89 lines
2.1 KiB
PHP
89 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace api;
|
|
|
|
include_once "../../global.inc.php";
|
|
include_once PATH_DATABASE . "/PssSqlManager.php";
|
|
include_once PATH_UTILITTY . "/XmlManager.php";
|
|
include_once PATH_UTILITTY . "/ArrayManager.php";
|
|
require_once PATH_API . "/Api.php";
|
|
|
|
/**
|
|
* This class provides some spezial PssAPI methods
|
|
* @author stubbfel
|
|
* @since 20.06.2013
|
|
*/
|
|
class PssApi extends Api {
|
|
|
|
/**
|
|
* Route string for the alias paramter
|
|
* @var string
|
|
*/
|
|
public static $routeParameterPids = "/pid/:pid+";
|
|
|
|
/**
|
|
* Route string for the iNames paramter
|
|
* @var string
|
|
*/
|
|
public static $routeParameterSNames = "/sname/:sname+";
|
|
|
|
/**
|
|
* Keyword for pidList arguments
|
|
* @var string
|
|
*/
|
|
public static $keyPidList = "pidList";
|
|
|
|
/**
|
|
* Keyword for iNameList arguments
|
|
* @var string
|
|
*/
|
|
public static $keySNameList = "sNameList";
|
|
|
|
/**
|
|
* max number of pid for each query
|
|
* @var int
|
|
*/
|
|
private static $maxPid = 10;
|
|
|
|
/**
|
|
* Constructor
|
|
* @param array[assoc] $headers - RequestHeader
|
|
*/
|
|
public function __construct($headers = array()) {
|
|
$this->sqlManager = new \database\PssSqlManager();
|
|
parent::__construct($headers);
|
|
}
|
|
|
|
/**
|
|
* Default-DeConstructor
|
|
*/
|
|
public function __destruct() {
|
|
parent::__destruct();
|
|
}
|
|
|
|
/**
|
|
* Method start a pis-query
|
|
* @param array $queryArgs
|
|
* @return query result as xml
|
|
*/
|
|
public function sendPssQuery($queryArgs) {
|
|
$pidList = \utiliy\ArrayManager::removeEmptyItmes($queryArgs[self::$keyPidList]);
|
|
|
|
if (array_key_exists(self::$keySNameList, $queryArgs)) {
|
|
$sNameList = \utiliy\ArrayManager::removeEmptyItmes($queryArgs[self::$keySNameList]);
|
|
} else {
|
|
$sNameList = array();
|
|
}
|
|
|
|
if (count($pidList) < self::$maxPid) {
|
|
$result = $this->sqlManager->sendPssQuery($pidList, $sNameList);
|
|
|
|
return $this->serialManager->arrayToPss($result);
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
}
|
|
|
|
?>
|