} else { $sql = 'SELECT ap.ATTENDANCE_CODE,ap.STUDENT_ID,ap.SCHOOL_DATE,CONCAT(\'_\',DATE_FORMAT(ap.SCHOOL_DATE,\'%y%b%d\')) AS SHORT_DATE FROM attendance_period ap,student_enrollment ssm,students s WHERE s.STUDENT_ID=ssm.STUDENT_ID AND ap.STUDENT_ID=ssm.STUDENT_ID AND ap.SCHOOL_DATE BETWEEN \'' . date('Y-m-d', strtotime($start_date)) . '\' AND \'' . date('Y-m-d', strtotime($end_date)) . '\''; if ($_REQUEST['include_inactive'] != 'Y') { $sql .= ' AND ((\'' . DBDate() . '\' BETWEEN ssm.START_DATE AND ssm.END_DATE OR ssm.END_DATE IS NULL) AND \'' . DBDate() . '\'>=ssm.START_DATE) '; } if ($_REQUEST['_search_all_schools'] != 'Y') { $sql .= ' AND ssm.SCHOOL_ID=\'' . UserSchool() . '\' '; } $sql = appendSQL($sql, $tmp_extra = array('NoSearchTerms' => true)); // extra must be lvalue $RET = DBGet(DBQuery($sql), array(), array('STUDENT_ID', 'SHORT_DATE')); } if (count($cal_RET)) { foreach ($cal_RET as $value) { $extra['SELECT'] .= ',\'\' as _' . str_replace('-', '', $value['SCHOOL_DATE']); $extra['columns_after']['_' . str_replace('-', '', $value['SCHOOL_DATE'])] = ShortDate($value['SCHOOL_DATE']); $extra['functions']['_' . str_replace('-', '', $value['SCHOOL_DATE'])] = '_makeColor'; $extra['link']['FULL_NAME']['link'] = "Modules.php?modname={$_REQUEST['next_modname']}&day_start={$_REQUEST['day_start']}&day_end={$_REQUEST['day_end']}&month_start={$_REQUEST['month_start']}&month_end={$_REQUEST['month_end']}&year_start={$_REQUEST['year_start']}&year_end={$_REQUEST['year_end']}&period_id={$_REQUEST['period_id']}"; $extra['link']['FULL_NAME']['variables'] = array('student_id' => 'STUDENT_ID'); } } Widgets('course'); Widgets('absences'); $extra['new'] = true; Search('student_id', $extra); echo '</FORM>'; } function _makeColor($value, $column) { global $THIS_RET, $RET, $attendance_codes; if ($_REQUEST['period_id']) {
(cpv.COURSE_PERIOD_DATE=\'' . date('Y-m-d', $j) . '\' OR cpv.COURSE_PERIOD_DATE IS NULL) AND cpv.PERIOD_ID =\'' . $course[PERIOD_ID] . '\' AND r.ROOM_ID=cpv.ROOM_ID AND POSITION(\'' . get_db_day($day) . '\' IN cpv.days)>0 AND cp.COURSE_PERIOD_ID IN (' . $custom_schedule_cpid . ')')); } if (count($day_RET_custom) > 0) { $schedule_RET[$i][date('y-m-d', $j)] = count($day_RET) > 1 ? '<font title="Conflict schedule (' . count($day_RET_custom) . ')" color="red">' . $day_RET_custom[1]['TITLE'] . '<br />Room :' . $day_RET_custom[1]['ROOM'] . '</font>' : '<spna title=' . date("l", $j) . '>' . $day_RET_custom[1]['TITLE'] . '<br />Room :' . $day_RET_custom[1]['ROOM'] . '</span>'; } else { $schedule_RET[$i][date('y-m-d', $j)] = '<div align=center title="Schedule not available">--</div>'; } } else { $schedule_RET[$i][date('y-m-d', $j)] = count($day_RET) > 1 ? '<font title="Conflict schedule (' . count($day_RET) . ')" color="red">' . $day_RET[1]['TITLE'] . '<br />Room :' . $day_RET[1]['ROOM'] . '</font>' : '<spna title=' . date("l", $j) . '>' . $day_RET[1]['TITLE'] . '<br />Room :' . $day_RET[1]['ROOM'] . '</span>'; } } } } } for ($i = $today; $i <= $today + $one_day * 6; $i = $i + $one_day) { $columns[date('y-m-d', $i)] = weekDate(date('Y-m-d', $i)) . ' ' . ShortDate(date('Y-m-d', $i)); } break; case 'month_view': $month_str = _makeMonths('Modules.php?modname=' . $_REQUEST['modname'] . '&marking_period_id=' . $_REQUEST['marking_period_id'] . '&view_mode=' . $_REQUEST['view_mode'] . '&month='); DrawHeaderHome('<table cellpadding="2" cellspacing="2" width="100%"><tr><td style="padding-right:20px;">Marking Period : ' . $mp . '</td><td>' . $month_str . '</td><td align="right">Calendar View : ' . $view_mode . '</td></tr></table>'); $fy_id = DBGet(DBQuery('SELECT MARKING_PERIOD_ID FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\'')); $fy_id = $fy_id[1]['MARKING_PERIOD_ID']; $month = date('m', $_REQUEST['month']); $year = date('Y', $_REQUEST['month']); // ++++++++++++++++++++++++++++++++++++++++++++++++++++++ $time = mktime(0, 0, 0, $month, 1, $year); $last = 31; while (!checkdate($month, $last, $year)) { $last--; }