-
Notifications
You must be signed in to change notification settings - Fork 99
/
header.php
399 lines (377 loc) · 18.5 KB
/
header.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
<?php if (!isset($imasroot)) {exit;} ?>
<!DOCTYPE html>
<?php if (isset($CFG['locale'])) {
echo '<html lang="'.$CFG['locale'].'">';
} else {
echo '<html lang="en">';
}
if (!isset($myrights)) {
$myrights = 0; // avoid errors in headercontent if not defined
}
//Look to see if a hook file is defined, and include if it is
if (isset($CFG['hooks']['header'])) {
require_once $CFG['hooks']['header'];
}
?>
<head>
<title><?php echo $installname; if (isset($pagetitle)) { echo " - $pagetitle";}?></title>
<meta http-equiv="X-UA-Compatible" content="IE=7, IE=Edge" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<?php
if (!empty($CFG['GEN']['uselocaljs'])) {
echo '<script src="'.$staticroot.'/javascript/jquery.min.js"></script>';
} else {
echo '<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js" integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>';
echo '<script>window.jQuery || document.write(\'<script src="'.$staticroot.'/javascript/jquery.min.js"><\/script>\')</script>';
}
if (empty($_SESSION['tzoffset']) && !empty($CFG['static_server'])) {
echo '<script src="'.$CFG['static_server'].'/javascript/staticcheck.js"></script>';
}
?>
<link rel="stylesheet" href="<?php echo $staticroot . "/imascore.css?ver=051824";?>" type="text/css" />
<?php
$isfw = false;
if (isset($coursetheme)) {
if (isset($flexwidth) || isset($usefullwidth)) {
$coursetheme = str_replace(array('_fw1920','_fw1000','_fw'),'',$coursetheme);
}
if (strpos($coursetheme,'_fw1920')!==false) {
$isfw = 1920;
$coursetheme = str_replace('_fw1920','',$coursetheme);
} else if (strpos($coursetheme,'_fw')!==false) {
$isfw = 1000;
$coursetheme = str_replace(array('_fw1000','_fw'),'',$coursetheme);
}
}
if (isset($CFG['GEN']['favicon'])) {
echo '<link rel="shortcut icon" href="'.$CFG['GEN']['favicon'].'" />';
} else {
echo '<link rel="shortcut icon" href="/favicon.ico" />';
}
if (isset($CFG['GEN']['appleicon'])) {
echo '<link rel="apple-touch-icon" href="'.$CFG['GEN']['appleicon'].'" />';
}
if (!empty($CFG['use_csrfp']) && class_exists('csrfProtector')) {
echo csrfProtector::output_header_code();
}
?>
<!--[if lte IE 6]>
<style>
div { zoom: 1; }
.clearlooks2, .clearlooks2 div { zoom: normal;}
.clear { line-height: 0;}
#GB_overlay, #GB_window {
position: absolute;
top: expression(0+((e=document.documentElement.scrollTop)?e:document.body.scrollTop)+'px');
left: expression(0+((e=document.documentElement.scrollLeft)?e:document.body.scrollLeft)+'px');}
}
</style>
<![endif]-->
<style type="text/css" media="print">
div.breadcrumb { display:none;}
#headerlogo { display:none;}
</style>
<script type="text/javascript">
var imasroot = '<?php echo $imasroot; ?>'; var cid = <?php echo (isset($cid) && is_numeric($cid))?$cid:0; ?>;
var staticroot = '<?php echo $staticroot; ?>';
</script>
<script type="text/javascript" src="<?php echo $staticroot;?>/javascript/general.js?v=100924"></script>
<?php
//$_SESSION['mathdisp'] = 3;
//
if (isset($CFG['locale'])) {
$lang = substr($CFG['locale'],0,2);
if (file_exists(rtrim(dirname(__FILE__), '/\\').'/i18n/locale/'.$lang.'/messages.js')) {
echo '<script type="text/javascript" src="'.$staticroot.'/i18n/locale/'.$lang.'/messages.js"></script>';
}
}
if (isset($coursetheme) && strpos($coursetheme,'_dark')!==false) {$mathdarkbg = true;} else {$mathdarkbg = false;}
if (isset($ispublic) && $ispublic && !isset($_SESSION['mathdisp'])) {
$_SESSION['mathdisp'] = 1;
$_SESSION['graphdisp'] = 1;
}
if (!isset($_SESSION['mathdisp'])) {
echo '<script type="text/javascript">var AMnoMathML = true;var ASnoSVG = true;var AMisGecko = 0;var AMnoTeX = false;var mathRenderer="none";</script>';
} else if ($_SESSION['mathdisp']==1 || $_SESSION['mathdisp']==3) {
//merged, eliminating original AsciiMath display; MathJax only now
if (isset($useeditor) && $_SESSION['useed']==1) {
echo '<script type="text/javascript">var AMTcgiloc = "'.$mathimgurl.'";</script>';
echo "<script src=\"$staticroot/javascript/ASCIIMathTeXImg_min.js?ver=111923\" type=\"text/javascript\"></script>\n";
}
if (isset($_SESSION['ltiitemtype'])) {
echo '<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function () {
sendLTIresizemsg();
});
MathJax.Hub.Register.MessageHook("End Process", sendLTIresizemsg);
</script>';
}
//Contrib not hosted in CDN yet
echo '<script type="text/x-mathjax-config">
MathJax.Hub.Config({"messageStyle": "none", asciimath2jax: {ignoreClass:"skipmathrender"}});
MathJax.Ajax.config.path["Local"] = "'.$staticroot.'/javascript/mathjax";
MathJax.Hub.config.extensions.push("[Local]/InputToDataAttrCDN.js");
MathJax.Hub.Register.StartupHook("AsciiMath Jax Ready", function () {
var AM = MathJax.InputJax.AsciiMath.AM;
AM.newsymbol({input: "o-", tag:"mo", output:"\u2296", ttype:AM.TOKEN.CONST});
AM.newsymbol({input: "ominus", tag:"mo", output:"\u2296", ttype:AM.TOKEN.CONST});
AM.newsymbol({input: "rightleftharpoons", tag:"mo", output:"\u21CC", ttype:AM.TOKEN.CONST});
AM.newsymbol({input: "hbar", tag:"mi", output:"\u210F", ttype:AM.TOKEN.CONST});
["arcsec","arccsc","arccot"].forEach(function(v) {
AM.newsymbol({input:v, tag:"mi", output:v, ttype:AM.TOKEN.UNARY, func:true});
});
});
</script>';
if (!empty($CFG['GEN']['uselocaljs'])) {
echo '<script type="text/javascript" async src="'.$staticroot.'/mathjax/MathJax.js?config=AM_CHTML-full"></script>';
} else {
echo '<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js?config=AM_CHTML-full"></script>';
}
echo '<script type="text/javascript">noMathRender = false; var usingASCIIMath = true; var AMnoMathML = true; var MathJaxCompatible = true;var mathRenderer="MathJax";
function rendermathnode(node,callback) {
if (window.MathJax) {
MathJax.Hub.Queue(["Typeset", MathJax.Hub, node]);
if (typeof callback == "function") {
MathJax.Hub.Queue(callback);
}
} else {
setTimeout(function() {rendermathnode(node, callback);}, 100);
}
}</script>';
echo '<style type="text/css">span.AM { font-size: 105%;} .mq-editable-field.mq-math-mode var { font-style: normal;}</style>';
} else if ($_SESSION['mathdisp']==7 || $_SESSION['mathdisp']==8) { // mathjax 3
if (isset($useeditor) && $_SESSION['useed']==1) {
echo '<script type="text/javascript">var AMTcgiloc = "'.$mathimgurl.'";</script>';
echo "<script src=\"$staticroot/javascript/ASCIIMathTeXImg_min.js?ver=111923\" type=\"text/javascript\"></script>\n";
}
// for autoload of a11y extension, add "a11y/semantic-enrich" to load, and put in options enrichSpeech: "shallow",
echo '<script>
window.MathJax = {
loader: {
load: ["input/asciimath", "output/chtml", "ui/menu"'.
(($_SESSION['mathdisp']==8) ? ',"a11y/semantic-enrich"' : '')
.']
},
options: {
ignoreHtmlClass: "skipmathrender",'.
(($_SESSION['mathdisp']==8) ? 'sre:{speech:"shallow"},' : '')
.'renderActions: {
addattr: [150,
function (doc) {for (math of doc.math) {MathJax.config.addDataAttr(math, doc)}},
function (math, doc) {MathJax.config.addDataAttr(math, doc)}
]
}
},
addDataAttr: function (math, doc) {
math.typesetRoot.setAttribute("data-asciimath", math.math);
},
startup: {
ready: function() {
var AM = MathJax.InputJax.AsciiMath.AM;
AM.newsymbol({input: "o-", tag:"mo", output:"\u2296", ttype:AM.TOKEN.CONST});
AM.newsymbol({input: "ominus", tag:"mo", output:"\u2296", ttype:AM.TOKEN.CONST});
AM.newsymbol({input: "rightleftharpoons", tag:"mo", output:"\u21CC", ttype:AM.TOKEN.CONST});
AM.newsymbol({input: "hbar", tag:"mi", output:"\u210F", ttype:AM.TOKEN.CONST});
["arcsec","arccsc","arccot"].forEach(function(v) {
AM.newsymbol({input:v, tag:"mi", output:v, ttype:AM.TOKEN.UNARY, func:true});
});
MathJax.startup.defaultReady();
}
}
};
</script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/startup.js" id="MathJax-script"></script>';
echo '<script type="text/javascript">noMathRender = false; var usingASCIIMath = true; var AMnoMathML = true; var MathJaxCompatible = true;var mathRenderer="MathJax";
function rendermathnode(node,callback) {
if (window.MathJax && window.MathJax.typesetPromise) {
if (typeof callback != "function") {
callback = function () {};
}
MathJax.typesetClear([node]);
MathJax.typesetPromise([node]).then(sendLTIresizemsg).then(callback);
} else {
setTimeout(function() {rendermathnode(node, callback);}, 100);
}
}</script>';
if (isset($_SESSION['ltiitemtype'])) {
echo '<script type="text/javascript">
MathJax.startup.promise = MathJax.startup.promise.then(sendLTIresizemsg);
</script>';
}
echo '<style type="text/css">span.AM { font-size: 105%;} </style>';
} else if ($_SESSION['mathdisp']==6) {
//Katex experimental
echo '<script type="text/javascript">var AMTcgiloc = "'.$mathimgurl.'";</script>';
echo "<script src=\"$staticroot/javascript/ASCIIMathTeXImg_min.js?ver=111923\" type=\"text/javascript\"></script>\n";
if (!empty($CFG['GEN']['uselocaljs'])) {
echo '<script src="'.$staticroot.'/katex/katex.min.js"></script>';
echo '<link rel="stylesheet" href="'.$staticroot.'/katex/katex.min.css" />';
//echo '<script type="text/javascript" async src="'.$imasroot.'/mathjax/MathJax.js?config=AM_CHTML-full"></script>';
} else {
echo '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.css" integrity="sha256-tVkQ3/3zHAr/iep04F8LJwgzNzJ2NzX8oHqg71BvzYU=" crossorigin="anonymous">';
echo '<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha256-6xggdIcWFnTnFwh8MX2xSsGmLa2uzMuAJJnOFzv+tzk=" crossorigin="anonymous"></script>';
//echo '<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js?config=AM_CHTML-full"></script>';
}
echo '<script type="text/javascript" src="'.$staticroot.'/katex/auto-render.js?v=073119"></script>';
echo '<script type="text/javascript">setupKatexAutoRender();</script>';
echo '<script type="text/javascript">noMathRender = false; var usingASCIIMath = true; var AMnoMathML = true; var MathJaxCompatible = true; var mathRenderer = "Katex";</script>';
//echo '<style type="text/css">span.AM { font-size: 105%;}</style>';
} else if ($_SESSION['mathdisp']==2 && isset($useeditor) && $_SESSION['useed']==1) {
//these scripts are used by the editor to make image-based math work in the editor
echo '<script type="text/javascript">var AMTcgiloc = "'.$mathimgurl.'";';
if ($mathdarkbg) {echo 'var mathbg = "dark";';}
echo '</script>';
echo "<script src=\"$staticroot/javascript/ASCIIMathTeXImg_min.js?ver=111923\" type=\"text/javascript\"></script>\n";
echo "<script type=\"text/javascript\">var usingASCIIMath = false; var AMnoMathML=true; var MathJaxCompatible = false; var mathRenderer=\"Image\"; function rendermathnode(el,callback) {AMprocessNode(el); if(typeof callback=='function'){callback();}}</script>";
} else if ($_SESSION['mathdisp']==2) {
echo "<script type=\"text/javascript\">var usingASCIIMath = false; var AMnoMathML=true; var MathJaxCompatible = false; var mathRenderer=\"Image\";function rendermathnode(el,callback) {AMprocessNode(el);} if(typeof callback=='function'){callback();}</script>";
} else if ($_SESSION['mathdisp']==0) {
echo "<script type=\"text/javascript\">var usingASCIIMath = false; var AMnoMathML=true; var MathJaxCompatible = false; var mathRenderer=\"none\";function rendermathnode(el,callback) {if(typeof callback=='function'){callback();}}</script>";
}
echo "<script src=\"$staticroot/javascript/mathjs.js?v=20230729\" type=\"text/javascript\"></script>\n";
if (isset($_SESSION['graphdisp']) && $_SESSION['graphdisp']==1) {
echo "<script src=\"$staticroot/javascript/ASCIIsvg_min.js?ver=112623\" type=\"text/javascript\"></script>\n";
echo "<script type=\"text/javascript\">var usingASCIISvg = true;</script>";
//echo "<script src=\"$imasroot/course/editor/plugins/AsciiSvg/ASCIIsvgAddon.js\" type=\"text/javascript\"></script>\n";
} else if (isset($_SESSION['graphdisp'])) {
echo "<script type=\"text/javascript\">var usingASCIISvg = false; var ASnoSVG=true;</script>";
}
if (isset($useeditor) && $_SESSION['useed']==1) {
echo '<script type="text/javascript" src="'.$staticroot.'/tinymce4/tinymce_bundled.min.js?v=021324"></script>';
//echo '<script type="text/javascript" src="'.$imasroot.'/tinymce4/tinymce.js?v=062821"></script>';
echo "\n";
echo '<script type="text/javascript">';
echo 'var coursetheme = "'.$coursetheme.'";';
echo 'var tinymceUseSnippets = '.($myrights>10?1:0).';';
if (!isset($CFG['GEN']['noFileBrowser'])) {
echo 'var filePickerCallBackFunc = filePickerCallBack;';
} else {
echo 'var filePickerCallBackFunc = null;';
}
if ($useeditor!="noinit") {
echo 'initeditor("exact","'.$useeditor.'");';
}
echo '</script>';
}
if ((isset($useeditor) && $_SESSION['useed']==1) || isset($loadiconfont)) {
echo '<link rel="stylesheet" href="'.$staticroot . '/iconfonts/imathasfont.css?v=013118" type="text/css" />';
echo '<!--[if lte IE 7]><link rel="stylesheet" href="'.$staticroot . '/iconfonts/imathasfontie7.css?v=013118" type="text/css" /><![endif]-->';
}
if (isset($placeinhead)) {
echo $placeinhead;
}
$curdir = rtrim(dirname(__FILE__), '/\\');
if (isset($CFG['GEN']['headerscriptinclude'])) {
require_once "$curdir/{$CFG['GEN']['headerscriptinclude']}";
}
if (function_exists('insertIntoHead')) {
insertIntoHead();
}
if (isset($coursetheme)) {
echo '<link rel="stylesheet" href="'. $staticroot . "/themes/$coursetheme?v=042217\" type=\"text/css\" />";
}
echo '<link rel="stylesheet" href="'. $staticroot . '/handheld.css?v=071320" media="only screen and (max-width:480px)"/>';
if (isset($CFG['GEN']['translatewidgetID'])) {
echo '<meta name="google-translate-customization" content="'.$CFG['GEN']['translatewidgetID'].'"></meta>';
}
if (isset($_SESSION['ltiitemtype'])) {
echo '<script type="text/javascript">
if (typeof mathRenderer != "undefined" && mathRenderer == "Katex") {
window.katexDoneCallback = sendLTIresizemsg;
} else {
jQuery(sendLTIresizemsg);
}
</script>';
}
echo "</head>\n";
if ($isfw!==false) {
echo "<body class=\"fw$isfw\">\n";
} else {
echo "<body class=\"notfw\">\n";
}
echo '<div class="mainbody">';
$insertinheaderwrapper = ' '; //"<h1>$coursename</h1>";
if (isset($insertinheaderwrapper)) {
//echo '<div class="headerwrapper">'.$insertinheaderwrapper.'</div>';
}
if (!isset($flexwidth) && !isset($hideAllHeaderNav)) {
echo '<div class="headerwrapper">';
}
if (isset($CFG['GEN']['headerinclude']) && !isset($flexwidth) && !isset($hideAllHeaderNav)) {
$prepend = '/' == substr($CFG['GEN']['headerinclude'], 0, 1) ? '' : $curdir;
require_once "$prepend/{$CFG['GEN']['headerinclude']}";
}
$didnavlist = false; $essentialsnavcnt = 0;
function getactivetab() {
$a = 'course';
$path = $_SERVER['PHP_SELF'];
if (strpos($path,'/msgs/')!==false) {
$a = 'msg';
} else if (strpos($path,'/forums/')!==false) {
$a = 'forum';
} else if (strpos($path,'showcalendar.php')!==false) {
$a = 'cal';
} else if (strpos($path,'grade')!==false || strpos($path,'/gb')!==false) {
$a = 'gb';
} else if (strpos($path,'listusers')!==false || strpos($path,'/latepass')!==false) {
$a = 'roster';
}
return $a;
}
if (!empty($cid) && !isset($flexwidth) && !isset($hideAllHeaderNav) && !isset($nocoursenav)) {
echo '<div id="navlistcont" role="navigation" aria-label="'._('Course Navigation').'">';
echo '<ul id="navlist">';
$a = array('course'=>'', 'msg'=>'', 'forum'=>'', 'cal'=>'', 'gb'=>'', 'roster'=>'');
$c = getactivetab();
$a[$c] = 'class="activetab"';
echo "<li><a {$a['course']} href=\"$imasroot/course/course.php?cid=$cid\">",_('Course'),"</a></li> ";
if (isset($coursemsgset) && $coursemsgset<4) { //messages
echo "<li><a {$a['msg']} href=\"$imasroot/msgs/msglist.php?cid=$cid\">",_('Messages'),"</a></li> ";
}
if (isset($coursetoolset) && ($coursetoolset&2)==0) { //forums
echo "<li><a {$a['forum']} href=\"$imasroot/forums/forums.php?cid=$cid\">",_('Forums'),"</a></li>";
}
if (isset($teacherid)) { //Roster
echo "<li><a {$a['roster']} href=\"$imasroot/course/listusers.php?cid=$cid\">",_('Roster'),"</a></li>\n";
}
if (isset($coursetoolset) && ($coursetoolset&1)==0) { //Calendar
echo "<li><a {$a['cal']} href=\"$imasroot/course/showcalendar.php?cid=$cid\">",_('Calendar'),"</a></li>\n";
}
if (isset($coursetoolset) && ($coursetoolset&4)==0) {
echo "<li><a {$a['gb']} href=\"$imasroot/course/gradebook.php?cid=$cid\">",_('Gradebook'),"</a></li>"; //Gradebook
}
if (!isset($haslogout)) { //Log out
echo "<li><a href=\"$imasroot/actions.php?action=logout\">",_('Log Out'),"</a></li>";
}
echo '</ul>';
echo '<div class="clear"></div>';
echo '</div>';
$didnavlist = true;
}
if (!isset($flexwidth) && !isset($hideAllHeaderNav)) {
echo '</div>';
}
echo '<div class="midwrapper" role="main">';
//load filter
$curdir = rtrim(dirname(__FILE__), '/\\');
require_once "$curdir/filter/filter.php";
//CUSTOMIZE: put a small (max 120px wide) logo on upper right of course pages
if (!isset($nologo) && !empty($smallheaderlogo)) {
echo '<div id="headerlogo" class="hideinmobile" ';
if (isset($myrights) && $myrights>10 && !$ispublic && !isset($_SESSION['ltiitemtype'])) {
echo 'onclick="mopen(\'homemenu\',';
if (isset($cid) && is_numeric($cid)) {
echo $cid;
} else {
echo 0;
}
echo ')" onmouseout="mclosetime()"';
}
echo '>'.$smallheaderlogo.'</div>';
if (isset($myrights) && $myrights>10 && !$ispublic && !isset($_SESSION['ltiitemtype'])) {
echo '<div id="homemenu" class="ddmenu" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">';
echo '</div>';
}
}
?>