This repository has been archived by the owner on Jul 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbookmyvenue_admin.php
214 lines (182 loc) · 6.35 KB
/
bookmyvenue_admin.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?php
// This is admin interface for book my venue.
// We are here to manage the requests.
include_once "header.php";
include_once "methods.php";
include_once "database.php";
include_once "tohtml.php";
include_once "check_access_permissions.php";
/* --------------------------------------------------------------------------*/
/**
* @Synopsis Geneate task table for bookmyvenue admin.
*
* @Returns
*/
/* ----------------------------------------------------------------------------*/
function bookmyVenueAdminTaskTable( )
{
$html = '<table class="tasks">
<tr>
<td>
Book using old interface <br />
<small>
You can browse all venues and see the pending requests and approved events.
</small>
</td>
<td>
<a href="bookmyvenue_browse.php">OLD BOOKING INTERFACE</a>
</td>
</tr>
</table>'
;
$html .= '<br>';
$html .= '<table class="tasks">
<tr>
<td>
<strong>Make sure you are logged-in using correct google account </strong>
</strong>
</td>
<td>
<a href="bookmyvenue_admin_synchronize_events_with_google_calendar.php">
<i class="fa fa-calendar fa-2x"></i> Synchronize public calendar </a>
</td>
</tr>
<tr>
<td>
Add/Update/Delete venues
</td>
<td>
<a href="bookmyvenue_admin_manages_venues.php"> Manage venues </a>
</td>
</tr>
<tr>
<td>Send emails manually (and generate documents)</td>
<td>
<i class="fa fa-share fa-2x"></i>
<a href="admin_acad_email_and_docs.php">Send emails
</td>
</tr>
<tr>
<td>Manage talks and seminars. </td>
<td>
<i class="fa fa-comments-o fa-2x"></i>
<a href="admin_acad_manages_talks.php">Manage talks/seminar
</td>
</tr>
<tr>
<td>Add or update speakers. </td>
<td>
<i class="fa fa-users fa-2x"></i>
<a href="admin_acad_manages_speakers.php">Manage speakers
</td>
</tr>
<tr>
<td>Block venues <br />
<small> Block venues on certain days/times. </small>
</td>
<td>
<i class="fa fa-ban fa-2x"></i>
<a href="bookmyvenue_admin_block_venues.php">Block venues</a>
</td>
</tr>
</table>' ;
return $html;
}
mustHaveAnyOfTheseRoles( array( 'BOOKMYVENUE_ADMIN' ) );
echo userHTML( );
echo bookmyVenueAdminTaskTable( );
echo '<h1> Pending requests </h1>';
$requests = getPendingRequestsGroupedByGID( );
if( count( $requests ) == 0 )
echo printInfo( "Cool! No request is pending for review" );
else
echo printInfo( "These requests needs your attention" );
$html = '<div style="font-size:small">';
$html .= '<table class="show_request">';
$tohide = 'last_modified_on,status,modified_by,timestamp,url,external_id,gid,rid';
foreach( $requests as $r )
{
// If request date has passed, ignore it.
if( strtotime( $r[ 'date' ] ) < strtotime( '-2 days' ) )
{
// TODO: Do not show requests which are more than 1 days old. Their status
// remains PENDING all the time. Dont know what to do such
// unapproved/expired requests.
continue;
}
$html .= '<form action="bookmyvenue_admin_request_review.php" method="post">';
$html .= '<tr><td>';
// Hide some buttons to send information to next page.
$html .= '<input type="hidden" name="gid" value="' . $r['gid'] . '" />';
$html .= '<input type="hidden" name="rid" value="' . $r['rid'] . '" />';
// If a request is coming from talk, use different background.
$color = 'white';
if( strpos( $r[ 'external_id'], 'talks.' ) !== false )
$color = 'yellow';
$html .= arrayToTableHTML( $r, 'events', $color, $tohide );
$html .= '</td>';
$html .= '<td style="background:white">
<button name="response" value="Review" title="Review request"> ' .
$symbReview . '</button> </td>';
$html .= '</tr>';
$html .= '</form>';
}
$html .= '</table>';
$html .= "</div>";
echo $html;
echo goBackToPageLink( "user.php", "Go back" );
?>
<h1>Upcoming (approved) events in next 4 weeks </h1>
<?php
// Let admin search.
echo '<form action="" method="post" accept-charset="utf-8">
<input name="query" value="" placeholder="Search using creator or title"></input>
<button type="submit" name="response" value="search">Search</button>
</form>';
if( __get__( $_POST, 'response', '' ) == 'search' )
{
$query = trim( $_POST[ 'query' ] );
if( trim( $query ) )
{
$day = dbDate( 'yesterday' );
$events = getTableEntries( 'events', 'date'
, "status='VALID' AND date >= '$day' AND
(created_by='$query' OR title LIKE '%$query%')"
);
}
else
$events = getEventsBeteen( 'today', '+2 week' );
}
else
$events = getEventsBeteen( 'today', '+2 week' );
if( count( $events ) > 0 )
{
$html = '<div style="font-size:small;">';
$event = $events[0];
$html .= "<table class=\"show_events\">";
$tofilter = 'eid,calendar_id,calendar_event_id' .
',external_id,gid,last_modified_on,status,url';
// Add extra field to create one last row.
$html .= arrayHeaderRow( $event, 'show_events', $tofilter );
foreach( $events as $event )
{
// Today's event if they are passed, don't display them.
if( $event[ 'date' ] == dbDate( 'today' ) && $event[ 'start_time'] < dbTime( 'now' ) )
continue;
$gid = $event['gid'];
$eid = $event['eid'];
$html .= "<tr><form method=\"post\" action=\"bookmyvenue_admin_edit.php\">";
$event[ 'edit' ] = "<td> <button title=\"Edit this entry\" name=\"response\"
value=\"edit\">" . $symbEdit . "</button></td>";
$html .= arrayToRowHTML( $event, 'events', $tofilter );
$html .= "<input name=\"gid\" type=\"hidden\" value=\"$gid\" />";
$html .= "<input name=\"eid\" type=\"hidden\" value=\"$eid\" />";
$html .= "</td></form>";
$html .= "</tr>";
}
$html .= "</table>";
$html .= "</div>";
echo $html;
}
echo goBackToPageLink( "user.php", "Go back" );
?>