1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
3
class Start extends CI_Controller {
8
function __construct() {
10
//Load required library
11
$this->load->model('user', '', TRUE);
12
$this->load->model('admin/admin_model', '', TRUE);
16
* This function runs when the user navigates directly to the start controller
18
public function index() {
19
if($this->user->isLoggedIn()) {
20
//User already logged in
21
redirect(base_url().'home', 'refresh');
23
//Display the start page
24
$this->drawStartPage('');
29
* This function draws the start page.
31
private function drawStartPage() {
32
$userName = $this->user->getUserName();
33
$userType = $this->user->getUserType();
34
//Creates an array with all courses.
35
$courses = $this->admin_model->getCourses();
37
//Creates an array with the variables that the bannermenu-view is expecting.
39
'userType' => $userType,
40
'userName' => $userName,
44
//Creates an array with the necessary css- and jsfiles needed for the views that are about to be shown.
46
'cssFiles' => array('bannermenu', 'startview'),
47
'jsFiles' => array('bannermenu')
50
//Puts the array above in <head></head>
51
$this->load->view('headTag', array('headTagData' => $headTagData));
53
$this->load->view('bannermenu', $data);
54
$this->load->view('startview', $data);