|
@@ -260,10 +260,10 @@ class Core_AclSimpleSchemaBase extends Core_AclBase {
|
|
|
public function canWriteField($fieldName) { return false; }// TODO: perms from Procesy
|
|
public function canWriteField($fieldName) { return false; }// TODO: perms from Procesy
|
|
|
public function canWriteObjectField($fieldName, $record) { return false; }// TODO: perms from Procesy
|
|
public function canWriteObjectField($fieldName, $record) { return false; }// TODO: perms from Procesy
|
|
|
|
|
|
|
|
- public function getTotal($params = array()) { throw new Exception("Unimplemented - TODO: F." . __FUNCTION__); }// TODO: use ParseOgcQuery
|
|
|
|
|
- public function getItem($primaryKey, $params = []) { throw new Exception("Unimplemented - TODO: F." . __FUNCTION__); }
|
|
|
|
|
- public function getItems($params = array()) { throw new Exception("Unimplemented - TODO: F." . __FUNCTION__); }// TODO: use ParseOgcQuery
|
|
|
|
|
- public function itemsFetchRefs(&$items) { throw new Exception("Unimplemented - TODO: F." . __FUNCTION__); }// TODO: , $fieldName = ''
|
|
|
|
|
|
|
+ public function getTotal($params = array()) { throw new Exception("Unimplemented - TODO: " . get_class($this) . "::" . __FUNCTION__); }// TODO: use ParseOgcQuery
|
|
|
|
|
+ public function getItem($primaryKey, $params = []) { throw new Exception("Unimplemented - TODO: " . get_class($this) . "::" . __FUNCTION__); }
|
|
|
|
|
+ public function getItems($params = array()) { throw new Exception("Unimplemented - TODO: " . get_class($this) . "::" . __FUNCTION__); }// TODO: use ParseOgcQuery
|
|
|
|
|
+ public function itemsFetchRefs(&$items) { throw new Exception("Unimplemented - TODO: " . get_class($this) . "::" . __FUNCTION__); }// TODO: , $fieldName = ''
|
|
|
public function fetchItemFieldRefs($primaryKey, $fieldName) {
|
|
public function fetchItemFieldRefs($primaryKey, $fieldName) {
|
|
|
$refTable = ACL::getRefTable($this->getNamespace(), $fieldName);
|
|
$refTable = ACL::getRefTable($this->getNamespace(), $fieldName);
|
|
|
$sqlPk = DB::getPDO()->quote($primaryKey, PDO::PARAM_STR);
|
|
$sqlPk = DB::getPDO()->quote($primaryKey, PDO::PARAM_STR);
|
|
@@ -282,7 +282,7 @@ class Core_AclSimpleSchemaBase extends Core_AclBase {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
public function addItem($itemTodo) { throw new Exception("Unimplemented - TODO: " . get_class($this) . "::" . __FUNCTION__); }
|
|
public function addItem($itemTodo) { throw new Exception("Unimplemented - TODO: " . get_class($this) . "::" . __FUNCTION__); }
|
|
|
- public function updateItem($itemPatch) { throw new Exception("Unimplemented - TODO: F." . __FUNCTION__); }
|
|
|
|
|
|
|
+ public function updateItem($itemPatch) { throw new Exception("Unimplemented - TODO: " . get_class($this) . "::" . __FUNCTION__); }
|
|
|
|
|
|
|
|
public function getGeomFieldType($fieldName) { return null; }
|
|
public function getGeomFieldType($fieldName) { return null; }
|
|
|
public function getPrimaryKeyField() { return $this->_primaryKey; }
|
|
public function getPrimaryKeyField() { return $this->_primaryKey; }
|
|
@@ -468,4 +468,44 @@ class Core_AclSimpleSchemaBase extends Core_AclBase {
|
|
|
return Core_AclHelper::getChildHistTable($this->getRootTableName(), $childName, $childSchema);
|
|
return Core_AclHelper::getChildHistTable($this->getRootTableName(), $childName, $childSchema);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function getEnumValues($childName) {
|
|
|
|
|
+ $childSchema = $this->_simpleSchema['root'][$childName];
|
|
|
|
|
+ DBG::log([
|
|
|
|
|
+ 'msg' => 'dbg acl',
|
|
|
|
|
+ 'sql field name' => $this->getSqlFieldName($childName),
|
|
|
|
|
+ 'xsdType' => $this->getXsdFieldType($childName),
|
|
|
|
|
+ 'childSchema' => $childSchema,
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ if ('p5:enum' == $this->getXsdFieldType($childName)) {
|
|
|
|
|
+ if (!empty($this->_simpleSchema['root'][$childName]['@aliasFieldValues'])) {
|
|
|
|
|
+ $aliasConf = $this->_simpleSchema['root'][$childName]['@aliasFieldValues'];
|
|
|
|
|
+ $acl = Core_AclHelper::getAclByNamespace($aliasConf['namespace']);
|
|
|
|
|
+ $sqlFldName = DB::getPDO()->quote($acl->getSqlFieldName($aliasConf['childName']), PDO::PARAM_STR);
|
|
|
|
|
+ $sqlTblName = DB::getPDO()->quote($acl->getRootTableName(), PDO::PARAM_STR);
|
|
|
|
|
+ $sqlDbName = DB::getPDO()->quote(DB::getPDO()->getDatabaseName(), PDO::PARAM_STR);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $sqlFldName = DB::getPDO()->quote($this->getSqlFieldName($childName), PDO::PARAM_STR);
|
|
|
|
|
+ $sqlTblName = DB::getPDO()->quote($this->getRootTableName(), PDO::PARAM_STR);
|
|
|
|
|
+ $sqlDbName = DB::getPDO()->quote(DB::getPDO()->getDatabaseName(), PDO::PARAM_STR);
|
|
|
|
|
+ }
|
|
|
|
|
+ $optionsEnum = DB::getPDO()->fetchValue("
|
|
|
|
|
+ select COLUMN_TYPE
|
|
|
|
|
+ from information_schema.COLUMNS c
|
|
|
|
|
+ where c.COLUMN_NAME = {$sqlFldName}
|
|
|
|
|
+ and c.TABLE_SCHEMA = {$sqlDbName}
|
|
|
|
|
+ and c.TABLE_NAME = {$sqlTblName}
|
|
|
|
|
+ ");
|
|
|
|
|
+ if (!empty($optionsEnum)) {
|
|
|
|
|
+ $optionsEnum = substr($optionsEnum, strlen('enum'));
|
|
|
|
|
+ $optionsEnum = trim($optionsEnum, "()'");
|
|
|
|
|
+ DBG::log(['msg' => '$optionsEnum', '$optionsEnum' => $optionsEnum]);
|
|
|
|
|
+ return explode("','", $optionsEnum);
|
|
|
|
|
+ }
|
|
|
|
|
+ DBG::log(['msg' => 'Error empty options from enum field', '$optionsEnum' => $optionsEnum]);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|