예제 #1
0
     $connection = db_start();
     db_trans_start($connection);
     unset($_SESSION['SCHEDULE']);
     if (count($insert)) {
         foreach ($insert as $student_id => $requests) {
             foreach ($requests as $request) {
                 $sql = "INSERT INTO SCHEDULE (SYEAR,SCHOOL_ID,STUDENT_ID,START_DATE,MODIFIED_DATE,COURSE_ID,COURSE_WEIGHT,COURSE_PERIOD_ID,MP,MARKING_PERIOD_ID) values('" . UserSyear() . "','" . UserSchool() . "','" . $request['STUDENT_ID'] . "','" . DBDate() . "','" . DBDate() . "','" . $request['COURSE_ID'] . "','" . $request['COURSE_WEIGHT'] . "','" . $request['COURSE_PERIOD_ID'] . "','" . $request['MP'] . "','" . $request['MARKING_PERIOD_ID'] . "')";
                 db_trans_query($connection, $sql);
             }
         }
     }
     foreach ($periods_RET as $course_id => $weights) {
         foreach ($weights as $weight => $periods) {
             foreach ($periods as $course_period_id => $period) {
                 $sql = "UPDATE COURSE_PERIODS SET FILLED_SEATS=COALESCE(TOTAL_SEATS,0)-'" . $period[1]['AVAILABLE_SEATS'] . "' WHERE COURSE_PERIOD_ID='{$course_period_id}'";
                 db_trans_query($connection, $sql);
             }
         }
     }
     db_trans_commit($connection);
     if (!$count) {
         $message = "<IMG SRC=assets/check.gif>All the requests were filled";
     }
     if ($_SCHEDULER['student_id']) {
         $link = "<A HREF=Modules.php?modname=Scheduling/Schedule.php>View this student's Schedule</A>";
     } else {
         $link = "<A HREF=Modules.php?modname=Scheduling/ScheduleReport.php>View the Schedule Report</A>";
     }
     DrawHeader($message, $link);
 } elseif ($_SCHEDULER['student_id']) {
     if (!$count) {
예제 #2
0
function db_trans_start($connection)
{
    global $DatabaseType;
    if ($DatabaseType == 'postres') {
        db_trans_query($connection, "BEGIN WORK");
    }
}
예제 #3
0
                     $bad_locked++;
                 }
                 //	db_trans_query($connection,"INSERT INTO SCHEDULE (SYEAR,SCHOOL_ID,STUDENT_ID,START_DATE,COURSE_ID,COURSE_PERIOD_ID,MP,MARKING_PERIOD_ID) values('".UserSyear()."','".UserSchool()."','".$student_id."','".$date."','".$course_period['COURSE_ID']."','".$course_period['COURSE_PERIOD_ID']."','".$course_period['MP']."','".$course_period['MARKING_PERIOD_ID']."');");
                 //modif Francois: multiple school periods for a course period
                 $course_periods_temp[] = $course_period['COURSE_PERIOD_ID'];
             }
         }
     }
     echo '<!-- Bad Locked ' . $scount . ' -->';
     echo '<!-- Schedule Count() ' . $scount . '-->';
     //echo 'Empty Courses:';
     foreach ($cp_parent_RET as $parent_id => $course_period) {
         $course_period = $course_period[1];
         //if($course_period['AVAILABLE_SEATS']<='0')
         //	echo $course_period['COURSE_ID'].': '.$course_period['COURSE_PERIOD_ID'].'<BR />';
         db_trans_query($connection, "UPDATE COURSE_PERIODS SET FILLED_SEATS=TOTAL_SEATS-'" . $course_period['AVAILABLE_SEATS'] . "' WHERE PARENT_ID='" . $parent_id . "'");
     }
     db_trans_commit($connection);
 }
 if ($_REQUEST['test_mode'] != 'Y' || $_REQUEST['delete'] == 'Y') {
     echo '<script type="text/javascript">' . "\r";
     //modif Francois: bugfix addHTML is not defined
     //echo 'addHTML("'.str_replace('"','\"','<IMG SRC="assets/spinning.gif" /> '.str_replace(array("'",'"'),array('&#39;','&rdquo;'),_('Optimizing ...')).' ').'","percentDIV",true);'."\r";
     echo 'document.getElementById("percentDIV").innerHTML = "' . str_replace('"', '\\"', '<IMG SRC="assets/spinning.gif" /> ' . str_replace(array("'", '"'), array('&#39;', '&rdquo;'), _('Optimizing ...')) . ' ') . '";' . "\r";
     echo '</script>';
     echo str_pad(' ', 4096);
     ob_flush();
     flush();
     DBQuery("VACUUM");
     DBQuery("ANALYZE");
 }
예제 #4
0
function db_trans_start($connection)
{
    db_trans_query($connection, "BEGIN WORK");
}