本文整理汇总了PHP中JApplication::getUserStateFromRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP JApplication::getUserStateFromRequest方法的具体用法?PHP JApplication::getUserStateFromRequest怎么用?PHP JApplication::getUserStateFromRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JApplication
的用法示例。
在下文中一共展示了JApplication::getUserStateFromRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItemModel
/**
* Return an instance of a model that loaded base on configuration
* @param mixed $config
* @param object $state
* @param string $coverage
* @return JModelList
*/
private function getItemModel($config, $state, $coverage)
{
$path = '';
// Load model file
if (!$config['path']) {
$path = JPATH_ADMINISTRATOR . '/';
} else {
$path = $config['path'] . '/';
}
require_once $path . $config['modelfile'];
// Load component language
$this->language->load($config['language'], JPATH_ADMINISTRATOR);
// Create model instance
$model = new $config['modelname'](array('state' => $state));
$model->getState('filter.search');
$currentCoverage = $this->app->getUserStateFromRequest('components.selected', 'tab');
if ($currentCoverage == $coverage) {
$order = $this->app->getUserStateFromRequest("{$currentCoverage}.{$config['modelname']}.order", 'filter_order', $config['order']);
$orderDir = $this->app->getUserStateFromRequest("{$currentCoverage}.{$config['modelname']}.orderDir", 'filter_order_Dir', 'asc');
$state->set('list.ordering', $order);
$state->set('list.direction', $orderDir);
}
$state->set('filter.search', $this->keyword);
$state->set('filter.published', 'all');
$state->set('filter.state', 'all');
if (isset($config['filters']) && is_array($config['filters'])) {
foreach ($config['filters'] as $key => $value) {
$state->set($key, $value);
}
}
return $model;
}
示例2: __construct
/**
* @param string $entity
*/
public function __construct($entity, $init)
{
$this->app = JFactory::getApplication();
$this->db = JFactory::getDBO();
$option = 'com_acctexp';
$this->filtered = false;
$this->limit = $this->app->getUserStateFromRequest("viewlistlimit", 'limit', $this->app->getCfg('list_limit'));
$this->limitstart = $this->app->getUserStateFromRequest("viewconf{$option}limitstart", 'limitstart', 0);
$this->search = xJ::escape($this->db, trim(strtolower($this->app->getUserStateFromRequest("search{$option}_subscr", 'search', ''))));
if (!empty($this->search)) {
$this->filtered = true;
}
$this->filter = new stdClass();
if (!empty($init['filter'])) {
foreach ($init['filter'] as $key => $default) {
$value = $this->app->getUserStateFromRequest('aec_' . $entity . '_' . $key, $entity . '_' . $key, $default);
if (!empty($_REQUEST[$key])) {
$value = $_REQUEST[$key];
}
if (is_array($default) && !is_array($value)) {
$value = array($value);
}
$this->filter->{$key} = $value;
if ($this->filter->{$key} != $default) {
$this->filtered = true;
}
}
}
if (!empty($init['sort'])) {
$this->{$key} = $this->app->getUserStateFromRequest('aec_' . $entity . '_sort', $entity . '_sort', $init['sort']);
}
if (empty($this->sort)) {
$this->sort = 'id ASC';
}
}
示例3: getUserStateFromRequest
/**
* Gets the value of a user state variable.
*
* @param string $stateName Unique name of state
* @param string $reqName The name of the variable passed in a request.
* @param string $default First value if not initialized
* @return string State
*/
function getUserStateFromRequest($stateName, $reqName, $default = null)
{
return $this->_baseFramework->getUserStateFromRequest($stateName, $reqName, $default);
}