/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 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
		/*
16
		 *	This function outputs data: user password hint.
17
		 */
64.1.1 by b11johgu
ExamplesController:
18
		public function pwdhint() {
19
		$user = $this->input->post('hintPwd');
52.1.1 by b11johgu
Added controllers for examplepage, templatelayout.
20
			$data = array(
21
				'hint' => $this->user->getPasswordHint($user)
22
			);
23
			
24
			//Output JSON data
25
			echo json_encode($data);
26
		}
69.1.3 by Daniel Hermansson
Added ajax functionality for ladok parser
27
28
		/*
29
		 *	This function outputs data: user password hint.
30
		 */
31
		public function ladok() {
32
			$string = $this->input->post('data');
33
			
34
			$parsedArray = $this->user->parseLadok($string);
35
			
36
			if ($parsedArray === FALSE) {
37
				$data = array('status' => FALSE);				
38
			} else {
39
				//Add users to database
40
				foreach ($parsedArray as $key => $value) {
41
					$this->user->addUser($parsedArray[$key]['username'], $parsedArray[$key]['firstname'] . ' ' . $parsedArray[$key]['lastname'], $parsedArray[$key]['ssn'], $parsedArray[$key]['ssn'], 'Student', 'Default', $parsedArray[$key]['email']);
42
				}
43
			
44
				$data = array('status' => TRUE);			
45
			}
46
			
47
			//Output JSON data
48
			echo json_encode($data);
49
		}
52.1.1 by b11johgu
Added controllers for examplepage, templatelayout.
50
		
51
		/*
52
		 *	This function outputs data: user password hint.
53
		 */
54
		public function pwdchange() {
55
			$pwdOld = $this->input->post('currentPwd');
56
			$pwdNew = $this->input->post('newPwd');
57
			$pwdHint = $this->input->post('hintPwd');
58
		
59
			$data = array(
60
				'status' => $this->user->changePassword($pwdOld, $pwdNew, $pwdHint)
61
			);
62
			
63
			//Output JSON data
64
			echo json_encode($data);
65
		}
64.1.1 by b11johgu
ExamplesController:
66
		
67
		public function categoryOrderDecrease(){
68
			$pwdOld = $this->input->post('currentPwd');
69
			$pwdNew = $this->input->post('newPwd');
70
		}
52.1.1 by b11johgu
Added controllers for examplepage, templatelayout.
71
	}
72
?>