本文整理汇总了PHP中VerifyDate函数的典型用法代码示例。如果您正苦于以下问题:PHP VerifyDate函数的具体用法?PHP VerifyDate怎么用?PHP VerifyDate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VerifyDate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Widgets
//.........这里部分代码省略.........
$extra['SELECT'] .= ',coalesce(sam.ADDRESS_ID,-ssm.STUDENT_ID) AS ADDRESS_ID,sam.ADDRESS_ID AS MAILING_LABEL';
$extra['FROM'] = " LEFT OUTER JOIN STUDENTS_JOIN_ADDRESS sam ON (sam.STUDENT_ID=ssm.STUDENT_ID AND sam.MAILING='Y'" . ($_REQUEST['residence'] == 'Y' ? " AND sam.RESIDENCE='Y'" : '') . ")" . $extra['FROM'];
$extra['functions'] += array('MAILING_LABEL' => 'MailingLabel');
}
$extra['search'] .= '<TR><TD align=right width=120>' . _('Mailing Labels') . '</TD><TD><INPUT type=checkbox name=mailing_labels value=Y></TD>';
break;
case 'balance':
if ($CentreModules['Student_Billing']) {
if (is_numeric($_REQUEST['balance_low']) && is_numeric($_REQUEST['balance_high'])) {
if ($_REQUEST['balance_low'] > $_REQUEST['balance_high']) {
$temp = $_REQUEST['balance_high'];
$_REQUEST['balance_high'] = $_REQUEST['balance_low'];
$_REQUEST['balance_low'] = $temp;
}
$extra['WHERE'] .= " AND (coalesce((SELECT sum(f.AMOUNT) FROM BILLING_FEES f,STUDENTS_JOIN_FEES sjf WHERE sjf.FEE_ID=f.ID AND sjf.STUDENT_ID=ssm.STUDENT_ID AND f.SYEAR=ssm.SYEAR),0)+(SELECT coalesce(sum(f.AMOUNT),0)-coalesce(sum(f.CASH),0) FROM LUNCH_TRANSACTIONS f WHERE f.STUDENT_ID=ssm.STUDENT_ID AND f.SYEAR=ssm.SYEAR)-coalesce((SELECT sum(p.AMOUNT) FROM BILLING_PAYMENTS p WHERE p.STUDENT_ID=ssm.STUDENT_ID AND p.SYEAR=ssm.SYEAR),0)) BETWEEN '{$_REQUEST['balance_low']}' AND '{$_REQUEST['balance_high']}' ";
if (!$extra['NoSearchTerms']) {
$_CENTRE['SearchTerms'] .= '<font color=gray><b>' . Localize('colon', _('Student Billing Balance')) . ' </b></font>' . _('Between') . ' ' . $_REQUEST['balance_low'] . ' & ' . $_REQUEST['balance_high'] . '<BR>';
}
}
$extra['search'] .= "<TR><TD align=right width=120>" . _('Balance') . "<BR></TD><TD><small>" . _('Between') . "</small> <INPUT type=text name=balance_low size=5 maxlength=10> <small>&</small> <INPUT type=text name=balance_high size=5 maxlength=10></TD></TR>";
}
break;
case 'discipline':
if ($CentreModules['Discipline']) {
if (is_array($_REQUEST['discipline'])) {
foreach ($_REQUEST['discipline'] as $key => $value) {
if (!$value) {
unset($_REQUEST['discipline'][$key]);
}
}
}
if ($_REQUEST['month_discipline_entry_begin'] && $_REQUEST['day_discipline_entry_begin'] && $_REQUEST['year_discipline_entry_begin']) {
$_REQUEST['discipline_entry_begin'] = $_REQUEST['day_discipline_entry_begin'] . '-' . $_REQUEST['month_discipline_entry_begin'] . '-' . $_REQUEST['year_discipline_entry_begin'];
if (!VerifyDate($_REQUEST['discipline_entry_begin'])) {
unset($_REQUEST['discipline_entry_begin']);
}
unset($_REQUEST['day_discipline_entry_begin']);
unset($_REQUEST['month_discipline_entry_begin']);
unset($_REQUEST['year_discipline_entry_begin']);
}
if ($_REQUEST['month_discipline_entry_end'] && $_REQUEST['day_discipline_entry_end'] && $_REQUEST['year_discipline_entry_end']) {
$_REQUEST['discipline_entry_end'] = $_REQUEST['day_discipline_entry_end'] . '-' . $_REQUEST['month_discipline_entry_end'] . '-' . $_REQUEST['year_discipline_entry_end'];
if (!VerifyDate($_REQUEST['discipline_entry_end'])) {
unset($_REQUEST['discipline_entry_end']);
}
unset($_REQUEST['day_discipline_entry_end']);
unset($_REQUEST['month_discipline_entry_end']);
unset($_REQUEST['year_discipline_entry_end']);
}
if ($_REQUEST['discipline_reporter'] || $_REQUEST['discipline_entry_begin'] || $_REQUEST['discipline_entry_end'] || count($_REQUEST['discipline']) || count($_REQUEST['discipline_begin']) || count($_REQUEST['discipline_end'])) {
$extra['WHERE'] .= ' AND dr.STUDENT_ID=ssm.STUDENT_ID AND dr.SYEAR=ssm.SYEAR AND dr.SCHOOL_ID=ssm.SCHOOL_ID ';
$extra['FROM'] .= ',DISCIPLINE_REFERRALS dr ';
}
$users_RET = DBGet(DBQuery("SELECT STAFF_ID,FIRST_NAME,LAST_NAME,MIDDLE_NAME FROM STAFF WHERE SYEAR='" . UserSyear() . "' AND (SCHOOLS IS NULL OR SCHOOLS LIKE '%," . UserSchool() . ",%') AND (PROFILE='admin' OR PROFILE='teacher') ORDER BY LAST_NAME,FIRST_NAME,MIDDLE_NAME"), array(), array('STAFF_ID'));
if ($_REQUEST['discipline_reporter']) {
$extra['WHERE'] .= " AND dr.STAFF_ID='{$_REQUEST['discipline_reporter']}' ";
if (!$extra['NoSearchTerms']) {
$_CENTRE['SearchTerms'] .= '<font color=gray><b>Reporter: </b></font>' . $users_RET[$_REQUEST['discipline_reporter']][1]['LAST_NAME'] . ', ' . $users_RET[$_REQUEST['discipline_reporter']][1]['FIRST_NAME'] . ' ' . $users_RET[$_REQUEST['discipline_reporter']][1]['MIDDLE_NAME'] . '<BR>';
}
}
$extra['search'] .= '<TR><TD align=right width=120>Reporter</TD><TD>';
$extra['search'] .= '<SELECT name=discipline_reporter><OPTION value="">' . _('Not Specified') . '</OPTION>';
foreach ($users_RET as $id => $user) {
$extra['search'] .= '<OPTION value=' . $id . '>' . $user[1]['LAST_NAME'] . ', ' . $user[1]['FIRST_NAME'] . ' ' . $user[1]['MIDDLE_NAME'] . '</OPTION>';
}
$extra['search'] .= '</SELECT>';
示例2: unset
# 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 '../../RedirectModulesInc.php';
if (!$_REQUEST['modfunc'] && $_REQUEST['search_modfunc'] != 'list') {
unset($_SESSION['MassDrops.php']);
}
if (clean_param($_REQUEST['modfunc'], PARAM_ALPHA) == 'save') {
$END_DATE = $_REQUEST['day'] . '-' . $_REQUEST['month'] . '-' . $_REQUEST['year'];
$end_date_mod = date('Y-m-d', strtotime($END_DATE));
if (!VerifyDate($END_DATE)) {
DrawHeader('<table><tr><td><IMG SRC=assets/x.gif></td><td>The date you entered is not valid</td></tr></table>');
for_error_sch();
} else {
$mp_table = GetMPTable(GetMP($_REQUEST['marking_period_id'], 'TABLE'));
$current_RET = DBGet(DBQuery('SELECT STUDENT_ID FROM schedule WHERE COURSE_PERIOD_ID=\'' . $_SESSION['MassDrops.php']['course_period_id'] . '\''));
if (count($_REQUEST['student']) > 0) {
foreach ($_REQUEST['student'] as $student_id => $yes) {
$start_end_RET = DBGet(DBQuery('SELECT START_DATE,END_DATE,SCHEDULER_LOCK FROM schedule WHERE STUDENT_ID=\'' . $student_id . '\' AND COURSE_PERIOD_ID=\'' . $_SESSION['MassDrops.php']['course_period_id'] . '\''));
if (count($start_end_RET)) {
if ($start_end_RET[1]['SCHEDULER_LOCK'] == 'Y' || $start_end_RET[1]['START_DATE'] > $end_date_mod) {
$select_stu = DBGet(DBQuery('SELECT FIRST_NAME,LAST_NAME FROM students WHERE STUDENT_ID=\'' . $student_id . '\''));
$select_stu = $select_stu[1]['FIRST_NAME'] . " " . $select_stu[1]['LAST_NAME'];
if ($start_end_RET[1]['SCHEDULER_LOCK'] == 'Y') {
$inactive_schedule2 .= $select_stu . "<br>";
$inactive_schedule_found = 2;
示例3: date
if ($_REQUEST['day_values']['START_DATE'][$school_id]) {
$start_date = $_REQUEST['day_values']['START_DATE'][$school_id] . "-" . $_REQUEST['month_values']['START_DATE'][$school_id] . "-" . $_REQUEST['year_values']['START_DATE'][$school_id];
} else {
$start_date = '';
}
if ($_REQUEST['day_values']['END_DATE'][$school_id]) {
$end_date = $_REQUEST['day_values']['END_DATE'][$school_id] . "-" . $_REQUEST['month_values']['END_DATE'][$school_id] . "-" . $_REQUEST['year_values']['END_DATE'][$school_id];
} else {
$end_date = '';
}
if ($end_date != '') {
$end_date = date('Y-m-d', strtotime($end_date));
} else {
$end_date = '0000-00-00';
}
if ($start_date != '' && VerifyDate($start_date) || $end_date != '' && VerifyDate($end_date) || $start_date == '' && $end_date == '') {
$day_valid = true;
$user_syear_RET = DBGet(DBQuery('SELECT MAX(syear) AS USERSYEAR FROM school_years WHERE school_id=\'' . $school_id . '\''));
$usersyear = $user_syear_RET[1]['USERSYEAR'];
$rel_value .= "({$staff_id},{$school_id},{$usersyear},'" . date('Y-m-d', strtotime($start_date)) . "','" . $end_date . "'),";
} else {
$day_valid = true;
$user_syear_RET = DBGet(DBQuery('SELECT MAX(syear) AS USERSYEAR FROM school_years WHERE school_id=\'' . $school_id . '\''));
$usersyear = $user_syear_RET[1]['USERSYEAR'];
$rel_value .= "({$staff_id},{$school_id},{$usersyear},'0000-00-00','" . $end_date . "'),";
}
}
$rel_value = substr($rel_value, 0, -1);
DBQuery("INSERT INTO staff_school_relationship(staff_id,school_id,syear,start_date,end_date)VALUES ({$rel_value})");
$_SESSION['staff_id'] = $_REQUEST['staff_id'] = $staff_id;
} else {
示例4: SaveData
function SaveData($iu_extra, $fields_done = false, $field_names = false)
{
if (!$fields_done) {
$fields_done = array();
}
if (!$field_names) {
$field_names = array();
}
if ($_REQUEST['month_values']) {
foreach ($_REQUEST['month_values'] as $table => $values) {
foreach ($values as $id => $columns) {
foreach ($columns as $column => $value) {
$_REQUEST['values'][$table][$id][$column] = $_REQUEST['day_values'][$table][$id][$column] . '-' . $value . '-' . $_REQUEST['year_values'][$table][$id][$column];
if ($_REQUEST['values'][$table][$id][$column] == '--') {
$_REQUEST['values'][$table][$id][$column] = '';
}
}
}
}
}
foreach ($_REQUEST['values'] as $table => $values) {
$table_properties = db_properties($table);
foreach ($values as $id => $columns) {
foreach ($columns as $column => $value) {
if ($field_names[$table][$column]) {
$name = 'The value for ' . $field_names[$table][$column];
} else {
$name = 'The value for ' . ucwords(strtolower(str_replace('_', ' ', $column)));
}
// COLUMN DOESN'T EXIST
if (!$table_properties[$column]) {
$error[] = 'There is no column for ' . $name . '. This value was not saved.';
continue;
}
// VALUE IS TOO LONG
if ($table_properties[$column]['TYPE'] == 'VARCHAR' && strlen($value) > $table_properties[$column]['SIZE']) {
$value = substr($value, 0, $table_properties[$column]['SIZE']);
$error[] = $name . ' was too long. It was truncated to fit in the field.';
}
// FIELD IS NUMERIC, VALUE CONTAINS NON-NUMERICAL CHARACTERS
if ($table_properties[$column]['TYPE'] == 'NUMERIC' && ereg('[^0-9-]', $value)) {
$value = ereg_replace('[^0-9]', '', $value);
$error[] = $name . ', a numerical field, contained non-numerical characters. These characaters were removed.';
}
// FIELD IS DATE, DATE IS WRONG
if ($table_properties[$column]['TYPE'] == 'DATE' && $value && !VerifyDate($value)) {
$error[] = $name . ', a date field, was not a valid date. This value could not be saved.';
continue;
}
if ($table_properties[$column]['TYPE'] == 'DATE' && $value) {
$value = date('Y-m-d', strtotime($value));
}
if ($id == 'new') {
if ($value) {
$ins_fields[$table] .= $column . ',';
$ins_values[$table] .= "'" . str_replace("\\'", "''", $value) . "',";
$go = true;
}
} else {
if (strlen($value) > 0) {
$sql[$table] .= "{$column}='" . str_replace("\\'", "''", str_replace(''', "''", $value)) . "',";
} else {
$sql[$table] .= "{$column}=NULL,";
}
}
}
if ($id == 'new') {
$sql[$table] = 'INSERT INTO ' . $table . ' (' . $iu_extra['fields'][$table] . substr($ins_fields[$table], 0, -1) . ') values(' . $iu_extra['values'][$table] . substr($ins_values[$table], 0, -1) . ')';
} else {
$sql[$table] = 'UPDATE ' . $table . ' SET ' . substr($sql[$table], 0, -1) . ' WHERE ' . str_replace('__ID__', $id, $iu_extra[$table]);
}
echo ErrorMessage($error);
if ($id != 'new' || $go == true) {
DBQuery($sql[$table]);
}
$error = $ins_fields = $ins_values = $sql = $go = '';
}
}
}
示例5: foreach
if (count($grades_RET)) {
foreach ($grades_RET as $value) {
$options[$value['ID']] = $value['TITLE'];
}
}
if ($_REQUEST['student_id'] != 'new' && $student['SCHOOL_ID'] != UserSchool()) {
$allow_edit = $_openSIS['allow_edit'];
$AllowEdit = $_openSIS['AllowEdit'][$_REQUEST['modname']];
$_openSIS['AllowEdit'][$_REQUEST['modname']] = $_openSIS['allow_edit'] = false;
}
if ($_REQUEST['student_id'] == 'new') {
$student_id = 'new';
} else {
$student_id = UserStudentID();
}
if ($student_id == 'new' && !VerifyDate($_REQUEST['day_values']['student_enrollment']['new']['START_DATE'] . '-' . $_REQUEST['month_values']['student_enrollment']['new']['START_DATE'] . '-' . $_REQUEST['year_values']['student_enrollment']['new']['START_DATE'])) {
unset($student['GRADE_ID']);
}
echo SelectInput($student['GRADE_ID'], 'values[student_enrollment][' . $student_id . '][GRADE_ID]', (!$student['GRADE_ID'] ? '<FONT color=red>' : '') . '' . (!$student['GRADE_ID'] ? '</FONT>' : ''), $options, '', '');
echo '</td></tr>';
echo '</table>';
echo '</td></TR>';
echo '<TR><td height="30px" colspan=2 class=hseparator><b>Access Information</b></td></tr><tr><td colspan="2">';
echo '<TABLE border=0>';
echo '<tr><td style=width:120px>Username</td><td>:</td><td>';
echo TextInput($student['USERNAME'], 'students[USERNAME]', '', 'class=cell_medium onkeyup="usercheck_init_student(this)"');
echo '<span id="ajax_output_st"></span>';
echo '</td></tr>';
echo '<tr><td>Password</td><td>:</td><td>';
echo TextInput(array($student['PASSWORD'], str_repeat('*', strlen($student['PASSWORD']))), 'students[PASSWORD]', '', 'class=cell_medium onkeyup=passwordStrength(this.value)', 'AUTOCOMPLETE = off');
echo '<div id="passwordStrength" style=display:none></div>';
示例6: SaveData
function SaveData($iu_extra, $fields_done = false, $field_names = false)
{
if (!$fields_done) {
$fields_done = array();
}
if (!$field_names) {
$field_names = array();
}
if ($_REQUEST['month_values']) {
foreach ($_REQUEST['month_values'] as $table => $values) {
foreach ($values as $id => $columns) {
foreach ($columns as $column => $value) {
if ($value == 'JAN') {
$value = '01';
}
if ($value == 'FEB') {
$value = '02';
}
if ($value == 'MAR') {
$value = '03';
}
if ($value == 'APR') {
$value = '04';
}
if ($value == 'MAY') {
$value = '05';
}
if ($value == 'JUN') {
$value = '06';
}
if ($value == 'JUL') {
$value = '07';
}
if ($value == 'AUG') {
$value = '08';
}
if ($value == 'SEP') {
$value = '09';
}
if ($value == 'OCT') {
$value = '10';
}
if ($value == 'NOV') {
$value = '11';
}
if ($value == 'DEC') {
$value = '12';
}
$_REQUEST['values'][$table][$id][$column] = $_REQUEST['year_values'][$table][$id][$column] . '-' . $value . '-' . $_REQUEST['day_values'][$table][$id][$column];
if ($_REQUEST['values'][$table][$id][$column] == '--') {
$_REQUEST['values'][$table][$id][$column] = '';
}
}
}
}
}
foreach ($_REQUEST['values'] as $table => $values) {
$table_properties = db_properties($table);
foreach ($values as $id => $columns) {
foreach ($columns as $column => $value) {
if ($table == 'student_enrollment') {
if ($column == 'START_DATE') {
$s_date = '1-' . $_REQUEST['month_values'][$table][$id][$column] . '-' . $_REQUEST['year_values'][$table][$id][$column];
$num_days = date('t', strtotime($s_date));
if ($num_days < $_REQUEST['day_values'][$table][$id][$column]) {
$error[] = '<font color=red>' . date('F', strtotime($s_date)) . ' has ' . $num_days . ' days</font>';
continue;
}
}
}
if ($field_names[$table][$column]) {
$name = 'The value for ' . $field_names[$table][$column];
} else {
$name = 'The value for ' . ucwords(strtolower(str_replace('_', ' ', $column)));
}
// COLUMN DOESN'T EXIST
if (!$table_properties[$column]) {
$error[] = 'There is no column for ' . $name . '. This value was not saved.';
continue;
}
// VALUE IS TOO LONG
if ($table_properties[$column]['TYPE'] == 'VARCHAR' && strlen($value) > $table_properties[$column]['SIZE']) {
$value = substr($value, 0, $table_properties[$column]['SIZE']);
$error[] = $name . ' was too long. It was truncated to fit in the field.';
}
// FIELD IS NUMERIC, VALUE CONTAINS NON-NUMERICAL CHARACTERS
if ($table_properties[$column]['TYPE'] == 'NUMERIC' && ereg('[^0-9-]', $value)) {
$value = ereg_replace('[^0-9]', '', $value);
$error[] = $name . ', a numerical field, contained non-numerical characters. These characaters were removed.';
}
// FIELD IS DATE, DATE IS WRONG
if ($table_properties[$column]['TYPE'] == 'DATE' && $value && !VerifyDate($value)) {
$error[] = $name . ', a date field, was not a valid date. This value could not be saved.';
continue;
}
if ($table_properties[$column]['TYPE'] == 'DATE' && $value) {
$value = date('Y-m-d', strtotime($value));
}
if ($id == 'new') {
if (trim($value)) {
//.........这里部分代码省略.........
示例7: foreach
<?php
if ($_REQUEST['modfunc'] == 'save') {
$date = $_REQUEST['day'] . '-' . $_REQUEST['month'] . '-' . $_REQUEST['year'];
if (count($_REQUEST['month_values'])) {
foreach ($_REQUEST['month_values'] as $field_name => $month) {
$_REQUEST['values'][$field_name] = $_REQUEST['day_values'][$field_name] . '-' . $month . '-' . $_REQUEST['year_values'][$field_name];
if (!VerifyDate($_REQUEST['values'][$field_name])) {
if ($_REQUEST['values'][$field_name] != '--') {
$note = '<IMG SRC=assets/warning_button.gif>' . _('The date you specified is not valid, so was not used. The other data was saved.');
}
unset($_REQUEST['values'][$field_name]);
}
}
}
if (count($_REQUEST['values']) && count($_REQUEST['student'])) {
if ($_REQUEST['values']['NEXT_SCHOOL'] != '') {
$next_school = $_REQUEST['values']['NEXT_SCHOOL'];
unset($_REQUEST['values']['NEXT_SCHOOL']);
}
if ($_REQUEST['values']['CALENDAR_ID']) {
$calendar = $_REQUEST['values']['CALENDAR_ID'];
unset($_REQUEST['values']['CALENDAR_ID']);
}
foreach ($_REQUEST['values'] as $field => $value) {
if (isset($value) && $value != '') {
$update .= ',' . $field . "='{$value}'";
$values_count++;
}
}
foreach ($_REQUEST['student'] as $student_id => $yes) {
示例8: DBGet
$id = DBGet(DBQuery("SHOW TABLE STATUS LIKE 'student_enrollment'"));
$studentemrollment_id[1]['STUDENTENROLL_ID'] = $id[1]['AUTO_INCREMENT'];
$studentemrollment_id = $studentemrollment_id[1]['STUDENTENROLL_ID'];
$sql = "INSERT INTO student_enrollment ";
$fields = 'STUDENT_ID,SYEAR,SCHOOL_ID,';
$values = "'{$student_id}','" . UserSyear() . "','" . UserSchool() . "',";
if ($_REQUEST['day_values']) {
$_REQUEST['values']['student_enrollment']['new']['START_DATE'] = $_REQUEST['day_values']['student_enrollment']['new']['START_DATE'] . '-' . $_REQUEST['month_values']['student_enrollment']['new']['START_DATE'] . '-' . $_REQUEST['year_values']['student_enrollment']['new']['START_DATE'];
} else {
$_REQUEST['values']['student_enrollment']['new']['START_DATE'] = '';
}
foreach ($_REQUEST['values']['student_enrollment']['new'] as $column => $value) {
if ($value) {
$value = paramlib_validation($column, $value);
if ($column == 'START_DATE' || $column == 'END_DATE') {
if (VerifyDate($value)) {
$values .= "'" . date('Y-m-d', strtotime($value)) . "',";
} else {
$err = "Invalid Enrollment date could not be saved";
continue;
}
} else {
$values .= "'" . str_replace("\\'", "''", str_replace(''', "''", $value)) . "',";
}
$fields .= $column . ',';
}
}
$sql .= '(' . substr($fields, 0, -1) . ') values(' . substr($values, 0, -1) . ')';
if (!$error) {
if ($un_chl_res != 'exist' && $pass_chl_res != 'exist' && $day_valid != false) {
DBQuery($sql);
示例9: _
$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>';
Widgets('all');
$extra['force_search'] = true;
if (!$_REQUEST['search_modfunc'] || $_REQUEST['search_modfunc'] == 'search' || $_FOCUS['modules_search']) {
DrawHeader(ProgramTitle());
Search('student_id', $extra);
} else {
if ($_REQUEST['month_discipline_entry_begin'] && $_REQUEST['day_discipline_entry_begin'] && $_REQUEST['year_discipline_entry_begin']) {
$start_date = $_REQUEST['day_discipline_entry_begin'] . '-' . $_REQUEST['month_discipline_entry_begin'] . '-' . $_REQUEST['year_discipline_entry_begin'];
if (!VerifyDate($start_date)) {
unset($start_date);
}
$end_date = $_REQUEST['day_discipline_entry_end'] . '-' . $_REQUEST['month_discipline_entry_end'] . '-' . $_REQUEST['year_discipline_entry_end'];
if (!VerifyDate($end_date)) {
unset($end_date);
}
}
if (!$_REQUEST['_FOCUS_PDF']) {
DrawHeader(ProgramTitle());
echo '<BR><BR>';
}
foreach ($_REQUEST['elements'] as $column => $Y) {
$extra['SELECT'] .= ',r.' . $column;
}
$extra['FROM'] .= ',DISCIPLINE_REFERRALS r ';
$extra['WHERE'] .= " AND r.STUDENT_ID=ssm.STUDENT_ID AND r.SYEAR=ssm.SYEAR ";
if (strpos($extra['FROM'], 'DISCIPLINE_REFERRALS dr') !== false) {
$extra['WHERE'] .= ' AND r.ID=dr.ID';
}
示例10: foreach
<?php
include 'modules/Students/config.inc.php';
if ($_REQUEST['values'] && $_POST['values']) {
if (count($_REQUEST['month_values'])) {
foreach ($_REQUEST['month_values'] as $table => $month_values) {
foreach ($month_values as $column => $value) {
$_REQUEST['values'][$table][$column] = $_REQUEST['day_values'][$table][$column] . '-' . $_REQUEST['month_values'][$table][$column] . '-' . $_REQUEST['year_values'][$table][$column];
if ($_REQUEST['values'][$table][$column] == '--') {
$_REQUEST['values'][$table][$column] = '';
} elseif (!VerifyDate($_REQUEST['values'][$table][$column])) {
unset($_REQUEST['values'][$table][$column]);
$note = _('This date is invalid and could not be saved.');
}
}
}
}
unset($_REQUEST['day_values']);
unset($_REQUEST['month_values']);
unset($_REQUEST['year_values']);
if ($_REQUEST['values']['EXISTING']) {
if ($_REQUEST['values']['EXISTING']['address_id'] && $_REQUEST['address_id'] == 'old') {
$_REQUEST['address_id'] = $_REQUEST['values']['EXISTING']['address_id'];
if (count(DBGet(DBQuery("SELECT '' FROM STUDENTS_JOIN_ADDRESS WHERE ADDRESS_ID='{$_REQUEST['address_id']}' AND STUDENT_ID='" . UserStudentID() . "'"))) == 0) {
DBQuery("INSERT INTO STUDENTS_JOIN_ADDRESS (ID,STUDENT_ID,ADDRESS_ID) values(" . db_seq_nextval('STUDENTS_JOIN_ADDRESS_SEQ') . ",'" . UserStudentID() . "','{$_REQUEST['address_id']}')");
DBQuery("INSERT INTO STUDENTS_JOIN_PEOPLE (ID,STUDENT_ID,PERSON_ID,ADDRESS_ID,CUSTODY,EMERGENCY,STUDENT_RELATION) SELECT DISTINCT ON (PERSON_ID) " . db_seq_nextval('STUDENTS_JOIN_PEOPLE_SEQ') . ",'" . UserStudentID() . "',PERSON_ID,ADDRESS_ID,CUSTODY,EMERGENCY,STUDENT_RELATION FROM STUDENTS_JOIN_PEOPLE WHERE ADDRESS_ID='{$_REQUEST['address_id']}'");
}
} elseif ($_REQUEST['values']['EXISTING']['person_id'] && $_REQUEST['person_id'] == 'old') {
$_REQUEST['person_id'] = $_REQUEST['values']['EXISTING']['person_id'];
if (count(DBGet(DBQuery("SELECT '' FROM STUDENTS_JOIN_PEOPLE WHERE PERSON_ID='{$_REQUEST['person_id']}' AND STUDENT_ID='" . UserStudentID() . "'"))) == 0) {
DBQuery("INSERT INTO STUDENTS_JOIN_PEOPLE (ID,STUDENT_ID,PERSON_ID,ADDRESS_ID,CUSTODY,EMERGENCY,STUDENT_RELATION) SELECT DISTINCT ON (PERSON_ID) " . db_seq_nextval('STUDENTS_JOIN_PEOPLE_SEQ') . ",'" . UserStudentID() . "',PERSON_ID,'{$_REQUEST['address_id']}',CUSTODY,EMERGENCY,STUDENT_RELATION FROM STUDENTS_JOIN_PEOPLE WHERE PERSON_ID='{$_REQUEST['person_id']}'");
示例11: foreach
$values .= "'{$_REQUEST['year_id']}',";
break;
case 'QTR':
$fields .= "PARENT_ID,";
$values .= "'{$_REQUEST['semester_id']}',";
break;
case 'PRO':
$fields .= "PARENT_ID,";
$values .= "'{$_REQUEST['quarter_id']}',";
break;
}
$go = false;
foreach ($columns as $column => $value) {
if ($column == 'START_DATE' || $column == 'END_DATE' || $column == 'POST_START_DATE' || $column == 'POST_END_DATE') {
//modif Francois: fix SQL bug START_DATE or END_DATE is null
if (!VerifyDate($value) && $value != '' || ($column == 'START_DATE' || $column == 'END_DATE') && $value == '') {
BackPrompt(_('Not all of the dates were entered correctly.'));
}
}
if ($value) {
$fields .= $column . ',';
$values .= "'" . $value . "',";
$go = true;
}
}
$sql .= '(' . mb_substr($fields, 0, -1) . ') values(' . mb_substr($values, 0, -1) . ')';
}
// CHECK TO MAKE SURE ONLY ONE MP & ONE GRADING PERIOD IS OPEN AT ANY GIVEN TIME
$dates_RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='{$_REQUEST['mp_term']}' AND (true=false" . ($columns['START_DATE'] ? " OR '" . $columns['START_DATE'] . "' BETWEEN START_DATE AND END_DATE" : '') . ($columns['END_DATE'] ? " OR '" . $columns['END_DATE'] . "' BETWEEN START_DATE AND END_DATE" : '') . ($columns['START_DATE'] && $columns['END_DATE'] ? " OR START_DATE BETWEEN '" . $columns['START_DATE'] . "' AND '" . $columns['END_DATE'] . "'\n\t\t\t\tOR END_DATE BETWEEN '" . $columns['START_DATE'] . "' AND '" . $columns['END_DATE'] . "'" : '') . ") AND SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'" . ($id != 'new' ? " AND SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "' AND MARKING_PERIOD_ID!='{$id}'" : '')));
$posting_RET = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='{$_REQUEST['mp_term']}' AND (true=false" . ($columns['POST_START_DATE'] ? " OR '" . $columns['POST_START_DATE'] . "' BETWEEN POST_START_DATE AND POST_END_DATE" : '') . ($columns['POST_END_DATE'] ? " OR '" . $columns['POST_END_DATE'] . "' BETWEEN POST_START_DATE AND POST_END_DATE" : '') . ($columns['POST_START_DATE'] && $columns['POST_END_DATE'] ? " OR POST_START_DATE BETWEEN '" . $columns['POST_START_DATE'] . "' AND '" . $columns['POST_END_DATE'] . "'\n\t\t\t\tOR POST_END_DATE BETWEEN '" . $columns['POST_START_DATE'] . "' AND '" . $columns['POST_END_DATE'] . "'" : '') . ") AND SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'" . ($id != 'new' ? " AND MARKING_PERIOD_ID!='{$id}'" : '')));
if (count($dates_RET)) {
示例12: CustomFields
function CustomFields($location, $type = 'student', $extra = array())
{
global $_ROSARIO;
if (count($_REQUEST['month_cust_begin'])) {
foreach ($_REQUEST['month_cust_begin'] as $field_name => $month) {
$_REQUEST['cust_begin'][$field_name] = $_REQUEST['day_cust_begin'][$field_name] . '-' . $month . '-' . $_REQUEST['year_cust_begin'][$field_name];
if (!VerifyDate($_REQUEST['cust_begin'][$field_name])) {
unset($_REQUEST['cust_begin'][$field_name]);
}
}
}
unset($_REQUEST['month_cust_begin']);
unset($_REQUEST['year_cust_begin']);
unset($_REQUEST['day_cust_begin']);
if (count($_REQUEST['month_cust_end'])) {
foreach ($_REQUEST['month_cust_end'] as $field_name => $month) {
$_REQUEST['cust_end'][$field_name] = $_REQUEST['day_cust_end'][$field_name] . '-' . $month . '-' . $_REQUEST['year_cust_end'][$field_name];
if (!VerifyDate($_REQUEST['cust_end'][$field_name])) {
unset($_REQUEST['cust_end'][$field_name]);
}
}
}
unset($_REQUEST['month_cust_end']);
unset($_REQUEST['year_cust_end']);
unset($_REQUEST['day_cust_end']);
if (count($_REQUEST['cust'])) {
foreach ($_REQUEST['cust'] as $key => $value) {
if ($value == '') {
unset($_REQUEST['cust'][$key]);
}
}
}
switch ($location) {
case 'from':
break;
case 'where':
if (count($_REQUEST['cust']) || count($_REQUEST['cust_begin'] || count($_REQUEST['cust_null']))) {
$fields = ParseMLArray(DBGet(DBQuery("SELECT TITLE,ID,TYPE,SELECT_OPTIONS FROM " . ($type == 'staff' ? 'STAFF' : 'CUSTOM') . "_FIELDS"), array(), array('ID')), 'TITLE');
}
if (count($_REQUEST['cust'])) {
foreach ($_REQUEST['cust'] as $field_name => $value) {
if ($value != '') {
switch ($fields[mb_substr($field_name, 7)][1]['TYPE']) {
case 'radio':
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= '<span style="color:gray"><b>' . $fields[mb_substr($field_name, 7)][1]['TITLE'] . ': </b></span>';
}
if ($value == 'Y') {
$string .= " AND s.{$field_name}='{$value}' ";
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= _('Yes');
}
} elseif ($value == 'N') {
$string .= " AND (s.{$field_name}!='Y' OR s.{$field_name} IS NULL) ";
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= _('No');
}
}
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= '<BR />';
}
break;
case 'codeds':
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= '<span style="color:gray"><b>' . $fields[mb_substr($field_name, 7)][1]['TITLE'] . ': </b></span>';
}
if ($value == '!') {
$string .= " AND (s.{$field_name}='' OR s.{$field_name} IS NULL) ";
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= _('No Value');
}
} else {
$string .= " AND s.{$field_name}='{$value}' ";
if (!$extra['NoSearchTerms']) {
$select_options = str_replace("\n", "\r", str_replace("\r\n", "\r", $fields[mb_substr($field_name, 7)][1]['SELECT_OPTIONS']));
$select_options = explode("\r", $select_options);
foreach ($select_options as $option) {
$option = explode('|', $option);
if ($option[0] != '' && $option[1] != '' && $value == $option[0]) {
$value = $option[1];
break;
}
}
$_ROSARIO['SearchTerms'] .= $value;
}
}
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= '<BR />';
}
break;
case 'exports':
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= '<span style="color:gray"><b>' . $fields[mb_substr($field_name, 7)][1]['TITLE'] . ': </b></span>';
}
if ($value == '!') {
$string .= " AND (s.{$field_name}='' OR s.{$field_name} IS NULL) ";
if (!$extra['NoSearchTerms']) {
$_ROSARIO['SearchTerms'] .= _('No Value');
}
} else {
//.........这里部分代码省略.........
示例13: unset
}
unset($_SESSION['_REQUEST_vars']['modfunc']);
Widgets('course');
Widgets('request');
Search('student_id', $extra);
if ($_REQUEST['month_schedule'] && $_POST['month_schedule']) {
foreach ($_REQUEST['month_schedule'] as $id => $start_dates) {
foreach ($start_dates as $start_date => $columns) {
foreach ($columns as $column => $value) {
$_REQUEST['schedule'][$id][$start_date][$column] = $_REQUEST['day_schedule'][$id][$start_date][$column] . '-' . $value . '-' . $_REQUEST['year_schedule'][$id][$start_date][$column];
//modif Francois: bugfix SQL bug when incomplete or non-existent date
//if($_REQUEST['schedule'][$id][$start_date][$column]=='--')
if (mb_strlen($_REQUEST['schedule'][$id][$start_date][$column]) < 11) {
$_REQUEST['schedule'][$id][$start_date][$column] = '';
} else {
while (!VerifyDate($_REQUEST['schedule'][$id][$start_date][$column])) {
$_REQUEST['day_schedule'][$id][$start_date][$column]--;
$_REQUEST['schedule'][$id][$start_date][$column] = $_REQUEST['day_schedule'][$id][$start_date][$column] . '-' . $value . '-' . $_REQUEST['year_schedule'][$id][$start_date][$column];
}
}
}
}
}
unset($_REQUEST['month_schedule']);
unset($_REQUEST['day_schedule']);
unset($_REQUEST['year_schedule']);
unset($_SESSION['_REQUEST_vars']['month_schedule']);
unset($_SESSION['_REQUEST_vars']['day_schedule']);
unset($_SESSION['_REQUEST_vars']['year_schedule']);
$_POST['schedule'] = $_REQUEST['schedule'];
}
示例14: CustomFields
function CustomFields($location, $table_arr = '')
{
global $_CENTRE;
if (count($_REQUEST['month_cust_begin'])) {
foreach ($_REQUEST['month_cust_begin'] as $field_name => $month) {
$_REQUEST['cust_begin'][$field_name] = $_REQUEST['day_cust_begin'][$field_name] . '-' . $_REQUEST['month_cust_begin'][$field_name] . '-' . $_REQUEST['year_cust_begin'][$field_name];
$_REQUEST['cust_end'][$field_name] = $_REQUEST['day_cust_end'][$field_name] . '-' . $_REQUEST['month_cust_end'][$field_name] . '-' . $_REQUEST['year_cust_end'][$field_name];
if (!VerifyDate($_REQUEST['cust_begin'][$field_name]) || !VerifyDate($_REQUEST['cust_end'][$field_name])) {
unset($_REQUEST['cust_begin'][$field_name]);
unset($_REQUEST['cust_end'][$field_name]);
}
}
unset($_REQUEST['month_cust_begin']);
unset($_REQUEST['year_cust_begin']);
unset($_REQUEST['day_cust_begin']);
unset($_REQUEST['month_cust_end']);
unset($_REQUEST['year_cust_end']);
unset($_REQUEST['day_cust_end']);
}
if (count($_REQUEST['cust'])) {
foreach ($_REQUEST['cust'] as $key => $value) {
if ($value == '') {
unset($_REQUEST['cust'][$key]);
}
}
}
switch ($location) {
case 'from':
break;
case 'where':
if (count($_REQUEST['cust']) || count($_REQUEST['cust_begin'])) {
$fields = DBGet(DBQuery("SELECT TITLE,ID,TYPE FROM CUSTOM_FIELDS"), array(), array('ID'));
}
if (count($_REQUEST['cust'])) {
foreach ($_REQUEST['cust'] as $field_name => $value) {
if ($value != '') {
switch ($fields[substr($field_name, 7)][1]['TYPE']) {
case 'radio':
$_CENTRE['SearchTerms'] .= '<font color=gray><b>' . $fields[substr($field_name, 7)][1]['TITLE'] . ': </b></font>';
if ($value == 'Y') {
$string .= " and s.{$field_name}='{$value}' ";
$_CENTRE['SearchTerms'] .= 'Yes';
} elseif ($value == 'N') {
$string .= " and (s.{$field_name}!='Y' OR s.{$field_name} IS NULL) ";
$_CENTRE['SearchTerms'] .= 'No';
}
$_CENTRE['SearchTerms'] .= '<BR>';
break;
case 'codeds':
$_CENTRE['SearchTerms'] .= '<font color=gray><b>' . $fields[substr($field_name, 7)][1]['TITLE'] . ': </b></font>';
if ($value == '!') {
$string .= " and (s.{$field_name}='' OR s.{$field_name} IS NULL) ";
$_CENTRE['SearchTerms'] .= 'No Value';
} else {
$string .= " and s.{$field_name}='{$value}' ";
$_CENTRE['SearchTerms'] .= $value;
}
$_CENTRE['SearchTerms'] .= '<BR>';
break;
case 'select':
$_CENTRE['SearchTerms'] .= '<font color=gray><b>' . $fields[substr($field_name, 7)][1]['TITLE'] . ': </b></font>';
if ($value == '!') {
$string .= " and (s.{$field_name}='' OR s.{$field_name} IS NULL) ";
$_CENTRE['SearchTerms'] .= 'No Value';
} else {
$string .= " and s.{$field_name}='{$value}' ";
$_CENTRE['SearchTerms'] .= $value;
}
$_CENTRE['SearchTerms'] .= '<BR>';
break;
case 'autos':
$_CENTRE['SearchTerms'] .= '<font color=gray><b>' . $fields[substr($field_name, 7)][1]['TITLE'] . ': </b></font>';
if ($value == '!') {
$string .= " and (s.{$field_name}='' OR s.{$field_name} IS NULL) ";
$_CENTRE['SearchTerms'] .= 'No Value';
} else {
$string .= " and s.{$field_name}='{$value}' ";
$_CENTRE['SearchTerms'] .= $value;
}
$_CENTRE['SearchTerms'] .= '<BR>';
break;
case 'edits':
$_CENTRE['SearchTerms'] .= '<font color=gray><b>' . $fields[substr($field_name, 7)][1]['TITLE'] . ': </b></font>';
if ($value == '!') {
$string .= " and (s.{$field_name}='' OR s.{$field_name} IS NULL) ";
$_CENTRE['SearchTerms'] .= 'No Value';
} elseif ($value == '~') {
$string .= " and position('\n'||s.{$field_name}||'\r' IN '\n'||(SELECT SELECT_OPTIONS FROM CUSTOM_FIELDS WHERE ID='" . substr($field_name, 7) . "')||'\r')=0 ";
$_CENTRE['SearchTerms'] .= 'Other';
} else {
$string .= " and s.{$field_name}='{$value}' ";
$_CENTRE['SearchTerms'] .= $value;
}
$_CENTRE['SearchTerms'] .= '<BR>';
break;
case 'text':
if (substr($value, 0, 2) == '\\"' && substr($value, -2) == '\\"') {
$string .= " and s.{$field_name}='" . substr($value, 2, -2) . "' ";
$_CENTRE['SearchTerms'] .= '<font color=gray><b>' . $fields[substr($field_name, 7)][1]['TITLE'] . ': </b></font>' . substr($value, 2, -2) . '<BR>';
} else {
//.........这里部分代码省略.........
示例15: _make
function _make($value, $column)
{
if (substr_count($value, '-') == 2 && VerifyDate($value)) {
$value = ProperDate($value);
} elseif (is_numeric($value)) {
$value = strpos($value, '.') === false ? $value : rtrim(rtrim($value, '0'), '.');
}
return str_replace('||', ',<BR>', trim($value, '|'));
}