/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/controllers/ExamplesController.php

  • Committer: b11johgu
  • Date: 2013-05-14 12:30:38 UTC
  • mto: This revision was merged to the branch mainline in revision 65.
  • Revision ID: b11johgu@student.his.se-20130514123038-rthxj3f34o32gpxy
ExamplesController:
- Added expand/collapse arrows for categories/subcategories.
- Added category positioning (incomplete).

more general changes made.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
                 * Ex. test_header will load test_header.css
10
10
                 */
11
11
                $this->load->library('session');
12
 
                $headData['list'] = array('headTag', 'header', 'examplesMenu', 'examplesBody');
13
 
                $this->load->view('headTag', $headData);
 
12
                $headTagData = array(
 
13
                        'cssFiles' => array('header', 'examplesMenu', 'examplesBody'),
 
14
                        'jsFiles' => array('header', 'examplesMenu', 'examplesBody', 'userControls')
 
15
                );
 
16
                $this->load->view('headTag', array('headTagData' => $headTagData));
14
17
                
15
18
                $this->load->helper('form');
16
19
                
17
20
                // Loading model to retrieve login data
18
21
                $this->load->model('user');
19
22
                $userInfo = array(
20
 
                        'userType' => $this->user->getUserType(),
 
23
                        'userType' => $this->user->getUserType(), // Loads different header for teacher/student
21
24
                        'userName' => $this->user->getUserName()
22
25
                );
23
26
                
31
34
                
32
35
                /* Loads categorydata into array */
33
36
                $query = $this->ExamplesModel->getTitles($userInfo['userName']);
34
 
                foreach ($query as $row)
 
37
                foreach ($query as $category)
35
38
                {
36
39
                        // Category
37
 
                        $query2 = $this->ExamplesModel->getBody($row->categoryName);
38
 
                        $allTitles[$row->categoryName] = array();
39
 
                        foreach ($query2 as $row2)
 
40
                        $query2 = $this->ExamplesModel->getBody($category->categoryName);
 
41
                        $allTitles[$category->categoryName.",".$category->courseID] = array();
 
42
                //      $allTitles[$category->categoryName] = array();
 
43
                //      $allTitles[$category->courseID] = array();
 
44
                                                foreach ($query2 as $subCategory)
40
45
                        {
41
46
                                // Subcategory
42
 
                                $query3 = $this->ExamplesModel->getExamples($row2->subCategoryName);
43
 
                                $allTitles[$row->categoryName][$row2->subCategoryName] = array();
44
 
                                foreach ($query3 as $row3)
 
47
                                $query3 = $this->ExamplesModel->getExamples($subCategory->subCategoryName);
 
48
                                $allTitles[$category->categoryName][$subCategory->subCategoryName] = array();
 
49
                                foreach ($query3 as $examples)
45
50
                                {
46
51
                                        //Examples
47
 
                                        $allTitles[$row->categoryName][$row2->subCategoryName][] = $row3->exampleName;
 
52
                                        $allTitles[$category->categoryName][$subCategory->subCategoryName][] = $examples->exampleName;
48
53
                                }
49
54
 
50
55
                        }
82
87
                }
83
88
        }
84
89
        
85
 
        
86
 
        /*
87
 
         *      This function draws the login form.
88
 
         */
89
 
        private function drawLoginForm($errors) {
90
 
                //Load required library
91
 
                $this->load->helper(array('form'));
92
 
                
93
 
                //Display the view
94
 
                $data['error'] = $errors;
95
 
                $headData['list'] = array('headTag', 'header', 'login_view');
96
 
                $this->load->view('headTag', $headData);
97
 
                $this->load->view('header');
98
 
                $this->load->view('login_view', $data);
99
 
        }
100
 
        
101
90
}
102
91
 
103
92
/* End of file ExamplesController.php */