示例#1
0
#***************************************************************************************
include '../../RedirectModulesInc.php';
unset($_SESSION['_REQUEST_vars']['values']);
unset($_SESSION['_REQUEST_vars']['modfunc']);
DrawBC("School Setup > " . ProgramTitle());
// --------------------------------------------------------------- Test SQL ------------------------------------------------------------------ //
// --------------------------------------------------------------- Tset SQL ------------------------------------------------------------------ //
if (clean_param($_REQUEST['modfunc'], PARAM_ALPHAMOD) == 'update' && (clean_param($_REQUEST['button'], PARAM_ALPHAMOD) == 'Save' || clean_param($_REQUEST['button'], PARAM_ALPHAMOD) == 'Update' || clean_param($_REQUEST['button'], PARAM_ALPHAMOD) == '')) {
    if (clean_param($_REQUEST['values'], PARAM_NOTAGS) && $_POST['values'] && User('PROFILE') == 'admin') {
        if ($_REQUEST['new_school'] != 'true') {
            $sql = 'UPDATE schools SET ';
            foreach ($_REQUEST as $col => $val) {
                $dt_ex = explode("_", $col);
                if ($dt_ex[0] == 'month') {
                    if ($_REQUEST['day_' . $dt_ex[1]]['CUSTOM_' . $dt_ex[1]] != '' && $_REQUEST['month_' . $dt_ex[1]]['CUSTOM_' . $dt_ex[1]] != '' && $_REQUEST['year_' . $dt_ex[1]]['CUSTOM_' . $dt_ex[1]] != '') {
                        $_REQUEST['values']['CUSTOM_' . $dt_ex[1]] = $_REQUEST['year_' . $dt_ex[1]]['CUSTOM_' . $dt_ex[1]] . "-" . MonthFormatter($_REQUEST['month_' . $dt_ex[1]]['CUSTOM_' . $dt_ex[1]]) . '-' . $_REQUEST['day_' . $dt_ex[1]]['CUSTOM_' . $dt_ex[1]];
                    }
                }
            }
            foreach ($_REQUEST['values'] as $column => $value) {
                if (substr($column, 0, 6) == 'CUSTOM') {
                    $custom_id = str_replace("CUSTOM_", "", $column);
                    $custom_RET = DBGet(DBQuery("SELECT TITLE,TYPE,REQUIRED FROM school_custom_fields WHERE ID=" . $custom_id));
                    $custom = DBGet(DBQuery("SHOW COLUMNS FROM schools WHERE FIELD='" . $column . "'"));
                    $custom = $custom[1];
                    if ($custom['NULL'] == 'NO' && trim($value) == '' && $custom['DEFAULT']) {
                        $value = $custom['DEFAULT'];
                    } else {
                        if ($custom['NULL'] == 'NO' && $value == '' && $custom_RET[1]['REQUIRED'] == 'Y') {
                            $custom_TITLE = $custom_RET[1]['TITLE'];
                            echo "<font color=red><b>Unable to save data, because " . $custom_TITLE . ' is required.</b></font><br/>';
示例#2
0
#  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 '../../RedirectModulesInc.php';
if ($_REQUEST['month_date'] && $_REQUEST['day_date'] && $_REQUEST['year_date']) {
    $date = $_REQUEST['year_date'] . '-' . MonthFormatter($_REQUEST['month_date']) . '-' . $_REQUEST['day_date'];
    //	while(!VerifyDate($date = $_REQUEST['day_date'].'-'.$_REQUEST['month_date'].'-'.$_REQUEST['year_date']))
    //		$_REQUEST['day_date']--;
} else {
    $_REQUEST['day_date'] = date('d');
    $_REQUEST['month_date'] = strtoupper(date('m'));
    $_REQUEST['year_date'] = date('Y');
    //	$date = $_REQUEST['day_date'].'-'.$_REQUEST['month_date'].'-'.$_REQUEST['year_date'];
    $date = $_REQUEST['year_date'] . '-' . $_REQUEST['month_date'] . '-' . $_REQUEST['day_date'];
}
DrawBC("Attendance > " . ProgramTitle());
$QI = DBQuery('SELECT sp.PERIOD_ID,sp.TITLE FROM school_periods sp WHERE sp.SCHOOL_ID=\'' . UserSchool() . '\' AND sp.SYEAR=\'' . UserSyear() . '\' AND EXISTS (SELECT \'\' FROM course_periods cp,course_period_var cpv WHERE cp.SYEAR=sp.SYEAR AND cpv.PERIOD_ID=sp.PERIOD_ID AND cpv.DOES_ATTENDANCE=\'Y\') ORDER BY sp.SORT_ORDER');
$periods_RET = DBGet($QI, array(), array('PERIOD_ID'));
$period_select = "<SELECT name=period><OPTION value=''>All</OPTION>";
foreach ($periods_RET as $id => $period) {
    $period_select .= "<OPTION value={$id}" . ($_REQUEST['period'] == $id ? ' SELECTED' : '') . ">" . $period[1]['TITLE'] . "</OPTION>";
示例#3
0
#  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 '../../RedirectModulesInc.php';
if (isset($_REQUEST['custom_date_id']) && count($_REQUEST['custom_date_id']) > 0) {
    foreach ($_REQUEST['custom_date_id'] as $custom_id) {
        $_REQUEST['staff']['CUSTOM_' . $custom_id] = $_REQUEST['year_CUSTOM_' . $custom_id] . '-' . MonthFormatter($_REQUEST['month_CUSTOM_' . $custom_id]) . '-' . $_REQUEST['day_CUSTOM_' . $custom_id];
    }
}
if (isset($_REQUEST['user_checkbox']) && count($_REQUEST['user_checkbox']) > 0) {
    foreach ($_REQUEST['user_checkbox'] as $custom_id => $custom_arr) {
        $temp_arr = implode('||', $custom_arr);
        $_REQUEST['staff'][$custom_id] = '||' . $temp_arr . '||';
    }
}
$st_flag = false;
$error = false;
$error_school = '';
if ($_REQUEST['staff_id'] != 'new') {
    $profile = DBGet(DBQuery('SELECT id FROM user_profiles WHERE profile = \'' . 'parent' . '\''));
    $parent_ids_arr = array();
    foreach ($profile as $k => $v) {