예제 #1
0
 /**
  * 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
                     BackendGalleriaModel::delete($row["id"]);
                 }
                 //--Update item
                 $item['id'] = $row['id'];
                 $item['language'] = $row['language'];
                 $item['description'] = \SpoonFilter::getPostValue("description_" . $row["id"], null, "");
                 BackendGalleriaModel::updateImage($item);
             }
             $this->redirect(BackendModel::createURLForAction('edit_album') . '&id=' . $this->id . '&report=deleted-images#tabImages');
         }
     }
 }