Changeset 701 for trunk/app/controllers
- Timestamp:
- 08/08/08 16:03:49 (4 months ago)
- Location:
- trunk/app/controllers
- Files:
-
- 4 modified
-
catglossaries_controller.php (modified) (1 diff)
-
entries_controller.php (modified) (3 diffs)
-
lessons_controller.php (modified) (1 diff)
-
news_controller.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/catglossaries_controller.php
r700 r701 109 109 } 110 110 111 public function admin_edit($catglossary_id=null)112 {113 $this->layout = 'admin';111 public function admin_edit($catglossary_id=null) 112 { 113 $this->layout = 'admin'; 114 114 115 115 if ( empty( $this->data['Catglossary'] ) ): -
trunk/app/controllers/entries_controller.php
r696 r701 123 123 $this->layout = 'admin'; 124 124 125 $this->set('subjects', Set::combine($this->Entry->Subject->find('all', array('order' => 'title')),"{n}.Subject.id","{n}.Subject.title"));126 127 if ( !empty($this->data['Entry']) )128 {125 $this->set('subjects',Set::combine($this->Entry->Subject->find('all', array('order'=>'title')),"{n}.Subject.id","{n}.Subject.title")); 126 127 if ( !empty($this->data['Entry']) ): 128 129 129 $this->Sanitize = new Sanitize; 130 130 … … 134 134 135 135 $this->data['Entry']['user_id'] = $this->Auth->user('id'); 136 137 $this->Entry->create();138 136 139 137 if ($this->Entry->save($this->data)): … … 146 144 endif; 147 145 endif; 148 }146 endif; 149 147 } 150 148 -
trunk/app/controllers/lessons_controller.php
r697 r701 31 31 32 32 $this->layout = $this->Edublog->layout($user_id); 33 33 34 34 $this->Edublog->blog($user_id); // blogger elements 35 35 36 $this->LessonTitle = __('Lesson', true);36 $this->LessonTitle = $username .' '. __('Lessons', true); 37 37 38 38 $conditions = array('Lesson.id'=>$id, 'Lesson.status'=>1); -
trunk/app/controllers/news_controller.php
r696 r701 114 114 115 115 /*** ======ADMIN METHODS === *****/ 116 public function admin_listing( $page=1)116 public function admin_listing() 117 117 { 118 118 $this->pageTitle = 'News manager'; … … 147 147 $this->set('themes', Set::combine($this->News->Theme->find('all', array('order'=>'theme')),"{n}.Theme.id","{n}.Theme.theme")); 148 148 149 if (!empty($this->data["News"])) 150 { 149 if (!empty($this->data['News'])): 151 150 $this->Sanitize = new Sanitize; 152 151 153 $this->Sanitize->paranoid($this->data[ "News"]["title"]);154 155 $this->Sanitize->paranoid($this->data[ "News"]["reference"]);156 157 $this->Sanitize->html($this->data[ "News"]["body"]);158 159 $this->data[ "News"]["user_id"] = $this->Auth->user('id');152 $this->Sanitize->paranoid($this->data['News']['title']); 153 154 $this->Sanitize->paranoid($this->data['News']['reference']); 155 156 $this->Sanitize->html($this->data['News']['body']); 157 158 $this->data['News']['user_id'] = $this->Auth->user('id'); 160 159 161 160 $this->News->create(); 162 161 163 if ($this->News->save($this->data["News"])) 164 { 165 if ( $this->data["News"]["end"] == 1 ) 166 { 167 $this->msgFlash('Story added!','/admin/news/listing'); 168 } 169 else 170 { 171 $id = $this->News->getLastInsertID(); 172 $this->msgFlash('Story added','/admin/news/edit/'.$id); 173 } 174 } 175 } 176 } 177 178 public function admin_edit($id=null) 179 { 180 $this->layout = 'admin'; 181 182 if ( empty( $this->data["News"] ) ) 183 { 184 $this->News->id = $id; 185 186 $this->data = $this->News->read(); 187 188 $this->set('themes', Set::combine($this->News->Theme->find('all', array('order'=>'theme')),"{n}.Theme.id","{n}.Theme.theme")); 189 } 190 else 191 { 162 if ($this->News->save($this->data)): 163 if ( $this->data['News']['end'] == 1 ): 164 $this->msgFlash(__('Data saved', true),'/admin/news/listing'); 165 else: 166 $id = $this->News->getLastInsertID(); 167 $this->msgFlash(__('Data saved', true),'/admin/news/edit/'.$id); 168 endif; 169 endif; 170 endif; 171 } 172 173 public function admin_edit($news_id=null) 174 { 175 $this->layout = 'admin'; 176 177 $this->set('themes', Set::combine($this->News->Theme->find('all', array('order'=>'theme')),"{n}.Theme.id","{n}.Theme.theme")); 178 179 if ( empty($this->data['News']) ): 180 $this->data = $this->News->read(null, $news_id); 181 else: 192 182 $this->Sanitize = new Sanitize; 193 183 194 184 $this->Sanitize->paranoid($this->data['News']['title']); 195 185 … … 198 188 $this->Sanitize->html($this->data['News']['body']); 199 189 200 if ($this->News->save($this->data['News'])) 201 { 202 if ( $this->data["News"]["end"] == 1 ) 203 { 204 $this->msgFlash('Story saved', '/admin/news/listing'); 205 } 206 else 207 { 208 $this->msgFlash('Story saved', '/admin/news/edit/'.$this->data["News"]["id"]); 209 } 210 } 211 } 212 } 213 214 public function admin_delete($id) 190 if ($this->News->save($this->data)): 191 if ( $this->data['News']['end'] == 1 ): 192 $this->msgFlash(__('Data saved', true), '/admin/news/listing'); 193 else: 194 $this->msgFlash(__('Data saved', true), '/admin/news/edit/'.$this->data['News']['id']); 195 endif; 196 endif; 197 endif; 198 } 199 200 public function admin_delete($news_id) 215 201 { 216 if ( $this->News->del($id) ) 217 { 218 $this->msgFlash('New deleted', '/admin/news/listing'); 219 } 220 else 221 { 222 $this->flash('Database error!', '/admin/news/listing'); 223 } 202 if ( $this->News->del($news_id) ): 203 $this->msgFlash(__('Data removed', true), '/admin/news/listing/'); 204 endif; 224 205 } 225 206 }
