コード例 #1
0
ファイル: DeleteFile.php プロジェクト: Comsa-Veurne/modules
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     //--Get the id
     $id = \SpoonFilter::getPostValue('id', null, '', 'string');
     //--Check if the id is not empty
     if (!empty($id)) {
         //--Delete file
         BackendGalleryModel::delete($id);
     }
     // success output
     $this->output(self::OK, null, 'image deleted');
 }
コード例 #2
0
ファイル: DeleteFiles.php プロジェクト: Comsa/modules
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     //--Get the ids as array
     $ids = \SpoonFilter::getPostValue('ids', null, '', 'array');
     //--Check if the id is not empty
     if (!empty($ids)) {
         foreach ($ids as $id) {
             //--Delete file
             BackendGalleryModel::delete($id);
         }
     }
     // success output
     $this->output(self::OK, null, 'images deleted');
 }
コード例 #3
0
ファイル: EditAlbum.php プロジェクト: Comsa/modules
 /**
  * Validate the form delete image
  *
  * @return void
  */
 private function validateFormDeleteImage()
 {
     //--Check if the delete-image form is submitted
     if ($this->frmDeleteImage->isSubmitted()) {
         //--Clean up fields in the form
         $this->frmDeleteImage->cleanupFields();
         //--Check if the image-array is not empty.
         if (!empty($this->images)) {
             //--Loop the images
             foreach ($this->images as $row) {
                 //--Check if the delete parameter is filled in.
                 if (\SpoonFilter::getPostValue("delete_" . $row["id"], null, "") == "Y") {
                     //--Delete the image
                     BackendGalleryModel::delete($row["id"]);
                 }
                 //--Update item
                 $item['id'] = $row['id'];
                 $item['language'] = $row['language'];
                 $item['description'] = \SpoonFilter::getPostValue("description_" . $row["id"], null, "");
                 BackendGalleryModel::updateImage($item);
             }
             $this->redirect(BackendModel::createURLForAction('edit_album') . '&id=' . $this->id . '&report=deleted-images#tabImages');
         }
     }
 }