/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk
90.1.13 by a11emmjo
Changed so that cms-controller loads filetree (before known as examplesController, examplesBody, examplesMenu).
1
<?php
2
	Class filetree extends CI_Model
3
	{
4
		/*
5
		 *	Loads categories
6
		 */
7
		 function getCategories($activeCourse) {
8
			$this -> db -> select('categoryName');
9
			$this -> db -> from('Categories'); 
10
			$this -> db -> where('courseID', $activeCourse); 
11
12
			$query = $this -> db -> get();
13
			return $query->result();
14
		}
15
		 
16
		 /*
17
		 *	Loads subcategories
18
		 */
19
		 function getSubCategories($categoryName, $activeCourse) {
20
			$this -> db -> select('subCategoryName');
21
			$this -> db -> from('SubCategories'); 
22
			$this -> db -> where('categoryName', $categoryName); 
23
			$this -> db -> where('courseID', $activeCourse); 
24
25
			$query = $this -> db -> get();
26
			return $query->result();
27
		}
28
		
29
		/*
30
		 *	Loads examples
31
		 */
32
		 function getExamples($subCategoryName, $categoryName, $activeCourse) {
33
			$this -> db -> select('exampleName');
34
			$this -> db -> from('Examples'); 
35
			$this -> db -> where('subCategoryName', $subCategoryName); 
36
			$this -> db -> where('categoryName', $categoryName);
37
			$this -> db -> where('courseID', $activeCourse);
38
39
			$query = $this -> db -> get();
40
			return $query->result();
41
		}
42
		
43
		/*
44
		 *	Loads quizzes
45
		 */
46
		 function getQuizzes($subCategoryName, $categoryName, $activeCourse) {
47
			$this -> db -> select('quizNr');
48
			$this -> db -> from('Quizzes'); 
49
			$this -> db -> where('subCategoryName', $subCategoryName);
50
			$this -> db -> where('categoryName', $categoryName);
51
			$this -> db -> where('courseID', $activeCourse);
52
			
53
			$query = $this -> db -> get();
54
			return $query->result();
55
		}
56
		
57
		
58
		/* TODO: OLD STUFF BELOW! -------------------------------------------------------------------------------------------*/
59
		
60
		/* Loads category names for menu 
61
		function getTitles($user)
62
		{
63
			$this -> db -> select('Categories.categoryName, Categories.courseID');
64
			$this -> db -> from('Categories');
65
			$this -> db -> join('StudentCourseRegistrations', 'Categories.courseID = StudentCourseRegistrations.courseID'); 
66
			$this -> db -> where('StudentCourseRegistrations.username', $user); 
67
			$this -> db -> order_by("orderNr", "asc"); 
68
		/* 	$this -> db -> where('StudentCourseRegistrations.courseID', 'd1popcrn');  
69
		* 	Line is disabled for now because of testing purposes.
70
		*	Will be modified to be used with parameter in function.
71
		*//*
72
			
73
			$query = $this -> db -> get();
74
			return $query->result();
75
		}*/
76
		
77
		/* Loads categorys & subcategorys for body 
78
		function getBody($categoryName)
79
		{
80
			$this -> db -> select('subCategoryName');
81
			$this -> db -> from('SubCategories'); 
82
			$this -> db -> where('categoryName', $categoryName); 
83
84
			$query = $this -> db -> get();
85
			return $query->result();
86
87
		}*/
88
		
89
		/* Loads examples for categorys 
90
		function getExamples($subCategoryName)
91
		{
92
			$this -> db -> select('exampleName');
93
			$this -> db -> from('Examples'); 
94
			$this -> db -> where('subCategoryName', $subCategoryName); 
95
96
			$query = $this -> db -> get();
97
			return $query->result();
98
99
100
		}*/
101
	}
102
?>
103