In this case this is the base class for the delete action
Inheritance: extends Action
Example #1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendBlogModel::exists($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // set category id
         $this->categoryId = \SpoonFilter::getGetValue('category', null, null, 'int');
         if ($this->categoryId == 0) {
             $this->categoryId = null;
         }
         // get data
         $this->record = (array) BackendBlogModel::get($this->id);
         // delete item
         BackendBlogModel::delete($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         // delete search indexes
         BackendSearchModel::removeIndex($this->getModule(), $this->id);
         // build redirect URL
         $redirectUrl = BackendModel::createURLForAction('Index') . '&report=deleted&var=' . urlencode($this->record['title']);
         // append to redirect URL
         if ($this->categoryId != null) {
             $redirectUrl .= '&category=' . $this->categoryId;
         }
         // item was deleted, so redirect
         $this->redirect($redirectUrl);
     } else {
         // something went wrong
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Example #2
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendExtensionsModel::existsTemplate($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // init var
         $success = false;
         // get template (we need the title)
         $item = BackendExtensionsModel::getTemplate($this->id);
         // valid template?
         if (!empty($item)) {
             // delete the page
             $success = BackendExtensionsModel::deleteTemplate($this->id);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_delete_template', array('id' => $this->id));
         }
         // page is deleted, so redirect to the overview
         if ($success) {
             $this->redirect(BackendModel::createURLForAction('ThemeTemplates') . '&theme=' . $item['theme'] . '&report=deleted-template&var=' . urlencode($item['label']));
         } else {
             $this->redirect(BackendModel::createURLForAction('ThemeTemplates') . '&error=non-existing');
         }
     } else {
         // something went wrong
         $this->redirect(BackendModel::createURLForAction('ThemeTemplates') . '&error=non-existing');
     }
 }
Example #3
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     BackendCatalogModel::deleteSpamComments();
     // item was deleted, so redirect
     $this->redirect(BackendModel::createURLForAction('comments') . '&report=deleted-spam#tabSpam');
 }
Example #4
0
 /**
  * Execute the action.
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendProfilesModel::exists($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // get item
         $profile = BackendProfilesModel::get($this->id);
         // already blocked? Prolly want to unblock then
         if ($profile['status'] === 'blocked') {
             // set profile status to active
             BackendProfilesModel::update($this->id, array('status' => 'active'));
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_unblock', array('id' => $this->id));
             // redirect
             $this->redirect(BackendModel::createURLForAction('Index') . '&report=profile-unblocked&var=' . urlencode($profile['email']) . '&highlight=row-' . $this->id);
         } else {
             // delete profile session that may be active
             BackendProfilesModel::deleteSession($this->id);
             // set profile status to blocked
             BackendProfilesModel::update($this->id, array('status' => 'blocked'));
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_block', array('id' => $this->id));
             // redirect
             $this->redirect(BackendModel::createURLForAction('Index') . '&report=profile-blocked&var=' . urlencode($profile['email']) . '&highlight=row-' . $this->id);
         }
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     BackendAgendaModel::deleteSubscribedSubscriptions();
     // item was deleted, so redirect
     $this->redirect(BackendModel::createURLForAction('subscriptions') . '&report=deleted-subscribed#tabSubscribed');
 }
Example #6
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendBlogModel::existsCategory($this->id)) {
         // get data
         $this->record = (array) BackendBlogModel::getCategory($this->id);
         // allowed to delete the category?
         if (BackendBlogModel::deleteCategoryAllowed($this->id)) {
             // call parent, this will probably add some general CSS/JS or other required files
             parent::execute();
             // delete item
             BackendBlogModel::deleteCategory($this->id);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_delete_category', array('id' => $this->id));
             // category was deleted, so redirect
             $this->redirect(BackendModel::createURLForAction('Categories') . '&report=deleted-category&var=' . rawurlencode($this->record['title']));
         } else {
             $this->redirect(BackendModel::createURLForAction('Categories') . '&error=delete-category-not-allowed&var=' . rawurlencode($this->record['title']));
         }
     } else {
         // something went wrong
         $this->redirect(BackendModel::createURLForAction('Categories') . '&error=non-existing');
     }
 }
Example #7
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendGalleryModel::existsAlbum($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // get album
         $this->album = BackendGalleryModel::getAlbumFromId($this->id);
         // is this album allowed to be deleted?
         if (!BackendGalleryModel::deleteAlbumAllowed($this->id)) {
             $this->redirect(BackendModel::createURLForAction('albums') . '&error=album-not-deletable');
         } else {
             // delete the item
             BackendGalleryModel::deleteAlbumById($this->id);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_delete_album', array('id' => $this->id));
             // item was deleted, so redirect
             $this->redirect(BackendModel::createURLForAction('albums') . '&report=album-deleted&var=' . urlencode($this->album['title']));
         }
     } else {
         $this->redirect(BackendModel::createURLForAction('albums') . '&error=non-existing');
     }
 }
Example #8
0
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendHotelsModel::exists('hotels_rooms', $this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // get data
         $this->record = (array) BackendHotelsModel::getRecord('hotels_rooms', $this->id);
         if ($this->record['image']) {
             // the image path
             $imagePath = FRONTEND_FILES_PATH . '/rooms/images';
             BackendModel::deleteThumbnails($imagePath, $this->record['image']);
         }
         // delete item
         BackendHotelsModel::deleteRecord('hotels_rooms', $this->id);
         // build redirect URL
         $redirectUrl = BackendModel::createURLForAction('Rooms') . '&report=deleted&var=' . urlencode($this->record['title'] . '&id=' . $this->record['id']);
         // item was deleted, so redirect
         $this->redirect($redirectUrl);
     } else {
         // something went wrong
         $this->redirect(BackendModel::createURLForAction('Rooms') . '&error=non-existing&id=' . $this->record['id']);
     }
 }
Example #9
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     BackendCatalogModel::deleteCompletedOrders();
     // item was deleted, so redirect
     $this->redirect(BackendModel::createURLForAction('orders') . '&report=deleted-completed#tabCompleted');
 }
 public function execute()
 {
     parent::execute();
     try {
         $id = Uuid::fromString($this->getParameter('id', 'string'));
         $teamMember = $this->get('team_repository')->find($id);
     } catch (\Exception $e) {
         return $this->redirect(Model::createURLForAction('Index') . '&error=non-existing');
     }
     $this->get('team_repository')->delete($teamMember);
     return $this->redirect(Model::createURLForAction('Index') . '&report=deleted');
 }
Example #11
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendAgendaModel::exists($this->id)) {
         parent::execute();
         $this->record = (array) BackendAgendaModel::get($this->id);
         BackendAgendaModel::delete($this->id);
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['title']));
     } else {
         $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
     }
 }
Example #12
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendAddressesModel::exists($this->id)) {
         parent::execute();
         $this->record = (array) BackendAddressesModel::get($this->id);
         BackendAddressesModel::delete($this->id);
         BackendAddressesModel::deleteGroupsFromAddress($this->id);
         // delete the image
         \SpoonFile::delete(FRONTEND_FILES_PATH . '/Addresses/Images/Source/' . $this->record['image']);
         BackendSearchModel::removeIndex($this->getModule(), $this->id);
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['id']));
     } else {
         $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
     }
 }
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // Does the item exist?
     if ($this->id !== null && BackendInstagramModel::exists($this->id)) {
         parent::execute();
         $this->record = (array) BackendInstagramModel::get($this->id);
         if ($this->record['locked'] == 'Y') {
             $this->redirect(Model::createURLForAction('Index') . '&error=is-locked');
         }
         // Delete the file
         BackendInstagramModel::delete($this->id);
         Model::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         $this->redirect(Model::createURLForAction('Index') . '&report=deleted&var=' . urlencode($this->record['title']));
     } else {
         $this->redirect(Model::createURLForAction('Index') . '&error=non-existing');
     }
 }
Example #14
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // group exists and id is not null?
     if ($this->id !== null && BackendGroupsModel::exists($this->id)) {
         parent::execute();
         // get record
         $this->record = BackendGroupsModel::get($this->id);
         // delete group
         BackendGroupsModel::delete($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         // item was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('Index') . '&report=deleted&var=' . urlencode($this->record['name']));
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Example #15
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendContentBlocksModel::exists($this->id)) {
         parent::execute();
         $this->record = (array) BackendContentBlocksModel::get($this->id);
         // delete item
         BackendContentBlocksModel::delete($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         // item was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('Index') . '&report=deleted&var=' . urlencode($this->record['title']));
     } else {
         // no item found, redirect to the overview with an error
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Example #16
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendLocationModel::exists($this->id)) {
         parent::execute();
         // get all data for the item we want to edit
         $this->record = (array) BackendLocationModel::get($this->id);
         // delete item
         BackendLocationModel::delete($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         // user was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('Index') . '&report=deleted&var=' . urlencode($this->record['title']));
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
 /**
  * Execute the action
  *
  * @return  void
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     $this->gallery_id = $this->getParameter('gallery_id', 'int');
     // does the item exist
     if ($this->id !== null && BackendSlideshowModel::existsImage($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // delete item
         BackendSlideshowModel::deleteImage($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete_image', array('id' => $this->id));
         // item was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('Edit') . '&report=deleted&var=' . '&id=' . $this->gallery_id . '#images');
     } else {
         // something went wrong
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Example #18
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendFormBuilderModel::exists($this->id)) {
         parent::execute();
         // get all data for the item we want to edit
         $this->record = (array) BackendFormBuilderModel::get($this->id);
         // delete item
         BackendFormBuilderModel::delete($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         // user was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('Index') . '&report=deleted&var=' . rawurlencode($this->record['name']));
     } else {
         // no item found, throw an exceptions, because somebody is f*****g with our URL
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Example #19
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendSearchModel::existsSynonymById($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // get data
         $this->record = (array) BackendSearchModel::getSynonym($this->id);
         // delete item
         BackendSearchModel::deleteSynonym($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete_synonym', array('id' => $this->id));
         // item was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('Synonyms') . '&report=deleted-synonym&var=' . rawurlencode($this->record['term']));
     } else {
         $this->redirect(BackendModel::createURLForAction('Synonyms') . '&error=non-existing');
     }
 }
Example #20
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendFaqModel::existsCategory($this->id)) {
         $this->record = (array) BackendFaqModel::getCategory($this->id);
         if (BackendFaqModel::deleteCategoryAllowed($this->id)) {
             parent::execute();
             // delete item
             BackendFaqModel::deleteCategory($this->id);
             BackendModel::triggerEvent($this->getModule(), 'after_delete_category', array('item' => $this->record));
             // category was deleted, so redirect
             $this->redirect(BackendModel::createURLForAction('Categories') . '&report=deleted-category&var=' . urlencode($this->record['title']));
         } else {
             $this->redirect(BackendModel::createURLForAction('Categories') . '&error=delete-category-not-allowed&var=' . urlencode($this->record['title']));
         }
     } else {
         $this->redirect(BackendModel::createURLForAction('Categories') . '&error=non-existing');
     }
 }
Example #21
0
 /**
  * Execute the action.
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendProfilesModel::existsProfileGroup($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // get profile group
         $profileGroup = BackendProfilesModel::getProfileGroup($this->id);
         // delete profile group
         BackendProfilesModel::deleteProfileGroup($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_profile_delete_from_group', array('id' => $this->id));
         // profile group was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('edit') . '&id=' . $profileGroup['profile_id'] . '&report=membership-deleted#tabGroups');
     } else {
         $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
     }
 }
Example #22
0
 /**
  * Execute the action.
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendProfilesModel::existsGroup($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // get group
         $group = BackendProfilesModel::getGroup($this->id);
         // delete group
         BackendProfilesModel::deleteGroup($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete_group', array('id' => $this->id));
         // group was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('Groups') . '&report=deleted&var=' . rawurlencode($group['name']));
     } else {
         $this->redirect(BackendModel::createURLForAction('Groups') . '&error=non-existing');
     }
 }
Example #23
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendPagesModel::exists($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // init var
         $success = false;
         // cannot have children
         if (BackendPagesModel::getFirstChildId($this->id) !== false) {
             $this->redirect(BackendModel::createURLForAction('Edit') . '&error=non-existing');
         }
         $revisionId = $this->getParameter('revision_id', 'int');
         if ($revisionId == 0) {
             $revisionId = null;
         }
         // get page (we need the title)
         $page = BackendPagesModel::get($this->id, $revisionId);
         // valid page?
         if (!empty($page)) {
             // delete the page
             $success = BackendPagesModel::delete($this->id, null, $revisionId);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
             // delete search indexes
             BackendSearchModel::removeIndex($this->getModule(), $this->id);
             // build cache
             BackendPagesModel::buildCache(BL::getWorkingLanguage());
         }
         // page is deleted, so redirect to the overview
         if ($success) {
             $this->redirect(BackendModel::createURLForAction('Index') . '&id=' . $page['parent_id'] . '&report=deleted&var=' . rawurlencode($page['title']));
         } else {
             $this->redirect(BackendModel::createURLForAction('Edit') . '&error=non-existing');
         }
     } else {
         $this->redirect(BackendModel::createURLForAction('Edit') . '&error=non-existing');
     }
 }
Example #24
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendGalleryModel::existsCategory($this->id)) {
         parent::execute();
         // is this category allowed to be deleted?
         if (!BackendGalleryModel::deleteCategoryAllowed($this->id)) {
             $this->redirect(BackendModel::createURLForAction('categories') . '&error=category-not-deletable');
         } else {
             // get category
             $this->record = BackendGalleryModel::getCategoryFromId($this->id);
             // delete category
             BackendGalleryModel::deleteCategoryById($this->id);
             BackendModel::triggerEvent($this->getModule(), 'after_delete_category', array('id' => $this->id));
             $this->redirect(BackendModel::createURLForAction('categories') . '&report=category-deleted&var=' . urlencode($this->record['title']));
         }
     } else {
         $this->redirect(BackendModel::createURLForAction('categories') . '&error=non-existing');
     }
 }
Example #25
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendCatalogModel::exists($this->id)) {
         parent::execute();
         $this->record = BackendCatalogModel::get($this->id);
         // clean the tags
         BackendTagsModel::saveTags($this->id, '', $this->URL->getModule());
         // clean the related products
         BackendCatalogModel::saveRelatedProducts($this->id, array());
         // delete record
         BackendCatalogModel::delete($this->id);
         // delete search indexes
         BackendSearchModel::removeIndex($this->getModule(), $this->id);
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['title']));
     } else {
         $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
     }
 }
Example #26
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendLocaleModel::exists($this->id) && BackendAuthentication::getUser()->isGod()) {
         parent::execute();
         // filter options
         $this->setFilter();
         // get data
         $this->record = (array) BackendLocaleModel::get($this->id);
         // delete item
         BackendLocaleModel::delete(array($this->id));
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         // build redirect URL
         $redirectUrl = BackendModel::createURLForAction('Index') . '&report=deleted&var=' . urlencode($this->record['name'] . ' (' . strtoupper($this->record['language']) . ')') . $this->filterQuery;
         // item was deleted, so redirect
         $this->redirect($redirectUrl);
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Example #27
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the user exist
     if ($this->id !== null && BackendUsersModel::exists($this->id) && BackendAuthentication::getUser()->getUserId() != $this->id) {
         parent::execute();
         // get data
         $user = new BackendUser($this->id);
         // God-users can't be deleted
         if ($user->isGod()) {
             $this->redirect(BackendModel::createURLForAction('Index') . '&error=cant-delete-god');
         }
         // delete item
         BackendUsersModel::delete($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         // item was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('Index') . '&report=deleted&var=' . $user->getSetting('nickname'));
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }