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