forked from francoisjacquet/rosariosis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Help.php
129 lines (94 loc) · 2.38 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
<?php
/**
* Help
*
* Generate the Help / Handbook PDF
* Translated if locale/[code]/Help.php file exists
* Based on user profile
*
* @package RosarioSIS
*/
require_once 'Warehouse.php';
require_once 'Menu.php';
require_once 'ProgramFunctions/Help.fnc.php';
$profiles = [
'admin' => _( 'Administrator' ),
'teacher' => _( 'Teacher' ),
'parent' => _( 'Parent' ),
'student' => _( 'Student' ),
];
$title = $profiles[ User( 'PROFILE' ) ];
$handle = PDFStart(); ?>
<style>.header2{ font-size: larger; }</style>
<div class="header1">
<h2><img src="assets/themes/<?php echo Preferences( 'THEME' ); ?>/logo.png" class="module-icon" />
<?php echo sprintf( _( '%s Handbook' ), $title ); ?></h2>
</div>
<?php
$help = HelpLoad();
$old_modcat = '';
$non_core_modules = array_diff_key( $RosarioModules, array_flip( $RosarioCoreModules ) );
foreach ( (array) $help as $program => $value ) :
// 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.
{
continue;
}
if ( $modcat != $old_modcat
&& $modcat != 'Custom' ) : ?>
<div style="page-break-after: always;"></div>
<?php
unset( $_ROSARIO['DrawHeader'] );
$_ROSARIO['HeaderIcon'] = $modcat;
$modcat_title = _( str_replace( '_', ' ', $modcat ) );
if ( in_array( $modcat, $non_core_modules ) )
{
$modcat_title = dgettext( $modcat, str_replace( '_', ' ', $modcat ) );
}
if ( ! empty( $_ROSARIO['Menu'][ $modcat ]['title'] ) )
{
$modcat_title = $_ROSARIO['Menu'][ $modcat ]['title'];
}
DrawHeader( $modcat_title );
endif;
if ( $modcat != 'Custom' )
{
$old_modcat = $modcat;
}
}
?>
<div style="page-break-inside: avoid;">
<h3>
<?php
if ( $program == 'default' )
{
echo ParseMLField( Config( 'TITLE' ) ) . ' ' . ROSARIO_VERSION;
}
else
echo ( ProgramTitle() == 'RosarioSIS' ? $program : ProgramTitle() );
?>
</h3>
<div class="header2">
<?php
$help_text = GetHelpText( $program );
echo $help_text;
?>
</div>
</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 );