function remainingCourses()
 {
     $db = new DatabaseConnector();
     $return = [];
     $stmt = "SELECT CourseInfo.courseID, CourseInfo.courseName, CourseInfo.credits, StudentCourse.weight, StudentCourse.relevance FROM StudentCourse INNER JOIN CourseInfo ON StudentCourse.courseInfoID = CourseInfo.courseInfoID WHERE userID = ? AND (grade = 'IP' OR grade = 'ND')";
     $params = array($this->userID);
     $output = $db->select($stmt, $params);
     if (count($output) == 0) {
         $this->log->toLog(2, __METHOD__, "No course information available");
         echo json_encode([]);
         return;
     }
     for ($i = 0, $c = count($output); $i < $c; $i++) {
         if ($output[$i][3] == "") {
             $this->log->toLog(3, __METHOD__, "weight is null");
         } else {
             if ($output[$i][4] == "") {
                 $this->log->toLog(3, __METHOD__, "relevance is null");
             }
         }
         $courseID = $output[$i][0];
         $courseName = $output[$i][1];
         $credits = $output[$i][2];
         $courseWeight = $output[$i][3];
         $courseRelevance = $output[$i][4];
         array_push($return, array($courseID, $courseName, $credits, $courseWeight, $courseRelevance));
     }
     echo json_encode($return);
     return $return;
 }
 public function getAllCoursesNeeded()
 {
     $dbc = new DatabaseConnector();
     $params = array($this->userID);
     $courses = $dbc->select("SELECT DISTINCT CourseInfo.courseID, CourseInfo.credits, StudentCourse.weight,\n          StudentCourse.relevance, StudentCourse.studentCourseID FROM StudentCourse INNER JOIN\n          CourseInfo ON CourseInfo.courseInfoID = StudentCourse.courseInfoID WHERE StudentCourse.userID = ?\n          and grade = 'ND'", $params);
     $output = array();
     foreach ($courses as $course) {
         $this->log->toLog(0, __METHOD__, "courseID: {$course['0']},\n            credits: {$course['1']}, weight: {$course['2']}, relevance: {$course['3']}, id: {$course['4']},");
         array_push($output, array('courseID' => $course[0], 'credits' => $course[1], 'weight' => $course[2], 'relevance' => $course[3], 'id' => $course[4]));
     }
     echo json_encode($output);
 }
 function getGrades($assessment, $course)
 {
     $db = new DatabaseConnector();
     $return = [];
     $stmt = "SELECT grade FROM Assessment WHERE assessmentTypeID in (select assessmentTypeID FROM AssessmentType WHERE AssessmentName = ?) AND studentCourseID in (SELECT studentCourseID FROM StudentCourse WHERE grade = 'IP' and userID = ? AND courseInfoID in (select courseInfoID FROM CourseInfo WHERE courseID = ?))";
     $params = array($assessment, $this->userID, $course);
     $output = $db->select($stmt, $params);
     if (count($output) == 0) {
         $this->log->toLog(2, __METHOD__, "No grades returned form assessment");
         echo json_encode([]);
         return $return;
     }
     $index = 1;
     for ($i = 0, $c = count($output); $i < $c; $i++) {
         $grades = $output[$i][0];
         $this->log->toLog(0, __METHOD__, "Grade: {$grades}");
         array_push($return, array("Grade" . $index, $grades));
         $index++;
     }
     echo json_encode($return);
     return $return;
 }
 function test005()
 {
     $sc = new SettingsController(12, 'newuser20');
     $sc->importReq('nursing.xml');
     $db = new DatabaseConnector();
     $params = array(5);
     $buckets = $db->select("Select description from MajorBucket Where majorID = ?", $params);
     $output = array();
     $b = array();
     foreach ($buckets as $bucket) {
         array_push($b, $bucket[0]);
     }
     array_push($output, $b);
     $courses = $db->select("SELECT CourseInfo.courseID FROM CourseInfo\n          INNER JOIN MajorBucketRequiredCourses ON MajorBucketRequiredCourses.courseInfoID = CourseInfo.courseInfoID\n          WHERE MajorBucketRequiredCourses.bucketID IN (SELECT bucketID FROM MajorBucket WHERE majorID = ?)", $params);
     $c = array();
     foreach ($courses as $course) {
         array_push($c, $course[0]);
     }
     array_push($output, $c);
     $expected = [["Chemistry & Lab", "Human Anatomy & Lab", "Human Growth & Development", "Human Physiology & Lab", "Intro to Ethics", "Intro to Psychology", "Junior 1: Semester 1", "Junior 2: Semester 2", "Junior 2: Semester 3", "Microbiology & Lab", "Nursing Core", "Nutrition", "Prerequisites", "Senior 3: Semester 1", "Senior 4: Semester 2", "Statistics"], ["ZOO3731", "ZOO3731L", "PCB2099", "PCB2099L", "MCB2000", "MCB2000L", "CHM1045L", "CHM1045", "STA2023", "HUN2201", "DEP2000", "PSY2012", "PHI2600", "NUR3029", "NUR3029C", "NUR3029L", "NUR3125", "NUR3066C", "NUR3226", "NUR3226L", "NUR3145", "NUR3666", "NSP3801", "NUR3821", "NUR3227", "NUR3227L", "NUR4455", "NUR4455L", "NUR3685L", "NUR3535", "NUR3535L", "NUR4355", "NUR4355L", "NUR4686L", "NUR4667", "NUR4636C", "NUR4286", "NUR4940", "NUR4945L"]];
     $this->assertEquals($output, $expected);
 }
 function currentCourses()
 {
     $db = new DatabaseConnector();
     $return = [];
     $stmt = "SELECT CourseInfo.courseID, CourseInfo.courseName, CourseInfo.credits, StudentCourse.weight, StudentCourse.relevance FROM StudentCourse INNER JOIN CourseInfo ON StudentCourse.courseInfoID = CourseInfo.courseInfoID WHERE grade = 'IP' AND userID = ? ";
     $params = array($this->userID);
     $output = $db->select($stmt, $params);
     if (count($output) == 0) {
         $this->log->toLog(2, __METHOD__, "No current course information");
         echo json_encode([]);
         return;
     }
     for ($i = 0, $c = count($output); $i < $c; $i++) {
         if ($output[$i][3] == "") {
             $this->log->toLog(3, __METHOD__, "weight is null");
         }
         if ($output[$i][4] == "") {
             $this->log->toLog(3, __METHOD__, "relevance is null");
         }
         $courseID = $output[$i][0];
         $courseName = $output[$i][1];
         $credits = $output[$i][2];
         $courseWeight = $output[$i][3];
         $courseRelevance = $output[$i][4];
         $this->log->toLog(0, __METHOD__, "Course ID: {$courseID}, Course Name: {$courseName}, Credits: {$credits}, Weight: {$courseWeight}, Relevance: {$courseRelevance}");
         array_push($return, array($courseID, $courseName, $credits, $courseWeight, $courseRelevance));
     }
     echo json_encode($return);
     return $return;
 }
 public function getStudentCourses($list)
 {
     $db = new DatabaseConnector();
     $params = array($list['id']);
     $courses = $db->select("SELECT courseID, courseName, grade, studentCourseID FROM CourseInfo INNER JOIN\n          StudentCourse on CourseInfo.courseInfoID = StudentCourse.courseInfoID WHERE userID = ?", $params);
     $output = array();
     foreach ($courses as $course) {
         array_push($output, array("courseID" => $course[1], "courseName" => $course[0], "grade" => $course[2], "id" => $course[3]));
         $this->log->toLog(0, __METHOD__, "student course: courseID: {$course['0']} grade: {$course['2']}");
     }
     echo json_encode($output);
 }