Beispiel #1
0
    die("There was an error connecting to the database: " . mysqli_connect_error());
}
/**
 * Get the list of student from SMS.
 * Foreach teacher see if they exist in my SIS
 *  If so, then update ?  maybe not.... ???
 *  What about teachers in multiple buildings??????
 *  If not, then insert
 *  Think about what to do about inactive teachers...?  Need to work on that...
 *  The buildingID in USERS is a center_id in my sis.  For SchoolID, maybe use
 *  33 = BOCES Questar III for teachers...?  Not sure that teachers need a school_id
 *
 */
$smsTeachers = make_assoc_array_from_sql(getCurrentTeachersFromSMS(), 'email', 'ms');
$q3aitTeachers = make_assoc_array_from_sql(getCurrentTeachersForSMS(), 'email', 'my');
$edCenters = make_assoc_array_from_sql(get_edCenters(), 'smsBuildingID', 'my');
$result = getSMSusers2center();
$u2c = array();
while ($row = $result->fetch_assoc()) {
    array_push($u2c, $row['user_id'] . $row['center_id']);
}
$msg = '';
// used to email admin if an error.
$error = false;
/**
 * NOTE:  Teachers in multiple buildings still have the same email address.  So,
 * Look up the teachers based on email rather than TGUID, then look for them in the
 * user2center table by user_id
 */
foreach ($smsTeachers as $email => $row) {
    $BuildingID = $row['buildingID'];
$today = date('Y-m-d');
$sql = "SELECT currentYearId from currentSchoolYear";
$result = $db->query($sql);
$row = $result->fetch_assoc();
$yid = $row['currentYearId'];
/** get the current term for this year in this center
 * Returns an sql result set including
 * term_id, term_name, term_weight, term_start_date, term_end_date, term_ord
 */
$sql = "SELECT * from terms\n    WHERE terms.term_start_date <= '" . $today . "'\n    AND terms.term_end_date >= '" . $today . "'";
$result = $db->query($sql);
$row = $result->fetch_assoc();
$current_term_id = $row['term_id'];
$current_term_name = $row['term_name'];
/** Get Ed Centers **/
$centers = get_edCenters();
foreach ($centers as $center_id => $short_name) {
    /** Get Teachers **/
    $teachers = get_users_for_center($center_id, 'isTeacher', 'Y', "users.last_name, users.first_name");
    foreach ($teachers as $teacher_id => $teacher_name) {
        $tinfo = get_teacher_info($teacher_id);
        $tuname = $tinfo['u_name'];
        /** Get Courses **/
        $sql = "\n        SELECT courses.course_id, courses.course_name\n        FROM courses\n        WHERE courses.teacher_id=" . $teacher_id . "\n        AND courses.school_year_id=" . $yid . "\n        AND courses.ed_center=" . $center_id;
        $result = $db->query($sql);
        $courses = make_array_from_sql($result, 'course_id', array('course_name'), '');
        foreach ($courses as $course_id => $course_name) {
            /** Get Classes **/
            /** class_id=>term_name course_name **/
            $classes = get_teacher_classes_by_course($course_id);
            foreach ($classes as $class_id => $class_name) {
Beispiel #3
0
<?php

// verify that the user is allowed here...
if ($_SESSION[$_CONF['sess_name'] . '_isAdmin'] || $_SESSION[$_CONF['sess_name'] . '_isOffice'] || $_SESSION[$_CONF['sess_name'] . '_isTeacher']) {
    /** Get the list of Ed Centers & Home Schools **/
    $centers = get_edCenters();
    $edCenters = make_array_from_mysql(get_edCenters(), 'center_id', array('short_name'), '');
    $homeSchools = get_homeSchools($_SESSION[$_CONF['sess_name'] . '_myCenter']);
    $edCentersList = make_selection_list($edCenters, -1, 'center_id', 'addToCenter', 'Center', 'off');
    $homeSchoolsList = make_selection_list($homeSchools, -1, 'school_id', 'addToSchool', 'School', 'off');
    $grade_level = 0;
    //default setting so I can use gradelevelrow for 2 areas...
    $main .= "\n\t\t<script language=\"javascript\" src=\"js/uname_search2.js\"></script>\n\t\t<script type=\"text/javascript\">\n\t\t\t\$(document).ready(function() {\n\t\t\t\t\$('#user_info').validationEngine({inlineValidation: true});\n\t\t\t\t\$('#user_pass').validationEngine();\n\t\t\t\t\$('input#showNewUser').click(\n\t\t\t\t\tfunction(e) {\n\t\t\t\t\t\t\$('div#newUserDialog').slideDown('slow');\n\t\t\t\t});\n\t\t\t\t\$('input#cancelNewUser').click(\n\t\t\t\t\tfunction(e) {\n                        \$.validationEngine.closePrompt(\".formError\",true);\n\t\t\t\t\t\t\$('div#newUserDialog').slideUp('slow');\n\t\t\t\t});\n\t\t\t\t\$('div#newUserDialog').hide();\n\n\t\t\t});\n\t\t</script>\n\t";
    $uid = -1;
    if (isset($_POST['u_id'])) {
        $uid = $_POST['u_id'];
    }
    if (isset($_POST['removeCenter'])) {
        /**
         * Next, if removing from center, then certainly need to deactivate/remove files from fs and db
         * If Updating, then need to check if any change to isTeacher or isStudent
         * deActivate_user($userMode,$_POST['u_id'],$_POST['c_id']);
         **/
        if ($userMode == 'teacher') {
            deActivate_teacher($_POST['u_id'], $_POST['c_id']);
        }
        if ($userMode == 'student') {
            deActivate_student($_POST['u_id'], $_POST['c_id']);
        }
        $sql = "DELETE from user2center where user_id=" . $_POST['u_id'] . " AND center_id=" . $_POST['c_id'];
        $result = $db->query($sql);