/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: Gustav Hartvigsson
  • Date: 2013-04-12 23:11:17 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20130412231117-qzldmubpart6gm8c
fixed an error in the header proposed header...

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
*/
12
12
class Codeviewer extends CI_Controller {
13
13
 
14
 
        /*Temporarily redirects the user to the startpage*/
15
 
        public function index(){
16
 
                redirect('/');
17
 
        }
18
 
 
19
14
        /**
20
15
        * This shows the codeviewer page
21
16
        */
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)){
24
 
                        
25
 
                        $headTagData['cssFiles'] = array('headTag', 'bannermenu', 'codeviewer');
26
 
                        $headTagData['jsFiles'] = array('ace/ace', 'bannermenu');
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();
35
 
                        $userInfo = array(
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
41
 
                        );
42
 
                        
43
 
                        $this->load->helper('form');
44
 
                        
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
 
                         */
51
 
                        $this->load->view('headTag', array('headTagData' => $headTagData));
52
 
                        $this->load->view('bannermenu', $userInfo);
53
 
                        $this->load->view('codeviewer/codeviewer', array("editors" => $editorHTML));
54
 
                } else {
55
 
                        /*Redirects to the startpage if no arguments are supplied.*/
56
 
                        redirect('/');
57
 
                }
 
17
        public function show($course, $example, $page){
 
18
                $this->load->model('codeviewer/Codeviewer_model');
 
19
 
 
20
                $editorHTML = $this->Codeviewer_model->getCode($course, $example, $page);
 
21
 
 
22
                $doc = $this->Codeviewer_model->getDoc($course, $example, $page);
 
23
 
 
24
                // This loads the view. It's stored in application/views/codeviewer/codeviewer.php
 
25
                // Do note that application/views should not be in the first argument of view()
 
26
                // The second argument is data to be shown in the view. "editors" => "test" would
 
27
                // generate an $editors variable in the view containing "test"
 
28
                $this->load->view('codeviewer/codeviewer', array("editors" => $editorHTML, "documentation" => $doc));
58
29
        }
59
 
}
 
30
}
 
 
b'\\ No newline at end of file'