/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
* This is a controller. It links the views related to the codeviewer together with the model, which holds
* the logic.  
*
* Function names equals path. Example: codeviewer/show in the url calls the function show in the controller
* codeviewer (this file below).
*
* The params after the url equals the input arguments of the function. Function show() has 3 arguments
* and therefore requires 3 arguments to be given in the url, like so: codeviewer/show/courseid/exampleid/pageid
*/
class Codeviewer extends CI_Controller {

	/**
	* This shows the codeviewer page
	*/
	public function show($course, $example, $page){
		$this->load->model('codeviewer/Codeviewer_model');

		$editorHTML = $this->Codeviewer_model->getCode($course, $example, $page);

		$doc = $this->Codeviewer_model->getDoc($course, $example, $page);

		// This loads the view. It's stored in application/views/codeviewer/codeviewer.php
		// Do note that application/views should not be in the first argument of view()
		// The second argument is data to be shown in the view. "editors" => "test" would
		// generate an $editors variable in the view containing "test"
		$this->load->view('codeviewer/codeviewer', array("editors" => $editorHTML, "documentation" => $doc));
	}
}