| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- Lib::loadClass('SchemaReader');
- Lib::loadClass('SchemaReaderResourceTableField');
- class SchemaReaderProcessStep {
- private $_nr;
- private $_resourcesRefTable = array();
- private $_resources = array();
- public function __construct($stepNr) {
- $this->_nr = $stepNr;
- }
- public function parseIniConfig($configData) {
- $this->_description = V::get('description', '', $configData);
- return true;
- }
- public function addResource($resource) {
- if ($resource instanceof SchemaReaderResourceTableField) {
- $this->_resourcesRefTable[$resource->getTableUri()] = true;
- }
- $resourceUri = $resource->getUri();
- if (array_key_exists($resourceUri, $this->_resources)) {
- $this->_resources[$resourceUri]->addPerms($resource->getPerms());
- } else {
- $this->_resources[$resourceUri] = $resource;
- }
- }
- public function hasTables() {
- return !empty($this->_resourcesFields);
- }
- public function getTables() {
- $tbls = array();
- foreach ($this->_resourcesRefTable as $tblUri => $vBool) {
- $configData = array('type'=>'Table');
- $tbl = SchemaReader::buildFromIni($tblUri, $configData);
- foreach ($this->_resources as $resource) {
- if ($resource instanceof SchemaReaderResourceTableField) {
- if ($tbl->getUri() == $resource->getTableUri()) {
- $tbl->addField($resource);
- }
- }
- }
- $tbls[$tblUri] = $tbl;
- }
- return $tbls;
- }
- }
|