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


PHP JApplicationCms::getUserStateFromRequest方法代码示例

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


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

示例1: __construct

 /**
  * MonitorModelAbstract constructor.
  *
  * @param   JApplicationCms  $application  The Application object to use in this model.
  * @param   boolean          $loadFilters  If set to true, filters and list options will be loaded from the page request.
  *
  * @throws Exception
  */
 public function __construct($application = null, $loadFilters = true)
 {
     parent::__construct();
     if ($application) {
         $this->app = $application;
     } else {
         $this->app = JFactory::getApplication();
     }
     if ($loadFilters) {
         // Receive & set filters
         if ($this->filters = $this->app->getUserStateFromRequest('filter.' . $this->prefix, 'filter', array(), 'array')) {
             foreach ($this->filters as $filter => $value) {
                 $this->getState()->set('filter.' . $this->prefix . '.' . $filter, $value);
             }
         }
         // Receive & set list options
         if ($this->list = $this->app->getUserStateFromRequest('list.' . $this->prefix, 'list', array(), 'array')) {
             if (isset($this->list['fullordering']) && $this->list['fullordering']) {
                 $fullOrdering = explode(' ', $this->list['fullordering']);
                 $this->list['ordering'] = $fullOrdering[0];
                 $this->list['direction'] = $fullOrdering[1];
             }
             foreach ($this->list as $key => $value) {
                 $this->getState()->set('list.' . $this->prefix . '.' . $key, $value);
             }
         }
         if (!isset($this->list['limit']) && ($limit = $this->app->getUserStateFromRequest('list.' . $this->prefix . '.limit', 'limit', null)) !== null) {
             $this->list['limit'] = $limit;
             $this->getState()->set('list.' . $this->prefix . '.limit', $limit);
         }
     }
 }
开发者ID:Harmageddon,项目名称:com_monitor,代码行数:40,代码来源:abstract.php

示例2: array

 /**
  * Creates an array of HTML code for each filter
  * Also adds in JS code to manage filters
  *
  * @param   string  $container  container
  * @param   string  $type       type listviz
  * @param   string  $id         html id, only used if called from viz plugin
  * @param   string  $ref        js filter ref, used when rendering filters for visualizations
  *
  * @return  array	of html code for each filter
  */
 protected function &makeFilters($container = 'listform_1', $type = 'list', $id = '', $ref = '')
 {
     $aFilters = array();
     $fScript = array();
     $opts = new stdClass();
     $opts->container = $container;
     $opts->type = $type;
     $opts->id = $type === 'list' ? $this->getId() : $id;
     $opts->ref = $this->getRenderContext();
     $opts->advancedSearch = $this->advancedSearch->opts();
     $opts->advancedSearch->controller = $type;
     $package = $this->app->getUserState('com_fabrik.package', 'fabrik');
     $filters = $this->getFilterArray();
     $params = $this->getParams();
     // Paul Switch to 0/1 for NO/YES from AND/OR so that bootstrap classes work but support legacy values
     if ($params->get('search-mode', '0') == '1' || $params->get('search-mode', '0') == 'OR') {
         // One field to search them all (and in the darkness bind them)
         $requestKey = $this->getFilterModel()->getSearchAllRequestKey();
         $v = $this->getFilterModel()->getSearchAllValue('html');
         $o = new stdClass();
         $searchLabel = $params->get('search-all-label', FText::_('COM_FABRIK_SEARCH'));
         $class = FabrikWorker::j3() ? 'fabrik_filter search-query input-medium' : 'fabrik_filter';
         $o->id = 'searchall_' . $this->getRenderContext();
         $o->displayValue = '';
         $o->filter = '<input type="search" size="20" placeholder="' . $searchLabel . '"title="' . $searchLabel . '" value="' . $v . '" class="' . $class . '" name="' . $requestKey . '" id="' . $id . '" />';
         if ($params->get('search-mode-advanced') == 1) {
             $searchOpts = array();
             $searchOpts[] = JHTML::_('select.option', 'all', FText::_('COM_FABRIK_ALL_OF_THESE_TERMS'));
             $searchOpts[] = JHTML::_('select.option', 'any', FText::_('COM_FABRIK_ANY_OF_THESE_TERMS'));
             $searchOpts[] = JHTML::_('select.option', 'exact', FText::_('COM_FABRIK_EXACT_TERMS'));
             $searchOpts[] = JHTML::_('select.option', 'none', FText::_('COM_FABRIK_NONE_OF_THESE_TERMS'));
             $mode = $this->app->getUserStateFromRequest('com_' . $package . '.list' . $this->getRenderContext() . '.searchallmode', 'search-mode-advanced');
             $o->filter .= '&nbsp;' . JHTML::_('select.genericList', $searchOpts, 'search-mode-advanced', "class='fabrik_filter'", 'value', 'text', $mode);
         }
         $o->name = 'all';
         $o->label = $searchLabel;
         $o->displayValue = '';
         $aFilters[] = $o;
     }
     $counter = 0;
     /* $$$ hugh - another one of those weird ones where if we use = the foreach loop
      * will sometimes skip a group
      * $groups = $this->getFormGroupElementData();
      */
     $groups = $this->getFormGroupElementData();
     foreach ($groups as $groupModel) {
         $groupModel->getGroup();
         $elementModels = null;
         $elementModels = $groupModel->getPublishedElements();
         foreach ($elementModels as $elementModel) {
             $element = $elementModel->getElement();
             /*$$ rob added as some filter_types were null, have to double check that this doesnt
              * mess with showing the readonly values from search forms
              */
             if (isset($element->filter_type) && $element->filter_type != '' && $element->filter_type != 'null') {
                 if ($elementModel->canView('list') && $elementModel->canUseFilter()) {
                     /* $$$ rob in faceted browsing somehow (not sure how!) some elements from the faceted table get inserted into elementModels
                      * with their form id set - so test if its been set and if its not the same as the current form id
                      * if so then ignore
                      */
                     if (isset($element->form_id) && (int) $element->form_id !== 0 && $element->form_id !== $this->getFormModel()->getId()) {
                         continue;
                     }
                     // Force the correct group model into the element model to ensure no wierdness in getting the element name
                     $elementModel->setGroupModel($groupModel);
                     $o = new stdClass();
                     $o->name = $elementModel->getFullName(true, false);
                     $o->id = $elementModel->getHTMLId() . 'value';
                     $o->filter = $elementModel->getFilter($counter, true);
                     $fScript[] = $elementModel->filterJS(true, $container);
                     $o->required = $elementModel->getParams()->get('filter_required');
                     $o->label = $elementModel->getListHeading();
                     $o->displayValue = $elementModel->filterDisplayValues;
                     $aFilters[] = $o;
                     $counter++;
                 }
             }
         }
     }
     $opts->filters = $aFilters;
     $opts = json_encode($opts);
     array_unshift($fScript, "\tFabrik.filter_{$container} = new FbListFilter({$opts});");
     $fScript[] = 'Fabrik.filter_' . $container . ".update();";
     $this->filterJs = implode("\n", $fScript);
     // Check for search form filters - if they exists create hidden elements for them
     $keys = FArrayHelper::getValue($filters, 'key', array());
     foreach ($keys as $i => $key) {
         if ($filters['no-filter-setup'][$i] == '1' && !in_array($filters['search_type'][$i], array('searchall', 'advanced', 'jpluginfilters'))) {
             $o = new stdClass();
//.........这里部分代码省略.........
开发者ID:pascal26,项目名称:fabrik,代码行数:101,代码来源:list.php


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