/** * create a new base_form_element_... * * @param $datatype * @return base_form_Input */ public static function createElement(Fieldinfo $fieldinfo) { $datatype = ucfirst($fieldinfo->getDataType()); $customClassName = "Custom_form_element_$datatype"; $baseClassName = "base_form_element_$datatype"; if (file_exists(ROOT . "/Custom/php/form/element/$datatype.php")) { return new $customClassName($fieldinfo); } return new $baseClassName($fieldinfo); }
public function getJSColModelElement() { $colModel = new base_js_ColModelElement(); $colModel->setName($this->fi->getFieldName()) ->setIndex($this->fi->getFieldName()) ->setWidth($this->fi->getDisplayedLength()) ->setClasses($this->fi->getFieldName()) ->setEditableTrue(); return $colModel; }
/** * execute the actual ajax request */ protected function executeRequest() { $requestHelper = $this->controller->getRequestHelper(); $class = $requestHelper->getParam('class'); $object = Factory::createObject($class); /** @var BaseObject[] $result */ $result = Finder::create($class)->find(); $urlColumns = $requestHelper->getParam('cols'); if (!is_null($urlColumns)) { if ($urlColumns == 'all') { $fi = new Fieldinfo($class); $columnNames = $fi->getAllFieldNames(); } else { $columnNames = explode(',', $urlColumns); } } else { $columnNames = $object->getStdSearchColumns(); } $response = new stdClass(); $i = 0; foreach ($result as $obj) { $values = []; $values['LK'] = (int) $obj['LK']; foreach ($columnNames as $colName) { $values[$colName] = $obj->getField($colName); } $response->BaseObjectReader[] = $values; $i++; } $jsonObject = json_encode($response); echo $jsonObject; exit(); }
private function _saveMNField(Fieldinfo $fi) { if (empty($this->_fields[$fi->getFieldName()])) { return; } /** @var BaseConnectionObject[] $connObjects */ $connObjects = $this->_fields[$fi->getFieldName()]; $objClass = get_class($this); $connClass = $fi->getConnectedClass(); /** @var BaseConnectionObject $connection */ $connection = new $connClass(); $otherClass = $connection->getOtherClass($objClass); $existingConnObjs = $connection->find($this->getLogicalKey(), $objClass); if (empty($connObjects) && empty($existingConnObjs)) { return; } if (empty($connObjects)) { $this->_deleteConnObjs($existingConnObjs); } $savedLKList = []; $actualLKList = []; foreach ($existingConnObjs as $obj) { $savedLKList[$obj->getLKForClass($otherClass)] = $obj; } foreach ($connObjects as $connObj) { $lk = $connObj->getLKForClass($otherClass); if (in_array($lk, array_keys($savedLKList))) { $actualLKList[] = $lk; continue; } $connObj->setLKForClass($objClass, $this->getLogicalKey()); $connObj->save(); } $diff = array_diff(array_keys($savedLKList), $actualLKList); foreach ($diff as $otherLK) { /** @var BaseConnectionObject $connObj */ $connObj = $savedLKList[$otherLK]; $connObj->delete(); } }
} $object = Factory::createObject($class); $user = Flat::user(); if (!User::isLoggedIn() || !$user->isEntitled($object->getPermissionForViewMode(DisplayClass::VIEW))) { $od->addContent('Sie verfügen nicht über die benötigten Rechte, um diese Datenkategorie zu betrachten. Bitte wenden Sie sich an den Support'); base_ui_Site::endMainContent($od); base_ui_Site::displayBottom($od); print $od->toString(); exit(); } $urlColumns = $requestHelper->getParam('cols'); if (!is_null($urlColumns)) { if ($urlColumns == 'all') { $fi = new Fieldinfo($class); $columnNames = $fi->getAllFieldNames(); } else { $columnNames = explode(',', $urlColumns); } } else { $columnNames = $object->getStdSearchColumns(); } $od->addContent(Html::startTag('h3')); $od->addContent('Suchergebnisliste: ' . $object->getDisplayName()); $od->addContent(Html::endTag('h3'));
public function setFieldinfo(Fieldinfo $fi) { $this->cache[$fi->getClass()][$fi->getFieldName()] = $fi; }