Exemplo n.º 1
0
if (!$_REQUEST['modfunc']) {
    $transaction_items = array('CASH' => array(1 => array('DESCRIPTION' => _('Cash'), 'COUNT' => 0, 'AMOUNT' => 0)), 'CHECK' => array(1 => array('DESCRIPTION' => _('Check'), 'COUNT' => 0, 'AMOUNT' => 0)), 'CREDIT CARD' => array(1 => array('DESCRIPTION' => _('Credit Card'), 'COUNT' => 0, 'AMOUNT' => 0)), 'DEBIT CARD' => array(1 => array('DESCRIPTION' => _('Debit Card'), 'COUNT' => 0, 'AMOUNT' => 0)), 'TRANSFER' => array(1 => array('DESCRIPTION' => _('Transfer'), 'COUNT' => 0, 'AMOUNT' => 0)), '' => array(1 => array('DESCRIPTION' => 'n/s', 'COUNT' => 0, 'AMOUNT' => 0)));
    $menus_RET = DBGet(DBQuery('SELECT TITLE FROM FOOD_SERVICE_MENUS WHERE SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY SORT_ORDER'));
    //echo '<pre>'; var_dump($menus_RET); echo '</pre>';
    $items = DBGet(DBQuery('SELECT SHORT_NAME,DESCRIPTION,0 AS COUNT FROM FOOD_SERVICE_ITEMS WHERE SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY SORT_ORDER'), array(), array('SHORT_NAME'));
    //echo '<pre>'; var_dump($items); echo '</pre>';
    $types = array('DEPOSIT' => array('DESCRIPTION' => _('Deposit'), 'COUNT' => 0, 'AMOUNT' => 0, 'ITEMS' => $transaction_items), 'CREDIT' => array('DESCRIPTION' => _('Credit'), 'COUNT' => 0, 'AMOUNT' => 0, 'ITEMS' => $transaction_items), 'DEBIT' => array('DESCRIPTION' => _('Debit'), 'COUNT' => 0, 'AMOUNT' => 0, 'ITEMS' => $transaction_items));
    foreach ($menus_RET as $menu) {
        $types += array($menu['TITLE'] => array('DESCRIPTION' => $menu['TITLE'], 'COUNT' => 0, 'AMOUNT' => 0, 'ITEMS' => $items));
    }
    $type_select = _('Type') . '<SELECT name=type_select><OPTION value=\'\'>' . _('Not Specified') . '</OPTION>';
    foreach ($types as $short_name => $type) {
        $type_select .= '<OPTION value=' . $short_name . ($_REQUEST['type_select'] == $short_name ? ' SELECTED' : '') . '>' . $type['DESCRIPTION'] . '</OPTION>';
    }
    $type_select .= '</SELECT>';
    $staff_RET = DBGet(DBquery('SELECT STAFF_ID,FIRST_NAME||\' \'||LAST_NAME AS FULL_NAME FROM STAFF WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOLS LIKE \'%,' . UserSchool() . ',%\' AND PROFILE=\'admin\' ORDER BY LAST_NAME'));
    $staff_select = _('User') . '<SELECT name=staff_select><OPTION value=\'\'>' . _('Not Specified') . '</OPTION>';
    foreach ($staff_RET as $staff) {
        $staff_select .= '<OPTION value=' . $staff['STAFF_ID'] . ($_REQUEST['staff_select'] == $staff['STAFF_ID'] ? ' SELECTED' : '') . '>' . $staff['FULL_NAME'] . '</OPTION>';
    }
    $staff_select .= '</SELECT>';
    $PHP_tmp_SELF = PreparePHP_SELF();
    echo "<FORM action={$PHP_tmp_SELF} method=POST>";
    DrawHeader(PrepareDate($date, '_date') . ' : ' . $type_select . ' : ' . $staff_select . ' : <INPUT type=submit value=' . _('Go') . '>', CheckBoxOnclick('by_name') . _('Sort by Name'));
    echo '</FORM>';
    if ($_REQUEST['type_select']) {
        $where = "AND fst.SHORT_NAME='" . $_REQUEST['type_select'] . "' ";
    }
    if ($_REQUEST['staff_select']) {
        $where = "AND fst.SELLER_ID='" . $_REQUEST['staff_select'] . "' ";
    }
Exemplo n.º 2
0
                                 $teachers_id = $teach_id[1]['TEACHER_ID'];
                             } else {
                                 $teachers_id = DBGet(DBQuery("SELECT TEACHER_ID,SECONDARY_TEACHER_ID FROM course_periods WHERE COURSE_PERIOD_ID='" . $cps . "'"));
                                 if ($teachers_id[1]['SECONDARY_TEACHER_ID'] != '') {
                                     $secondary_teachers_id = $teachers_id[1]['SECONDARY_TEACHER_ID'];
                                 } else {
                                     $secondary_teachers_id = '';
                                 }
                                 $teachers_id = $teachers_id[1]['TEACHER_ID'];
                             }
                             $attendance_completed_check = DBGet(DBQuery("SELECT COUNT(*) as COMPLETED FROM attendance_completed WHERE PERIOD_ID='" . $vals['PERIOD_ID'] . "' AND COURSE_PERIOD_ID='" . $cps . "'\r\n                                                                    AND SCHOOL_DATE='" . $vals['COURSE_PERIOD_DATE'] . "'"));
                             if ($attendance_completed_check[1]['COMPLETED'] == 0) {
                                 if ($secondary_teachers_id != '') {
                                     DBquery("INSERT INTO missing_attendance (SCHOOL_ID,SYEAR,SCHOOL_DATE,COURSE_PERIOD_ID,PERIOD_ID,TEACHER_ID,SECONDARY_TEACHER_ID) \r\n                               VALUES ('" . UserSchool() . "','" . UserSyear() . "','" . $vals['COURSE_PERIOD_DATE'] . "','" . $cps . "','" . $vals['PERIOD_ID'] . "','" . $teachers_id . "','" . $secondary_teachers_id . "')");
                                 } else {
                                     DBquery("INSERT INTO missing_attendance (SCHOOL_ID,SYEAR,SCHOOL_DATE,COURSE_PERIOD_ID,PERIOD_ID,TEACHER_ID) \r\n                               VALUES ('" . UserSchool() . "','" . UserSyear() . "','" . $vals['COURSE_PERIOD_DATE'] . "','" . $cps . "','" . $vals['PERIOD_ID'] . "','" . $teachers_id . "')");
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     DBQuery("CALL SEAT_FILL()");
     unset($_SESSION['_REQUEST_vars']['schedule']);
     unset($_REQUEST['schedule']);
 }
 if (UserStudentID() && $_REQUEST['modfunc'] != 'choose_course' && $_REQUEST['modfunc'] != 'more_info') {
     echo "<FORM name=modify id=modify action=Modules.php?modname=" . strip_tags(trim($_REQUEST[modname])) . "&modfunc=modify METHOD=POST>";
     $tmp_REQUEST = $_REQUEST;
 $months = array(1 => _('January'), _('February'), _('March'), _('April'), _('May'), _('June'), _('July'), _('August'), _('September'), _('October'), _('November'), _('December'));
 $custom_RET = DBGet(DBQuery("SELECT TITLE,ID FROM CUSTOM_FIELDS WHERE ID IN ('200000000','200000003')"), array(), array('ID'));
 $extra['SELECT'] = ",ssm.CALENDAR_ID,ssm.START_DATE,ssm.END_DATE";
 foreach ($custom_RET as $id => $custom) {
     $extra['SELECT'] .= ",CUSTOM_" . $id;
 }
 // ACTIVE logic taken from GetStuList()
 $extra['SELECT'] .= ',' . db_case(array("(ssm.SYEAR='" . UserSyear() . "' AND ('" . DBDate() . "'>=ssm.START_DATE AND ('" . DBDate() . "'<=ssm.END_DATE OR ssm.END_DATE IS NULL)))", 'TRUE', "'Active'", "'Inactive'")) . ' AS STATUS';
 $RET = GetStuList($extra);
 if (count($RET)) {
     $school_RET = DBGet(DBQuery("SELECT TITLE FROM SCHOOLS WHERE ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'"));
     // override default options
     $options = "--webpage --quiet -t pdf12 --jpeg --no-links --portrait --footer t --header . --left 0.25in --right 0.25in --top 0.5in --size 8.5x11in --bodyfont Courier --fontsize 8";
     $handle = PDFStart($options);
     foreach ($RET as $student) {
         $calendar_RET = DBGet(DBquery("SELECT " . db_case(array("MINUTES>=" . Config('ATTENDANCE_FULL_DAY_MINUTES'), 'true', "'1.0'", "'0.5'")) . "AS POS,trim(leading '0' from to_char(SCHOOL_DATE,'MM')) AS MON,trim(leading '0' from to_char(SCHOOL_DATE,'DD')) AS DAY FROM ATTENDANCE_CALENDAR WHERE CALENDAR_ID='" . $student['CALENDAR_ID'] . "' AND SCHOOL_DATE>='" . $student['START_DATE'] . "'" . ($student['END_DATE'] ? " AND SCHOOL_DATE<='" . $student['END_DATE'] . "'" : '')), array(), array('MON', 'DAY'));
         $attendance_RET = DBGet(DBQuery("SELECT trim(leading '0' from to_char(ap.SCHOOL_DATE,'MM')) AS MON,trim(leading '0' from to_char(ap.SCHOOL_DATE,'DD')) AS DAY,ac.STATE_CODE,ac.SHORT_NAME FROM ATTENDANCE_PERIOD ap,ATTENDANCE_CODES ac,SCHOOL_PERIODS sp WHERE ap.STUDENT_ID='" . $student['STUDENT_ID'] . "' AND ap.PERIOD_ID=sp.PERIOD_ID AND sp.SCHOOL_ID='" . UserSchool() . "' AND sp.SYEAR='" . UserSyear() . "' AND ac.ID=ap.ATTENDANCE_CODE AND sp.ATTENDANCE='Y'"), array(), array('MON', 'DAY'));
         //echo '<pre>'; var_dump($calendar_RET); echo '</pre>';
         echo '<TABLE class="width-100p">';
         echo '<TR><TD class="width-100p center">';
         echo '<TABLE style="width:96%">';
         echo '<TR><TD class="width-100p center">';
         echo '<span class="sizep2"><B>' . $student['FULL_NAME'] . '</B></span>';
         echo '</TD><TR>';
         echo '</TABLE>';
         echo '<TABLE style="width:96%; border: solid 1px">';
         echo '<TR class="center"><TD><B>' . _('Student Name') . '</B></TD><TD><B>ID#</B></TD><TD><B>' . _('School') . ' / ' . _('Year') . '</B></TD></TR>';
         //modif Francois: school year over one/two calendar years format
         echo '<TR><TD class="center">' . $student['FULL_NAME'] . '</TD><TD class="center">' . $student['STUDENT_ID'] . '</TD><TD class="center">' . $school_RET[1]['TITLE'] . ' / ' . FormatSyear(UserSyear(), Config('SCHOOL_SYEAR_OVER_2_YEARS')) . '</TD></TR>';
         echo '<TR><TD colspan="3"><span class="sizep1"><B>' . _('Demographics') . '</B></span><TABLE style="width:98%; margin:0 auto;" class="cellpadding-0 cellspacing-0">';
         echo '<TR><TD style="text-align:right">' . ParseMLField($custom_RET[200000000][1]['TITLE']) . ':&nbsp;</TD><TD>' . $student['CUSTOM_200000000'] . '</TD><TD style="text-align:right">' . _('Status') . ':&nbsp;</TD><TD>' . _($student['STATUS']) . '</TD></TR>';
Exemplo n.º 4
0
// convert the actual date to the calendar one (2000-01-02 -> 2000-01-08, Sunday to Saturday)
$day_of_week = date("w");
$day = $day_of_week + 2;
$actual_time = date("H:i:s");
$actual_date = "2000-01-0{$day} {$actual_time}";
// retrieve the outputs to be managed by this task
$sql = "SELECT OUT_ID, OUT_STATUS FROM OUTPUTS WHERE MANAGED_BY = " . MANAGED_BY_AUTO;
$data_set = DBquery($db_handler, $sql);
if ($data_set) {
    foreach ($data_set as $row) {
        $out_id = intval($row['OUT_ID']);
        $out_status = intval($row['OUT_STATUS']);
        logMessage("IrrighinoTask - Checking OUT_ID {$out_id} now in OUT_STATUS {$out_status}");
        // check if we neeed to change the status
        $sql = "SELECT EVENT_ID FROM EVENTS WHERE OUT_ID = {$out_id} AND START < '{$actual_date}' AND END > '{$actual_date}'";
        $event_data_set = DBquery($db_handler, $sql);
        // a event has been found
        if ($event_data_set->fetch()) {
            logMessage("IrrighinoTask - An event was found for this OUT_ID");
            // if the output is OFF, turn it ON
            if ($out_status == STATUS_OFF) {
                $response = callArduino("on/{$out_id}");
                if (strpos($response, "OK") !== false) {
                    $sql = "UPDATE OUTPUTS SET OUT_STATUS = " . STATUS_ON . " WHERE OUT_ID = {$out_id}";
                    DBexec($db_handler, $sql);
                    logEvent($db_handler, TYPE_OUT_ON, "Output {$out_id} turned ON by a schedule");
                    logMessage("IrrighinoTask - OUT_ID {$out_id} turned ON and event logged in the DB");
                } else {
                    logEvent($db_handler, TYPE_ERROR, "Unable to turn ON output {$out_id}");
                    logMessage("IrrighinoTask - Error while calling Arduino to turn ON OUT_ID {$out_id}, response: {$response}");
                }
Exemplo n.º 5
0
$ordering_mode = $ordering_array[0]['dir'];
// get the paging parameters
$start = $_POST['start'];
$length = $_POST['length'];
$db_handler = DBconnect();
// count the number of records in the DB
$sql = "SELECT COUNT(ID) AS NUMRECORDS FROM LOG";
if (!empty($search_value)) {
    $sql .= " WHERE EVENT_DESC LIKE '%" . $search_value . "%'";
}
foreach (DBquery($db_handler, $sql) as $row) {
    $response->recordsTotal = $row['NUMRECORDS'];
    $response->recordsFiltered = $row['NUMRECORDS'];
}
$sql = "SELECT EVENT_ID, datetime(DATE, 'localtime') as DATE, EVENT_DESC FROM LOG";
if (!empty($search_value)) {
    $sql .= " WHERE EVENT_DESC LIKE '%" . $search_value . "%'";
}
$sql .= " ORDER BY " . $ordering_column . " " . $ordering_mode . " LIMIT " . $start . ", " . $length;
$data = array();
foreach (DBquery($db_handler, $sql) as $row) {
    $event = array();
    array_push($event, $row['EVENT_ID']);
    array_push($event, $row['DATE']);
    array_push($event, $row['EVENT_DESC']);
    array_push($data, $event);
}
$response->data = $data;
$out = json_encode($response);
header('Content-Type: application/json');
echo $out;
Exemplo n.º 6
0
if (!$_REQUEST['modfunc']) {
    $transaction_items = array('CASH' => array(1 => array('DESCRIPTION' => 'Cash', 'COUNT' => 0, 'AMOUNT' => 0)), 'CHECK' => array(1 => array('DESCRIPTION' => 'Check', 'COUNT' => 0, 'AMOUNT' => 0)), 'CREDIT CARD' => array(1 => array('DESCRIPTION' => 'Credit Card', 'COUNT' => 0, 'AMOUNT' => 0)), 'DEBIT CARD' => array(1 => array('DESCRIPTION' => 'Debit Card', 'COUNT' => 0, 'AMOUNT' => 0)), 'TRANSFER' => array(1 => array('DESCRIPTION' => 'Transfer', 'COUNT' => 0, 'AMOUNT' => 0)), '' => array(1 => array('DESCRIPTION' => 'n/s', 'COUNT' => 0, 'AMOUNT' => 0)));
    $menus_RET = DBGet(DBQuery('SELECT TITLE FROM FOOD_SERVICE_MENUS WHERE SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY SORT_ORDER'));
    //echo '<pre>'; var_dump($menus_RET); echo '</pre>';
    $items = DBGet(DBQuery('SELECT SHORT_NAME,DESCRIPTION,0 AS COUNT FROM FOOD_SERVICE_ITEMS WHERE SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY SORT_ORDER'), array(), array('SHORT_NAME'));
    //echo '<pre>'; var_dump($items); echo '</pre>';
    $types = array('DEPOSIT' => array('DESCRIPTION' => 'Deposit', 'COUNT' => 0, 'AMOUNT' => 0, 'ITEMS' => $transaction_items), 'CREDIT' => array('DESCRIPTION' => 'Credit', 'COUNT' => 0, 'AMOUNT' => 0, 'ITEMS' => $transaction_items), 'DEBIT' => array('DESCRIPTION' => 'Debit', 'COUNT' => 0, 'AMOUNT' => 0, 'ITEMS' => $transaction_items));
    foreach ($menus_RET as $menu) {
        $types += array($menu['TITLE'] => array('DESCRIPTION' => $menu['TITLE'], 'COUNT' => 0, 'AMOUNT' => 0, 'ITEMS' => $items));
    }
    $type_select = 'Type<SELECT name=type_select><OPTION value=\'\'>Not Specified</OPTION>';
    foreach ($types as $short_name => $type) {
        $type_select .= '<OPTION value=' . $short_name . ($_REQUEST['type_select'] == $short_name ? ' SELECTED' : '') . '>' . $type['DESCRIPTION'] . '</OPTION>';
    }
    $type_select .= '</SELECT>';
    $staff_RET = DBGet(DBquery("SELECT STAFF_ID,CONCAT(FIRST_NAME,' ',LAST_NAME) AS FULL_NAME FROM STAFF WHERE SYEAR='" . UserSyear() . "' AND SCHOOLS LIKE '%," . UserSchool() . ",%' AND PROFILE='admin' ORDER BY LAST_NAME"));
    $staff_select = 'User<SELECT name=staff_select><OPTION value=\'\'>Not Specified</OPTION>';
    foreach ($staff_RET as $staff) {
        $staff_select .= '<OPTION value=' . $staff['STAFF_ID'] . ($_REQUEST['staff_select'] == $staff['STAFF_ID'] ? ' SELECTED' : '') . '>' . $staff['FULL_NAME'] . '</OPTION>';
    }
    $staff_select .= '</SELECT>';
    $PHP_tmp_SELF = PreparePHP_SELF();
    echo "<FORM action={$PHP_tmp_SELF} method=POST>";
    DrawHeaderHome(PrepareDate($date, '_date') . ' : ' . $type_select . ' : ' . $staff_select . ' : <INPUT type=submit value=Go>');
    echo '</FORM>';
    if ($_REQUEST['type_select']) {
        $where = "AND fst.SHORT_NAME='" . $_REQUEST['type_select'] . "' ";
    }
    if ($_REQUEST['staff_select']) {
        $where = "AND fst.SELLER_ID='" . $_REQUEST['staff_select'] . "' ";
    }
Exemplo n.º 7
0
         if (!$test_email) {
             // get staff id
             $id = DBGet(DBQuery('SELECT ' . db_seq_nextval('STAFF_SEQ') . ' AS SEQ_ID ' . FROM_DUAL));
             $id = $id[1]['SEQ_ID'];
             $sql = "INSERT INTO STAFF (STAFF_ID,SYEAR,PROFILE,PROFILE_ID,FIRST_NAME,MIDDLE_NAME,LAST_NAME,USERNAME,PASSWORD,EMAIL) values ('{$id}','" . UserSyear() . "','parent','{$profile_id}','{$user['FIRST_NAME']}','{$user['MIDDLE_NAME']}','{$user['LAST_NAME']}','{$username}','{$password}','" . $students[1]['EMAIL'] . "')";
             DBQuery($sql);
             $staff = DBGet(DBquery("SELECT FIRST_NAME||' '||LAST_NAME AS NAME,USERNAME,PASSWORD FROM STAFF WHERE STAFF_ID={$id}"));
         } else {
             $id = true;
             $staff = array(1 => array('NAME' => $user['FIRST_NAME'] . ' ' . $user['LAST_NAME'], 'USERNAME' => $username, 'PASSWORD' => $password));
         }
         $account = 'new';
     }
 } else {
     $id = $students[1]['STAFF_ID'];
     $staff = DBGet(DBquery("SELECT FIRST_NAME||' '||LAST_NAME AS NAME,USERNAME,PASSWORD FROM STAFF WHERE STAFF_ID={$id}"));
     $account = 'old';
 }
 if ($id) {
     $staff = $staff[1];
     $student_list = '';
     foreach ($students as $student) {
         if (!$test_email) {
             $sql = "INSERT INTO STUDENTS_JOIN_USERS (STAFF_ID,STUDENT_ID) values ('{$id}',{$student['STUDENT_ID']})";
             DBQuery($sql);
         }
         $student_list .= str_replace('&nbsp;', ' ', $student['FULL_NAME']) . "\r";
     }
     $msg = str_replace('^S', $student_list, $message[$account]);
     $msg = str_replace('^N', $staff['NAME'], $msg);
     $msg = str_replace('^U', $staff['USERNAME'], $msg);