getData(); $this->_version = $config->get('version', 'CONFIG'); $this->_date = $config->get('date', 'CONFIG'); if('1' == V::get('DBG_SCH', '', $_GET)){echo'
$configData (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($configData);echo'';}
$configSections = array_keys($configData);
if (in_array('ACCESS', $configSections)) {
if (array_key_exists('HAS_ACCESS', $configData['ACCESS'])) {
$this->_access = $configData['ACCESS']['HAS_ACCESS'];
if (!is_array($this->_access)) $this->_access = array($this->_access);
}
if (array_key_exists('GROUPS', $configData['ACCESS'])) {
$this->_accessGroups = $configData['ACCESS']['GROUPS'];
if (!is_array($this->_accessGroups)) $this->_accessGroups = array($this->_accessGroups);
}
}
$this->_steps = array();
foreach ($configSections as $section) {
if ('STEP' == substr($section, 0, 4)) {
$sectionParts = explode(':', $section);
$sectionPartsCnt = count($sectionParts);
if ($sectionPartsCnt == 2) {// eg. [STEP:1]
$stepNr = $sectionParts[1];
$step = SchemaReader::buildProcessStepFromIni($stepNr, $configData[$section]);
if ($step) {
$this->_steps[$stepNr] = $step;
}
}
}
}
if('1' == V::get('DBG_SCH', '', $_GET)){echo'$this->_steps:1 (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($this->_steps);echo'';}
foreach ($configSections as $section) {
if ('STEP' == substr($section, 0, 4)) {
$sectionParts = explode(':', $section);
$sectionPartsCnt = count($sectionParts);
if ($sectionPartsCnt > 3) {// eg. [STEP:1:RESOURCE:1]
$stepNr = $sectionParts[1];
$resourceUri = V::get('uri', '', $configData[$section]);
if (!$resourceUri) continue;
$resource = SchemaReader::buildFromIni($resourceUri, $configData[$section]);
if ($resource && array_key_exists($stepNr, $this->_steps)) {
$this->_steps[$stepNr]->addResource($resource);
}
}
}
}
if('1' == V::get('DBG_SCH', '', $_GET)){echo'$this->_steps:2 (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($this->_steps);echo'';}
$this->_resourcesTable = array();
foreach ($this->_steps as $step) {
$stepTbls = $step->getTables();
foreach ($stepTbls as $tblUri => $tbl) {
if (array_key_exists($tblUri, $this->_resourcesTable)) {
$this->_resourcesTable[$tblUri]->mergeFields($tbl);
} else {
$this->_resourcesTable[$tblUri] = $tbl;
}
}
}
if('1' == V::get('DBG_SCH', '', $_GET)){echo'this->_resourcesTable (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($this->_resourcesTable);echo'';}
return true;
}
public function hasTables() {
return !empty($this->_resourcesTable);
}
public function getTables() {
return $this->_resourcesTable;
}
public function hasAccess() {
if (!empty($this->_access)) {
foreach ($this->_access as $accessName) {
if (User::hasAccess($accessName)) {
return true;
}
}
}
if (!empty($this->_accessGroups)) {
foreach ($this->_accessGroups as $accessGroup) {
if (User::hasGroup($accessGroup)) {
return true;
}
}
}
return false;
}
}