/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: 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:
90
90
                $subCategoryName = urldecode($subCategoryName);
91
91
                $this->load->model('admin/Admin_model');
92
92
                $examples = $this->Admin_model->getExamples($cid,  $categoryName, $subCategoryName);
 
93
                $quizzes = $this->Admin_model->getQuizzes($cid,  $categoryName, $subCategoryName);
93
94
                $this->load->view('admin/header', array("title" => "Manage category - ".$cid." - ". $categoryName));
94
95
                $menu = $this->Admin_model->getMenu();
95
96
                $this->load->view('admin/menu', array("menu" => $menu));
96
 
                $this->load->view('admin/manage_sub_category', array("examples" => $examples, "cid" => $cid, "categoryName" => $categoryName, "subCategoryName" => $subCategoryName));
 
97
                $this->load->view('admin/manage_sub_category', array("examples" => $examples, "quizzes" => $quizzes , "cid" => $cid, "categoryName" => $categoryName, "subCategoryName" => $subCategoryName));
97
98
        }
98
99
 
99
100
        public function addExample($cid, $categoryName, $subCategoryName){
114
115
                }
115
116
        }
116
117
 
117
 
        public function manageExample($cid, $example) {
118
 
                $cid = urldecode($cid);
119
 
                $example = urldecode($example);
120
 
                $this->load->model('admin/Admin_model');
121
 
                $pages = $this->Admin_model->getPages($cid, $example);
122
 
                $this->load->view('admin/header', array("title" => "Manage example - ".$example." - ".$cid));
123
 
                $menu = $this->Admin_model->getMenu();
124
 
                $this->load->view('admin/menu', array("menu" => $menu));
125
 
                $this->load->view('admin/manage_example', array("pages" => $pages, "cid" => $cid, "example" => $example));
126
 
        }
127
 
 
128
 
        public function addPage($cid, $example){
129
 
                $cid = urldecode($cid);
130
 
                $example = urldecode($example);
131
 
                if(!isset($_POST['page'])) {
132
 
                        $this->load->helper('form');
133
 
                        $this->load->view('admin/header', array("title" => "Add page"));
134
 
                        $menu = $this->Admin_model->getMenu();
135
 
                        $this->load->view('admin/menu', array("menu" => $menu));
136
 
                        $this->load->view('admin/add_page', array("cid" => $cid, "example" => $example));
137
 
                } else {
138
 
                        $this->load->model('admin/Admin_model');
139
 
                        $this->Admin_model->addPage($_POST['cid'], $_POST['example'],$_POST['page']);
140
 
                        redirect("admin/");
141
 
                }
142
 
        }
143
 
 
144
 
        public function managePage($cid, $example, $page) {
145
 
                $cid = urldecode($cid);
146
 
                $example = urldecode($example);
147
 
                $page = urldecode($page);
 
118
        public function manageExample($cid, $categoryName, $subCategoryName, $example) {
 
119
                $cid = urldecode($cid);
 
120
                $example = urldecode($example);
 
121
                $categoryName = urldecode($categoryName);
 
122
                $subCategoryName = urldecode($subCategoryName);
148
123
                if(!isset($_POST['documentation'])){
149
124
                        $this->load->helper('form');
150
125
 
151
126
                        $this->load->model('codeviewer/Codeviewer_model');
152
 
 
153
127
                        
154
 
                        $editorHTML = $this->Codeviewer_model->getCode($cid, $example, $page);
 
128
                        $editorHTML = $this->Codeviewer_model->getCode($cid, $categoryName, $subCategoryName, $example);
155
129
 
156
130
                        //$doc = $this->Codeviewer_model->getDoc($cid, $example, $page);
157
131
 
158
 
                        $this->load->view('admin/header', array("editors" => $editorHTML, "title" => "Manage page - ".$page." - ".$example." - ".$cid));
159
 
                        $this->load->view('admin/manage_page', array("cid" => $cid, "example" => $example, "page" => $page /*,"documentation" => $doc*/));
 
132
                        $this->load->view('admin/header', array("editors" => $editorHTML, "title" => "Manage example - ".$categoryName." - ".$subCategoryName." - ".$example." - ".$cid));
 
133
                        $this->load->view('admin/manage_example', array("cid" => $cid, "example" => $example, "category" => $categoryName, "subcategory" => $subCategoryName /*,"documentation" => $doc*/));
160
134
                } else {
161
135
                        $this->load->model('admin/Admin_model');
162
 
                        $this->Admin_model->updatePage($_POST['cid'], $_POST['example'],$_POST['page'], $_POST['documentation'], $_POST['files']);
 
136
                        $this->Admin_model->updateExample($_POST['cid'], $_POST['example'],$_POST['category'], $_POST['subcategory'], $_POST['documentation'], $_POST['files']);
163
137
                        redirect("admin/");
164
138
                }
165
139
        }
166
140
 
167
 
        public function uploadFile($cid, $example, $page) {
 
141
        public function uploadFile($cid, $categoryName, $subCategoryName, $example) {
168
142
                $cid = urldecode($cid);
169
143
                $example = urldecode($example);
170
 
                $page = urldecode($page);
 
144
                $categoryName = urldecode($categoryName);
 
145
                $subCategoryName = urldecode($subCategoryName);
171
146
                $this->load->model('admin/Admin_model');
172
 
                $this->Admin_model->uploadFile($_FILES['files'],$cid, $example, $page);
 
147
                $this->Admin_model->uploadFile($_FILES['files'],$cid, $categoryName, $subCategoryName, $example);
173
148
        }
174
149
 
175
150
}
 
 
b'\\ No newline at end of file'