$term_id = $_POST['term_id']; $termName = $_POST['term_name']; $loc = array(); $year = date("y"); $download = false; if (isset($_POST['all'])) { $sql = "SELECT classes.class_id,courses.teacher_id,courses.course_name\n FROM classes,courses\n WHERE courses.teacher_id=" . $tid . "\n AND courses.school_year_id=" . $_SESSION[$_CONF['sess_name'] . '_current_school_year'] . " \n AND classes.term_id=" . $term_id . "\n AND courses.course_id=classes.course_id\n ORDER by courses.course_name"; $result = $db->query($sql); while ($row = $result->fetch_assoc()) { $loc[$row['class_id']] = $row['course_name']; } $filename = $year . "_" . $termName . "_" . $teacherName . "_ClassSummaries.pdf"; $download = true; } else { $cid = $_SESSION[$_CONF['sess_name'] . '_selected_class']; $result = get_class_info($cid); $row = $result->fetch_assoc(); $className = $row['course_name']; $loc[$cid] = $className; $filename = $year . "_" . $className . "_" . $termName . "_" . $teacherName . "_ClassSummary.pdf"; } $currentDate = date("F j, Y", time() - 18000); /** Get the list of categories for this class **/ /** Changing this file to be a PDF rather than an HTML page... More efficient... **/ /** NOW FOR THE PDF STUFF **/ /** @ 72dpi, 11 X 8.5 is (792 X 612) **/ /** with a margin of 36 pts or 1/2 inch **/ /** Starting Coords **/ /** Some defaults...**/
/** * Remove a class along with any data associated with it. * * @param int $cid * @return Array {txt, num} */ function remove_class($cid) { global $_CONF; global $db; $err['num'] = 0; $err['txt'] = ""; $class_info = get_class_info($cid); //courses.course_name, classes.term_id, terms.term_name, users.first_name, users.last_name, users.user_id $class = $class_info->fetch_assoc(); /** Delete the grades from the grade table first **/ $sql = "DELETE from grades where assignment_id IN (\r\n\t\t\t SELECT assignment_id\r\n\t\t\t\tFROM assignments,categories\r\n\t\t\t\tWHERE assignments.category_id=categories.category_id\r\n\t\t\t\tAND categories.class_id=" . $cid . ")"; $result = $db->query($sql); if ($db->errno != 0) { $err['txt'] .= $db->errno . " : " . $db->error . " : " . $sql . "<br />"; $err['num']++; } /** Delete the assignments next **/ $sql = "DELETE from assignments where category_id IN(\r\n \t\t\t\tSELECT category_id\r\n\t\t\t\tFROM cateogries\r\n\t\t\t\tWHERE categories.class_id=" . $cid . ")"; if ($db->errno != 0) { $err['txt'] .= $db->errno . " : " . $db->error . " : " . $sql . "<br />"; $err['num']++; } /** Delete the categories next **/ $sql = "DELETE from categories where class_id=" . $cid; $result = $db->query($sql); if ($db->errno != 0) { $err['txt'] .= $db->errno . " : " . $db->error . " : " . $sql . "<br />"; $err['num']++; } /** remove the students schedules for this class **/ $sql = "DELETE from student2class where class_id=" . $cid; $result = $db->query($sql); if ($db->errno != 0) { $err['txt'] .= $db->errno . " : " . $db->error . " : " . $sql . "<br />"; $err['num']++; } /** This should be handled by the delete course routine. Only need to remove the entry from download2course if the course is removed. $sql = "SELECT filename from download where class_id=".$cid; $result = $db->query($sql); if($result->num_rows > 0){ while($row = $result->fetch_assoc()){ $name = $row['filename']; $file = $_CONF['path_to_config']."/downloads/".$name; if(!unlink($file)){ $err['txt'] .= "Error deleting file".$file."<br />"; $err['num']++; } } } $sql = "DELETE from download where class_id=".$cid; $result = $db->query($sql);SELECT * FROM `courses` WHERE 1 if($db->errno!= 0){ $err['txt'] .= $db->errno." : ".$db->error." : ".$sql."<br />"; $err['num']++; } **/ /** Remove the teacher_page2course links for this class **/ $sql = "DELETE from teacher_page2course where class_id=" . $cid; $result = $db->query($sql); /** Downloads not associated with a class ONLY a course **/ /** DropBox not associated with a class only users **/ /** teacher_backup_gradebook folders need deleting for this class **/ $path = $_CONF['configPath'] . "teacher_backups/" . $_SESSION[$_CONF['sess_name'] . '_myCenters'][$_SESSION[$_CONF['sess_name'] . '_myCenter']]['short_name'] . "/" . $_SESSION[$_CONF['sess_name'] . '_myUname'] . "/"; del_dir($path . $class['course_name'] . "/" . $class['term_name']); /** Finally delete the class **/ $sql = "DELETE from classes where class_id=" . $cid; $result = $db->query($sql); if ($db->errno != 0) { $err['txt'] .= $db->errno . " : " . $db->error . " : " . $sql . "<br />"; $err['num']++; } return $err; }
$currentDate = date("F j, Y", time() - 18000); /** Get the list of categories for this class **/ $cat_names_array = array(); /** holds the names of the categories for this class **/ $info = array(); /** used to hold grade info like category weight and grade **/ $cat_weight_sum = 0; /** holds category weight sum **/ $my_cat_avg_sum = 0; /** holds my category avg's sum **/ $custom_scores = array(); $custom_scores = get_custom_scores($tid, $_SESSION[$_CONF['sess_name'] . '_current_school_year']); $schoolYears = get_school_years_list(); $schoolYear = $schoolYears[$_SESSION[$_CONF['sess_name'] . '_current_school_year']]; //displayArray($custom_scores); $classinfo = get_class_info($cid); $row = $classinfo->fetch_assoc(); $courseID = $row['course_id']; $wblHours = round(get_wbl_hours($sid, $courseID), 2); $sql = "SELECT * from categories where class_id=" . $cid; $result = $db->query($sql); if ($result) { while ($row = $result->fetch_assoc()) { ${$row['category_name']} = array(); array_push($cat_names_array, $row['category_name']); //$MAX = $row['category_name']."_max_points"; //$info[$MAX] = 0; //$USER = $row['category_name']."_user_points"; //$info[$USER] = 0; $WEIGHT = $row['category_name'] . "_weight"; $info[$WEIGHT] = $row['category_weight'];
if ($rcv % 2) { $rowclass = "row_odd"; $rcv++; } else { $rowclass = "row_even"; $rcv++; } $tbody .= "<tr class=" . $rowclass . "><td class=\"student_name\"><span style=white-space:nowrap>" . $sname . "</span></td>\n"; /** classes_title = $termName-$className **/ $termCount = 0; $avgSum = 0; // holds proportional value of term average for final average $percentSum = 0; foreach ($classes as $class_id => $class_title) { $reports = getReportForStudent($sid, $tid, $class_id); $classInfo = make_assoc_array_from_sql(get_class_info($class_id), "class_id", "my"); $termID = $classInfo[$class_id]['term_id']; if (!empty($reports)) { $termCount++; if ($reports[$sid]['overallCalculatedAverage'] > 0) { $termWeight = $terms[$termID]['term_weight']; $avgSum += $reports[$sid]['overallCalculatedAverage'] * ($termWeight / 100); $percentSum += $termWeight; } if ($reports[$sid]['locked']['hasLocked']) { $tbody .= "<td class=\"cat_info\"><span style=\"color:red\">" . $reports[$sid]['locked']['lockedGrade'] . "</span></td>\n"; } else { $tbody .= "<td class=\"cat_info\">" . $reports[$sid]['overallCalculatedAverage'] . "</td>\n"; } } }
<?php $summary_table = ""; include "newProgressReports.php"; $classList = $classArray; $tid = $_SESSION[$_CONF['sess_name'] . '_myUID']; // loop over array just in case I wish to display more than a single class at some point like in multi-class reports foreach ($classList as $class => $className) { $result = get_class_info($class); $row = $result->fetch_assoc(); $term_id = $row['term_id']; $className = $row['course_name']; $termName = $row['term_name']; $teacherName = $row['first_name'] . " " . $row['last_name']; $cat_names_array = array(); /** holds the names of the categories for this class **/ $sql = "SELECT * from categories where class_id=" . $class; $result = $db->query($sql); $catcount = $result->num_rows; while ($row = $result->fetch_assoc()) { $cat_names_array[$row['category_name']] = $row['category_weight']; } $currentDate = date("F j, Y", time() - 18000); /** Build the table header **/ $summary_table .= "<table class=\"grade_book_print\">"; $summary_table .= "<tr class=\"grade_header\"><td colspan=" . ($catcount + 2) . ">" . $termName . " - " . $className . " - " . $teacherName . "</td></tr>"; $summary_table .= "<tr class=\"grade_header\">"; $summary_table .= "<td>Students</td>"; foreach ($cat_names_array as $cat => $weight) { $summary_table .= "<td valign=top align=center>"; $summary_table .= $cat . "<br />" . $weight . "%</td>";