public function __construct() { parent::__construct('formEditEvent', 'Edit Event'); $event = $this->getEvent(); $isAdmin = Session::getUser()->hasPriv('MODERATE_EVENTS'); $isOwner = Session::getUser()->getData('organization') == $event['organizer']; if (!$isAdmin && !$isOwner) { throw new Exception('You do not have the privs for this.'); } else { if ($isAdmin) { $el = FormHelpers::getOrganizerList(true); $el->setValue($event['organizer']); $this->addElement($el); } } $this->addElement(Element::factory('hidden', 'id', 'event id', $event['id'])); $this->addElement(Element::factory('text', 'title', 'Title', $event['title'])); if ($isAdmin) { $this->addElement(FormHelpers::getVenueListElement(null, true)); } else { $this->addElement(FormHelpers::getVenueListElement(Session::getUser()->getData('organization'), true)); } $this->getElement('venue')->setValue($event['venue']); $this->addElement(Element::factory('text', 'dateStart', 'Start', $event['dateStart'])); $this->addElement(Element::factory('text', 'dateFinish', 'Finish', $event['dateFinish'])); $this->addScript('$("#formEditEvent-dateStart").datetime({"firstDay": 1 })'); $this->addScript('$("#formEditEvent-dateFinish").datetime({"firstDay": 2 })'); $this->addElement(Element::factory('numeric', 'priceOnDoor', 'Ticket price on the door', $event['priceOnDoor'])); $this->addElement(Element::factory('numeric', 'priceInAdv', 'Ticket price in advance', $event['priceInAdv'])); $this->addElement($this->getElementCurrency($event['currency'])); $this->addElement(Element::factory('text', 'website', 'Event website', $event['website'])); $this->addElement(Element::factory('checkbox', 'showers', 'Showers', $event['showers'])); $this->addElement($this->getElementSleeping($event['sleeping'])); $this->addElement(Element::factory('checkbox', 'alcohol', 'Bring your own alcohol?', $event['alcohol'])); $this->addElement(Element::factory('checkbox', 'smoking', 'Smoking area?', $event['smoking'])); $this->addElement(Element::factory('numeric', 'networkMbps', 'Network (mbps)', $event['networkMbps'])); $this->getElement('networkMbps')->addSuggestedValue('100', 'Old 100 meg network'); $this->getElement('networkMbps')->addSuggestedValue('1000', 'Shiny Gigabit network'); $this->addElement(Element::factory('numeric', 'internetMbps', 'Internet (mbps)', $event['internetMbps'], 'If you have an internet connection, what speed is it? Enter 0 for no connection.')); $this->getElement('internetMbps')->addSuggestedValue('0', 'No internet!'); $this->getElement('internetMbps')->addSuggestedValue('2', '2mbps'); $this->getElement('internetMbps')->addSuggestedValue('8', '8mbps'); $this->addElement(Element::factory('numeric', 'numberOfSeats', 'Number of seats', $event['numberOfSeats'])); $this->addElement(Element::factory('textarea', 'blurb', 'Additional blurb', htmlify($event['blurb']))); $this->addButtons(Form::BTN_SUBMIT); }
public function __construct() { parent::__construct('formEditVenue', 'Edit Venue'); $venue = $this->getVenue(); if (Session::getUser()->getData('organization') != $venue['organizer']) { Session::requirePriv('EDIT_VENUE'); } $this->addElement(Element::factory('hidden', 'id', null, $venue['id'])); $this->addElement(Element::factory('text', 'title', 'Title', $venue['title'])); $this->addElement(Element::factory('text', 'lat', 'Lat', $venue['lat'])); $this->getElement('lat')->setMinMaxLengths(1, 10); $this->addElement(Element::factory('text', 'lng', 'Lng', $venue['lng'])); $this->getElement('lng')->setMinMaxLengths(1, 10); $this->addElement(FormHelpers::getElementCountry($venue['country'])); $this->addElement(FormHelpers::getOrganizerList()); $this->getElement('organizer')->setValue($venue['organizer']); $this->addButtons(Form::BTN_SUBMIT); }
public function __construct() { parent::__construct('newVenue', 'New Venue'); $this->addElement(Element::factory('html', 'desc', null, 'A venue is a physical place where an event will be hosted, this may be a convention centre, a hall or just your house. You can specify detail such as sleeping arangements when the event is created.')); $this->addElement(Element::factory('text', 'title', 'Title', null, 'eg: Budleigh Salterton town hall, Cheltenham Racecourse, etc.')); $this->addElement(FormHelpers::getElementCountry('United Kingdom')); $this->addElement(Element::factory('html', 'locationDesc', null, '<br />The geodetic (WGS84) latitude/longitude of your venue. This can be awkward, but it allows us to put a pin on the map. We cannot use post/zip codes because many countries do not have them! <a href = "http://www.getlatlon.com/">http://getlatlong.com</a> will convert an address to a rough lat/lng. ')); $this->addElement(Element::factory('numeric', 'lat', 'Latitude'))->setAllowNegative(true); $this->addElement(Element::factory('numeric', 'lng', 'Longitude'))->setAllowNegative(true); if (Session::hasPriv('NEW_VENUE')) { $this->addElement(FormHelpers::getOrganizerList()); if (isset($_REQUEST['formNewVenue-organizer'])) { $this->getElement('organizer')->setValue($_REQUEST['formNewVenue-organizer']); } } $this->addButtons(Form::BTN_SUBMIT); $this->requireFields(array('title', 'lat', 'lng', 'country')); }
public function __construct() { parent::__construct('formEditUser', 'Edit User'); $user = $this->getUser(); $this->addElementReadOnly('Username', $user['username']); $this->addElement(Element::factory('text', 'email', 'Email Address', $user['email'])); $this->getElement('email')->setMinMaxLengths(0, 64); $this->addElement(Element::factory('text', 'usernameSteam', 'Steam Username', $user['usernameSteam'], 'Plaese do include your Steam username - its a good way for us to get in contact.')); $this->getElement('usernameSteam')->setMinMaxLengths(0, 64); $this->addElement(Element::factory('hidden', 'uid', null, $user['id'])); if (Session::hasPriv('EDIT_USER')) { $this->addElement(Element::factory('html', null, null, 'Admin fields')); $this->addElement($this->getGroupSelectionElement($user['group'])); $this->addElement(FormHelpers::getOrganizerList(true)); $this->getElement('organizer')->setValue($user['organization']); $this->addElement(Element::factory('password', 'password', 'New Password')); $this->getElement('password')->setOptional(true); } $this->addButtons(Form::BTN_SUBMIT); }
public function __construct() { parent::__construct('formNewEvent', 'New Event'); if (Session::getUser()->hasPriv('CREATE_EVENTS')) { $this->addElement(Element::factory('html', 'msg', null, 'Hi superuser.')); if (isset($_REQUEST['formNewEvent-organizer'])) { $organizerId = intval($_REQUEST['formNewEvent-organizer']); $this->addElement(Element::factory('hidden', 'organizer', 'Organizer', $organizerId)); $this->addElement(FormHelpers::getVenueListElement($organizerId)); } else { $this->addElement(FormHelpers::getOrganizerList(true)); $this->addElement(FormHelpers::getVenueListElement()); } } else { if (Session::getUser()->getData('organization')) { $organizer = fetchOrganizer(Session::getUser()->getData('organization')); if ($organizer['published']) { $this->addElement(Element::factory('html', 'msg', null, 'You are authorized to create public events for your organization.')); } else { $this->addElement(Element::factory('html', 'msg', null, 'Your event will be linked to your organization, but will not be public until your organization has been approved.')); } try { $this->addElement(FormHelpers::getVenueListElement(Session::getUser()->getData('organization'))); } catch (Exception $e) { redirect('account.php', 'Create a venue first!'); } } else { $this->addElement(Element::factory('html', 'msg', null, 'You can create events, but they will not appear in public lists until approved.')); } } $this->addElement(Element::factory('text', 'title', 'Title', null, 'eg: MyLan 2011')); $this->addElement(Element::factory('text', 'eventWebsite', 'Event specific URL', null, 'A URL to the event webpage on the organizer website would be useful.')); $this->getElement('eventWebsite')->setMinMaxLengths(0, 256); $this->addElement(Element::factory('text', 'dateStart', 'Start date')); $this->addElement(Element::factory('text', 'dateFinish', 'Finish date')); $this->addElement(Element::factory('html', 'protip', null, '<strong style = "text-decoration: blink; color: red;">Protip:</strong> You can edit this event and add much more detail after you have created it. ')); $this->addScript('$("#formNewEvent-dateStart").datetime({chainTo: "#formNewEvent-dateFinish", stepMins: 15, first: 3})'); $this->addButtons(Form::BTN_SUBMIT); $this->requireFields(array('title')); }