本文整理汇总了PHP中db_case函数的典型用法代码示例。如果您正苦于以下问题:PHP db_case函数的具体用法?PHP db_case怎么用?PHP db_case使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_case函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeSchoolInput
function makeSchoolInput($value = '')
{
$QI = DBQuery("SELECT NAME,SCHOOL,SCHOOL_TYPE FROM SCHOOLS WHERE SCHOOL > '00' AND DISPLAY_FORMS='Y' ORDER BY " . db_case(array("SCHOOL", "'ALL'", "'2'", "'1'")) . "," . db_case(array("SCHOOL_TYPE", "'ELM'", "'1'", "'MID'", "'2'", "'HIGH'", "'3'", "'4'")) . ",NAME ");
$RET = DBReturn($QI, $count);
$return .= "<SELECT name=school>";
$return .= "<OPTION value=''>Not Specified</OPTION>";
foreach ($RET as $key => $school) {
$return .= "<OPTION value={$school['SCHOOL']}";
if ($school[SCHOOL] == $value) {
$return .= " SELECTED";
}
$return .= ">{$school['NAME']}</OPTION>";
}
$return .= "</SELECT>";
return $return;
}
示例2: DBGet
<?php
if ($_REQUEST['detailed_view'] == 'true') {
$RET = DBGet(DBQuery("SELECT fst.TRANSACTION_ID AS TRANS_ID,fst.TRANSACTION_ID,fst.ACCOUNT_ID,fst.SHORT_NAME,fst.STUDENT_ID,fst.DISCOUNT,(SELECT sum(AMOUNT) FROM FOOD_SERVICE_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fst.TRANSACTION_ID) AS AMOUNT,fst.BALANCE,to_char(fst.TIMESTAMP,'YYYY-MM-DD') AS DATE,to_char(fst.TIMESTAMP,'HH:MI:SS AM') AS TIME,fst.DESCRIPTION," . db_case(array('fst.STUDENT_ID', "''", 'NULL', "(SELECT LAST_NAME||', '||" . (Preferences('NAME') == 'Common' ? 'coalesce(CUSTOM_200000002,FIRST_NAME)' : 'FIRST_NAME') . " FROM STUDENTS WHERE STUDENT_ID=fst.STUDENT_ID)")) . " AS FULL_NAME," . db_case(array('fst.SELLER_ID', "''", 'NULL', "(SELECT FIRST_NAME||' '||LAST_NAME FROM STAFF WHERE STAFF_ID=fst.SELLER_ID)")) . " AS SELLER FROM FOOD_SERVICE_TRANSACTIONS fst WHERE SYEAR='" . UserSyear() . "' AND fst.TIMESTAMP BETWEEN '" . $date . "' AND date '" . $date . "' +1 AND SCHOOL_ID='" . UserSchool() . "'" . $where . "ORDER BY " . ($_REQUEST['by_name'] ? "FULL_NAME," : '') . "fst.TRANSACTION_ID DESC"), array('DATE' => 'ProperDate', 'SHORT_NAME' => 'bump_count'));
foreach ($RET as $key => $value) {
// get details of each transaction
$tmpRET = DBGet(DBQuery("SELECT TRANSACTION_ID AS TRANS_ID,*,'" . $value['SHORT_NAME'] . "' AS TRANSACTION_SHORT_NAME FROM FOOD_SERVICE_TRANSACTION_ITEMS WHERE TRANSACTION_ID='" . $value['TRANSACTION_ID'] . "'"), array('SHORT_NAME' => 'bump_items_count'));
// merge transaction and detail records
$RET[$key] = array($value) + $tmpRET;
}
//echo '<pre>'; var_dump($RET); echo '</pre>';
$columns = array('TRANSACTION_ID' => _('ID'), 'ACCOUNT_ID' => _('Account ID'), 'FULL_NAME' => _('Student'), 'DATE' => _('Date'), 'TIME' => _('Time'), 'BALANCE' => _('Balance'), 'DISCOUNT' => _('Discount'), 'DESCRIPTION' => _('Description'), 'DISCOUNT' => _('Discount'), 'AMOUNT' => _('Amount'), 'SELLER' => _('User'));
$group = array(array('TRANSACTION_ID'));
$link['remove']['link'] = PreparePHP_SELF($_REQUEST, array(), array('modfunc' => 'delete'));
$link['remove']['variables'] = array('transaction_id' => 'TRANS_ID', 'item_id' => 'ITEM_ID');
} else {
$RET = DBGet(DBQuery("SELECT fst.TRANSACTION_ID,fst.ACCOUNT_ID,fst.SHORT_NAME,fst.STUDENT_ID,fst.DISCOUNT,(SELECT sum(AMOUNT) FROM FOOD_SERVICE_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fst.TRANSACTION_ID) AS AMOUNT,fst.BALANCE,to_char(fst.TIMESTAMP,'YYYY-MM-DD') AS DATE,to_char(fst.TIMESTAMP,'HH:MI:SS AM') AS TIME,fst.DESCRIPTION," . db_case(array('fst.STUDENT_ID', "''", 'NULL', "(SELECT LAST_NAME||', '||" . (Preferences('NAME') == 'Common' ? 'coalesce(CUSTOM_200000002,FIRST_NAME)' : 'FIRST_NAME') . " FROM STUDENTS WHERE STUDENT_ID=fst.STUDENT_ID)")) . " AS FULL_NAME FROM FOOD_SERVICE_TRANSACTIONS fst WHERE SYEAR='" . UserSyear() . "' AND fst.TIMESTAMP BETWEEN '" . $date . "' AND date '" . $date . "' +1 AND SCHOOL_ID='" . UserSchool() . "'" . $where . "ORDER BY " . ($_REQUEST['by_name'] ? "FULL_NAME," : '') . "fst.TRANSACTION_ID DESC"), array('DATE' => 'ProperDate', 'SHORT_NAME' => 'bump_count'));
$columns = array('TRANSACTION_ID' => _('ID'), 'ACCOUNT_ID' => _('Account ID'), 'FULL_NAME' => _('Student'), 'DATE' => _('Date'), 'TIME' => _('Time'), 'BALANCE' => _('Balance'), 'DISCOUNT' => _('Discount'), 'DESCRIPTION' => _('Description'), 'AMOUNT' => _('Amount'));
}
示例3: unset
}
}
}
unset($_REQUEST['student']);
unset($_REQUEST['staff']);
unset($_REQUEST['modfunc']);
}
$schools_RET = DBGet(DBQuery("SELECT ID,SYEAR,TITLE FROM SCHOOLS"), array(), array('SYEAR'));
//echo '<pre>'; var_dump($schools_RET); echo '</pre>';
foreach ($schools_RET as $syear => $schools) {
foreach ($schools as $school) {
$schools_select[$syear][$school['ID']] = $school['TITLE'];
}
}
//echo '<pre>'; var_dump($schools_select); echo '</pre>';
$students_RET = DBGet(DBQuery("SELECT fst.TRANSACTION_ID,fst.ACCOUNT_ID,fst.SYEAR," . db_case(array('fst.STUDENT_ID', "''", 'NULL', "(SELECT FIRST_NAME||' '||LAST_NAME FROM STUDENTS WHERE STUDENT_ID=fst.STUDENT_ID)")) . " AS FULL_NAME,fst.ACCOUNT_ID AS STUDENTS,fst.SCHOOL_ID FROM FOOD_SERVICE_TRANSACTIONS fst WHERE fst.SCHOOL_ID IS NULL"), array('STUDENTS' => '_students', 'SCHOOL_ID' => '_make_school'));
$staff_RET = DBGet(DBQuery("SELECT fst.TRANSACTION_ID,fst.STAFF_ID,fst.SYEAR,(SELECT FIRST_NAME||' '||LAST_NAME FROM STAFF WHERE STAFF_ID=fst.STAFF_ID) AS FULL_NAME,fst.SCHOOL_ID FROM FOOD_SERVICE_STAFF_TRANSACTIONS fst WHERE fst.SCHOOL_ID IS NULL"), array('SCHOOL_ID' => '_make_staff_school'));
//echo '<pre>'; var_dump($students_RET); echo '</pre>';
//echo '<pre>'; var_dump($users_RET); echo '</pre>';
echo "<FORM action=Modules.php?modname={$_REQUEST['modname']}&modfunc=update method=POST>";
DrawHeader('', SubmitButton(_('Save')));
$columns = array('TRANSACTION_ID' => _('ID'), 'ACCOUNT_ID' => _('Account ID'), 'SYEAR' => _('School Year'), 'FULL_NAME' => _('Student'), 'STUDENTS' => _('Students'), 'SCHOOL_ID' => _('School'));
ListOutput($students_RET, $columns, _('Student Transaction w/o School'), _('Student Transactions w/o School'), false, array(), array('save' => false, 'search' => false));
$columns = array('TRANSACTION_ID' => _('ID'), 'SYEAR' => _('School Year'), 'FULL_NAME' => _('User'), 'SCHOOL_ID' => _('School'));
ListOutput($staff_RET, $columns, _('User Transaction w/o School'), _('User Transactions w/o School'), false, array(), array('save' => false, 'search' => false));
echo '<CENTER>' . SubmitButton(_('Save')) . '</CENTER>';
echo '</FORM>';
function _students($value, $column)
{
$RET = DBGet(DBQuery("SELECT s.FIRST_NAME||' '||s.LAST_NAME AS FULL_NAME FROM STUDENTS s,FOOD_SERVICE_STUDENT_ACCOUNTS fsa WHERE s.STUDENT_ID=fsa.STUDENT_ID AND fsa.ACCOUNT_ID='" . $value . "'"));
foreach ($RET as $student) {
示例4: DBGet
#
# This program is released under the terms of the GNU General Public License as
# published by the Free Software Foundation, version 2 of the License.
# See license.txt.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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';
$requests_RET = DBGet(DBQuery("SELECT concat(r.COURSE_ID, '_', r.COURSE_WEIGHT) AS CRS,\r\n\t\t\t\t\tr.COURSE_ID,r.COURSE_WEIGHT,cp.COURSE_PERIOD_ID,\r\n\t\t\t\t\tc.TITLE AS COURSE_TITLE,cp.PERIOD_ID,\r\n\t\t\t\t\t(cp.TOTAL_SEATS-cp.FILLED_SEATS) AS OPEN_SEATS,s.STUDENT_ID AS SCHEDULED\r\n\t\t\t\tFROM SCHEDULE_REQUESTS r,\r\n\t\t\t\tCOURSES c,SCHOOL_PERIODS sp,\r\n\t\t\t\tCOURSE_PERIODS cp LEFT OUTER JOIN SCHEDULE s ON \r\n\t\t\t\t\t(s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND s.STUDENT_ID='" . UserStudentID() . "')\r\n\t\t\t\tWHERE \r\n\t\t\t\t\tr.SYEAR='" . UserSyear() . "' AND r.SCHOOL_ID='" . UserSchool() . "'\r\n\t\t\t\t\tAND r.COURSE_ID=cp.COURSE_ID AND c.COURSE_ID=cp.COURSE_ID\r\n\t\t\t\t\tAND r.STUDENT_ID='" . UserStudentID() . "'\r\n\t\t\t\t\tAND sp.PERIOD_ID=cp.PERIOD_ID\r\n\t\t\t\t\tORDER BY " . db_case(array('s.STUDENT_ID', "''", "NULL", 'sp.SORT_ORDER')) . "\r\n\t\t\t\t"), array(), array('CRS', 'PERIOD_ID'));
$periods_RET = DBGet(DBQuery("SELECT PERIOD_ID,SHORT_NAME FROM SCHOOL_PERIODS WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' ORDER BY SORT_ORDER"));
echo '<CENTER><TABLE style="border: 1px solid;">';
echo '<TR><TD></TD>';
foreach ($periods_RET as $period) {
echo '<TD><small><b>' . $period['SHORT_NAME'] . '</b></small></TD>';
}
foreach ($requests_RET as $course => $periods) {
echo '<TR><TD><small><b>' . $periods[key($periods)][1]['COURSE_TITLE'] . '</b><small></TD>';
foreach ($periods_RET as $period) {
if ($periods[$period['PERIOD_ID']][1]['SCHEDULED']) {
$color = '0000FF';
} elseif ($periods[$period['PERIOD_ID']]) {
if ($periods[$period['PERIOD_ID']][1]['OPEN_SEATS'] == 0) {
$color = 'FFFF00';
} else {
示例5: foreach
foreach ($percents_RET as $student_id => $percents) {
$total = $total_percent = 0;
foreach ($percents as $percent) {
$total += $percent['GRADE_PERCENT'] * $programconfig[User('STAFF_ID')][$prefix . $percent['MARKING_PERIOD_ID']];
$total_percent += $programconfig[User('STAFF_ID')][$prefix . $percent['MARKING_PERIOD_ID']];
}
#echo $total /= $total_percent;
$total /= $total_percent;
$import_RET[$student_id] = array(1 => array('REPORT_CARD_GRADE_ID' => _makeLetterGrade($total / 100, $course_period_id, 0, 'ID'), 'GRADE_PERCENT' => round($total, 2)));
}
} else {
if ($programconfig[User('STAFF_ID')]['WEIGHT'] == 'Y') {
$points_RET = DBGet(DBQuery('SELECT DISTINCT s.STUDENT_ID,gt.ASSIGNMENT_TYPE_ID, gt.ASSIGNMENT_TYPE_ID,sum(' . db_case(array('gg.POINTS', "'-1'", "'0'", 'gg.POINTS')) . ') AS PARTIAL_POINTS,sum(' . db_case(array('gg.POINTS', '\'-1\' OR (ga.due_date < (select DISTINCT ssm.start_date from student_enrollment ssm where ssm.STUDENT_ID=s.STUDENT_ID AND ssm.SYEAR=\'' . UserSyear() . '\' AND ssm.SCHOOL_ID=' . UserSchool() . ' AND (ssm.START_DATE IS NOT NULL AND (CURRENT_DATE<=ssm.END_DATE OR CURRENT_DATE>=ssm.END_DATE OR ssm.END_DATE IS NULL)) order by ssm.start_date desc limit 1
) ) ', '\'0\'', 'ga.POINTS')) . ') AS PARTIAL_TOTAL, gt.FINAL_GRADE_PERCENT FROM students s JOIN schedule ss ON (ss.STUDENT_ID=s.STUDENT_ID AND ss.COURSE_PERIOD_ID=\'' . $course_period_id . '\') JOIN gradebook_assignments ga ON ((ga.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID OR ga.COURSE_ID=\'' . $course_id . '\' AND ga.STAFF_ID=\'' . User('STAFF_ID') . '\') AND ga.MARKING_PERIOD_ID=\'' . UserMP() . '\') LEFT OUTER JOIN gradebook_grades gg ON (gg.STUDENT_ID=s.STUDENT_ID AND gg.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND gg.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID),gradebook_assignment_types gt WHERE gg.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND gt.ASSIGNMENT_TYPE_ID=ga.ASSIGNMENT_TYPE_ID AND gt.COURSE_ID=\'' . $course_id . '\' AND ((ga.ASSIGNED_DATE IS NULL OR CURRENT_DATE>=ga.ASSIGNED_DATE) AND (ga.DUE_DATE IS NULL OR CURRENT_DATE>=ga.DUE_DATE) OR gg.POINTS IS NOT NULL) GROUP BY s.STUDENT_ID,ss.START_DATE,gt.ASSIGNMENT_TYPE_ID,gt.FINAL_GRADE_PERCENT'), array(), array('STUDENT_ID'));
} else {
$points_RET = DBGet(DBQuery('SELECT DISTINCT s.STUDENT_ID,\'-1\' AS ASSIGNMENT_TYPE_ID,sum(' . db_case(array('gg.POINTS', "'-1'", "'0'", 'gg.POINTS')) . ') AS PARTIAL_POINTS,sum(' . db_case(array('gg.POINTS', '\'-1\' OR (ga.due_date < (select DISTINCT ssm.start_date from student_enrollment ssm where ssm.STUDENT_ID=s.STUDENT_ID AND ssm.SYEAR=\'' . UserSyear() . '\' AND ssm.SCHOOL_ID=' . UserSchool() . ' AND (ssm.START_DATE IS NOT NULL AND (CURRENT_DATE<=ssm.END_DATE OR CURRENT_DATE>=ssm.END_DATE OR ssm.END_DATE IS NULL)) order by ssm.start_date desc limit 1
) ) ', '\'0\'', 'ga.POINTS')) . ') AS PARTIAL_TOTAL,\'1\' AS FINAL_GRADE_PERCENT FROM students s JOIN schedule ss ON (ss.STUDENT_ID=s.STUDENT_ID AND ss.COURSE_PERIOD_ID=\'' . $course_period_id . '\') JOIN gradebook_assignments ga ON ((ga.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID OR ga.COURSE_ID=\'' . $course_id . '\' AND ga.STAFF_ID=\'' . User('STAFF_ID') . '\') AND ga.MARKING_PERIOD_ID=\'' . UserMP() . '\') LEFT OUTER JOIN gradebook_grades gg ON (gg.STUDENT_ID=s.STUDENT_ID AND gg.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND gg.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID) WHERE gg.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND ((ga.ASSIGNED_DATE IS NULL OR CURRENT_DATE>=ga.ASSIGNED_DATE) AND (ga.DUE_DATE IS NULL OR CURRENT_DATE>=ga.DUE_DATE) OR gg.POINTS IS NOT NULL) GROUP BY s.STUDENT_ID,ss.START_DATE,FINAL_GRADE_PERCENT'), array(), array('STUDENT_ID'));
}
if (count($points_RET)) {
foreach ($points_RET as $student_id => $student) {
$total = $total_percent = 0;
foreach ($student as $partial_points) {
if ($partial_points['PARTIAL_TOTAL'] != 0) {
$total += $partial_points['PARTIAL_POINTS'] * $partial_points['FINAL_GRADE_PERCENT'] / $partial_points['PARTIAL_TOTAL'];
$total_percent += $partial_points['FINAL_GRADE_PERCENT'];
}
}
if ($total_percent != 0) {
$total /= $total_percent;
}
$import_RET[$student_id] = array(1 => array('REPORT_CARD_GRADE_ID' => _makeLetterGrade($total, $course_period_id, 0, 'ID'), 'GRADE_PERCENT' => round(100 * $total, 2)));
}
示例6: foreach
if (count($config_RET)) {
foreach ($config_RET as $title => $value) {
$programconfig[User('STAFF_ID')][$title] = $value[1]['VALUE'];
}
} else {
$programconfig[User('STAFF_ID')] = true;
}
include 'ProgramFunctions/_makeLetterGrade.fnc.php';
$course_period_id = UserCoursePeriod();
$course_id = DBGet(DBQuery("SELECT COURSE_ID FROM COURSE_PERIODS WHERE COURSE_PERIOD_ID='" . UserCoursePeriod() . "'"));
$course_id = $course_id[1]['COURSE_ID'];
$grades_RET = DBGet(DBQuery("SELECT ID,TITLE,GPA_VALUE FROM REPORT_CARD_GRADES WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'"), array(), array('ID'));
if ($programconfig[User('STAFF_ID')]['WEIGHT'] == 'Y') {
$points_RET = DBGet(DBQuery("SELECT DISTINCT ON (s.STUDENT_ID,gt.ASSIGNMENT_TYPE_ID) s.STUDENT_ID, gt.ASSIGNMENT_TYPE_ID,sum(" . db_case(array('gg.POINTS', "'-1'", "'0'", 'gg.POINTS')) . ") AS PARTIAL_POINTS,sum(" . db_case(array('gg.POINTS', "'-1'", "'0'", 'ga.POINTS')) . ") AS PARTIAL_TOTAL, gt.FINAL_GRADE_PERCENT FROM STUDENTS s JOIN SCHEDULE ss ON (ss.STUDENT_ID=s.STUDENT_ID AND ss.COURSE_PERIOD_ID='{$course_period_id}') JOIN GRADEBOOK_ASSIGNMENTS ga ON ((ga.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID OR ga.COURSE_ID='{$course_id}' AND ga.STAFF_ID='" . User('STAFF_ID') . "') AND ga.MARKING_PERIOD_ID" . ($programconfig[User('STAFF_ID')]['ELIGIBILITY_CUMULITIVE'] == 'Y' ? " IN (" . GetChildrenMP('SEM', UserMP()) . ")" : "='" . UserMP() . "'") . ") LEFT OUTER JOIN GRADEBOOK_GRADES gg ON (gg.STUDENT_ID=s.STUDENT_ID AND gg.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND gg.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID),GRADEBOOK_ASSIGNMENT_TYPES gt WHERE gt.ASSIGNMENT_TYPE_ID=ga.ASSIGNMENT_TYPE_ID AND gt.COURSE_ID='{$course_id}' AND ((ga.ASSIGNED_DATE IS NULL OR CURRENT_DATE>=ga.ASSIGNED_DATE) AND (ga.DUE_DATE IS NULL OR CURRENT_DATE>=ga.DUE_DATE) OR gg.POINTS IS NOT NULL) GROUP BY s.STUDENT_ID,ss.START_DATE,gt.ASSIGNMENT_TYPE_ID,gt.FINAL_GRADE_PERCENT"), array(), array('STUDENT_ID'));
} else {
$points_RET = DBGet(DBQuery("SELECT DISTINCT ON (s.STUDENT_ID) s.STUDENT_ID,'-1' AS ASSIGNMENT_TYPE_ID,sum(" . db_case(array('gg.POINTS', "'-1'", "'0'", 'gg.POINTS')) . ") AS PARTIAL_POINTS,sum(" . db_case(array('gg.POINTS', "'-1'", "'0'", 'ga.POINTS')) . ") AS PARTIAL_TOTAL,'1' AS FINAL_GRADE_PERCENT FROM STUDENTS s JOIN SCHEDULE ss ON (ss.STUDENT_ID=s.STUDENT_ID AND ss.COURSE_PERIOD_ID='{$course_period_id}') JOIN GRADEBOOK_ASSIGNMENTS ga ON ((ga.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID OR ga.COURSE_ID='{$course_id}' AND ga.STAFF_ID='" . User('STAFF_ID') . "') AND ga.MARKING_PERIOD_ID" . ($programconfig[User('STAFF_ID')]['ELIGIBILITY_CUMULITIVE'] == 'Y' ? " IN (" . GetChildrenMP('SEM', UserMP()) . ")" : "='" . UserMP() . "'") . ") LEFT OUTER JOIN GRADEBOOK_GRADES gg ON (gg.STUDENT_ID=s.STUDENT_ID AND gg.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND gg.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID) WHERE ((ga.ASSIGNED_DATE IS NULL OR CURRENT_DATE>=ga.ASSIGNED_DATE) AND (ga.DUE_DATE IS NULL OR CURRENT_DATE>=ga.DUE_DATE) OR gg.POINTS IS NOT NULL) GROUP BY s.STUDENT_ID,ss.START_DATE "), array(), array('STUDENT_ID'));
}
if (count($points_RET)) {
foreach ($points_RET as $student_id => $student) {
$total = $total_percent = 0;
foreach ($student as $partial_points) {
if ($partial_points['PARTIAL_TOTAL'] != 0) {
$total += $partial_points['PARTIAL_POINTS'] * $partial_points['FINAL_GRADE_PERCENT'] / $partial_points['PARTIAL_TOTAL'];
$total_percent += $partial_points['FINAL_GRADE_PERCENT'];
}
}
if ($total_percent != 0) {
$total /= $total_percent;
}
$grade = $grades_RET[_makeLetterGrade($total, 0, 0, 'ID')][1];
if ($grade['GPA_VALUE'] == '0' || !$grade['GPA_VALUE']) {
示例7: IN
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++;
$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['PERIOD_ID']][1]['SHORT_NAME'], $attendance_RET[$value['SCHOOL_DATE']][$course['PERIOD_ID']][1]['STATE_CODE'], $attendance_RET[$value['SCHOOL_DATE']][$course['PERIOD_ID']][1]['DEFAULT_CODE']);
}
}
}
$columns = array('TITLE' => 'Course');
if (count($cal_RET)) {
foreach ($cal_RET as $value) {
$columns[$value['SHORT_DATE']] = ShortDate($value['SCHOOL_DATE']);
示例8: GetStuListAttn
//.........这里部分代码省略.........
$extra['columns_after']['PHONE'] = 'Home Phone';
}
if ($view_other_RET['GUARDIANS'][1]['VALUE'] == 'Y' || $view_other_RET['ALL_CONTACTS'][1]['VALUE'] == 'Y') {
$functions['PARENTS'] = 'makeParents';
if ($view_other_RET['ALL_CONTACTS'][1]['VALUE'] == 'Y') {
$extra['columns_after']['PARENTS'] = 'Contacts';
} else {
$extra['columns_after']['PARENTS'] = 'Guardians';
}
}
} elseif ($_REQUEST['addr'] || $extra['addr']) {
$extra['FROM'] = ' LEFT OUTER JOIN student_address a ON (ssm.STUDENT_ID=a.STUDENT_ID) ' . $extra['FROM'];
$distinct = 'DISTINCT ';
}
}
$extra['SELECT'] .= $select;
} elseif ($_REQUEST['addr'] || $extra['addr']) {
$extra['FROM'] = ' LEFT OUTER JOIN student_address a ON (ssm.STUDENT_ID=a.STUDENT_ID) ' . $extra['FROM'];
$distinct = 'DISTINCT ';
}
switch (User('PROFILE')) {
case 'admin':
$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 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') {
示例9: NoInput
echo '<TD valign=top>' . NoInput(red($student['BALANCE']), _('Balance')) . '</TD>';
echo '</TR></TABLE>';
if ($_REQUEST['detailed_view'] != 'true') {
DrawHeader('<A HREF=' . PreparePHP_SELF($_REQUEST, array(), array('detailed_view' => 'true')) . '>' . _('Detailed View') . '</A>');
} else {
DrawHeader('<A HREF=' . PreparePHP_SELF($_REQUEST, array(), array('detailed_view' => 'false')) . '>' . _('Original View') . '</A>');
}
if ($student['BALANCE']) {
if ($_REQUEST['student_select']) {
$where = " AND fst.STUDENT_ID='" . $_REQUEST['student_select'] . "'";
}
if ($_REQUEST['type_select']) {
$where .= " AND fst.SHORT_NAME='" . $_REQUEST['type_select'] . "'";
}
if ($_REQUEST['detailed_view'] == 'true') {
$RET = DBGet(DBQuery("SELECT fst.TRANSACTION_ID AS TRANS_ID,fst.TRANSACTION_ID,fst.STUDENT_ID,fst.DISCOUNT,(SELECT sum(AMOUNT) FROM FOOD_SERVICE_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fst.TRANSACTION_ID) AS AMOUNT,fst.BALANCE,to_char(fst.TIMESTAMP,'YYYY-MM-DD') AS DATE,to_char(fst.TIMESTAMP,'HH:MI:SS AM') AS TIME,fst.DESCRIPTION," . db_case(array('fst.STUDENT_ID', "''", 'NULL', "(SELECT FIRST_NAME||' '||LAST_NAME FROM STUDENTS WHERE STUDENT_ID=fst.STUDENT_ID)")) . " AS STUDENT," . db_case(array('fst.SELLER_ID', "''", 'NULL', "(SELECT FIRST_NAME||' '||LAST_NAME FROM STAFF WHERE STAFF_ID=fst.SELLER_ID)")) . " AS SELLER FROM FOOD_SERVICE_TRANSACTIONS fst WHERE fst.ACCOUNT_ID='" . $student['ACCOUNT_ID'] . "' AND SYEAR='" . UserSyear() . "' AND fst.TIMESTAMP BETWEEN '" . $start_date . "' AND date '" . $end_date . "' +1" . $where . " ORDER BY fst.TRANSACTION_ID DESC"), array('DATE' => 'ProperDate', 'BALANCE' => 'red'));
// get details of each transaction
foreach ($RET as $key => $value) {
$tmpRET = DBGet(DBQuery("SELECT TRANSACTION_ID AS TRANS_ID,* FROM FOOD_SERVICE_TRANSACTION_ITEMS WHERE TRANSACTION_ID='" . $value['TRANSACTION_ID'] . "'"));
// merge transaction and detail records
$RET[$key] = array($RET[$key]) + $tmpRET;
}
$columns = array('TRANSACTION_ID' => _('ID'), 'STUDENT' => _('Student'), 'DATE' => _('Date'), 'TIME' => _('Time'), 'BALANCE' => _('Balance'), 'DISCOUNT' => _('Discount'), 'DESCRIPTION' => _('Description'), 'AMOUNT' => _('Amount'), 'SELLER' => _('Seller'));
$group = array(array('TRANSACTION_ID'));
$link['remove']['link'] = PreparePHP_SELF($_REQUEST, array(), array('modfunc' => 'delete'));
$link['remove']['variables'] = array('transaction_id' => 'TRANS_ID', 'item_id' => 'ITEM_ID');
} else {
$RET = DBGet(DBQuery("SELECT fst.TRANSACTION_ID,fst.DISCOUNT,(SELECT sum(AMOUNT) FROM FOOD_SERVICE_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fst.TRANSACTION_ID) AS AMOUNT,fst.BALANCE,to_char(fst.TIMESTAMP,'YYYY-MM-DD') AS DATE,to_char(fst.TIMESTAMP,'HH:MI:SS AM') AS TIME,fst.DESCRIPTION FROM FOOD_SERVICE_TRANSACTIONS fst WHERE fst.ACCOUNT_ID='" . $student['ACCOUNT_ID'] . "' AND SYEAR='" . UserSyear() . "' AND fst.TIMESTAMP BETWEEN '" . $start_date . "' AND date '" . $end_date . "'+1 " . $where . " ORDER BY fst.TRANSACTION_ID DESC"), array('DATE' => 'ProperDate', 'BALANCE' => 'red'));
$columns = array('TRANSACTION_ID' => _('ID'), 'DATE' => _('Date'), 'TIME' => _('Time'), 'BALANCE' => _('Balance'), 'DISCOUNT' => _('Discount'), 'DESCRIPTION' => _('Description'), 'AMOUNT' => _('Amount'));
}
ListOutput($RET, $columns, _('Transaction'), _('Transactions'), $link, $group);
示例10: GetStuList_Absence_Summary
//.........这里部分代码省略.........
$functions['PARENTS'] = 'makeParents';
if ($view_other_RET['ALL_CONTACTS'][1]['VALUE'] == 'Y') {
$extra['columns_after']['PARENTS'] = 'Contacts';
} else {
$extra['columns_after']['PARENTS'] = 'Guardians';
}
}
} elseif ($_REQUEST['addr'] || $extra['addr']) {
$extra['FROM'] = ' LEFT OUTER JOIN students_join_address sam ON (ssm.STUDENT_ID=sam.STUDENT_ID ' . $extra['students_join_address'] . ') LEFT OUTER JOIN address a ON (sam.ADDRESS_ID=a.ADDRESS_ID) ' . $extra['FROM'];
$distinct = 'DISTINCT ';
}
}
$extra['SELECT'] .= $select;
} elseif ($_REQUEST['addr'] || $extra['addr']) {
$extra['FROM'] = ' LEFT OUTER JOIN students_join_address sam ON (ssm.STUDENT_ID=sam.STUDENT_ID ' . $extra['students_join_address'] . ') LEFT OUTER JOIN address a ON (sam.ADDRESS_ID=a.ADDRESS_ID) ' . $extra['FROM'];
$distinct = 'DISTINCT ';
}
$_SESSION['new_customsql'] = $extra['SELECT'];
switch (User('PROFILE')) {
case 'admin':
$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,';
}
$_SESSION['new_sql'] = $sql;
$sql .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,s.PHONE,ssm.SCHOOL_ID,s.ALT_ID,ssm.SCHOOL_ID AS LIST_SCHOOL_ID,ssm.GRADE_ID' . $extra['SELECT'];
$_SESSION['new_sql'] .= 's.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,s.PHONE,ssm.SCHOOL_ID,s.ALT_ID,ssm.SCHOOL_ID AS LIST_SCHOOL_ID,ssm.GRADE_ID' . $_SESSION['new_customsql'];
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.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 ';
}
$_SESSION['new_sql'] .= ',' . db_case(array('(ssm.SYEAR=\'' . UserSyear() . '\' AND ( (ssm.START_DATE IS NOT NULL 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 ';
$_SESSION['new_sql'] .= ' FROM students s ';
if ($_REQUEST['mp_comment']) {
$sql .= ",student_mp_comments smc ";
$_SESSION['newsql'] .= ',student_mp_comments smc ';
}
if ($_REQUEST['goal_title'] || $_REQUEST['goal_description']) {
$sql .= ',goal g ';
$_SESSION['newsql'] .= ',goal g ';
}
if ($_REQUEST['progress_name'] || $_REQUEST['progress_description']) {
$sql .= ",progress p ";
$_SESSION['newsql'] .= ',progress p ';
}
if ($_REQUEST['doctors_note_comments'] || $_REQUEST['med_day'] || $_REQUEST['med_month'] || $_REQUEST['med_year']) {
$sql .= ",student_medical_notes smn ";
$_SESSION['newsql'] .= ',student_medical_notes smn ';
}
if ($_REQUEST['type'] || $_REQUEST['imm_comments'] || $_REQUEST['imm_day'] || $_REQUEST['imm_month'] || $_REQUEST['imm_year']) {
$sql .= ',student_immunization sm ';
$_SESSION['newsql'] .= ',student_immunization sm ';
}
if ($_REQUEST['med_alrt_title'] || $_REQUEST['ma_day'] || $_REQUEST['ma_month'] || $_REQUEST['ma_year']) {
$sql .= ",student_medical_alerts sma ";
$_SESSION['newsql'] .= ',student_medical_alerts sma ';
}
if ($_REQUEST['reason'] || $_REQUEST['result'] || $_REQUEST['med_vist_comments'] || $_REQUEST['nv_day'] || $_REQUEST['nv_month'] || $_REQUEST['nv_year']) {
$sql .= ",student_medical_visits smv ";
$_SESSION['newsql'] .= ',student_medical_visits smv ';
示例11: DBGet
<?php
/**
* @file $Id: ReferralLog.php 405 2007-01-22 21:10:19Z focus-sis $
* @package Focus/SIS
* @copyright Copyright (C) 2006 Andrew Schmadeke. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* Focus/SIS is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.txt for copyright notices and details.
*/
$categories_RET = DBGet(DBQuery("SELECT f.ID,u.TITLE,u.SELECT_OPTIONS,f.DATA_TYPE,u.SORT_ORDER FROM DISCIPLINE_FIELDS f,DISCIPLINE_FIELD_USAGE u WHERE f.DATA_TYPE!='multiple_checkbox' AND u.DISCIPLINE_FIELD_ID=f.ID ORDER BY " . db_case(array('DATA_TYPE', "'textarea'", "'1'", "'0'")) . ",SORT_ORDER"), array(), array('ID'));
$extra['new'] = true;
$extra['second_col'] .= '<fieldset><legend>' . _('Include in Referral Log') . ':</legend><TABLE>';
$extra['second_col'] .= '<TR><TD><INPUT type=checkbox name=elements[ENTRY_DATE] value=Y CHECKED>' . _('Entry Date') . '</TD>';
$extra['second_col'] .= '<TD><INPUT type=checkbox name=elements[STAFF_ID] value=Y CHECKED>' . _('Reporter') . '</TD></TR>';
foreach ($categories_RET as $id => $category) {
if ($i % 2 == 0) {
$extra['second_col'] .= '</TR><TR>';
}
$extra['second_col'] .= '<TD><INPUT type=checkbox name=elements[CATEGORY_' . $id . '] value=Y' . ($category[1]['DATA_TYPE'] == 'textarea' ? ' CHECKED' : '') . '>' . $category[1]['TITLE'] . '</TD>';
$i++;
}
$extra['second_col'] .= '</TABLE></fieldset>';
$templates_RET = DBGet(DBQuery("SELECT ID,TITLE FROM HEADER_TEMPLATES ORDER BY TITLE"));
foreach ($templates_RET as $template) {
$options .= "<OPTION value={$template['ID']}>" . $template['TITLE'] . '</OPTION>';
}
$extra['second_col'] .= '<TABLE><TR><TD width=100> </TD><TD align=' . ALIGN_RIGHT . '>' . _('Document Template') . ' </TD><TD><SELECT name=_template_id><OPTION value="">' . _('None') . '</OPTION>' . $options . '</SELECT></TD></TR></TABLE>';
示例12: MyWidgets
function MyWidgets($item)
{
global $extra, $_ROSARIO;
switch ($item) {
case 'honor_roll':
if ($_REQUEST['honor_roll'] == 'Y' && $_REQUEST['high_honor_roll'] == 'Y') {
$extra['SELECT'] .= "," . db_case(array("exists(SELECT rg.GPA_VALUE FROM STUDENT_REPORT_CARD_GRADES sg,COURSE_PERIODS cp,REPORT_CARD_GRADES rg WHERE sg.STUDENT_ID=s.STUDENT_ID AND cp.SYEAR=ssm.SYEAR AND sg.SYEAR=ssm.SYEAR AND sg.MARKING_PERIOD_ID='" . UserMP() . "' AND cp.COURSE_PERIOD_ID=sg.COURSE_PERIOD_ID AND cp.DOES_HONOR_ROLL='Y' AND rg.GRADE_SCALE_ID=cp.GRADE_SCALE_ID AND sg.REPORT_CARD_GRADE_ID=rg.ID AND rg.GPA_VALUE<(SELECT HHR_GPA_VALUE FROM REPORT_CARD_GRADE_SCALES WHERE ID=rg.GRADE_SCALE_ID))", 'true', 'NULL', "'<img src=\"assets/check.png\" height=\"15\" />'")) . " AS HIGH_HONOR";
$extra['WHERE'] .= " AND exists(SELECT '' FROM STUDENT_REPORT_CARD_GRADES sg,COURSE_PERIODS cp WHERE sg.STUDENT_ID=s.STUDENT_ID AND cp.SYEAR=ssm.SYEAR AND sg.SYEAR=ssm.SYEAR AND sg.MARKING_PERIOD_ID='" . UserMP() . "' AND cp.COURSE_PERIOD_ID=sg.COURSE_PERIOD_ID AND cp.DOES_HONOR_ROLL='Y')";
$extra['WHERE'] .= " AND NOT exists(SELECT '' FROM STUDENT_REPORT_CARD_GRADES sg,COURSE_PERIODS cp,REPORT_CARD_GRADES rg WHERE sg.STUDENT_ID=s.STUDENT_ID AND cp.SYEAR=ssm.SYEAR AND sg.SYEAR=ssm.SYEAR AND sg.MARKING_PERIOD_ID='" . UserMP() . "' AND cp.COURSE_PERIOD_ID=sg.COURSE_PERIOD_ID AND cp.DOES_HONOR_ROLL='Y' AND rg.GRADE_SCALE_ID=cp.GRADE_SCALE_ID AND sg.REPORT_CARD_GRADE_ID=rg.ID AND rg.GPA_VALUE<(SELECT HR_GPA_VALUE FROM REPORT_CARD_GRADE_SCALES WHERE ID=rg.GRADE_SCALE_ID))";
$extra['columns_after']['HIGH_HONOR'] = _('High Honor');
if (!$extra['NoSearchTerms']) {
//modif Francois: add translation
$_ROSARIO['SearchTerms'] .= '<b>' . _('Honor Roll') . ' & ' . _('High Honor Roll') . '</b><BR />';
}
} elseif ($_REQUEST['honor_roll'] == 'Y') {
$extra['WHERE'] .= " AND exists(SELECT '' FROM STUDENT_REPORT_CARD_GRADES sg,COURSE_PERIODS cp WHERE sg.STUDENT_ID=s.STUDENT_ID AND cp.SYEAR=ssm.SYEAR AND sg.SYEAR=ssm.SYEAR AND sg.MARKING_PERIOD_ID='" . UserMP() . "' AND cp.COURSE_PERIOD_ID=sg.COURSE_PERIOD_ID AND cp.DOES_HONOR_ROLL='Y')";
$extra['WHERE'] .= " AND NOT exists(SELECT '' FROM STUDENT_REPORT_CARD_GRADES sg,COURSE_PERIODS cp,REPORT_CARD_GRADES rg WHERE sg.STUDENT_ID=s.STUDENT_ID AND cp.SYEAR=ssm.SYEAR AND sg.SYEAR=ssm.SYEAR AND sg.MARKING_PERIOD_ID='" . UserMP() . "' AND cp.COURSE_PERIOD_ID=sg.COURSE_PERIOD_ID AND cp.DOES_HONOR_ROLL='Y' AND rg.GRADE_SCALE_ID=cp.GRADE_SCALE_ID AND sg.REPORT_CARD_GRADE_ID=rg.ID AND rg.GPA_VALUE<(SELECT HR_GPA_VALUE FROM REPORT_CARD_GRADE_SCALES WHERE ID=rg.GRADE_SCALE_ID))";
$extra['WHERE'] .= " AND exists(SELECT '' FROM STUDENT_REPORT_CARD_GRADES sg,COURSE_PERIODS cp,REPORT_CARD_GRADES rg WHERE sg.STUDENT_ID=s.STUDENT_ID AND cp.SYEAR=ssm.SYEAR AND sg.SYEAR=ssm.SYEAR AND sg.MARKING_PERIOD_ID='" . UserMP() . "' AND cp.COURSE_PERIOD_ID=sg.COURSE_PERIOD_ID AND cp.DOES_HONOR_ROLL='Y' AND rg.GRADE_SCALE_ID=cp.GRADE_SCALE_ID AND sg.REPORT_CARD_GRADE_ID=rg.ID AND rg.GPA_VALUE<(SELECT HHR_GPA_VALUE FROM REPORT_CARD_GRADE_SCALES WHERE ID=rg.GRADE_SCALE_ID))";
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= '<b>' . _('Honor Roll') . '</b><BR />';
}
} elseif ($_REQUEST['high_honor_roll'] == 'Y') {
$extra['WHERE'] .= " AND exists(SELECT '' FROM STUDENT_REPORT_CARD_GRADES sg,COURSE_PERIODS cp WHERE sg.STUDENT_ID=s.STUDENT_ID AND cp.SYEAR=ssm.SYEAR AND sg.SYEAR=ssm.SYEAR AND sg.MARKING_PERIOD_ID='" . UserMP() . "' AND cp.COURSE_PERIOD_ID=sg.COURSE_PERIOD_ID AND cp.DOES_HONOR_ROLL='Y')";
$extra['WHERE'] .= " AND NOT exists(SELECT '' FROM STUDENT_REPORT_CARD_GRADES sg,COURSE_PERIODS cp,REPORT_CARD_GRADES rg WHERE sg.STUDENT_ID=s.STUDENT_ID AND cp.SYEAR=ssm.SYEAR AND sg.SYEAR=ssm.SYEAR AND sg.MARKING_PERIOD_ID='" . UserMP() . "' AND cp.COURSE_PERIOD_ID=sg.COURSE_PERIOD_ID AND cp.DOES_HONOR_ROLL='Y' AND rg.GRADE_SCALE_ID=cp.GRADE_SCALE_ID AND sg.REPORT_CARD_GRADE_ID=rg.ID AND rg.GPA_VALUE<(SELECT HHR_GPA_VALUE FROM REPORT_CARD_GRADE_SCALES WHERE ID=rg.GRADE_SCALE_ID))";
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= '<b>' . _('High Honor Roll') . '</b><BR />';
}
}
//modif Francois: add <label> on checkbox
$extra['search'] .= '<TR><TD style="text-align:right; width:120px:">' . _('Honor Roll') . '</TD><TD><label><INPUT type="checkbox" name="honor_roll" value="Y" checked /> ' . _('Honor') . '</label> <label><INPUT type="checkbox" name="high_honor_roll" value="Y" checked /> ' . _('High Honor') . '</label></TD></TR>';
break;
}
}
示例13: DBGet
}
} else {
$programconfig[User('STAFF_ID')] = true;
}
$_openSIS['_makeLetterGrade']['courses'][$course_period_id] = DBGet(DBQuery("SELECT DOES_BREAKOFF,GRADE_SCALE_ID FROM COURSE_PERIODS WHERE COURSE_PERIOD_ID='" . $course_period_id . "'"));
include '_makeLetterGrade.fnc.php';
if (false && GetMP($_REQUEST['mp'], 'TABLE') == 'SCHOOL_SEMESTERS') {
$points_RET = DBGet(DBQuery("SELECT STUDENT_ID,MARKING_PERIOD_ID FROM STUDENT_REPORT_CARD_GRADES WHERE COURSE_PERIOD_ID='" . $course_period_id . "' AND MARKING_PERIOD_ID IN (" . GetAllMP('SEM', $_REQUEST['mp']) . ",'E" . GetParentMP('SEM', UserMP()) . "')"), array(), array('STUDENT_ID'));
}
if (GetMP($_REQUEST['mp'], 'TABLE') == 'SCHOOL_QUARTERS' || GetMP($_REQUEST['mp'], 'TABLE') == 'SCHOOL_PROGRESS_PERIODS') {
// the 'populate the form' approach does not require that we get precisely the right students because nothing is modified here
// so we don't need to filter on enrollment dates - in fact, for include_inactive we want 'em all anyway
if ($programconfig[User('STAFF_ID')]['WEIGHT'] == 'Y') {
$points_RET = DBGet(DBQuery("SELECT DISTINCT s.STUDENT_ID,gt.ASSIGNMENT_TYPE_ID, gt.ASSIGNMENT_TYPE_ID,sum(" . db_case(array('gg.POINTS', "'-1'", "'0'", 'gg.POINTS')) . ") AS PARTIAL_POINTS,sum(" . db_case(array('gg.POINTS', "'-1'", "'0'", 'ga.POINTS')) . ") AS PARTIAL_TOTAL, gt.FINAL_GRADE_PERCENT FROM STUDENTS s JOIN SCHEDULE ss ON (ss.STUDENT_ID=s.STUDENT_ID AND ss.COURSE_PERIOD_ID='{$course_period_id}') JOIN GRADEBOOK_ASSIGNMENTS ga ON ((ga.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID OR ga.COURSE_ID='{$course_id}' AND ga.STAFF_ID='" . User('STAFF_ID') . "') AND ga.MARKING_PERIOD_ID='" . UserMP() . "') LEFT OUTER JOIN GRADEBOOK_GRADES gg ON (gg.STUDENT_ID=s.STUDENT_ID AND gg.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND gg.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID),GRADEBOOK_ASSIGNMENT_TYPES gt WHERE gt.ASSIGNMENT_TYPE_ID=ga.ASSIGNMENT_TYPE_ID AND gt.COURSE_ID='{$course_id}' AND ((ga.ASSIGNED_DATE IS NULL OR CURRENT_DATE>=ga.ASSIGNED_DATE) AND (ga.DUE_DATE IS NULL OR CURRENT_DATE>=ga.DUE_DATE) OR gg.POINTS IS NOT NULL) GROUP BY s.STUDENT_ID,ss.START_DATE,gt.ASSIGNMENT_TYPE_ID,gt.FINAL_GRADE_PERCENT"), array(), array('STUDENT_ID'));
} else {
$points_RET = DBGet(DBQuery("SELECT DISTINCT s.STUDENT_ID,'-1' AS ASSIGNMENT_TYPE_ID,sum(" . db_case(array('gg.POINTS', "'-1'", "'0'", 'gg.POINTS')) . ") AS PARTIAL_POINTS,sum(" . db_case(array('gg.POINTS', "'-1'", "'0'", 'ga.POINTS')) . ") AS PARTIAL_TOTAL,'1' AS FINAL_GRADE_PERCENT FROM STUDENTS s JOIN SCHEDULE ss ON (ss.STUDENT_ID=s.STUDENT_ID AND ss.COURSE_PERIOD_ID='{$course_period_id}') JOIN GRADEBOOK_ASSIGNMENTS ga ON ((ga.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID OR ga.COURSE_ID='{$course_id}' AND ga.STAFF_ID='" . User('STAFF_ID') . "') AND ga.MARKING_PERIOD_ID='" . UserMP() . "') LEFT OUTER JOIN GRADEBOOK_GRADES gg ON (gg.STUDENT_ID=s.STUDENT_ID AND gg.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND gg.COURSE_PERIOD_ID=ss.COURSE_PERIOD_ID) WHERE ((ga.ASSIGNED_DATE IS NULL OR CURRENT_DATE>=ga.ASSIGNED_DATE) AND (ga.DUE_DATE IS NULL OR CURRENT_DATE>=ga.DUE_DATE) OR gg.POINTS IS NOT NULL) GROUP BY s.STUDENT_ID,ss.START_DATE, FINAL_GRADE_PERCENT"), array(), array('STUDENT_ID'));
}
if (count($points_RET)) {
foreach ($points_RET as $student_id => $student) {
$total = $total_percent = 0;
foreach ($student as $partial_points) {
if ($partial_points['PARTIAL_TOTAL'] != 0) {
$total += $partial_points['PARTIAL_POINTS'] * $partial_points['FINAL_GRADE_PERCENT'] / $partial_points['PARTIAL_TOTAL'];
$total_percent += $partial_points['FINAL_GRADE_PERCENT'];
}
}
if ($total_percent != 0) {
$total /= $total_percent;
}
$import_RET[$student_id] = array(1 => array('REPORT_CARD_GRADE_ID' => _makeLetterGrade($total, $course_period_id, 0, 'ID'), 'GRADE_PERCENT' => round(100 * $total, 1)));
}
示例14: GetStuList
$referrals_RET = GetStuList($extra);
$chart['chart_data'][0][0] = '';
$chart['chart_data'][1][0] = 'Series';
foreach ($referrals_RET as $referral) {
$referral['TITLE'] = explode("||", trim($referral['TITLE'], '|'));
foreach ($referral['TITLE'] as $option) {
$options_count[$option]++;
}
}
foreach ($category_RET[1]['OPTIONS'] as $option) {
$chart['chart_data'][0][] = $option;
$chart['chart_data'][1][] = $options_count[$option];
}
} elseif ($category_RET[1]['TYPE'] == 'radio') {
$extra = array();
$extra['SELECT_ONLY'] = db_case(array("s.CUSTOM_" . $_REQUEST['category_id'], "'Y'", "'" . _('Yes') . "'", "'" . _('No') . "'")) . " AS TITLE,COUNT(*) AS COUNT ";
$extra['FROM'] = ',DISCIPLINE_REFERRALS dr ';
$extra['WHERE'] = "AND dr.STUDENT_ID=ssm.STUDENT_ID AND dr.SCHOOL_ID=ssm.SCHOOL_ID AND dr.ENTRY_DATE BETWEEN '{$start_date}' AND '{$end_date}' ";
$extra['GROUP'] = 'CUSTOM_' . $_REQUEST['category_id'];
$extra['group'] = array('TITLE');
$extra['DEBUG'] = true;
Widgets('all');
$totals_RET = GetStuList($extra);
// $sql = "SELECT dr.CATEGORY_".$_REQUEST['category_id']." AS TITLE,COUNT(*) AS COUNT FROM DISCIPLINE_REFERRALS dr,STUDENTS s,STUDENT_ENROLLMENT ssm WHERE ssm.STUDENT_ID=s.STUDENT_ID AND dr.ENTRY_DATE BETWEEN '$start_date' AND '$end_date' AND dr.SCHOOL_ID=ssm.SCHOOL_ID AND dr.SCHOOL_ID='".UserSchool()."' ";
// $sql = appendSQL($sql);
// $sql .= " GROUP BY CATEGORY_".$_REQUEST['category_id'];
//$totals_RET = DBGet(DBQuery($sql),array(),array('TITLE'));
$chart['chart_data'][0][0] = '';
$chart['chart_data'][1][0] = 'Series';
$chart['chart_data'][0][0] = _('Yes');
$chart['chart_data'][1][0] = $totals_RET['Yes'][1]['COUNT'];
示例15: DBGet
$assignments_RET = DBGet(DBQuery("SELECT ga.ASSIGNMENT_ID,gg.POINTS,ga.ASSIGNED_DATE,ga.DUE_DATE,gg.COMMENT,ga.TITLE,ga.DESCRIPTION,ga.ASSIGNED_DATE,ga.DUE_DATE,ga.POINTS AS POINTS_POSSIBLE,at.TITLE AS CATEGORY\r\n FROM GRADEBOOK_ASSIGNMENTS ga LEFT OUTER JOIN GRADEBOOK_GRADES gg\r\n ON (gg.COURSE_PERIOD_ID='{$course['COURSE_PERIOD_ID']}' AND gg.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND gg.STUDENT_ID='" . UserStudentID() . "'),GRADEBOOK_ASSIGNMENT_TYPES at\r\n WHERE (ga.COURSE_PERIOD_ID='{$course['COURSE_PERIOD_ID']}' OR ga.COURSE_ID='{$course['COURSE_ID']}' AND ga.STAFF_ID='{$staff_id}') AND ga.MARKING_PERIOD_ID='" . UserMP() . "'\r\n AND at.ASSIGNMENT_TYPE_ID=ga.ASSIGNMENT_TYPE_ID AND ((ga.ASSIGNED_DATE IS NOT NULL )\r\n or gg.POINTS IS NOT NULL) AND (ga.POINTS!='0' OR gg.POINTS IS NOT NULL AND gg.POINTS!='-1') ORDER BY ga.ASSIGNMENT_ID DESC"), array('TITLE' => '_makeTipTitle'));
/*$assignments_RET = DBGet(DBQuery("SELECT ga.ASSIGNMENT_ID,gg.POINTS,gg.COMMENT,ga.TITLE,ga.DESCRIPTION,ga.ASSIGNED_DATE,ga.DUE_DATE,ga.POINTS AS POINTS_POSSIBLE,at.TITLE AS CATEGORY
FROM GRADEBOOK_ASSIGNMENTS ga LEFT OUTER JOIN GRADEBOOK_GRADES gg
ON (gg.COURSE_PERIOD_ID='$course[COURSE_PERIOD_ID]' AND gg.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND gg.STUDENT_ID='".UserStudentID()."'),GRADEBOOK_ASSIGNMENT_TYPES at
WHERE (ga.COURSE_PERIOD_ID='$course[COURSE_PERIOD_ID]' OR ga.COURSE_ID='$course[COURSE_ID]' AND ga.STAFF_ID='$staff_id') AND ga.MARKING_PERIOD_ID='".UserMP()."'
AND at.ASSIGNMENT_TYPE_ID=ga.ASSIGNMENT_TYPE_ID AND ((ga.ASSIGNED_DATE IS NULL OR CURRENT_DATE>=ga.ASSIGNED_DATE) AND (ga.DUE_DATE IS NULL OR CURRENT_DATE>=ga.DUE_DATE+".round($programconfig[$staff_id]['LATENCY']).")
OR gg.POINTS IS NOT NULL) AND (ga.POINTS!='0' OR gg.POINTS IS NOT NULL AND gg.POINTS!='-1') ORDER BY ga.ASSIGNMENT_ID DESC"),array('TITLE'=>'_makeTipTitle'));
*/
//echo '<pre>'; var_dump($assignments_RET); echo '</pre>';
if (count($assignments_RET)) {
if ($_REQUEST['id'] == 'all') {
# echo '<BR>';
DrawHeader('<br><B>' . $course['COURSE_TITLE'] . '</B> - ' . substr($course['TITLE'], strrpos(str_replace(' - ', ' ^ ', $course['TITLE']), '^') + 2), "<A HREF=Modules.php?modname={$_REQUEST['modname']}>Back to Totals</A>");
}
if ($do_stats) {
$all_RET = DBGet(DBQuery("SELECT ga.ASSIGNMENT_ID,gg.POINTS,min(" . db_case(array('gg.POINTS', "'-1'", 'ga.POINTS', 'gg.POINTS')) . ") AS MIN,max(" . db_case(array('gg.POINTS', "'-1'", '0', 'gg.POINTS')) . ") AS MAX," . db_case(array("sum(" . db_case(array('gg.POINTS', "'-1'", '0', '1')) . ")", "'0'", "'0'", "sum(" . db_case(array('gg.POINTS', "'-1'", '0', 'gg.POINTS')) . ") / sum(" . db_case(array('gg.POINTS', "'-1'", '0', '1')) . ")")) . " AS AVG,sum(CASE WHEN gg.POINTS<=g.POINTS AND gg.STUDENT_ID!=g.STUDENT_ID THEN 1 ELSE 0 END) AS LOWER,sum(CASE WHEN gg.POINTS>g.POINTS THEN 1 ELSE 0 END) AS HIGHER FROM GRADEBOOK_GRADES gg,GRADEBOOK_ASSIGNMENTS ga LEFT OUTER JOIN GRADEBOOK_GRADES g ON (g.COURSE_PERIOD_ID='{$course['COURSE_PERIOD_ID']}' AND g.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND g.STUDENT_ID='" . UserStudentID() . "'),GRADEBOOK_ASSIGNMENT_TYPES at WHERE (ga.COURSE_PERIOD_ID='{$course['COURSE_PERIOD_ID']}' OR ga.COURSE_ID='{$course['COURSE_ID']}' AND ga.STAFF_ID='{$staff_id}') AND ga.MARKING_PERIOD_ID='" . UserMP() . "' AND gg.ASSIGNMENT_ID=ga.ASSIGNMENT_ID AND at.ASSIGNMENT_TYPE_ID=ga.ASSIGNMENT_TYPE_ID AND ((ga.ASSIGNED_DATE IS NOT NULL ) OR g.POINTS IS NOT NULL) AND ga.POINTS!='0' GROUP BY ga.ASSIGNMENT_ID"), array(), array('ASSIGNMENT_ID'));
}
//echo '<pre>'; var_dump($all_RET); echo '</pre>';
$LO_columns = array('TITLE' => 'Title', 'CATEGORY' => 'Category', 'POINTS' => 'Points / Possible', 'PERCENT' => 'Percent', 'LETTER' => 'Letter', 'ASSIGNED_DATE' => 'Assigned Date', 'DUE_DATE' => 'Due Date') + ($do_stats ? array('BAR1' => 'Grade Range', 'BAR2' => 'Class Rank') : array());
$LO_ret = array(0 => array());
foreach ($assignments_RET as $assignment) {
if ($do_stats) {
unset($bargraph1);
unset($bargraph2);
if ($all_RET[$assignment['ASSIGNMENT_ID']]) {
$all = $all_RET[$assignment['ASSIGNMENT_ID']][1];
$all_RET1 = DBGet(DBQuery("SELECT g.ASSIGNMENT_ID,g.POINTS FROM GRADEBOOK_GRADES g where g.COURSE_PERIOD_ID='" . $course[COURSE_PERIOD_ID] . "' "));
$count_tot = 0;
foreach ($all_RET1 as $all1) {
if ($assignment['ASSIGNMENT_ID'] == $all1['ASSIGNMENT_ID']) {
$assg_tot[] = $all1['POINTS'];