12
12
class Codeviewer extends CI_Controller {
14
/*Temporarily redirects the user to the startpage*/
15
public function index(){
20
15
* This shows the codeviewer page
22
public function show($cid = null, $category = null, $subcategory = null, $example = null){
23
if(!is_null($cid) && !is_null($category) && !is_null($subcategory) && !is_null($example)){
25
$headTagData['cssFiles'] = array('headTag', 'bannermenu', 'codeviewer');
26
$headTagData['jsFiles'] = array('ace/ace', 'bannermenu');
28
$this->load->model('codeviewer/Codeviewer_model');
29
$this->load->model('user', '', TRUE);
30
$this->load->model('admin/admin_model', '', TRUE);
32
$editorHTML = $this->Codeviewer_model->getCode($cid, $category, $subcategory, $example);
34
$activeCourse = $this->user->getActiveCourse();
36
'userType' => $this->user->getUserType(),
37
'userName' => $this->user->getUserName(),
38
'courses' => $this->admin_model->getCourses(),
39
'categories' => $this->admin_model->getCategories($activeCourse['courseID']),
40
'activeCourse' => $activeCourse
43
$this->load->helper('form');
45
/* $doc = $this->Codeviewer_model->getDoc($cid, $category, $subcategory, $example);
46
* This loads the view. It's stored in application/views/codeviewer/codeviewer.php
47
* Do note that application/views should not be in the first argument of view()
48
* The second argument is data to be shown in the view. "editors" => "test" would
49
* generate an $editors variable in the view containing "test"
51
$this->load->view('headTag', array('headTagData' => $headTagData));
52
$this->load->view('bannermenu', $userInfo);
53
$this->load->view('codeviewer/codeviewer', array("editors" => $editorHTML));
55
/*Redirects to the startpage if no arguments are supplied.*/
17
public function show($cid, $category, $subcategory, $example){
18
$headTagData['cssFiles'] = array('headTag', 'header', 'codeviewer');
19
$headTagData['jsFiles'] = array('ace/ace', 'header');
21
$this->load->model('codeviewer/Codeviewer_model');
23
$editorHTML = $this->Codeviewer_model->getCode($cid, $category, $subcategory, $example);
25
$this->load->model('user');
28
'userType' => $this->user->getUserType(),
29
'userName' => $this->user->getUserName()
32
$this->load->helper('form');
34
// $doc = $this->Codeviewer_model->getDoc($cid, $category, $subcategory, $example);
36
// This loads the view. It's stored in application/views/codeviewer/codeviewer.php
37
// Do note that application/views should not be in the first argument of view()
38
// The second argument is data to be shown in the view. "editors" => "test" would
39
// generate an $editors variable in the view containing "test"
40
$this->load->view('headTag', array('headTagData' => $headTagData));
41
$this->load->view('header', $userInfo);
42
$this->load->view('codeviewer/codeviewer', array("editors" => $editorHTML));