/lenasys/trunk

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