Changeset 695 for trunk/app/controllers
- Timestamp:
- 08/04/08 21:29:32 (4 months ago)
- Files:
-
- 1 modified
-
trunk/app/controllers/subjects_controller.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/subjects_controller.php
r661 r695 67 67 $this->layout = 'admin'; 68 68 69 // adds new classroom to database 70 if (!empty($this->data["Subject"])) 71 { 69 if (!empty($this->data['Subject'])): 70 72 71 $this->Sanitize = new Sanitize; 73 72 74 $this->Sanitize->clean($this->data[ "Subject"]); //Hopefully this is enough73 $this->Sanitize->clean($this->data['Subject']); 75 74 76 $this->Subject->create(); 77 78 if ($this->Subject->save($this->data["Subject"])) 79 { 80 $this->msgFlash('Your subject has been saved.','/admin/subjects/listing'); 81 } 82 } 75 if ($this->Subject->save($this->data)): 76 $this->msgFlash(__('Data saved', true),'/admin/subjects/listing'); 77 endif; 78 endif; 83 79 } 84 80 85 public function admin_edit($id = null) 86 { 87 88 if (empty($this->data["Subject"])) 89 { 81 public function admin_edit($subject_id = null) 82 { 83 if (empty($this->data['Subject'])): 84 90 85 $this->layout = 'admin'; 91 86 92 $this->Subject->id = $id; 93 94 $this->data = $this->Subject->read(); 95 } 96 else 97 { 87 $this->data = $this->Subject->read(null, $subject_id); 88 89 else: 90 98 91 $this->Sanitize = new Sanitize; 99 92 100 $this->Sanitize->clean($this->data[ "Subject"]); //Hopefully this is enough93 $this->Sanitize->clean($this->data['Subject']); 101 94 102 if ($this->Subject->save($this->data['Subject'])) 103 { 95 if ($this->Subject->save($this->data)): 104 96 $this->msgFlash('Your subject has been updated', '/admin/subjects/listing'); 105 } 106 }107 }97 endif; 98 endif; 99 } 108 100 109 public function admin_delete($id) 110 { 111 // deletes task from database 112 $this->Subject->del($id); 113 $this->msgFlash('Subject has been deleted','/admin/subjects/listing'); 114 } 115 101 public function admin_delete($subject_id) 102 { 103 if ( $this->Subject->del($subject_id) ): 104 $this->msgFlash('Subject has been deleted','/admin/subjects/listing'); 105 endif; 106 } 116 107 } 117 108 ?>
