/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/admin.php

  • Committer: galaxyAbstractor
  • Date: 2013-04-10 15:49:32 UTC
  • mto: (19.1.5 lenasys)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: galaxyabstractor@gmail.com-20130410154932-4vizlzk0ar5gykvi
* Added an simple admin panel to the codeviewer-cmssy stuff
* Redesigned a bit like the mockups - still stuff to come
* Implemented the codeviewer + admin panel again using the Framework CodeIgniter instead 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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();
 
9
                $this->load->view('admin/index', array("courses" => $courses));
 
10
        }
 
11
 
 
12
        public function addCourse(){
 
13
                
 
14
                if(!isset($_POST['cid'])){
 
15
                        $this->load->helper('form');
 
16
                        $this->load->view('admin/add_course');
 
17
                } else {
 
18
                        $this->load->model('admin/Admin_model');
 
19
                        $this->Admin_model->addCourse($_POST['cid'], $_POST['name']);
 
20
                        redirect("admin/");
 
21
                }
 
22
        }
 
23
 
 
24
        public function manageCourse($cid) {
 
25
                $this->load->model('admin/Admin_model');
 
26
                $examples = $this->Admin_model->getExamples($cid);
 
27
                $this->load->view('admin/manage_course', array("examples" => $examples, "cid" => $cid));
 
28
        }
 
29
 
 
30
        public function addExample($cid){
 
31
                
 
32
                if(!isset($_POST['example'])){
 
33
                        $this->load->helper('form');
 
34
                        $this->load->view('admin/add_example', array("cid" => $cid));
 
35
                } else {
 
36
                        $this->load->model('admin/Admin_model');
 
37
                        $this->Admin_model->addExample($_POST['cid'], $_POST['example']);
 
38
                        redirect("admin/");
 
39
                }
 
40
        }
 
41
 
 
42
        public function manageExample($cid, $example) {
 
43
                $this->load->model('admin/Admin_model');
 
44
                $pages = $this->Admin_model->getPages($cid, $example);
 
45
                $this->load->view('admin/manage_example', array("pages" => $pages, "cid" => $cid, "example" => $example));
 
46
        }
 
47
 
 
48
        public function addPage($cid, $example){
 
49
                
 
50
                if(!isset($_POST['page'])){
 
51
                        $this->load->helper('form');
 
52
                        $this->load->view('admin/add_page', array("cid" => $cid, "example" => $example));
 
53
                } else {
 
54
                        $this->load->model('admin/Admin_model');
 
55
                        $this->Admin_model->addPage($_POST['cid'], $_POST['example'],$_POST['page'], $_POST['documentation']);
 
56
                        redirect("admin/");
 
57
                }
 
58
        }
 
59
 
 
60
        public function managePage($cid, $example, $page) {
 
61
                if(!isset($_POST['documentation'])){
 
62
                        $this->load->helper('form');
 
63
                        $this->load->view('admin/manage_page', array("cid" => $cid, "example" => $example, "page" => $page));
 
64
                } else {
 
65
                        $this->load->model('admin/Admin_model');
 
66
                        $this->Admin_model->updatePage($_POST['cid'], $_POST['example'],$_POST['page'], $_POST['documentation']);
 
67
                        redirect("admin/");
 
68
                }
 
69
        }
 
70
 
 
71
        public function uploadFile($cid, $example, $page) {
 
72
                $this->load->model('admin/Admin_model');
 
73
                $this->Admin_model->uploadFile($_FILES['files'],$cid, $example, $page);
 
74
        }
 
75
 
 
76
}
 
 
b'\\ No newline at end of file'