本文整理汇总了PHP中RtiprintHelper::urlRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP RtiprintHelper::urlRequest方法的具体用法?PHP RtiprintHelper::urlRequest怎么用?PHP RtiprintHelper::urlRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RtiprintHelper
的用法示例。
在下文中一共展示了RtiprintHelper::urlRequest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Method to display a view.
*
* @access public
* @param boolean $cachable If true, the view output will be cached.
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}..
* @return void
*
* @since Cook 1.0
*/
public function display($cachable = false, $urlparams = false)
{
$jinput = JFactory::getApplication()->input;
$this->_parentDisplay();
//If page is called through POST, reconstruct the url
if ($jinput->getMethod(null, null) == 'POST') {
//Kill the post and rebuild the url
$this->setRedirect(RtiprintHelper::urlRequest());
return;
}
return $this;
}
示例2: applyRedirection
/**
* Customize the redirection depending on result.
* (proposed by Cook Self Service).
*
* @access protected
* @param mixed $result bool or integer. The result from the task operation
* @param array $redirections The redirections (option.view.layout) ordered by task result [0,1,...]
* @param array $vars Eventual added vars to the redirection.
*
* @return void
* @return void
*/
protected function applyRedirection($result, $redirections, $vars = array())
{
if ($result === null) {
$result = 1;
} else {
$result = (int) $result;
}
if (!$this->_result) {
$this->_result = $result;
}
if (!isset($redirections[$result])) {
return;
}
//Keep the default redirection
//Get the selected redirection depending on result
$redirection = $redirections[$result];
switch ($redirection) {
//Stay on the same page
case 'stay':
$this->setRedirect(RtiprintHelper::urlRequest());
return;
break;
//Return to the previous page in navigation history
//Return to the previous page in navigation history
case 'previous':
//TODO
break;
}
$url = explode(".", $redirection);
//Get from given url parts (empty string will keep the current value)
if (isset($url[0])) {
$values['option'] = !empty($url[0]) ? $url[0] : $this->option;
}
if (isset($url[1])) {
$values['view'] = !empty($url[1]) ? $url[1] : $this->view_list;
}
if (isset($url[2])) {
$values['layout'] = !empty($url[2]) ? $url[2] : $this->getLayout(true);
}
$jinput = JFactory::getApplication()->input;
//Followers : If value is defined in the current form, it will be added in the request
$followers = array('cid' => 'ARRAY', 'tmpl' => 'CMD', 'Itemid' => 'CMD', 'lang' => 'CMD');
//Filters followers
$model = CkJModel::getInstance($this->view_list, 'RtiprintModel');
if ($model) {
$filters = $model->get('filter_vars');
foreach ($filters as $filterName => $type) {
$type = 'STRING';
//When filter is empty, don't follow, so FILTER is not used.
$filterVar = 'filter_' . $filterName;
//Adds a filter follower
$followers[$filterVar] = $type;
}
}
//Apply the followers values
foreach ($followers as $varName => $varType) {
if ($pos = strpos($varType, ":")) {
$varType = substr($varType, 0, $pos);
}
$value = $jinput->get($varName, '', strtoupper($varType));
if ($varType == 'ARRAY' && !empty($value)) {
$value = implode(",", $value);
$varName .= "[]";
}
if ($value != '') {
$values[$varName] = $value;
}
}
//Override with vars in params
foreach ($vars as $key => $value) {
$values[$key] = $value;
}
//Prepare the url
foreach ($values as $key => $value) {
if ($value !== null) {
$parts[] = $key . '=' . $value;
}
}
//Apply redirection
$this->setRedirect(JRoute::_("index.php?" . implode("&", $parts), false));
}