getData(); $this->_version = $config->get('version', 'CONFIG'); $this->_date = $config->get('date', 'CONFIG'); DBG::_('DBG_SCH', '1', "configData", $configData, __CLASS__, __FUNCTION__, __LINE__ ); $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; } } } } DBG::_('DBG_SCH', '1', "_steps:1", $this->_steps, __CLASS__, __FUNCTION__, __LINE__ ); 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); } } } } DBG::_('DBG_SCH', '1', "_steps:2", $this->_steps, __CLASS__, __FUNCTION__, __LINE__ ); $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; } } } DBG::_('DBG_SCH', '1', "_resourcesTable", $this->_resourcesTable, __CLASS__, __FUNCTION__, __LINE__ ); 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; } }