Ejemplo n.º 1
0
$db = new mysqli($_CONF['DB_host'], $_CONF['DB_user'], $_CONF['DB_pass'], $_CONF['DB_name']);
if (mysqli_connect_errno()) {
    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
 */
Ejemplo n.º 2
0
 * This requires that the teachers from SMS exist in my sms.
 *
 */
require '/usr/local/q3ait/config.php';
require $_CONF['webRoot'] . 'functionLib.php';
// Connect to DB
$db = new mysqli($_CONF['DB_host'], $_CONF['DB_user'], $_CONF['DB_pass'], $_CONF['DB_name']);
if (mysqli_connect_errno()) {
    die("There was an error connecting to the database: " . mysqli_connect_error());
}
$schoolYears = get_school_years_list();
$currentSchoolYear = get_current_school_year();
$schoolYear = $schoolYears[$currentSchoolYear];
$msg = '';
$q3aitTeachers = make_assoc_array_from_sql(getCurrentTeachersForSMS(), 'email', 'my');
$smsTeachers = make_assoc_array_from_sql(getCurrentTeachersFromSMS(), 'username', 'ms');
$edCenters = make_assoc_array_from_sql(get_edCenters(), 'smsBuildingID', 'my');
$q3aitCourses = make_assoc_array_from_sql(getCoursesForSMS(), 'SectionID', 'my');
$smsCourses = make_assoc_array_from_sql(getCoursesFromSMS(), 'SectionID', 'ms');
$course = array('teacher_id' => '', 'course_name' => '', 'school_year_id' => '', 'isCore' => '', 'ed_center' => '', 'SectionID' => '');
foreach ($smsCourses as $SectionID => $courseInfo) {
    if ($courseInfo['TakesAttendance'] != 1) {
        continue;
    }
    $teacher_id = $q3aitTeachers[$smsTeachers[$courseInfo['username']]['email']]['user_id'];
    if (!$teacher_id) {
        continue;
    }
    $teacher_fname = $q3aitTeachers[$smsTeachers[$courseInfo['username']]['email']]['first_name'];
    $teacher_lname = $q3aitTeachers[$smsTeachers[$courseInfo['username']]['email']]['last_name'];
    if ($SectionID != '' && $courseInfo['username'] != '' && $courseInfo['BuildingID'] != '') {