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


PHP CustomFields函数代码示例

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


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

示例1: GetStuListAttn


//.........这里部分代码省略.........
                    $sql .= 'CONCAT(s.LAST_NAME,\', \',coalesce(s.COMMON_NAME,s.FIRST_NAME)) AS FULL_NAME,';
                } else {
                    $sql .= 'CONCAT(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 AS LIST_SCHOOL_ID,ssm.GRADE_ID ' . $extra['SELECT'];
                if ($_REQUEST['include_inactive'] == 'Y') {
                    $sql .= ',' . db_case(array('(ssm.SYEAR=\'' . UserSyear() . '\' AND (ssm.START_DATE IS NOT NULL AND (\'' . date('Y-m-d', strtotime($extra['DATE'])) . '\'<=ssm.END_DATE OR ssm.END_DATE IS NULL)))', 'true', "'<FONT color=green>Active</FONT>'", "'<FONT color=red>Inactive</FONT>'")) . ' AS ACTIVE ';
                }
            }
            $sql .= ' FROM students s,student_enrollment ssm ' . $extra['FROM'] . ' WHERE ssm.STUDENT_ID=s.STUDENT_ID ';
            if ($_REQUEST['include_inactive'] == 'Y') {
                $sql .= ' AND ssm.ID=(SELECT ID FROM student_enrollment WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR<=\'' . UserSyear() . '\' ORDER BY START_DATE DESC LIMIT 1)';
            } else {
                $sql .= ' AND ssm.SYEAR=\'' . UserSyear() . '\' AND (ssm.START_DATE IS NOT NULL AND (\'' . date('Y-m-d', strtotime($extra['DATE'])) . '\'<=ssm.END_DATE OR ssm.END_DATE IS NULL)) ';
            }
            if (UserSchool() && $_REQUEST['_search_all_schools'] != 'Y') {
                $sql .= ' AND ssm.SCHOOL_ID=\'' . UserSchool() . '\'';
            } else {
                //
                $sql .= ' AND ssm.SCHOOL_ID IN (' . GetUserSchools(UserID(), true) . ') ';
                $extra['columns_after']['LIST_SCHOOL_ID'] = 'School';
                $functions['LIST_SCHOOL_ID'] = 'GetSchool';
            }
            if (!$extra['SELECT_ONLY'] && $_REQUEST['include_inactive'] == 'Y') {
                $extra['columns_after']['ACTIVE'] = 'Status';
            }
            break;
        case 'teacher':
            $sql = 'SELECT ';
            if ($extra['SELECT_ONLY']) {
                $sql .= $extra['SELECT_ONLY'];
            } else {
                if (Preferences('NAME') == 'Common') {
                    $sql .= 'CONCAT(s.LAST_NAME,\', \',coalesce(s.COMMON_NAME,s.FIRST_NAME)) AS FULL_NAME,';
                } else {
                    $sql .= 'CONCAT(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('(ssm.START_DATE IS NOT NULL AND  (\'' . $extra['DATE'] . '\'<=ssm.END_DATE OR ssm.END_DATE IS NULL))', 'true', "'<FONT color=green>Active</FONT>'", "'<FONT color=red>Inactive</FONT>'")) . ' AS ACTIVE';
                    $sql .= ',' . db_case(array('(\'' . $extra['DATE'] . '\'>=ss.START_DATE AND (\'' . $extra['DATE'] . '\'<=ss.END_DATE OR ss.END_DATE IS NULL))', 'true', "'<FONT color=green>Active</FONT>'", "'<FONT color=red>Inactive</FONT>'")) . ' AS ACTIVE_SCHEDULE';
                }
            }
            //
            $sql .= ' FROM students s,course_periods cp,schedule ss,student_enrollment ssm,course_period_var cpv ' . $extra['FROM'] . ' WHERE ssm.STUDENT_ID=s.STUDENT_ID AND cpv.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND cpv.ID="' . $extra['ID'] . '" AND ssm.STUDENT_ID=ss.STUDENT_ID AND ssm.SCHOOL_ID=\'' . UserSchool() . '\' AND ssm.SYEAR=\'' . UserSyear() . '\' AND ssm.SYEAR=cp.SYEAR AND ssm.SYEAR=ss.SYEAR AND ' . db_case(array(User('STAFF_ID'), 'cp.teacher_id', ' cp.teacher_id=' . User('STAFF_ID'), 'cp.secondary_teacher_id', ' cp.secondary_teacher_id=' . User('STAFF_ID'), 'cp.course_period_id IN(SELECT course_period_id from teacher_reassignment tra WHERE cp.course_period_id=tra.course_period_id AND tra.pre_teacher_id=' . User('STAFF_ID') . ')')) . ' AND cp.COURSE_PERIOD_ID=\'' . UserCoursePeriod() . '\' AND cp.COURSE_ID=ss.COURSE_ID AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID';
            if ($extra['cpvdate'] != '') {
                $sql .= $extra['cpvdate'];
            }
            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)';
                $sql .= ' AND ss.START_DATE=(SELECT START_DATE FROM schedule WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR=ssm.SYEAR AND MARKING_PERIOD_ID IN (' . GetAllMP('', $queryMP) . ') AND COURSE_ID=cp.COURSE_ID AND COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID ORDER BY START_DATE DESC LIMIT 1)';
            } else {
                $sql .= ' AND (ssm.START_DATE IS NOT NULL  AND \'' . $extra['DATE'] . '\'>=ssm.START_DATE AND (\'' . $extra['DATE'] . '\'<=ssm.END_DATE OR ssm.END_DATE IS NULL))';
                $sql .= ' AND (\'' . $extra['DATE'] . '\'>=ss.START_DATE AND (\'' . $extra['DATE'] . '\'<=ss.END_DATE OR ss.END_DATE IS NULL))';
            }
            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 {
                if (Preferences('NAME') == 'Common') {
                    $sql .= 'CONCAT(s.LAST_NAME,\', \',coalesce(s.COMMON_NAME,s.FIRST_NAME)) AS FULL_NAME,';
                } else {
                    $sql .= 'CONCAT(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,student_enrollment ssm ' . $extra['FROM'] . '
					WHERE ssm.STUDENT_ID=s.STUDENT_ID AND ssm.SYEAR=\'' . UserSyear() . '\' AND ssm.SCHOOL_ID=\'' . UserSchool() . '\' AND (\'' . DBDate() . '\' BETWEEN ssm.START_DATE AND ssm.END_DATE OR (ssm.END_DATE IS NULL AND \'' . DBDate() . '\'>ssm.START_DATE)) AND ssm.STUDENT_ID' . ($extra['ASSOCIATED'] ? ' IN (SELECT STUDENT_ID FROM students_join_users WHERE STAFF_ID=\'' . $extra['ASSOCIATED'] . '\')' : '=\'' . UserStudentID() . '\'');
            break;
        default:
            exit('Error');
    }
    $sql = appendSQL($sql, $extra);
    $sql .= $extra['WHERE'] . ' ';
    $sql .= CustomFields('where');
    if ($extra['GROUP']) {
        $sql .= ' GROUP BY ' . $extra['GROUP'];
    }
    if (!$extra['ORDER_BY'] && !$extra['SELECT_ONLY']) {
        if (Preferences('SORT') == 'Grade') {
            $sql .= ' ORDER BY (SELECT SORT_ORDER FROM school_gradelevels WHERE ID=ssm.GRADE_ID),FULL_NAME';
        } else {
            $sql .= ' ORDER BY FULL_NAME';
        }
        $sql .= $extra['ORDER'];
    } elseif ($extra['ORDER_BY']) {
        $sql .= ' ORDER BY ' . $extra['ORDER_BY'];
    }
    if ($extra['DEBUG'] === true) {
        echo '<!--' . $sql . '-->';
    }
    return DBGet(DBQuery($sql), $functions, $extra['group']);
}
开发者ID:jicheng17,项目名称:fenghua,代码行数:101,代码来源:CustomFunctionsFnc.php

示例2: Buttons

        echo '<CENTER><INPUT type=checkbox name=_search_all_schools value=Y' . (Preferences('DEFAULT_ALL_SCHOOLS') == 'Y' ? ' CHECKED' : '') . '><font color=black>Search All Schools</font></CENTER><BR>';
    }
    echo '<CENTER>' . Buttons('Submit') . '</CENTER>';
    echo '</FORM>';
    PopTable('footer');
}
if (!$_REQUEST['modfunc']) {
    if (!isset($extra)) {
        $extra = array();
    }
    Widgets('user');
    if ($_REQUEST['advanced'] == 'Y') {
        Widgets('all');
    }
    $extra['WHERE'] .= appendSQL('');
    $extra['WHERE'] .= CustomFields('where');
    echo "<FORM  name=ada_from id=ada_from onSubmit='return formcheck_ada_dates();' action=Modules.php?modname=" . strip_tags(trim($_REQUEST[modname])) . "&list_by_day=" . strip_tags(trim($_REQUEST[list_by_day])) . " method=POST>";
    $advanced_link = " <A HREF=Modules.php?modname={$_REQUEST['modname']}&modfunc=search&list_by_day={$_REQUEST['list_by_day']}&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']}>Advanced</A>";
    DrawHeaderHome('<table><tr><td>' . DateInputAY($start_date, 'start', 1) . '</td><td>&nbsp;&nbsp;-&nbsp;&nbsp;</td><td>' . DateInputAY($end_date, 'end', 2) . '</td><td> - </td><td>' . $advanced_link, ' : <INPUT type=submit value=Go  class=btn_medium></td></tr></table>');
    echo '</FORM>';
    if ($_REQUEST['list_by_day'] == 'true') {
        $cal_days = 1;
        $search_stu = 0;
        if ($_REQUEST['last'] != '' || $_REQUEST['first'] != '' || $_REQUEST['stuid'] != '' || $_REQUEST['altid'] != '') {
            $stu_q = 'SELECT GROUP_CONCAT(STUDENT_ID) as STUDENT_ID FROM students WHERE ';
            $stu_q .= $_REQUEST['last'] != '' ? ' LAST_NAME=\'' . $_REQUEST['last'] . '\' OR ' : '';
            $stu_q .= $_REQUEST['first'] != '' ? ' FIRST_NAME=\'' . $_REQUEST['first'] . '\' OR ' : '';
            $stu_q .= $_REQUEST['stuid'] != '' ? ' STUDENT_ID=\'' . $_REQUEST['stuid'] . '\' OR ' : '';
            $stu_q .= $_REQUEST['altid'] != '' ? ' ALT_ID=\'' . $_REQUEST['altid'] . '\' OR ' : '';
            $stu_q = preg_replace('/ OR $/', '', $stu_q);
            $stu_q = DBGet(DBQuery($stu_q));
开发者ID:jeffthestampede,项目名称:excelsior,代码行数:31,代码来源:Percent.php

示例3: array

 if (User('PROFILE') == 'admin') {
     if (!isset($extra)) {
         $extra = array();
     }
     StaffWidgets('user', $extra);
     if ($_REQUEST['advanced'] == 'Y') {
         StaffWidgets('all', $extra);
     }
 }
 if (!$extra['NoSearchTerms']) {
     if ($_REQUEST['_search_all_schools'] == 'Y') {
         $_ROSARIO['SearchTerms'] .= '<span style="color:gray"><b>' . _('Search All Schools') . '</b></span><BR />';
     }
 }
 $extra['WHERE'] .= appendStaffSQL('', array('NoSearchTerms' => $extra['NoSearchTerms']));
 $extra['WHERE'] .= CustomFields('where', 'staff', array('NoSearchTerms' => $extra['NoSearchTerms']));
 if (!isset($_ROSARIO['DrawHeader'])) {
     DrawHeader(_('Choose A User'));
 }
 $staff_RET = GetStaffList($extra);
 if ($extra['profile']) {
     // DO NOT translate those strings since they will be passed to ListOutput ultimately
     $options = array('admin' => 'Administrator', 'teacher' => 'Teacher', 'parent' => 'Parent', 'none' => 'No Access');
     $singular = $options[$extra['profile']];
     $plural = $singular . ($options[$extra['profile']] == 'none' ? '' : 's');
     $columns = array('FULL_NAME' => $singular, 'STAFF_ID' => _('RosarioSIS ID'));
 } else {
     $columns = array('FULL_NAME' => _('User'), 'PROFILE' => _('Profile'), 'STAFF_ID' => _('RosarioSIS ID'));
 }
 $name_link['FULL_NAME']['link'] = 'Modules.php?modname=' . $_REQUEST['next_modname'];
 $name_link['FULL_NAME']['variables'] = array('staff_id' => 'STAFF_ID');
开发者ID:fabioassuncao,项目名称:rosariosis,代码行数:31,代码来源:Search.inc.php

示例4: _getResults

function _getResults($type, $number, $index = '')
{
    global $num, $remote_type;
    $type = trim($type);
    $start_REQUEST = $_REQUEST;
    if (isset($_REQUEST['screen'][$num])) {
        $_REQUEST = $_REQUEST['screen'][$num];
    }
    foreach ((array) $_REQUEST as $key => $value) {
        // Is array
        // for example: ['cust[CUSTOM_XXX]'] or ['month_cust_begin[CUSTOM_XXX]']
        // => ['cust']['CUSTOM_XXX']
        if (mb_strpos($key, 'cust') !== false && mb_strpos($key, '[') !== false) {
            $_REQUEST[mb_substr($key, 0, mb_strpos($key, '['))][mb_substr($key, mb_strpos($key, '[') + 1)] = $value;
            unset($_REQUEST[$key]);
        }
    }
    $min_max_date = DBGet(DBQuery("SELECT to_char(min(SCHOOL_DATE),'dd-MON-yy') AS MIN_DATE,\n\t\tto_char(max(SCHOOL_DATE),'dd-MON-yy') AS MAX_DATE\n\t\tFROM ATTENDANCE_CALENDAR\n\t\tWHERE SYEAR='" . UserSyear() . "'"));
    if (isset($_REQUEST['day_start']) && isset($_REQUEST['month_start']) && isset($_REQUEST['year_start'])) {
        $start_date = $_REQUEST['day_start'] . '-' . $_REQUEST['month_start'] . '-' . $_REQUEST['year_start'];
    } else {
        $start_date = $min_max_date[1]['MIN_DATE'];
    }
    if (isset($_REQUEST['day_end']) && isset($_REQUEST['month_end']) && isset($_REQUEST['year_end'])) {
        $end_date = $_REQUEST['day_end'] . '-' . $_REQUEST['month_end'] . '-' . $_REQUEST['year_end'];
    } else {
        $end_date = $min_max_date[1]['MAX_DATE'];
    }
    $extra = appendSQL('');
    if (isset($_REQUEST['school'])) {
        $extra .= " AND ssm.SCHOOL_ID = '" . $_REQUEST['school'] . "' ";
    }
    $extra .= CustomFields('where');
    if (isset($_REQUEST['age'])) {
        // We could have used AGE() function since PostgreSQL 8.4.
        $extra .= " AND (DATE_PART('day', CURRENT_TIMESTAMP - s.CUSTOM_200000004::timestamp) / 365.25)::int = " . $_REQUEST['age'] . ' ';
    }
    $schools = mb_substr(str_replace(",", "','", User('SCHOOLS')), 2, -2);
    if (isset($_REQUEST['school'])) {
        $extra_schools = '';
    } elseif (!isset($_REQUEST['_search_all_schools']) || $_REQUEST['_search_all_schools'] != 'Y') {
        $extra_schools = "SCHOOL_ID='" . UserSchool() . "' AND ";
    } elseif ($schools) {
        $extra_schools = "SCHOOL_ID IN (" . $schools . ") AND ";
    }
    $array = array();
    /*if(mb_substr($type,0,7)=='orchard')
    	{
    		$test_title = mb_substr($type,9,-6);
    		$type = 'orchard_test';
    	}*/
    switch ($type) {
        case 'present':
            if (!mb_strpos($extra, 'GROUP')) {
                $extra .= " GROUP BY ad.SCHOOL_DATE";
            }
            $present_RET = DBGet(DBQuery("SELECT ad.SCHOOL_DATE,COALESCE(sum(ad.STATE_VALUE),0) AS STATE_VALUE\n\t\t\t\tFROM ATTENDANCE_DAY ad,STUDENT_ENROLLMENT ssm,STUDENTS s\n\t\t\t\tWHERE s.STUDENT_ID=ssm.STUDENT_ID\n\t\t\t\tAND " . str_replace('SCHOOL_ID', 'ssm.SCHOOL_ID', $extra_schools) . " ad.STUDENT_ID=ssm.STUDENT_ID\n\t\t\t\tAND ssm.SYEAR='" . UserSyear() . "'\n\t\t\t\tAND ad.SYEAR=ssm.SYEAR\n\t\t\t\tAND ad.SCHOOL_DATE BETWEEN '" . $start_date . "' AND '" . $end_date . "'\n\t\t\t\tAND (ad.SCHOOL_DATE BETWEEN ssm.START_DATE AND ssm.END_DATE\n\t\t\t\t\tOR (ssm.END_DATE IS NULL AND ssm.START_DATE <= ad.SCHOOL_DATE)) " . $extra));
            foreach ((array) $present_RET as $present) {
                if ($index) {
                    $array[$present[$index]] = $present['STATE_VALUE'];
                } else {
                    $array[] = $present['STATE_VALUE'];
                }
            }
            break;
        case 'absent':
            if (!mb_strpos($extra, 'GROUP')) {
                $extra .= " GROUP BY ad.SCHOOL_DATE";
            }
            $absent_RET = DBGet(DBQuery("SELECT ad.SCHOOL_DATE,COALESCE(sum(ad.STATE_VALUE-1)*-1,0) AS STATE_VALUE\n\t\t\t\tFROM ATTENDANCE_DAY ad,STUDENT_ENROLLMENT ssm,STUDENTS s\n\t\t\t\tWHERE s.STUDENT_ID=ssm.STUDENT_ID\n\t\t\t\tAND " . str_replace('SCHOOL_ID', 'ssm.SCHOOL_ID', $extra_schools) . " ad.STUDENT_ID=ssm.STUDENT_ID\n\t\t\t\tAND ssm.SYEAR='" . UserSyear() . "'\n\t\t\t\tAND ad.SYEAR=ssm.SYEAR\n\t\t\t\tAND ad.SCHOOL_DATE BETWEEN '" . $start_date . "' AND '" . $end_date . "'\n\t\t\t\tAND (ad.SCHOOL_DATE BETWEEN ssm.START_DATE AND ssm.END_DATE\n\t\t\t\t\tOR (ssm.END_DATE IS NULL AND ssm.START_DATE <= ad.SCHOOL_DATE)) " . $extra));
            foreach ((array) $absent_RET as $absent) {
                if ($index) {
                    $array[$absent[$index]] = $absent['STATE_VALUE'];
                } else {
                    $array[] = $absent['STATE_VALUE'];
                }
            }
            break;
        case 'enrolled':
            if (!mb_strpos($extra, 'GROUP')) {
                $extra .= " GROUP BY ac.SCHOOL_DATE";
            }
            $enrolled_RET = DBGet(DBQuery("SELECT ac.SCHOOL_DATE,count(*) AS STUDENTS\n\t\t\t\tFROM STUDENT_ENROLLMENT ssm,ATTENDANCE_CALENDAR ac,STUDENTS s\n\t\t\t\tWHERE s.STUDENT_ID=ssm.STUDENT_ID\n\t\t\t\tAND ssm.SYEAR='" . UserSyear() . "'\n\t\t\t\tAND ac.SYEAR=ssm.SYEAR\n\t\t\t\tAND ac.CALENDAR_ID=ssm.CALENDAR_ID\n\t\t\t\tAND " . str_replace('SCHOOL_ID', 'ssm.SCHOOL_ID', $extra_schools) . " ssm.SCHOOL_ID=ac.SCHOOL_ID\n\t\t\t\tAND (ac.SCHOOL_DATE BETWEEN ssm.START_DATE AND ssm.END_DATE OR\n\t\t\t\t\t(ssm.END_DATE IS NULL AND ssm.START_DATE <= ac.SCHOOL_DATE))\n\t\t\t\tAND ac.SCHOOL_DATE BETWEEN '" . $start_date . "' AND '" . $end_date . "' " . $extra));
            foreach ((array) $enrolled_RET as $enrolled) {
                if ($index) {
                    $array[$enrolled[$index]] = $enrolled['STUDENTS'];
                } else {
                    $array[] = $enrolled['STUDENTS'];
                }
            }
            break;
        case 'student id':
            $student_id_RET = DBGet(DBQuery("SELECT ssm.STUDENT_ID\n\t\t\t\tFROM STUDENT_ENROLLMENT ssm,STUDENTS s\n\t\t\t\tWHERE s.STUDENT_ID=ssm.STUDENT_ID\n\t\t\t\tAND " . str_replace('SCHOOL_ID', 'ssm.SCHOOL_ID', $extra_schools) . " ssm.SYEAR='" . UserSyear() . "'\n\t\t\t\tAND ('" . DBDate() . "' BETWEEN ssm.START_DATE AND ssm.END_DATE OR ssm.END_DATE IS NULL) " . $extra));
            foreach ((array) $student_id_RET as $student_id) {
                if ($index) {
                    $array[$student_id[$index]] = $student_id['STUDENT_ID'];
                } else {
                    $array[] = $student_id['STUDENT_ID'];
                }
            }
//.........这里部分代码省略.........
开发者ID:francoisjacquet,项目名称:Reports,代码行数:101,代码来源:ReportsCalculations.fnc.php

示例5: GetStuList_Absence_Summary


//.........这里部分代码省略.........
            $sql .= $extra['FROM'] . ' WHERE ssm.STUDENT_ID=s.STUDENT_ID AND ssm.STUDENT_ID=ss.STUDENT_ID
					AND ssm.SCHOOL_ID=\'' . UserSchool() . '\' AND ssm.SYEAR=\'' . UserSyear() . '\' AND ssm.SYEAR=cp.SYEAR AND ssm.SYEAR=ss.SYEAR
					AND (ss.MARKING_PERIOD_ID IN (' . GetAllMP('', $queryMP) . ')  OR (ss.START_DATE<=\'' . date('Y-m-d') . '\'  AND (ss.END_DATE>=\'' . date('Y-m-d') . '\'  OR ss.END_DATE IS NULL)))
					AND (cp.TEACHER_ID=\'' . User('STAFF_ID') . '\' OR cp.SECONDARY_TEACHER_ID=\'' . User('STAFF_ID') . '\') AND cp.COURSE_PERIOD_ID=\'' . UserCoursePeriod() . '\'
					AND cp.COURSE_ID=ss.COURSE_ID AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID';
            $_SESSION['new_sql'] .= $extra['FROM'] . ' WHERE ssm.STUDENT_ID=s.STUDENT_ID AND ssm.STUDENT_ID=ss.STUDENT_ID
					AND ssm.SCHOOL_ID=\'' . UserSchool() . '\' AND ssm.SYEAR=\'' . UserSyear() . '\' AND ssm.SYEAR=cp.SYEAR AND ssm.SYEAR=ss.SYEAR
					AND (ss.MARKING_PERIOD_ID IN (' . GetAllMP('', $queryMP) . ')   OR (ss.START_DATE<=\'' . date('Y-m-d') . '\'  AND (ss.END_DATE>=\'' . date('Y-m-d') . '\'  OR ss.END_DATE IS NULL)))
					AND (cp.TEACHER_ID=\'' . User('STAFF_ID') . '\' OR cp.SECONDARY_TEACHER_ID=\'' . User('STAFF_ID') . '\') AND cp.COURSE_PERIOD_ID=\'' . UserCoursePeriod() . '\'
					AND cp.COURSE_ID=ss.COURSE_ID AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID';
            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)';
                $sql .= ' AND ss.START_DATE=(SELECT START_DATE FROM schedule WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR=ssm.SYEAR AND MARKING_PERIOD_ID IN (' . GetAllMP('', $queryMP) . ') AND COURSE_ID=cp.COURSE_ID AND COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID ORDER BY START_DATE DESC LIMIT 1)';
                $_SESSION['new_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)';
                $_SESSION['new_sql'] .= ' AND ss.START_DATE=(SELECT START_DATE FROM schedule WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR=ssm.SYEAR AND MARKING_PERIOD_ID IN (' . GetAllMP('', $queryMP) . ') AND COURSE_ID=cp.COURSE_ID AND COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID ORDER BY START_DATE DESC LIMIT 1)';
            } else {
                $sql .= $_SESSION['inactive_stu_filter'] = ' AND (ssm.START_DATE IS NOT NULL AND (\'' . $extra['DATE'] . '\'<=ssm.END_DATE OR ssm.END_DATE IS NULL))';
                $sql .= $_SESSION['inactive_stu_filter'] = ' AND (ssm.START_DATE IS NOT NULL AND (\'' . $extra['DATE'] . '\'<=ss.END_DATE OR ss.END_DATE IS NULL))';
                // $sql .= " AND ('".$extra['DATE']."'>=ssm.START_DATE AND ('".$extra['DATE']."'<=ssm.END_DATE OR ssm.END_DATE IS NULL))";
                //$sql .= " AND ('".$extra['DATE']."'>=ss.START_DATE AND ('".$extra['DATE']."'<=ss.END_DATE OR ss.END_DATE IS NULL))";
                $_SESSION['new_sql'] .= ' AND (ssm.START_DATE IS NOT NULL AND (\'' . $extra['DATE'] . '\'<=ssm.END_DATE OR ssm.END_DATE IS NULL))';
                $_SESSION['new_sql'] .= ' AND (ssm.START_DATE IS NOT NULL AND (\'' . $extra['DATE'] . '\'<=ss.END_DATE OR ss.END_DATE IS NULL))';
            }
            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 {
                if (Preferences('NAME') == 'Common') {
                    $sql .= 'CONCAT(s.LAST_NAME,\', \',coalesce(s.COMMON_NAME,s.FIRST_NAME)) AS FULL_NAME,';
                } else {
                    $sql .= 'CONCAT(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,s.ALT_ID,ssm.SCHOOL_ID,ssm.GRADE_ID ' . $extra['SELECT'];
            }
            $sql .= ' FROM students s,student_enrollment ssm ' . $extra['FROM'] . '
					WHERE ssm.STUDENT_ID=s.STUDENT_ID AND ssm.SYEAR=\'' . UserSyear() . '\' AND ssm.SCHOOL_ID=\'' . UserSchool() . '\' AND (\'' . DBDate() . '\' BETWEEN ssm.START_DATE AND ssm.END_DATE OR (ssm.END_DATE IS NULL AND \'' . DBDate() . '\'>ssm.START_DATE)) AND ssm.STUDENT_ID' . ($extra['ASSOCIATED'] ? ' IN (SELECT STUDENT_ID FROM students_join_people WHERE PERSON_ID=\'' . $extra['ASSOCIATED'] . '\')' : '=\'' . UserStudentID() . '\'');
            break;
        default:
            exit('Error');
    }
    if ($expanded_view == true) {
        $custom_str = CustomFields('where', '', 1);
        if ($custom_str != '') {
            $_SESSION['custom_count_sql'] = $custom_str;
        }
        $sql .= $custom_str;
    } elseif ($expanded_view == false) {
        $custom_str = CustomFields('where', '', 2);
        if ($custom_str != '') {
            $_SESSION['custom_count_sql'] = $custom_str;
        }
        $sql .= $custom_str;
    } else {
        $custom_str = CustomFields('where');
        if ($custom_str != '') {
            $_SESSION['custom_count_sql'] = $custom_str;
        }
        $sql .= $custom_str;
    }
    $sql .= $extra['WHERE'] . ' ';
    $sql = appendSQL_Absence_Summary($sql, $extra);
    //        TODO               Modification Required
    //        if($_SESSION['stu_search']['sql'] && $_REQUEST['return_session'] && $extra['SELECT']!='' && strpos($sql,'address a')==0)
    //        {
    //            $sql = str_replace("FROM", $extra['SELECT']." FROM",$sql);
    //        }
    //
    //        if($_SESSION['stu_search']['sql'] && $_REQUEST['return_session'] && $extra['FROM']!='' && strpos($sql,'address a')==0)
    //        {
    //            $sql = str_replace("WHERE",$extra['FROM']." WHERE",$sql);
    //
    //        }
    //        --------------------------------------------------
    if ($extra['GROUP']) {
        $sql .= ' GROUP BY ' . $extra['GROUP'];
    }
    if (!$extra['ORDER_BY'] && !$extra['SELECT_ONLY']) {
        if (Preferences('SORT') == 'Grade') {
            $sql .= ' ORDER BY (SELECT SORT_ORDER FROM school_gradelevels WHERE ID=ssm.GRADE_ID),FULL_NAME';
        } else {
            $sql .= ' ORDER BY FULL_NAME';
        }
        $sql .= $extra['ORDER'];
    } elseif ($extra['ORDER_BY'] && !($_SESSION['stu_search']['sql'] && $_REQUEST['return_session'])) {
        $sql .= ' ORDER BY ' . $extra['ORDER_BY'];
    }
    if ($extra['DEBUG'] === true) {
        echo '<!--' . $sql . '-->';
    }
    $return = DBGet(DBQuery($sql), $functions, $extra['group']);
    $_SESSION['count_stu'] = count($return);
    return $return;
}
开发者ID:26746647,项目名称:openSIS,代码行数:101,代码来源:GetStuList.fnc.php

示例6: GetStuListAttn


//.........这里部分代码省略.........
            if ($extra['SELECT_ONLY']) {
                $sql .= $extra['SELECT_ONLY'];
            } else {
                if (Preferences('NAME') == 'Common') {
                    $sql .= "CONCAT(s.LAST_NAME,', ',coalesce(s.COMMON_NAME,s.FIRST_NAME)) AS FULL_NAME,";
                } else {
                    $sql .= "CONCAT(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 AS LIST_SCHOOL_ID,ssm.GRADE_ID ' . $extra['SELECT'];
                if ($_REQUEST['include_inactive'] == 'Y') {
                    $sql .= ',' . db_case(array("(ssm.SYEAR='" . UserSyear() . "' AND ('" . date('Y-m-d', strtotime($extra['DATE'])) . "'>ssm.START_DATE AND ('" . date('Y-m-d', strtotime($extra['DATE'])) . "'<=ssm.END_DATE OR ssm.END_DATE IS NULL)))", 'true', "'<FONT color=green>Active</FONT>'", "'<FONT color=red>Inactive</FONT>'")) . ' AS ACTIVE ';
                }
            }
            $sql .= " FROM STUDENTS s,STUDENT_ENROLLMENT ssm " . $extra['FROM'] . " WHERE ssm.STUDENT_ID=s.STUDENT_ID ";
            if ($_REQUEST['include_inactive'] == 'Y') {
                $sql .= " AND ssm.ID=(SELECT ID FROM STUDENT_ENROLLMENT WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR<='" . UserSyear() . "' ORDER BY START_DATE DESC LIMIT 1)";
            } else {
                $sql .= " AND ssm.SYEAR='" . UserSyear() . "' AND ('" . date('Y-m-d', strtotime($extra['DATE'])) . "'>=ssm.START_DATE AND ('" . date('Y-m-d', strtotime($extra['DATE'])) . "'<=ssm.END_DATE OR ssm.END_DATE IS NULL)) ";
            }
            if (UserSchool() && $_REQUEST['_search_all_schools'] != 'Y') {
                $sql .= " AND ssm.SCHOOL_ID='" . UserSchool() . "'";
            } else {
                if (User('SCHOOLS')) {
                    $sql .= " AND ssm.SCHOOL_ID IN (" . substr(str_replace(',', "','", User('SCHOOLS')), 2, -2) . ") ";
                }
                $extra['columns_after']['LIST_SCHOOL_ID'] = 'School';
                $functions['LIST_SCHOOL_ID'] = 'GetSchool';
            }
            if (!$extra['SELECT_ONLY'] && $_REQUEST['include_inactive'] == 'Y') {
                $extra['columns_after']['ACTIVE'] = 'Status';
            }
            break;
        case 'teacher':
            $sql = 'SELECT ';
            if ($extra['SELECT_ONLY']) {
                $sql .= $extra['SELECT_ONLY'];
            } else {
                if (Preferences('NAME') == 'Common') {
                    $sql .= "CONCAT(s.LAST_NAME,', ',coalesce(s.COMMON_NAME,s.FIRST_NAME)) AS FULL_NAME,";
                } else {
                    $sql .= "CONCAT(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 ('" . $extra['DATE'] . "'<=ssm.END_DATE OR ssm.END_DATE IS NULL))", 'true', "'<FONT color=green>Active</FONT>'", "'<FONT color=red>Inactive</FONT>'")) . ' AS ACTIVE';
                    $sql .= ',' . db_case(array("('" . $extra['DATE'] . "'>=ss.START_DATE AND ('" . $extra['DATE'] . "'<=ss.END_DATE OR ss.END_DATE IS NULL))", 'true', "'<FONT color=green>Active</FONT>'", "'<FONT color=red>Inactive</FONT>'")) . ' AS ACTIVE_SCHEDULE';
                }
            }
            $sql .= " FROM STUDENTS s,COURSE_PERIODS cp,SCHEDULE ss,STUDENT_ENROLLMENT ssm " . $extra['FROM'] . " WHERE ssm.STUDENT_ID=s.STUDENT_ID AND ssm.STUDENT_ID=ss.STUDENT_ID\r\n\t\t\t\t\tAND ssm.SCHOOL_ID='" . UserSchool() . "' AND ssm.SYEAR='" . UserSyear() . "' AND ssm.SYEAR=cp.SYEAR AND ssm.SYEAR=ss.SYEAR\r\n\t\t\t\t\tAND ss.MARKING_PERIOD_ID IN (" . GetAllMP('', $queryMP) . ")\r\n\t\t\t\t\tAND (cp.TEACHER_ID='" . User('STAFF_ID') . "' OR cp.SECONDARY_TEACHER_ID='" . User('STAFF_ID') . "') AND cp.COURSE_PERIOD_ID='" . UserCoursePeriod() . "'\r\n\t\t\t\t\tAND cp.COURSE_ID=ss.COURSE_ID AND cp.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID";
            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)";
                $sql .= " AND ss.START_DATE=(SELECT START_DATE FROM SCHEDULE WHERE STUDENT_ID=ssm.STUDENT_ID AND SYEAR=ssm.SYEAR AND MARKING_PERIOD_ID IN (" . GetAllMP('', $queryMP) . ") AND COURSE_ID=cp.COURSE_ID AND COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID ORDER BY START_DATE DESC LIMIT 1)";
            } else {
                $sql .= " AND ('" . $extra['DATE'] . "'>=ssm.START_DATE AND ('" . $extra['DATE'] . "'<=ssm.END_DATE OR ssm.END_DATE IS NULL))";
                $sql .= " AND ('" . $extra['DATE'] . "'>=ss.START_DATE AND ('" . $extra['DATE'] . "'<=ss.END_DATE OR ss.END_DATE IS NULL))";
            }
            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 {
                if (Preferences('NAME') == 'Common') {
                    $sql .= "CONCAT(s.LAST_NAME,', ',coalesce(s.COMMON_NAME,s.FIRST_NAME)) AS FULL_NAME,";
                } else {
                    $sql .= "CONCAT(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,STUDENT_ENROLLMENT ssm " . $extra['FROM'] . "\r\n\t\t\t\t\tWHERE ssm.STUDENT_ID=s.STUDENT_ID AND ssm.SYEAR='" . UserSyear() . "' AND ssm.SCHOOL_ID='" . UserSchool() . "' AND ('" . DBDate() . "' BETWEEN ssm.START_DATE AND ssm.END_DATE OR (ssm.END_DATE IS NULL AND '" . DBDate() . "'>ssm.START_DATE)) AND ssm.STUDENT_ID" . ($extra['ASSOCIATED'] ? " IN (SELECT STUDENT_ID FROM STUDENTS_JOIN_USERS WHERE STAFF_ID='" . $extra['ASSOCIATED'] . "')" : "='" . UserStudentID() . "'");
            break;
        default:
            exit('Error');
    }
    $sql = appendSQL($sql, $extra);
    $sql .= $extra['WHERE'] . ' ';
    $sql .= CustomFields('where');
    if ($extra['GROUP']) {
        $sql .= ' GROUP BY ' . $extra['GROUP'];
    }
    if (!$extra['ORDER_BY'] && !$extra['SELECT_ONLY']) {
        if (Preferences('SORT') == 'Grade') {
            $sql .= " ORDER BY (SELECT SORT_ORDER FROM SCHOOL_GRADELEVELS WHERE ID=ssm.GRADE_ID),FULL_NAME";
        } else {
            $sql .= " ORDER BY FULL_NAME";
        }
        $sql .= $extra['ORDER'];
    } elseif ($extra['ORDER_BY']) {
        $sql .= ' ORDER BY ' . $extra['ORDER_BY'];
    }
    if ($extra['DEBUG'] === true) {
        echo '<!--' . $sql . '-->';
    }
    return DBGet(DBQuery($sql), $functions, $extra['group']);
}
开发者ID:26746647,项目名称:Belize-openSIS,代码行数:101,代码来源:custom_functions.fnc.php

示例7: UPPER

        if ($_REQUEST['GENDER']) {
            $extra .= " AND s.GENDER='{$_REQUEST['GENDER']}'";
        }
        if ($_REQUEST['stuid']) {
            $extra .= " AND s.STUDENT_ID = '{$_REQUEST['stuid']}' ";
        }
        if ($_REQUEST['last']) {
            $extra .= " AND UPPER(s.LAST_NAME) LIKE '" . strtoupper($_REQUEST['last']) . "%' ";
        }
        if ($_REQUEST['first']) {
            $extra .= " AND UPPER(s.FIRST_NAME) LIKE '" . strtoupper($_REQUEST['first']) . "%' ";
        }
        if ($_REQUEST['ethnic']) {
            $extra .= " AND s.ETHNICITY = '{$_REQUEST['ethnic']}' ";
        }
        $extra .= CustomFields('where') . " GROUP BY ssm.GRADE_ID,ssm.CALENDAR_ID";
        $student_days_absent = DBGet(DBQuery("SELECT ssm.GRADE_ID,ssm.CALENDAR_ID,COALESCE(sum(ad.STATE_VALUE-1)*-1,0) AS STATE_VALUE FROM ATTENDANCE_DAY ad,STUDENT_ENROLLMENT ssm,STUDENTS s WHERE s.STUDENT_ID=ssm.STUDENT_ID AND ad.STUDENT_ID=ssm.STUDENT_ID AND ssm.SYEAR='" . UserSyear() . "' AND ad.SYEAR=ssm.SYEAR AND ad.SCHOOL_DATE BETWEEN '{$start_date}' AND '{$end_date}' AND (ad.SCHOOL_DATE BETWEEN ssm.START_DATE AND ssm.END_DATE OR (ssm.END_DATE IS NULL AND ssm.START_DATE <= ad.SCHOOL_DATE)) " . $extra), array(''), array('GRADE_ID', 'CALENDAR_ID'));
        $student_days_possible = DBGet(DBQuery("SELECT ssm.GRADE_ID,ssm.CALENDAR_ID,'' AS DAYS_POSSIBLE,count(*) AS ATTENDANCE_POSSIBLE,count(*) AS STUDENTS,'' AS PRESENT,'' AS ABSENT,'' AS ADA,'' AS AVERAGE_ATTENDANCE,'' AS AVERAGE_ABSENT FROM STUDENT_ENROLLMENT ssm,ATTENDANCE_CALENDAR ac,STUDENTS s WHERE s.STUDENT_ID=ssm.STUDENT_ID AND ssm.SYEAR='" . UserSyear() . "' AND ac.SYEAR=ssm.SYEAR AND ac.CALENDAR_ID=ssm.CALENDAR_ID AND " . ($_REQUEST['_search_all_schools'] != 'Y' ? "ssm.SCHOOL_ID='" . UserSchool() . "' AND " : '') . " ssm.SCHOOL_ID=ac.SCHOOL_ID AND (ac.SCHOOL_DATE BETWEEN ssm.START_DATE AND ssm.END_DATE OR (ssm.END_DATE IS NULL AND ssm.START_DATE <= ac.SCHOOL_DATE)) AND ac.SCHOOL_DATE BETWEEN '{$start_date}' AND '{$end_date}' " . $extra), array('GRADE_ID' => '_make', 'STUDENTS' => '_make', 'PRESENT' => '_make', 'ABSENT' => '_make', 'ADA' => '_make', 'AVERAGE_ATTENDANCE' => '_make', 'AVERAGE_ABSENT' => '_make', 'DAYS_POSSIBLE' => '_make'));
        $columns = array('GRADE_ID' => 'Grade', 'STUDENTS' => 'Total Attendance', 'DAYS_POSSIBLE' => 'Days Possible', 'PRESENT' => 'Present', 'ABSENT' => 'Absent', 'ADA' => 'ADA', 'AVERAGE_ATTENDANCE' => 'Average Attendance', 'AVERAGE_ABSENT' => 'Average Absent');
        $link['add']['html'] = array('GRADE_ID' => '<b>Total</b>', 'STUDENTS' => round($sum['STUDENTS'], 1), 'DAYS_POSSIBLE' => $cal_days[key($cal_days)][1]['COUNT'], 'PRESENT' => $sum['PRESENT'], 'ADA' => Percent($sum['PRESENT'] / ($sum['PRESENT'] + $sum['ABSENT'])), 'ABSENT' => $sum['ABSENT'], 'AVERAGE_ATTENDANCE' => round($sum['AVERAGE_ATTENDANCE'], 1), 'AVERAGE_ABSENT' => round($sum['AVERAGE_ABSENT'], 1));
        ListOutput($student_days_possible, $columns, '', '', $link);
    }
}
function _make($value, $column)
{
    global $THIS_RET, $student_days_absent, $cal_days, $sum, $calendars_RET;
    switch ($column) {
        case 'STUDENTS':
            //$sum['STUDENTS'] += $value/$cal_days[$THIS_RET['CALENDAR_ID']][1]['COUNT'];
            $sum['STUDENTS'] += $value;
            //return round($value/$cal_days[$THIS_RET['CALENDAR_ID']][1]['COUNT'],1);
开发者ID:SoftScape,项目名称:opensis,代码行数:31,代码来源:Percent.php


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