// SPDX-FileCopyrightText: 2021 Harald Eilertsen ';
$content.= 'Note: the iCal link will download a file with extension .ical which can be used to add the event to your calendar. For convenience, we set all events with start time at 19:00 but please check the actual event for the correct time.';
$content.= '
';
$content .= $this->render_pagination();
//from main form that includes filters
$content .= '';
$content.= ' ';
return $content;
}
private function get_args() : void
{
$this->filter = [];
// Use the submitted "city" if any. Otherwise, use the default/static value.
$cty = filter_input( INPUT_GET, 'city', FILTER_SANITIZE_SPECIAL_CHARS );
if ($cty) {
$this->filter['city'] = $cty;
}
$venue = filter_input( INPUT_GET, 'venue', FILTER_SANITIZE_SPECIAL_CHARS );
if ($venue) {
$this->filter['venue_id'] = $venue;
}
$smonth = filter_input( INPUT_GET, 'month', FILTER_SANITIZE_SPECIAL_CHARS );
if ($smonth) {
$this->filter['month'] = $smonth;
}
if(isset($_GET['only_mine']) && $_GET['only_mone'] == '1') {
$this->filter['currentuser'] = $this->username;
}
if (isset($_GET['page_no']) && $_GET['page_no'] != "" && is_numeric($_GET['page_no']) && isset($_GET['page_no']) == $this->page_no ) {
$this->page_no = intval($_GET['page_no']);
} else {
$this->page_no = 1;
}
}
private function get_concerts() : ?array
{
$total_records_per_page = 15;
$total_concerts = GiglogAdmin_Concert::count( $this->filter );
$this->total_no_of_pages = ceil( $total_concerts / $total_records_per_page );
//calculate OFFSET Value and SET other Variables
$offset = ($this->page_no - 1) * $total_records_per_page;
$this->previous_page = $this->page_no - 1;
$this->next_page = $this->page_no + 1;
if ($this->page_no > $this->total_no_of_pages ) {
$this->page_no = 1;
}
$this->filter['offset'] = $offset;
$this->filter['recperpage'] = $total_records_per_page;
return GiglogAdmin_Concert::find_concerts($this->filter);
}
private function get_filter(string $f) : ?string
{
return isset( $this->filter[$f] ) ? $this->filter[$f] : null;
}
private function render_pagination() : string
{
$content =
'CITY DATE NAME VENUE ';
if (!is_admin()) {
$content .= 'EVENT TICKETS Calendar ';
}
else {
$content .= 'PHOTO1 PHOTO2 TEXT1 TEXT2 STATUS ';
if (current_user_can('administrator')) {
$content .= 'AdminOptions ';
}
}
$content .= ' ';
$last_city = $concert->venue()->city();
}
$content .= '';
if ($last_city != $concert->venue()->city()) {
$content .= $concert->venue()->city();
}
$content .= ' ';
$content .=
"" . date( 'd.M.Y', strtotime( $concert->cdate() ) ) . " "
. "{$concert->cname()} "
. "{$concert->venue()->name()} ";
if( is_admin() ) {
$content .= '' . $this->mark_new_concert($concert) . ' ';
foreach ( [ 'photo1', 'photo2', 'rev1', 'rev2' ] as $role ) {
$content .= ''
. $this->assign_role_for_user_form( $role, $concert )
. ' ';
}
$content .= '' . self::STATUS_LABELS[$concert->status()] . ' ';
if (current_user_can('administrator')) {
$content .= "{$this->adminactions( $concert )} ";
}
}
else {
$content .= "eventlink()}\">Link ";
$content .= "tickets()}\">Tickets ";
}
$content .= ' iCal ';
$content .= '