/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/application/controllers/codeviewer.php

  • Committer: a11andoh
  • Date: 2013-05-24 11:28:43 UTC
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: a11andoh@student.his.se-20130524112843-360je7hu7q13r171
added the cms controller to load all content pages.
added first time registration controller to load the views for the registration
pages.
added and fixed temporarypages for the controllers 
and edited the models to be able to get active courses.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
 
 
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
*/
3
12
class Codeviewer extends CI_Controller {
4
13
 
5
 
        public function show($course, $example, $page){
 
14
        /**
 
15
        * This shows the codeviewer page
 
16
        */
 
17
        public function show($cid, $category, $subcategory, $example){
 
18
                $headTagData['cssFiles'] = array('headTag', 'header', 'codeviewer');
 
19
                $headTagData['jsFiles'] = array('ace/ace', 'header');
 
20
        
6
21
                $this->load->model('codeviewer/Codeviewer_model');
7
22
 
8
 
                $files = $this->Codeviewer_model->getFiles($course, $example,$page);
9
 
                $editorHTML = "";
10
 
                foreach ($files as $file) {
11
 
                        $editorHTML .= $this->Codeviewer_model->showFile($file, "html");
12
 
                }
13
 
 
14
 
                $doc = $this->Codeviewer_model->getDoc($course, $example, $page);
15
 
 
16
 
                $this->load->view('codeviewer/codeviewer', array("editors" => $editorHTML, "documentation" => $doc));
 
23
                $editorHTML = $this->Codeviewer_model->getCode($cid, $category, $subcategory, $example);
 
24
        
 
25
                $this->load->model('user');
 
26
                
 
27
                $userInfo = array(
 
28
                        'userType' => $this->user->getUserType(),
 
29
                        'userName' => $this->user->getUserName()
 
30
                );
 
31
                
 
32
                $this->load->helper('form');
 
33
                
 
34
                // $doc = $this->Codeviewer_model->getDoc($cid, $category, $subcategory, $example);
 
35
 
 
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));
17
43
        }
18
 
}
 
 
b'\\ No newline at end of file'
 
44
}