/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk
85.1.8 by a11andoh
added the cms controller to load all content pages.
1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
3
	class Cms extends CI_Controller {
4
	
5
		/*
6
		 *	Constructor
7
		 */
8
		function __construct() {
9
			parent::__construct();
10
			//Load required library
11
			$this->load->model('user', '', TRUE);
12
			$this->load->model('admin/admin_model', '', TRUE);
13
		}
14
		
15
		/*
16
		 *	This function runs when the user navigates directly to this controller
17
		 */
18
		public function index() {
19
			if($this->user->isLoggedIn()) {
20
				//User already logged in
21
				$this->drawCmsPage('');
22
			} else {
23
				//Display the start page
24
				redirect(base_url().'home', 'refresh');
25
			}
26
		}		
27
		
28
		/*
29
		 *	This function draws the cms page.
30
		 */
31
		private function drawCmsPage() {
32
			$userName = $this->user->getUserName();
33
			$userType = $this->user->getUserType();
34
			//Creates an array with all courses.
35
			//Creates an array with the variables that the bannermenu-view is expecting.
36
			$data = array(
37
				'userType' => $userType,
38
				'userName' => $userName,
39
			);
40
			
41
			//Creates an array with the necessary css- and jsfiles needed for the views that are about to be shown.
42
			$headTagData = array(
43
				'cssFiles' => array('bannermenu', 'registration', 'startview'),
44
				'jsFiles' => array('bannermenu')
45
			);
46
			
47
			//Puts the array above in <head></head>
48
			$this->load->view('headTag', array('headTagData' => $headTagData));	
49
			
50
			$this->load->view('bannermenu', $data);
51
			if ($userType=='1'){
52
				$this->load->view('registrationTeacher');
53
			}
54
			else if($userType=='2'){
55
				$this->load->view('registrationStudent');
56
			}
57
			else{
58
				$this->load->view('startview');
59
			}
60
		}
61
	}
62
?>