bzr branch
http://gegoxaren.bato24.eu/bzr/lenasys/trunk
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
1 |
<?php
|
23.1.2
by galaxyAbstractor
Fixed database stuff, added files to database. |
2 |
/**
|
3 |
* This is a controller. It links the views related to the codeviewer together with the model, which holds
|
|
4 |
* the logic.
|
|
5 |
*
|
|
6 |
* Function names equals path. Example: codeviewer/show in the url calls the function show in the controller
|
|
7 |
* codeviewer (this file below).
|
|
8 |
*
|
|
9 |
* The params after the url equals the input arguments of the function. Function show() has 3 arguments
|
|
10 |
* and therefore requires 3 arguments to be given in the url, like so: codeviewer/show/courseid/exampleid/pageid
|
|
11 |
*/
|
|
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
12 |
class Codeviewer extends CI_Controller { |
13 |
||
109.1.1
by c11emian
Temporarily redirects the user to the startpage |
14 |
/*Temporarily redirects the user to the startpage*/
|
15 |
public function index(){ |
|
16 |
redirect('/'); |
|
17 |
}
|
|
18 |
||
23.1.2
by galaxyAbstractor
Fixed database stuff, added files to database. |
19 |
/**
|
20 |
* This shows the codeviewer page
|
|
21 |
*/
|
|
115.1.1
by c11emian
#1171772 |
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)){ |
|
117
by Gustav Hatvigsson
Merged Fransson:s changes and fixed a conflict. |
24 |
|
116.1.1
by a11patfr at his
Fixed a css loading error. |
25 |
$headTagData['cssFiles'] = array('headTag', 'bannermenu', 'codeviewer'); |
26 |
$headTagData['jsFiles'] = array('ace/ace', 'bannermenu'); |
|
117
by Gustav Hatvigsson
Merged Fransson:s changes and fixed a conflict. |
27 |
|
28 |
$this->load->model('codeviewer/Codeviewer_model'); |
|
29 |
$this->load->model('user', '', TRUE); |
|
30 |
$this->load->model('admin/admin_model', '', TRUE); |
|
31 |
||
32 |
$editorHTML = $this->Codeviewer_model->getCode($cid, $category, $subcategory, $example); |
|
33 |
||
34 |
$activeCourse = $this->user->getActiveCourse(); |
|
115.1.1
by c11emian
#1171772 |
35 |
$userInfo = array( |
36 |
'userType' => $this->user->getUserType(), |
|
117
by Gustav Hatvigsson
Merged Fransson:s changes and fixed a conflict. |
37 |
'userName' => $this->user->getUserName(), |
38 |
'courses' => $this->admin_model->getCourses(), |
|
39 |
'categories' => $this->admin_model->getCategories($activeCourse['courseID']), |
|
40 |
'activeCourse' => $activeCourse |
|
115.1.1
by c11emian
#1171772 |
41 |
);
|
117
by Gustav Hatvigsson
Merged Fransson:s changes and fixed a conflict. |
42 |
|
115.1.1
by c11emian
#1171772 |
43 |
$this->load->helper('form'); |
117
by Gustav Hatvigsson
Merged Fransson:s changes and fixed a conflict. |
44 |
|
118
by Gustav Hatvigsson
fixes a multiline comment. |
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"
|
|
50 |
*/
|
|
117
by Gustav Hatvigsson
Merged Fransson:s changes and fixed a conflict. |
51 |
$this->load->view('headTag', array('headTagData' => $headTagData)); |
52 |
$this->load->view('bannermenu', $userInfo); |
|
115.1.1
by c11emian
#1171772 |
53 |
$this->load->view('codeviewer/codeviewer', array("editors" => $editorHTML)); |
54 |
} else { |
|
55 |
/*Redirects to the startpage if no arguments are supplied.*/
|
|
56 |
redirect('/'); |
|
57 |
}
|
|
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
58 |
}
|
58.1.2
by a11patfr at his
First steps to working codeviewer, can now show all files. |
59 |
}
|