-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.php
111 lines (108 loc) · 3.35 KB
/
dashboard.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
<?php
include("functions.php");
$AV = new AV;
if(!$AV->userLoggedIn())
$AV->redirect("/");
if(isset($_POST['title'])
and isset($_POST['description'])
and isset($_POST['from'])
and isset($_POST['to'])
and isset($_POST['when'])) {
$title = $AV->escapeString($_POST['title']);
$description = $AV->escapeString($_POST['description']);
$from = $AV->escapeString($_POST['from']);
$to = Array(
'city' => $AV->escapeString($_POST['city']),
'country' => $AV->escapeString($_POST['country'])
);
$when = $AV->escapeString($_POST['when']);
$AV->currentUserInsertTrip($title, $description, $from, $to, $when);
$AV->redirect();
}
$AV->parseHTMLContent();
$AV->templateHeader("{lang['welcome-back']} {user['name']} {lang['on']} {{website_name}}", "", Array("profile"));
?>
<div class="dashboard_content">
<div class="row">
<div class="col-md-8">
<div class="row feed">
<div class="col-md-12">
<h2>{lang['latest-trips']}</h2>
</div>
<div class="col-md-12">
<div class="row trips">
<?php
$trips = $AV->getTrips();
if(!$trips):
?>
{lang['no-trips-to-show']}
<?php
else:
foreach($trips as $trip) {
$destination = Array($trip['city'], $trip['country']);
$destination = implode(", ", $destination);
print "
<div class=\"trip col-md-4\">
<a href=\"{{url}}/viaggi/{$trip['slug']}/\">
<div class=\"background\">
<div class=\"overlay\"></div>
<img src=\"" . $AV->getTripImage($trip['city'], $trip['country']) . ")\" />
</div>
<div class=\"info\">
<div class=\"title\">
{$trip['title']}
</div>
<br />
<div class=\"destination\">
{$destination}<br />
{$trip['formattedDate']}
</div>
</div>
</a>
</div>";
}
endif;
?>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="row feed">
<div class="col-md-12">
<div class="row">
<div class="col-md-12">
<h2>{lang['insert-a-trip']}</h2>
<br />
</div>
<div class="col-md-12">
<form id="insertTrip" action="<?php print $_SERVER['REQUEST_URI'] ?>" method="POST">
<div class="row">
<div class="col-md-12">
<input type="text" name="title" class="form-control input" placeholder="{lang['title']}" /><br />
<textarea name="description" class="form-control textarea" placeholder="{lang['description']}"></textarea><br />
</div>
<div class="col-md-12">
<input type="text" name="from" class="form-control input" id="gMapsAutocompleteFrom" placeholder="{lang['from']}" /><br />
</div>
<div class="col-md-12">
<input type="hidden" name="city">
<input type="hidden" name="country">
<input type="text" name="to" class="form-control input" id="gMapsAutocompleteTo" placeholder="{lang['to']}" /><br />
</div>
<div class="col-md-12">
<input type="text" name="when" class="form-control input" id="datePicker" placeholder="{lang['when']}" /><br />
</div>
<div class="col-md-12">
<button class="btn btn-primary btn-block">{lang['insert-trip']}</button><br />
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php $AV->templateFooter(); ?>