/** * Read Metadata from xml array * * @param array $xmlArr * @return void */ protected function readMetadata(&$xmlArr) { parent::readMetaData($xmlArr); $this->inheritFrom = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["INHERITFROM"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["INHERITFROM"] : null; $this->searchRule = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["SEARCHRULE"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["SEARCHRULE"] : null; $this->baseSearchRule = $this->searchRule; $this->sortRule = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["SORTRULE"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["SORTRULE"] : null; $this->baseSortRule = $this->sortRule; $this->otherSQLRule = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["OTHERSQLRULE"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["OTHERSQLRULE"] : null; $this->baseOtherSQLRule = $this->otherSQLRule; $this->accessRule = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["ACCESSRULE"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["ACCESSRULE"] : null; $this->updateCondition = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["UPDATECONDITION"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["UPDATECONDITION"] : null; $this->deleteCondition = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["DELETECONDITION"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["DELETECONDITION"] : null; $this->databaseAliasName = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["DBNAME"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["DBNAME"] : null; if ($this->databaseAliasName == null) { $this->databaseAliasName = "Default"; } $this->mainTableName = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["TABLE"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["TABLE"] : null; $this->idGeneration = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["IDGENERATION"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["IDGENERATION"] : null; $this->stateless = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["STATELESS"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["STATELESS"] : null; // read in uniqueness attribute $this->uniqueness = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["UNIQUENESS"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["UNIQUENESS"] : null; $this->cacheLifeTime = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["CACHELIFETIME"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["CACHELIFETIME"] : "0"; $this->objectName = $this->prefixPackage($this->objectName); if ($this->inheritFrom == '@sourceMeta') { $this->inheritFrom = '@' . $this->objectName; } else { $this->inheritFrom = $this->prefixPackage($this->inheritFrom); } // build BizRecord $this->bizRecord = new BizRecord($xmlArr["BIZDATAOBJ"]["BIZFIELDLIST"]["BIZFIELD"], "Openbizx\\Data\\BizField", $this); // build TableJoins $this->tableJoins = new MetaIterator($xmlArr["BIZDATAOBJ"]["TABLEJOINS"]["JOIN"], "Openbizx\\Data\\Tools\\TableJoin", $this); // build ObjReferences $this->objReferences = new MetaIterator($xmlArr["BIZDATAOBJ"]["OBJREFERENCES"]["OBJECT"], "Openbizx\\Data\\Tools\\ObjReference", $this); // read in parameters $this->parameters = new MetaIterator($xmlArr["BIZDATAOBJ"]["PARAMETERS"]["PARAMETER"], "Parameter"); $this->messageFile = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["MESSAGEFILE"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["MESSAGEFILE"] : null; $this->objectMessages = MessageHelper::loadMessage($this->messageFile, $this->package); $this->eventManagerName = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["EVENTMANAGER"]) ? $xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["EVENTMANAGER"] : null; $this->dataPermControl = isset($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["DATAPERMCONTROL"]) ? strtoupper($xmlArr["BIZDATAOBJ"]["ATTRIBUTES"]["DATAPERMCONTROL"]) : 'N'; }
/** * Read Metadata from xml array * * @param array $xmlArr * @return void */ protected function readMetadata(&$xmlArr) { parent::readMetaData($xmlArr); $this->objectName = $this->prefixPackage($this->objectName); $this->title = isset($xmlArr["WEBPAGE"]["ATTRIBUTES"]["TITLE"]) ? $xmlArr["WEBPAGE"]["ATTRIBUTES"]["TITLE"] : null; $this->keywords = isset($xmlArr["WEBPAGE"]["ATTRIBUTES"]["KEYWORDS"]) ? $xmlArr["WEBPAGE"]["ATTRIBUTES"]["KEYWORDS"] : null; $this->templateEngine = isset($xmlArr["WEBPAGE"]["ATTRIBUTES"]["TEMPLATEENGINE"]) ? $xmlArr["WEBPAGE"]["ATTRIBUTES"]["TEMPLATEENGINE"] : null; $this->templateFile = isset($xmlArr["WEBPAGE"]["ATTRIBUTES"]["TEMPLATEFILE"]) ? $xmlArr["WEBPAGE"]["ATTRIBUTES"]["TEMPLATEFILE"] : null; //echo __METHOD__. '-' . __LINE__ . ' templateFile : ' . $this->templateFile . '<br />'; $this->viewSet = isset($xmlArr["WEBPAGE"]["ATTRIBUTES"]["VIEWSET"]) ? $xmlArr["WEBPAGE"]["ATTRIBUTES"]["VIEWSET"] : null; $this->tab = isset($xmlArr["WEBPAGE"]["ATTRIBUTES"]["TAB"]) ? $xmlArr["WEBPAGE"]["ATTRIBUTES"]["TAB"] : null; $this->formRefs = new MetaIterator($xmlArr["WEBPAGE"]["FORMREFERENCES"]["REFERENCE"], "Openbizx\\Easy\\FormReference", $this); if ($xmlArr["WEBPAGE"]["FORMREFERENCELIBS"]) { $this->formRefLibs = new MetaIterator($xmlArr["WEBPAGE"]["FORMREFERENCELIBS"]["REFERENCE"], "Openbizx\\Easy\\FormReference", $this); } if ($xmlArr["WEBPAGE"]["WIDGETS"]) { $this->widgets = new MetaIterator($xmlArr["WEBPAGE"]["WIDGETS"]["REFERENCE"], "Openbizx\\Easy\\FormReference", $this); } $this->messageFile = isset($xmlArr["WEBPAGE"]["ATTRIBUTES"]["MESSAGEFILE"]) ? $xmlArr["WEBPAGE"]["ATTRIBUTES"]["MESSAGEFILE"] : null; $this->objectMessages = MessageHelper::loadMessage($this->messageFile, $this->package); $this->cacheLifeTime = isset($xmlArr["WEBPAGE"]["ATTRIBUTES"]["CACHELIFETIME"]) ? $xmlArr["WEBPAGE"]["ATTRIBUTES"]["CACHELIFETIME"] : "0"; $this->readTile($xmlArr); // TODO: is this needed as title supports expression? $this->translate(); // translate for multi-language support if (empty($this->title)) { $this->title = $this->objectDescription; } }
/** * Inherit from parent object. Name, Package, Class cannot be inherited * * @return void */ protected function inheritParentObj() { if (!$this->inheritFrom) { return; } $parentObj = Openbizx::getObject($this->inheritFrom); $this->title = $this->title ? $this->title : $parentObj->title; $this->icon = $this->icon ? $this->icon : $parentObj->icon; $this->objectDescription = $this->objectDescription ? $this->objectDescription : $parentObj->objectDescription; $this->jsClass = $this->jsClass ? $this->jsClass : $parentObj->jsClass; $this->height = $this->height ? $this->height : $parentObj->height; $this->width = $this->width ? $this->width : $parentObj->width; $this->defaultForm = $this->defaultForm ? $this->defaultForm : $parentObj->defaultForm; $this->templateEngine = $this->templateEngine ? $this->templateEngine : $parentObj->templateEngine; $this->templateFile = $this->templateFile ? $this->templateFile : $parentObj->templateFile; $this->formType = $this->formType ? $this->formType : $parentObj->formType; $this->range = $this->range ? $this->range : $parentObj->range; $this->fixSearchRule = $this->fixSearchRule ? $this->fixSearchRule : $parentObj->fixSearchRule; $this->defaultFixSearchRule = $this->defaultFixSearchRule ? $this->defaultFixSearchRule : $parentObj->defaultFixSearchRule; $this->dataObjName = $this->dataObjName ? $this->dataObjName : $parentObj->dataObjName; $this->directMethodList = $this->directMethodList ? $this->directMethodList : $parentObj->directMethodList; $this->eventName = $this->eventName ? $this->eventName : $parentObj->eventName; $this->messageFile = $this->messageFile ? $this->messageFile : $parentObj->messageFile; $this->objectMessages = MessageHelper::loadMessage($this->messageFile, $this->package); $this->cacheLifeTime = $this->cacheLifeTime ? $this->cacheLifeTime : $parentObj->cacheLifeTime; $this->currentPage = $this->currentPage ? $this->currentPage : $parentObj->currentPage; $this->startItem = $this->startItem ? $this->startItem : $parentObj->startItem; $this->dataPanel->merge($parentObj->dataPanel); $this->actionPanel->merge($parentObj->actionPanel); $this->navPanel->merge($parentObj->navPanel); $this->searchPanel->merge($parentObj->searchPanel); if ($this->dataPanel->current()) { foreach ($this->dataPanel as $elem) { $elem->adjustFormName($this->objectName); } } if ($this->actionPanel->current()) { foreach ($this->actionPanel as $elem) { $elem->adjustFormName($this->objectName); } } if ($this->navPanel->current()) { foreach ($this->navPanel as $elem) { $elem->adjustFormName($this->objectName); } } if ($this->searchPanel->current()) { foreach ($this->searchPanel as $elem) { $elem->adjustFormName($this->objectName); } } $this->panels = array($this->dataPanel, $this->actionPanel, $this->navPanel, $this->searchPanel); }