11
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);
21
function showPopup($popupName) {
23
'cssFiles' => array('popup'),
24
'jsFiles' => array('login')
28
'userType' => $this->user->getUserType(), // Loads different header for teacher/student
29
'userName' => $this->user->getUserName()
32
// Loads head views, supplying CSS and JS data
33
$this->load->view('headTag', array('headTagData' => $headTagData));
35
$this->load->view('popup/'.$popupName);
39
* This function return TRUE if the user is logged in and FALSE otherwise.
41
public function isLoggedIn() {
42
if ($this->user->isLoggedIn()) {
51
16
* This function outputs data: user password hint.
53
18
public function pwdhint() {
54
$this->load->model('user');
55
if($this->input->post('username')) {
56
$username = $this->input->post('username');
58
'hint' => $this->user->getPasswordHint($username)
19
$user = $this->input->post('hintPwd');
21
'hint' => $this->user->getPasswordHint($user)
62
echo json_encode($data);
25
echo json_encode($data);
106
68
$pwdOld = $this->input->post('currentPwd');
107
69
$pwdNew = $this->input->post('newPwd');
110
// Takes a course ID and sets the course to published (isHidden = 0)
111
public function publishCourse($courseID) {
112
$this->load->model('user');
113
$this->load->model('admin/admin_model');
115
if(!$this->user->isLoggedIn() || $this->user->getUserType() != "Teacher") {
116
$this->load->view('manageCoursesMessage', array('message' => 'You do not have access to this page'));
117
echo "not logged in";
121
$this->admin_model->unsetCourseHidden($courseID);
124
//Takes a course ID and sets the course to unpublished (isHidden = 1)
125
public function unpublishCourse($courseID) {
126
$this->load->model('user');
127
$this->load->model('admin/admin_model');
129
if(!$this->user->isLoggedIn() || $this->user->getUserType() != "Teacher") {
130
$this->load->view('manageCoursesMessage', array('message' => 'You do not have access to this page'));
131
echo "not logged in";
135
$this->admin_model->setCourseHidden($courseID);
b'\\ No newline at end of file'