public function signup($nickname = null)
 {
     $user = $this->load_user($nickname);
     $signup = new EventSignup();
     if ($this->post) {
         $event_id = mysql_real_escape_string($_POST['event']);
         $event = Event::find_by_id($event_id);
         if (!$event) {
             Error404();
         }
         $signup->event_id = $event->id;
         $signup->user_id = $user->id;
         if (!isset($_POST['stage'])) {
             $signup->paid = $this->PostData('paid');
             $signup->lift_required = $this->PostData('lift_required');
             $signup->voucher = $this->PostData('voucher');
             $signup->voucher_code = $this->PostData('voucher_code');
             $ticket_id = mysql_real_escape_string($this->PostData('ticket'));
             $ticket = EventTicket::find("event_tickets.event_id = '{$event_id}' AND event_tickets.id = '{$ticket_id}'");
             if ($ticket) {
                 $signup->event_ticket_id = $ticket->id;
             }
             if ($signup->save()) {
                 Site::Flash('notice', "{$user->nickname} has been signed up to {$event->name}");
                 Redirect("admin/signups/{$signup->id}");
             }
         }
     }
     $tickets = array();
     foreach ($event->tickets() as $ticket) {
         $tickets[$ticket->id] = $ticket->name;
     }
     $this->assign("signup", $signup);
     $this->assign("user", $user);
     $this->assign("event", $event);
     $this->assign("tickets", $tickets);
     $this->title = "Event Signup";
     $this->render("user/signup.tpl");
 }
Exemple #2
0
		if (count($achievements) == 0) {
			$achievement = new UserAchievement();
			$achievement->user_id = $user->id;
			$achievement->achievement_id = 79;
			$achievement->category_id = 14;
			$achievement->save();
			echo "-> Awarding";
		} else {
			echo " -> Already awarded";
		}
		echo "\r\n<br />";
	}
}
*/
$user = User::find_by_id(4791);
$event = Event::find_by_id(33);
$ticket = EventTicket::find_by_id(179);
for ($i = 0; $i < 40; $i++) {
    $event_signup = new EventSignup();
    $event_signup->event_id = $event->id;
    $event_signup->user_id = $user->id;
    $event_signup->event_ticket_id = $ticket->id;
    $event_signup->event_ticket = $ticket;
    if ($i != 0) {
        $event_signup->voucher = true;
        $event_signup->voucher_code = md5(time() . $event->id . mt_rand(0, 99999999999));
        $event_signup->manager_id = $user->id;
    }
    $event_signup->paid = true;
    $event_signup->save();
}