本文整理匯總了PHP中Control::loadState方法的典型用法代碼示例。如果您正苦於以下問題:PHP Control::loadState方法的具體用法?PHP Control::loadState怎麽用?PHP Control::loadState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Control
的用法示例。
在下文中一共展示了Control::loadState方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadState
/**
* Loads params
* @param array
* @return void
*/
public function loadState(array $params)
{
if (isset($params['order'])) {
$params['order'] = explode('.', $params['order']);
// validate
$copy = $params['order'];
sort($copy);
if ($copy != range(0, self::MAX)) {
unset($params['order']);
}
}
parent::loadState($params);
}
示例2: loadState
/**
* Loads params
* @param array
* @return void
*/
public function loadState(array $params)
{
if ($this->rememberState) {
$session = $this->getStateSession();
if (!isset($session->currentState)) {
$session->currentState = $session->initState;
}
if (isset($session->currentState)) {
$cs = $session->currentState;
$is = $session->initState;
foreach ($cs as $key => $value) {
if ($cs[$key] != $is[$key]) {
// additional input validation
switch ($key) {
case 'page':
$value = $value > 0 ? $value : 1;
break;
case 'order':
break;
case 'filters':
break;
case 'itemsPerPage':
break;
}
$params[$key] = $value;
}
}
}
}
parent::loadState($params);
}
示例3: 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);
}
示例4: loadState
/**
* Loads state informations.
* @param array
* @return void
*/
public function loadState(array $params)
{
parent::loadState($params);
$this->getPaginator()->page = $this->page;
}