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

  • Committer: a11andoh
  • Date: 2013-05-28 09:57:37 UTC
  • mto: This revision was merged to the branch mainline in revision 115.
  • Revision ID: a11andoh@student.his.se-20130528095737-6qt9w0rg0rb6mqib
corrected a wrong in the css file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
2
 
3
3
class ViewStudentsController extends CI_Controller {
4
4
 
6
6
                $this->load->model('user');
7
7
                $this->load->model('admin/admin_model');
8
8
 
9
 
                if(!$this->user->isLoggedIn() || $this->user->getUserType() != "Teacher") {
10
 
                        echo "You do not have access to this page.";
11
 
                        return;
12
 
                }
13
 
 
14
9
                // NOTE: viewstudents is a deprecated model. Should eventually be replaced by a proper model
15
10
                $this->load->model('viewstudents');
16
11
 
31
26
                $this->load->view('viewStudentsBody', array('students' => $students));
32
27
        }
33
28
 
34
 
        public function editStudentDetails() {
 
29
        public function index_old()
 
30
        {
 
31
                /* headData manages the <head>-tag and loads corresponding CSS.
 
32
                 * The views that are entered will load CSS with same name.
 
33
                 * Ex. test_header will load test_header.css
 
34
                 */
 
35
                $this->load->library('session');
 
36
                $headTagData = array(
 
37
                        'cssFiles' => array('header', 'examplesMenu', 'examplesBody'),
 
38
                        'jsFiles' => array('header', 'examplesMenu', 'examplesBody', 'userControls')
 
39
                );
 
40
                $this->load->view('headTag', array('headTagData' => $headTagData));
 
41
                
 
42
                $this->load->helper('form');
 
43
                
 
44
                // Loading model to retrieve login data
35
45
                $this->load->model('user');
36
 
                if(!$this->input->post('username') || !$this->user->isLoggedIn()) {
37
 
                        echo "You do not have access to this page";
38
 
                        return;
 
46
                $userInfo = array(
 
47
                        'userType' => $this->user->getUserType(), // Loads different header for teacher/student
 
48
                        'userName' => $this->user->getUserName()
 
49
                );
 
50
                
 
51
                $this->load->view('header', $userInfo);
 
52
                        
 
53
                /* Loads used models */
 
54
                $this->load->model('viewstudents');
 
55
                
 
56
                // menuData loads items to the menu.
 
57
                $allTitles = array();
 
58
                $allStudents = array();
 
59
                
 
60
                /* Loads categorydata into array */
 
61
                $query = $this->viewstudents->getStudents();
 
62
 
 
63
                
 
64
                foreach ($query as $student)
 
65
                {
 
66
                        array_push($allStudents, $student->userName);
39
67
                }
 
68
                
 
69
                /*Menu for examples page showing categories */
 
70
                $this->load->view('examplesMenu', array('titles' => $allTitles));
 
71
                
 
72
                /* Loads body for examples page */
 
73
                
 
74
                $this->load->view('viewStudentsBody', array('students' => $allStudents));       
40
75
 
41
 
                $data = array(
42
 
                        'name' => $this->input->post('name');
43
 
                );
44
76
        }
 
77
 
45
78
        
46
79
        public function validate() {
47
80
                //Load required library