If you don't specify a module the current module will be used.
If you don't specify a language the current language will be used.
public static createURLForAction ( string $action = null, string $module = null, string $language = null, array $parameters = null, boolean $urlencode = true ) : string | ||
$action | string | The action to build the URL for. |
$module | string | The module to build the URL for. |
$language | string | The language to use, if not provided we will use the working language. |
$parameters | array | GET-parameters to use. |
$urlencode | boolean | Should the parameters be urlencoded? |
return | string |
/** * Validate the form * * @return void */ private function validateForm() { // is the form submitted? if ($this->frm->isSubmitted()) { // cleanup the submitted fields, ignore fields that were added by hackers $this->frm->cleanupFields(); // validate fields $this->frm->getField('title')->isFilled(BL::err('TitleIsRequired')); // validate meta $this->meta->validate(); // no errors? if ($this->frm->isCorrect()) { // build item $item['title'] = $this->frm->getField('title')->getValue(); $item['language'] = BL::getWorkingLanguage(); $item['meta_id'] = $this->meta->save(); $item['sequence'] = BackendSlideshowModel::getMaximumCategorySequence() + 1; // insert the item $item['id'] = BackendSlideshowModel::insertCategory($item); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_add_category', array('item' => $item)); // everything is saved, so redirect to the overview $this->redirect(BackendModel::createURLForAction('Categories') . '&report=added-category&var=' . urlencode($item['title']) . '&highlight=' . $item['id']); } } }
/** * 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'); } }
/** * Validates the settings form */ private function validateForm() { if ($this->frm->isSubmitted()) { $this->frm->cleanupFields(); if ($this->frm->isCorrect()) { // set the base values $width = (int) $this->frm->getField('width_widget')->getValue(); $height = (int) $this->frm->getField('height_widget')->getValue(); if ($width > 800) { $width = 800; } elseif ($width < 300) { $width = $this->get('fork.settings')->get('Location', 'width_widget'); } if ($height < 150) { $height = $this->get('fork.settings')->get('Location', 'height_widget'); } // set our settings (widgets) $this->get('fork.settings')->set($this->URL->getModule(), 'zoom_level_widget', (string) $this->frm->getField('zoom_level_widget')->getValue()); $this->get('fork.settings')->set($this->URL->getModule(), 'width_widget', $width); $this->get('fork.settings')->set($this->URL->getModule(), 'height_widget', $height); $this->get('fork.settings')->set($this->URL->getModule(), 'map_type_widget', (string) $this->frm->getField('map_type_widget')->getValue()); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_saved_settings'); // redirect to the settings page $this->redirect(BackendModel::createURLForAction('Settings') . '&report=saved'); } } }
/** * Execute the action */ public function execute() { parent::execute(); BackendCatalogModel::deleteSpamComments(); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('comments') . '&report=deleted-spam#tabSpam'); }
/** * Validate the form */ private function validateForm() { if ($this->frm->isSubmitted()) { // cleanup the submitted fields, ignore fields that were added by hackers $this->frm->cleanupFields(); // validate fields $this->frm->getField('title')->isFilled(BL::err('TitleIsRequired')); // no errors? if ($this->frm->isCorrect()) { // build item $item['title'] = $this->frm->getField('title')->getValue(); $item['language'] = BL::getWorkingLanguage(); $item['publish_on'] = BackendModel::getUTCDate('Y-m-d H:i:s'); $item['hidden'] = $this->frm->getField('hidden')->getValue(); // get the highest sequence available $item['sequence'] = BackendGalleryModel::getMaximumCategorySequence() + 1; // insert the item $item['id'] = BackendGalleryModel::insertCategory($item); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_add_category', array('item' => $item)); // everything is saved, so redirect to the overview $this->redirect(BackendModel::createURLForAction('categories') . '&report=added-category&var=' . urlencode($item['title']) . '&highlight=row-' . $item['id']); } } }
/** * 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'); } }
/** * Execute the action */ public function execute() { parent::execute(); // action to execute $action = \SpoonFilter::getGetValue('action', array('delete'), ''); // form id $formId = \SpoonFilter::getGetValue('form_id', null, '', 'int'); // no id's provided if (!isset($_GET['id'])) { $this->redirect(BackendModel::createURLForAction('Index') . '&error=no-items-selected'); } elseif ($action == '') { // no action provided $this->redirect(BackendModel::createURLForAction('Index') . '&error=no-action-selected'); } elseif (!BackendFormBuilderModel::exists($formId)) { // valid form id $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing'); } else { // redefine id's $ids = (array) $_GET['id']; // delete comment(s) if ($action == 'delete') { BackendFormBuilderModel::deleteData($ids); } // define report $report = count($ids) > 1 ? 'items-' : 'item-'; // init var if ($action == 'delete') { $report .= 'deleted'; } // redirect $this->redirect(BackendModel::createURLForAction('Data') . '&id=' . $formId . '&report=' . $report); } }
/** * Validate the form */ protected function validateForm() { if ($this->frm->isSubmitted()) { $this->frm->cleanupFields(); // Validation $fields = $this->frm->getFields(); $fields['username']->isFilled(Language::err('FieldIsRequired')); if ($this->frm->isCorrect()) { // Build the item $item['username'] = $fields['username']->getValue(); // Lookup user id $userObj = Helper::searchUser($item['username']); if (isset($userObj->data)) { $userId = $userObj->data[0]->id; $item['user_id'] = $userId; } else { $this->redirect(Model::createURLForAction('Index') . '&error=api_error'); } // Insert it $item['id'] = BackendInstagramModel::insert($item); Model::triggerEvent($this->getModule(), 'after_add', $item); $this->redirect(Model::createURLForAction('Index') . '&report=added&highlight=row-' . $item['id']); } } }
/** * Execute the action */ public function execute() { parent::execute(); // action to execute $action = SpoonFilter::getGetValue('action', array('deleteImages', 'deleteFiles', 'deleteVideos'), 'delete'); if (!isset($_GET['id'])) { $this->redirect(BackendModel::createURLForAction('index') . '&error=no-selection'); } else { // redefine id's $aIds = (array) $_GET['id']; $agendaID = (int) $_GET['agenda_id']; // delete media if ($action == 'deleteImages') { BackendAgendaModel::deleteImage($aIds); } else { if ($action == 'deleteFiles') { BackendAgendaModel::deleteFile($aIds); } else { if ($action == 'deleteVideos') { BackendAgendaModel::deleteVideo($aIds); } } } } $this->redirect(BackendModel::createURLForAction('media') . '&agenda_id=' . $agendaID . '&report=deleted'); }
/** * 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'); } }
/** * Execute the action */ public function execute() { // If step 1 isn't entered, redirect back to the first step of the wizard $this->record = \SpoonSession::get('module'); if (!$this->record || !array_key_exists('title', $this->record)) { $this->redirect(Model::createURLForAction('Add')); } // If there are no fields added, redirect back to the second step of the wizard if (!array_key_exists('fields', $this->record) || empty($this->record['fields'])) { $this->redirect(Model::createURLForAction('AddStep2')); } parent::execute(); // initialize some variables $this->backendPath = BACKEND_MODULES_PATH . '/' . $this->record['camel_case_name'] . '/'; $this->frontendPath = FRONTEND_MODULES_PATH . '/' . $this->record['camel_case_name'] . '/'; $this->variables = (array) $this->record; unset($this->variables['fields']); $this->generateFolders(); $this->generateBaseFiles(); $this->generateInstallerFiles(); // Backend $this->generateBackendFiles(); $this->generateBackendModel(); $this->generateBackendActions(); $this->generateBackendCategoryActions(); // Frontend $this->generateFrontendFiles(); $this->generateFrontendModel(); $this->generateFrontendActions(); $this->generateFrontendCategoryActions(); $this->generateFrontendCategoryWidget(); $this->parse(); $this->display(); }
/** * Execute the action */ public function execute() { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // action to execute $id = \SpoonFilter::getGetValue('id', null, 0); // no id's provided if (empty($id) || !BackendMailmotorModel::existsMailing($id)) { $this->redirect(BackendModel::createURLForAction('Index') . '&error=mailing-does-not-exist'); } else { // get the mailing and reset some fields $mailing = BackendMailmotorModel::getMailing($id); $mailing['status'] = 'concept'; $mailing['send_on'] = null; $mailing['created_on'] = BackendModel::getUTCDate('Y-m-d H:i:s'); $mailing['edited_on'] = $mailing['created_on']; unset($mailing['recipients'], $mailing['id'], $mailing['cm_id'], $mailing['send_on_raw']); // set groups $groups = $mailing['groups']; unset($mailing['groups']); // create a new mailing based on the old one $newId = BackendMailmotorModel::insertMailing($mailing); // update groups for this mailing BackendMailmotorModel::updateGroupsForMailing($newId, $groups); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_copy_mailing', array('item' => $mailing)); } // redirect $this->redirect(BackendModel::createURLForAction('Index') . '&report=mailing-copied&var=' . $mailing['name']); }
/** * Validate the form */ protected function validateForm() { if ($this->frm->isSubmitted()) { $this->frm->cleanupFields(); // validation $fields = $this->frm->getFields(); $fields['title']->isFilled(BL::err('FieldIsRequired')); if ($this->frm->isCorrect()) { $item['title'] = $fields['title']->getValue(); $item['id'] = BackendMailengineModel::insertGroup($item); //--Check if there are users if (isset($fields["users"])) { //--Get all the users $users = $fields["users"]->getValue(); foreach ($users as $key => $value) { $userGroup = array(); $userGroup["group_id"] = $item['id']; $userGroup["user_id"] = $value; //--Add user to the group BackendMailengineModel::insertUserToGroup($userGroup); } } BackendModel::triggerEvent($this->getModule(), 'after_add_group', $item); $this->redirect(BackendModel::createURLForAction('groups') . '&report=added&highlight=row-' . $item['id']); } } }
/** * Execute the action */ public function execute() { parent::execute(); // action to execute $action = \SpoonFilter::getGetValue('action', array('delete'), ''); // get passed group ID $id = \SpoonFilter::getGetValue('group_id', null, 0, 'int'); // fetch group record $this->group = BackendMailmotorModel::getGroup($id); // set redirect URL $redirectURL = BackendModel::createURLForAction('CustomFields') . '&group_id=' . $this->group['id']; // no id's provided if (!$action) { $this->redirect($redirectURL . '&error=no-action-selected'); } if (!isset($_GET['fields'])) { $this->redirect($redirectURL . '&error=no-items-selected'); } if (empty($this->group)) { $this->redirect(BackendModel::createURLForAction('Groups') . '&error=non-existing'); } else { // redefine id's $this->fields = (array) $_GET['fields']; // evaluate $action, see what action was triggered switch ($action) { case 'delete': $this->deleteCustomFields(); break; } } }
private function validateAuthConfigForm() { $this->get('fork.settings')->set($this->URL->getModule(), 'client_id', $this->frm->getField('client_id')->getValue()); $this->get('fork.settings')->set($this->URL->getModule(), 'client_secret', $this->frm->getField('client_secret')->getValue()); // We need to authenticate, redirect to oauth $this->redirect(BackendModel::createURLForAction('oauth')); }
private function validateForm() { if ($this->frm->isSubmitted()) { $fields = $this->frm->getFields(); $fields['title']->isFilled(BL::err('TitleIsRequired')); if ($this->frm->isCorrect()) { $item = []; $item['title'] = $fields['title']->getValue(); $item['capacity'] = $fields['capacity']->getValue(); $item['price'] = $fields['price']->getValue(); $item['count'] = $fields['count']->getValue(); $item['image'] = null; $item['hotel_id'] = $this->id; if ($fields['image']->isFilled()) { // the image path $imagePath = FRONTEND_FILES_PATH . '/rooms/images'; // create folders if needed $fs = new Filesystem(); $fs->mkdir(array($imagePath . '/source', $imagePath . '/128x128')); $item['image'] = $fields['image']->getFileName(false) . '.' . $fields['image']->getExtension(); $i = 2; while ($fs->exists($imagePath . '/source/' . $item['image'])) { $item['image'] = $fields['image']->getFileName(false) . '(' . $i . ')' . '.' . $fields['image']->getExtension(); $i++; } // upload the image & generate thumbnails $fields['image']->generateThumbnails($imagePath, $item['image']); } $item['id'] = BackendHotelsModel::insertRecord('hotels_rooms', $item); $this->redirect(BackendModel::createURLForAction('Rooms') . '&id=' . $this->id . '&report=added&var=' . urlencode($item['title']) . '&highlight=row-' . $item['id']); } } }
/** * 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'); } }
/** * Execute the action */ public function execute() { parent::execute(); BackendAgendaModel::deleteSubscribedSubscriptions(); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('subscriptions') . '&report=deleted-subscribed#tabSubscribed'); }
/** * Validate the form */ protected function validateForm() { if ($this->frm->isSubmitted()) { $this->frm->cleanupFields(); $frmFields = $this->frm->getFields(); // validate form if ($frmFields['twitter']->isChecked()) { // we need fields when search is ticked $frmFields['twitter_name']->isFilled(Language::err('FieldIsRequired')); } if ($this->frm->isCorrect()) { // if this field is checked, let's add a boolean searchable true to the chosen fields if ($frmFields['twitter']->isChecked()) { $this->record['twitter'] = $frmFields['twitter_name']->getValue(); } else { if (array_key_exists('twitter', $this->record)) { unset($this->record['twitter']); } } // save the object in our session \SpoonSession::set('module', $this->record); $this->redirect(Model::createURLForAction('Generate')); } } }
/** * Execute the action */ public function execute() { parent::execute(); BackendCatalogModel::deleteCompletedOrders(); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('orders') . '&report=deleted-completed#tabCompleted'); }
/** * Validate the form */ private function validateForm() { // Is the form submitted? if ($this->frm->isSubmitted()) { // Cleanup the submitted fields, ignore fields that were added by hackers $this->frm->cleanupFields(); // XML provided? if ($this->frm->getField('wordpress')->isFilled()) { $this->frm->getField('wordpress')->isAllowedExtension(array('xml'), BL::err('XMLFilesOnly')); } else { // No file $this->frm->getField('wordpress')->addError(BL::err('FieldIsRequired')); } // No errors? if ($this->frm->isCorrect()) { // Move the file $this->frm->getField('wordpress')->moveFile(FRONTEND_FILES_PATH . '/wordpress.xml'); // Process the XML $this->processXML(); // Remove the file $this->fs->remove(FRONTEND_FILES_PATH . '/wordpress.xml'); // Everything is saved, so redirect to the overview $this->redirect(BackendModel::createURLForAction('index') . '&report=imported'); } } }
/** * Validate the form */ private function validateForm() { if ($this->frm->isSubmitted()) { $this->frm->cleanupFields(); $fields = $this->frm->getFields(); // validate fields $fields['title']->isFilled(BL::err('TitleIsRequired')); if ($this->frm->isCorrect()) { // build item $item['id'] = BackendContentBlocksModel::getMaximumId() + 1; $item['user_id'] = BackendAuthentication::getUser()->getUserId(); $item['template'] = count($this->templates) > 1 ? $fields['template']->getValue() : $this->templates[0]; $item['language'] = BL::getWorkingLanguage(); $item['title'] = $fields['title']->getValue(); $item['text'] = $fields['text']->getValue(); $item['hidden'] = $fields['hidden']->getValue() ? 'N' : 'Y'; $item['status'] = 'active'; $item['created_on'] = BackendModel::getUTCDate(); $item['edited_on'] = BackendModel::getUTCDate(); // insert the item $item['revision_id'] = BackendContentBlocksModel::insert($item); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_add', array('item' => $item)); // everything is saved, so redirect to the overview $this->redirect(BackendModel::createURLForAction('Index') . '&report=added&var=' . urlencode($item['title']) . '&highlight=row-' . $item['id']); } } }
/** * Validate the form */ private function validateForm() { if ($this->frm->isSubmitted()) { $this->frm->cleanupFields(); // get fields $ddmGroup = $this->frm->getField('group'); $fileFile = $this->frm->getField('file'); $csv = array(); // validate input $ddmGroup->isFilled(BL::getError('FieldIsRequired')); if ($fileFile->isFilled(BL::err('FieldIsRequired'))) { if ($fileFile->isAllowedExtension(array('csv'), sprintf(BL::getError('ExtensionNotAllowed'), 'csv'))) { $csv = Csv::fileToArray($fileFile->getTempFileName()); if ($csv === false) { $fileFile->addError(BL::getError('InvalidCSV')); } } } if ($this->frm->isCorrect()) { // import the profiles $overwrite = $this->frm->getField('overwrite_existing')->isChecked(); $statistics = BackendProfilesModel::importCsv($csv, $ddmGroup->getValue(), $overwrite); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_import', array('statistics' => $statistics)); // build redirect url with the right message $redirectUrl = BackendModel::createURLForAction('index') . '&report='; $redirectUrl .= $overwrite ? 'profiles-imported-and-updated' : 'profiles-imported'; $redirectUrl .= '&var[]=' . $statistics['count']['inserted']; $redirectUrl .= '&var[]=' . $statistics['count']['exists']; // everything is saved, so redirect to the overview $this->redirect($redirectUrl); } } }
/** * Validate the form */ private function validateForm() { // is the form submitted? if ($this->frm->isSubmitted()) { // cleanup the submitted fields, ignore fields that were added by hackers $this->frm->cleanupFields(); // validate field $this->frm->getField('synonym')->isFilled(BL::err('SynonymIsRequired')); $this->frm->getField('term')->isFilled(BL::err('TermIsRequired')); if (BackendSearchModel::existsSynonymByTerm($this->frm->getField('term')->getValue())) { $this->frm->getField('term')->addError(BL::err('TermExists')); } // no errors? if ($this->frm->isCorrect()) { // build item $item = array(); $item['term'] = $this->frm->getField('term')->getValue(); $item['synonym'] = $this->frm->getField('synonym')->getValue(); $item['language'] = BL::getWorkingLanguage(); // insert the item $id = BackendSearchModel::insertSynonym($item); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_add_synonym', array('item' => $item)); // everything is saved, so redirect to the overview $this->redirect(BackendModel::createURLForAction('Synonyms') . '&report=added-synonym&var=' . rawurlencode($item['term']) . '&highlight=row-' . $id); } } }
/** * Validate the form */ private function validateForm() { if ($this->frm->isSubmitted()) { $this->frm->cleanupFields(); // validate fields $this->meta->validate(); if ($this->frm->isCorrect()) { // build item $item['language'] = BL::getWorkingLanguage(); $item['meta_id'] = $this->meta->save(); $item['sequence'] = BackendCatalogModel::getMaximumSpecificationSequence() + 1; // save the data $item['id'] = BackendCatalogModel::insertSpecification($item); //--Add the languages foreach ((array) BackendModel::get('fork.settings')->get('Core', 'languages') as $key => $language) { $itemLanguage = array(); $itemLanguage['id'] = $item['id']; $itemLanguage['language'] = $language; $itemLanguage['title'] = $this->frm->getField('title_' . $language)->getValue(); BackendCatalogModel::insertSpecificationLanguage($itemLanguage); } // trigger event BackendModel::triggerEvent($this->getModule(), 'after_add_specification', array('item' => $item)); // everything is saved, so redirect to the overview $this->redirect(BackendModel::createURLForAction('specifications') . '&report=added-specification&var=' . urlencode($this->frm->getField('title_nl')->getValue()) . '&highlight=row-' . $item['id']); } } }
/** * 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'); } }
/** * Execute the action */ public function execute() { parent::execute(); BackendAuthentication::logout(); // redirect to login-screen $this->redirect(BackendModel::createURLForAction('Index', $this->getModule())); }
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']); } }
/** * Load the datagrids * * @return void */ private function loadDataGrids() { // load all categories that are in use $categories = BackendSlideshowModel::getActiveCategories(true); // run over categories and create datagrid for each one foreach ($categories as $categoryId => $categoryTitle) { // create datagrid $dataGrid = new BackendDataGridDB(BackendSlideshowModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $categoryId)); // disable paging $dataGrid->setPaging(false); // set colum URLs $dataGrid->setColumnURL('title', BackendModel::createURLForAction('Edit') . '&id=[id]'); // set column functions $dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[publish_on]'), 'publish_on', true); $dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getUser'), array('[user_id]'), 'user_id', true); // set headers $dataGrid->setHeaderLabels(array('user_id' => \SpoonFilter::ucfirst(BL::lbl('Author')), 'publish_on' => \SpoonFilter::ucfirst(BL::lbl('PublishedOn')))); // enable drag and drop $dataGrid->enableSequenceByDragAndDrop(); // our JS needs to know an id, so we can send the new order $dataGrid->setRowAttributes(array('id' => '[id]')); $dataGrid->setAttributes(array('data-action' => "GallerySequence")); // create a column #images $dataGrid->addColumn('images', ucfirst(BL::lbl('Images'))); $dataGrid->setColumnFunction(array('Backend\\Modules\\Slideshow\\Engine\\Model', 'getImagesByGallery'), array('[id]', true), 'images', true); // hide columns $dataGrid->setColumnsHidden(array('category_id', 'sequence', 'filename')); // add edit column $dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&id=[id]', BL::lbl('Edit')); // set column order $dataGrid->setColumnsSequence('dragAndDropHandle', 'title', 'images', 'user_id', 'publish_on', 'edit'); // add dataGrid to list $this->dataGrids[] = array('id' => $categoryId, 'title' => $categoryTitle, 'content' => $dataGrid->getContent()); } }
/** * Execute the action */ public function execute() { parent::execute(); // current status $from = \SpoonFilter::getGetValue('from', array('subscribed', 'moderation'), 'subscribed'); // action to execute $action = \SpoonFilter::getGetValue('action', array('subscribed', 'moderation', 'delete'), 'moderation'); // no id's provided if (!isset($_GET['id'])) { $this->redirect(BackendModel::createURLForAction('subscriptions') . '&error=no-subscriptions-selected'); } // redefine id's $ids = (array) $_GET['id']; // delete comment(s) if ($action == 'delete') { BackendAgendaModel::deleteSubscriptions($ids); } else { // set new status BackendAgendaModel::updateSubscriptionStatuses($ids, $action); } // define report $report = count($ids) > 1 ? 'subscriptions-' : 'subscription-'; // init var if ($action == 'subscribed') { $report .= 'moved-subscribed'; } if ($action == 'moderation') { $report .= 'moved-moderation'; } if ($action == 'delete') { $report .= 'deleted'; } // redirect $this->redirect(BackendModel::createURLForAction('subscriptions') . '&report=' . $report . '#tab' . \SpoonFilter::ucfirst($from)); }