1: <?php
2:
3: namespace webservices\details\annotations\feature;
4:
5: use \PDO as PDO;
6: 7: 8: 9:
10: class Pub extends \WebService {
11:
12: public function getById($param_feature_id) {
13:
14:
15: global $db;
16:
17: if (false)
18: $db = new PDO();
19:
20: $query_get_feature_pubs = <<<EOF
21: SELECT
22: p.*,
23: array_to_string((SELECT array_agg(Surname||', '||Givennames) FROM PubAuthor pa WHERE pa.pub_id = p.pub_id ),' and ') as author
24: FROM
25: Feature_Pub f
26: INNER JOIN Pub p ON (f.pub_id = p.pub_id)
27: WHERE
28: f.feature_id = :feature_id;
29: EOF;
30:
31: $stm_get_feature_pubs = $db->prepare($query_get_feature_pubs);
32: $stm_get_feature_pubs->bindParam('feature_id', $param_feature_id);
33:
34: $ret = array();
35:
36: $stm_get_feature_pubs->execute();
37: while ($pub = $stm_get_feature_pubs->fetch(PDO::FETCH_ASSOC)) {
38: $ret[$pub['pub_id']] = $pub;
39: }
40:
41: return $ret;
42: }
43:
44: 45: 46:
47: public function execute($querydata) {
48:
49: return $this->getById($querydata['query1']);
50: }
51:
52: }
53: ?>
54: