本文整理汇总了PHP中JArrayHelper::getvalue方法的典型用法代码示例。如果您正苦于以下问题:PHP JArrayHelper::getvalue方法的具体用法?PHP JArrayHelper::getvalue怎么用?PHP JArrayHelper::getvalue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JArrayHelper
的用法示例。
在下文中一共展示了JArrayHelper::getvalue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Display the view
*/
public function display($tpl = null)
{
// Initialiase variables.
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
$canvas = JArrayHelper::getValue($this->item->params, 'canvas', array());
$blocks = new stdClass();
$b = JArrayHelper::getValue($canvas, 'blocks', array());
$blocks->form = JArrayHelper::getValue($b, 'form', array());
$blocks->list = JArrayHelper::getValue($b, 'list', array());
$blocks->visualization = JArrayHelper::getValue($b, 'visualization', array());
$opts = JArrayHelper::getvalue($canvas, 'options', array());
$tabs = JArrayHelper::getValue($canvas, 'tabs', array('Page 1'));
$tabs = $tabs;
$d = new stdClass();
$layout = JArrayHelper::getValue($canvas, 'layout', $d);
$document = JFactory::getDocument();
$opts = new stdClass();
$opts->tabs = $tabs;
$opts->blocks = $blocks;
$opts->tabelement = 'packagemenu';
$opts->pagecontainer = 'packagepages';
$opts->layout = $layout;
$opts = json_encode($opts);
$script = "head.ready(function() {\n\tPackageCanvas = new AdminPackage({$opts})\n});";
$document->addScriptDeclaration($script);
parent::display($tpl);
}
示例2: display
/**
* Display
*
* @param string $tpl Template
*
* @return void
*/
public function display($tpl = null)
{
FabrikHelperHTML::framework();
$app = JFactory::getApplication();
$input = $app->input;
$state = $this->get('State');
$item = $this->get('Item');
$document = JFactory::getDocument();
$srcs = array('media/com_fabrik/js/icons.js', 'media/com_fabrik/js/icongen.js', 'media/com_fabrik/js/canvas.js', 'media/com_fabrik/js/history.js', 'media/com_fabrik/js/keynav.js', 'media/com_fabrik/js/tabs.js', 'media/com_fabrik/js/pages.js', 'media/com_fabrik/js/frontpackage.js');
FabrikHelperHTML::script($srcs);
FabrikHelperHTML::stylesheet('media/com_fabrik/css/package.css');
$canvas = $item->params->get('canvas');
// $$$ rob 08/11/2011 test if component name set but still rendering
// in option=com_fabrik then we should use fabrik as the package
if ($input->get('option') === 'com_fabrik') {
$item->component_name = 'fabrik';
}
$opts = JArrayHelper::getvalue($canvas, 'options', array());
$tabs = JArrayHelper::getValue($canvas, 'tabs', array('Page 1'));
$tabs = json_encode($tabs);
$d = new stdClass();
$layout = JArrayHelper::getValue($canvas, 'layout', $d);
$layout = json_encode(JArrayHelper::getValue($canvas, 'layout', $d));
$id = $this->get('State')->get('package.id');
$script = "window.addEvent('fabrik.loaded', function() {\n\t\t\tnew FrontPackage({\n\t\ttabs : {$tabs},\n\t\ttabelement : 'packagemenu',\n\t\tpagecontainer : 'packagepages',\n\t\tlayout: {$layout},\n\t\t'packageId': {$id},\n\t\t'package':'{$item->component_name}'\n\t});\n\t\t});";
FabrikHelperHTML::addScriptDeclaration($script);
// Force front end templates
$this->_basePath = COM_FABRIK_FRONTEND . '/views';
$tmpl = !isset($item->template) ? 'default' : $item->template;
$this->addTemplatePath($this->_basePath . '/' . $this->_name . '/tmpl/' . $tmpl);
$text = $this->loadTemplate();
FabrikHelperHTML::runConentPlugins($text);
echo $text;
}
示例3: display
/**
* Display the view
*
* @param string $tpl Template
*
* @return void
*/
public function display($tpl = null)
{
// Initialise variables.
JHtml::_('behavior.modal', 'a.modal');
$model = $this->getModel();
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->listform = $this->get('PackageListForm');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
throw new RuntimeException(implode("\n", $errors), 500);
}
$this->addToolbar();
$canvas = FArrayHelper::getValue($this->item->params, 'canvas', array());
$blocks = new stdClass();
$b = FArrayHelper::getValue($canvas, 'blocks', array());
$blocks->form = FArrayHelper::getValue($b, 'form', array());
$blocks->list = FArrayHelper::getValue($b, 'list', array());
$blocks->visualization = FArrayHelper::getValue($b, 'visualization', array());
$opts = JArrayHelper::getvalue($canvas, 'options', array());
$d = new stdClass();
$layout = FArrayHelper::getValue($canvas, 'layout', $d);
$document = JFactory::getDocument();
$opts = new stdClass();
$opts->blocks = $blocks;
$opts->layout = $layout;
$opts = json_encode($opts);
$this->js = "PackageCanvas = new AdminPackage({$opts});";
$srcs[] = 'administrator/components/com_fabrik/views/package/adminpackage.js';
FabrikHelperHTML::iniRequireJS();
FabrikHelperHTML::script($srcs, $this->js);
// Simple layout
$this->listOpts = $model->getListOpts();
$this->formOpts = $model->getFormOpts();
$this->selFormOpts = $model->getSelFormOpts();
$this->selListOpts = $model->getSelListOpts();
FabrikAdminHelper::setViewLayout($this);
parent::display($tpl);
}
示例4: display
function display($tpl = null)
{
FabrikHelperHTML::framework();
$state = $this->get('State');
$item = $this->get('Item');
$document = JFactory::getDocument();
FabrikHelperHTML::script('media/com_fabrik/js/icons.js', true);
FabrikHelperHTML::script('media/com_fabrik/js/icongen.js', true);
FabrikHelperHTML::script('media/com_fabrik/js/canvas.js', true);
FabrikHelperHTML::script('media/com_fabrik/js/history.js', true);
FabrikHelperHTML::script('media/com_fabrik/js/keynav.js', true);
FabrikHelperHTML::script('media/com_fabrik/js/tabs.js', true);
FabrikHelperHTML::script('media/com_fabrik/js/pages.js', true);
FabrikHelperHTML::script('media/com_fabrik/js/frontpackage.js', true);
FabrikHelperHTML::stylesheet('media/com_fabrik/css/package.css');
$canvas = $item->params->get('canvas');
$opts = JArrayHelper::getvalue($canvas, 'options', array());
$tabs = JArrayHelper::getValue($canvas, 'tabs', array('Page 1'));
$tabs = json_encode($tabs);
$d = new stdClass();
$layout = JArrayHelper::getValue($canvas, 'layout', $d);
$layout = json_encode(JArrayHelper::getValue($canvas, 'layout', $d));
$id = $this->get('State')->get('package.id');
$script = "head.ready(function() {\r\n\t\t\tnew FrontPackage({\r\n\t\ttabs : {$tabs},\r\n\t\ttabelement : 'packagemenu',\r\n\t\tpagecontainer : 'packagepages',\r\n\t\tlayout: {$layout},\r\n\t\t'packageid':{$id},\r\n\t\t'package':'{$item->component_name}'\r\n\t});\r\n\t\t});";
$document->addScriptDeclaration($script);
//force front end templates
$this->_basePath = COM_FABRIK_FRONTEND . DS . 'views';
$tmpl = !isset($item->template) ? 'default' : $item->template;
$this->addTemplatePath($this->_basePath . DS . $this->_name . DS . 'tmpl' . DS . $tmpl);
$text = $this->loadTemplate();
$opt = JRequest::getVar('option');
JRequest::setVar('option', 'com_content');
jimport('joomla.html.html.content');
$text .= '{emailcloak=off}';
$text = JHTML::_('content.prepare', $text);
$text = preg_replace('/\\{emailcloak\\=off\\}/', '', $text);
JRequest::setVar('option', $opt);
echo $text;
}
示例5: display
/**
* Display the view
*/
public function display($tpl = null)
{
// Initialiase variables.
JHtml::_('behavior.modal', 'a.modal');
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->listform = $this->get('PackageListForm');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
$canvas = JArrayHelper::getValue($this->item->params, 'canvas', array());
$blocks = new stdClass();
$b = JArrayHelper::getValue($canvas, 'blocks', array());
$blocks->form = JArrayHelper::getValue($b, 'form', array());
$blocks->list = JArrayHelper::getValue($b, 'list', array());
$blocks->visualization = JArrayHelper::getValue($b, 'visualization', array());
$opts = JArrayHelper::getvalue($canvas, 'options', array());
$tabs = JArrayHelper::getValue($canvas, 'tabs', array('Page 1'));
$tabs = $tabs;
$d = new stdClass();
$layout = JArrayHelper::getValue($canvas, 'layout', $d);
$document = JFactory::getDocument();
$opts = new stdClass();
$opts->tabs = $tabs;
$opts->blocks = $blocks;
$opts->tabelement = 'packagemenu';
$opts->pagecontainer = 'packagepages';
$opts->layout = $layout;
$opts = json_encode($opts);
$this->js = "PackageCanvas = new AdminPackage({$opts});\n\t\tnew inline('#packagemenu li span');";
parent::display($tpl);
}
示例6: makeRedirect
/**
* generic function to redirect
* @param string redirection message to show
*/
function makeRedirect($msg = null, &$model)
{
$app = JFactory::getApplication();
if (is_null($msg)) {
$msg = JText::_('COM_FABRIK_RECORD_ADDED_UPDATED');
}
if ($app->isAdmin()) {
if (array_key_exists('apply', $model->_formData)) {
$url = "index.php?option=com_fabrik&c=form&task=form&formid=" . JRequest::getInt('formid') . "&listid=" . JRequest::getInt('listid') . "&rowid=" . JRequest::getInt('rowid');
} else {
$url = "index.php?option=com_fabrik&c=table&task=viewTable&cid[]=" . $model->_table->id;
}
$this->setRedirect($url, $msg);
} else {
if (array_key_exists('apply', $model->_formData)) {
$url = "index.php?option=com_fabrik&c=form&view=form&formid=" . JRequest::getInt('formid') . "&rowid=" . JRequest::getInt('rowid') . "&listid=" . JRequest::getInt('listid');
} else {
if ($this->isMambot) {
//return to the same page
//$$$ hugh - this doesn't seem to work if SEF is NOT enabled, just goes to index.php.
//$url = JArrayHelper::getValue($_SERVER, 'REQUEST_URI', 'index.php');
$url = JArrayHelper::getvalue($_SERVER, 'HTTP_REFERER', 'index.php');
} else {
//return to the page that called the form
$url = urldecode(JRequest::getVar('fabrik_referrer', 'index.php', 'post'));
}
$Itemid = $app->getMenu('site')->getActive()->id;
if ($url == '') {
$url = "index.php?option=com_fabrik&Itemid={$Itemid}";
}
}
$config = JFactory::getConfig();
if ($config->get('sef')) {
$url = JRoute::_($url);
}
$this->setRedirect($url, $msg);
}
}
示例7: makeRedirect
/**
* generic function to redirect
* @param string redirection message to show
*/
function makeRedirect($msg = null, &$model)
{
$app =& JFactory::getApplication();
if (is_null($msg)) {
$msg = JText::_('RECORD ADDED/UPDATED');
}
if ($app->isAdmin()) {
if (array_key_exists('apply', $model->_formData)) {
$url = "index.php?option=com_fabrik&c=form&task=form&fabrik=" . JRequest::getInt('fabrik') . "&tableid=" . JRequest::getInt('tableid') . "&rowid=" . JRequest::getInt('rowid');
} else {
$url = "index.php?option=com_fabrik&c=table&task=viewTable&cid[]=" . $model->_table->id;
}
$this->setRedirect($url, $msg);
} else {
if (array_key_exists('apply', $model->_formData)) {
$url = "index.php?option=com_fabrik&c=form&view=form&fabrik=" . JRequest::getInt('fabrik') . "&rowid=" . JRequest::getInt('rowid') . "&tableid=" . JRequest::getInt('tableid') . '&Itemid=' . JRequest::getInt('Itemid');
// $$$ hugh - Seems to be causing 404's when SEF'ing. Temporarily commenting it out.
//$url .= "&fabrik_referrer=".urlencode(JRequest::getVar('fabrik_referrer'));
} else {
if ($this->_isMambot) {
//return to the same page
//$$$ hugh - this doesn't seem to work if SEF is NOT enabled, just goes to index.php.
//$url = JArrayHelper::getValue($_SERVER, 'REQUEST_URI', 'index.php');
$url = JArrayHelper::getvalue($_SERVER, 'HTTP_REFERER', 'index.php');
} else {
//return to the page that called the form
$url = urldecode(JRequest::getVar('fabrik_referrer', 'index.php', 'post'));
}
global $Itemid;
if ($url == '') {
$url = "index.php?option=com_fabrik&Itemid={$Itemid}";
}
}
$config =& JFactory::getConfig();
if ($config->getValue('sef')) {
$url = JRoute::_($url);
}
$this->setRedirect($url, $msg);
}
}
示例8: getRedirectURL
/**
* since 3.0
* Enter description here ...
* @param object $model
*/
protected function getRedirectURL($model, $incSession = true)
{
$app = JFactory::getApplication();
if ($app->isAdmin()) {
if (array_key_exists('apply', $model->_formData)) {
$url = "index.php?option=com_fabrik&c=form&task=form&formid=".JRequest::getInt('formid')."&listid=".JRequest::getInt('listid')."&rowid=".JRequest::getInt('rowid');
} else {
$url = "index.php?option=com_fabrik&c=table&task=viewTable&cid[]=".$model->_table->id;
}
} else {
if (array_key_exists('apply', $model->_formData)) {
$url = "index.php?option=com_fabrik&view=form&formid=".JRequest::getInt('formid')."&rowid=".JRequest::getInt('rowid')."&listid=".JRequest::getInt('listid');
} else {
if ($this->isMambot) {
//return to the same page
$url = JArrayHelper::getvalue($_SERVER, 'HTTP_REFERER', 'index.php');
} else {
//return to the page that called the form
$url = urldecode(JRequest::getVar('fabrik_referrer', 'index.php', 'post'));
}
$Itemid = $app->getMenu('site')->getActive()->id;
if ($url == '') {
$url = "index.php?option=com_fabrik&Itemid=$Itemid";
}
}
$config = JFactory::getConfig();
if ($config->get('sef')) {
$url = JRoute::_($url);
}
}
//3.0 need to distinguish between the default redirect and redirect plugin
$this->baseRedirect = true;
if (!$incSession) {
return $url;
}
$session = JFactory::getSession();
$formdata = $session->get('com_fabrik.form.data');
$context = 'com_fabrik.form.'.$formdata['formid'].'.redirect.';
//if the redirect plug-in has set a url use that in preference to the default url
//$surl = $session->get($context.'url', array($url));
$surl = $session->get($context.'url', array());
if (!empty($surl)) {
$this->baseRedirect = false;
}
if (!is_array($surl)) {
$surl = array($surl);
}
if (empty($surl)) {
$surl[] = $url;
}
// $$$ hugh - hmmm, array_shift re-orders array keys, which will screw up plugin ordering?
$url = array_shift($surl);
$session->set($context.'url', $surl);
return $url;
}
示例9: makeRedirect
/**
* generic function to redirect
*
* @param object &$model form model
* @param string $msg redirection message to show
*
* @return null
*/
protected function makeRedirect(&$model, $msg = null)
{
$app = JFactory::getApplication();
$package = $app->getUserState('com_fabrik.package', 'fabrik');
$input = $app->input;
$formId = $input->getInt('formid');
$listId = $input->getInt('listid');
$rowId = $input->getString('rowid');
if (is_null($msg)) {
$msg = FText::_('COM_FABRIK_RECORD_ADDED_UPDATED');
}
if ($app->isAdmin()) {
// Admin links use com_fabrik over package option
if (array_key_exists('apply', $model->formData)) {
$url = 'index.php?option=com_fabrik&c=form&task=form&formid=' . $formId . '&listid=' . $listId . '&rowid=' . $rowId;
} else {
$url = 'index.php?option=com_fabrik&c=table&task=viewTable&cid[]=' . $model->getTable()->id;
}
$this->setRedirect($url, $msg);
} else {
if (array_key_exists('apply', $model->formData)) {
$url = 'index.php?option=com_' . $package . '&c=form&view=form&formid=' . $formId . '&rowid=' . $rowId . '&listid=' . $listId;
} else {
if ($this->isMambot) {
// Return to the same page
$url = JArrayHelper::getvalue($_SERVER, 'HTTP_REFERER', 'index.php');
} else {
// Return to the page that called the form
$url = urldecode($input->post->get('fabrik_referrer', 'index.php', 'string'));
}
$Itemid = FabrikWorker::itemId();
if ($url == '') {
$url = 'index.php?option=com_' . $package . '&Itemid=' . $Itemid;
}
}
$config = JFactory::getConfig();
if ($config->get('sef')) {
$url = JRoute::_($url);
}
$this->setRedirect($url, $msg);
}
}
示例10: getBitstreamDocument
/**
* Gets a populated instance of the \JSolr\Apache\Solr\Document class containing
* indexable information about a single bitstream.
*
* @param stdClass $record The bitstream information.
*
* @return \JSolr\Apache\Solr\Document A populated instance of the
* \JSolr\Apache\Solr\Document class containing indexable information about
* the single bitstream.
*/
private function getBitstreamDocument($record)
{
$doc = new \JSolr\Apache\Solr\Document();
// Make the first language available the bitstream's language.
$lang = explode('-', JArrayHelper::getValue($record->lang, 0));
$lang = JArrayHelper::getvalue($lang, 0);
$doc->addField('id', $record->id);
$doc->addField('context', $this->get('assetContext'));
for ($i = 0; $i < count($record->lang); $i++) {
if ($i == 0) {
if ($this->get('params')->get('ignore_language', 1)) {
$doc->addField('lang', '*');
} else {
$doc->addField('lang', JArrayHelper::getValue($record->lang, $i));
}
} else {
$doc->addField('lang_alt', JArrayHelper::getValue($record->lang, $i));
}
}
$doc->addField('key', $this->get('assetContext') . '.' . $record->id);
if (isset($record->author)) {
$doc->addField('author', $record->author);
$doc->addField('author_' . $lang, $record->author);
}
$doc->addField('title', $record->name);
$doc->addField('title_' . $lang, $record->name);
$doc->addField('type_s', $record->type);
if (isset($record->body)) {
if (strip_tags($record->body)) {
$doc->addField("body_{$lang}", strip_tags($record->body));
}
}
foreach ($record->metadata->toArray() as $key => $value) {
$metakey = $this->cleanBitstreamMetadataKey($key);
if (is_float($value)) {
$doc->addField($metakey . '_tfm', $value);
} elseif (is_int($value)) {
// handle solr int/long differentiation.
if ((int) $value > 2147483647 || (int) $value < -2147483648) {
$doc->addField($metakey . '_tlm', $value);
} else {
$doc->addField($metakey . '_tim', $value);
}
} else {
$doc->addField($metakey . '_sm', $value);
}
}
return $doc;
}
示例11: getJSIcons
//.........这里部分代码省略.........
$html = str_replace("'", '"', $html);
$this->txt[] = $html;
if ($iconImg == '') {
$iconImg = JArrayHelper::getValue($markerImages, $c, '');
if ($iconImg != '') {
$iconImg = JArrayHelper::getValue($rowdata, $iconImg, '');
// Get the src
preg_match('/src=["|\'](.*?)["|\']/', $iconImg, $matches);
if (array_key_exists(1, $matches)) {
$iconImg = $matches[1];
// Check file exists
$path = str_replace(COM_FABRIK_LIVESITE, '', $iconImg);
if (JFile::exists(JPATH_BASE . $path)) {
$customimagefound = true;
}
}
}
if ($iconImg != '') {
list($width, $height) = $this->markerSize($iconImg);
} else {
// Standard google map icon size
$width = 20;
$height = 34;
}
} else {
// Standard google map icon size
list($width, $height) = $this->markerSize(JPATH_SITE . '/images/stories/' . $iconImg);
}
$gClass = JArrayHelper::getValue($groupClass, 0, '');
if (!empty($gClass)) {
$gClass .= '_raw';
$gClass = isset($row->{$gClass}) ? $row->{$gClass} : '';
}
if (array_key_exists($v[0] . $v[1], $icons)) {
$existingIcon = $icons[$v[0] . $v[1]];
if ($existingIcon['groupkey'] == $groupKey) {
/* $$$ hugh - this inserts label between multiple record $html, but not at the top.
* If they want to insert label, they can do it themselves in the template.
* $icons[$v[0].$v[1]][2] = $icons[$v[0].$v[1]][2] . "<h6>$table->label</h6>" . $html;
* Don't insert linebreaks in empty bubble
*/
if ($html != '') {
$html = "<br />" . $html;
}
$icons[$v[0] . $v[1]][2] = $icons[$v[0] . $v[1]][2] . $html;
if ($customimagefound) {
$icons[$v[0] . $v[1]][3] = $iconImg;
}
} else {
$groupedIcons[] = array($v[0], $v[1], $html, $iconImg, $width, $height, 'groupkey' => $groupKey, 'listid' => $listid, 'title' => $title, 'groupClass' => 'type' . $gClass);
}
} else {
// Default icon - lets see if we need to use a letter icon instead
if (JArrayHelper::getValue($letters, $c, '') != '') {
$iconImg = $uri->getScheme() . '://www.google.com/mapfiles/marker' . JString::strtoupper($letters[$c]) . '.png';
}
$icons[$v[0] . $v[1]] = array($v[0], $v[1], $html, $iconImg, $width, $height, 'groupkey' => $groupKey, 'listid' => $listid, 'title' => $title, 'groupClass' => 'type' . $gClass);
}
if ($params->get('fb_gm_use_radius', '0') == '1') {
$radiusElement = JArrayHelper::getValue($radiusElements, $c, '');
$radiusUnits = JArrayHelper::getValue($radiusUnits, $c, 'k');
$radiusMeters = $radiusUnits == 'k' ? 1000 : 1609.34;
if (!empty($radiusElement)) {
$radius = (double) $row->{$radiusElement};
$radius *= $radiusMeters;
$icons[$v[0] . $v[1]]['radius'] = $radius;
} else {
$default = (double) JArrayHelper::getvalue($radiusDefaults, $c, 50);
$default *= $radiusMeters;
$icons[$v[0] . $v[1]]['radius'] = $default;
}
}
$icons[$v[0] . $v[1]]['c'] = $c;
$this->recordCount++;
$k++;
}
}
// Replace last icon?
$iconImg = JArrayHelper::getValue($aLastIcons, $c, '');
if ($iconImg != '') {
list($width, $height) = $this->markerSize(JPATH_SITE . '/media/com_fabrik/images/' . $iconImg);
$icons[$v[0] . $v[1]][3] = $iconImg;
$icons[$v[0] . $v[1]][4] = $width;
$icons[$v[0] . $v[1]][5] = $height;
}
$c++;
}
// Replace coord keys with numeric keys
$icons = array_values($icons);
$icons = array_merge($icons, $groupedIcons);
if ($maxMarkers != 0 && $maxMarkers < count($icons)) {
$icons = array_slice($icons, -$maxMarkers);
}
$limitMessageShown = !($k >= $recLimit);
if (!$limitMessageShown && $recLimit !== 0 && $limitMessage != '') {
$app->enqueueMessage($limitMessage);
}
FabrikHelperHTML::debug($icons, 'map');
return $icons;
}
示例12: getRedirectURL
/**
* Get redirect URL
*
* @param bool $incSession set url in session?
* @param bool $isMambot is Mambot
*
* @return array url: string redirect url, baseRedirect (True: default redirect, False: plugin redirect)
*
* @since 3.0.6 (was in form controller)
*/
public function getRedirectURL($incSession = true, $isMambot = false)
{
$app = JFactory::getApplication();
if ($app->isAdmin()) {
if (array_key_exists('apply', $this->_formData)) {
$url = 'index.php?option=com_fabrik&task=form.view&formid=' . JRequest::getInt('formid') . '&rowid=' . JRequest::getInt('rowid');
} else {
$url = 'index.php?option=com_fabrik&task=list.view&listid=' . $this->getListModel()->getId();
}
} else {
if (array_key_exists('apply', $this->_formData)) {
$url = 'index.php?option=com_fabrik&view=form&formid=' . JRequest::getInt('formid') . '&rowid=' . JRequest::getInt('rowid') . '&listid=' . JRequest::getInt('listid');
} else {
if ($isMambot) {
// Return to the same page
$url = JArrayHelper::getvalue($_SERVER, 'HTTP_REFERER', 'index.php');
} else {
// Return to the page that called the form
$url = urldecode(JRequest::getVar('fabrik_referrer', 'index.php', 'post'));
}
$Itemid = (int) @$app->getMenu('site')->getActive()->id;
if ($url == '') {
if ($Itemid !== 0) {
$url = 'index.php?' . http_build_query($app->getMenu('site')->getActive()->query) . '&Itemid=' . $Itemid;
} else {
// No menu link so redirect back to list view
$url = 'index.php?option=com_fabrik&view=list&listid=' . JRequest::getInt('listid');
}
}
}
$config = JFactory::getConfig();
if ($config->get('sef')) {
$url = JRoute::_($url);
}
}
// 3.0 need to distinguish between the default redirect and redirect plugin
$baseRedirect = true;
if (!$incSession) {
return $url;
}
$session = JFactory::getSession();
$formdata = $session->get('com_fabrik.form.data');
$context = $this->getRedirectContext();
// If the redirect plug-in has set a url use that in preference to the default url
$surl = $session->get($context . 'url', array());
if (!empty($surl)) {
$baseRedirect = false;
}
if (!is_array($surl)) {
$surl = array($surl);
}
if (empty($surl)) {
$surl[] = $url;
}
// $$$ hugh - hmmm, array_shift re-orders array keys, which will screw up plugin ordering?
$url = array_shift($surl);
$session->set($context . 'url', $surl);
return array('url' => $url, 'baseRedirect' => $baseRedirect);
}