/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/application/models/examplesmodel.php

  • Committer: Gustav Hatvigsson
  • Date: 2013-05-03 12:03:33 UTC
  • mfrom: (52.1.1 lenasys)
  • Revision ID: gustav.hartvigsson@gmail.com-20130503120333-pps6aq9mlm3weawx
Merged the changes from the implementation team: - Added examplespage.
- Added functions to header.
- Added interactions with database.
- Added ajax controller for user settings.
- Logged in page updated with links.
- Added template layout controller.
and so forth
General changes in Codeigniter.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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