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

  • Committer: a11andoh
  • Date: 2013-05-24 11:28:43 UTC
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: a11andoh@student.his.se-20130524112843-360je7hu7q13r171
added the cms controller to load all content pages.
added first time registration controller to load the views for the registration
pages.
added and fixed temporarypages for the controllers 
and edited the models to be able to get active courses.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
2
 
 
3
        class Ajax extends CI_Controller {
 
4
                /*
 
5
                 *      Constructor
 
6
                 */
 
7
                function __construct() {
 
8
                        parent::__construct();
 
9
                        
 
10
                        //Load required library
 
11
                        $this->load->model('user', '', TRUE);
 
12
                }
 
13
                
 
14
                /*
 
15
                 *      This function loads a popupview to be displayed, the argument is the name of the popupview
 
16
                 */
 
17
                public function popup($popupName) {
 
18
                        $popup = $this->load->view('popup/'.$popupName, '', TRUE);
 
19
                        return $popup;
 
20
                }
 
21
                
 
22
                
 
23
                /*
 
24
                 *      This function outputs data: user password hint.
 
25
                 */
 
26
                public function pwdhint() {
 
27
                $user = $this->input->post('hintPwd');
 
28
                        $data = array(
 
29
                                'hint' => $this->user->getPasswordHint($user)
 
30
                        );
 
31
                        
 
32
                        //Output JSON data
 
33
                        echo json_encode($data);
 
34
                }
 
35
 
 
36
                /*
 
37
                 *      This function outputs data: user password hint.
 
38
                 */
 
39
                public function ladok() {
 
40
                        $string = $this->input->post('data');
 
41
                        
 
42
                        $parsedArray = $this->user->parseLadok($string);
 
43
                        
 
44
                        if ($parsedArray === FALSE) {
 
45
                                $data = array('status' => FALSE);                               
 
46
                        } else {
 
47
                                //Add users to database
 
48
                                foreach ($parsedArray as $key => $value) {
 
49
                                        $this->user->addUser($parsedArray[$key]['username'], $parsedArray[$key]['firstname'] . ' ' . $parsedArray[$key]['lastname'], $parsedArray[$key]['ssn'], $parsedArray[$key]['ssn'], 'Student', 'Default', $parsedArray[$key]['email']);
 
50
                                }
 
51
                        
 
52
                                $data = array('status' => TRUE);                        
 
53
                        }
 
54
                        
 
55
                        //Output JSON data
 
56
                        echo json_encode($data);
 
57
                }
 
58
                
 
59
                /*
 
60
                 *      This function outputs data: user password hint.
 
61
                 */
 
62
                public function pwdchange() {
 
63
                        $pwdOld = $this->input->post('currentPwd');
 
64
                        $pwdNew = $this->input->post('newPwd');
 
65
                        $pwdHint = $this->input->post('hintPwd');
 
66
                
 
67
                        $data = array(
 
68
                                'status' => $this->user->changePassword($pwdOld, $pwdNew, $pwdHint)
 
69
                        );
 
70
                        
 
71
                        //Output JSON data
 
72
                        echo json_encode($data);
 
73
                }
 
74
                
 
75
                public function categoryOrderDecrease(){
 
76
                        $pwdOld = $this->input->post('currentPwd');
 
77
                        $pwdNew = $this->input->post('newPwd');
 
78
                }
 
79
        }
 
80
?>
 
 
b'\\ No newline at end of file'