예제 #1
0
 /**
  * Function used by the photo delete button
  * in /admin/reports/edit/N
  * @param $id is the DB id of the image to delete
  **/
 public function deletePhoto($id = 0)
 {
     $this->auto_render = false;
     $this->template = null;
     if ($id) {
         Media_Model::delete_photo($id);
     }
 }
예제 #2
0
 /**
  * Overrides the default delete method for the ORM.
  * Deletes all other content related to the incident - performs
  * an SQL destroy
  */
 public function delete()
 {
     // Delete Location
     ORM::factory('location')->where('id', $this->location_id)->delete_all();
     // Delete Categories
     ORM::factory('incident_category')->where('incident_id', $this->id)->delete_all();
     // Delete Translations
     ORM::factory('incident_lang')->where('incident_id', $this->id)->delete_all();
     // Delete Photos From Directory
     $photos = ORM::factory('media')->where('incident_id', $this->id)->where('media_type', 1)->find_all();
     foreach ($photos as $photo) {
         Media_Model::delete_photo($photo->id);
     }
     // Delete Media
     ORM::factory('media')->where('incident_id', $this->id)->delete_all();
     // Delete Sender
     ORM::factory('incident_person')->where('incident_id', $this->id)->delete_all();
     // Delete relationship to SMS message
     $updatemessage = ORM::factory('message')->where('incident_id', $this->id)->find();
     if ($updatemessage->loaded) {
         $updatemessage->incident_id = 0;
         $updatemessage->save();
     }
     // Delete Comments
     ORM::factory('comment')->where('incident_id', $this->id)->delete_all();
     // Delete ratings
     ORM::factory('rating')->where('incident_id', $this->id)->delete_all();
     $incident_id = $this->id;
     // Action::report_delete - Deleted a Report
     Event::run('ushahidi_action.report_delete', $incident_id);
     parent::delete();
 }
예제 #3
0
 /**
  * Delete Photo
  * @param int $id The unique id of the photo to be deleted
  */
 public function deletePhoto($id)
 {
     $this->auto_render = FALSE;
     $this->template = "";
     if ($id) {
         Media_Model::delete_photo($id);
     }
 }