1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
3
class Ajax extends CI_Controller {
7
function __construct() {
10
//Load required library
11
$this->load->model('user', '', TRUE);
15
* This function loads a popupview to be displayed, the argument is the name of the popupview
17
public function popup($popupName) {
18
$this->load->view('popup/'.$popupName);
22
* This function outputs data: user password hint.
24
public function pwdhint() {
25
$user = $this->input->post('hintPwd');
27
'hint' => $this->user->getPasswordHint($user)
31
echo json_encode($data);
35
* This function outputs data: user password hint.
37
public function ladok() {
38
$string = $this->input->post('data');
40
$parsedArray = $this->user->parseLadok($string);
42
if ($parsedArray === FALSE) {
43
$data = array('status' => FALSE);
45
//Add users to database
46
foreach ($parsedArray as $key => $value) {
47
$this->user->addUser($parsedArray[$key]['username'], $parsedArray[$key]['firstname'] . ' ' . $parsedArray[$key]['lastname'], $parsedArray[$key]['ssn'], $parsedArray[$key]['ssn'], 'Student', 'Default', $parsedArray[$key]['email']);
50
$data = array('status' => TRUE);
54
echo json_encode($data);
58
* This function outputs data: user password hint.
60
public function pwdchange() {
61
$pwdOld = $this->input->post('currentPwd');
62
$pwdNew = $this->input->post('newPwd');
63
$pwdHint = $this->input->post('hintPwd');
66
'status' => $this->user->changePassword($pwdOld, $pwdNew, $pwdHint)
70
echo json_encode($data);
73
public function categoryOrderDecrease(){
74
$pwdOld = $this->input->post('currentPwd');
75
$pwdNew = $this->input->post('newPwd');
78
// Takes a course ID and sets the course to published (isHidden = 0)
79
public function publishCourse($courseID) {
80
$this->load->model('user');
81
$this->load->model('admin/admin_model');
83
if(!$this->user->isLoggedIn() || $this->user->getUserType() != "Teacher") {
84
$this->load->view('manageCoursesMessage', array('message' => 'You do not have access to this page'));
89
$this->admin_model->unsetCourseHidden($courseID);
92
//Takes a course ID and sets the course to unpublished (isHidden = 1)
93
public function unpublishCourse($courseID) {
94
$this->load->model('user');
95
$this->load->model('admin/admin_model');
97
if(!$this->user->isLoggedIn() || $this->user->getUserType() != "Teacher") {
98
$this->load->view('manageCoursesMessage', array('message' => 'You do not have access to this page'));
103
$this->admin_model->setCourseHidden($courseID);
b'\\ No newline at end of file'