本文整理匯總了PHP中Backend\Core\Engine\Model::createURLForAction方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model::createURLForAction方法的具體用法?PHP Model::createURLForAction怎麽用?PHP Model::createURLForAction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Backend\Core\Engine\Model
的用法示例。
在下文中一共展示了Model::createURLForAction方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: validateForm
/**
* 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']);
}
}
}
示例2: execute
/**
* 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');
}
}
示例3: validateForm
/**
* 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');
}
}
}
示例4: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
BackendCatalogModel::deleteSpamComments();
// item was deleted, so redirect
$this->redirect(BackendModel::createURLForAction('comments') . '&report=deleted-spam#tabSpam');
}
示例5: validateForm
/**
* 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']);
}
}
}
示例6: execute
/**
* 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');
}
}
示例7: execute
/**
* 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);
}
}
示例8: validateForm
/**
* 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']);
}
}
}
示例9: execute
/**
* 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');
}
示例10: execute
/**
* 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');
}
}
示例11: execute
/**
* 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();
}
示例12: execute
/**
* 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']);
}
示例13: validateForm
/**
* 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']);
}
}
}
示例14: execute
/**
* 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;
}
}
}
示例15: validateAuthConfigForm
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'));
}