5
5
$this->load->database();
8
function getCode($cid, $category, $subcategory, $example) {
8
function getCode($cid, $example, $page) {
10
10
$this->db->from('Files');
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");
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");
18
17
$query = $this->db->get();
20
foreach ($query->result() as $row) { //creats array with array consisting of columnNr and code file.
22
if($row->fileType == 'Code') {
23
$output .= '<div class="editorinfo">'.$row->codeLanguage.' '.$row->fileName.'</div>';
24
$output .= '<div id="ace_'.str_replace(".", "", $row->fileName).'" class="ace">';
25
$output .= $row->dataBlob;
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/merbivore");
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).'");';
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);';
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);
19
foreach ($query->result() as $row) {
20
$output .= '<div class="editorinfo">'.$row->language.' '.$row->fileName.'</div>';
21
$output .= '<div id="ace_'.str_replace(".", "", $row->fileName).'" class="ace">';
22
$output .= $row->dataBlob;
25
$output .= '<script type="text/javascript">
26
var Range = require("ace/range").Range;
27
var editor = ace.edit("ace_'.str_replace(".", "", $row->fileName).'");
28
editor.setTheme("ace/theme/merbivore");
29
editor.getSession().setMode("ace/mode/'.$row->language.'");
30
editor.setReadOnly(true);
31
editor.setShowPrintMargin(false);
32
editor.setDisplayIndentGuides(false);
33
editor.setHighlightSelectedWord(true);
34
lines = editor.getSession().getLength();
35
$("#ace_'.str_replace(".", "", $row->fileName).'").height(Math.min(500,lines*16));
36
aceeditors.push("ace_'.str_replace(".", "", $row->fileName).'");';
39
for($i = 0; $i < count($interestingrows); $i++) {
40
$output .= 'editor.getSession().addMarker(new Range('.$interestingrows[$i][0].', 0, '
41
.$interestingrows[$i][1].', Number.POSITIVE_INFINITY), "interesting", "text",false);';
44
$output .= '</script>';
60
function getDoc($cid, $category, $subcategory, $example){
51
function getDoc($cid, $example, $page){
61
52
$this->db->select('dataBlob');
62
53
$this->db->from('Files');
63
$this->db->join("Containers", "Containers.fileName = Files.fileName");
64
$this->db->where("Containers.categoryName", $category);
65
$this->db->where("Containers.subcategoryName", $subcategory);
66
$this->db->where("Containers.exampleName", $example);
67
$this->db->where("Containers.courseID", $cid);
68
$this->db->where("Containers.fileName", $cid."/".$category."/".$subcategory."/".$example."/"."documentation");
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");
70
60
$query = $this->db->get();
71
61
$result = $query->result();
72
62
return $result[0]->dataBlob;