/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/models/codeviewer/codeviewer_model.php

  • Committer: Gustav Hatvigsson
  • Date: 2013-05-07 08:05:14 UTC
  • mfrom: (53.2.2 lenasys)
  • Revision ID: gustav.hartvigsson@gmail.com-20130507080514-u53zto672m0t19wl
merded the new salting stuff for the user passwords and stuff...

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
                $this->load->database();
6
6
        }
7
7
 
8
 
        function getCode($cid, $example, $page) {
 
8
        function getCode($cid, $category, $subcategory, $example) {
9
9
 
10
10
                $this->db->from('Files');
11
 
                $this->db->join("PageFiles", "Pagefiles.fileName = Files.fileName");
12
 
                $this->db->where("PageFiles.pagesName", $page);
13
 
                $this->db->where("PageFiles.exampleName", $example);
14
 
                $this->db->where("PageFiles.courseID", $cid);
15
 
                $this->db->not_like("PageFiles.fileName", $cid."/".$example."/".$page."/"."documentation");
 
11
                $this->db->join("Containers", "Containers.fileName = Files.fileName");
 
12
                $this->db->where("Containers.categoryName", $category);
 
13
                $this->db->where("Containers.subcategoryName", $subcategory);
 
14
                $this->db->where("Containers.exampleName", $example);
 
15
                $this->db->where("Containers.courseID", $cid);
 
16
                $this->db->not_like("Containers.fileName", $cid."/".$category."/".$subcategory."/".$example."/documentation");
16
17
 
17
18
                $query = $this->db->get();
18
19
                $output = "";
19
20
                foreach ($query->result() as $row) {
20
 
                        $output .= '<div class="editorinfo">'.$row->language.'&nbsp;&nbsp;&nbsp;&nbsp;'.$row->fileName.'</div>';
 
21
                        $output .= '<div class="editorinfo">'.$row->codeLanguage.'&nbsp;&nbsp;&nbsp;&nbsp;'.$row->fileName.'</div>';
21
22
                        $output .= '<div id="ace_'.str_replace(".", "", $row->fileName).'" class="ace">';
22
23
                        $output .= $row->dataBlob;
23
24
                        $output .= '</div>';
26
27
                        var Range = require("ace/range").Range;
27
28
                        var editor = ace.edit("ace_'.str_replace(".", "", $row->fileName).'");
28
29
                        editor.setTheme("ace/theme/merbivore");
29
 
                        editor.getSession().setMode("ace/mode/'.$row->language.'");
 
30
                        editor.getSession().setMode("ace/mode/'.$row->codeLanguage.'");
30
31
                        editor.setReadOnly(true);
31
32
                        editor.setShowPrintMargin(false);
32
33
                        editor.setDisplayIndentGuides(false);
48
49
                return $output;
49
50
        }
50
51
 
51
 
        function getDoc($cid, $example, $page){
 
52
        function getDoc($cid, $category, $subcategory, $example){
52
53
                $this->db->select('dataBlob');
53
54
                $this->db->from('Files');
54
 
                $this->db->join("PageFiles", "PageFiles.fileName = Files.fileName");
55
 
                $this->db->where("PageFiles.pageName", $page);
56
 
                $this->db->where("PageFiles.exampleName", $example);
57
 
                $this->db->where("PageFiles.courseID", $cid);
58
 
                $this->db->where("PageFiles.fileName", $cid."/".$example."/".$page."/"."documentation");
 
55
                $this->db->join("Containers", "Containers.fileName = Files.fileName");
 
56
                $this->db->where("Containers.categoryName", $category);
 
57
                $this->db->where("Containers.subcategoryName", $subcategory);
 
58
                $this->db->where("Containers.exampleName", $example);
 
59
                $this->db->where("Containers.courseID", $cid);
 
60
                $this->db->where("Containers.fileName", $cid."/".$category."/".$subcategory."/".$example."/"."documentation");
59
61
 
60
62
                $query = $this->db->get();
61
63
                $result = $query->result();