Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/helpers/sections_helper.php
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Line(s) | |||||
asort($prioritized_prefixes); | asort($prioritized_prefixes); | ||||
foreach ($prioritized_prefixes as $prefix => $priority) { | foreach ($prioritized_prefixes as $prefix => $priority) { | ||||
$this->_processPrefixSections($prefix); | $this->_processPrefixSections($prefix); | ||||
} | } | ||||
// 2. apply section adjustments | // 2. apply section adjustments | ||||
foreach ($prefixes as $prefix) { | foreach ($prefixes as $prefix) { | ||||
$config =& $this->Application->UnitConfigReader->configData[$prefix]; | $config =& $this->Application->UnitConfigReader->configData[$prefix]; | ||||
/** @var Array $section_adjustments */ | |||||
$section_adjustments = getArrayValue($config, 'SectionAdjustments'); | $section_adjustments = getArrayValue($config, 'SectionAdjustments'); | ||||
/* @var $section_adjustments Array */ | |||||
if ( !$section_adjustments ) { | if ( !$section_adjustments ) { | ||||
continue; | continue; | ||||
} | } | ||||
foreach ($section_adjustments as $section_name => $adjustment_params) { | foreach ($section_adjustments as $section_name => $adjustment_params) { | ||||
if ( is_array($adjustment_params) ) { | if ( is_array($adjustment_params) ) { | ||||
if ( !array_key_exists($section_name, $this->Tree) ) { | if ( !array_key_exists($section_name, $this->Tree) ) { | ||||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | |||||
else { | else { | ||||
$this->Application->setDBCache('sections_parsed', serialize($this->Tree)); | $this->Application->setDBCache('sections_parsed', serialize($this->Tree)); | ||||
} | } | ||||
} | } | ||||
function _processPrefixSections($prefix) | function _processPrefixSections($prefix) | ||||
{ | { | ||||
$config =& $this->Application->UnitConfigReader->configData[$prefix]; | $config =& $this->Application->UnitConfigReader->configData[$prefix]; | ||||
/** @var Array $sections */ | |||||
$sections = getArrayValue($config, 'Sections'); | $sections = getArrayValue($config, 'Sections'); | ||||
/* @var $sections Array */ | |||||
if ( !$sections ) { | if ( !$sections ) { | ||||
return ; | return ; | ||||
} | } | ||||
foreach ($sections as $section_name => $section_params) { | foreach ($sections as $section_name => $section_params) { | ||||
// we could also skip not allowed sections here in future | // we could also skip not allowed sections here in future | ||||
if ( isset($section_params['SectionPrefix']) ) { | if ( isset($section_params['SectionPrefix']) ) { | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | |||||
* @param string $section_name | * @param string $section_name | ||||
* @param bool $check_permission | * @param bool $check_permission | ||||
* @return string | * @return string | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function getFirstChild($section_name, $check_permission = false) | public function getFirstChild($section_name, $check_permission = false) | ||||
{ | { | ||||
$section_data =& $this->getSectionData($section_name); | $section_data =& $this->getSectionData($section_name); | ||||
/** @var Array $children */ | |||||
$children = isset($section_data['children']) && $section_data['children'] ? $section_data['children'] : false; | $children = isset($section_data['children']) && $section_data['children'] ? $section_data['children'] : false; | ||||
/* @var $children Array */ | |||||
if ( $children ) { | if ( $children ) { | ||||
// get 1st child | // get 1st child | ||||
ksort($children, SORT_NUMERIC); | ksort($children, SORT_NUMERIC); | ||||
foreach ($children as $child_section) { | foreach ($children as $child_section) { | ||||
if ( !$this->sectionVisible($child_section, $check_permission) ) { | if ( !$this->sectionVisible($child_section, $check_permission) ) { | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
if ($section_data && isset($section_data['perm_prefix'])) { | if ($section_data && isset($section_data['perm_prefix'])) { | ||||
// this section uses other section permissions | // this section uses other section permissions | ||||
$ret = $this->Application->getUnitOption($section_data['perm_prefix'].'.main', 'PermSection'); | $ret = $this->Application->getUnitOption($section_data['perm_prefix'].'.main', 'PermSection'); | ||||
} | } | ||||
return $ret; | return $ret; | ||||
} | } | ||||
} | } | ||||
No newline at end of file | No newline at end of file |