12
12
$this->load->database();
15
/* Get all of the courses */
16
16
function getCourses() {
17
17
$this->db->order_by("name", "asc");
18
18
$query = $this->db->get('Courses');
19
19
return $query->result();
22
/* Get all the public courses */
23
function getPublicCourses() {
24
$this->db->from("Courses");
25
$this->db->where("isHidden","0");
26
$this->db->where("isPublic","1");
27
$query = $this->db->get();
28
return $query->result();
31
/* Get all the private courses for a student - If they are published and private*/
32
function getPrivateCourses($studentID) {
33
$this->db->from("Courses");
34
$this->db->join("StudentCourseRegistrations", "Courses.courseID = StudentCourseRegistrations.courseID");
35
$this->db->where("userName", $studentID);
36
$this->db->where("isPublic", "0");
37
$this->db->where("isHidden","0");
38
$query = $this->db->get();
39
return $query->result();
42
/* Get all the courses for a student, both private from getPrivateCourses(), and public from getPublicCourses() */
43
function getStudentCourses($studentID) {
44
$private = $this->getPrivateCourses($studentID);
45
$public = $this->getPublicCourses();
46
return array_merge($private, $public);
22
49
function setCourseHidden($courseID) {
23
50
$this->db->where("courseID", $courseID);