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


PHP Control::loadState方法代码示例

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


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

示例1: loadState

 /**
  * Loads state informations.
  * @param  array
  * @return void
  */
 public function loadState(array $params)
 {
     /** check for invalid parameter value and in that case set it 
      * to default value.
      */
     //if(isset($params['page']) && gettype($params['page']) != "integer" )
     //    $params['page'] = $this->page;
     //dump("guuuu");
     parent::loadState($params);
     $this->getPaginator()->page = $this->page;
 }
开发者ID:BroukPytlik,项目名称:agility,代码行数:16,代码来源:VisualPaginator.php

示例2: loadState

 public function loadState(array $params)
 {
     $session = $this->getSession();
     if (!empty($params) && isset($params['settings'])) {
         $settings = array();
         foreach ($params['settings'] as $key => $val) {
             $settings[$key] = $val;
         }
         $session['settings'] = $settings;
     } elseif (!empty($session['settings'])) {
         foreach ($session['settings'] as $key => $val) {
             $params['settings'][$key] = $val;
         }
     }
     parent::loadState($params);
 }
开发者ID:adusak,项目名称:DataGrid,代码行数:16,代码来源:BaseControl.php

示例3: loadState

 function loadState(array $params)
 {
     parent::loadState($params);
     if (count($this->sort) == 0) {
         foreach ($this->defaultSort as $k => $v) {
             if (!isset($this->sort[$k])) {
                 $this->sort[$k] = $v;
             }
         }
     }
     foreach ($this->sort as $k => $v) {
         if (!in_array($k, $this->enabledSort) && !isset($this->defaultSort[$k])) {
             unset($this->sort[$k]);
             continue;
         }
         if (!in_array($v, array_keys($this->enableValues))) {
             unset($this->sort[$k]);
             continue;
         }
     }
     foreach ($this->defaultFilter as $k => $v) {
         if (!isset($this->filter[$k])) {
             $this->filter[$k] = $v;
         }
     }
     foreach ($this->filter as $k => $v) {
         if (!in_array($k, $this->enableFilter)) {
             unset($this->filter[$k]);
             continue;
         }
     }
     if (!is_null($this->countCallback)) {
         $this->count = call_user_func($this->countCallback, $this->getDbFilter());
     } else {
         throw new \LogicException('Missing count callback');
     }
     $this->limit = Nette\Utils\Validators::isNumericInt($this->limit) ? $this->limit : static::DEFAULT_LIMIT;
     $this->page = Nette\Utils\Validators::isNumericInt($this->page) && $this->page <= ceil($this->count / $this->limit) && $this->page > 0 ? $this->page : 1;
     $this->cleanSortKeys = $this->defaultSort;
     foreach ($this->enabledSort as $k => $v) {
         if (isset($this->cleanSortKeys[$k])) {
             unset($this->cleanSortKeys[$k]);
         }
     }
 }
开发者ID:trejjam,项目名称:utils,代码行数:45,代码来源:FilterFactory.php

示例4: loadState

 public function loadState(array $params)
 {
     return $this->control->loadState($params);
 }
开发者ID:dotblue,项目名称:nette-control-rendering,代码行数:4,代码来源:Renderer.php

示例5: loadState

 /**
  * Loads state informations.
  * @param  array
  * @return void
  */
 public function loadState(array $params)
 {
     parent::loadState($params);
     if ($this->getParent() instanceof DataGrid) {
         $this->getPaginator()->page = $this->getParent()->page;
     }
 }
开发者ID:OCC2,项目名称:occ2pacs,代码行数:12,代码来源:DataGridPaginator.php

示例6: loadState

	/**
	 * Loads params
	 * @param  array
	 * @return void
	 */
	public function loadState(array $params)
	{
		if (isset($params['order'])) {
			$params['order'] = explode('.', (string) $params['order']);

			// validate
			$copy = $params['order'];
			sort($copy);
			if ($copy != range(0, $this->width * $this->width - 1)) {
				unset($params['order']);
			}
		}

		parent::loadState($params);
	}
开发者ID:norbe,项目名称:examples,代码行数:20,代码来源:FifteenControl.php

示例7: loadState

 /**
  * @param array $params
  * @throws \Nette\Application\BadRequestException
  */
 public function loadState(array $params)
 {
     parent::loadState($params);
     if ($this->hasFilteringForm()) {
         foreach ($params as $column => $value) {
             if (!isset($this->filteringConditions[$column])) {
                 continue;
             }
             $this->filteringData[$column] = $value;
             $this['filteringForm-' . $column]->setDefaultValue($value);
         }
     }
     if ($this->view !== '') {
         if (!$this->hasView($this->view)) {
             throw new BadRequestException();
         }
     } elseif (!empty($this->views)) {
         reset($this->views);
         $this->view = key($this->views);
     }
 }
开发者ID:wodCZ,项目名称:Nette-NoGrid,代码行数:25,代码来源:NoGrid.php

示例8: loadState

 /**
  * Loads state informations.
  * @param  array
  * @return void
  */
 public function loadState(array $params)
 {
     if ($this->rememberState) {
         $session = $this->getStateSession();
         foreach ($this->getPersistentParams() as $name) {
             if (isset($session[$name]) && !isset($params[$name])) {
                 $params[$name] = $session[$name];
             }
         }
     }
     parent::loadState($params);
 }
开发者ID:natrim,项目名称:gridito,代码行数:17,代码来源:Grid.php

示例9: loadState

 /**
  * Loads state information
  * @param  array
  * @return void
  */
 public function loadState(array $params)
 {
     parent::loadState($params);
     $datetime = \DateTime::createFromFormat('!Y-m', date($this->year . '-' . $this->month));
     if ($datetime === false) {
         $datetime = \DateTime::createFromFormat('!Y-m', date('Y-m'));
     }
     $this->month = $datetime->format('n');
     $this->year = $datetime->format('Y');
 }
开发者ID:blitzik,项目名称:calendar,代码行数:15,代码来源:Calendar.php

示例10: loadState

 /**
  * @param  array $params
  * @return void
  */
 public function loadState(array $params)
 {
     parent::loadState(static::processParams($params));
     if (!$this->polluted && !$this->isInDefaultState()) {
         $this->polluted = TRUE;
     }
     if (!$this->polluted) {
         if ($this->defaultOrderBy !== NULL) {
             $this->orderBy = array_merge($this->defaultOrderBy, $this->orderBy);
             $this->polluted = TRUE;
         }
         if ($this->defaultFilters !== NULL) {
             $this->setFilters($this->defaultFilters, FALSE);
             $this->polluted = TRUE;
         }
     }
     $i = 0;
     foreach ($this->orderBy as $column => $dir) {
         try {
             $this['columns']->getComponent($column)->setSortedBy(TRUE, $dir, $i++);
         } catch (\RuntimeException $e) {
             unset($this->orderBy[$column]);
         }
         if (!$this->multiSort && $i > 1) {
             unset($this->orderBy[$column]);
         }
     }
     $this->validateState();
 }
开发者ID:uestla,项目名称:twigrid,代码行数:33,代码来源:DataGrid.php

示例11: loadState

 public function loadState(array $params)
 {
     if (isset($params['page']) and !Validators::is($params['page'], 'numericint')) {
         $params['page'] = 1;
     }
     parent::loadState($params);
     $this->getPaginator()->setPage($this->page);
     $this->page = $this->getPaginator()->getPage();
 }
开发者ID:blitzik,项目名称:CMS,代码行数:9,代码来源:VisualPaginator.php

示例12: loadState

 /**
  * @param array
  */
 public function loadState(array $params)
 {
     parent::loadState($params);
     // get items per page from session
     if ($this->session !== NULL && $this->canSetItemsPerPage) {
         if (isset($this->sessionSection->{$this->getSessionReposity()}) && in_array($this->sessionSection->{$this->getSessionReposity()}, array_keys($this->itemsPerPageList), TRUE)) {
             $this->setItemsPerPage($this->sessionSection->{$this->getSessionReposity()});
         } else {
             unset($this->sessionSection->{$this->getSessionReposity()});
         }
     }
     $this->getPaginator()->page = $this->page;
     $this->getPaginator()->itemsPerPage = $this->itemsPerPage;
     $this->page = $this->getPaginator()->page;
     $this->itemsPerPage = $this->getPaginator()->itemsPerPage;
     $this["itemsPerPage"]->setDefaults(["itemsPerPage" => $this->itemsPerPage]);
 }
开发者ID:aleswita,项目名称:visualpaginator,代码行数:20,代码来源:VisualPaginator.php

示例13: loadState

 /**
  * Loads state informations.
  *
  * @param  array
  * @return void
  */
 public function loadState(array $params)
 {
     parent::loadState($params);
     $this->getPaginator()->setDate(new DateTime($this->date ?: 'now'));
 }
开发者ID:stekycz,项目名称:nette-date-paginator,代码行数:11,代码来源:VisualDatePaginator.php

示例14: loadState

 /**
  * Get and load session params
  * @param array $params 
  */
 public function loadState(array $params)
 {
     parent::loadState($params);
     $this->getSession();
     $this->loadSession();
 }
开发者ID:ricco24,项目名称:DataGrid,代码行数:10,代码来源:DataGrid.php

示例15: loadState

 /**
  * Loads state informations
  * @author Pavel Železný <info@pavelzelezny.cz>
  * @param array $params
  * @return void
  */
 public function loadState(array $params)
 {
     parent::loadState($params);
     $this->getPaginator()->setPage($this->getPage());
 }
开发者ID:animack,项目名称:jao-nette-visual-paginator,代码行数:11,代码来源:VisualPaginator.php


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