public function create()
 {
     $event = new Event();
     if ($this->post) {
         $event->name = $this->PostData('name');
         $event->shortname = $this->PostData('shortname');
         $event->permalink = $this->PostData('permalink');
         $event->location = $this->PostData('location');
         $event->postcode = $this->PostData('postcode');
         $event->capacity = $this->PostData('capacity');
         $event->forum_id = $this->PostData('forum_id');
         $event->visible = $this->PostData('visible');
         $event->active = $this->PostData('active');
         $event->display_achievements = $this->PostData('display_achievements');
         $event->set_startdate($this->PostData('startdate'));
         $event->set_enddate($this->PostData('enddate'));
         $event->lock_seating = $this->PostData('lock_seating');
         $event->next = $this->PostData('next');
         $event->tournament_url = $this->PostData('tournament_url');
         $event->advertised = $this->PostData('advertised');
         if ($event->Save()) {
             Site::Flash("notice", "The event has been created");
             Redirect("admin/events");
         }
     }
     $this->assign("event", $event);
     $this->title = "New Event";
     $this->render("event/create.tpl");
 }
Example #2
0
function createBarn($eventId, $name)
{
    $event = new Event($eventId);
    if ($event->GetEvent() == null) {
        throw new Exception('Invalid event id.');
        exit;
    }
    $barn = R::dispense(BARN);
    $barn->name = $name;
    $id = R::store($barn);
    if ($event->AddBarn($barn) < 0) {
        throw new Exception('Could not add barn to event.');
        exit;
    }
    $event->Save();
    return $id;
}
function createDivision($eventId, $name)
{
    $event = new Event($eventId);
    if ($event->GetEvent() == null) {
        throw new Exception('Invalid event id.');
        exit;
    }
    $division = R::dispense(DIVISION);
    $division->name = $name;
    $id = R::store($division);
    if ($id <= 0) {
        throw new Exception('Could not store division.');
        exit;
    }
    if ($event->AddDivision($division) < 0) {
        throw new Exception('Could not add division to event.');
        exit;
    }
    $event->Save();
    return $id;
}