include "common.inc.php"; dbConnect(); session_start(); login(); $mysql_debug=1; if (!$_SESSION['id']) { show_login(); } else { if ($_SESSION['type']=='teacher') { if ($_GET['action']=='invoices') show_teacher_invoices(); else show_teacher_schedule(); } else { //front desk if ($_POST['action']=='change_status') { change_status(); } if ($_POST['action']=='remove_exception') { remove_exception(); } if ($_POST['action']=='remove_student') { remove_student(); } if ($_POST['action']=='delete_lesson') { delete_lesson(); } if ($_POST['action']=='ignore_warning') { ignore_warning(); } if ($_GET['action']=='exception') { show_exception(); } else if ($_GET['action']=='master') { /* if ($_GET['locations']!==false) { setcookie('locations',$_GET['locations'],time()+60*60*24*365); $_COOKIE['locations']=$_GET['locations']; } */ show_master_schedule(); } else if ($_GET['action']=='chart') { show_teacher_chart(); } else if ($_GET['action']=='student') { show_student(); } else if ($_GET['action']=='teacher') { show_teacher(); } else if ($_GET['action']=='waitinglist') { show_waitinglist(); } else if ($_GET['action']=='add_makeup_time') { show_add_makeup_time(); } else { show_dashboard(); } } } dbClose(); foot(); function delete_lesson() { $dq=mysqlDelete('lessons',"id='%s' AND status='Ongoing' AND from_date>CURDATE()",$_POST['id'],1); if ($dq<0) { $msg="
There was an error deleting the lesson status:".mysql_error()."
"; } else if ($dq==0) { $msg="The lesson wasn't deleted. It may have already been deleted or might not be an upcoming ongoing lesson.
"; } else { $msg="Lesson deleted.
"; } } function show_add_makeup_time() { $title="Add Makeup Time"; head($title); ?>Make up time added. You should now be able to add a makeup for this lesson.
"; } else { ?>Select an active or future lesson to add makeup time to it. Only add time if there is a good reason for it (e.g. they are owed a makeup from a previous lesson, and this new lesson is just a reschedule of the rest of their lessons for the year).
} } function show_exception() { if ($_GET['id']) { $action="Edit"; $r=mysqlQuery("SELECT l.id as lessons_id, l.day, l.time, l.length, l.label, l.instrument, l.locations, x.id, x.teachers_id as sub, x.date, x.status, x.notes FROM lessons as l, lesson_exceptions as x WHERE x.id='%s' AND x.lessons_id=l.id LIMIT 1",$_GET['id']); } else { $action="Add"; $r=mysqlQuery("SELECT l.id, l.teachers_id, l.day, l.time, l.length, l.label, l.instrument, l.locations, t.label as teacher FROM lessons as l LEFT JOIN teachers as t ON (l.teachers_id=t.id) WHERE l.id='%s' LIMIT 1",$_GET['lessons_id']); } $title="$action Exception"; head($title); ?>Lesson not found.
} else { $lesson=mysql_fetch_assoc($r); if ($_POST['date'] && $_POST['status']) { $_REQUEST['time']=$lesson['time']; if ($_POST['id']) { $_REQUEST['last_modified_by']=$_SESSION['username']; $uq=mysqlUpdate('lesson_exceptions',buildPairs(array('date','status','teachers_id','last_modified_by','notes')),"id='%s'",$_POST['id'],1); if ($uq<0) { ?>Database error