bzr branch
http://gegoxaren.bato24.eu/bzr/lenasys/trunk
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
1 |
<?php
|
2 |
||
3 |
class Admin extends CI_Controller { |
|
4 |
||
5 |
||
6 |
public function index() { |
|
7 |
$this->load->model('admin/Admin_model'); |
|
8 |
$courses = $this->Admin_model->getCourses(); |
|
23.1.1
by galaxyAbstractor
Removed codeigniter user guide, shouldn't be in the repo |
9 |
$this->load->view('admin/header', array("title" => "Index")); |
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
10 |
$this->load->view('admin/index', array("courses" => $courses)); |
11 |
}
|
|
12 |
||
13 |
public function addCourse(){ |
|
14 |
||
15 |
if(!isset($_POST['cid'])){ |
|
16 |
$this->load->helper('form'); |
|
23.1.1
by galaxyAbstractor
Removed codeigniter user guide, shouldn't be in the repo |
17 |
$this->load->view('admin/header', array("title" => "Add course")); |
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
18 |
$this->load->view('admin/add_course'); |
19 |
} else { |
|
20 |
$this->load->model('admin/Admin_model'); |
|
21 |
$this->Admin_model->addCourse($_POST['cid'], $_POST['name']); |
|
22 |
redirect("admin/"); |
|
23 |
}
|
|
24 |
}
|
|
25 |
||
26 |
public function manageCourse($cid) { |
|
27 |
$this->load->model('admin/Admin_model'); |
|
28 |
$examples = $this->Admin_model->getExamples($cid); |
|
23.1.1
by galaxyAbstractor
Removed codeigniter user guide, shouldn't be in the repo |
29 |
$this->load->view('admin/header', array("title" => "Manage course - ".$cid)); |
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
30 |
$this->load->view('admin/manage_course', array("examples" => $examples, "cid" => $cid)); |
31 |
}
|
|
32 |
||
33 |
public function addExample($cid){ |
|
34 |
||
35 |
if(!isset($_POST['example'])){ |
|
36 |
$this->load->helper('form'); |
|
23.1.1
by galaxyAbstractor
Removed codeigniter user guide, shouldn't be in the repo |
37 |
$this->load->view('admin/header', array("title" => "Add example")); |
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
38 |
$this->load->view('admin/add_example', array("cid" => $cid)); |
39 |
} else { |
|
40 |
$this->load->model('admin/Admin_model'); |
|
41 |
$this->Admin_model->addExample($_POST['cid'], $_POST['example']); |
|
42 |
redirect("admin/"); |
|
43 |
}
|
|
44 |
}
|
|
45 |
||
46 |
public function manageExample($cid, $example) { |
|
47 |
$this->load->model('admin/Admin_model'); |
|
48 |
$pages = $this->Admin_model->getPages($cid, $example); |
|
23.1.1
by galaxyAbstractor
Removed codeigniter user guide, shouldn't be in the repo |
49 |
$this->load->view('admin/header', array("title" => "Manage example - ".$example." - ".$cid)); |
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
50 |
$this->load->view('admin/manage_example', array("pages" => $pages, "cid" => $cid, "example" => $example)); |
51 |
}
|
|
52 |
||
53 |
public function addPage($cid, $example){ |
|
54 |
||
55 |
if(!isset($_POST['page'])){ |
|
56 |
$this->load->helper('form'); |
|
23.1.1
by galaxyAbstractor
Removed codeigniter user guide, shouldn't be in the repo |
57 |
$this->load->view('admin/header', array("title" => "Add page")); |
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
58 |
$this->load->view('admin/add_page', array("cid" => $cid, "example" => $example)); |
59 |
} else { |
|
60 |
$this->load->model('admin/Admin_model'); |
|
61 |
$this->Admin_model->addPage($_POST['cid'], $_POST['example'],$_POST['page'], $_POST['documentation']); |
|
62 |
redirect("admin/"); |
|
63 |
}
|
|
64 |
}
|
|
65 |
||
66 |
public function managePage($cid, $example, $page) { |
|
67 |
if(!isset($_POST['documentation'])){ |
|
68 |
$this->load->helper('form'); |
|
23.1.1
by galaxyAbstractor
Removed codeigniter user guide, shouldn't be in the repo |
69 |
|
70 |
$this->load->model('codeviewer/Codeviewer_model'); |
|
71 |
||
72 |
$files = $this->Codeviewer_model->getFiles($cid, $example,$page); |
|
73 |
$editorHTML = ""; |
|
74 |
foreach ($files as $file) { |
|
75 |
$editorHTML .= $this->Codeviewer_model->showFile($file, "html"); |
|
76 |
}
|
|
77 |
||
78 |
$doc = $this->Codeviewer_model->getDoc($cid, $example, $page); |
|
79 |
||
80 |
$this->load->view('admin/header', array("editors" => $editorHTML, "title" => "Manage page - ".$page." - ".$example." - ".$cid)); |
|
81 |
$this->load->view('admin/manage_page', array("cid" => $cid, "example" => $example, "page" => $page, "documentation" => $doc)); |
|
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
82 |
} else { |
83 |
$this->load->model('admin/Admin_model'); |
|
84 |
$this->Admin_model->updatePage($_POST['cid'], $_POST['example'],$_POST['page'], $_POST['documentation']); |
|
85 |
redirect("admin/"); |
|
86 |
}
|
|
87 |
}
|
|
88 |
||
89 |
public function uploadFile($cid, $example, $page) { |
|
90 |
$this->load->model('admin/Admin_model'); |
|
91 |
$this->Admin_model->uploadFile($_FILES['files'],$cid, $example, $page); |
|
92 |
}
|
|
93 |
||
94 |
}
|