function compareCourses($c1, $c2, $progID) { $course1 = getCourseForID($c1); $course2 = getCourseForID($c2); if ($course1->reqForProgram[$progID] == 'R' && $course2->reqForProgram[$progID] != 'R') { return -1; } else { if ($course2->reqForProgram[$progID] == 'R' && $course1->reqForProgram[$progID] != 'R') { return 1; } else { return strcmp($course1->courseID, $course2->courseID); } } }
require_once "include/header.php"; ?> <!-----------------------------------------------------------> <!-- Including required scripts and styles for the tabbing --> <script type="text/javascript" src="tabber.js"></script> <link rel="stylesheet" href="tab.css" TYPE="text/css" MEDIA="screen"> <!-----------------------------------------------------------> <?php require_once "../src/include.php"; if (!isset($_GET['course'])) { die("ERROR: Course name not given."); } $courseID = $_GET['course']; $course = getCourseForID($courseID); // 0 = authorized // 1 = wrong pw // 2 = no pw given if (!isset($_POST['pw'])) { $authorized = 2; } else { if (!validPwForCourse($courseID, $_POST['pw'])) { $authorized = 1; } else { $authorized = 0; } } function formattedDate($time) { if ($time == "") {
break; case '8': $error = 'File upload stopped by extension'; break; case '999': default: $error = 'No error code avaiable'; } } elseif (empty($_FILES[$fileElementName]['tmp_name']) || $_FILES[$fileElementName]['tmp_name'] == 'none') { $error = '$_FILES[$fileElementName][\'tmp_name\']:' . $_FILES[$fileElementName]['tmp_name']; } else { $fileName = time() . $_FILES[$fileElementName]['name']; // save path, relative to this file $filePath = "../../data/courses/" . $_GET['course'] . "/" . $fileName; move_uploaded_file($_FILES[$fileElementName]['tmp_name'], $filePath); $course = getCourseForID($_GET['course']); $assignments = $course->sampleAssignments; $assignmentKey = $_GET['assignment_type'] . $_GET['assignment_number']; $assignment = $assignments[$assignmentKey]; if ($assignment == null) { $assignment = new SampleAssignment(); $assignment->type = $_GET['assignment_type']; $assignment->number = $_GET['assignment_number']; } if ($_GET['file_type'] == 'assignment') { $assignment->assignmentFileName = $fileName; } else { if ($_GET['file_type'] == 'A') { $assignment->sampleFileNames[0] = $fileName; } else { if ($_GET['file_type'] == 'B') {
function getCoursesForOutcomes($outcomes) { $matches = array(); foreach (getPrograms() as $program) { $programID = $program['short']; foreach (getCourseIDsForProgramID($programID) as $courseID) { $course = getCourseForID($courseID); if ($course->matchesOutcomes($outcomes)) { $matches[] = $course; } } } return $matches; }
<?php require_once '../../../src/include.php'; if (!isset($_POST['json'])) { die("ERROR: No data was sent from the client"); } $json = str_replace('\\r\\n', "\n", $_POST['json']); $json = str_replace('\\', '', $json); $json = str_replace("\n", '\\n', $json); $data = json_decode($json, true); $course = getCourseForID($data['course_id']); $course->instructors = $data['course_instructor']; // Course instructor information $course->description = $data['course_description']; $course->courseLearningOutcomes = array_filter($data['course_learning_outcomes'], "isNonEmptyString"); $course->textbook = $data['textbook']; $course->topics = $data['topics']; $assignments = array(); // save assignment info (tab 2) for ($i = 0; $i < $data['assignment_row_count']; $i++) { // If an assignment row is deleted, these items won't be posted, so ignore them if (!isset($data['type_' . $i])) { continue; } $type = $data['type_' . $i]; $number = $data['number_' . $i]; $assignmentKey = $type . $number; $assignment = new Assignment(); $assignment->type = $type; $assignment->number = $number; $assignment->learningOutcomes = array();