Overview

Namespaces

  • api
  • config
  • database
  • None
  • PHP
  • Slim
    • Exception
    • Http
    • Middleware
  • utiliy

Classes

  • Api
  • PisApi
  • PssApi
  • SpsApi
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: namespace api;
  4: 
  5: include_once "../../global.inc.php";
  6: include_once PATH_DATABASE . "/PisSqlManager.php";
  7: include_once PATH_UTILITTY . "/ArrayManager.php";
  8: require_once PATH_API . "/Api.php";
  9: 
 10: /**
 11:  * This class provides some spezial PisAPI methods
 12:  * @author stubbfel
 13:  * @since 20.06.2013
 14:  */
 15: class PisApi extends Api {
 16: 
 17:     /**
 18:      * Route string for the pids paramter
 19:      * @var string
 20:      */
 21:     public static $routeParameterPids = "/pid/:pid+";
 22:     
 23:         /**
 24:      * Route string for the parent paramter
 25:      * @var string
 26:      */
 27:     public static $routeParameterParent = "/parent/:parent";
 28: 
 29:     /**
 30:      * Route string for the iNames paramter
 31:      * @var string
 32:      */
 33:     public static $routeParameterINames = "/iname/:iname+";
 34: 
 35:     /**
 36:      * public string for the patter string parameter
 37:      * @var string
 38:      */
 39:     public static $routParameterIPatter = "ipatter/:ipatter";
 40: 
 41:     /**
 42:      * Keyword for pidList arguments
 43:      * @var string
 44:      */
 45:     public static $keyPidList = "pidList";
 46: 
 47:     /**
 48:      * Keyword for iNameList arguments
 49:      * @var string
 50:      */
 51:     public static $keyINameList = "iNameList";
 52: 
 53:     /**
 54:      * Keyword for iNameList arguments
 55:      * @var string
 56:      */
 57:     public static $keyIPatter = "searchPatter";
 58: 
 59:     /**
 60:      * Keyword for parendId arguments
 61:      * @var string
 62:      */
 63:     public static $keyParentId = "parendId";
 64: 
 65:     /**
 66:      * max number of pid for each query
 67:      * @var int
 68:      */
 69:     private static $maxPid = 50;
 70: 
 71:     /**
 72:      * Constructor
 73:      * @param array[assoc] $headers - RequestHeader
 74:      */
 75:     public function __construct($headers = array()) {
 76:         $this->sqlManager = new \database\PisSqlManager();
 77:         parent::__construct($headers);
 78:     }
 79: 
 80:     /**
 81:      * Default-DeConstructor
 82:      */
 83:     public function __destruct() {
 84:         parent::__destruct();
 85:     }
 86: 
 87:     /**
 88:      * Method start a pis-query
 89:      * @param array $queryArgs
 90:      * @return query result as xml
 91:      */
 92:     public function sendPisQuery($queryArgs) {
 93:         $pidList = \utiliy\ArrayManager::removeEmptyItmes($queryArgs[self::$keyPidList]);
 94: 
 95:         if (array_key_exists(self::$keyINameList, $queryArgs)) {
 96:             $iNameList = \utiliy\ArrayManager::removeEmptyItmes($queryArgs[self::$keyINameList]);
 97:         } else {
 98:             $iNameList = array();
 99:         }
100:         if (array_key_exists(self::$keyIPatter, $queryArgs)) {
101:             $iPatter = trim($queryArgs[self::$keyIPatter]);
102:         } else {
103:             $iPatter = "*";
104:         }
105: 
106:         if (array_key_exists(self::$keyParentId, $queryArgs)) {
107:             $parentId = trim($queryArgs[self::$keyParentId]);
108:         } else {
109:             $parentId = "*";
110:         }
111: 
112:         if (count($pidList) < self::$maxPid) {
113:             $result = $this->sqlManager->sendPisQuery($pidList, $parentId, $iNameList, $iPatter);
114: 
115:             return $this->serialManager->arrayToPis($result);
116:         }
117:         return NULL;
118:     }
119: 
120: }
121: 
122: ?>
123: 
GeoApi API documentation generated by ApiGen 2.8.0