1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php
Class examplesmodel extends CI_Model
{
/* Loads category names for menu */
function getTitles($user)
{
$this -> db -> select('Categories.categoryName, Categories.courseID');
$this -> db -> from('Categories');
$this -> db -> join('StudentCourseRegistrations', 'Categories.courseID = StudentCourseRegistrations.courseID');
$this -> db -> where('StudentCourseRegistrations.username', $user);
$this -> db -> order_by("orderNr", "asc");
/* $this -> db -> where('StudentCourseRegistrations.courseID', 'd1popcrn');
* Line is disabled for now because of testing purposes.
* Will be modified to be used with parameter in function.
*/
$query = $this -> db -> get();
return $query->result();
}
/* Loads categorys & subcategorys for body */
function getBody($categoryName)
{
$this -> db -> select('subCategoryName');
$this -> db -> from('SubCategories');
$this -> db -> where('categoryName', $categoryName);
$query = $this -> db -> get();
return $query->result();
}
/* Loads examples for categorys */
function getExamples($subCategoryName)
{
$this -> db -> select('exampleName');
$this -> db -> from('Examples');
$this -> db -> where('subCategoryName', $subCategoryName);
$query = $this -> db -> get();
return $query->result();
}
}
?>
|