/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
		
83.2.3 by elof.bigestans at gmail
Working on functionality for managecourses
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
		
52.1.1 by b11johgu
Added controllers for examplepage, templatelayout.
22
		
23
		/*
24
		 *	This function outputs data: user password hint.
25
		 */
64.1.1 by b11johgu
ExamplesController:
26
		public function pwdhint() {
27
		$user = $this->input->post('hintPwd');
52.1.1 by b11johgu
Added controllers for examplepage, templatelayout.
28
			$data = array(
29
				'hint' => $this->user->getPasswordHint($user)
30
			);
31
			
32
			//Output JSON data
33
			echo json_encode($data);
34
		}
69.1.3 by Daniel Hermansson
Added ajax functionality for ladok parser
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
		}
52.1.1 by b11johgu
Added controllers for examplepage, templatelayout.
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
		}
64.1.1 by b11johgu
ExamplesController:
74
		
75
		public function categoryOrderDecrease(){
76
			$pwdOld = $this->input->post('currentPwd');
77
			$pwdNew = $this->input->post('newPwd');
78
		}
83.2.3 by elof.bigestans at gmail
Working on functionality for managecourses
79
80
		// Takes a course ID and sets the course to published (isHidden = 0)
81
		public function publishCourse($courseID) {
82
83
		}
84
85
		//Takes a course ID and sets the course to unpublished (isHidden = 1)
86
		public function unpublishCourse($courseID) {
87
			
88
		}
52.1.1 by b11johgu
Added controllers for examplepage, templatelayout.
89
	}
90
?>