-
Notifications
You must be signed in to change notification settings - Fork 1
/
Side.php
executable file
·627 lines (554 loc) · 32 KB
/
Side.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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
<?php
#**************************************************************************
# openSIS is a free student information system for public and non-public
# schools from Open Solutions for Education, Inc. web: www.os4ed.com
#
# openSIS is web-based, open source, and comes packed with features that
# include student demographic info, scheduling, grade book, attendance,
# report cards, eligibility, transcripts, parent portal,
# student portal and more.
#
# Visit the openSIS web site at http://www.opensis.com to learn more.
# If you have question regarding this system or the license, please send
# an email to info@os4ed.com.
#
# This program is released under the terms of the GNU General Public License as
# published by the Free Software Foundation, version 2 of the License.
# See license.txt.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#***************************************************************************************
$var1= explode("?",$_SERVER['REQUEST_URI']);
include("functions/ParamLib.php");
$url=validateQueryString($var1[1]);
if($url===FALSE || !$var1[1]){
header('Location: index.php');
}
//echo $_SERVER['REQUEST_URI'];
//exit;
error_reporting(1);
include "./Warehouse.php";
$tmp_REQUEST = $_REQUEST;
$_SESSION['Side_PHP_SELF'] = "Side.php";
$old_school = UserSchool();
$old_syear = UserSyear();
$old_period = UserCoursePeriod();
//$btnn = $_REQUEST['btnn'];
$btnn =optional_param('btnn','',PARAM_SPCL);
//$nsc = $_REQUEST['nsc'];
$nsc = optional_param('nsc','',PARAM_SPCL);
unset($_SESSION['smc']);
unset($_SESSION['g']);
unset($_SESSION['p']);
unset($_SESSION['smn']);
unset($_SESSION['sm']);
unset($_SESSION['sma']);
unset($_SESSION['smv']);
unset($_SESSION['s']);
unset($_SESSION['_search_all']);
unset($_SESSION['custom_count_sql']);
unset($_SESSION['inactive_stu_filter']);
unset($_SESSION['new_sql']);
unset($_SESSION['newsql']);
unset($_SESSION['newsql1']);
if(isset($_SESSION['stu_search']['sql'])){
unset($_SESSION['stu_search']);
}
if(isset ($_SESSION['staf_search']['sql'])){
unset ($_SESSION['staf_search']['sql']);
}
//if(($_REQUEST['school'] && $_REQUEST['school']!=$old_school) || ($_REQUEST['period'] && $_REQUEST['period']!=$old_period))
if((optional_param('school','',PARAM_SPCL) && optional_param('school','',PARAM_SPCL)!=$old_school) || (optional_param('period','',PARAM_SPCL) && optional_param('period','',PARAM_SPCL)!=$old_period))
{
unset($_SESSION['student_id']);
$_SESSION['unset_student'] = true;
unset($_SESSION['staff_id']);
//unset($_SESSION['UserMP']);
unset($_REQUEST['mp']);
}
//if($_REQUEST['modfunc']=='update' && $_POST)
if(optional_param('modfunc','',PARAM_SPCL)=='update' && $_POST)
{
//===================
//if(User('PROFILE')=='teacher' &&($_REQUEST['school']!=$old_school || $nsc=='NT'))
if(User('PROFILE')=='teacher' &&(optional_param('school','',PARAM_SPCL)!=$old_school || $nsc=='NT'))
{
//echo 'pinki'; exit;
//if($_REQUEST['act']=='school')
if(optional_param('act','',PARAM_SPCL)=='school')
{
//$_SESSION['UserSchool'] = $_REQUEST['school'];
$_SESSION['UserSchool'] = optional_param('school','',PARAM_SPCL);
DBQuery("UPDATE staff SET CURRENT_SCHOOL_ID='".UserSchool()."' WHERE STAFF_ID='".User('STAFF_ID')."'");
unset($_SESSION['UserSyear']);
unset($_SESSION['UserMP']);
unset($_SESSION['UserSubject']);
unset($_SESSION['UserCourse']);
unset($_SESSION['UserCoursePeriod']);
$school_years_RET=DBGet(DBQuery("SELECT MAX(sy.SYEAR) AS SYEAR FROM school_years sy,staff s INNER JOIN staff_school_relationship ssr USING(staff_id) WHERE ssr.school_id=sy.school_id AND sy.syear=ssr.syear AND sy.SCHOOL_ID=".UserSchool()." AND STAFF_ID='$_SESSION[STAFF_ID]'"));
$_SESSION['UserSyear']=$school_years_RET[1]['SYEAR'];
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_quarters WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
if(!isset($_SESSION['UserMP']))
{
$_SESSION['UserMP'] = GetCurrentMP('QTR',DBDate());
}
if(!$RET)
{
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_semesters WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "' ORDER BY SORT_ORDER"));
if (!isset($_SESSION['UserMP'])) {
$_SESSION['UserMP'] = GetCurrentMP('SEM', DBDate());
}
}
if(!$RET)
{
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_years WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
if (!isset($_SESSION['UserMP'])) {
$_SESSION['UserMP'] = GetCurrentMP('FY', DBDate());
}
}
//echo $_SESSION['UserSyear']; exit; //pinki
}
//elseif($_REQUEST['act']=='syear')
elseif(optional_param('act','',PARAM_SPCL)=='syear')
{
unset($_SESSION['student_id']);
unset($_SESSION['_REQUEST_vars']['student_id']);
$_SESSION['UserSyear'] = optional_param('syear','',PARAM_SPCL);
unset($_SESSION['UserMP']);
unset($_SESSION['UserSubject']);
unset($_SESSION['UserCourse']);
unset($_SESSION['UserCoursePeriod']);
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_quarters WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
if(!isset($_SESSION['UserMP']))
{
$_SESSION['UserMP'] = GetCurrentMP('QTR',DBDate());
}
if(!$RET)
{
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_semesters WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "' ORDER BY SORT_ORDER"));
if (!isset($_SESSION['UserMP'])) {
$_SESSION['UserMP'] = GetCurrentMP('SEM', DBDate());
}
}
if(!$RET)
{
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_years WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
if (!isset($_SESSION['UserMP'])) {
$_SESSION['UserMP'] = GetCurrentMP('FY', DBDate());
}
}
}
//elseif($_REQUEST['act']=='mp')
elseif(optional_param('act','',PARAM_SPCL)=='mp')
{
$_SESSION['UserMP'] = optional_param('mp','',PARAM_SPCL);
unset($_SESSION['UserSubject']);
unset($_SESSION['UserCourse']);
unset($_SESSION['UserCoursePeriod']);
}
//elseif($_REQUEST['act']=='subject')
elseif(optional_param('act','',PARAM_SPCL)=='subject')
{
$_SESSION['UserSubject'] = optional_param('subject','',PARAM_SPCL);
unset($_SESSION['UserCourse']);
unset($_SESSION['UserCoursePeriod']);
}
//elseif($_REQUEST['act']=='course')
elseif(optional_param('act','',PARAM_SPCL)=='course')
{
$_SESSION['UserCourse'] =clean_param($_REQUEST['course'],PARAM_NOTAGS);
unset($_SESSION['UserCoursePeriod']);
}
//elseif($_REQUEST['act']=='period')
elseif(optional_param('act','',PARAM_SPCL)=='period')
{
$_SESSION['UserCoursePeriod'] =optional_param('period','',PARAM_SPCL);
}
}
//===================
if (User('PROFILE') == 'admin' && (clean_param($_REQUEST['school'], PARAM_NOTAGS) != $old_school || $nsc == 'NT'))
{
if ($_POST['school'])
{
$_SESSION['UserSchool'] = clean_param($_REQUEST['school'], PARAM_NOTAGS);
DBQuery("UPDATE staff SET CURRENT_SCHOOL_ID='" . UserSchool() . "' WHERE STAFF_ID='" . $_SESSION['STAFF_ID']. "'");
unset($_SESSION['UserSyear']);
unset($_SESSION['UserMP']);
$school_years_RET=DBGet(DBQuery("SELECT MAX(sy.SYEAR) AS SYEAR FROM school_years sy,staff_school_relationship ssr WHERE ssr.SYEAR=sy.SYEAR AND sy.SCHOOL_ID=".UserSchool()." AND ssr.STAFF_ID='$_SESSION[STAFF_ID]'"));
$_SESSION['UserSyear']=$school_years_RET[1]['SYEAR'];
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_quarters WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
if(!isset($_SESSION['UserMP']))
{
$_SESSION['UserMP'] = GetCurrentMP('QTR',DBDate());
}
if(!$RET)
{
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_semesters WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "' ORDER BY SORT_ORDER"));
if (!isset($_SESSION['UserMP'])) {
$_SESSION['UserMP'] = GetCurrentMP('SEM', DBDate());
}
}
if(!$RET)
{
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_years WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
if (!isset($_SESSION['UserMP'])) {
$_SESSION['UserMP'] = GetCurrentMP('FY', DBDate());
}
}
}
elseif ($_POST['syear'])
{
unset($_SESSION['student_id']);
unset($_SESSION['_REQUEST_vars']['student_id']);
$_SESSION['UserSyear'] = optional_param('syear', '', PARAM_SPCL);
unset($_SESSION['UserMP']);
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_quarters WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
if(!isset($_SESSION['UserMP']))
{
$_SESSION['UserMP'] = GetCurrentMP('QTR',DBDate());
}
if(!$RET)
{
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_semesters WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
if(!isset($_SESSION['UserMP']))
{
$_SESSION['UserMP'] = GetCurrentMP('SEM',DBDate());
}
}
if(!$RET)
{
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_years WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
if(!isset($_SESSION['UserMP']))
{
$_SESSION['UserMP'] = GetCurrentMP('FY',DBDate());
}
}
}
elseif ($_POST['mp'])
{
$_SESSION['UserMP'] = optional_param('mp', '', PARAM_SPCL);
}
}
// if(User('PROFILE')=='admin' && $nsc=='TT')
// {
// // --------------------------------------------------------------- School Session Assign ------------------------------------------------------------------ //
// $QI = DBQuery("SELECT ID,TITLE FROM schools ORDER BY ID DESC");
// $RET = DBGet($QI);
// //print_r($RET);
// //echo $RET[1]['ID'];
// //echo "<br>";
// //echo $RET[1]['TITLE'];
// // --------------------------------------------------------------- School Session Assign ------------------------------------------------------------------ //
// //$_SESSION['UserSchool'] = $_REQUEST['school'];
// $_SESSION['UserSchool'] = $RET[1]['ID'];
// DBQuery("UPDATE staff SET CURRENT_SCHOOL_ID='".UserSchool()."' WHERE STAFF_ID='".User('STAFF_ID')."'");
// }
// if(User('PROFILE')=='admin')
// {
// $school_years=DBGet(DBQuery("SELECT SYEAR FROM school_years WHERE SCHOOL_ID=".UserSchool()));
// if(count($school_years)>1)
// //$_SESSION['UserSyear'] = $_REQUEST['syear'];
// $_SESSION['UserSyear'] = optional_param('syear','',PARAM_SPCL);
// else
// $_SESSION['UserSyear'] = $school_years[1]['SYEAR'];
// }
// else
// //$_SESSION['UserSyear'] = $_REQUEST['syear'];
// $_SESSION['UserSyear'] = optional_param('syear','',PARAM_SPCL);
//
// // $_SESSION['UserCoursePeriod'] = $_REQUEST['period']
// $_SESSION['UserCoursePeriod'] = optional_param('period','',PARAM_SPCL);
//
// //if($_REQUEST['mp'])
// if(optional_param('mp','',PARAM_SPCL))
// //$_SESSION['UserMP'] = $_REQUEST['mp'];
// $_SESSION['UserMP'] = optional_param('mp','',PARAM_SPCL);
if (User('PROFILE') == 'parent' || User('PROFILE')=='student')
{
if ($_POST['syear'])
{
$_SESSION['UserSyear'] = optional_param('syear', '', PARAM_SPCL);
unset ($_SESSION['UserMP']);
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_quarters WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
if(!isset($_SESSION['UserMP']))
{
$_SESSION['UserMP'] = GetCurrentMP('QTR',DBDate());
}
if(!$RET)
{
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_semesters WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
if(!isset($_SESSION['UserMP']))
{
$_SESSION['UserMP'] = GetCurrentMP('SEM',DBDate());
}
}
if(!$RET)
{
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_years WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
if(!isset($_SESSION['UserMP']))
{
$_SESSION['UserMP'] = GetCurrentMP('FY',DBDate());
}
}
}
elseif($_POST['student_id'])
{
unset ($_SESSION['UserMP']);
$_SESSION['student_id'] = optional_param('student_id', '', PARAM_ALPHANUM);
}
elseif($_POST['mp'])
{
$_SESSION['UserMP'] = optional_param('mp', '', PARAM_SPCL);
}
//if($_SESSION['student_id']!=$_REQUEST['student_id'])
// if ($_SESSION['student_id'] != optional_param('student_id', '', PARAM_ALPHANUM))
// unset($_SESSION['UserMP']);
//$_SESSION['student_id'] = $_REQUEST['student_id'];
}
$ses_modname['vars']['modname']='misc/Portal.php';
unset($_SESSION['_REQUEST_vars']);
echo "<script language=javascript>parent.body.location='".str_replace('&','&',PreparePHP_SELF($ses_modname['vars']))."';</script>";
}//---------------------------- Updaet End-------------------------------------------
//if(!$_SESSION['UserSyear'])
// $_SESSION['UserSyear'] = $DefaultSyear;
if(!$_SESSION['student_id'] && User('PROFILE')=='student')
$_SESSION['student_id'] = $_SESSION['STUDENT_ID'];
if(!$_SESSION['UserSchool'])
{
if(User('PROFILE')=='admin' && (!User('SCHOOLS') || strpos(User('SCHOOLS'),','.User('CURRENT_SCHOOL_ID').',')!==false))
$_SESSION['UserSchool'] = User('CURRENT_SCHOOL_ID');
elseif(User('PROFILE')=='student')
$_SESSION['UserSchool'] = trim(User('SCHOOLS'),',');
elseif(User('PROFILE')=='teacher')
{
$mp = GetAllMP('QTR',UserMP());
if(!isset($mp))
$mp = GetAllMP('SEM',UserMP());
if(!isset($mp))
$mp = GetAllMP('FY',UserMP());
$QI = DBQuery("SELECT cp.SCHOOL_ID FROM course_periods cp, school_periods sp,courses c WHERE c.COURSE_ID=cp.COURSE_ID AND cp.PERIOD_ID=sp.PERIOD_ID AND cp.SYEAR='".UserSyear()."' AND cp.TEACHER_ID='".User('STAFF_ID')."''".(UserMP()?' AND cp.MARKING_PERIOD_ID IN ('.$mp.')':'')."' ORDER BY sp.SORT_ORDER LIMIT 1");
$RET = DBGet($QI);
$_SESSION['UserSchool'] = $RET[1]['SCHOOL_ID'];
}
}
/*if((!$_SESSION['UserMP'] || ($_REQUEST['school'] && $_REQUEST['school'] != $old_school) || ($_REQUEST['syear'] && $_REQUEST['syear'] != $old_syear) || ($_REQUEST['period'] && $_REQUEST['period'] != $old_period)) && User('PROFILE')!='parent'){
$_SESSION['UserMP'] = GetCurrentMP('QTR',DBDate());
}*/
//if(($_REQUEST['school'] && $_REQUEST['school'] != $old_school) || ($_REQUEST['syear'] && $_REQUEST['syear'] != $old_syear))
if((optional_param('school','',PARAM_SPCL) && optional_param('school','',PARAM_SPCL) != $old_school) || (optional_param('syear','',PARAM_SPCL) && optional_param('syear','',PARAM_SPCL) != $old_syear))
{
unset($_SESSION['UserPeriod']);
unset($_SESSION['UserCoursePeriod']);
}
//if($_REQUEST['student_id']=='new')
if(optional_param('student_id','',PARAM_ALPHANUM)=='new')
{
unset($_SESSION['student_id']);
unset($_SESSION['_REQUEST_vars']['student_id']);
unset($_SESSION['_REQUEST_vars']['search_modfunc']);
#------------- New added ----------------------------#
if($_SESSION['_REQUEST_vars']['modfunc']=='choose_course')
unset($_SESSION['_REQUEST_vars']['modfunc']);
#------------- New added ----------------------------#
#------------- New added on 09.12.2011 For removing old date----------------------------#
if($_SESSION['_REQUEST_vars']['modname']=='Attendance/Administration.php')
{
unset($_SESSION['_REQUEST_vars']['month_date']);
unset($_SESSION['_REQUEST_vars']['day_date']);
unset($_SESSION['_REQUEST_vars']['year_date']);
}
#------------- New added on 09.12.2011 ----------------------------#
echo "<script language=javascript>parent.body.location='".str_replace('&','&',PreparePHP_SELF($_SESSION['_REQUEST_vars']))."';</script>";
}
//if($_REQUEST['student_id']=='new')
if(optional_param('school_id','',PARAM_ALPHANUM)=='new')
{
unset($_SESSION['UserSchool']);
echo "<script language=javascript>parent.body.location='".str_replace('&','&',PreparePHP_SELF($_SESSION['_REQUEST_vars']))."';</script>";
/*
unset($_SESSION['student_id']);
unset($_SESSION['_REQUEST_vars']['student_id']);
unset($_SESSION['_REQUEST_vars']['search_modfunc']);
*/
}
//if($_REQUEST['staff_id']=='new')
if(optional_param('staff_id','',PARAM_ALPHANUM)=='new')
{
unset($_SESSION['miss_attn']);
unset($_SESSION['staff_id']);
unset($_SESSION['_REQUEST_vars']['staff_id']);
unset($_SESSION['_REQUEST_vars']['search_modfunc']);
$usr_modname['vars']['modname']=$_SESSION['_REQUEST_vars']['modname'];
unset($_SESSION['_REQUEST_vars']);
echo "<script language=javascript>parent.body.location='".str_replace('&','&',PreparePHP_SELF($usr_modname['vars']))."';</script>";
}
unset($_REQUEST['modfunc']);
echo "
<HTML>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />
<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />
<link rel=stylesheet type=\"text/css\" href=\"assets/stylesheet.css\">
<script language=\"JavaScript\" type=\"text/javascript\">
</script>
<title>".Config('TITLE')."</title>
</head>
<BODY background=assets/themes/".Preferences('THEME')."/bg.jpg leftmargin=6 marginwidth=4 topmargin=0 ".(clean_param($_REQUEST['modcat'],PARAM_NOTAGS)?"onload=openMenu('".clean_param($_REQUEST['modcat'],PARAM_NOTAGS)."');":'').">";
// User Information
echo "<TABLE border=0 cellpadding=0 cellspacing=0 width=100%><TR><TD height=30>";
echo '<A HREF=index.php target=_top>'.DrawPNG('themes/'.Preferences('THEME').'/logo.png','border=0 width=160').'</A>';
echo "</TD></TR><TR>";
echo "<TD class=BoxContents style='border: inset #C9C9C9 2px; background-image:url(\"assets/bg.gif\")' width=100% valign=top>
<FORM action=Side.php?modfunc=update method=POST>
<INPUT type=hidden name=modcat value='' id=modcat_input>
<b>".User('NAME')."</b>
<BR>".date('l F j, Y')."
<BR>";
if(User('PROFILE')=='admin')
{
$schools = substr(str_replace(",","','",User('SCHOOLS')),2,-2);
$QI = DBQuery("SELECT ID,TITLE FROM schools".($schools?" WHERE ID IN ($schools)":''));
$RET = DBGet($QI);
// if(!UserSchool())
// {
// $_SESSION['UserSchool'] = $RET[1]['ID'];
// DBQuery("UPDATE staff SET CURRENT_SCHOOL_ID='".UserSchool()."' WHERE STAFF_ID='".User('STAFF_ID')."'");
// }
echo "<SELECT name=school onChange='document.forms[0].submit();' style='width:150;'>";
foreach($RET as $school)
echo "<OPTION value=$school[ID]".((UserSchool()==$school['ID'])?' SELECTED':'').">".$school['TITLE']."</OPTION>";
echo "</SELECT><BR>";
}
if(1)
{
if(User('PROFILE')!='student')
$sql = "SELECT DISTINCT sy.SYEAR FROM school_years sy,staff s,staff_school_relationship ssr, login_authentication la WHERE s.STAFF_ID=la.USER_ID AND s.PROFILE_ID=la.PROFILE_ID AND ssr.SYEAR=sy.SYEAR AND s.STAFF_ID=ssr.STAFF_ID AND la.USERNAME=(SELECT USERNAME FROM login_authentication WHERE s.STAFF_ID='$_SESSION[STAFF_ID]' AND PROFILE_ID='$_SESSION[PROFILE_ID]')";
else
$sql = "SELECT DISTINCT sy.SYEAR FROM school_years sy,student_enrollment se WHERE se.SYEAR=sy.SYEAR AND se.STUDENT_ID='$_SESSION[STUDENT_ID]'";
$years_RET = DBGet(DBQuery($sql));
}
else
$years_RET = array(1=>array('SYEAR'=>"$DefaultSyear"));
echo "<SELECT name=syear onChange='document.forms[0].submit();'>";
foreach($years_RET as $year)
echo "<OPTION value=$year[SYEAR]".((UserSyear()==$year['SYEAR'])?' SELECTED':'').">$year[SYEAR]-".($year['SYEAR']+1)."</OPTION>";
echo '</SELECT><BR>';
if(User('PROFILE')=='parent')
{
$RET = DBGet(DBQuery("SELECT sju.STUDENT_ID, CONCAT(s.LAST_NAME,', ',s.FIRST_NAME) AS FULL_NAME,se.SCHOOL_ID FROM students s,students_join_people sju, student_enrollment se WHERE s.STUDENT_ID=sju.STUDENT_ID AND sju.PERSON_ID='".User('STAFF_ID')."' AND se.SYEAR=".UserSyear()." AND se.STUDENT_ID=sju.STUDENT_ID AND (('".DBDate()."' BETWEEN se.START_DATE AND se.END_DATE OR se.END_DATE IS NULL) AND '".DBDate()."'>=se.START_DATE)"));
if(!UserStudentID())
$_SESSION['student_id'] = $RET[1]['STUDENT_ID'];
echo "<SELECT name=student_id onChange='document.forms[0].submit();'>";
if(count($RET))
{
foreach($RET as $student)
{
echo "<OPTION value=$student[STUDENT_ID]".((UserStudentID()==$student['STUDENT_ID'])?' SELECTED':'').">".$student['FULL_NAME']."</OPTION>";
if(UserStudentID()==$student['STUDENT_ID'])
$_SESSION['UserSchool'] = $student['SCHOOL_ID'];
}
}
echo "</SELECT><BR>";
if(!UserMP())
$_SESSION['UserMP'] = GetCurrentMP('QTR',DBDate());
}
if(User('PROFILE')=='teacher')
{/*
//if(UserMP())
// $QI = DBQuery("SELECT DISTINCT cp.PERIOD_ID,cp.COURSE_PERIOD_ID,sp.TITLE,sp.SHORT_NAME,cp.MARKING_PERIOD_ID,cp.DAYS,cp.SCHOOL_ID,sp.SORT_ORDER,c.TITLE AS COURSE_TITLE FROM course_periods cp, school_periods sp,courses c WHERE c.COURSE_ID=cp.COURSE_ID AND cp.PERIOD_ID=sp.PERIOD_ID AND cp.SYEAR='".UserSyear()."' AND cp.TEACHER_ID='".User('STAFF_ID')."' AND cp.MARKING_PERIOD_ID IN (".GetAllMP('QTR',UserMP()).") ORDER BY sp.SORT_ORDER ");
//else
$QI = DBQuery("SELECT DISTINCT cp.PERIOD_ID,cp.COURSE_PERIOD_ID,sp.TITLE,sp.SHORT_NAME,cp.MARKING_PERIOD_ID,cp.DAYS,cp.SCHOOL_ID,sp.SORT_ORDER,c.TITLE AS COURSE_TITLE FROM course_periods cp, school_periods sp,courses c WHERE c.COURSE_ID=cp.COURSE_ID AND cp.PERIOD_ID=sp.PERIOD_ID AND cp.SYEAR='".UserSyear()."' AND cp.TEACHER_ID='".User('STAFF_ID')."' ORDER BY sp.SORT_ORDER");
$RET = DBGet($QI);
// get the fy marking period id's, there should be exactly one fy marking period per school
$fy_RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,SCHOOL_ID FROM school_years WHERE SYEAR='".UserSyear()."'"),array(),array('SCHOOL_ID'));
// only need quarters and semesters since years are suppressed and progress_periods aren't used
$mp_RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE,SHORT_NAME FROM school_quarters WHERE SYEAR='".UserSyear()."'
UNION SELECT MARKING_PERIOD_ID,TITLE,SHORT_NAME FROM school_semesters WHERE SYEAR='".UserSyear()."'"),array(),array('MARKING_PERIOD_ID'));
if(!UserPeriod())
$_SESSION['UserPeriod'] = $RET[1]['PERIOD_ID'];
if(!UserCoursePeriod())
$_SESSION['UserCoursePeriod'] = $RET[1]['COURSE_PERIOD_ID'];
echo "<SELECT name=period onChange='document.forms[0].submit();' style='width:150;'>";
foreach($RET as $period)
{
echo "<OPTION value=$period[COURSE_PERIOD_ID]".((UserCoursePeriod()==$period['COURSE_PERIOD_ID'])?' SELECTED':'').">".$period['SHORT_NAME'].($period['MARKING_PERIOD_ID']!=$fy_RET[$period['SCHOOL_ID']][1]['MARKING_PERIOD_ID']?' '.$mp_RET[$period['MARKING_PERIOD_ID']][1]['SHORT_NAME']:'').(strlen($period['DAYS'])<5?' '.$period['DAYS']:'').' - '.$period['COURSE_TITLE']."</OPTION>";
if(UserCoursePeriod()==$period['COURSE_PERIOD_ID'])
{
if($period['SCHOOL_ID']!=UserSchool())
unset($_SESSION['UserMP']);
$_SESSION['UserSchool'] = $period['SCHOOL_ID'];
$_SESSION['UserPeriod'] = $period['PERIOD_ID'];
}
}
echo "</SELECT><BR>";
*/}
$RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID,TITLE FROM school_quarters WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
echo "<SELECT name=mp onChange='document.forms[0].submit();'>";
if(count($RET))
{
if(!UserMP())
$_SESSION['UserMP'] = $RET[1]['MARKING_PERIOD_ID'];
foreach($RET as $quarter)
echo "<OPTION value=$quarter[MARKING_PERIOD_ID]".(UserMP()==$quarter['MARKING_PERIOD_ID']?' SELECTED':'').">".$quarter['TITLE']."</OPTION>";
}
echo "</SELECT>";
echo '</FORM>';
if(UserStudentID() && User('PROFILE')!='parent' && User('PROFILE')!='student')
{
$RET = DBGet(DBQuery("SELECT FIRST_NAME,LAST_NAME,MIDDLE_NAME,NAME_SUFFIX FROM students WHERE STUDENT_ID='".UserStudentID()."'"));
//echo '<TABLE border=0 cellpadding=0 cellspacing=0 width=100%><TR><TD width=19 valign=middle><A HREF=Side.php?student_id=new&modcat='.$_REQUEST['modcat'].'><IMG SRC=assets/x.gif height=17 border=0></A></TD><TD ><B><A HREF=Modules.php?modname=Students/Student.php&student_id='.UserStudentID().' target=body><font color=#FFFFFF size=-2>'.$RET[1]['FIRST_NAME'].' '.($RET[1]['MIDDLE_NAME']?$RET[1]['MIDDLE_NAME'].' ':'').$RET[1]['LAST_NAME'].' '.$RET[1]['NAME_SUFFIX'].'</font></A></B></TD></TR></TABLE>';
echo '<TABLE border=0 cellpadding=0 cellspacing=0 width=100%><TR><TD width=19 valign=middle><A HREF=Side.php?student_id=new&modcat='.optional_param('modcat','',PARAM_SPCL).'><IMG SRC=assets/x.gif height=17 border=0></A></TD><TD ><B><A HREF=Modules.php?modname=Students/Student.php&student_id='.UserStudentID().' target=body><font color=#FFFFFF size=-2>'.$RET[1]['FIRST_NAME'].' '.($RET[1]['MIDDLE_NAME']?$RET[1]['MIDDLE_NAME'].' ':'').$RET[1]['LAST_NAME'].' '.$RET[1]['NAME_SUFFIX'].'</font></A></B></TD></TR></TABLE>';
}
if(UserStaffID() && User('PROFILE')=='admin')
{
if(UserStudentID())
echo '<IMG SRC=assets/pixel_trans.gif height=2>';
$RET = DBGet(DBQuery("SELECT FIRST_NAME,LAST_NAME FROM staff WHERE STAFF_ID='".UserStaffID()."'"));
//echo '<TABLE border=0 cellpadding=0 cellspacing=0 width=100%><TR><TD bgcolor=#336633 width=19 valign=middle><A HREF=Side.php?staff_id=new&modcat='.$_REQUEST['modcat'].'><IMG SRC=assets/x.gif height=17 border=0></A></TD><TD bgcolor=#336633><B><A HREF=Modules.php?modname=Users/User.php&staff_id='.UserStaffID().' target=body><font color=#FFFFFF size=-2>'.$RET[1]['FIRST_NAME'].' '.$RET[1]['LAST_NAME'].'</font></A></B></TD></TR></TABLE>';
echo '<TABLE border=0 cellpadding=0 cellspacing=0 width=100%><TR><TD bgcolor=#336633 width=19 valign=middle><A HREF=Side.php?staff_id=new&modcat='.optional_param('modcat','',PARAM_SPCL).'><IMG SRC=assets/x.gif height=17 border=0></A></TD><TD bgcolor=#336633><B><A HREF=Modules.php?modname=Users/User.php&staff_id='.UserStaffID().' target=body><font color=#FFFFFF size=-2>'.$RET[1]['FIRST_NAME'].' '.$RET[1]['LAST_NAME'].'</font></A></B></TD></TR></TABLE>';
}
echo '<BR>';
// Program Information
require('Menu.php');
foreach($_openSIS['Menu'] as $modcat=>$programs)
{
if(count($_openSIS['Menu'][$modcat]))
{
$keys = array_keys($_openSIS['Menu'][$modcat]);
$menu = false;
foreach($keys as $key_index=>$file)
{
if(!is_numeric($file))
$menu = true;
}
if(!$menu)
continue;
echo "<A style='cursor: pointer; cursor:hand;' onclick='openMenu(\"".$modcat."\");parent.body.location=\"Modules.php?modname=$modcat/Search.php\";'><IMG SRC=assets/icons/$modcat.gif height=20 border=0 align=absmiddle><font color=blue face='Verdana, Arial, sans-serif'><B>".str_replace('_',' ',$modcat)."</B></font></A><BR><DIV id=menu_visible".$modcat."></DIV>";
echo "<DIV id=menu_hidden".$modcat." style=\"visibility:hidden;position:absolute;\"><TABLE width=100%>";
//foreach($_openSIS['Menu'][$modcat] as $file=>$title)
foreach($keys as $key_index=>$file)
{
$title = $_openSIS['Menu'][$modcat][$file];
if(substr($file,0,7)=='http://')
echo "<TR><TD width=20></TD><TD class=BoxContents><b>›</b> <A HREF=$file target=body onclick='javascript:parent.help.location=\"Bottom.php?modname=$file\"'><font color=blue>$title</font></A></TD></TR>";
elseif(substr($file,0,7)=='HTTP://')
echo "<TR><TD width=20></TD><TD class=BoxContents><b>›</b> <A HREF=$file target=_blank><font color=blue>$title</font></A></TD></TR>";
elseif(!is_numeric($file))
echo "<TR><TD width=20></TD><TD class=BoxContents><b>›</b> <A HREF=Modules.php?modname=$file target=body onclick='javascript:parent.help.location=\"Bottom.php?modname=$file\"'><font color=blue>$title</font></A></TD></TR>";
elseif($keys[$key_index+1] && !is_numeric($keys[$key_index+1]))
echo '<TR><TD colspan=2 height=3></TD></TR><TR><TD colspan=2 class=BoxContents> <b>'.$title.'</b></TD></TR>';
}
echo "</TABLE></DIV>";
}
}
echo '</TD></TR></TABLE>';
echo '</BODY>';
echo '</HTML>';
?>