예제 #1
0
function calcSeats(&$_RET, $columns)
{
    $RET = array(0 => array());
    foreach ($_RET as $periods) {
        $value = array();
        foreach ($columns as $column) {
            $value += array($column => $periods[key($periods)][$column]);
        }
        if ($_REQUEST['include_child_mps']) {
            $total_seats = $filled_seats = array();
        } else {
            $total_seats = $filled_seats = 0;
        }
        foreach ($periods as $period) {
            calcSeats1($period, $total_seats, $filled_seats);
        }
        if ($_REQUEST['include_child_mps']) {
            foreach ($total_seats as $mp => $total) {
                $filled = $filled_seats[$mp];
                $value += array('OFT_' . $mp => ($total !== false ? $filled !== false ? $total - $filled : '' : 'n/a') . '|' . ($filled !== false ? $filled : '') . '|' . ($total !== false ? $total : 'n/a'));
            }
        } else {
            $value += array('OPEN_SEATS' => $total_seats !== false ? $filled_seats !== false ? $total_seats - $filled_seats : '' : 'n/a', 'FILLED_SEATS' => $filled_seats !== false ? $filled_seats : '', 'TOTAL_SEATS' => $total_seats !== false ? $total_seats : 'n/a');
        }
        $RET[] = $value;
    }
    unset($RET[0]);
    return $RET;
}
예제 #2
0
파일: Courses.php 프로젝트: linil/centreSIS
 $columns = array('TITLE' => _('Course'));
 $link = array();
 $link['TITLE']['link'] = "Modules.php?modname={$_REQUEST['modname']}&subject_id={$_REQUEST['subject_id']}";
 $link['TITLE']['variables'] = array('course_id' => 'COURSE_ID');
 if ($_REQUEST['modfunc'] == 'choose_course') {
     $link['TITLE']['link'] .= "&modfunc={$_REQUEST['modfunc']}&last_year={$_REQUEST['last_year']}" . ($_REQUEST['modname'] == 'Scheduling/Schedule.php' ? "&include_child_mps={$_REQUEST['include_child_mps']}&year_date={$_REQUEST['year_date']}&month_date={$_REQUEST['month_date']}&day_date={$_REQUEST['day_date']}" : '');
 } else {
     $link['add']['link'] = "Modules.php?modname={$_REQUEST['modname']}&subject_id={$_REQUEST['subject_id']}&course_id=new";
 }
 echo '<TD valign=top>';
 ListOutput($courses_RET, $columns, _('Course'), _('Courses'), $link, array(), $LO_options);
 echo '</TD>';
 if ($_REQUEST['course_id'] && $_REQUEST['course_id'] != 'new') {
     $periods_RET = DBGet(DBQuery("SELECT '{$_REQUEST['subject_id']}' AS SUBJECT_ID,COURSE_ID,COURSE_PERIOD_ID,TITLE,MP,MARKING_PERIOD_ID,CALENDAR_ID,TOTAL_SEATS AS AVAILABLE_SEATS FROM COURSE_PERIODS cp WHERE COURSE_ID='{$_REQUEST['course_id']}' " . ($_REQUEST['modfunc'] == 'choose_course' && $_REQUEST['modname'] == 'Scheduling/Schedule.php' ? " AND '{$date}'<=(SELECT END_DATE FROM SCHOOL_MARKING_PERIODS WHERE SYEAR=cp.SYEAR AND MARKING_PERIOD_ID=cp.MARKING_PERIOD_ID)" : '') . " ORDER BY (SELECT SORT_ORDER FROM SCHOOL_PERIODS WHERE PERIOD_ID=cp.PERIOD_ID),TITLE"));
     if ($_REQUEST['modname'] == 'Scheduling/Schedule.php') {
         calcSeats1($periods_RET, $date);
     }
     if (count($periods_RET)) {
         if ($_REQUEST['course_period_id']) {
             foreach ($periods_RET as $key => $value) {
                 if ($value['COURSE_PERIOD_ID'] == $_REQUEST['course_period_id']) {
                     $periods_RET[$key]['row_color'] = Preferences('HIGHLIGHT');
                 }
             }
         }
     }
     $columns = array('TITLE' => _('Course Period'));
     $link = array();
     if ($_REQUEST['modname'] != 'Scheduling/Schedule.php' || $_REQUEST['modname'] == 'Scheduling/Schedule.php' && !$_REQUEST['include_child_mps']) {
         $link['TITLE']['link'] = "Modules.php?modname={$_REQUEST['modname']}&subject_id={$_REQUEST['subject_id']}&course_id={$_REQUEST['course_id']}";
         $link['TITLE']['variables'] = array('course_period_id' => 'COURSE_PERIOD_ID', 'course_marking_period_id' => 'MARKING_PERIOD_ID');