当前位置: 首页>>代码示例>>PHP>>正文


PHP GetAllMP函数代码示例

本文整理汇总了PHP中GetAllMP函数的典型用法代码示例。如果您正苦于以下问题:PHP GetAllMP函数的具体用法?PHP GetAllMP怎么用?PHP GetAllMP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetAllMP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: UpdateAttendanceDaily

function UpdateAttendanceDaily($student_id, $date = '', $comment = false)
{
    $daysWeek = _('SuMoTuWeThFrSa');
    /// Days of the week
    if (!$date) {
        $date = DBDate();
    }
    $sql = "SELECT\n\t\t\t\tsum(sp.LENGTH) AS TOTAL\n\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac\n\t\t\tWHERE\n\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\n\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\n\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cp.PERIOD_ID\n\t\t\t\tAND position(substring('{$daysWeek}' FROM cast(extract(DOW FROM cast('{$date}' AS DATE)) AS INT)*2+1 FOR 2) IN cp.DAYS)>0\n\t\t\t\tAND s.STUDENT_ID='{$student_id}'\n\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\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))\n\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t";
    $RET = DBGet(DBQuery($sql));
    $total = $RET[1]['TOTAL'];
    if ($total == 0) {
        return;
    }
    $sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\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'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'";
    $RET = DBGet(DBQuery($sql));
    $total -= $RET[1]['TOTAL'];
    $sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\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'\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';
    }
    $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) . "')");
    }
}
开发者ID:linil,项目名称:centreSIS,代码行数:35,代码来源:Attendance.php

示例2: 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) . "')");
    }
}
开发者ID:26746647,项目名称:Belize-openSIS,代码行数:47,代码来源:Attendance.php

示例3: UpdateAttendanceDaily

function UpdateAttendanceDaily($student_id, $date = '', $comment = false)
{
    if (!$date) {
        $date = DBDate();
    }
    //modif Francois: days numbered
    //modif Francois: multiple school periods for a course period
    if (SchoolInfo('NUMBER_DAYS_ROTATION') !== null) {
        $sql = "SELECT\n\t\t\t\t\tsum(sp.LENGTH) AS TOTAL\n\t\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac, COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\t\t\tWHERE \n\t\t\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND\n\t\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\n\t\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\n\t\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cpsp.PERIOD_ID\n\t\t\t\t\tAND position(substring('MTWHFSU' FROM cast((SELECT CASE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " WHEN 0 THEN " . SchoolInfo('NUMBER_DAYS_ROTATION') . " ELSE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " END AS day_number FROM attendance_calendar WHERE school_date>=(SELECT start_date FROM school_marking_periods WHERE start_date<='{$date}' AND end_date>='{$date}' AND mp='QTR') AND school_date<='{$date}') AS INT) FOR 1) IN cpsp.DAYS)>0\n\t\t\t\t\tAND s.STUDENT_ID='{$student_id}'\n\t\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\n\t\t\t\t\tAND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\n\t\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t\t";
    } else {
        $sql = "SELECT\n\t\t\t\t\tsum(sp.LENGTH) AS TOTAL\n\t\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac, COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\t\t\tWHERE \n\t\t\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND\n\t\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\n\t\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\n\t\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cpsp.PERIOD_ID\n\t\t\t\t\tAND position(substring('UMTWHFS' FROM cast(extract(DOW FROM cast('{$date}' AS DATE)) AS INT)+1 FOR 1) IN cpsp.DAYS)>0\n\t\t\t\t\tAND s.STUDENT_ID='{$student_id}'\n\t\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\n\t\t\t\t\tAND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\n\t\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t\t";
    }
    $RET = DBGet(DBQuery($sql));
    $total = $RET[1]['TOTAL'];
    if ($total == 0) {
        return;
    }
    $sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\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'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'";
    $RET = DBGet(DBQuery($sql));
    $total -= $RET[1]['TOTAL'];
    $sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\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'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'";
    $RET = DBGet(DBQuery($sql));
    $total -= $RET[1]['TOTAL'] * 0.5;
    if ($total >= Config('ATTENDANCE_FULL_DAY_MINUTES')) {
        $length = '1.0';
    } elseif ($total >= Config('ATTENDANCE_FULL_DAY_MINUTES') / 2) {
        $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='" . $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='" . $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) . "','" . $comment . "')");
    }
}
开发者ID:fabioassuncao,项目名称:rosariosis,代码行数:39,代码来源:Attendance.php

示例4: DBDate

 } else {
     $date = DBDate();
     $date_extra = 'OR sr.END_DATE IS NULL';
 }
 $columns = array('PERIOD_TITLE' => '' . _('Period - Teacher') . '', 'MARKING_PERIOD_ID' => '' . _('Term') . '', 'DAYS' => '' . _('Days') . '', 'DURATION' => '' . _('Time') . '', 'ROOM' => '' . _('Room') . '', 'COURSE_TITLE' => '' . _('Course') . '');
 $extra['SELECT'] .= ',c.TITLE AS COURSE_TITLE,p_cp.TITLE AS PERIOD_TITLE,sr.MARKING_PERIOD_ID,p_cp.DAYS, CONCAT(sp.START_TIME,\'' . ' to ' . '\', sp.END_TIME) AS DURATION,p_cp.ROOM';
 $extra['FROM'] .= ' LEFT OUTER JOIN schedule sr ON (sr.STUDENT_ID=ssm.STUDENT_ID),courses c,course_periods p_cp,school_periods sp ';
 //	$extra['WHERE'] .= " AND p_cp.PERIOD_ID=sp.PERIOD_ID AND ssm.SYEAR=sr.SYEAR AND sr.COURSE_ID=c.COURSE_ID AND sr.COURSE_PERIOD_ID=p_cp.COURSE_PERIOD_ID AND p_cp.PERIOD_ID=sp.PERIOD_ID  AND ('$date' BETWEEN sr.START_DATE AND sr.END_DATE $date_extra)";
 $extra['WHERE'] .= ' AND p_cp.PERIOD_ID=sp.PERIOD_ID AND ssm.SYEAR=sr.SYEAR AND sr.COURSE_ID=c.COURSE_ID AND sr.COURSE_PERIOD_ID=p_cp.COURSE_PERIOD_ID AND p_cp.PERIOD_ID=sp.PERIOD_ID';
 if ($_REQUEST['include_inactive'] != 'Y') {
     $extra['WHERE'] .= ' AND (\'' . date('Y-m-d', strtotime($date)) . '\' BETWEEN sr.START_DATE AND sr.END_DATE OR (sr.END_DATE IS NULL AND sr.START_DATE<=\'' . date('Y-m-d', strtotime($date)) . '\')) ';
 }
 if ($_REQUEST['mp_id'] && (User('PROFILE_ID') != 0 && User('PROFILE_ID') != 3)) {
     $extra['WHERE'] .= ' AND sr.MARKING_PERIOD_ID=' . $_REQUEST['mp_id'] . '';
 } else {
     $extra['WHERE'] .= ' AND sr.MARKING_PERIOD_ID IN (' . GetAllMP(GetMPTable(GetMP($_REQUEST['mp_id'], 'TABLE')), $_REQUEST['mp_id']) . ')';
 }
 $extra['functions'] = array('MARKING_PERIOD_ID' => 'GetMP', 'DAYS' => '_makeDays');
 $extra['group'] = array('STUDENT_ID');
 $extra['ORDER'] = ',sp.SORT_ORDER';
 if ($_REQUEST['mailing_labels'] == 'Y') {
     $extra['group'][] = 'ADDRESS_ID';
 }
 Widgets('mailing_labels');
 $RET = GetStuList($extra);
 if (count($RET)) {
     $handle = PDFStart();
     foreach ($RET as $student_id => $courses) {
         echo "<meta charset='UTF-8'><table width=100%  style=\" font-family:Arial; font-size:12px;\" >";
         echo "<tr><td width=105>" . DrawLogo() . "</td><td  style=\"font-size:15px; font-weight:bold; padding-top:20px;\">" . GetSchool(UserSchool()) . "<div style=\"font-size:12px;\">" . _('Student Schedules Report') . "</div></td><td align=right style=\"padding-top:20px;\">" . ProperDate(DBDate()) . "<br />" . _('Powered by openSIS') . "</td></tr><tr><td colspan=3 style=\"border-top:1px solid #333;\">&nbsp;</td></tr></table>";
         if ($_REQUEST['mailing_labels'] == 'Y') {
开发者ID:SysBind,项目名称:opensis-ml,代码行数:31,代码来源:PrintSchedules.php

示例5: _makeCodePulldown

function _makeCodePulldown($value, $title)
{
    global $THIS_RET, $codes_RET, $current_RET, $current_schedule_RET, $date;
    if (!is_array($current_schedule_RET[$THIS_RET['STUDENT_ID']])) {
        $current_schedule_RET[$THIS_RET['STUDENT_ID']] = DBGet(DBQuery('SELECT cp.PERIOD_ID,cp.COURSE_PERIOD_ID FROM schedule s,course_periods cp WHERE s.STUDENT_ID=\'' . $THIS_RET['STUDENT_ID'] . '\' AND s.SYEAR=\'' . UserSyear() . '\' AND s.SCHOOL_ID=\'' . UserSchool() . '\' AND cp.COURSE_PERIOD_ID = s.COURSE_PERIOD_ID AND cp.DOES_ATTENDANCE=\'Y\' AND s.MARKING_PERIOD_ID IN (' . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ') AND (\'' . $date . '\' BETWEEN s.START_DATE AND s.END_DATE OR s.END_DATE IS NULL)'), array(), array('PERIOD_ID'));
        if (!$current_schedule_RET[$THIS_RET['STUDENT_ID']]) {
            $current_schedule_RET[$THIS_RET['STUDENT_ID']] = array();
        }
    }
    if ($THIS_RET['COURSE']) {
        $period = $THIS_RET['COURSE_PERIOD_ID'];
        $period_id = $THIS_RET['PERIOD_ID'];
        foreach ($codes_RET as $code) {
            $options[$code['ID']] = $code['TITLE'];
        }
    } else {
        $period_id = substr($title, 7);
        $period = $current_schedule_RET[$THIS_RET['STUDENT_ID']][$period_id][1]['COURSE_PERIOD_ID'];
        foreach ($codes_RET as $code) {
            $options[$code['ID']] = $code['SHORT_NAME'];
        }
    }
    $val = $current_RET[$THIS_RET['STUDENT_ID']][$period][1]['ATTENDANCE_CODE'];
    if ($current_schedule_RET[$THIS_RET['STUDENT_ID']][$period_id]) {
        return SelectInput($val, 'attendance[' . $THIS_RET['STUDENT_ID'] . '][' . $period . '][ATTENDANCE_CODE]', '', $options);
    } else {
        return false;
    }
}
开发者ID:SysBind,项目名称:opensis-ml,代码行数:29,代码来源:Administration_fast.php

示例6: GetStuList


//.........这里部分代码省略.........
            //$sql = 'SELECT '.$distinct;
            if (isset($extra['SELECT_ONLY'])) {
                $sql .= $extra['SELECT_ONLY'];
            } else {
                $sql .= "s.LAST_NAME||', '||s.FIRST_NAME||' '||coalesce(s.MIDDLE_NAME,' ') AS FULL_NAME,";
                $sql .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,ssm.SCHOOL_ID,ssm.SCHOOL_ID AS LIST_SCHOOL_ID,ssm.GRADE_ID ' . $extra['SELECT'];
                if (isset($_REQUEST['include_inactive']) && $_REQUEST['include_inactive'] == 'Y') {
                    $sql .= ',' . db_case(array("(ssm.SYEAR='" . UserSyear() . "' AND ('" . $extra['DATE'] . "'>=ssm.START_DATE AND ('" . $extra['DATE'] . "'<=ssm.END_DATE OR ssm.END_DATE IS NULL)))", 'TRUE', '\'<span style="color:green">' . _('Active') . '</span>\'', '\'<span style="color:red">' . _('Inactive') . '</span>\'')) . ' AS ACTIVE';
                }
            }
            $sql .= " FROM STUDENTS s JOIN STUDENT_ENROLLMENT ssm ON (ssm.STUDENT_ID=s.STUDENT_ID";
            if (isset($_REQUEST['include_inactive']) && $_REQUEST['include_inactive'] == 'Y') {
                //$sql .= " AND ssm.ID=(SELECT max(ID) FROM STUDENT_ENROLLMENT WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR<='".UserSyear()."')";
                $sql .= " AND ssm.ID=(SELECT ID FROM STUDENT_ENROLLMENT WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR<='" . UserSyear() . "' ORDER BY SYEAR DESC,START_DATE DESC LIMIT 1)";
            } else {
                $sql .= " AND ssm.SYEAR='" . UserSyear() . "' AND ('" . $extra['DATE'] . "'>=ssm.START_DATE AND (ssm.END_DATE IS NULL OR '" . $extra['DATE'] . "'<=ssm.END_DATE))";
            }
            if (UserSchool() && $_REQUEST['_search_all_schools'] != 'Y') {
                $sql .= " AND ssm.SCHOOL_ID='" . UserSchool() . "'";
            } else {
                if (User('SCHOOLS')) {
                    $sql .= " AND ssm.SCHOOL_ID IN (" . mb_substr(str_replace(',', "','", User('SCHOOLS')), 2, -2) . ") ";
                }
                $extra['columns_after']['LIST_SCHOOL_ID'] = 'School';
                $functions['LIST_SCHOOL_ID'] = 'GetSchool';
            }
            $sql .= ")" . $extra['FROM'] . " WHERE TRUE";
            if (empty($extra['SELECT_ONLY']) && isset($_REQUEST['include_inactive']) && $_REQUEST['include_inactive'] == 'Y') {
                $extra['columns_after']['ACTIVE'] = _('Status');
            }
            break;
        case 'teacher':
            $sql = 'SELECT ';
            //$sql = 'SELECT '.$distinct;
            if ($extra['SELECT_ONLY']) {
                $sql .= $extra['SELECT_ONLY'];
            } else {
                $sql .= "s.LAST_NAME||', '||s.FIRST_NAME||' '||coalesce(s.MIDDLE_NAME,' ') AS FULL_NAME,";
                $sql .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,ssm.SCHOOL_ID,ssm.GRADE_ID ' . $extra['SELECT'];
                if ($_REQUEST['include_inactive'] == 'Y') {
                    $sql .= ',' . db_case(array("('" . $extra['DATE'] . "'>=ssm.START_DATE AND (ssm.END_DATE IS NULL OR '" . $extra['DATE'] . "'<=ssm.END_DATE))", 'TRUE', '\'<span style="color:green">' . _('Active') . '</span>\'', '\'<span style="color:red">' . _('Inactive') . '</span>\'')) . ' AS ACTIVE';
                    $sql .= ',' . db_case(array("('" . $extra['DATE'] . "'>=ss.START_DATE AND (ss.END_DATE IS NULL OR '" . $extra['DATE'] . "'<=ss.END_DATE)) AND ss.MARKING_PERIOD_ID IN (" . GetAllMP($extra['MPTable'], $extra['MP']) . ")", 'TRUE', '\'<span style="color:green">' . _('Active') . '</span>\'', '\'<span style="color:red">' . _('Inactive') . '</span>\'')) . ' AS ACTIVE_SCHEDULE';
                }
            }
            $sql .= " FROM STUDENTS s JOIN SCHEDULE ss ON (ss.STUDENT_ID=s.STUDENT_ID AND ss.SYEAR='" . UserSyear() . "'";
            if ($_REQUEST['include_inactive'] == 'Y') {
                $sql .= " AND ss.START_DATE=(SELECT START_DATE FROM SCHEDULE WHERE STUDENT_ID=s.STUDENT_ID AND SYEAR=ss.SYEAR AND COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID ORDER BY START_DATE DESC LIMIT 1)";
            } else {
                $sql .= " AND ss.MARKING_PERIOD_ID IN (" . GetAllMP($extra['MPTable'], $extra['MP']) . ") AND ('" . $extra['DATE'] . "'>=ss.START_DATE AND ('" . $extra['DATE'] . "'<=ss.END_DATE OR ss.END_DATE IS NULL))";
            }
            $sql .= ") JOIN COURSE_PERIODS cp ON (cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID AND " . ($extra['all_courses'] == 'Y' ? "cp.TEACHER_ID='" . User('STAFF_ID') . "'" : "cp.COURSE_PERIOD_ID='" . UserCoursePeriod() . "'") . ")\n\t\t\t\tJOIN STUDENT_ENROLLMENT ssm ON (ssm.STUDENT_ID=s.STUDENT_ID AND ssm.SYEAR=ss.SYEAR AND ssm.SCHOOL_ID='" . UserSchool() . "'";
            if ($_REQUEST['include_inactive'] == 'Y') {
                $sql .= " AND ssm.ID=(SELECT ID FROM STUDENT_ENROLLMENT WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR=ssm.SYEAR ORDER BY START_DATE DESC LIMIT 1)";
            } else {
                $sql .= " AND ('" . $extra['DATE'] . "'>=ssm.START_DATE AND (ssm.END_DATE IS NULL OR '" . $extra['DATE'] . "'<=ssm.END_DATE))";
            }
            $sql .= ")" . $extra['FROM'] . " WHERE TRUE";
            if (!$extra['SELECT_ONLY'] && $_REQUEST['include_inactive'] == 'Y') {
                $extra['columns_after']['ACTIVE'] = _('School Status');
                $extra['columns_after']['ACTIVE_SCHEDULE'] = _('Course Status');
            }
            break;
        case 'parent':
        case 'student':
            $sql = 'SELECT ';
            if ($extra['SELECT_ONLY']) {
                $sql .= $extra['SELECT_ONLY'];
            } else {
                $sql .= "s.LAST_NAME||', '||s.FIRST_NAME||' '||coalesce(s.MIDDLE_NAME,' ') AS FULL_NAME,";
                $sql .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,ssm.SCHOOL_ID,ssm.GRADE_ID ' . $extra['SELECT'];
            }
            $sql .= " FROM STUDENTS s JOIN STUDENT_ENROLLMENT ssm ON (ssm.STUDENT_ID=s.STUDENT_ID AND ssm.SYEAR='" . UserSyear() . "' AND ssm.SCHOOL_ID='" . UserSchool() . "'\n\t\t\t\t\tAND ('" . $extra['DATE'] . "'>=ssm.START_DATE AND (ssm.END_DATE IS NULL OR '" . $extra['DATE'] . "'<=ssm.END_DATE)) AND s.STUDENT_ID" . ($extra['ASSOCIATED'] ? " IN (SELECT STUDENT_ID FROM STUDENTS_JOIN_USERS WHERE STAFF_ID='" . $extra['ASSOCIATED'] . "')" : "='" . UserStudentID() . "'");
            $sql .= ")" . $extra['FROM'] . " WHERE TRUE";
            break;
        default:
            exit(_('Error'));
    }
    //$sql = appendSQL($sql,array('NoSearchTerms'=>$extra['NoSearchTerms']));
    $sql .= ' ' . $extra['WHERE'] . ' ';
    if (isset($extra['GROUP'])) {
        $sql .= ' GROUP BY ' . $extra['GROUP'];
    }
    if (!isset($extra['ORDER_BY']) && !isset($extra['SELECT_ONLY'])) {
        $sql .= ' ORDER BY ';
        if (Preferences('SORT') == 'Grade') {
            $sql .= '(SELECT SORT_ORDER FROM SCHOOL_GRADELEVELS WHERE ID=ssm.GRADE_ID),';
        }
        // it would be easier to sort on full_name but postgres sometimes yields strange results
        $sql .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME';
        $sql .= $extra['ORDER'];
    } elseif (isset($extra['ORDER_BY'])) {
        $sql .= ' ORDER BY ' . $extra['ORDER_BY'];
    }
    //modif Francois: bugfix if PDF, dont echo SQL
    if (!isset($_REQUEST['_ROSARIO_PDF']) && 0) {
        //activate only for debug purpose
        echo '<!--' . $sql . '-->';
    }
    return DBGet(DBQuery($sql), $functions, $extra['group']);
}
开发者ID:fabioassuncao,项目名称:rosariosis,代码行数:101,代码来源:GetStuList.fnc.php

示例7: DrawHeaderHome

echo "<FORM action=Modules.php?modname={$_REQUEST['modname']} method=POST>";
DrawHeaderHome(PrepareDateSchedule($date, '_date', false, array('submit' => true)) . ' - ' . $period_select . ' : <INPUT type=submit class=btn_medium value=Go>');
echo '</FORM>';
$day = date('D', strtotime($date));
switch ($day) {
    case 'Sun':
        $day = 'U';
        break;
    case 'Thu':
        $day = 'H';
        break;
    default:
        $day = substr($day, 0, 1);
        break;
}
$sql = "SELECT CONCAT(s.LAST_NAME,', ',s.FIRST_NAME) AS FULL_NAME,sp.TITLE,cp.PERIOD_ID,s.STAFF_ID\n\t\tFROM STAFF s,COURSE_PERIODS cp,SCHOOL_PERIODS sp\n\t\tWHERE\n\t\t\tsp.PERIOD_ID = cp.PERIOD_ID\n\t\t\tAND cp.TEACHER_ID=s.STAFF_ID AND cp.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\tAND cp.SYEAR='" . UserSyear() . "' AND cp.SCHOOL_ID='" . UserSchool() . "' AND s.PROFILE='teacher'\n\t\t\tAND cp.DOES_ATTENDANCE='Y' AND instr(cp.DAYS,'{$day}')>0" . ($_REQUEST['period'] ? " AND cp.PERIOD_ID='{$_REQUEST['period']}'" : '') . "\n\t\t\tAND NOT EXISTS (SELECT '' FROM ATTENDANCE_COMPLETED ac WHERE ac.STAFF_ID=cp.TEACHER_ID AND ac.SCHOOL_DATE='" . date('Y-m-d', strtotime($date)) . "' AND ac.PERIOD_ID=sp.PERIOD_ID)\n\t\t";
$RET = DBGet(DBQuery($sql), array(), array('STAFF_ID', 'PERIOD_ID'));
if (count($RET)) {
    foreach ($RET as $staff_id => $periods) {
        $i++;
        $staff_RET[$i]['FULL_NAME'] = $periods[key($periods)][1]['FULL_NAME'];
        foreach ($periods as $period_id => $period) {
            $staff_RET[$i][$period_id] = '<IMG SRC=assets/x.gif>';
        }
    }
}
$columns = array('FULL_NAME' => 'Teacher');
if (!$_REQUEST['period']) {
    foreach ($periods_RET as $id => $period) {
        $columns[$id] = $period[1]['TITLE'];
    }
开发者ID:SoftScape,项目名称:opensis,代码行数:31,代码来源:TeacherCompletion.php

示例8: UpdateAttendanceDaily

function UpdateAttendanceDaily($student_id, $date = '', $comment = false)
{
    if (!$date) {
        $date = DBDate();
    }
    $current_mp = GetCurrentMP('QTR', $date);
    $MP_TYPE = 'QTR';
    if (!$current_mp) {
        $current_mp = GetCurrentMP('SEM', $date);
        $MP_TYPE = 'SEM';
    }
    if (!$current_mp) {
        $current_mp = GetCurrentMP('FY', $date);
        $MP_TYPE = 'FY';
    }
    $sql = 'SELECT
				SUM(sp.LENGTH) AS TOTAL
			FROM schedule s,course_periods cp,course_period_var cpv,school_periods sp,attendance_calendar ac
			WHERE
				s.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND cpv.DOES_ATTENDANCE=\'Y\'
				AND ac.SCHOOL_DATE=\'' . $date . '\' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)
                                AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID
				AND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR
				AND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cpv.PERIOD_ID
				AND position(substring(\'UMTWHFS\' FROM DAYOFWEEK(\'' . $date . '\')  FOR 1) IN cpv.DAYS)>0
				AND s.STUDENT_ID=\'' . $student_id . '\'
				AND s.SYEAR=\'' . UserSyear() . '\'
				AND (\'' . $date . '\' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND \'' . $date . '\'>=s.START_DATE))
				AND s.MARKING_PERIOD_ID IN (' . GetAllMP($MP_TYPE, $current_mp) . ')
			';
    $RET = DBGet(DBQuery($sql));
    $total = $RET[1]['TOTAL'];
    if ($total == 0) {
        return;
    }
    $current_RET = DBGet(DBQuery('SELECT MINUTES_PRESENT,STATE_VALUE,COMMENT FROM attendance_day WHERE STUDENT_ID=' . $student_id . ' AND SCHOOL_DATE=\'' . $date . '\''));
    $total = $current_RET['MINUTES_PRESENT'];
    $sql = 'SELECT SUM(sp.LENGTH) AS TOTAL
			FROM attendance_period ap,school_periods sp,attendance_codes ac
			WHERE 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=\'P\'
			AND sp.SYEAR=\'' . UserSyear() . '\'';
    $RET = DBGet(DBQuery($sql));
    $total += $RET[1]['TOTAL'];
    $sql = 'SELECT SUM(sp.LENGTH) AS TOTAL
			FROM attendance_period ap,school_periods sp,attendance_codes ac
			WHERE 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\'
			AND sp.SYEAR=\'' . UserSyear() . '\'';
    $RET = DBGet(DBQuery($sql));
    $total += $RET[1]['TOTAL'] * 0.5;
    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 && $length != $current_RET[1]['STATE_VALUE']) {
        DBQuery('UPDATE attendance_day SET STATE_VALUE=\'' . $length . '\' 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) {
        $check_assoc = DBGet(DBQuery('SELECT COUNT(*) as REC_EX FROM attendance_period ap,course_periods cp WHERE ap.STUDENT_ID=' . $student_id . ' AND ap.SCHOOL_DATE=\'' . $date . '\' AND cp.COURSE_PERIOD_ID=ap.COURSE_PERIOD_ID AND cp.SCHOOL_ID=' . UserSchool() . ' AND cp.SYEAR=' . UserSyear()));
        if ($check_assoc[1]['REC_EX'] > 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 . '\',\'' . $current_mp . '\',\'' . str_replace("", "", $comment) . '\')');
        }
    }
}
开发者ID:jicheng17,项目名称:fh,代码行数:77,代码来源:AttendanceFnc.php

示例9: DrawHeaderHome

    echo "<div style='width:795px; overflow:scroll; overflow-y:hidden;'>";
    DrawHeaderHome('<table><tr><td>' . PrepareDate($start_date, '_start') . '</td><td> - </td><td>' . PrepareDate($end_date, '_end') . '</td><td> : </td><td>' . $period_select . ' : <INPUT type=submit class=btn_medium value=Go></td></tr></table>');
}
$cal_RET = DBGet(DBQuery('SELECT DISTINCT SCHOOL_DATE,CONCAT(\'_\',DATE_FORMAT(SCHOOL_DATE,\'%y%b%d\')) AS SHORT_DATE FROM attendance_calendar WHERE SCHOOL_ID=\'' . UserSchool() . '\' AND SCHOOL_DATE BETWEEN \'' . date('Y-m-d', strtotime($start_date)) . '\' AND \'' . date('Y-m-d', strtotime($end_date)) . '\' ORDER BY SCHOOL_DATE'));
if (UserStudentID() || $_REQUEST['student_id'] || User('PROFILE') == 'parent') {
    // JUST TO SET USERSTUDENTID()
    Search('student_id');
    if ($_REQUEST['period_id']) {
        $sql = 'SELECT
				cp.TITLE as COURSE_PERIOD,sp.TITLE as PERIOD,cpv.PERIOD_ID
			FROM
				schedule s,courses c,course_periods cp,course_period_var cpv,school_periods sp
			WHERE
				s.COURSE_ID = c.COURSE_ID AND s.COURSE_ID = cp.COURSE_ID AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID
				AND s.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND cpv.PERIOD_ID = sp.PERIOD_ID AND cpv.DOES_ATTENDANCE=\'Y\'
				AND s.SYEAR = c.SYEAR AND cp.MARKING_PERIOD_ID IN (' . GetAllMP('QTR', UserMP()) . ')
				AND s.STUDENT_ID=\'' . UserStudentID() . '\' AND s.SYEAR=\'' . UserSyear() . '\'
				AND (\'' . DBDate() . '\' BETWEEN s.START_DATE AND s.END_DATE OR s.END_DATE IS NULL)
			ORDER BY sp.SORT_ORDER
			';
        $schedule_RET = DBGet(DBQuery($sql));
        $sql = 'SELECT ap.SCHOOL_DATE,ap.PERIOD_ID,ac.SHORT_NAME,ac.STATE_CODE,ac.DEFAULT_CODE FROM attendance_period ap,attendance_codes ac WHERE ap.SCHOOL_DATE BETWEEN \'' . $start_date . '\' AND \'' . $end_date . '\' AND ap.ATTENDANCE_CODE=ac.ID AND ap.STUDENT_ID=\'' . UserStudentID() . '\'';
        $attendance_RET = DBGet(DBQuery($sql), array(), array('SCHOOL_DATE', 'PERIOD_ID'));
    } else {
        $schedule_RET[1] = array('COURSE_PERIOD' => 'Daily Attendance', 'PERIOD_ID' => '0');
        $attendance_RET = DBGet(DBQuery('SELECT ad.SCHOOL_DATE,\'0\' AS PERIOD_ID,ad.STATE_VALUE AS STATE_CODE,' . db_case(array('ad.STATE_VALUE', "'0.0'", "'A'", "'1.0'", "'P'", "'H'")) . ' AS SHORT_NAME FROM attendance_day ad WHERE ad.SCHOOL_DATE BETWEEN \'' . $start_date . '\' AND \'' . $end_date . '\' AND ad.STUDENT_ID=\'' . UserStudentID() . '\''), array(), array('SCHOOL_DATE', 'PERIOD_ID'));
    }
    $i = 0;
    if (count($schedule_RET)) {
        foreach ($schedule_RET as $course) {
            $i++;
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:31,代码来源:DailySummary_old.php

示例10: calcSeats0

function calcSeats0($period)
{
    $mp = $period['MARKING_PERIOD_ID'];
    $seats = DBGet(DBQuery("SELECT max((SELECT count(1) FROM SCHEDULE ss JOIN STUDENT_ENROLLMENT sem ON (sem.STUDENT_ID=ss.STUDENT_ID AND sem.SYEAR=ss.SYEAR) WHERE ss.COURSE_PERIOD_ID='{$period['COURSE_PERIOD_ID']}' AND (ss.MARKING_PERIOD_ID='{$mp}' OR ss.MARKING_PERIOD_ID IN (" . GetAllMP(GetMP($mp, 'MP'), $mp) . ")) AND (ac.SCHOOL_DATE>=ss.START_DATE AND (ss.END_DATE IS NULL OR ac.SCHOOL_DATE<=ss.END_DATE)) AND (ac.SCHOOL_DATE>=sem.START_DATE AND (sem.END_DATE IS NULL OR ac.SCHOOL_DATE<=sem.END_DATE)))) AS FILLED_SEATS FROM ATTENDANCE_CALENDAR ac WHERE ac.CALENDAR_ID='{$period['CALENDAR_ID']}' AND ac.SCHOOL_DATE BETWEEN " . db_case(array("(CURRENT_DATE>'" . GetMP($mp, 'END_DATE') . "')", 'TRUE', "'" . GetMP($mp, 'START_DATE') . "'", 'CURRENT_DATE')) . " AND '" . GetMP($mp, 'END_DATE') . "'"));
    return $seats[1]['FILLED_SEATS'];
}
开发者ID:fabioassuncao,项目名称:rosariosis,代码行数:6,代码来源:Scheduler.php

示例11: IN

 $MP_TYPE = $MP_TYPE_RET[1]['MP_TYPE'];
 if ($MP_TYPE == 'year') {
     $MP_TYPE = 'FY';
 } else {
     if ($MP_TYPE == 'semester') {
         $MP_TYPE = 'SEM';
     } else {
         if ($MP_TYPE == 'quarter') {
             $MP_TYPE = 'QTR';
         } else {
             $MP_TYPE = '';
         }
     }
 }
 if ($_REQUEST['period_id']) {
     $sql = "SELECT\r\n                cp.TITLE as COURSE_PERIOD,sp.TITLE as PERIOD,cp.PERIOD_ID, cp.COURSE_PERIOD_ID\r\n            FROM\r\n                SCHEDULE s,COURSES c,COURSE_PERIODS cp,SCHOOL_PERIODS sp\r\n            WHERE\r\n                s.COURSE_ID = c.COURSE_ID AND s.COURSE_ID = cp.COURSE_ID\r\n                AND s.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND cp.PERIOD_ID = sp.PERIOD_ID AND cp.DOES_ATTENDANCE='Y'\r\n                AND s.SYEAR = c.SYEAR AND cp.MARKING_PERIOD_ID IN (" . GetAllMP($MP_TYPE, UserMP()) . ")\r\n                AND s.STUDENT_ID='" . UserStudentID() . "' AND s.SYEAR='" . UserSyear() . "'\r\n                AND ('" . date('Y-m-d', strtotime(DBDate())) . "' BETWEEN s.START_DATE AND s.END_DATE OR s.END_DATE IS NULL)\r\n            ORDER BY sp.SORT_ORDER\r\n            ";
     $schedule_RET = DBGet(DBQuery($sql));
     $sql = "SELECT ap.SCHOOL_DATE,ap.COURSE_PERIOD_ID,ac.SHORT_NAME,ac.STATE_CODE,ac.DEFAULT_CODE FROM ATTENDANCE_PERIOD ap,ATTENDANCE_CODES ac WHERE ap.SCHOOL_DATE BETWEEN '" . date('Y-m-d', strtotime($start_date)) . "' AND '" . date('Y-m-d', strtotime($end_date)) . "' AND ap.ATTENDANCE_CODE=ac.ID AND ap.STUDENT_ID='" . UserStudentID() . "'";
     $attendance_RET = DBGet(DBQuery($sql), array(), array('SCHOOL_DATE', 'COURSE_PERIOD_ID'));
 } else {
     $schedule_RET[1] = array('COURSE_PERIOD' => 'Daily Attendance', 'COURSE_PERIOD_ID' => '0');
     $attendance_RET = DBGet(DBQuery("SELECT ad.SCHOOL_DATE,'0' AS COURSE_PERIOD_ID,ad.STATE_VALUE AS STATE_CODE," . db_case(array('ad.STATE_VALUE', "'0.0'", "'A'", "'1.0'", "'P'", "'H'")) . " AS SHORT_NAME FROM ATTENDANCE_DAY ad WHERE ad.SCHOOL_DATE BETWEEN '" . date('Y-m-d', strtotime($start_date)) . "' AND '" . date('Y-m-d', strtotime($end_date)) . "' AND ad.STUDENT_ID='" . UserStudentID() . "'"), array(), array('SCHOOL_DATE', 'COURSE_PERIOD_ID'));
 }
 $i = 0;
 if (count($schedule_RET)) {
     foreach ($schedule_RET as $course) {
         $i++;
         $student_RET[$i]['TITLE'] = $course['COURSE_PERIOD'];
         foreach ($cal_RET as $value) {
             $student_RET[$i][$value['SHORT_DATE']] = _makePeriodColor($attendance_RET[$value['SCHOOL_DATE']][$course['COURSE_PERIOD_ID']][1]['SHORT_NAME'], $attendance_RET[$value['SCHOOL_DATE']][$course['COURSE_PERIOD_ID']][1]['STATE_CODE'], $attendance_RET[$value['SCHOOL_DATE']][$course['COURSE_PERIOD_ID']][1]['DEFAULT_CODE']);
         }
开发者ID:26746647,项目名称:Belize-openSIS,代码行数:31,代码来源:DailySummary.php

示例12: DBGet

         continue;
     }
 }
 # ------------------------------------ PARENT RESTRICTION ENDS----------------------------------------- #
 if ($_SESSION['MassSchedule.php']['gender'] != 'N') {
     $select_stu_RET = DBGet(DBQuery('SELECT FIRST_NAME,LAST_NAME,LEFT(GENDER,1) AS GENDER FROM students WHERE STUDENT_ID=\'' . $student_id . '\''));
     if ($_SESSION['MassSchedule.php']['gender'] != $select_stu_RET[1]['GENDER']) {
         $select_stu = $select_stu_RET[1]['FIRST_NAME'] . "&nbsp;" . $select_stu_RET[1]['LAST_NAME'];
         $gender_conflict .= $select_stu . "<br>";
         continue;
     }
     #$clash = true;
 }
 # ------------------------------------ Same Days Conflict Start ------------------------------------------ #
 $mp_RET = DBGet(DBQuery('SELECT cp.MP,cp.MARKING_PERIOD_ID,cpv.DAYS,cpv.PERIOD_ID,cp.MARKING_PERIOD_ID,cp.TOTAL_SEATS,COALESCE(cp.FILLED_SEATS,0) AS FILLED_SEATS FROM course_periods cp,course_period_var cpv WHERE cp.COURSE_PERIOD_ID=\'' . $_SESSION['MassSchedule.php']['course_period_id'] . '\' AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID'));
 $mps = GetAllMP(GetMPTable(GetMP($mp_RET[1]['MARKING_PERIOD_ID'], 'TABLE')), $mp_RET[1]['MARKING_PERIOD_ID']);
 $period_RET = DBGet(DBQuery('SELECT cpv.DAYS FROM schedule s,course_periods cp,course_period_var cpv WHERE cp.COURSE_PERIOD_ID=s.COURSE_PERIOD_ID AND s.STUDENT_ID=\'' . $student_id . '\' AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID AND cpv.PERIOD_ID=\'' . $mp_RET[1]['PERIOD_ID'] . '\' AND s.MARKING_PERIOD_ID IN (' . $mps . ') AND (s.END_DATE IS NULL OR \'' . $convdate . '\'<=s.END_DATE)'));
 $ig_scheld = DBGet(DBQuery('SELECT IGNORE_SCHEDULING FROM school_periods WHERE PERIOD_ID=\'' . $mp_RET[1]['PERIOD_ID'] . '\' AND SCHOOL_ID=\'' . UserSchool() . '\''));
 $sql_dupl = 'SELECT COURSE_PERIOD_ID FROM schedule WHERE STUDENT_ID = \'' . $student_id . '\' AND COURSE_PERIOD_ID = \'' . $_SESSION['MassSchedule.php']['course_period_id'] . '\' AND (END_DATE IS NULL OR (\'' . $convdate . '\' BETWEEN START_DATE AND END_DATE)) AND SCHOOL_ID=\'' . UserSchool() . '\'';
 $rit_dupl = DBQuery($sql_dupl);
 $count_entry = mysql_num_rows($rit_dupl);
 $days_conflict = false;
 if ($count_entry < 1 && $ig_scheld[1]['IGNORE_SCHEDULING'] != 'Y') {
     foreach ($period_RET as $existing) {
         if (strlen($mp_RET[1]['DAYS']) + strlen($existing['DAYS']) > 7) {
             $days_conflict = true;
             break;
         } else {
             foreach (_str_split($mp_RET[1]['DAYS']) as $i) {
                 if (strpos($existing['DAYS'], $i) !== false) {
                     $days_conflict = true;
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:31,代码来源:MassSchedule.php

示例13: DrawBC

#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#***************************************************************************************
include '../../Redirect_modules.php';
DrawBC(_('Gradebook') . " > " . ProgramTitle());
if (!$_REQUEST['LO_sort']) {
    $_REQUEST['LO_sort'] = "CUM_RANK";
    $_REQUEST['LO_direction'] = 1;
}
if ($_REQUEST['search_modfunc'] == 'list') {
    if (!$_REQUEST['mp'] && GetMP(UserMP(), 'POST_START_DATE')) {
        $_REQUEST['mp'] = UserMP();
    } elseif (strpos(GetAllMP('QTR', UserMP()), str_replace('E', '', $_REQUEST['mp'])) === false && strpos(GetChildrenMP('PRO', UserMP()), "'" . $_REQUEST['mp'] . "'") === false && GetMP(UserMP(), 'POST_START_DATE')) {
        $_REQUEST['mp'] = UserMP();
    }
    if (!$_REQUEST['mp'] && GetMP(GetParentMP('SEM', UserMP()), 'POST_START_DATE')) {
        $_REQUEST['mp'] = GetParentMP('SEM', UserMP());
    }
    $sem = GetParentMP('SEM', UserMP());
    $pro = GetChildrenMP('PRO', UserMP());
    $pros = explode(',', str_replace("'", '', $pro));
    $pro_grading = false;
    $pro_select = '';
    foreach ($pros as $pro) {
        if (GetMP($pro, 'POST_START_DATE')) {
            if (!$_REQUEST['mp']) {
                $_REQUEST['mp'] = $pro;
                $current_RET = DBGet(DBQuery('SELECT g.STUDENT_ID,g.REPORT_CARD_GRADE_ID,g.REPORT_CARD_COMMENT_ID,g.COMMENT FROM student_report_card_grades g,course_periods cp WHERE cp.COURSE_PERIOD_ID=g.COURSE_PERIOD_ID AND cp.COURSE_PERIOD_ID=' . $course_period_id . ' AND g.MARKING_PERIOD_ID=\'' . $_REQUEST['mp'] . '\''), array(), array('STUDENT_ID'));
开发者ID:SysBind,项目名称:opensis-ml,代码行数:31,代码来源:GPARankList.php

示例14: ProperDate

        $date_select .= '<OPTION value="' . $i . '"' . ($i + 86400 >= $start_time && $i - 86400 <= $start_time ? ' SELECTED="SELECTED"' : '') . '>' . ProperDate(date('Y.m.d', $i)) . ' - ' . ProperDate(date('Y.m.d', $i + 1 + ($END_DAY - $START_DAY) * 60 * 60 * 24)) . '</OPTION>';
    }
}
DrawHeader(_('Timeframe') . ': <SELECT name="start_date">' . $date_select . '</SELECT> - ' . _('Period') . ': ' . $period_select, SubmitButton(_('Go')));
echo '</FORM>';
//modif Francois: multiple school periods for a course period
/*$sql = "SELECT s.LAST_NAME||', '||s.FIRST_NAME AS FULL_NAME,sp.TITLE,cp.PERIOD_ID,s.STAFF_ID 
		FROM STAFF s,COURSE_PERIODS cp,SCHOOL_PERIODS sp 
		WHERE 
			sp.PERIOD_ID = cp.PERIOD_ID
			AND cp.TEACHER_ID=s.STAFF_ID AND cp.MARKING_PERIOD_ID IN (".GetAllMP('QTR',UserMP()).")
			AND cp.SYEAR='".UserSyear()."' AND cp.SCHOOL_ID='".UserSchool()."' AND s.PROFILE='teacher'
			".(($_REQUEST['period'])?" AND cp.PERIOD_ID='$_REQUEST[period]'":'')."
			AND NOT EXISTS (SELECT '' FROM ELIGIBILITY_COMPLETED ac WHERE ac.STAFF_ID=cp.TEACHER_ID AND ac.PERIOD_ID = sp.PERIOD_ID AND ac.SCHOOL_DATE BETWEEN '$start_date' AND '$end_date')
		";*/
$sql = "SELECT s.LAST_NAME||', '||s.FIRST_NAME AS FULL_NAME,sp.TITLE,cpsp.PERIOD_ID,s.STAFF_ID \n\t\tFROM STAFF s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\tWHERE \n\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND \n\t\t\tsp.PERIOD_ID = cpsp.PERIOD_ID\n\t\t\tAND cp.TEACHER_ID=s.STAFF_ID AND cp.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', UserMP()) . ")\n\t\t\tAND cp.SYEAR='" . UserSyear() . "' AND cp.SCHOOL_ID='" . UserSchool() . "' AND s.PROFILE='teacher'\n\t\t\t" . ($_REQUEST['period'] ? " AND cpsp.PERIOD_ID='{$_REQUEST['period']}'" : '') . "\n\t\t\tAND NOT EXISTS (SELECT '' FROM ELIGIBILITY_COMPLETED ac WHERE ac.STAFF_ID=cp.TEACHER_ID AND ac.PERIOD_ID = sp.PERIOD_ID AND ac.SCHOOL_DATE BETWEEN '{$start_date}' AND '{$end_date}')\n\t\t";
$RET = DBGet(DBQuery($sql), array(), array('STAFF_ID', 'PERIOD_ID'));
$i = 0;
if (count($RET)) {
    foreach ($RET as $staff_id => $periods) {
        $i++;
        $staff_RET[$i]['FULL_NAME'] = $periods[key($periods)][1]['FULL_NAME'];
        foreach ($periods as $period_id => $period) {
            $staff_RET[$i][$period_id] = '<IMG SRC="assets/x.png" height="24">';
        }
    }
}
$columns = array('FULL_NAME' => _('Teacher'));
if (!$_REQUEST['period']) {
    foreach ($periods_RET as $period) {
        $columns[$period['PERIOD_ID']] = $period['TITLE'];
开发者ID:fabioassuncao,项目名称:rosariosis,代码行数:31,代码来源:TeacherCompletion.php

示例15: GetStaffList

function GetStaffList(&$extra)
{
    global $profiles_RET, $_CENTRE;
    $functions = array('PROFILE' => 'makeProfile');
    switch (User('PROFILE')) {
        case 'admin':
        case 'teacher':
            if ($_REQUEST['expanded_view'] == 'true') {
                $select = ',LAST_LOGIN';
                $extra['columns_after']['LAST_LOGIN'] = _('Last Login');
                $functions['LAST_LOGIN'] = 'makeLogin';
                $view_fields_RET = DBGet(DBQuery("SELECT cf.ID,cf.TYPE,cf.TITLE FROM STAFF_FIELDS cf WHERE ((SELECT VALUE FROM PROGRAM_USER_CONFIG WHERE TITLE=cast(cf.ID AS TEXT) AND PROGRAM='StaffFieldsView' AND USER_ID='" . User('STAFF_ID') . "')='Y'" . ($extra['staff_fields']['view'] ? " OR cf.ID IN (" . $extra['staff_fields']['view'] . ")" : '') . ") ORDER BY cf.SORT_ORDER,cf.TITLE"));
                foreach ($view_fields_RET as $field) {
                    $extra['columns_after']['CUSTOM_' . $field['ID']] = $field['TITLE'];
                    if ($field['TYPE'] == 'date') {
                        $functions['CUSTOM_' . $field['ID']] = 'ProperDate';
                    } elseif ($field['TYPE'] == 'numeric') {
                        $functions['CUSTOM_' . $field['ID']] = 'removeDot00';
                    } elseif ($field['TYPE'] == 'codeds') {
                        $functions['CUSTOM_' . $field['ID']] = 'StaffDeCodeds';
                    } elseif ($field['TYPE'] == 'exports') {
                        $functions['CUSTOM_' . $field['ID']] = 'StaffDeCodeds';
                    }
                    $select .= ',s.CUSTOM_' . $field['ID'];
                }
                $extra['SELECT'] .= $select;
            } else {
                if (!$extra['columns_after']) {
                    $extra['columns_after'] = array();
                }
                if ($extra['staff_fields']['view']) {
                    $view_fields_RET = DBGet(DBQuery("SELECT cf.ID,cf.TYPE,cf.TITLE FROM STAFF_FIELDS cf WHERE cf.ID IN (" . $extra['staff_fields']['view'] . ") ORDER BY cf.SORT_ORDER,cf.TITLE"));
                    foreach ($view_fields_RET as $field) {
                        $extra['columns_after']['CUSTOM_' . $field['ID']] = $field['TITLE'];
                        if ($field['TYPE'] == 'date') {
                            $functions['CUSTOM_' . $field['ID']] = 'ProperDate';
                        } elseif ($field['TYPE'] == 'numeric') {
                            $functions['CUSTOM_' . $field['ID']] = 'removeDot00';
                        } elseif ($field['TYPE'] == 'codeds') {
                            $functions['CUSTOM_' . $field['ID']] = 'StaffDeCodeds';
                        } elseif ($field['TYPE'] == 'exports') {
                            $functions['CUSTOM_' . $field['ID']] = 'StaffDeCodeds';
                        }
                        $select .= ',s.CUSTOM_' . $field['ID'];
                    }
                    $extra['SELECT'] .= $select;
                }
            }
            if (User('PROFILE') != 'admin') {
                $extra['WHERE'] .= " AND (s.STAFF_ID='" . User('STAFF_ID') . "' OR s.PROFILE='parent' AND exists(SELECT '' FROM STUDENTS_JOIN_USERS _sju,STUDENT_ENROLLMENT _sem,SCHEDULE _ss WHERE _sju.STAFF_ID=s.STAFF_ID AND _sem.STUDENT_ID=_sju.STUDENT_ID AND _sem.SYEAR='" . UserSYEAR() . "' AND _ss.STUDENT_ID=_sem.STUDENT_ID AND _ss.COURSE_PERIOD_ID='" . UserCoursePeriod() . "'";
                if ($_REQUEST['include_inactive'] != 'Y') {
                    $extra['WHERE'] .= " AND _ss.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', UserMP()) . ") AND ('" . DBDate() . "'>=_sem.START_DATE AND ('" . DBDate() . "'<=_sem.END_DATE OR _sem.END_DATE IS NULL)) AND ('" . DBDate() . "'>=_ss.START_DATE AND ('" . DBDate() . "'<=_ss.END_DATE OR _ss.END_DATE IS NULL))";
                }
                $extra['WHERE'] .= "))";
            }
            $profiles_RET = DBGet(DBQuery("SELECT * FROM USER_PROFILES"), array(), array('ID'));
            $sql = "SELECT\n\t\t\t\t\ts.LAST_NAME||', '||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() . "'";
            //$sql = appendStaffSQL($sql,array('NoSearchTerms'=>$extra['NoSearchTerms']));
            if ($_REQUEST['_search_all_schools'] != 'Y') {
                $sql .= " AND (s.SCHOOLS LIKE '%," . UserSchool() . ",%' OR s.SCHOOLS IS NULL OR s.SCHOOLS='') ";
            }
            $sql .= $extra['WHERE'] . ' ';
            //$sql .= CustomFields('where','staff',array('NoSearchTerms'=>$extra['NoSearchTerms']));
            // it would be easier to sort on full_name but postgres sometimes yields strange results
            $sql .= 'ORDER BY s.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME';
            if ($extra['functions']) {
                $functions += $extra['functions'];
            }
            return DBGet(DBQuery($sql), $functions);
            break;
    }
}
开发者ID:linil,项目名称:centreSIS,代码行数:72,代码来源:GetStaffList.fnc.php


注:本文中的GetAllMP函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。