本文整理汇总了PHP中SpoonFilter类的典型用法代码示例。如果您正苦于以下问题:PHP SpoonFilter类的具体用法?PHP SpoonFilter怎么用?PHP SpoonFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SpoonFilter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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']);
}
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:34,代码来源:copy.php
示例2: parse
/**
* Parse the form
*/
protected function parse()
{
parent::parse();
// prevent XSS
$filter = \SpoonFilter::arrayMapRecursive('htmlspecialchars', $this->filter);
$this->tpl->assign($filter);
}
开发者ID:bwgraves,项目名称:forkcms,代码行数:10,代码来源:Add.php
示例3: parse
/**
* Parse the correct messages into the template
*/
protected function parse()
{
parent::parse();
// grab the error-type from the parameters
$errorType = $this->getParameter('type');
// set correct headers
switch ($errorType) {
case 'module-not-allowed':
case 'action-not-allowed':
SpoonHTTP::setHeadersByCode(403);
break;
case 'not-found':
SpoonHTTP::setHeadersByCode(404);
break;
}
// querystring provided?
if ($this->getParameter('querystring') !== null) {
// split into file and parameters
$chunks = explode('?', $this->getParameter('querystring'));
// get extension
$extension = SpoonFile::getExtension($chunks[0]);
// if the file has an extension it is a non-existing-file
if ($extension != '' && $extension != $chunks[0]) {
// set correct headers
SpoonHTTP::setHeadersByCode(404);
// give a nice error, so we can detect which file is missing
echo 'Requested file (' . htmlspecialchars($this->getParameter('querystring')) . ') not found.';
// stop script execution
exit;
}
}
// assign the correct message into the template
$this->tpl->assign('message', BL::err(SpoonFilter::toCamelCase(htmlspecialchars($errorType), '-')));
}
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:37,代码来源:index.php
示例4: loadForm
/**
* Loads the settings form
*/
private function loadForm()
{
// init settings form
$this->frm = new BackendForm('settings');
// get current settings
$this->settings = BackendSearchModel::getModuleSettings();
// add field for pagination
$this->frm->addDropdown('overview_num_items', array_combine(range(1, 30), range(1, 30)), BackendModel::getModuleSetting($this->URL->getModule(), 'overview_num_items', 20));
$this->frm->addDropdown('autocomplete_num_items', array_combine(range(1, 30), range(1, 30)), BackendModel::getModuleSetting($this->URL->getModule(), 'autocomplete_num_items', 20));
$this->frm->addDropdown('autosuggest_num_items', array_combine(range(1, 30), range(1, 30)), BackendModel::getModuleSetting($this->URL->getModule(), 'autosuggest_num_items', 20));
// modules that, no matter what, can not be searched
$disallowedModules = array('search');
// loop modules
foreach (BackendModel::getModulesForDropDown() as $module => $label) {
// check if module is searchable
if (!in_array($module, $disallowedModules) && is_callable(array('Frontend' . SpoonFilter::toCamelCase($module) . 'Model', 'search'))) {
// add field to decide wether or not this module is searchable
$this->frm->addCheckbox('search_' . $module, isset($this->settings[$module]) ? $this->settings[$module]['searchable'] == 'Y' : false);
// add field to decide weight for this module
$this->frm->addText('search_' . $module . '_weight', isset($this->settings[$module]) ? $this->settings[$module]['weight'] : 1);
// field disabled?
if (!isset($this->settings[$module]) || $this->settings[$module]['searchable'] != 'Y') {
$this->frm->getField('search_' . $module . '_weight')->setAttribute('disabled', 'disabled');
$this->frm->getField('search_' . $module . '_weight')->setAttribute('class', 'inputText disabled');
}
// add to list of modules
$this->modules[] = array('module' => $module, 'id' => $this->frm->getField('search_' . $module)->getAttribute('id'), 'label' => $label, 'chk' => $this->frm->getField('search_' . $module)->parse(), 'txt' => $this->frm->getField('search_' . $module . '_weight')->parse(), 'txtError' => '');
}
}
}
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:33,代码来源:settings.php
示例5: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$formId = \SpoonFilter::getPostValue('form_id', null, '', 'int');
$newIdSequence = trim(\SpoonFilter::getPostValue('new_id_sequence', null, '', 'string'));
// invalid form id
if (!BackendFormBuilderModel::exists($formId)) {
$this->output(self::BAD_REQUEST, null, 'form does not exist');
} else {
// list id
$ids = (array) explode('|', rtrim($newIdSequence, '|'));
// loop id's and set new sequence
foreach ($ids as $i => $id) {
$id = (int) $id;
// get field
$field = BackendFormBuilderModel::getField($id);
// from this form and not a submit button
if (!empty($field) && $field['form_id'] == $formId && $field['type'] != 'submit') {
BackendFormBuilderModel::updateField($id, array('sequence' => $i + 1));
}
}
$this->output(self::OK, null, 'sequence updated');
}
}
开发者ID:bwgraves,项目名称:forkcms,代码行数:28,代码来源:Sequence.php
示例6: execute
/**
* Execute the action
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// get parameters
$charset = $this->getContainer()->getParameter('kernel.charset');
$searchTerm = \SpoonFilter::getPostValue('term', null, '');
$term = $charset == 'utf-8' ? \SpoonFilter::htmlspecialchars($searchTerm) : \SpoonFilter::htmlentities($searchTerm);
$limit = (int) $this->get('fork.settings')->get('Search', 'autocomplete_num_items', 10);
// validate
if ($term == '') {
$this->output(self::BAD_REQUEST, null, 'term-parameter is missing.');
} else {
// get matches
$matches = FrontendSearchModel::getStartsWith($term, FRONTEND_LANGUAGE, $limit);
// get search url
$url = FrontendNavigation::getURLForBlock('Search');
// loop items and set search url
foreach ($matches as &$match) {
$match['url'] = $url . '?form=search&q=' . $match['term'];
}
// output
$this->output(self::OK, $matches);
}
}
开发者ID:bwgraves,项目名称:forkcms,代码行数:28,代码来源:Autocomplete.php
示例7: 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');
}
}
开发者ID:netconstructor,项目名称:forkcms,代码行数:40,代码来源:delete.php
示例8: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$charset = $this->getContainer()->getParameter('kernel.charset');
$searchTerm = \SpoonFilter::getPostValue('term', null, '');
$term = $charset == 'utf-8' ? \SpoonFilter::htmlspecialchars($searchTerm) : \SpoonFilter::htmlentities($searchTerm);
// validate search term
if ($term == '') {
$this->output(self::BAD_REQUEST, null, 'term-parameter is missing.');
} else {
// previous search result
$previousTerm = \SpoonSession::exists('searchTerm') ? \SpoonSession::get('searchTerm') : '';
\SpoonSession::set('searchTerm', '');
// save this term?
if ($previousTerm != $term) {
// format data
$this->statistics = array();
$this->statistics['term'] = $term;
$this->statistics['language'] = LANGUAGE;
$this->statistics['time'] = FrontendModel::getUTCDate();
$this->statistics['data'] = serialize(array('server' => $_SERVER));
$this->statistics['num_results'] = FrontendSearchModel::getTotal($term);
// save data
FrontendSearchModel::save($this->statistics);
}
// save current search term in cookie
\SpoonSession::set('searchTerm', $term);
// output
$this->output(self::OK);
}
}
开发者ID:forkcms,项目名称:forkcms,代码行数:35,代码来源:Save.php
示例9: 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;
}
}
}
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:29,代码来源:mass_address_action.php
示例10: parse
/**
* Parse the data into the template
*/
private function parse()
{
// get vars
$title = \SpoonFilter::ucfirst(FL::msg('BlogAllComments'));
$link = SITE_URL . FrontendNavigation::getURLForBlock('Blog');
$detailLink = SITE_URL . FrontendNavigation::getURLForBlock('Blog', 'Detail');
$description = null;
// create new rss instance
$rss = new FrontendRSS($title, $link, $description);
// loop articles
foreach ($this->items as $item) {
// init vars
$title = $item['author'] . ' ' . FL::lbl('On') . ' ' . $item['post_title'];
$link = $detailLink . '/' . $item['post_url'] . '/#comment-' . $item['id'];
$description = $item['text'];
// create new instance
$rssItem = new FrontendRSSItem($title, $link, $description);
// set item properties
$rssItem->setPublicationDate($item['created_on']);
$rssItem->setAuthor($item['author']);
// add item
$rss->addItem($rssItem);
}
$rss->parse();
}
开发者ID:bwgraves,项目名称:forkcms,代码行数:28,代码来源:CommentsRss.php
示例11: 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();
// get parameters
$id = SpoonFilter::getPostValue('id', null, '', 'int');
$name = trim(SpoonFilter::getPostValue('value', null, '', 'string'));
// validate
if ($name == '') {
$this->output(self::BAD_REQUEST, null, 'no name provided');
}
// get existing id
$existingId = BackendMailmotorModel::getCampaignId($name);
// existing campaign
if ($existingId !== 0 && $id !== $existingId) {
$this->output(self::ERROR, array('id' => $existingId, 'error' => true), BL::err('CampaignExists', $this->getModule()));
}
// build array
$item = array();
$item['id'] = $id;
$item['name'] = $name;
$item['created_on'] = BackendModel::getUTCDate('Y-m-d H:i:s');
// get page
$rows = BackendMailmotorModel::updateCampaign($item);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'edited_campaign', array('item' => $item));
// output
if ($rows !== 0) {
$this->output(self::OK, array('id' => $id), BL::msg('CampaignEdited', $this->getModule()));
} else {
$this->output(self::ERROR, null, BL::err('CampaignNotEdited', $this->getModule()));
}
}
开发者ID:netconstructor,项目名称:forkcms,代码行数:38,代码来源:edit_campaign.php
示例12: loadForm
/**
* Loads the form.
*/
private function loadForm()
{
// init var
$modules = array();
$checkedModules = SpoonSession::exists('modules') ? SpoonSession::get('modules') : array();
// loop required modules
foreach ($this->modules['required'] as $module) {
// add to the list
$modules[] = array('label' => SpoonFilter::toCamelCase($module), 'value' => $module, 'attributes' => array('disabled' => 'disabled'));
// update $_POST if needed
if (!isset($_POST['modules']) || !is_array($_POST['modules']) || !in_array($module, $_POST['modules'])) {
$_POST['modules'][] = $module;
}
}
// loop optional modules
foreach ($this->modules['optional'] as $module) {
// add to the list
$modules[] = array('label' => SpoonFilter::toCamelCase($module), 'value' => $module);
}
// add multi checkbox
$this->frm->addMultiCheckbox('modules', $modules, array_unique(array_merge($this->modules['required'], $checkedModules)));
// example data
$this->frm->addCheckbox('example_data', SpoonSession::exists('example_data') ? SpoonSession::get('example_data') : true);
// debug mode
$this->frm->addCheckbox('debug_mode', SpoonSession::exists('debug_mode') ? SpoonSession::get('debug_mode') : false);
// specific debug email address
$this->frm->addCheckbox('different_debug_email', SpoonSession::exists('different_debug_email') ? SpoonSession::get('different_debug_email') : false);
// specific debug email address text
$this->frm->addText('debug_email', SpoonSession::exists('debug_email') ? SpoonSession::get('debug_email') : '');
}
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:33,代码来源:step_4.php
示例13: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
// get parameters
$mailingId = SpoonFilter::getPostValue('mailing_id', null, '', 'int');
$sendOnDate = SpoonFilter::getPostValue('send_on_date', null, BackendModel::getUTCDate('d/m/Y'));
$sendOnTime = SpoonFilter::getPostValue('send_on_time', null, BackendModel::getUTCDate('H:i'));
$messageDate = $sendOnDate;
// validate mailing ID
if ($mailingId == '') {
$this->output(self::BAD_REQUEST, null, 'Provide a valid mailing ID');
}
if ($sendOnDate == '' || $sendOnTime == '') {
$this->output(self::BAD_REQUEST, null, 'Provide a valid send date date provided');
}
// record is empty
if (!BackendMailmotorModel::existsMailing($mailingId)) {
$this->output(self::BAD_REQUEST, null, BL::err('MailingDoesNotExist', 'mailmotor'));
}
// reverse the date and make it a proper
$explodedDate = explode('/', $sendOnDate);
$sendOnDate = $explodedDate[2] . '-' . $explodedDate[1] . '-' . $explodedDate[0];
// calc full send timestamp
$sendTimestamp = strtotime($sendOnDate . ' ' . $sendOnTime);
// build data
$item['id'] = $mailingId;
$item['send_on'] = BackendModel::getUTCDate('Y-m-d H:i:s', $sendTimestamp);
$item['edited_on'] = BackendModel::getUTCDate('Y-m-d H:i:s');
// update mailing
BackendMailmotorModel::updateMailing($item);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_edit_mailing_step4', array('item' => $item));
// output
$this->output(self::OK, array('mailing_id' => $mailingId, 'timestamp' => $sendTimestamp), sprintf(BL::msg('SendOn', $this->getModule()), $messageDate, $sendOnTime));
}
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:38,代码来源:save_send_date.php
示例14: __construct
public function __construct()
{
// define the Named Application
if (!defined('NAMED_APPLICATION')) {
define('NAMED_APPLICATION', 'backend');
}
// set the module
$this->setModule(SpoonFilter::getGetValue('module', null, ''));
// set the requested file
$this->setFile(SpoonFilter::getGetValue('file', null, ''));
// set the language
$this->setLanguage(SpoonFilter::getGetValue('language', array_keys(BackendLanguage::getWorkingLanguages()), SITE_DEFAULT_LANGUAGE));
// build the path
if ($this->module == 'core') {
$path = BACKEND_CORE_PATH . '/js/' . $this->getFile();
} else {
$path = BACKEND_MODULES_PATH . '/' . $this->getModule() . '/js/' . $this->getFile();
}
// set correct headers
SpoonHTTP::setHeaders('content-type: application/javascript');
// create a new template instance (this will handle all stuff for us)
$tpl = new BackendTemplate();
// enable addslashes on each locale
$tpl->setAddSlashes(true);
// display
$tpl->display($path, true);
}
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:27,代码来源:javascript.php
示例15: parse
/**
* Parse the data into the template
*/
private function parse()
{
// form was sent?
if ($this->URL->getParameter('sent') == 'true') {
// show message
$this->tpl->assign('unsubscribeIsSuccess', true);
// hide form
$this->tpl->assign('unsubscribeHideForm', true);
}
// unsubscribe was issued for a specific group/address
if (SpoonFilter::isEmail($this->email) && FrontendMailmotorModel::existsGroup($this->group)) {
// unsubscribe the address from this group
if (FrontendMailmotorModel::unsubscribe($this->email, $this->group)) {
// hide form
$this->tpl->assign('unsubscribeHideForm', true);
// show message
$this->tpl->assign('unsubscribeIsSuccess', true);
} else {
// show message
$this->tpl->assign('unsubscribeHasError', true);
}
}
// parse the form
$this->frm->parse($this->tpl);
}
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:28,代码来源:unsubscribe.php
示例16: parse
/**
* Parse the correct messages into the template
*/
protected function parse()
{
parent::parse();
// grab the error-type from the parameters
$errorType = $this->getParameter('type');
// set correct headers
switch ($errorType) {
case 'module-not-allowed':
case 'action-not-allowed':
$this->statusCode = Response::HTTP_FORBIDDEN;
break;
case 'not-found':
$this->statusCode = Response::HTTP_NOT_FOUND;
break;
default:
$this->statusCode = Response::HTTP_BAD_REQUEST;
break;
}
// querystring provided?
if ($this->getParameter('querystring') !== null) {
// split into file and parameters
$chunks = explode('?', $this->getParameter('querystring'));
// get extension
$extension = pathinfo($chunks[0], PATHINFO_EXTENSION);
// if the file has an extension it is a non-existing-file
if ($extension != '' && $extension != $chunks[0]) {
// give a nice error, so we can detect which file is missing
throw new ExitException('File not found', 'Requested file (' . htmlspecialchars($this->getParameter('querystring')) . ') not found.', Response::HTTP_NOT_FOUND);
}
}
// assign the correct message into the template
$this->tpl->assign('message', BL::err(\SpoonFilter::toCamelCase(htmlspecialchars($errorType), '-')));
}
开发者ID:forkcms,项目名称:forkcms,代码行数:36,代码来源:Index.php
示例17: 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();
// get parameters
$formId = trim(SpoonFilter::getPostValue('form_id', null, '', 'int'));
$fieldId = trim(SpoonFilter::getPostValue('field_id', null, '', 'int'));
// invalid form id
if (!BackendFormBuilderModel::exists($formId)) {
$this->output(self::BAD_REQUEST, null, 'form does not exist');
}
// invalid fieldId
if (!BackendFormBuilderModel::existsField($fieldId, $formId)) {
$this->output(self::BAD_REQUEST, null, 'field does not exist');
}
// get field
$field = BackendFormBuilderModel::getField($fieldId);
// submit button cannot be deleted
if ($field['type'] == 'submit') {
$this->output(self::BAD_REQUEST, null, 'submit button cannot be deleted');
} else {
// delete field
BackendFormBuilderModel::deleteField($fieldId);
// success output
$this->output(self::OK, null, 'field deleted');
}
}
开发者ID:netconstructor,项目名称:forkcms,代码行数:32,代码来源:delete_field.php
示例18: __construct
/**
* @param string $type The type of init to load, possible values: backend, backend_ajax, backend_cronjob, backend_js
*/
public function __construct($type)
{
$allowedTypes = array('api');
$type = (string) $type;
// check if this is a valid type
if (!in_array($type, $allowedTypes)) {
exit('Invalid init-type');
}
// set type
$this->type = $type;
// register the autoloader
spl_autoload_register(array('APIInit', 'autoLoader'));
// set some ini-options
ini_set('memory_limit', '64M');
// set a default timezone if no one was set by PHP.ini
if (ini_get('date.timezone') == '') {
date_default_timezone_set('Europe/Brussels');
}
/**
* At first we enable the error reporting. Later on it will be disabled based on the
* value of SPOON_DEBUG, but for now it's required to see possible errors while trying
* to include the globals file(s).
*/
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'On');
$this->requireGlobals();
$this->definePaths();
$this->setIncludePath();
$this->setDebugging();
// get spoon
require_once 'spoon/spoon.php';
$this->requireAPIClasses();
SpoonFilter::disableMagicQuotes();
$this->initSession();
}
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:38,代码来源:init.php
示例19: loadDataGrids
/**
* Loads the datagrids
*/
private function loadDataGrids()
{
/*
* DataGrid for the subscriptions that are awaiting moderation.
*/
$this->dgModeration = new BackendDataGridDB(BackendAgendaModel::QRY_DATAGRID_BROWSE_SUBSCRIPTIONS, array('moderation', BL::getWorkingLanguage()));
// active tab
$this->dgModeration->setActiveTab('tabModeration');
// num items per page
$this->dgModeration->setPagingLimit(30);
// header labels
$this->dgModeration->setHeaderLabels(array('created_on' => \SpoonFilter::ucfirst(BL::lbl('Date'))));
// add the multi-checkbox column
$this->dgModeration->setMassActionCheckboxes('checkbox', '[id]');
// assign column functions
$this->dgModeration->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), '[created_on]', 'created_on', true);
// sorting
$this->dgModeration->setSortingColumns(array('created_on', 'name'), 'created_on');
$this->dgModeration->setSortParameter('desc');
// add mass action drop-down
$ddmMassAction = new \SpoonFormDropdown('action', array('subscribed' => BL::lbl('MoveToSubscribed'), 'delete' => BL::lbl('Delete')), 'subscribed');
$ddmMassAction->setAttribute('id', 'actionModeration');
$ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDeleteModeration'));
$ddmMassAction->setOptionAttributes('subscribe', array('data-message-id' => 'confirmSubscribedModeration'));
$this->dgModeration->setMassAction($ddmMassAction);
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit_subscription')) {
$this->dgModeration->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_subscription') . '&id=[id]', BL::lbl('Edit'));
}
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('mass_subscriptions_action')) {
$this->dgModeration->addColumn('approve', null, BL::lbl('Approve'), BackendModel::createURLForAction('mass_subscriptions_action') . '&id=[id]&from=subscribed&action=subscribed', BL::lbl('Approve'));
}
/*
* DataGrid for the subscriptions that are marked as subscribed
*/
$this->dgSubscribed = new BackendDataGridDB(BackendAgendaModel::QRY_DATAGRID_BROWSE_SUBSCRIPTIONS, array('subscribed', BL::getWorkingLanguage()));
// active tab
$this->dgSubscribed->setActiveTab('tabSubscriptions');
// num items per page
$this->dgSubscribed->setPagingLimit(30);
// header labels
$this->dgSubscribed->setHeaderLabels(array('created_on' => \SpoonFilter::ucfirst(BL::lbl('Date'))));
// add the multi-checkbox column
$this->dgSubscribed->setMassActionCheckboxes('checkbox', '[id]');
// assign column functions
$this->dgSubscribed->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), '[created_on]', 'created_on', true);
// sorting
$this->dgSubscribed->setSortingColumns(array('created_on', 'name'), 'created_on');
$this->dgSubscribed->setSortParameter('desc');
// add mass action drop-down
$ddmMassAction = new \SpoonFormDropdown('action', array('moderation' => BL::lbl('MoveToModeration'), 'delete' => BL::lbl('Delete')), 'published');
$ddmMassAction->setAttribute('id', 'actionSubscriptions');
$ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDeleteSubscribed'));
$this->dgSubscribed->setMassAction($ddmMassAction);
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit_subscription')) {
$this->dgSubscribed->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_subscription') . '&id=[id]', BL::lbl('Edit'));
}
}
开发者ID:Comsa-Veurne,项目名称:modules,代码行数:63,代码来源:Subscriptions.php
示例20: 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);
}
}
开发者ID:bwgraves,项目名称:forkcms,代码行数:36,代码来源:MassDataAction.php
注:本文中的SpoonFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论