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