-
Notifications
You must be signed in to change notification settings - Fork 0
/
class.locatie.php
89 lines (78 loc) · 2.48 KB
/
class.locatie.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
79
80
81
82
83
84
85
86
87
88
89
<?php
/*************************************
* @version 1.6
* @author Jaap Voets - Xperience Automatisering
* locaties opvragen
***********************************/
include_once("class.nbb.php");
class Locatie extends NBB {
var $dispatcher;
var $xml;
var $filter;
var $loc_ID;
function Locatie( $loc_ID = 0) {
/* constructor van de parent expliciet aanroepen */
parent::NBB( 0 );
$this->dispatcher = 'locaties.pl';
$this->data = '';
$this->filter = '';
$this->loc_ID = $loc_ID;
return true;
}
/* ophalen van xml en parsen */
function data() {
if (! $this->data ) {
$url = parent::base_url() . $this->dispatcher . '?';
$url .= $this->filter;
if ($this->loc_ID > 0 ) {
$url .= "&loc_ID=" . $this->loc_ID;
}
$xml_string = $this->get_xml( $url );
$data = $this->parse( $xml_string );
$this->data = $data;
}
return $this->data;
}
function overzicht() {
$data = $this->data();
foreach( $data->locatie as $loc ) {
$id = "" .$loc['id'];
$lijst[ $id ]['naam'] = "" . $loc->naam;
$lijst[ $id ]['adres'] = "" . $loc->adres;
$lijst[ $id ]['postcode'] = "" . $loc->postcode;
$lijst[ $id ]['plaats'] = "" . $loc->plaats;
$lijst[ $id ]['longitude'] = "" . $loc->longitude;
$lijst[ $id ]['latitude'] = "" . $loc->latitude;
}
return $lijst;
}
// get details of single location
function gegevens( $loc_ID = 0) {
if ($loc_ID == 0 ) {
$loc_ID = $this->loc_ID;
}
$lijst = $this->overzicht();
if (count($lijst) > 0) {
return $lijst[ $loc_ID ];
} else {
return array();
}
}
/* filter for a specific clb_ID as specified in the NBB database */
function clubid( $clb_ID = 0 ) {
$this->filter .= "&clb_ID=$clb_ID";
}
/* filter on particular season */
function seizoen( $seizoen = '' ) {
$this->filter .= "&szn_Naam=$seizoen";
}
/* filter on particular team */
function team( $plg_ID ) {
$this->filter .= "&plg_ID=$plg_ID";
}
/* filter for an organisation as specified in the NBB database */
function orgid( $org_ID = 0 ) {
$this->filter .= "&org_ID=$org_ID";
}
}
?>