Improved the layout compiler methods.
This commit is contained in:
@ -12116,7 +12116,6 @@ class Interpretation extends Fields
|
||||
$COMPONENT = strtoupper($component);
|
||||
// set uppercase view
|
||||
$VIEWS = strtoupper($nameListCode);
|
||||
|
||||
// build the body
|
||||
$body = array();
|
||||
// check if the filter type is sidebar (1 = sidebar)
|
||||
@ -12146,6 +12145,14 @@ class Interpretation extends Fields
|
||||
$body[] = $this->_t(1) . "}";
|
||||
$body[] = "</script>";
|
||||
}
|
||||
// Trigger Event: jcb_ce_onSetDefaultViewsBodyTop
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onSetDefaultViewsBodyTop',
|
||||
array(&$this,
|
||||
&$body,
|
||||
&$nameSingleCode,
|
||||
&$nameListCode)
|
||||
);
|
||||
$body[] = "<form action=\"<?php echo JRoute::_('index.php?option=com_"
|
||||
. $component . "&view=" . $nameListCode
|
||||
. "'); ?>\" method=\"post\" name=\"adminForm\" id=\"adminForm\">";
|
||||
@ -12159,6 +12166,14 @@ class Interpretation extends Fields
|
||||
$body[] = "<?php else : ?>";
|
||||
$body[] = $this->_t(1) . "<div id=\"j-main-container\">";
|
||||
$body[] = "<?php endif; ?>";
|
||||
// Trigger Event: jcb_ce_onSetDefaultViewsFormTop
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onSetDefaultViewsFormTop',
|
||||
array(&$this,
|
||||
&$body,
|
||||
&$nameSingleCode,
|
||||
&$nameListCode)
|
||||
);
|
||||
// check if the filter type is sidebar (2 = topbar)
|
||||
if (isset($this->adminFilterType[$nameListCode])
|
||||
&& $this->adminFilterType[$nameListCode] == 2)
|
||||
@ -12247,7 +12262,23 @@ class Interpretation extends Fields
|
||||
$body[] = $this->_t(1)
|
||||
. "<input type=\"hidden\" name=\"task\" value=\"\" />";
|
||||
$body[] = $this->_t(1) . "<?php echo JHtml::_('form.token'); ?>";
|
||||
// Trigger Event: jcb_ce_onSetDefaultViewsFormBottom
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onSetDefaultViewsFormBottom',
|
||||
array(&$this,
|
||||
&$body,
|
||||
&$nameSingleCode,
|
||||
&$nameListCode)
|
||||
);
|
||||
$body[] = "</form>";
|
||||
// Trigger Event: jcb_ce_onSetDefaultViewsBodyBottom
|
||||
$this->triggerEvent(
|
||||
'jcb_ce_onSetDefaultViewsBodyBottom',
|
||||
array(&$this,
|
||||
&$body,
|
||||
&$nameSingleCode,
|
||||
&$nameListCode)
|
||||
);
|
||||
|
||||
return implode(PHP_EOL, $body);
|
||||
}
|
||||
@ -12503,9 +12534,7 @@ class Interpretation extends Fields
|
||||
public function setEditBody(&$view)
|
||||
{
|
||||
// set view name
|
||||
$nameSingleCode = ComponentbuilderHelper::safeString(
|
||||
$view['settings']->name_single
|
||||
);
|
||||
$nameSingleCode = $view['settings']->name_single_code;
|
||||
// main lang prefix
|
||||
$langView = $this->langPrefix . '_'
|
||||
. ComponentbuilderHelper::safeString($nameSingleCode, 'U');
|
||||
@ -12805,7 +12834,7 @@ class Interpretation extends Fields
|
||||
$tabs = array();
|
||||
// sort the tabs based on key order
|
||||
ksort($this->tabCounter[$nameSingleCode]);
|
||||
// start tab builinging loop
|
||||
// start tab building loop
|
||||
foreach ($this->tabCounter[$nameSingleCode] as $tabNr => $tabName)
|
||||
{
|
||||
$tabWidth = 12;
|
||||
@ -13516,29 +13545,211 @@ class Interpretation extends Fields
|
||||
*/
|
||||
public function setLayout($nameSingleCode, $layoutName, $items, $type)
|
||||
{
|
||||
// first build the layout file
|
||||
$target = array('admin' => $nameSingleCode);
|
||||
$this->buildDynamique($target, $type, $layoutName);
|
||||
// add to front if needed
|
||||
if ($this->lang === 'both')
|
||||
// we check if there is a local override
|
||||
if (!$this->setLayoutOverride($nameSingleCode, $layoutName, $items))
|
||||
{
|
||||
$target = array('site' => $nameSingleCode);
|
||||
// first build the layout file
|
||||
$target = array('admin' => $nameSingleCode);
|
||||
$this->buildDynamique($target, $type, $layoutName);
|
||||
// add to front if needed
|
||||
if ($this->lang === 'both')
|
||||
{
|
||||
$target = array('site' => $nameSingleCode);
|
||||
$this->buildDynamique($target, $type, $layoutName);
|
||||
}
|
||||
if (ComponentbuilderHelper::checkString($items))
|
||||
{
|
||||
// LAYOUTITEMS <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$nameSingleCode . '_'
|
||||
. $layoutName][$this->hhh . 'LAYOUTITEMS' . $this->hhh]
|
||||
= $items;
|
||||
}
|
||||
else
|
||||
{
|
||||
// LAYOUTITEMS <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$nameSingleCode . '_'
|
||||
. $layoutName][$this->hhh . 'bogus' . $this->hhh]
|
||||
= 'boom';
|
||||
}
|
||||
}
|
||||
if (ComponentbuilderHelper::checkString($items))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $nameSingleCode
|
||||
* @param string $layoutName
|
||||
* @param string $items
|
||||
*
|
||||
* @return boolean true if override was found
|
||||
*/
|
||||
protected function setLayoutOverride($nameSingleCode, $layoutName, $items)
|
||||
{
|
||||
if (($data = $this->getLayoutOverride($nameSingleCode, $layoutName))
|
||||
!== false)
|
||||
{
|
||||
// LAYOUTITEMS <<<DYNAMIC>>>
|
||||
// first build the layout file
|
||||
$target = array('admin' => $nameSingleCode);
|
||||
$this->buildDynamique($target, 'layoutoverride', $layoutName);
|
||||
// add to front if needed
|
||||
if ($this->lang === 'both')
|
||||
{
|
||||
$target = array('site' => $nameSingleCode);
|
||||
$this->buildDynamique($target, 'layoutoverride', $layoutName);
|
||||
}
|
||||
// make sure items is an empty string (should not be needed.. but)
|
||||
if (!ComponentbuilderHelper::checkString($items))
|
||||
{
|
||||
$items = '';
|
||||
}
|
||||
// set placeholder
|
||||
$placeholder = $this->placeholders;
|
||||
$placeholder[$this->hhh . 'LAYOUTITEMS' . $this->hhh] = $items;
|
||||
// OVERRIDE_LAYOUT_CODE <<<DYNAMIC>>>
|
||||
$php_view = (array) explode(PHP_EOL, $data['php_view']);
|
||||
if (ComponentbuilderHelper::checkArray($php_view))
|
||||
{
|
||||
$php_view = PHP_EOL . PHP_EOL . implode(PHP_EOL, $php_view);
|
||||
$this->fileContentDynamic[$nameSingleCode . '_'
|
||||
. $layoutName][$this->hhh
|
||||
. 'OVERRIDE_LAYOUT_CODE' . $this->hhh]
|
||||
= $this->setPlaceholders(
|
||||
$php_view, $placeholder
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->fileContentDynamic[$nameSingleCode . '_'
|
||||
. $layoutName][$this->hhh
|
||||
. 'OVERRIDE_LAYOUT_CODE' . $this->hhh]
|
||||
= '';
|
||||
}
|
||||
// OVERRIDE_LAYOUT_BODY <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$nameSingleCode . '_'
|
||||
. $layoutName][$this->hhh . 'LAYOUTITEMS' . $this->hhh]
|
||||
= $items;
|
||||
. $layoutName][$this->hhh
|
||||
. 'OVERRIDE_LAYOUT_BODY' . $this->hhh]
|
||||
= PHP_EOL . $this->setPlaceholders(
|
||||
$data['html'], $placeholder
|
||||
);
|
||||
|
||||
// since override was found
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $nameSingleCode
|
||||
* @param string $layoutName
|
||||
*
|
||||
* @return array the layout data
|
||||
*/
|
||||
protected function getLayoutOverride($nameSingleCode, $layoutName)
|
||||
{
|
||||
// check if there is an override by component name, view name, & layout name
|
||||
if ($this->setTemplateAndLayoutData(
|
||||
'override', $nameSingleCode, false, array(''),
|
||||
array($this->componentCodeName . $nameSingleCode . $layoutName)
|
||||
))
|
||||
{
|
||||
// LAYOUTITEMS <<<DYNAMIC>>>
|
||||
$this->fileContentDynamic[$nameSingleCode . '_'
|
||||
. $layoutName][$this->hhh . 'bogus' . $this->hhh]
|
||||
= 'boom';
|
||||
$data = $this->layoutData[$this->target][$this->componentCodeName
|
||||
. $nameSingleCode . $layoutName];
|
||||
// remove since we will add the layout now
|
||||
if ($this->lang === 'both')
|
||||
{
|
||||
unset(
|
||||
$this->layoutData['admin'][$this->componentCodeName
|
||||
. $nameSingleCode . $layoutName]
|
||||
);
|
||||
unset(
|
||||
$this->layoutData['site'][$this->componentCodeName
|
||||
. $nameSingleCode . $layoutName]
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset(
|
||||
$this->layoutData[$this->target][$this->componentCodeName
|
||||
. $nameSingleCode . $layoutName]
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
// check if there is an override by component name & layout name
|
||||
elseif ($this->setTemplateAndLayoutData(
|
||||
'override', $nameSingleCode, false, array(''),
|
||||
array($this->componentCodeName . $layoutName)
|
||||
))
|
||||
{
|
||||
$data = $this->layoutData[$this->target][$this->componentCodeName
|
||||
. $layoutName];
|
||||
// remove since we will add the layout now
|
||||
if ($this->lang === 'both')
|
||||
{
|
||||
unset(
|
||||
$this->layoutData['admin'][$this->componentCodeName
|
||||
. $layoutName]
|
||||
);
|
||||
unset(
|
||||
$this->layoutData['site'][$this->componentCodeName
|
||||
. $layoutName]
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset(
|
||||
$this->layoutData[$this->target][$this->componentCodeName
|
||||
. $layoutName]
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
// check if there is an override by view & layout name
|
||||
elseif ($this->setTemplateAndLayoutData(
|
||||
'override', $nameSingleCode, false, array(''),
|
||||
array($nameSingleCode . $layoutName)
|
||||
))
|
||||
{
|
||||
$data = $this->layoutData[$this->target][$nameSingleCode
|
||||
. $layoutName];
|
||||
// remove since we will add the layout now
|
||||
if ($this->lang === 'both')
|
||||
{
|
||||
unset(
|
||||
$this->layoutData['admin'][$nameSingleCode . $layoutName]
|
||||
);
|
||||
unset($this->layoutData['site'][$nameSingleCode . $layoutName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($this->layoutData[$this->target][$layoutName]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
// check if there is an override by layout name (global layout)
|
||||
elseif ($this->setTemplateAndLayoutData(
|
||||
'override', $nameSingleCode, false, array(''),
|
||||
array($layoutName)
|
||||
))
|
||||
{
|
||||
$data = $this->layoutData[$this->target][$layoutName];
|
||||
// remove since we will add the layout now
|
||||
if ($this->lang === 'both')
|
||||
{
|
||||
unset($this->layoutData['admin'][$layoutName]);
|
||||
unset($this->layoutData['site'][$layoutName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($this->layoutData[$this->target][$layoutName]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user