-
Notifications
You must be signed in to change notification settings - Fork 0
/
info.php
78 lines (73 loc) · 2.45 KB
/
info.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* @package fi.opengov.datacatalog
* @author The Midgard Project, http://www.midgard-project.org
* @copyright The Midgard Project, http://www.midgard-project.org
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
*/
/**
* fi.opengov.datacatalog dataset info dba
*
* @todo: docs
*
* @package fi.opengov.datacatalog
*/
class fi_opengov_datacatalog_info_dba extends __fi_opengov_datacatalog_info_dba
{
/**
* Finds and returns organization and license details
* @param integer id of the info
* @param string type can be organization, license, format
* @return array storing the title and URL of the organization or the license
*/
public function get_details($id = null, $type = '')
{
$details = array();
if ( $id
&& $type != '')
{
$organization = array();
$qb = fi_opengov_datacatalog_info_dba::new_query_builder();
$qb->add_constraint('id', '=', $id);
$qb->add_constraint('type', '=', $type);
$_res = $qb->execute();
/* make sure we return only 1 organization and license */
$details['title'] = $_res[0]->title;
$details['url'] = $_res[0]->url;
switch($type)
{
case 'organization':
$details['information'] = $_res[0]->get_parameter('fi.opengov.datacatalog', 'org_information');
$details['address'] = $_res[0]->get_parameter('fi.opengov.datacatalog', 'org_address');
$details['contact'] = $_res[0]->get_parameter('fi.opengov.datacatalog', 'org_contact');
break;
case 'license':
$details['type'] = $_res[0]->get_parameter('fi.opengov.datacatalog', 'license_type');
break;
}
unset($_res);
unset($qb);
}
return $details;
}
/**
* Finds and returns the info's guid
* @param integer id of the info
* @return string guid of the info object
*/
public function get_guid($id = null)
{
$guid = null;
if (isset($id))
{
$qb = fi_opengov_datacatalog_info_dba::new_query_builder();
$qb->add_constraint('id', '=', $id);
$_res = $qb->execute();
$guid = $_res[0]->guid;
unset($_res);
unset($qb);
}
return $guid;
}
}
?>