/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/cms.php

  • Committer: Gustav Hatvigsson
  • Date: 2013-05-28 15:21:12 UTC
  • mfrom: (83.2.23 pvp)
  • Revision ID: gustav.hartvigsson@gmail.com-20130528152112-pn1d6h8o6udcia0b
merged  Bigestans:s changes.


* Moved login JS to bannermenu.js and removed login.js
* Removed deprecated login CSS and JS
* Fixed login functionality -- now shows validation errors directly in the login popup, works through ajax
* Added a nifty little icon to represent the disabled login hint button
* Removed temporary functions from cms controller: tempLogin(), tempLogout(), test()
* Cleaned up ajax.php and cms.php

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
                }
15
15
                
16
16
                /*
17
 
                 *Temporary function to be able to be logged in to reach the page
18
 
                 */
19
 
                public function tempLogin() {
20
 
                        $this->load->model('user');
21
 
                        $loginDetails = array(
22
 
                        'username' => 'tempTeacher',
23
 
                        'name' => 'tempFoo',
24
 
                        'usertype' => 'Teacher',
25
 
                        'ssn' => '0000',
26
 
                        'activeCourse' => 'DA525G');
27
 
                        $this->session->set_userdata('authenticated', $loginDetails);
28
 
                        redirect(base_url().'cms', 'refresh');
29
 
                }
30
 
                public function tempLogout() {
31
 
                        $this->load->model('user');
32
 
                        $this->session->unset_userdata('authenticated');
33
 
                        redirect(base_url().'home', 'refresh');
34
 
                }
35
 
                
36
 
                /*
37
17
                 *      This function runs when the user navigates directly to this controller
38
18
                 */
39
19
                public function index() {
46
26
                        }
47
27
                }               
48
28
                
49
 
                public function test(){
50
 
                        
51
 
                        $result = $this->admin_model->getStudentCourses("student");
52
 
                        foreach($result as $res) {
53
 
                                echo $res->courseID. ' - ';
54
 
                                echo $res->name;
55
 
                                echo "<br>";
56
 
                                
57
 
                        }
58
 
                        
59
 
                        //var_dump($result);
60
 
                }
61
 
                
62
 
                
63
29
                /*
64
30
                 *      This function draws the cms page.
65
31
                 */
67
33
                        $userName = $this->user->getUserName();
68
34
                        $userType = $this->user->getUserType();
69
35
                        $activeCourse = $this->user->getActiveCourse();
70
 
                        //Creates an array with all courses.
71
 
                        $courses = $this->admin_model->getCourses();
 
36
 
 
37
                        if($userName != "" && $userType == "Teacher") {
 
38
                                //Creates an array with all courses.
 
39
                                $courses = $this->admin_model->getCourses();
 
40
                        } elseif($userName != "" && $userType == "Student") {
 
41
                                $courses = $this->admin_model->getStudentCourses($userName);
 
42
                        } else {
 
43
                                $courses = $this->admin_model->getPublicCourses();
 
44
                        }
 
45
 
 
46
 
72
47
                        //Creates an array with all categories for active course
73
48
                        $categories = $this->admin_model->getCategories($activeCourse['courseID']);
74
49