forked from francoisjacquet/rosariosis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelp.php
178 lines (137 loc) · 3.2 KB
/
Help.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?php
/**
* Help
*
* Generate the Help / Handbook PDF
* Translated if Help_[2_letters_locale].php file exists
* Based on user profile
*
* @package RosarioSIS
*/
require_once 'Warehouse.php';
$help_translated = 'Help_' . mb_substr( $locale, 0, 2 ) . '.php';
$help_english = 'Help_en.php';
if ( file_exists( $help_translated ) ) // FJ translated help.
{
require_once $help_translated;
}
else
require_once $help_english;
// FJ add help for non-core modules.
$non_core_modules = array_diff( array_keys( $RosarioModules ), $RosarioCoreModules );
foreach ( (array) $non_core_modules as $non_core_module )
{
$non_core_dir = 'modules/' . $non_core_module . '/';
if ( file_exists( $non_core_dir . $help_translated ) ) // FJ translated help.
{
require_once $non_core_dir . $help_translated;
}
elseif ( file_exists( $non_core_dir . $help_english ) )
{
require_once $non_core_dir . $help_english;
}
}
switch ( User( 'PROFILE' ) )
{
case 'admin':
$title = _( 'Administrator' );
break;
case 'teacher':
$title = _( 'Teacher' );
break;
case 'parent':
$title = _( 'Parent' );
break;
case 'student':
$title = _( 'Student' );
break;
}
$handle = PDFStart(); ?>
<style>.header2{ font-size: larger; }</style>
<table>
<tr>
<td>
<img src="assets/themes/<?php echo Preferences( 'THEME' ); ?>/logo.png" class="logo" />
</td>
<td>
<h1> <?php echo sprintf( _( '%s Handbook' ), $title ); ?></h1>
</td>
</tr>
</table>
<hr />
<?php
foreach ( (array) $help as $program => $value ) :
// FJ zap programs which are not allowed.
if ( $program !== 'default'
&& ! AllowUse( $program ) )
{
continue;
}
$_REQUEST['modname'] = $program;
if ( mb_strpos( $program, '/' ) )
{
$modcat = mb_substr( $program, 0, mb_strpos( $program, '/' ) );
if ( ! $RosarioModules[ $modcat ] ) // Module not activated.
{
break;
}
if ( $modcat != $old_modcat
&& $modcat != 'Custom' ) : ?>
<div style="page-break-after: always;"></div>
<?php
unset( $_ROSARIO['DrawHeader'] );
$_ROSARIO['HeaderIcon'] = 'modules/' . $modcat . '/icon.png';
$modcat_echo = str_replace( '_', ' ', $modcat );
echo DrawHeader( _( $modcat_echo ) );
?>
<hr />
<?php
endif;
if ( $modcat != 'Custom' )
{
$old_modcat = $modcat;
}
}
?>
<div style="page-break-inside: avoid;">
<h3>
<?php
if ( $program == 'default' )
{
echo ParseMLField( Config( 'TITLE' ) )
. ' - ' . sprintf( _( '%s Handbook' ), $title ) . '<br />'
. sprintf( _( 'version %s' ), '1.1' );
}
else
echo ( ProgramTitle() == 'RosarioSIS' ? $program : ProgramTitle() );
?>
</h3>
<table class="width-100p">
<tr>
<td class="header2">
<?php
if ( User( 'PROFILE' ) == 'student' )
{
// Note: for other languages, this is hard to translate.
// Please use the general term "student" instead of child!
$value = str_replace(
'your child',
'yourself',
str_replace( 'your child\'s', 'your', $value )
);
}
$value = str_replace( 'RosarioSIS', Config( 'NAME' ), $value );
echo $value;
?>
</td>
</tr>
</table>
</div>
<br />
<?php endforeach; ?>
<div class="center">
<b><a href="https://www.rosariosis.org/">https://www.rosariosis.org/</a></b>
</div>
<?php
$_REQUEST['modname'] = '';
PDFStop( $handle );