forked from physje/funda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_openhuis.php
58 lines (46 loc) · 1.57 KB
/
check_openhuis.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
<?php
include_once(__DIR__.'/include/config.php');
include_once(__DIR__ .'/include/HTML_TopBottom.php');
$db = connect_db();
$Opdrachten = getZoekOpdrachten(1, '', true);
$block = array();
# Doorloop alle zoekopdrachten
foreach($Opdrachten as $OpdrachtID) {
# Alles initialiseren
$String = array();
$OpdrachtData = getOpdrachtData($OpdrachtID);
$OpdrachtURL = "http://partnerapi.funda.nl/feeds/Aanbod.svc/rss/?type=koop&zo=". getSearchString($OpdrachtData['url'], true) .'open-huis/';
$content = file_get_contents_retry($OpdrachtURL);
$Huizen = explode('<item>', $content);
array_shift($Huizen);
if(count($Huizen) > 0) {
$String[] = "<h1>". $OpdrachtData['naam'] ."</h1><br>";
$String[] = "(<a href='". $OpdrachtData['url'] .'open-huis/' ."'>funda.nl</a>; <a href='$OpdrachtURL'>RSS</a>)";
$String[] = "<ol>";
}
foreach($Huizen as $huis) {
$data = RSS2Array($huis);
$fundaID = $data['id'];
$String[] = "<li><a href='". $data['link'] ."'>". formatStreetAndNumber($fundaID) ."</a> (<a href='admin/edit.php?id=$fundaID'>$fundaID</a>)</li>";
if(!hasOpenHuis($fundaID)) {
toLog('info', $OpdrachtID, $fundaID, 'Open huis aangekondigd');
setOpenHuis($fundaID);
mark4Details($fundaID);
sendPushoverOpenHuis($fundaID, $OpdrachtID);
}
}
if(count($String) > 0) {
$String[] = '</ol>';
$block[] = implode("\n", $String);
}
}
echo $HTMLHeader;
echo "<tr>\n";
echo "<td width='50%' valign='top' align='center'>\n";
foreach($block as $key => $value) {
echo showBlock($value);
echo '<p>';
}
echo "</td>\n";
echo "</tr>\n";
echo $HTMLFooter;