Explorar el Código

added default_objects:SystemProcess

Piotr Labudda hace 9 años
padre
commit
d72ba8216d

+ 1 - 1
SE/se-lib/Core/AclHelper.php

@@ -195,7 +195,7 @@ class Core_AclHelper {// Helper class for Acl
     $aclList[] = 'default_objects:AccessOwner';
     $aclList[] = 'default_objects:SystemObject';// tabele i obiekty możliwe do podłączenia do procesu (default_db/*, default_objects/*)
     // $aclList[] = 'default_objects:UserObject';// TODO: tabele i obiekty widoczne dla aktualnego usera
-    // $aclList[] = 'default_objects:SystemProcess';// TODO: wszystkie proces init
+    $aclList[] = 'default_objects:SystemProcess';// TODO: wszystkie proces init
     // $aclList[] = 'default_objects:UserProcess';// TODO: proces init przypisane do aktualnego usera
     $aclList[] = 'default_objects:File';
     $aclList[] = 'default_objects:Korespondencja';

+ 3 - 1
SE/se-lib/Route/Storage.php

@@ -1407,7 +1407,9 @@ jQuery(document).on('p5UIBtnAjax:Storage:addBaseProces:ajaxLoaded', function(e,
 					function ($item) {
 						return [
 							'ns' => $item['namespace'],
-							'edit' => '<a href="index.php?_route=ViewTableAjax&namespace=' . $item['namespace'] . '">edit</a>'
+							'edit' => '<a href="index.php?_route=ViewTableAjax&namespace=' . $item['namespace'] . '">edit</a>',
+							'wfs Describe' => '<a href="wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&SRSNAME=EPSG:3003&REQUEST=DescribeFeatureType&TYPENAME=' . $item['typeName'] . '">DescribeFeatureType</a>',
+							'wfs getFeature' => '<a href="wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&SRSNAME=EPSG:3003&REQUEST=GetFeature&TYPENAME=' . $item['typeName'] . '&MAXFEATURES=10">GetFeature</a> (max:10)'
 						];
 					}
 					, $acl->getItems([

+ 15 - 12
SE/se-lib/Schema/SystemObjectStorageAcl.php

@@ -10,14 +10,15 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
       '@namespace' => 'default_objects/SystemObject',
       'ID' => [ '@type' => 'xsd:integer' ],
       'namespace' => [ '@type' => 'xsd:string' ],
+      'typeName' => [ '@type' => 'xsd:string' ],
       'tabela' => [ '@type' => 'xsd:string', '@alias' => 'DESC' ],
       'nazwa' => [ '@type' => 'xsd:string', '@alias' => 'DESC' ],
       'opis' => [ '@type' => 'xsd:string', '@alias' => 'OPIS' ],
       'id_zasob' => [ '@type' => 'xsd:integer' ],
-      'A_RECORD_CREATE_AUTHOR' => [ '@type' => 'xsd:string' ],
-      'A_RECORD_CREATE_DATE' => [ '@type' => 'xsd:date' ],
-      'A_RECORD_UPDATE_AUTHOR' => [ '@type' => 'xsd:string' ],
-      'A_RECORD_UPDATE_DATE' => [ '@type' => 'xsd:date' ],
+      'autor' => [ '@type' => 'xsd:string' , '@alias' => 'A_RECORD_CREATE_AUTHOR' ],
+      'utworzono' => [ '@type' => 'xsd:date' , '@alias' => 'A_RECORD_CREATE_DATE' ],
+      'zaktualizował' => [ '@type' => 'xsd:string' , '@alias' => 'A_RECORD_UPDATE_AUTHOR' ],
+      'zaktualizowano' => [ '@type' => 'xsd:date', '@alias' => 'A_RECORD_UPDATE_DATE' ]
     ]
   ];
   public $_rootTableName = 'CRM_LISTA_ZASOBOW';
@@ -74,6 +75,7 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
         array_map(
           function ($row) {
             $row['namespace'] = "default_db/{$row['tabela']}";
+            $row['typeName'] = "default_db:{$row['tabela']}";
             $row['ID'] = $this->_generateUniqueKeyFromNamespace($row['namespace']);
             return $row;
           }
@@ -82,10 +84,10 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
               , z.`DESC` as tabela
               , IF(z.`DESC_PL` != '', z.`DESC_PL`, z.`DESC`) as nazwa
               , z.`OPIS` as opis
-              , z.A_RECORD_CREATE_AUTHOR
-              , z.A_RECORD_CREATE_DATE
-              , z.A_RECORD_UPDATE_AUTHOR
-              , z.A_RECORD_UPDATE_DATE
+              , z.A_RECORD_CREATE_AUTHOR as `autor`
+              , z.A_RECORD_CREATE_DATE as `utworzono`
+              , z.A_RECORD_UPDATE_AUTHOR as `zaktualizował`
+              , z.A_RECORD_UPDATE_DATE as `zaktualizowano`
             from `CRM_LISTA_ZASOBOW` z
             where z.PARENT_ID = {$idMainDatabase}
               and z.`TYPE` = 'TABELA'
@@ -99,13 +101,14 @@ class Schema_SystemObjectStorageAcl extends Core_AclSimpleSchemaBase {
             return [
               'ID' => $this->_generateUniqueKeyFromNamespace($namespace),
               'namespace' => $namespace,
+              'typeName' => $typeName,
               'tabela' => '', // TODO: $acl->getRootTableName(),
               'nazwa' => substr($typeName, strrpos($typeName, ':') + 1),
               'opis' => '...',
-              'A_RECORD_CREATE_AUTHOR' => '',
-              'A_RECORD_CREATE_DATE' => '',
-              'A_RECORD_UPDATE_AUTHOR' => '',
-              'A_RECORD_UPDATE_DATE' => ''
+              'autor' => '',
+              'utworzono' => '',
+              'zaktualizował' => '',
+              'zaktualizowano' => ''
             ];
           }
           , Core_AclHelper::getAclList()

+ 85 - 0
SE/se-lib/Schema/SystemProcessStorageAcl.php

@@ -0,0 +1,85 @@
+<?php
+
+Lib::loadClass('Core_AclSimpleSchemaBase');
+Lib::loadClass('ParseOgcFilter');
+
+class Schema_SystemProcessStorageAcl extends Core_AclSimpleSchemaBase {
+
+  public $_simpleSchema = [
+    'root' => [
+      '@namespace' => 'default_objects/SystemProcess',
+      'ID' => [ '@type' => 'xsd:integer' ],
+      'nazwa' => [ '@type' => 'xsd:string', '@alias' => 'DESC' ],
+      'opis' => [ '@type' => 'xsd:string', '@alias' => 'OPIS' ],
+      'autor' => [ '@type' => 'xsd:string' , '@alias' => 'A_RECORD_CREATE_AUTHOR' ],
+      'utworzono' => [ '@type' => 'xsd:date' , '@alias' => 'A_RECORD_CREATE_DATE' ],
+      'zaktualizował' => [ '@type' => 'xsd:string' , '@alias' => 'A_RECORD_UPDATE_AUTHOR' ],
+      'zaktualizowano' => [ '@type' => 'xsd:date', '@alias' => 'A_RECORD_UPDATE_DATE' ]
+    ]
+  ];
+  public $_rootTableName = 'CRM_PROCES';
+
+  public function getTotal($params = []) {
+    $sqlWhereAnd = $this->_parseSqlWhere($params);
+    return DB::getPDO()->fetchValue("
+      select count(1) as total
+      from `CRM_PROCES` p
+      where p.`TYPE` = 'PROCES_INIT'
+        and p.`A_STATUS` not in('DELETED', 'OFF_HARD', 'OFF_SOFT')
+        {$sqlWhereAnd}
+    ");
+  }
+
+  public function _parseSqlWhere($params = []) {
+    $sqlWhereAnd = "";
+    // TODO: parse where/ogc, etc.
+    return $sqlWhereAnd;
+  }
+
+  public function getItems($params = []) {
+    $sqlOrderBy = "";
+    $sqlLimitOffset = "";
+    $sqlWhereAnd = $this->_parseSqlWhere($params);
+
+    $currSortCol = V::get('order_by', 'ID', $params);
+    $currSortFlip = strtolower(V::get('order_dir', 'desc', $params));
+    // TODO: validate $currSortCol is in field list
+    // TODO: validate $currSortFlip ('asc' or 'desc')
+
+    if ('nazwa' == $currSortCol) $currSortCol = 'DESC';// TODO: @see attribute '@alias' for field 'nazwa'
+    $aliasMap = array();
+    foreach ($this->_simpleSchema['root'] as $key => $field) {
+      if ('@' === substr($key, 0, 1)) continue;
+      $aliasMap[ $key ] = (!empty($field['@alias'])) ? $field['@alias'] : $key;
+    }
+    // TODO: if (!array_key_exists($currSortCol, $aliasMap)) throw new Exception("field name not allowed to sort");
+    $currSortCol = (array_key_exists($currSortCol, $aliasMap)) ? $aliasMap[$currSortCol] : null;
+
+    if (!empty($currSortCol) && ('asc' == $currSortFlip || 'desc' == $currSortFlip)) {
+      $sqlOrderBy = "order by p.`{$currSortCol}` {$currSortFlip}";
+    }
+
+    $limit = V::get('limit', 0, $params);
+    $limit = ($limit < 0) ? 0 : $limit;
+    $offset = V::get('limitstart', 0, $params);
+    $offset = ($offset < 0) ? 0 : $offset;
+    if ($limit > 0) $sqlLimitOffset = "limit {$limit} offset {$offset}";
+
+    return DB::getPDO()->fetchAllByKey("
+      select p.ID
+        , p.`DESC` as nazwa
+        , p.`OPIS` as opis
+        , p.A_RECORD_CREATE_AUTHOR as `autor`
+        , p.A_RECORD_CREATE_DATE as `utworzono`
+        , p.A_RECORD_UPDATE_AUTHOR as `zaktualizował`
+        , p.A_RECORD_UPDATE_DATE as `zaktualizowano`
+      from `CRM_PROCES` p
+      where p.`TYPE` = 'PROCES_INIT'
+        and p.`A_STATUS` not in('DELETED', 'OFF_HARD', 'OFF_SOFT')
+        {$sqlWhereAnd}
+      {$sqlOrderBy}
+      {$sqlLimitOffset}
+    ", 'ID');
+  }
+
+}