本文整理汇总了PHP中JModel::getState方法的典型用法代码示例。如果您正苦于以下问题:PHP JModel::getState方法的具体用法?PHP JModel::getState怎么用?PHP JModel::getState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModel
的用法示例。
在下文中一共展示了JModel::getState方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getState
function getState($property = null)
{
if (!$this->__state_set) {
$option = JRequest::getCmd('option');
$app =& JFactory::getApplication();
$context = $option . '.' . $this->getName();
$this->setState('filter_published', $app->getUserStateFromRequest($context . '.filter_published', 'filter_published', 0, 'int'));
$this->setState('filter_catid', $app->getUserStateFromRequest($context . '.filter_catid', 'filter_catid', 0, 'int'));
$this->setState('filter_species', $app->getUserStateFromRequest($context . '.filter_species', 'filter_species', 0, 'word'));
$this->setState('filter_location_state', $app->getUserStateFromRequest($context . '.filter_location_state', 'filter_location_state', 0, 'word'));
$this->setState('filter_adoption_status', $app->getUserStateFromRequest($context . '.filter_adoption_status', 'filter_adoption_status', 0, 'word'));
$this->setState('filter_real_time_need', $app->getUserStateFromRequest($context . '.filter_real_time_need', 'filter_real_time_need', 0, 'word'));
$this->setState('filter_real_time_status', $app->getUserStateFromRequest($context . '.filter_real_time_status', 'filter_real_time_status', 0, 'word'));
$this->setState('filter_search', $app->getUserStateFromRequest($context . '.filter_search', 'filter_search', ''));
$this->setState('filter_order', $app->getUserStateFromRequest($context . '.filter_order', 'filter_order', 'title', 'cmd'));
$this->setState('filter_order_Dir', $app->getUserStateFromRequest($context . '.filter_order_Dir', 'filter_order_Dir', 'ASC', 'word'));
$limit = $app->getUserStateFromRequest($context . '.limit', 'limit', $app->getCfg('list_limit', 5), 'int');
//strange limitstart
// $limitstart = $app->getUserStateFromRequest( $context.'.limitstart', 'limitstart', 0, 'int' );
$limitstart = JRequest::getInt('limitstart', 0, '', 'int');
$limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
$this->setState('limit', $limit);
$this->setState('limitstart', $limitstart);
$this->__state_set = true;
}
return parent::getState($property);
}
示例2: getState
/**
* Overridden method to get model state variables.
*
* @param string Optional parameter name.
* @param mixed The default value to use if no state property exists by name.
* @return object The property where specified, the state object where omitted.
* @since 1.6
*/
public function getState($property = null, $default = null)
{
// if the model state is uninitialized lets set some values we will need from the request.
if ($this->__state_set === false) {
$this->__state_set = true;
}
$value = parent::getState($property);
return is_null($value) ? $default : $value;
}
示例3: getState
function getState($property = null)
{
static $set;
if (!$set) {
$folder = JRequest::getVar('folder');
$this->setState('folder', $folder);
$set = true;
}
return parent::getState($property);
}
示例4: getState
function getState($property = null)
{
static $set;
if (!$set) {
$folder = JRequest::getVar('folder', '', '', 'path');
$this->setState('folder', $folder);
$parent = str_replace("\\", "/", dirname($folder));
$parent = $parent == '.' ? null : $parent;
$this->setState('parent', $parent);
$set = true;
}
return parent::getState($property);
}
示例5: getState
function getState($property = null)
{
$input = JFactory::getApplication()->input;
static $set;
if (!$set) {
$folder = $input->get('folder', '', '', 'path');
$this->setState('folder', $folder);
$parent = str_replace("\\", "/", dirname($folder));
$parent = $parent == '.' ? null : $parent;
$this->setState('parent', $parent);
$set = true;
}
return parent::getState($property);
}
示例6: postSaveHook
/**
* Function that allows child controller access to model data after the data has been saved.
*
* @param JModel $model The data model object.
*
* @return void
* @since 1.6
*/
protected function postSaveHook(JModel &$model, $validData = array())
{
// Initialise variables.
$app = JFactory::getApplication();
$task = $this->getTask();
switch ($task) {
case 'save2new':
$app->setUserState('com_modules.add.module.extension_id', $model->getState('module.extension_id'));
break;
default:
$app->setUserState('com_modules.add.module.extension_id', null);
break;
}
}
示例7: getState
public function getState($property = null)
{
static $set;
$option = JRequest::getCmd('option');
$application = JFactory::getApplication();
if (!$set) {
// current type
$type = $application->getUserStateFromRequest($option . '.type', 'type', '');
$this->setState('type', $type);
if ($type == 'link_file') {
$default_folder = 'images/';
} else {
$default_folder = COM_SIMPLELISTS_DIR;
}
// Current folder
$folder = $application->getUserStateFromRequest($option . '.files.folder', 'folder', $default_folder);
// Workaround for com_media
if (!is_dir(JPATH_SITE . '/' . $folder) && is_dir(JPATH_SITE . '/images/' . $folder)) {
$folder = 'images/' . $folder;
}
// Save the state of this folder
if ($folder == '.') {
$folder = false;
}
if (!empty($folder) && preg_match('/\\/$/', $folder) == false) {
$folder = $folder . '/';
}
$this->setState('folder', $folder);
// Save the state of this folder
$parent = dirname($folder);
if (empty($folder)) {
$parent = false;
}
$this->setState('parent', $parent);
// Current item
$current = $application->getUserStateFromRequest($option . '.files.current', 'current', '');
$this->setState('current', $current);
$set = true;
}
return parent::getState($property);
}
示例8: getState
function getState($property = null)
{
static $set;
if (!$set) {
$folder = JRequest::getVar('folder', '', '', 'path');
$upload = JRequest::getVar('upload', '', '', 'int');
// Phoca Gallery folder images/phocagallery = ''
// Media Manager folder images/phocagallery = 'phocagallery'
// After uploading via Media Manager, we covert the media manager folder to phoca gallery folder
/* if ($upload == 1) {
$countReplace = 1;
$folder = str_replace('phocagallery','',$folder,$countReplace );
if (substr($folder,0,1) == '/') {
$folder = str_replace('/','',$folder,$countReplace );
}
}*/
$this->setState('folder', $folder);
$parent = str_replace("\\", "/", dirname($folder));
$parent = $parent == '.' ? null : $parent;
$this->setState('parent', $parent);
$set = true;
}
return parent::getState($property);
}
示例9: getState
/**
* Overridden method to get model state variables.
*
* @param string Optional parameter name.
* @param mixed The default value to use if no state property exists by name.
* @return object The property where specified, the state object where omitted.
* @since 1.6
*/
public function getState($property = null, $default = null)
{
// if the model state is uninitialized lets set some values we will need from the request.
if ($this->__state_set === false) {
$app = JFactory::getApplication();
$this->setState('action', $step = $app->getUserState('com_kunena.install.action', null));
$this->setState('step', $step = $app->getUserState('com_kunena.install.step', 0));
$this->setState('task', $task = $app->getUserState('com_kunena.install.task', 0));
$this->setState('version', $task = $app->getUserState('com_kunena.install.version', null));
if ($step == 0) {
$app->setUserState('com_kunena.install.status', array());
}
$this->setState('status', $app->getUserState('com_kunena.install.status'));
$this->__state_set = true;
}
$value = parent::getState($property);
return is_null($value) ? $default : $value;
}
示例10: postSaveHook
/**
* Function that allows child controller access to model data after the data has been saved.
*
* @param JModel &$model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 1.6
*/
protected function postSaveHook(JModel &$model, $validData = array())
{
// Initialise variables.
$app = JFactory::getApplication();
$task = $this->getTask();
switch ($task) {
case 'save2new':
$app->setUserState('com_modules.add.module.extension_id', $model->getState('module.extension_id'));
break;
case 'save':
$app->setUserState('com_modules.add.module.extension_id', null);
// Redirect to the list screen.
$this->setRedirect(JRoute::_(sprintf('index.php?option=%s&view=modules', RokSprocket_Helper::getRedirectionOption()) . $this->getRedirectToListAppend(), false));
break;
case 'ajaxsave':
default:
}
$app->setUserState('com_modules.add.module.params', null);
}