Example #1
0
function getAttendanceByStudentByMonth($s, $m, $c)
{
    global $db;
    if ($m < 10) {
        $m = "0" . $m;
    }
    $syID = get_current_school_year();
    $schoolYears = get_school_years_list();
    $currentYear = $schoolYears[$syID];
    list($startYear, $endYear) = preg_split("/-/", $currentYear);
    if ($m > 8) {
        $y = $startYear;
    } else {
        $y = $endYear;
    }
    $sql = "\n        SELECT attendance.date, attendance.status, attendance.note, courses.course_name, users.first_name, users.last_name\n        FROM attendance, users, courses\n        WHERE attendance.date like '" . $y . "-" . $m . "%'\n            AND users.user_id=attendance.student_id\n            AND attendance.student_id=" . $s . "\n            AND courses.course_id=attendance.course_id\n            AND attendance.course_id=" . $c . "\n        ORDER by users.last_name, users.first_name";
    $result = $db->query($sql);
    return $result;
}
Example #2
0
<?php

$foo = "single";
// if on this page, only viewing single report
include "newProgressReports.php";
$currentDate = date("F j, Y", time() - 18000);
$schoolYears = get_school_years_list();
$schoolYear = $schoolYears[$_SESSION[$_CONF['sess_name'] . '_current_school_year']];
$assign_table = "";
$b = "";
$custom_scores = array();
$custom_scores = get_custom_scores($tid, $_SESSION[$_CONF['sess_name'] . '_current_school_year']);
//displayArray($custom_scores);
$cid = $_SESSION[$_CONF['sess_name'] . '_selected_class'];
$sid = $_SESSION[$_CONF['sess_name'] . '_selected_student'];
/*  This only works for teachers.  should move to teach_rep or stud_rep
        $tid = $_SESSION[$_CONF['sess_name'].'_myUID'];
    */
$reports = getReportForStudent($sid, $tid, $cid);
//$reports = $reportsResults;
if (count($reports)) {
    foreach ($reports as $id => $report) {
        $teacherName = $report['classInfo']['first_name'] . " " . $report['classInfo']['last_name'];
        /** Assignments Table **/
        $assign_table = "\n                <table class=\"grade_book_print\">\n                <tr class=\"grade_header\">\n                    <th>Date</a></th>\n                    <th>Assignment</th>\n                    <th>Category</th>\n                    <th>Score</th>\n                    <th>Weight</th>\n                    <th>Avg.</th>\n\n                </tr>";
        $rcv = 0;
        /** used for row shading **/
        //foreach($report['studentGrades'] as $gid=>$grade){
        foreach ($report['assignments'] as $grade) {
            $cat = $grade['category_name'];
            if ($rcv % 2) {
Example #3
0
/**
* This funciton will enroll a single student in all classes (terms) for a course.
* Need to decide how to deal with a student that drops out...
*
[SectionID] => 96420d9b-8bb7-4181-8922-ecb8238d72f0
[username] => mknichel
[tsn] => CTE-AIT - I
[BuildingID] => 13
[SchoolYear] => 2010-2011
[TakesAttendance] => 1
[isTeacher] => 1
[TGUID] => 9dfa30cd-d054-42ef-9c00-804faa2b2f5c
[STGUID] => f1504c04-9ecb-4ca8-b4a2-02b10f056461
[isActive] => 1
[FirstName] => Kyle
[LastName] => Porter
* @param array $regi
* @return array error {true/false} message string
*/
function OLD_registerStudentInCourse($regi)
{
    global $db;
    $terms = array();
    $today = strtotime(date('Y-m-d'));
    // ues to compare with terms...
    $schoolYearList = get_school_years_list();
    $schoolYearID = array_search($regi['SchoolYear'], $schoolYearList);
    $result = get_terms($schoolYearID, $regi['center_id'], 'term_ord');
    while ($row = $result->fetch_assoc()) {
        if ($today >= strtotime("-10 days", strtotime($row['term_start_date'])) && $today <= strtotime($row['term_end_date'])) {
            array_push($terms, $row['term_id']);
        }
    }
    $classes = get_classes_for_course($regi['course_id']);
    $message = '';
    while ($row = $classes->fetch_assoc()) {
        if (!in_array($row['term_id'], $terms)) {
            continue;
        }
        $error = false;
        $classID = $row['class_id'];
        $sql = "INSERT into student2class (class_id, user_id) VALUES(" . $row['class_id'] . "," . $regi['student_id'] . ")";
        $result = $db->query($sql);
        $errmsg = "Registering student {" . $regi['student_id'] . "} in class {" . $row['class_id'] . "}<br>\n";
        if (!$result) {
            $error = true;
            $errmsg .= "There was an error executing the query \n\"" . $sql . " \"\n around line " . __LINE__ . " in file " . __FILE__ . "<br>\n" . $db->error;
        } else {
            $sql2 = "SELECT assignments.assignment_id from assignments, categories, classes\r\n            WHERE assignments.category_id=categories.category_id AND categories.class_id=" . $row['class_id'];
            $result2 = $db->query($sql2);
            if (!$result2) {
                $error = true;
                $errmsg .= "There was an error executing the query \n\"" . $sql2 . " \"\n around line " . __LINE__ . " in file " . __FILE__ . "<br>\n" . $db->error;
            } else {
                while ($row2 = $result2->fetch_assoc()) {
                    $sql3 = "INSERT into grades (student_id, assignment_id) VALUES(" . $regi['student_id'] . "," . $row2['assignment_id'] . ")<br>\n";
                    $result3 = $db->query($sql3);
                }
            }
        }
        if ($error) {
            email_admin('Q3AIT.ORG ERROR! Problem registering students in classes.', $errmsg);
        }
        $message .= $errmsg;
    }
    return array('error' => $error, 'message' => $message);
}
Example #4
0
     $result = queryMSsql($sql2);
 }
 /**
  * ==========  Grades ==========
  */
 if (isset($_POST['addGradeComments'])) {
     /**
      * Need to insert STGUID, SectionID, Comment, SchoolYear, classid
      */
     $q3aitStudents = make_assoc_array_from_sql(getCurrentStudentsForSMS(), 'user_id', 'my');
     $stguid = $q3aitStudents[$_POST['student_id']]['STGUID'];
     $ci = get_class_info($_POST['class_id']);
     $classInfo = $ci->fetch_assoc();
     $SectionID = $classInfo['SectionID'];
     $schoolYearID = get_current_school_year();
     $schoolYearList = get_school_years_list();
     $schoolYear = $schoolYearList[$schoolYearID];
     $smsClassInfo = getClassInfoFromSectionID($SectionID);
     $classID = $smsClassInfo['CLASSID'];
     /**
      * Now for Q3AIT DB...
      */
     /**
             $c = $_POST['class_id'];
             $s = $_POST['student_id'];
             $g1 = $g2 = makeSQLsafe($_POST['gradeComment']);
             $sql = "INSERT INTO comments (class_id, student_id, gradeComment)
                VALUES(".$c.",".$s.",'".$g1."')
                 ON DUPLICATE KEY
                    UPDATE gradeComment='".$g2."'";
             print $sql;