当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::setVar方法代码示例

本文整理汇总了PHP中Request::setVar方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::setVar方法的具体用法?PHP Request::setVar怎么用?PHP Request::setVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Request的用法示例。


在下文中一共展示了Request::setVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: populateState

 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @return	void
  * @since	1.6
  */
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication('administrator');
     $search = $this->getUserStateFromRequest($this->context . '.search', 'filter_search');
     $this->setState('filter.search', $search);
     $published = $this->getUserStateFromRequest($this->context . '.published', 'filter_published', '');
     $this->setState('filter.published', $published);
     $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
     $this->setState('filter.access', $access);
     $parentId = $this->getUserStateFromRequest($this->context . '.filter.parent_id', 'filter_parent_id', 0, 'int');
     $this->setState('filter.parent_id', $parentId);
     $level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', 0, 'int');
     $this->setState('filter.level', $level);
     $menuType = Request::getVar('menutype', null);
     if ($menuType) {
         if ($menuType != $app->getUserState($this->context . '.filter.menutype')) {
             $app->setUserState($this->context . '.filter.menutype', $menuType);
             Request::setVar('limitstart', 0);
         }
     } else {
         $menuType = $app->getUserState($this->context . '.filter.menutype');
         if (!$menuType) {
             $menuType = $this->getDefaultMenuType();
         }
     }
     $this->setState('filter.menutype', $menuType);
     $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
     $this->setState('filter.language', $language);
     // Component parameters.
     $params = Component::params('com_menus');
     $this->setState('params', $params);
     // List state information.
     parent::populateState('a.lft', 'asc');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:42,代码来源:items.php

示例2: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', true);
     $userId = User::get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == User::get('id'));
     // Since we don't track these assets at the item level, use the category id.
     $canDo = NewsfeedsHelper::getActions($this->item->catid, 0);
     Toolbar::title(Lang::txt('COM_NEWSFEEDS_MANAGER_NEWSFEED'), 'newsfeeds.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count(User::getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)) {
         Toolbar::apply('newsfeed.apply');
         Toolbar::save('newsfeed.save');
     }
     if (!$checkedOut && count(User::getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) {
         Toolbar::save2new('newsfeed.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         Toolbar::save2copy('newsfeed.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('newsfeed.cancel');
     } else {
         Toolbar::cancel('newsfeed.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS_EDIT');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:34,代码来源:view.html.php

示例3: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     $canDo = TemplatesHelper::getActions();
     Toolbar::title($isNew ? Lang::txt('COM_TEMPLATES_MANAGER_ADD_STYLE') : Lang::txt('COM_TEMPLATES_MANAGER_EDIT_STYLE'), 'thememanager');
     // If not checked out, can save the item.
     if ($canDo->get('core.edit')) {
         Toolbar::apply('style.apply');
         Toolbar::save('style.save');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         Toolbar::save2copy('style.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('style.cancel');
     } else {
         Toolbar::cancel('style.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     // Get the help information for the template item.
     $lang = Lang::getRoot();
     $help = $this->get('Help');
     if ($lang->hasKey($help->url)) {
         $debug = $lang->setDebug(false);
         $url = Lang::txt($help->url);
         $lang->setDebug($debug);
     } else {
         $url = null;
     }
     Toolbar::help('style');
     //$help->key, false, $url);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:39,代码来源:view.html.php

示例4: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     $canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
     Toolbar::title(Lang::txt($isNew ? 'COM_MENUS_VIEW_NEW_MENU_TITLE' : 'COM_MENUS_VIEW_EDIT_MENU_TITLE'), 'menu.png');
     // If a new item, can save the item.  Allow users with edit permissions to apply changes to prevent returning to grid.
     if ($isNew && $canDo->get('core.create')) {
         if ($canDo->get('core.edit')) {
             Toolbar::apply('menu.apply');
         }
         Toolbar::save('menu.save');
     }
     // If user can edit, can save the item.
     if (!$isNew && $canDo->get('core.edit')) {
         Toolbar::apply('menu.apply');
         Toolbar::save('menu.save');
     }
     // If the user can create new items, allow them to see Save & New
     if ($canDo->get('core.create')) {
         Toolbar::save2new('menu.save2new');
     }
     if ($isNew) {
         Toolbar::cancel('menu.cancel');
     } else {
         Toolbar::cancel('menu.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('menu');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:35,代码来源:view.html.php

示例5: actionDisplay

 public function actionDisplay()
 {
     $id = Request::getVar('id', null);
     $alias = Request::getVar('alias', null);
     $model = Video::getInstance();
     if ($id == null or $id == "") {
         if ($alias != null and $alias != "") {
             $obj_item = $model->getItemByAlias($alias);
         } else {
             header("Location: /");
         }
     } else {
         $obj_item = $model->getItem($id);
     }
     $items = $model->getItems($obj_item['catID'], true, 4);
     $items2 = $model->getItems($obj_item['catID'], false, 9);
     $obj_category = $model->getCategory($obj_item['catID']);
     $data['item'] = $obj_item;
     $data['items'] = $items;
     $data['items2'] = $items2;
     $data['category'] = $obj_category;
     $page_title = $obj_item['title'];
     $page_keyword = $obj_item['metakey'] != "" ? $obj_item['metakey'] : $page_title;
     $page_description = $obj_item['metadesc'] != "" ? $obj_item['metadesc'] : $page_title;
     setSysConfig("seopage.title", $page_title);
     setSysConfig("seopage.keyword", $page_keyword);
     setSysConfig("seopage.description", $page_description);
     Request::setVar('alias', $obj_category['alias']);
     $this->render('default', $data);
 }
开发者ID:ducdm87,项目名称:gamelienminh,代码行数:30,代码来源:DetailController.php

示例6: onCourse

 /**
  * Return data on a course view (this will be some form of HTML)
  *
  * @param   object   $course    Current course
  * @param   object   $offering  Name of the component
  * @param   boolean  $describe  Return plugin description only?
  * @return  object
  */
 public function onCourse($course, $offering, $describe = false)
 {
     $response = with(new \Hubzero\Base\Object())->set('name', $this->_name)->set('title', Lang::txt('PLG_COURSES_' . strtoupper($this->_name)))->set('default_access', 'registered')->set('display_menu_tab', false);
     if ($describe) {
         return $response;
     }
     if (!($active = Request::getVar('active'))) {
         Request::setVar('active', $active = $this->_name);
     }
     if ($response->get('name') == $active) {
         // Things we need from the form
         $recvEmailOptionID = Request::getInt('memberoptionid', 0);
         $recvEmailOptionValue = Request::getInt('recvpostemail', 0);
         include_once __DIR__ . DS . 'memberoption.class.php';
         switch ($action) {
             case 'editmemberoptions':
                 $response->set('html', $this->edit($course, $user, $recvEmailOptionID, $recvEmailOptionValue));
                 break;
             case 'savememberoptions':
                 $response->set('html', $this->save($course, $user, $recvEmailOptionID, $recvEmailOptionValue));
                 break;
             default:
                 $response->set('html', $this->edit($course, $user, $recvEmailOptionID, $recvEmailOptionValue));
                 break;
         }
     }
     // Return the output
     return $response;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:37,代码来源:memberoptions.php

示例7: addToolbar

 /**
  * Display the toolbar.
  *
  * @return  void
  *
  * @since   2.5
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', 1);
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == User::get('id'));
     $canDo = UsersHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     Toolbar::title(Lang::txt('COM_USERS_NOTES'), 'user');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count(User::getAuthorisedCategories('com_users', 'core.create')))) {
         Toolbar::apply('note.apply');
         Toolbar::save('note.save');
     }
     if (!$checkedOut && count(User::getAuthorisedCategories('com_users', 'core.create'))) {
         Toolbar::save2new('note.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && count(User::getAuthorisedCategories('com_users', 'core.create')) > 0) {
         Toolbar::save2copy('note.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('note.cancel');
     } else {
         Toolbar::cancel('note.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('note');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:34,代码来源:view.html.php

示例8: editTask

 /**
  * Edit a role
  *
  * @return     void
  */
 public function editTask($row = null)
 {
     Request::setVar('hidemainmenu', 1);
     if (!is_object($row)) {
         // Incoming (expecting an array)
         $id = Request::getVar('id', array(0));
         if (is_array($id)) {
             $id = !empty($id) ? $id[0] : 0;
         }
         // Load the object
         $row = new Tables\Role($this->database);
         $row->load($id);
     }
     $this->view->row = $row;
     if (!$this->view->row->id) {
         $this->view->row->created_by = User::get('id');
         $this->view->row->created = Date::toSql();
     }
     require_once dirname(dirname(__DIR__)) . DS . 'models' . DS . 'courses.php';
     $model = \Components\Courses\Models\Courses::getInstance();
     $this->view->courses = $model->courses();
     // Set any errors
     foreach ($this->getErrors() as $error) {
         \Notify::error($error);
     }
     // Output the HTML
     $this->view->setLayout('edit')->display();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:33,代码来源:roles.php

示例9: onCourse

 /**
  * Return data on a course view (this will be some form of HTML)
  *
  * @param   object   $course    Current course
  * @param   object   $offering  Name of the component
  * @param   boolean  $describe  Return plugin description only?
  * @return  object
  */
 public function onCourse($course, $offering, $describe = false)
 {
     if (!$offering->access('manage', 'section')) {
         return;
     }
     $response = with(new \Hubzero\Base\Object())->set('name', $this->_name)->set('title', Lang::txt('PLG_COURSES_' . strtoupper($this->_name)))->set('description', Lang::txt('PLG_COURSES_' . strtoupper($this->_name) . '_BLURB'))->set('default_access', $this->params->get('plugin_access', 'managers'))->set('display_menu_tab', true)->set('icon', 'f083');
     if ($describe) {
         return $response;
     }
     $nonadmin = Request::getState('com_courses.offering' . $offering->get('id') . '.nonadmin', 0);
     if (!($active = Request::getVar('active')) && !$nonadmin) {
         Request::setVar('active', $active = $this->_name);
     }
     if ($response->get('name') == $active) {
         // Set the page title
         Document::setTitle(Document::getTitle() . ': ' . Lang::txt('PLG_COURSES_' . strtoupper($this->_name)));
         Pathway::append(Lang::txt('PLG_COURSES_' . strtoupper($this->_name)), $offering->link() . '&active=' . $this->_name);
         $view = with($this->view('default', 'overview'))->set('option', Request::getVar('option', 'com_courses'))->set('course', $course)->set('offering', $offering)->set('params', $this->params);
         foreach ($this->getErrors() as $error) {
             $view->setError($error);
         }
         $response->set('html', $view->loadTemplate());
     }
     // Return the output
     return $response;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:34,代码来源:dashboard.php

示例10: addToolbar

 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/languages.php';
     Request::setVar('hidemainmenu', 1);
     $isNew = empty($this->item->lang_id);
     $canDo = LanguagesHelper::getActions();
     Toolbar::title(Lang::txt($isNew ? 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_NEW_TITLE' : 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_EDIT_TITLE'), 'langmanager.png');
     // If a new item, can save.
     if ($isNew && $canDo->get('core.create')) {
         Toolbar::save('language.save');
     }
     //If an existing item, allow to Apply and Save.
     if (!$isNew && $canDo->get('core.edit')) {
         Toolbar::apply('language.apply');
         Toolbar::save('language.save');
     }
     // If an existing item, can save to a copy only if we have create rights.
     if ($canDo->get('core.create')) {
         Toolbar::save2new('language.save2new');
     }
     if ($isNew) {
         Toolbar::cancel('language.cancel');
     } else {
         Toolbar::cancel('language.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('language');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:33,代码来源:view.html.php

示例11: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (App::isSite() && !User::isGuest()) {
         $exceptions = ['com_users.logout', 'com_users.userlogout', 'com_support.tickets.save.index', 'com_members.changepassword', 'com_members.media.download.profiles'];
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         $badpassword = Session::get('badpassword', false);
         $expiredpassword = Session::get('expiredpassword', false);
         // If guest, proceed as normal and they'll land on the login page
         if (!in_array($current, $exceptions) && ($badpassword || $expiredpassword)) {
             Request::setVar('option', 'com_members');
             Request::setVar('task', 'changepassword');
             Request::setVar('id', 0);
             if ($badpassword) {
                 Request::setVar('Your password does not meet current site requirements. Please change your password now.');
             }
             if ($expiredpassword) {
                 Request::setVar('Your password has expired. Please change your password now.');
             }
             $this->event->stop();
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:30,代码来源:password.php

示例12: displayTask

 /**
  * Display admin control panel
  *
  * @return  void
  */
 public function displayTask()
 {
     // Set the template - this will display cpanel.php
     // from the selected admin template.
     \Request::setVar('tmpl', 'cpanel');
     $this->view->setLayout('default')->display();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:12,代码来源:cpanel.php

示例13: onAfterRoute

 /**
  * Method to catch the onAfterRoute event.
  *
  * @return  boolean
  */
 public function onAfterRoute()
 {
     $task = Request::getVar('task', 'none');
     if (User::isGuest() || !App::isSite() || $task == 'user.logout') {
         return false;
     }
     $menuId = $this->params->get('menuId', 0);
     if (!$menuId) {
         return false;
     }
     $menu = App::get('menu');
     $activeMenu = $menu->getActive();
     $defaultMenu = $menu->getDefault();
     // If routing to the home page...
     if ($activeMenu == $defaultMenu) {
         // Reset the active menu item and
         // overwrite request vars
         $menu->setActive($menuId);
         $menu->setDefault($menuId, $defaultMenu->language);
         $item = $menu->getItem($menuId);
         $vars = $item->query;
         $vars['Itemid'] = $menuId;
         foreach ($vars as $key => $var) {
             Request::setVar($key, $var);
         }
     }
     return true;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:33,代码来源:memberhome.php

示例14: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     // First, check for presence of subject dn, which is the minimum required field
     if (!isset($_SERVER['SSL_CLIENT_S_DN']) || !$_SERVER['SSL_CLIENT_S_DN']) {
         \App::redirect($this->params->get('failure_location', '/invalidcert.php'));
         return;
     }
     if (\User::isGuest()) {
         // If so, redirect to login
         Request::setVar('option', 'com_users');
         Request::setVar('task', 'user.login');
         Request::setVar('authenticator', 'certificate');
         Request::setVar('return', base64_encode(\Request::current()));
         return;
     }
     // Check if user is registered and if current session is linked to cert identity
     $hzad = \Hubzero\Auth\Domain::getInstance('authentication', 'certificate', $_SERVER['SSL_CLIENT_I_DN_CN']);
     if ($link = \Hubzero\Auth\Link::getInstance($hzad->id, $_SERVER['SSL_CLIENT_S_DN_CN'])) {
         if ($link->user_id == \User::get('id')) {
             // All clear...return nothing
             return;
         }
     }
     // Otherwise, we have a cert-based user that doesn't match the current user
     Request::setVar('option', 'com_users');
     Request::setVar('task', 'user.logout');
     $this->event->stop();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:33,代码来源:certificate.php

示例15: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (User::isGuest()) {
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         if (App::isSite()) {
             $pages = ['com_users.login'];
             $granted = Session::get('user_consent', false);
             if (in_array($current, $pages) && !$granted) {
                 Request::setVar('option', 'com_users');
                 Request::setVar('view', 'userconsent');
             }
         } else {
             if (App::isAdmin()) {
                 $exceptions = ['com_login.grantconsent'];
                 $granted = Session::get('user_consent', false);
                 if (!in_array($current, $exceptions) && !$granted) {
                     Request::setVar('option', 'com_login');
                     Request::setVar('task', 'consent');
                 }
             }
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:31,代码来源:userconsent.php


注:本文中的Request::setVar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。