本文整理汇总了PHP中BackendModel::createURLForAction方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendModel::createURLForAction方法的具体用法?PHP BackendModel::createURLForAction怎么用?PHP BackendModel::createURLForAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BackendModel
的用法示例。
在下文中一共展示了BackendModel::createURLForAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
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('custom_fields') . '&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;
}
}
}
示例2: execute
/**
* Execute the action
*
* @return void
*/
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
if (is_callable(array('BackendSearchModel', 'removeIndex'))) {
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 {
$this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
}
}
示例3: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
BackendBlogModel::deleteSpamComments();
// item was deleted, so redirect
$this->redirect(BackendModel::createURLForAction('comments') . '&report=deleted-spam#tabSpam');
}
示例4: loadDataGrid
/**
* Loads the datagrid with the groups
*
* @return void
*/
private function loadDataGrid()
{
// create datagrid
$this->dataGrid = new BackendDataGridDB(BackendMailmotorModel::QRY_DATAGRID_BROWSE_GROUPS);
$this->dataGrid->setColumnsHidden(array('language', 'is_default'));
// sorting columns
$this->dataGrid->setSortingColumns(array('name', 'created_on'), 'created_on');
$this->dataGrid->setSortParameter('desc');
// set colum URLs
$this->dataGrid->setColumnURL('name', BackendModel::createURLForAction('addresses') . '&group_id=[id]');
// set the datagrid ID so we don't run into trouble with multiple datagrids that use mass actions
$this->dataGrid->setAttributes(array('id' => 'dgGroups'));
// add the multicheckbox column
$this->dataGrid->setMassActionCheckboxes('checkbox', '[id]', BackendMailmotorModel::getDefaultGroupIds());
$this->dataGrid->setColumnsSequence('checkbox', 'name', 'created_on', 'language');
// add mass action dropdown
$ddmMassAction = new SpoonFormDropdown('action', array('delete' => BL::lbl('Delete')), 'delete');
$this->dataGrid->setMassAction($ddmMassAction);
// set column functions
$this->dataGrid->setColumnFunction(array('BackendDataGridFunctions', 'getTimeAgo'), array('[created_on]'), 'created_on', true);
// add delete column
$this->dataGrid->addColumnAction('custom_fields', null, BL::lbl('CustomFields'), BackendModel::createURLForAction('custom_fields') . '&group_id=[id]', BL::lbl('CustomFields'), array('class' => 'button icon iconEdit linkButton'));
$this->dataGrid->addColumnAction('export', null, BL::lbl('Export'), BackendModel::createURLForAction('export_addresses') . '&id=[id]', BL::lbl('Export'), array('class' => 'button icon iconExport linkButton'));
$this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_group') . '&id=[id]', BL::lbl('Edit'));
// add styles
$this->dataGrid->setColumnAttributes('name', array('class' => 'title'));
// set paging limit
$this->dataGrid->setPagingLimit(self::PAGING_LIMIT);
}
示例5: execute
/**
* Execute the action
*/
public function execute()
{
// get parameters
$this->id = $this->getParameter('mailing_id', 'int');
// does the item exist
if (BackendMailmotorModel::existsMailing($this->id)) {
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// fetch the mailing
$mailing = BackendMailmotorModel::getMailing($this->id);
// get all data for the user we want to edit
$records = (array) BackendMailmotorCMHelper::getCM()->getCampaignBounces($mailing['cm_id']);
// reset some data
if (!empty($records)) {
// loop the records
foreach ($records as $record) {
// only remove the hard bounces
if ($record['bounce_type'] == 'Hard') {
// remove the address
BackendMailmotorModel::deleteAddresses($record['email']);
}
}
}
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_delete_bounces');
// user was deleted, so redirect
$this->redirect(BackendModel::createURLForAction('statistics') . '&id=' . $mailing['id'] . '&report=deleted-bounces');
} else {
$this->redirect(BackendModel::createURLForAction('statistics') . '&error=no-bounces');
}
}
示例6: 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 == '') {
$this->redirect(BackendModel::createURLForAction('index') . '&error=no-action-selected');
} elseif (!BackendFormBuilderModel::exists($formId)) {
$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);
}
}
示例7: validateForm
/**
* Validate the form
*/
private function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
// validate fields
$this->frm->getField('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 ? $this->frm->getField('template')->getValue() : $this->templates[0];
$item['language'] = BL::getWorkingLanguage();
$item['title'] = $this->frm->getField('title')->getValue();
$item['text'] = $this->frm->getField('text')->getValue();
$item['hidden'] = $this->frm->getField('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']);
}
}
}
示例8: 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');
}
}
示例9: validateForm
/**
* Validate the form
*
* @return void
*/
private function validateForm()
{
// is the form submitted?
if ($this->frm->isSubmitted()) {
// set callback for generating an unique URL
$this->meta->setURLCallback('BackendBlogModel', 'getURLForCategory');
// 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();
// insert the item
$item['id'] = BackendBlogModel::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']);
}
}
}
示例10: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// action to execute
$action = SpoonFilter::getGetValue('action', array('delete', 'export'), '');
$this->groupId = SpoonFilter::getGetValue('group_id', null, '');
// no id's provided
if (!$action) {
$this->redirect(BackendModel::createURLForAction('addresses') . '&error=no-action-selected');
}
if (!isset($_GET['emails'])) {
$this->redirect(BackendModel::createURLForAction('addresses') . '&error=no-items-selected');
} else {
// redefine id's
$this->emails = (array) $_GET['emails'];
// evaluate $action, see what action was triggered
switch ($action) {
case 'delete':
$this->deleteAddresses();
break;
case 'export':
$this->exportAddresses();
break;
}
}
}
示例11: 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('theme_templates') . '&theme=' . $item['theme'] . '&report=deleted-template&var=' . urlencode($item['label']));
} else {
$this->redirect(BackendModel::createURLForAction('theme_templates') . '&error=non-existing');
}
} else {
$this->redirect(BackendModel::createURLForAction('theme_templates') . '&error=non-existing');
}
}
示例12: validateForm
/**
* 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();
// get field
$txtName = $this->frm->getField('name');
// name filled in?
if ($txtName->isFilled(BL::getError('NameIsRequired'))) {
// name exists?
if (BackendProfilesModel::existsGroupName($txtName->getValue())) {
// set error
$txtName->addError(BL::getError('GroupNameExists'));
}
}
// no errors?
if ($this->frm->isCorrect()) {
// build item
$values['name'] = $txtName->getValue();
// insert values
$id = BackendProfilesModel::insertGroup($values);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_add_group', array('item' => $values));
// everything is saved, so redirect to the overview
$this->redirect(BackendModel::createURLForAction('groups') . '&report=group-added&var=' . urlencode($values['name']) . '&highlight=row-' . $id);
}
}
}
示例13: validateForm
/**
* Validates the settings form
*
* @return void
*/
private function validateForm()
{
// form is submitted
if ($this->frm->isSubmitted()) {
// cleanup the submitted fields, ignore fields that were added by hackers
$this->frm->cleanupFields();
// form is validated
if ($this->frm->isCorrect()) {
// set our settings (overview map)
BackendModel::setModuleSetting($this->URL->getModule(), 'zoom_level', (string) $this->frm->getField('zoom_level')->getValue());
BackendModel::setModuleSetting($this->URL->getModule(), 'width', (int) $this->frm->getField('width')->getValue());
BackendModel::setModuleSetting($this->URL->getModule(), 'height', (int) $this->frm->getField('height')->getValue());
BackendModel::setModuleSetting($this->URL->getModule(), 'map_type', (string) $this->frm->getField('map_type')->getValue());
// set our settings (widgets)
BackendModel::setModuleSetting($this->URL->getModule(), 'zoom_level_widget', (string) $this->frm->getField('zoom_level_widget')->getValue());
BackendModel::setModuleSetting($this->URL->getModule(), 'width_widget', (int) $this->frm->getField('width_widget')->getValue());
BackendModel::setModuleSetting($this->URL->getModule(), 'height_widget', (int) $this->frm->getField('height_widget')->getValue());
BackendModel::setModuleSetting($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');
}
}
}
示例14: 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 = BackendModel::getModuleSetting('location', 'width_widget');
}
if ($height < 150) {
$height = BackendModel::getModuleSetting('location', 'height_widget');
}
// set our settings (widgets)
BackendModel::setModuleSetting($this->URL->getModule(), 'zoom_level_widget', (string) $this->frm->getField('zoom_level_widget')->getValue());
BackendModel::setModuleSetting($this->URL->getModule(), 'width_widget', $width);
BackendModel::setModuleSetting($this->URL->getModule(), 'height_widget', $height);
BackendModel::setModuleSetting($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');
}
}
}
示例15: 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'];
$mailing['data'] = serialize($mailing['data']);
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']);
}