/** * initDataTypeObject * @author Thomas Schedler <*****@*****.**> * @version 1.0 */ public function initDataTypeObject() { $this->objDataType = GenericSetup::getDataTypeObject($this->setup->getFormTypeId()); if ($this->objDataType instanceof GenericDataTypeAbstract) { $this->objDataType->setGenericSetup($this->setup); } }
/** * addField * @param GenericElementField $objField * @author Thomas Schedler <*****@*****.**> * @version 1.2 */ protected function addField(GenericElementField &$objField, $intRegionId, $strNameExtension = '', $intRegionInstanceId = null, $blnEmpty = false) { try { $sqlStmt = array(); $arrOptions = array(); /** * get array options for select output if sqlSelect is in database */ if ($objField->sqlSelect != '' && $objField->sqlSelect) { $objReplacer = new Replacer(); $sqlSelect = $objReplacer->sqlReplacer($objField->sqlSelect, $this->setup->getLanguageId(), $this->setup->getRootLevelId()); $sqlStmt = $this->core->dbh->query($sqlSelect)->fetchAll(); if ($objField->idFieldTypeGroup == GenericSetup::FIELD_TYPE_SELECT_ID) { $arrOptions[''] = 'Bitte wählen'; } foreach ($sqlStmt as $arrSql) { if (array_key_exists('depth', $arrSql)) { $arrOptions[$arrSql['id']] = array('title' => $arrSql['title'], 'depth' => $arrSql['depth']); } else { $arrOptions[$arrSql['id']] = $arrSql['title']; } } } if ($objField->type == GenericSetup::FIELD_TYPE_TEMPLATE) { $objField->defaultValue = $this->setup->getTemplateId(); } if (!is_null($intRegionInstanceId)) { $mixedValue = $objField->getInstanceValue($intRegionInstanceId); } else { $mixedValue = $objField->getValue(); } if ($blnEmpty == true) { $mixedValue = null; } $strCssClass = ''; if ($objField->isKeyField) { $strCssClass = ' keyfield'; } /** * add field to form */ $this->addElement($objField->type, $objField->name . $strNameExtension, array('value' => $mixedValue, 'label' => $objField->title, 'description' => $objField->description, 'decorators' => array($objField->decorator), 'fieldId' => $objField->id, 'columns' => $objField->columns, 'class' => $objField->type . $strCssClass, 'height' => $objField->height, 'isGenericSaveField' => $objField->isSaveField, 'isCoreField' => $objField->isCoreField, 'MultiOptions' => $arrOptions, 'LanguageId' => $this->setup->getLanguageId(), 'isEmptyField' => $blnEmpty == true ? 1 : 0, 'required' => $objField->isKeyField == 1 ? true : false)); $this->getElement($objField->name . $strNameExtension)->regionId = $intRegionId; $this->getElement($objField->name . $strNameExtension)->regionExtension = $strNameExtension; $this->getElement($objField->name . $strNameExtension)->formTypeId = $this->setup->getFormTypeId(); if (count($objField->getProperties()) > 0) { foreach ($objField->getProperties() as $strProperty => $mixedPropertyValue) { if (in_array($strProperty, self::$FIELD_PROPERTIES_TO_IMPART)) { $this->getElement($objField->name . $strNameExtension)->{$strProperty} = $mixedPropertyValue; } } } /** * template specific addons */ if ($objField->type == GenericSetup::FIELD_TYPE_TEMPLATE) { $this->getElement($objField->name . $strNameExtension)->isStartPage = $this->Setup()->getIsStartElement(false); $this->getElement($objField->name . $strNameExtension)->intElementTypeId = $this->Setup()->getElementTypeId(); $this->getElement($objField->name . $strNameExtension)->intParentTypeId = $this->Setup()->getParentTypeId(); } } catch (Exception $exc) { $this->core->logger->err($exc); } }