public function index($permalink = null) { $event = self::load_event($permalink); $event_id = mysql_real_escape_string($event->id); $signups = EventSignup::find_all("event_signups.event_id = '{$event_id}' AND event_tickets.participant = true AND event_signups.paid = true AND event_signups.event_seat_id IS NULL"); $this->assign("signups", $signups); $this->assign("event", $event); $this->title = "{$event->name} Seating"; $this->render("event_seat/index.tpl"); }
public function event_signups($reload = false) { if ($reload or !$this->event_signups_cache) { $id = mysql_real_escape_string($this->id); $this->event_signups_cache = EventSignup::find_all("event_signups.user_id = '{$id}'", "events.startdate ASC"); } return $this->event_signups_cache; }
public function filtered_signups($filter = "all", $reload = false) { $id = mysql_real_escape_string($this->id); if ($filter == "all") { return $this->event_signups($reload); } elseif ($filter == "paid") { if ($reload or !$this->filtered_paid_signups_cache) { $this->filtered_paid_signups_cache = EventSignup::find_all("event_signups.event_ticket_id = '{$id}' AND event_signups.paid = true"); } return $this->filtered_paid_signups_cache; } elseif ($filter == "unpaid") { if ($reload or !$this->filtered_unpaid_signups_cache) { $this->filtered_unpaid_signups_cache = EventSignup::find_all("event_signups.event_ticket_id = '{$id}' AND event_signups.paid = false"); } return $this->filtered_unpaid_signups_cache; } }
public function edit() { $event = self::load_event(); if ($event->enddate <= time()) { Site::Flash("error", "It is not possible to change your seat"); Redirect("{$event->permalink}/seating"); } $seat = self::load_seat($event); if ($seat->event_signup->id) { Site::Flash("error", "The seat has already been chosen"); Redirect("{$seat->event->permalink}/seating/{$seat->seating_plan->permalink}"); } // Fetch signups $event_id = mysql_real_escape_string($event->id); $user_id = mysql_real_escape_string(Site::CurrentUser()->id); $signups = EventSignup::find_all("event_signups.event_id = '{$event_id}' AND (event_signups.user_id = '{$user_id}' OR event_signups.manager_id = '{$user_id}') AND event_signups.paid = true AND event_tickets.participant = true"); $total = count($signups); if ($total == 0) { Site::Flash("error", "You need to be a paid participant to choose your seat"); Redirect("{$seat->event->permalink}/seating/{$seat->seating_plan->permalink}"); } $eligible = array(); foreach ($signups as $signup) { if ($signup->event_seat_id && $event->lock_seating) { // A seat is assigned, and seating is locked - No continue; } if (!$signup->event_ticket->seating_group_id && !$seat->seating_group_id && !$seat->disabled) { // Seat is not disabled, there's no group on the ticket or the seat, so we're good $eligible[$signup->id] = $signup; continue; } if ($signup->event_ticket->seating_group_id && $seat->seating_group_id && $signup->event_ticket->seating_group_id == $seat->seating_group_id) { // Seat has a group, and it's the same as the ticket, this is good $eligible[$signup->id] = $signup; } } if (count($eligible) == 0) { if (count($signups) == 0) { Site::Flash("error", "You need to be a paid participant to choose your seat"); } else { Site::Flash('error', 'You have no bookings that can choose this seat'); } Redirect("{$seat->event->permalink}/seating/{$seat->seating_plan->permalink}"); } if (count($eligible) == 1) { $signup = current($eligible); $signup->event_seat_id = $seat->id; if ($signup->save()) { Site::Flash("notice", "You have chosen seat {$seat->label}"); //Email::send_event_checkin($signup); } else { Site::Flash('error', 'Unable to choose seat, please try again'); } Redirect("{$seat->event->permalink}/seating/{$seat->seating_plan->permalink}"); } // We have more than one eligible booking, we need the user to select which one if ($this->post) { $id = $this->postData('signup'); if (!$this->csrf) { Site::InstantFlash('error', 'Invalid form submission'); } elseif (!$id || !array_key_exists($id, $eligible)) { Site::InstantFlash('error', 'Please select a valid event booking'); } else { $eligible[$id]->event_seat_id = $seat->id; if ($eligible[$id]->save()) { Site::Flash('notice', "You have chosen seat {$seat->label}"); //Email::send_event_checkin($signup); Redirect("{$seat->event->permalink}/seating/{$seat->seating_plan->permalink}"); } else { Site::InstantFlash('error', 'Unable to choose seat, please try again'); } } } $this->assign("event", $event); $this->assign("seat", $seat); $this->assign("signups", $eligible); $this->title = "{$event->name} :: Seating Plan"; $this->render("event_seat/edit.tpl"); }
<?php require "init.php"; $script = Script::find_by_code("unpaid_emails"); $script->start(); ob_start(); $time = date("H:i:s"); echo "[{$time}] Forums\r\n\r\n"; $offset = 31; $lower = strtotime("-{$offset} days midnight"); $offset--; $upper = strtotime("-{$offset} days midnight"); $signups = EventSignup::find_all("\n\t\tevent_signups.paid = false\n\t\tAND event_signups.voucher = false\n\t\tAND event_signups.created_at BETWEEN FROM_UNIXTIME({$lower}) AND FROM_UNIXTIME({$upper})\n\t\tAND events.startdate > NOW()\n\t\tAND users.allow_emails = true\n\t\tAND users.suspended = false\n\t\tAND users.activated = true\n\t"); $users = array(); foreach ($signups as $signup) { if (!in_array($signup->user->id, $users)) { if ($signup->event_ticket->participant && $signup->event->count_participants("paid") < $signup->event->capacity) { $users[] = $signup->user->id; $script->addlog("Reminder sent to {$signup->user->email} ({$signup->user->nickname}) for [{$signup->id}]"); echo "Sending reminder to {$signup->user->email} ({$signup->user->nickname}) for signup {$signup->id}\n"; Email::send_signup_reminder($signup); } } } $script = Script::find_by_code("unpaid_emails"); $output = ob_get_contents(); $script->finish($output);
public function signups($reload = false) { if ($reload or !$this->signups_cache) { $id = mysql_real_escape_string($this->id); $this->signups_cache = EventSignup::find_all("event_signups.event_id = '{$id}'"); } return $this->signups_cache; }
public function intranet_index($permalink = null) { global $config; if (!in_array(Site::RemoteIP(), $config['intranet']['ips'])) { //throw new Error403(); } $event = self::load_event($permalink, true); if ($_GET['key'] == md5("winbarmint")) { $event_id = mysql_real_escape_string($event->id); $signups = EventSignup::find_all("event_signups.event_id = '{$event_id}' AND event_signups.paid = true AND event_signups.voucher = false", "users.id ASC"); $this->assign("signups", $signups); $this->assign("event", $event); header('Content-Type: text/xml'); $this->render("event_signup/intranet_index.tpl", true); } else { Error403(); } }