1: <?php
2:
3: namespace api;
4:
5: include_once "../../global.inc.php";
6: include_once PATH_DATABASE . "/PssSqlManager.php";
7: include_once PATH_UTILITTY . "/XmlManager.php";
8: include_once PATH_UTILITTY . "/ArrayManager.php";
9: require_once PATH_API . "/Api.php";
10:
11: /**
12: * This class provides some spezial PssAPI methods
13: * @author stubbfel
14: * @since 20.06.2013
15: */
16: class PssApi extends Api {
17:
18: /**
19: * Route string for the alias paramter
20: * @var string
21: */
22: public static $routeParameterPids = "/pid/:pid+";
23:
24: /**
25: * Route string for the iNames paramter
26: * @var string
27: */
28: public static $routeParameterSNames = "/sname/:sname+";
29:
30: /**
31: * Keyword for pidList arguments
32: * @var string
33: */
34: public static $keyPidList = "pidList";
35:
36: /**
37: * Keyword for iNameList arguments
38: * @var string
39: */
40: public static $keySNameList = "sNameList";
41:
42: /**
43: * max number of pid for each query
44: * @var int
45: */
46: private static $maxPid = 50;
47:
48: /**
49: * Constructor
50: * @param array[assoc] $headers - RequestHeader
51: */
52: public function __construct($headers = array()) {
53: $this->sqlManager = new \database\PssSqlManager();
54: parent::__construct($headers);
55: }
56:
57: /**
58: * Default-DeConstructor
59: */
60: public function __destruct() {
61: parent::__destruct();
62: }
63:
64: /**
65: * Method start a pis-query
66: * @param array $queryArgs
67: * @return query result as xml
68: */
69: public function sendPssQuery($queryArgs) {
70: $pidList = \utiliy\ArrayManager::removeEmptyItmes($queryArgs[self::$keyPidList]);
71:
72: if (array_key_exists(self::$keySNameList, $queryArgs)) {
73: $sNameList = \utiliy\ArrayManager::removeEmptyItmes($queryArgs[self::$keySNameList]);
74: } else {
75: $sNameList = array();
76: }
77:
78: if (count($pidList) < self::$maxPid) {
79: $result = $this->sqlManager->sendPssQuery($pidList, $sNameList);
80:
81: return $this->serialManager->arrayToPss($result);
82: }
83: return NULL;
84: }
85:
86: }
87:
88: ?>
89: