/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: Simon Bergöö
  • Date: 2013-05-15 12:41:14 UTC
  • mfrom: (66 lenasys_b)
  • mto: This revision was merged to the branch mainline in revision 67.
  • Revision ID: a11simbe@student.his.se-20130515124114-d9fctkf2rkqq6xg6
Merged from trunk, statred working on the popups model.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
                $this->db->where("Containers.subcategoryName", $subcategory);
14
14
                $this->db->where("Containers.exampleName", $example);
15
15
                $this->db->where("Containers.courseID", $cid);
16
 
                $this->db->not_like("Containers.fileName", $cid."/".$category."/".$subcategory."/".$example."/documentation");
 
16
                //$this->db->not_like("Containers.fileName", $cid."/".$category."/".$subcategory."/".$example."/documentation");
17
17
 
18
18
                $query = $this->db->get();
19
 
                $output = "";
20
 
                foreach ($query->result() as $row) {
21
 
                        $output .= '<div class="editorinfo">'.$row->codeLanguage.'&nbsp;&nbsp;&nbsp;&nbsp;'.$row->fileName.'</div>';
22
 
                        $output .= '<div id="ace_'.str_replace(".", "", $row->fileName).'" class="ace">';
23
 
                        $output .= $row->dataBlob;
24
 
                        $output .= '</div>';
25
 
 
26
 
                        $output .=  '<script type="text/javascript">
27
 
                        var Range = require("ace/range").Range;
28
 
                        var editor = ace.edit("ace_'.str_replace(".", "", $row->fileName).'");
29
 
                        editor.setTheme("ace/theme/merbivore");
30
 
                        editor.getSession().setMode("ace/mode/'.$row->codeLanguage.'");
31
 
                        editor.setReadOnly(true);
32
 
                        editor.setShowPrintMargin(false);
33
 
                        editor.setDisplayIndentGuides(false);
34
 
                        editor.setHighlightSelectedWord(true);
35
 
                        lines = editor.getSession().getLength();
36
 
                        $("#ace_'.str_replace(".", "", $row->fileName).'").height(Math.min(500,lines*16));
37
 
                        aceeditors.push("ace_'.str_replace(".", "", $row->fileName).'");';
38
 
 
39
 
                        /*
40
 
                        for($i = 0; $i < count($interestingrows); $i++) {
41
 
                        $output .= 'editor.getSession().addMarker(new Range('.$interestingrows[$i][0].', 0, '
42
 
                                .$interestingrows[$i][1].', Number.POSITIVE_INFINITY), "interesting", "text",false);';
 
19
                $outarr = array();
 
20
                foreach ($query->result() as $row) { //creats array with array consisting of columnNr and code file.
 
21
                        $output = "";
 
22
                        if($row->fileType == 'Code') {
 
23
                                $output .= '<div class="editorinfo">'.$row->codeLanguage.'&nbsp;&nbsp;&nbsp;&nbsp;'.$row->fileName.'</div>';
 
24
                                $output .= '<div id="ace_'.str_replace(".", "", $row->fileName).'" class="ace">';
 
25
                                $output .= $row->dataBlob;
 
26
                                $output .= '</div>';
 
27
 
 
28
                                $output .=  '<script type="text/javascript">
 
29
                                var Range = require("ace/range").Range;
 
30
                                var editor = ace.edit("ace_'.str_replace(".", "", $row->fileName).'");
 
31
                                editor.setTheme("ace/theme/eclipse");
 
32
                                editor.getSession().setMode("ace/mode/'.$row->codeLanguage.'");
 
33
                                editor.setReadOnly(true);
 
34
                                editor.setShowPrintMargin(false);
 
35
                                editor.setDisplayIndentGuides(false);
 
36
                                editor.setHighlightSelectedWord(true);
 
37
                                lines = editor.getSession().getLength();
 
38
                                $("#ace_'.str_replace(".", "", $row->fileName).'").height(Math.min(500,lines*16));
 
39
                                aceeditors.push("ace_'.str_replace(".", "", $row->fileName).'");';
 
40
 
 
41
                                /*
 
42
                                for($i = 0; $i < count($interestingrows); $i++) {
 
43
                                $output .= 'editor.getSession().addMarker(new Range('.$interestingrows[$i][0].', 0, '
 
44
                                        .$interestingrows[$i][1].', Number.POSITIVE_INFINITY), "interesting", "text",false);';
 
45
                                }
 
46
                                */
 
47
                                $output .= '</script>';
 
48
                                $outarr[] = array($row->columnNr,$output);
 
49
                        } else if($row->fileType == 'Text') {
 
50
                                $output .= $row->dataBlob;
 
51
                                $outarr[] = array($row->columnNr,$output);
43
52
                        }
44
 
                        */
45
 
                        $output .= '</script>';
46
53
 
47
54
                }
48
55
 
49
 
                return $output;
 
56
                return $outarr;
50
57
        }
51
58
 
 
59
        /*
52
60
        function getDoc($cid, $category, $subcategory, $example){
53
61
                $this->db->select('dataBlob');
54
62
                $this->db->from('Files');
62
70
                $query = $this->db->get();
63
71
                $result = $query->result();
64
72
                return $result[0]->dataBlob;
65
 
        }
66
 
 
 
73
        }*/
67
74
}