-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathTimeLine.php
152 lines (132 loc) · 6.35 KB
/
TimeLine.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
include_once(__DIR__.'/include/config.php');
include_once(__DIR__ .'/include/HTML_TopBottom.php');
$db = connect_db();
$minUserLevel = 1;
$cfgProgDir = 'auth/';
include($cfgProgDir. "secure.php");
echo $HTMLHeader;
if(isset($_POST['add'])) {
foreach($_POST['huis'] as $huis) {
echo addHouse2List($huis, $_POST['lijst']);
}
echo "Huizen verwerkt.";
} elseif(isset($_REQUEST['selectie'])) {
$groep = substr($_REQUEST['selectie'], 0, 1);
$id = substr($_REQUEST['selectie'], 1);
if($groep == 'Z') {
$opdrachtData = getOpdrachtData($id);
$Name = $opdrachtData['naam'];
$from = "$TableResultaat, $TableHuizen";
$where = "$TableResultaat.$ResultaatID = $TableHuizen.$HuizenID AND $TableResultaat.$ResultaatZoekID = $id";
} else {
$LijstData = getLijstData($id);
$Name = $LijstData['naam'];
$from = "$TableListResult, $TableHuizen";
$where = "$TableListResult.$ListResultHuis = $TableHuizen.$HuizenID AND $TableListResult.$ListResultList = $id";
}
$Huizen = null;
if($_POST['addHouses'] == '1') {
$showListAdd = true;
$Huizen = getLijstHuizen($_POST['chosenList']);
}
$sql = "SELECT min($TableHuizen.$HuizenStart) FROM $from WHERE $where";
$result = mysqli_query($db, $sql);
$row = mysqli_fetch_array($result);
$start_tijd = $row[0];
$sql = "SELECT max($TableHuizen.$HuizenEind) FROM $from WHERE $where";
$result = mysqli_query($db, $sql);
$row = mysqli_fetch_array($result);
$eind_tijd = $row[0];
$sql = "SELECT $TableHuizen.$HuizenOffline, $TableHuizen.$HuizenVerkocht, $TableHuizen.$HuizenAfmeld, $TableHuizen.$HuizenStart, $TableHuizen.$HuizenEind, $TableHuizen.$HuizenAdres, $TableHuizen.$HuizenID, $TableHuizen.$HuizenURL, ($TableHuizen.$HuizenEind - $TableHuizen.$HuizenStart) as tijdsduur FROM $from WHERE $where ORDER BY $TableHuizen.$HuizenAdres";
$result = mysqli_query($db, $sql);
$row = mysqli_fetch_array($result);
$fullWidth = $eind_tijd - $start_tijd;
echo "<form method='post' action='". $_SERVER['PHP_SELF']."'>\n";
if(isset($showListAdd) AND $showListAdd) echo "<input type='hidden' name='lijst' value='". $_POST['chosenList'] ."'>\n";
echo "<table width='100%' border=0>\n";
echo "<tr>\n";
echo " <td align='center'><h1>Tijdslijn '$Name'</h1></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td> </td>\n";
echo "</tr>\n";
echo "<tr><td>\n";
echo " <table width='100%' border=0><tr>\n";
echo " <td width='25%'> </td>\n";
echo " <td width='35%' align='left'>". date("d M y", $start_tijd) ."</td>\n";
echo " <td width='35%' align='right'>". date("d M y", $eind_tijd) ."</td>\n";
echo " <td width='5%' align='right'> </td>\n";
echo " </tr></table>\n";
echo "</td></tr>\n";
do {
$breedte_1 = round(70*($row[$HuizenStart] - $start_tijd)/$fullWidth);
$breedte_2 = round(70*($row[$HuizenEind] - $row[$HuizenStart])/$fullWidth);
if($row[$HuizenVerkocht] == '1') {
$breedte_3 = round(70*($row[$HuizenAfmeld] - $row[$HuizenEind])/$fullWidth);
} else {
$breedte_3 = 0;
}
$breedte_4 = 70 - $breedte_1 - $breedte_2 - $breedte_3;
$adres = convertToReadable(urldecode($row[$HuizenAdres]));
$relPrijzen = getFullPriceHistory($row[$HuizenID]);
$prijzen = $relPrijzen[0];
$percentageAll = 100-$relPrijzen[5];
if($row[$HuizenOffline] == '1') {
if($row[$HuizenVerkocht] != '1') {
$class = 'offline';
} else {
$class = 'offlineVerkocht';
}
} elseif($row[$HuizenVerkocht] == '1') {
$class = 'onlineVerkocht';
} else {
$class = 'online';
}
echo "<tr><td>\n";
echo " <table width='100%' border=0><tr>\n";
echo " <td width='25%'>";
if(isset($showListAdd) AND $showListAdd) echo " <input type='checkbox' name='huis[]' value='". $row[$HuizenID] ."'". (in_array($row[$HuizenID], $Huizen) ? ' checked' : '') .">";
echo "<a id='". $row[$HuizenID] ."'><a href='admin/HouseDetails.php?selectie=". $_REQUEST['selectie'] ."&id=". $row[$HuizenID] ."' target='_blank'><img src='images/details.gif' title='Toon opties voor $adres'></a> <a href='http://funda.nl/". $row[$HuizenID] ."' target='_blank' class='$class' title='Bezoek $adres op funda.nl'>$adres</a></td>\n";
if($breedte_1 != 0) { echo " <td width='". $breedte_1 ."%'> </td>\n"; }
echo " <td width='". $breedte_2 ."%' bgcolor='#FF6D6D' title='". getDoorlooptijd($row[$HuizenID]) ." in de verkoop. Van ". date("d-m-y", $row[$HuizenStart]) .' t/m '. date("d-m-y", $row[$HuizenEind]) ."'> </td>\n";
if($breedte_3 != 0) { echo " <td width='". $breedte_3 ."%' bgcolor='#FFA0A0'> </td>\n"; }
if($breedte_4 != 0) { echo " <td width='". $breedte_4 ."%'> </td>\n"; }
echo " <td width='5%' align='right'><a href='PrijsDaling.php?selectie=". $_REQUEST['selectie'] ."#". $row[$HuizenID] ."' title='Bekijk de prijsdaling van $adres\nVraagprijs ". formatPrice(getOrginelePrijs($row[$HuizenID])) ." | Gecorrigeerde prijs ". formatPrice(corrigeerPrice($row[$HuizenStart], getOrginelePrijs($row[$HuizenID]))) ."'>". number_format($percentageAll, 0) ."%</a></td>\n";
echo " </tr></table>\n";
echo "</td></tr>\n";
} while($row = mysqli_fetch_array($result));
if(isset($showListAdd) AND $showListAdd) {
echo "<tr>\n";
echo " <td colspan='$aantalCols'> </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan='$aantalCols' align='center'><input type='submit' name='add' value='Voeg toe'></td>\n";
echo "</tr>\n";
}
echo "</table>\n";
echo "</form>\n";
} else {
$HTML[] = "<form method='post' action='". $_SERVER['PHP_SELF'] ."'>";
$HTML[] = "<input type='hidden' name='addHouses' value='". (isset($_REQUEST['addHouses']) ? '1' : '0') ."'>";
$HTML[] = "<input type='hidden' name='chosenList' value='". (isset($_REQUEST['chosenList']) ? $_REQUEST['chosenList'] : '') ."'>";
$HTML[] = "<table>";
$HTML[] = "<tr>";
$HTML[] = " <td>Selectie</td>";
$HTML[] = " <td> </td>";
$HTML[] = " <td>". makeSelectionSelection(isset($_REQUEST['addHouses']), false) ."</td>";
$HTML[] = "</tr>";
$HTML[] = "<tr>";
$HTML[] = " <td colspan='3' align='center'><input type='submit' name='submit' value='Weergeven'></td>";
$HTML[] = "</tr>";
$HTML[] = "</table>";
$HTML[] = "</form>";
echo "<tr>\n";
echo "<td width='25%' valign='top' align='center'> </td>\n";
echo "<td width='50%' valign='top' align='center'>\n";
echo showBlock(implode("\n", $HTML));
echo "</td>\n";
echo "<td width='25%' valign='top' align='center'> </td>\n";
echo "</tr>\n";
}
echo $HTMLFooter;