Changeset 625 for trunk/app/controllers/lessons_controller.php
- Timestamp:
- 07/04/08 15:06:44 (5 months ago)
- Files:
-
- 1 modified
-
trunk/app/controllers/lessons_controller.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/lessons_controller.php
r540 r625 87 87 $this->set('subjects', Set::combine($this->Lesson->Subject->find('all', array('order' => 'title')), "{n}.Subject.id","{n}.Subject.title")); 88 88 89 if (!empty($this->data["Lesson"]))90 { 89 if (!empty($this->data['Lesson'])): 90 91 91 $this->Sanitize = new Sanitize; 92 92 93 $this->Sanitize->html($this->data[ "Lesson"]["title"]);93 $this->Sanitize->html($this->data['Lesson']['title']); 94 94 95 $this->Sanitize->html($this->data[ "Lesson"]["body"]);95 $this->Sanitize->html($this->data['Lesson']['body']); 96 96 97 $this->data[ "Lesson"]["user_id"] = $this->Auth->user('id');;97 $this->data['Lesson']['user_id'] = $this->Auth->user('id');; 98 98 99 if ($this->Lesson->save($this->data["Lesson"])) 100 { 99 if ($this->Lesson->save($this->data['Lesson'])): 101 100 $this->msgFlash('Lesson saved', '/admin/lessons/edit/'.$this->Lesson->getLastInsertID()); 102 }103 }101 endif; 102 endif; 104 103 } 105 104 … … 110 109 $this->set('subjects', Set::combine($this->Lesson->Subject->find('all', array('order' => 'title')), "{n}.Subject.id","{n}.Subject.title")); 111 110 112 if ( empty( $this->data["Lesson"] ) ) 113 { 111 if ( empty( $this->data["Lesson"] ) ): 112 114 113 $this->Lesson->id = $id; 115 114 116 115 $this->data = $this->Lesson->read(); 117 }118 else 119 {116 117 else: 118 120 119 $this->Sanitize = new Sanitize; 121 120 122 $this->Sanitize->html($this->data[ "Lesson"]["title"]);121 $this->Sanitize->html($this->data['Lesson']['title']); 123 122 124 $this->Sanitize->html($this->data[ "Lesson"]["body"]);123 $this->Sanitize->html($this->data['Lesson']['body']); 125 124 126 if ($this->Lesson->save($this->data["Lesson"])) 127 { 128 if ( $this->data["Lesson"]["end"] == 1 ) 129 { 130 $this->redirect('/admin/lessons/listing'); 131 } 132 else 133 { 134 $this->msgFlash('Your story has been saved!', '/admin/lessons/edit/'.$this->data["Lesson"]["id"]); 135 } 136 } 137 } 125 if ($this->Lesson->save($this->data['Lesson'])): 126 if ( $this->data['Lesson']['end'] == 1 ): 127 $this->redirect('/admin/lessons/listing'); 128 129 else: 130 $this->msgFlash(__('Data saved', true), '/admin/lessons/edit/'.$this->data["Lesson"]["id"]); 131 endif; 132 endif; 133 endif; 138 134 } 139 135 // change status enabled/disabled actived
