<?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) {
} $b .= ">Date (descending)</option>\n <option value=\"assignments.due_date asc\""; if ($_SESSION[$_CONF['sess_name'] . '_gradebook_sortBy'] == "assignments.due_date asc") { $b .= " selected"; } $b .= ">Date (ascending)</option>\n <option value=\"categories.category_name\""; if ($_SESSION[$_CONF['sess_name'] . '_gradebook_sortBy'] == "categories.category_name") { $b .= " selected"; $order_by .= ",assignments.due_date asc"; } $b .= ">Category Name</option>\n </select> \n </form>\n </center>"; $main .= make_box($t, $b, $bc) . "<br />"; $bc = ""; if ($classID != -1) { $header .= "\n\t<script type=\"text/javascript\" src=\"js/greybox/greybox.js\"></script>\n\t<link href=\"js/greybox/greybox.css\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />\n\t<script type=\"text/javascript\">\n\t\t\$(document).ready(function(){\n\t\t\t\$(\".gradeBookStudents tr:even\").addClass(\"alt\");\n\t\t\t\$(\".gradeBookGrades tr:even\").addClass(\"alt\");\n\t\t\t\$(\"tr\").eq(0).removeClass(\"alt\");\n\t\t\t\$(\"tr\").eq(1).removeClass(\"alt\");\n\t\t\t\n\t\t\t\$(\".grade_book tr.student\").mouseover(function() {\n\t\t\t\t//\$(this).addClass(\"over\");\n\t\t\t});\n\t\t\t\$(\".grade_book tr.student\").mouseout(function() {\n\t\t\t\t//\$(this).removeClass(\"over\");\n\t\t\t});\n\t\t\t\$(\"tr.gradeBookStudentRowGrades\").click(function() {\n\t\t\t\t\$(this).closest(\"tr\").siblings().removeClass(\"clicked\");\n\t\t\t\t\$(this).addClass(\"clicked\");\n\t\t\t});\n\t\t});\n\tvar scoresArray = new Array()\t\t\n\tfunction init_scores(){\n"; $result = get_custom_scores($_SESSION[$_CONF['sess_name'] . '_myUID'], $_SESSION[$_CONF['sess_name'] . '_current_school_year']); foreach ($result as $code => $score) { $header .= "\n\t\t\t\tscoresArray['" . $code . "'] = \"" . $score['grade'] . "\""; } $header .= "\n\t}\n\tfunction notDefined(score, custom_scores){\n\t\terr = \"\";\n\t\tfor(var key in custom_scores){\n\t\t\tif (!custom_scores.hasOwnProperty(key)){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(key == score) \n\t\t\t\t\treturn false;\n\t\t\t\telse\n\t\t\t\t\terr += key + \" : \";\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\tfunction validate_score(theScore, maxScore, oldScore){\n\t\terr = \"\";\n\t\tif (theScore.value.match(/[A-Za-z]/)) { str=true; } else { str = false; }\n\t\tif(str){\n\t\t\tif(notDefined(theScore.value, scoresArray)){\n\t\t\t\terr = \"You have not defined that special { \"+ theScore.value +\" }score yet.\";\n\t\t\t\ttheScore.value=oldScore;\n\t\t\t\ttheScore.style.background = \"Yellow\";\n\t\t\t\ttheScore.focus();\n\t\t\t\talert(err);\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tif(theScore.value < 0){\n\t\t\t\terr = \"The score cannot be less than 0.\";\n\t\t\t\ttheScore.value='';\n\t\t\t\ttheScore.style.background = \"Yellow\";\n\t\t\t\ttheScore.focus();\n\t\t\t\talert(err);\n\t\t\t}\n\t\t\telse if(theScore.value > maxScore){\n\t\t\t\terr = \"Are you sure this is extra credit?\";\n\t\t\t\tvar ans = confirm(err);\n\t\t\t\tif(ans){\n\t\t\t\t\ttheScore.style.background = \"White\";\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\ttheScore.style.background = \"Yellow\";\n\t\t\t\t\ttheScore.value = oldScore;\n\t\t\t\t\ttheScore.focus();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\twindow.onload = init_scores;\n\t</script>"; $header .= "\n <script type=\"text/javascript\">\n jQuery(function(\$){\n \$('#myGradebook').protectData();\n \$.protectData.message = \"YOU HAVE MADE CHANGES TO YOUR GRADEBOOK THAT ARE NOT SAVED!\\n Click Leave This Page to loose changes \\n Click Stay On This Page to save (then submit the form)\\n\";\n \$.protectData.stateChangeCallback = function(isProtected){};\n });\n </script>\n <script type=\"text/javascript\" src=\"js/greybox/greybox.js\"></script>\n <link href=\"js/greybox/greybox.css\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />\n <script type=\"text/javascript\">\n var GB_ANIMATION = true;\n \$(document).ready(function(){\n \$(\"a.greybox\").click(function(){\n var t = this.title || \$(this).text() || this.href;\n GB_show(t,this.href,600,1000);\n return false;\n })\n });\n </script>\n <style>\n #greybox {\n display:none;\n background:#000;\n position:fixed;\n left:0;\n top:0;\n width:100%;\n height:100%;\n opacity:.5;\n z-index:9000;\n }\n .popup{\n display:none;\n background:#fff;\n padding:20px;\n border:2px solid #ddd;\n float:left;\n font-size:1.2em;\n position:fixed;\n top:50%;\n left:50%;\n z-index:9999;\n border-radius:10px;\n -moz-border-radius:10px;\n -webkit-border-radius:10px;\n box-shadow: 0px 0px 20px #000;\n -moz-box-shadow: 0px 0px 20px #000;\n -webkit-box-shadow: 0px 0px 20px #000;\n }\n </style>"; $t = "Teacher Gradebook for " . $_SESSION[$_CONF['sess_name'] . '_myfName'] . " " . $_SESSION[$_CONF['sess_name'] . '_mylName']; $b = "<center><span style=\"color:red\">NOTE: A red grade means there is a comment for that grade.</span><br />Mouseover the grade and a tooltip will pop-up and display the comment.</center>"; $sql = "SELECT courses.course_name, terms.term_name \n\t\t\t\tFROM courses, classes,terms \n\t\t\t\tWHERE class_id=" . $classID . "\n\t\t\t\t\tAND courses.course_id=classes.course_id\n\t\t\t\t\tAND terms.term_id=classes.term_id"; $result = $db->query($sql); $row = $result->fetch_assoc(); $className = $row['class_name']; $termName = $row['term_name']; /** Now lets retrieve the grades from the gradebook**/ $sql1 = "\n\t\t\t\tSELECT grades.assignment_id, grades.student_id, grades.raw_score, grades.comment\n\t\t\t\tFROM grades\n\t\t\t\tJOIN assignments USING (assignment_id)\n\t\t\t\tJOIN categories USING (category_id)\n\t\t\t\tJOIN classes USING (class_id)\n\t\t\t\tJOIN courses USING (course_id)\n\t\t\t\tJOIN users ON user_id = " . $_SESSION[$_CONF['sess_name'] . '_myUID'] . "\n\t\t\t\tWHERE classes.class_id=" . $classID . "\n\t\t\t\t\tAND courses.course_id=classes.course_id"; $result1 = $db->query($sql1);