本文整理汇总了PHP中SpoonFilter::getGetValue方法的典型用法代码示例。如果您正苦于以下问题:PHP SpoonFilter::getGetValue方法的具体用法?PHP SpoonFilter::getGetValue怎么用?PHP SpoonFilter::getGetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpoonFilter
的用法示例。
在下文中一共展示了SpoonFilter::getGetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// get parameters
$this->id = $this->getParameter('id', 'int');
// does the item exists
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 all data for the item we want to edit
$this->getData();
// load drafts
$this->loadDrafts();
// load the datagrid with revisions
$this->loadRevisions();
// load the form
$this->loadForm();
// validate the form
$this->validateForm();
// parse the datagrid
$this->parse();
// display the page
$this->display();
} else {
$this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
}
}
示例2: execute
/**
* 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));
}
示例3: isUserAllowed
/**
* The user is allowed on this page
*
* @return bool
*/
private function isUserAllowed()
{
// catch the key and e-mail address from GET
$this->email = urldecode(\SpoonFilter::getGetValue('email', null, ''));
$this->key = \SpoonFilter::getGetValue('key', null, '');
// if the email or the key aren't set, redirect the user
if ($this->email !== '' && $this->key !== '') {
// fetch the user
$userId = BackendUsersModel::getIdByEmail($this->email);
$this->user = new BackendUser($userId);
$requestTime = $this->user->getSetting('reset_password_timestamp');
// check if the request was made within 24 hours
if (time() - $requestTime > 86400) {
// remove the reset_password_key and reset_password_timestamp usersettings
BackendUsersModel::deleteResetPasswordSettings($userId);
// redirect to the login form, with a timeout error
$this->redirect(BackendModel::createURLForAction('Index', null, null, array('reset' => 'timeout')));
}
// check if the provided key matches the one in the user record
if ($this->key === $this->user->getSetting('reset_password_key')) {
return true;
}
}
// if we made it here the user is not allowed to access this page
return false;
}
示例4: 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
$term = SpoonFilter::getGetValue('term', null, '');
// validate
if ($term == '') {
$this->output(self::BAD_REQUEST, null, 'term-parameter is missing.');
}
// 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'] = FRONTEND_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);
}
示例5: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// set force compile on because we're using multiple forms on 1 page
$this->tpl->setForceCompile(true);
// get parameters
$this->id = $this->getParameter('id', 'int');
// get the step
$this->stepId = SpoonFilter::getGetValue('step', array(1, 2, 3, 4), 1, '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();
// load jquery tiny
$this->header->addJS('tiny_mce/jquery.tinymce.js', 'core');
// get all data for the item we want to edit
$this->getData();
// load the wizard steps
$this->loadWizardSteps();
// load the appropriate step
$this->{'loadStep' . $this->stepId}();
// parse
$this->parse();
// display the page
$this->display();
} else {
$this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
}
}
示例6: 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');
}
}
示例7: __construct
public function __construct()
{
// if the application wasn't defined before we will define it
if (!defined('NAMED_APPLICATION')) {
define('NAMED_APPLICATION', 'frontend');
}
// 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', FrontendLanguage::getActiveLanguages(), SITE_DEFAULT_LANGUAGE));
// create a new template instance (this will handle all stuff for us)
$tpl = new FrontendTemplate();
// enable addslashes on each locale
$tpl->setAddSlashes(true);
// set correct headers
SpoonHTTP::setHeaders('content-type: application/javascript');
// fetch the template path
if ($this->module == 'core') {
$file = FRONTEND_CORE_PATH . '/js/' . $this->getFile();
} else {
$file = FRONTEND_MODULES_PATH . '/' . $this->getModule() . '/js/' . $this->getFile();
}
// output the template
$tpl->display(FrontendTheme::getPath($file), true);
}
示例8: __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);
}
示例9: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
$this->addJS('https://maps.googleapis.com/maps/api/js?sensor=false', true, false);
$this->addJS('/src/Frontend/Modules/Addresses/Js/markerclusterer.js', true, false);
$this->addJS('/src/Frontend/Modules/Addresses/Js/bootstrap.min.js', true, false);
$this->addJS('/src/Frontend/Modules/Addresses/Js/bootstrap-multiselect.js', true, false);
$this->addCSS('/src/Frontend/Modules/Addresses/Layout/Css/bootstrap-multiselect.css', true, false);
$this->addCSS('/src/Frontend/Modules/Addresses/Layout/Css/Addresses.css', true, false);
//--Get search
$this->search = urldecode(\SpoonFilter::getGetValue("search", null, ""));
if ($this->search != "") {
$this->lat = urldecode(\SpoonFilter::getGetValue("lat", null, ""));
$this->lng = urldecode(\SpoonFilter::getGetValue("lng", null, ""));
}
$this->addJSData('search', $this->search);
$this->addJSData('lat', $this->lat);
$this->addJSData('lng', $this->lng);
$this->searchGroups = \SpoonFilter::getGetValue("groups", null, array(), 'array');
//$this ->searchTopGroups = (\SpoonFilter::getGetValue("topgroups", null, array(),'array'));
$this->loadTemplate();
$this->loadData();
$this->loadForm();
$this->parse();
}
示例10: loadForm
/**
* Load the form
*/
private function loadForm()
{
$this->imageIsAllowed = BackendModel::getModuleSetting($this->URL->getModule(), 'show_image_form', true);
$this->frm = new BackendForm('add');
// set hidden values
$rbtHiddenValues[] = array('label' => BL::lbl('Hidden', $this->URL->getModule()), 'value' => 'Y');
$rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N');
// get categories
$categories = BackendBlogModel::getCategories();
$categories['new_category'] = SpoonFilter::ucfirst(BL::getLabel('AddCategory'));
// create elements
$this->frm->addText('title', null, null, 'inputText title', 'inputTextError title');
$this->frm->addEditor('text');
$this->frm->addEditor('introduction');
$this->frm->addRadiobutton('hidden', $rbtHiddenValues, 'N');
$this->frm->addCheckbox('allow_comments', BackendModel::getModuleSetting($this->getModule(), 'allow_comments', false));
$this->frm->addDropdown('category_id', $categories, SpoonFilter::getGetValue('category', null, null, 'int'));
if (count($categories) != 2) {
$this->frm->getField('category_id')->setDefaultElement('');
}
$this->frm->addDropdown('user_id', BackendUsersModel::getUsers(), BackendAuthentication::getUser()->getUserId());
$this->frm->addText('tags', null, null, 'inputText tagBox', 'inputTextError tagBox');
$this->frm->addDate('publish_on_date');
$this->frm->addTime('publish_on_time');
if ($this->imageIsAllowed) {
$this->frm->addImage('image');
}
// meta
$this->meta = new BackendMeta($this->frm, null, 'title', true);
}
示例11: 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']);
}
示例12: 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();
// set category id
$this->categoryId = SpoonFilter::getGetValue('category', null, null, 'int');
if ($this->categoryId == 0) {
$this->categoryId = null;
} else {
// get category
$this->category = BackendBlogModel::getCategory($this->categoryId);
// reset
if (empty($this->category)) {
// reset GET to trick Spoon
$_GET['category'] = null;
// reset
$this->categoryId = null;
}
}
// load datagrid
$this->loadDataGrids();
// parse page
$this->parse();
// display the page
$this->display();
}
示例13: __construct
/**
* Default constructor
*
* @return void
*/
public function __construct()
{
// set the module
$this->setModule(SpoonFilter::getGetValue('module', null, ''));
// set the action
$this->setAction(SpoonFilter::getGetValue('action', null, ''));
// set the language
$this->setLanguage(SpoonFilter::getGetValue('language', null, ''));
// create a new action
$action = new FrontendAJAXAction($this->getAction(), $this->getModule());
// attempt to execute this action
try {
// execute the action
$action->execute();
} catch (Exception $e) {
// if we are debugging, we obviously want to see the exception
if (SPOON_DEBUG) {
throw $e;
}
// create fake action
$fakeAction = new FrontendBaseAJAXAction('', '');
// output the exceptions-message as an error
$fakeAction->output(FrontendBaseAJAXAction::ERROR, null, $e->getMessage());
}
}
示例14: __construct
/**
* Default constructor
*
* @return void
*/
public function __construct()
{
// check if the user is logged in
$this->validateLogin();
// named application
if (!defined('NAMED_APPLICATION')) {
define('NAMED_APPLICATION', 'backend_ajax');
}
// set the module
$this->setModule(SpoonFilter::getGetValue('module', null, ''));
// set the action
$this->setAction(SpoonFilter::getGetValue('action', null, ''));
// set the language
$this->setLanguage(SpoonFilter::getGetValue('language', null, ''));
// create a new action
$action = new BackendAJAXAction($this->getAction(), $this->getModule());
// try to execute
try {
// execute the action
$action->execute();
} catch (Exception $e) {
// set correct headers
SpoonHTTP::setHeadersByCode(500);
// if we are debugging we should see the exceptions
if (SPOON_DEBUG) {
throw $e;
}
// output
$fakeAction = new BackendBaseAJAXAction('', '');
$fakeAction->output(BackendBaseAJAXAction::ERROR, null, $e->getMessage());
}
}
示例15: 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;
}
}
}