Changeset 637 for trunk/app/controllers/entries_controller.php
- Timestamp:
- 07/10/08 17:53:04 (5 months ago)
- Files:
-
- 1 modified
-
trunk/app/controllers/entries_controller.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/entries_controller.php
r635 r637 11 11 12 12 uses('sanitize'); 13 uses('l10n'); 13 14 14 15 15 class EntriesController extends AppController { … … 126 126 $this->Entry->create(); 127 127 128 if ($this->Entry->save($this->data ["Entry"])):128 if ($this->Entry->save($this->data)): 129 129 if ( $this->data["Entry"]["end"] == 1 ): // edition ends 130 $this->msgFlash( 'Story has been added', '/admin/entries/listing');130 $this->msgFlash(__('Entry saved', true), '/admin/entries/listing'); 131 131 132 132 else: //edition continue 133 133 $id = $this->Entry->getLastInsertID(); 134 $this->msgFlash( 'Story has been added', '/admin/entries/edit/'.$id);134 $this->msgFlash(__('Entry saved', true), '/admin/entries/edit/'.$id); 135 135 endif; 136 136 endif; … … 149 149 $this->layout = 'admin'; 150 150 151 $conditions = array("Entry.user_id"=>$this->Auth->user('id')); 152 153 $fields = null; 154 155 $order = 'Entry.id DESC'; 156 157 $limit = 20; 158 159 $this->set('data', $this->Entry->findAll($conditions, $fields, $order, $limit)); 151 $this->paginate['limit'] = 10; 152 153 $this->paginate['fields'] = array('Entry.title', 'Entry.body', 'Entry.created', 'Entry.status', 'Entry.user_id', 'Entry.discution', 'Entry.subject_id', 'Entry.id', 'User.username', 'Subject.title', 'Subject.id'); 154 155 $this->paginate['conditions'] = array("Entry.user_id"=>$this->Auth->user('id')); 156 157 $data = $this->paginate('Entry'); 158 159 $this->set(compact('data')); 160 160 161 } 161 162 … … 166 167 $this->set('subjects',Set::combine($this->Entry->Subject->find('all',array('order'=>'title')),"{n}.Subject.id","{n}.Subject.title")); 167 168 168 if (empty($this->data['Entry'])) 169 { 170 $this->data = $this->Entry->read(null, $id); 171 } 172 else 173 { 169 if (empty($this->data['Entry'])): 170 $this->data = $this->Entry->read(null, $id); 171 else: 174 172 $this->Sanitize = new Sanitize; 175 173 … … 182 180 $this->redirect('/admin/entries/listing'); 183 181 else: 184 $this->msgFlash( 'Entry has been updated','/admin/entries/edit/'.$this->data['Entry']['id']);182 $this->msgFlash(__('Entry saved', true),'/admin/entries/edit/'.$this->data['Entry']['id']); 185 183 endif; 186 184 endif; 187 }185 endif; 188 186 } 189 187 // change status enabled/disabled actived … … 195 193 196 194 if ($this->Entry->save($this->data['Entry'])): 197 $this->msgFlash( 'Entry status changed', '/admin/entries/listing');195 $this->msgFlash(__('Status modified', true), '/admin/entries/listing'); 198 196 endif; 199 197 } … … 210 208 { 211 209 if ( $this->Entry->del($id)): 212 $this->msgFlash( 'The entry has been deleted.', '/admin/entries/listing');210 $this->msgFlash(__('Data deleted',true), '/admin/entries/listing'); 213 211 endif; 214 212 }
