本文整理汇总了PHP中UserSchool函数的典型用法代码示例。如果您正苦于以下问题:PHP UserSchool函数的具体用法?PHP UserSchool怎么用?PHP UserSchool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UserSchool函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetCurrentMP
function GetCurrentMP($mp, $date, $error = true)
{
global $_openSIS;
switch ($mp) {
case 'FY':
$table = 'school_years';
break;
case 'SEM':
$table = 'school_semesters';
break;
case 'QTR':
$table = 'school_quarters';
break;
case 'PRO':
$table = 'school_progress_periods';
break;
}
if (!$_openSIS['GetCurrentMP'][$date][$mp]) {
$_openSIS['GetCurrentMP'][$date][$mp] = DBGet(DBQuery('SELECT MARKING_PERIOD_ID FROM ' . $table . ' WHERE \'' . $date . '\' BETWEEN START_DATE AND END_DATE AND SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
}
if ($_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']) {
return $_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID'];
} elseif (strpos($_SERVER['PHP_SELF'], 'Side.php') === false && $error == true) {
ErrorMessage(array('' . _("You are not currently in a marking period") . ''));
}
//ShowErr("You are not currently in a marking period");
}
示例2: GetStaffList
function GetStaffList(&$extra)
{
global $profiles_RET;
$functions = array('PROFILE' => 'makeProfile');
switch (User('PROFILE')) {
case 'admin':
$profiles_RET = DBGet(DBQuery("SELECT * FROM USER_PROFILES"), array(), array('ID'));
$sql = "SELECT CONCAT(\n\t\t\t\t\tCOALESCE(s.LAST_NAME,' '),', ',COALESCE(s.FIRST_NAME,' '),' ',COALESCE(s.MIDDLE_NAME,' ')) AS FULL_NAME,\n\t\t\t\t\ts.PROFILE,s.PROFILE_ID,s.STAFF_ID,s.SCHOOLS " . $extra['SELECT'] . "\n\t\t\t\tFROM\n\t\t\t\t\tSTAFF s " . $extra['FROM'] . "\n\t\t\t\tWHERE\n\t\t\t\t\ts.SYEAR='" . UserSyear() . "'";
if ($_REQUEST['_search_all_schools'] != 'Y') {
$sql .= " AND (s.SCHOOLS LIKE '%," . UserSchool() . ",%' OR s.SCHOOLS IS NULL OR s.SCHOOLS='') ";
}
if ($_REQUEST['username']) {
$sql .= "AND UPPER(s.USERNAME) LIKE '" . strtoupper($_REQUEST['username']) . "%' ";
}
if ($_REQUEST['last']) {
$sql .= "AND UPPER(s.LAST_NAME) LIKE '" . strtoupper($_REQUEST['last']) . "%' ";
}
if ($_REQUEST['first']) {
$sql .= "AND UPPER(s.FIRST_NAME) LIKE '" . strtoupper($_REQUEST['first']) . "%' ";
}
if ($_REQUEST['profile']) {
$sql .= "AND s.PROFILE='" . $_REQUEST['profile'] . "' ";
}
$sql .= $extra['WHERE'] . ' ';
$sql .= "ORDER BY FULL_NAME";
if ($extra['functions']) {
$functions += $extra['functions'];
}
return DBGet(DBQuery($sql), $functions);
break;
}
}
示例3: GetCurrentMP
function GetCurrentMP($mp, $date, $error = true)
{
global $_openSIS;
switch ($mp) {
case 'FY':
$table = 'SCHOOL_YEARS';
break;
case 'SEM':
$table = 'SCHOOL_SEMESTERS';
break;
case 'QTR':
$table = 'SCHOOL_QUARTERS';
break;
case 'PRO':
$table = 'SCHOOL_PROGRESS_PERIODS';
break;
}
if (!$_openSIS['GetCurrentMP'][$date][$mp]) {
$_openSIS['GetCurrentMP'][$date][$mp] = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM {$table} WHERE '{$date}' BETWEEN START_DATE AND END_DATE AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
}
if ($_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']) {
return $_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID'];
} elseif (strpos($_SERVER['PHP_SELF'], 'Side.php') === false && $error == true) {
ErrorMessage(array("You are not currently in a marking period"));
}
//ShowErr("You are not currently in a marking period");
}
示例4: GetTeacher
function GetTeacher($teacher_id, $title = '', $column = 'FULL_NAME', $schools = true)
{
global $_openSIS;
if (!$_openSIS['GetTeacher']) {
$QI = DBQuery("SELECT STAFF_ID,CONCAT(LAST_NAME,', ',FIRST_NAME) AS FULL_NAME,USERNAME,PROFILE FROM STAFF WHERE SYEAR='" . UserSyear() . "'" . ($schools ? " AND SCHOOLS LIKE '%," . UserSchool() . ",%'" : ''));
$_openSIS['GetTeacher'] = DBGet($QI, array(), array('STAFF_ID'));
}
return $_openSIS['GetTeacher'][$teacher_id][1][$column];
}
示例5: GetTeacher
function GetTeacher($teacher_id, $title = '', $column = 'FULL_NAME', $schools = true)
{
global $_CENTRE;
if (!$_CENTRE['GetTeacher']) {
$QI = DBQuery("SELECT STAFF_ID,LAST_NAME||', '||FIRST_NAME AS FULL_NAME,USERNAME,PROFILE FROM STAFF WHERE SYEAR='" . UserSyear() . "'" . ($schools ? " AND (SCHOOLS IS NULL OR SCHOOLS LIKE '%," . UserSchool() . ",%')" : ''));
$_CENTRE['GetTeacher'] = DBGet($QI, array(), array('STAFF_ID'));
}
return $_CENTRE['GetTeacher'][$teacher_id][1][$column];
}
示例6: Config
function Config($item)
{
global $_ROSARIO, $DefaultSyear;
if (empty($_ROSARIO['Config']) || !isset($_ROSARIO['Config'][$item])) {
$QI = DBQuery("SELECT TITLE, CONFIG_VALUE FROM CONFIG WHERE " . (UserSchool() < 1 ? '' : "SCHOOL_ID='" . UserSchool() . "' OR") . " SCHOOL_ID='0'");
$_ROSARIO['Config'] = DBGet($QI, array(), array('TITLE'));
$_ROSARIO['Config']['SYEAR'][1]['CONFIG_VALUE'] = $DefaultSyear;
}
return $_ROSARIO['Config'][$item][1]['CONFIG_VALUE'];
}
示例7: GetCurrentMP
function GetCurrentMP($mp, $date, $error = true)
{
global $_ROSARIO;
if (!$_ROSARIO['GetCurrentMP'][$date][$mp]) {
$_ROSARIO['GetCurrentMP'][$date][$mp] = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='{$mp}' AND '{$date}' BETWEEN START_DATE AND END_DATE AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'"));
}
if ($_ROSARIO['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']) {
return $_ROSARIO['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID'];
} elseif ($error) {
ErrorMessage(array(_('You are not currently in a marking period')), 'fatal');
}
}
示例8: UpdateSchoolArray
function UpdateSchoolArray($school_id = null)
{
if (!$school_id) {
$school_id = UserSchool();
}
$_SESSION['SchoolData'] = DBGet(DBQuery("SELECT * FROM SCHOOLS WHERE ID = '" . $school_id . "' AND SYEAR = '" . UserSyear() . "'"));
$_SESSION['SchoolData'] = $_SESSION['SchoolData'][1];
//modif Francois: if only one school, no Search All Schools option
$schools_nb = DBGet(DBQuery("SELECT COUNT(*) AS SCHOOLS_NB FROM SCHOOLS WHERE SYEAR = '" . UserSyear() . "';"));
$_SESSION['SchoolData']['SCHOOLS_NB'] = $schools_nb[1]['SCHOOLS_NB'];
$_SESSION['SchoolData'];
}
示例9: _makeLetterGrade
function _makeLetterGrade($percent, $course_period_id = 0, $staff_id = 0, $ret = 'TITLE')
{
global $programconfig, $_ROSARIO;
if (!$course_period_id) {
$course_period_id = UserCoursePeriod();
}
if (!$staff_id) {
$staff_id = User('STAFF_ID');
}
if (!$programconfig[$staff_id]) {
$config_RET = DBGet(DBQuery("SELECT TITLE,VALUE FROM PROGRAM_USER_CONFIG WHERE USER_ID='" . $staff_id . "' AND PROGRAM='Gradebook'"), array(), array('TITLE'));
if (count($config_RET)) {
foreach ($config_RET as $title => $value) {
$programconfig[$staff_id][$title] = $value[1]['VALUE'];
}
} else {
$programconfig[$staff_id] = true;
}
}
if (!$_ROSARIO['_makeLetterGrade']['courses'][$course_period_id]) {
$_ROSARIO['_makeLetterGrade']['courses'][$course_period_id] = DBGet(DBQuery("SELECT DOES_BREAKOFF,GRADE_SCALE_ID FROM COURSE_PERIODS WHERE COURSE_PERIOD_ID='" . $course_period_id . "'"));
}
$does_breakoff = $_ROSARIO['_makeLetterGrade']['courses'][$course_period_id][1]['DOES_BREAKOFF'];
$grade_scale_id = $_ROSARIO['_makeLetterGrade']['courses'][$course_period_id][1]['GRADE_SCALE_ID'];
$percent *= 100;
if ($does_breakoff == 'Y') {
if ($programconfig[$staff_id]['ROUNDING'] == 'UP') {
$percent = ceil($percent);
} elseif ($programconfig[$staff_id]['ROUNDING'] == 'DOWN') {
$percent = floor($percent);
} elseif ($programconfig[$staff_id]['ROUNDING'] == 'NORMAL') {
$percent = round($percent);
}
} else {
$percent = round($percent);
}
// school default
if ($ret == '%') {
return $percent;
}
if (!$_ROSARIO['_makeLetterGrade']['grades'][$grade_scale_id]) {
$_ROSARIO['_makeLetterGrade']['grades'][$grade_scale_id] = DBGet(DBQuery("SELECT TITLE,ID,BREAK_OFF,COMMENT FROM REPORT_CARD_GRADES WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' AND GRADE_SCALE_ID='{$grade_scale_id}' ORDER BY BREAK_OFF IS NOT NULL DESC,BREAK_OFF DESC,SORT_ORDER"));
}
//$grades = array('A+','A','A-','B+','B','B-','C+','C','C-','D+','D','D-','F');
foreach ($_ROSARIO['_makeLetterGrade']['grades'][$grade_scale_id] as $grade) {
if ($does_breakoff == 'Y' ? $percent >= $programconfig[$staff_id][$course_period_id . '-' . $grade['ID']] && is_numeric($programconfig[$staff_id][$course_period_id . '-' . $grade['ID']]) : $percent >= $grade['BREAK_OFF']) {
//modif Francois: use Report Card Grades comments
//return $ret=='ID' ? $grade['ID'] : $grade['TITLE'];
return $grade[$ret];
}
}
}
示例10: _makePaymentsRemove
function _makePaymentsRemove($value, $column)
{
global $THIS_RET, $refunded_payments_RET;
if (!$refunded_payments_RET) {
$refunded_payments_RET = DBGet(DBQuery("SELECT p.REFUNDED_PAYMENT_ID FROM BILLING_PAYMENTS p WHERE p.STUDENT_ID='" . UserStudentID() . "' AND (p.REFUNDED_PAYMENT_ID IS NOT NULL AND p.REFUNDED_PAYMENT_ID!='') AND p.SYEAR='" . UserSyear() . "' AND p.SCHOOL_ID='" . UserSchool() . "'"), array(), array('REFUNDED_PAYMENT_ID'));
}
if (!$THIS_RET['REFUNDED_PAYMENT_ID'] && !$refunded_payments_RET[$THIS_RET['ID']]) {
$return = button('remove', _('Refund'), "Modules.php?modname={$_REQUEST['modname']}&modfunc=refund&id={$THIS_RET['ID']}");
} elseif ($refunded_payments_RET[$THIS_RET['ID']]) {
$return = '<center><font color=#00FF66>' . _('Refunded') . '</font></center>';
}
return $return . button('remove', _('Delete'), "Modules.php?modname={$_REQUEST['modname']}&modfunc=remove&id={$THIS_RET['ID']}");
}
示例11: _makePaymentsRemove
function _makePaymentsRemove($value, $column)
{
global $THIS_RET, $refunded_payments_RET;
if (!$refunded_payments_RET) {
$refunded_payments_RET = DBGet(DBQuery("SELECT p.REFUNDED_PAYMENT_ID FROM BILLING_PAYMENTS p WHERE p.STUDENT_ID='" . UserStudentID() . "' AND (p.REFUNDED_PAYMENT_ID IS NOT NULL AND p.REFUNDED_PAYMENT_ID!='') AND p.SYEAR='" . UserSyear() . "' AND p.SCHOOL_ID='" . UserSchool() . "'"), array(), array('REFUNDED_PAYMENT_ID'));
}
if (!$THIS_RET['REFUNDED_PAYMENT_ID'] && !$refunded_payments_RET[$THIS_RET['ID']]) {
$return = button('remove', _('Refund'), '"Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=refund&id=' . $THIS_RET['ID'] . '"');
} elseif ($refunded_payments_RET[$THIS_RET['ID']]) {
$return = '<span style="color:#00A642; text-align:center">' . _('Refunded') . '</span>';
}
return $return . button('remove', _('Delete'), '"Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=remove&id=' . $THIS_RET['ID'] . '"');
}
示例12: _makeLetterGrade
function _makeLetterGrade($percent, $course_period_id = 0, $staff_id = 0, $ret = '')
{
global $programconfig, $_openSIS;
if (!$course_period_id) {
$course_period_id = UserCoursePeriod();
}
if (!$staff_id) {
$staff_id = User('STAFF_ID');
}
if (!$programconfig[$staff_id]) {
$config_RET = DBGet(DBQuery('SELECT TITLE,VALUE FROM program_user_config WHERE USER_ID=\'' . $staff_id . '\' AND PROGRAM=\'Gradebook\''), array(), array('TITLE'));
if (count($config_RET)) {
foreach ($config_RET as $title => $value) {
$programconfig[$staff_id][$title] = $value[1]['VALUE'];
}
} else {
$programconfig[$staff_id] = true;
}
}
if (!$_openSIS['_makeLetterGrade']['courses'][$course_period_id]) {
$_openSIS['_makeLetterGrade']['courses'][$course_period_id] = DBGet(DBQuery('SELECT DOES_BREAKOFF,GRADE_SCALE_ID FROM course_periods WHERE COURSE_PERIOD_ID=\'' . $course_period_id . '\''));
}
$does_breakoff = $_openSIS['_makeLetterGrade']['courses'][$course_period_id][1]['DOES_BREAKOFF'];
$grade_scale_id = $_openSIS['_makeLetterGrade']['courses'][$course_period_id][1]['GRADE_SCALE_ID'];
$percent *= 100;
// if ($does_breakoff=='Y')
// {
if ($programconfig[$staff_id]['ROUNDING'] == 'UP') {
$percent = ceil($percent);
} elseif ($programconfig[$staff_id]['ROUNDING'] == 'DOWN') {
$percent = floor($percent);
} elseif ($programconfig[$staff_id]['ROUNDING'] == 'NORMAL') {
$percent = round($percent, 2);
} else {
$percent = round($percent, 2);
}
// school default
if ($ret == '%') {
return $percent;
}
if (!$_openSIS['_makeLetterGrade']['grades'][$grade_scale_id]) {
$_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] = DBGet(DBQuery('SELECT TITLE,ID,BREAK_OFF FROM report_card_grades WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' AND GRADE_SCALE_ID=\'' . $grade_scale_id . '\' ORDER BY BREAK_OFF IS NOT NULL DESC,BREAK_OFF DESC,SORT_ORDER'));
}
//$grades = array('A+','A','A-','B+','B','B-','C+','C','C-','D+','D','D-','F');
foreach ($_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] as $grade) {
if ($does_breakoff == 'Y' ? $percent >= $programconfig[$staff_id][$course_period_id . '-' . $grade['ID']] && is_numeric($programconfig[$staff_id][$course_period_id . '-' . $grade['ID']]) : $percent >= $grade['BREAK_OFF']) {
return $ret == 'ID' ? $grade['ID'] : $grade['TITLE'];
}
}
}
示例13: DrawLogo
function DrawLogo()
{
$logo_ret = DBGet(DBQuery('SELECT VALUE FROM program_config WHERE school_id=\'' . UserSchool() . '\' AND program=\'SchoolLogo\''));
if ($logo_ret && file_exists($logo_ret[1]['VALUE'])) {
$logo = $logo_ret[1]['VALUE'];
$size = getimagesize($logo);
$width = $size[0];
$height = $size[1];
$image = '<img src="' . $logo . '" ' . ($width > 100 && $height > 100 ? $width > $height ? $height > 100 || $width > 100 ? ' width=100' : '' : ($height > 100 || $width > 100 ? ' height=100' : '') : '') . ' alt="Logo" />';
} else {
$image = '<img src="assets/logo.png" alt=" " />';
}
return $image;
}
示例14: UpdateAttendanceDaily
function UpdateAttendanceDaily($student_id, $date = '', $comment = false)
{
if (!$date) {
$date = DBDate();
}
$sql = "SELECT\r\n\t\t\t\tsum(sp.LENGTH) AS TOTAL\r\n\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac\r\n\t\t\tWHERE\r\n\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND cp.DOES_ATTENDANCE='Y'\r\n\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\r\n\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\r\n\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cp.PERIOD_ID\r\n\t\t\t\tAND position(substring('UMTWHFS' FROM DAYOFWEEK('{$date}') FOR 1) IN cp.DAYS)>0\r\n\t\t\t\tAND s.STUDENT_ID='{$student_id}'\r\n\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\r\n\t\t\t\tAND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\r\n\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\r\n\t\t\t";
$RET = DBGet(DBQuery($sql));
$total = $RET[1]['TOTAL'];
if ($total == 0) {
return;
}
$sql = "SELECT sum(sp.LENGTH) AS TOTAL\r\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\r\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='A'\r\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'";
$RET = DBGet(DBQuery($sql));
$total -= $RET[1]['TOTAL'];
$sql = "SELECT sum(sp.LENGTH) AS TOTAL\r\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\r\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='H'\r\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'";
$RET = DBGet(DBQuery($sql));
$total -= $RET[1]['TOTAL'] * 0.5;
/*
if($total>=300)
$length = '1.0';
elseif($total>=150)
$length = '.5';
else
$length = '0.0';
*/
if (stripos($_SERVER['SERVER_SOFTWARE'], 'linux')) {
$comment = str_replace("'", "\\'", $comment);
}
$sys_pref = DBGet(DBQuery("SELECT * FROM SYSTEM_PREFERENCE WHERE SCHOOL_ID=" . UserSchool()));
$fdm = $sys_pref[1]['FULL_DAY_MINUTE'];
$hdm = $sys_pref[1]['HALF_DAY_MINUTE'];
if ($total >= $fdm) {
$length = '1.0';
} elseif ($total >= $hdm) {
$length = '.5';
} else {
$length = '0.0';
}
$current_RET = DBGet(DBQuery("SELECT MINUTES_PRESENT,STATE_VALUE,COMMENT FROM ATTENDANCE_DAY WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'"));
if (count($current_RET) && $current_RET[1]['MINUTES_PRESENT'] != $total) {
DBQuery("UPDATE ATTENDANCE_DAY SET MINUTES_PRESENT='{$total}',STATE_VALUE='{$length}'" . ($comment !== false ? ",COMMENT='" . str_replace("", "", $comment) . "'" : '') . " WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'");
} elseif (count($current_RET) && $comment !== false && $current_RET[1]['COMMENT'] != $comment) {
DBQuery("UPDATE ATTENDANCE_DAY SET COMMENT='" . str_replace("", "", $comment) . "' WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'");
} elseif (count($current_RET) == 0) {
DBQuery("INSERT INTO ATTENDANCE_DAY (SYEAR,STUDENT_ID,SCHOOL_DATE,MINUTES_PRESENT,STATE_VALUE,MARKING_PERIOD_ID,COMMENT) values('" . UserSyear() . "','{$student_id}','{$date}','{$total}','{$length}','" . GetCurrentMP('QTR', $date) . "','" . str_replace("", "", $comment) . "')");
}
}
示例15: _rollover
function _rollover($table)
{
global $id;
switch ($table) {
//modif Francois: copy School Configuration
case 'CONFIG':
DBQuery("INSERT INTO CONFIG (SCHOOL_ID,TITLE,CONFIG_VALUE) SELECT '{$id}' AS SCHOOL_ID,TITLE,CONFIG_VALUE FROM CONFIG WHERE SCHOOL_ID='" . UserSchool() . "';");
DBQuery("INSERT INTO PROGRAM_CONFIG (SCHOOL_ID,SYEAR,PROGRAM,VALUE,TITLE) SELECT '{$id}' AS SCHOOL_ID,SYEAR,PROGRAM,VALUE,TITLE FROM PROGRAM_CONFIG WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "';");
break;
case 'SCHOOL_PERIODS':
DBQuery("INSERT INTO SCHOOL_PERIODS (PERIOD_ID,SYEAR,SCHOOL_ID,SORT_ORDER,TITLE,SHORT_NAME,LENGTH,ATTENDANCE,ROLLOVER_ID) SELECT nextval('SCHOOL_PERIODS_SEQ'),SYEAR,'{$id}' AS SCHOOL_ID,SORT_ORDER,TITLE,SHORT_NAME,LENGTH,ATTENDANCE,PERIOD_ID FROM SCHOOL_PERIODS WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'");
break;
case 'SCHOOL_GRADELEVELS':
$table_properties = db_properties($table);
$columns = '';
foreach ($table_properties as $column => $values) {
if ($column != 'ID' && $column != 'SCHOOL_ID' && $column != 'NEXT_GRADE_ID') {
$columns .= ',' . $column;
}
}
DBQuery("INSERT INTO {$table} (ID,SCHOOL_ID" . $columns . ") SELECT nextval('" . $table . "_SEQ'),'{$id}' AS SCHOOL_ID" . $columns . " FROM {$table} WHERE SCHOOL_ID='" . UserSchool() . "'");
break;
case 'SCHOOL_MARKING_PERIODS':
DBQuery("INSERT INTO SCHOOL_MARKING_PERIODS (MARKING_PERIOD_ID,PARENT_ID,SYEAR,MP,SCHOOL_ID,TITLE,SHORT_NAME,SORT_ORDER,START_DATE,END_DATE,POST_START_DATE,POST_END_DATE,DOES_GRADES,DOES_COMMENTS,ROLLOVER_ID) SELECT " . db_seq_nextval('MARKING_PERIOD_SEQ') . ",PARENT_ID,SYEAR,MP,'{$id}' AS SCHOOL_ID,TITLE,SHORT_NAME,SORT_ORDER,START_DATE,END_DATE,POST_START_DATE,POST_END_DATE,DOES_GRADES,DOES_COMMENTS,MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'");
DBQuery("UPDATE SCHOOL_MARKING_PERIODS SET PARENT_ID=(SELECT mp.MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS mp WHERE mp.SYEAR=school_marking_periods.SYEAR AND mp.SCHOOL_ID=school_marking_periods.SCHOOL_ID AND mp.ROLLOVER_ID=school_marking_periods.PARENT_ID) WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='{$id}'");
break;
case 'REPORT_CARD_GRADES':
DBQuery("INSERT INTO REPORT_CARD_GRADE_SCALES (ID,SYEAR,SCHOOL_ID,TITLE,COMMENT,HR_GPA_VALUE,HHR_GPA_VALUE,SORT_ORDER,ROLLOVER_ID) SELECT " . db_seq_nextval('REPORT_CARD_GRADE_SCALES_SEQ') . ",SYEAR,'{$id}',TITLE,COMMENT,HR_GPA_VALUE,HHR_GPA_VALUE,SORT_ORDER,ID FROM REPORT_CARD_GRADE_SCALES WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'");
DBQuery("INSERT INTO REPORT_CARD_GRADES (ID,SYEAR,SCHOOL_ID,TITLE,COMMENT,BREAK_OFF,GPA_VALUE,GRADE_SCALE_ID,SORT_ORDER) SELECT " . db_seq_nextval('REPORT_CARD_GRADES_SEQ') . ",SYEAR,'{$id}',TITLE,COMMENT,BREAK_OFF,GPA_VALUE,(SELECT ID FROM REPORT_CARD_GRADE_SCALES WHERE ROLLOVER_ID=report_card_grades.GRADE_SCALE_ID AND SCHOOL_ID='{$id}'),SORT_ORDER FROM REPORT_CARD_GRADES WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'");
break;
case 'REPORT_CARD_COMMENTS':
DBQuery("INSERT INTO REPORT_CARD_COMMENTS (ID,SYEAR,SCHOOL_ID,TITLE,SORT_ORDER,CATEGORY_ID,COURSE_ID) SELECT " . db_seq_nextval('REPORT_CARD_COMMENTS_SEQ') . ",SYEAR,'{$id}',TITLE,SORT_ORDER,NULL,NULL FROM REPORT_CARD_COMMENTS WHERE COURSE_ID IS NULL AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'");
break;
case 'ELIGIBILITY_ACTIVITIES':
case 'ATTENDANCE_CODES':
$table_properties = db_properties($table);
$columns = '';
foreach ($table_properties as $column => $values) {
if ($column != 'ID' && $column != 'SYEAR' && $column != 'SCHOOL_ID') {
$columns .= ',' . $column;
}
}
DBQuery("INSERT INTO {$table} (ID,SYEAR,SCHOOL_ID" . $columns . ") SELECT nextval('" . $table . "_SEQ'),SYEAR,'{$id}' AS SCHOOL_ID" . $columns . " FROM {$table} WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'");
break;
}
}