private function getElementSignups($status)
 {
     $el = new ElementSelect('signups', 'Signups', $status);
     $el->addOption('off');
     $el->addOption('punters');
     $el->addOption('waitinglist');
     $el->addOption('staff');
     return $el;
 }
 private function getStatusElement($currentValue)
 {
     $el = new ElementSelect('status', 'Status', $currentValue);
     $el->addOption('ATTENDED');
     $el->addOption('CANCELLED');
     $el->addOption('SIGNEDUP');
     $el->addOption('STAFF');
     $el->addOption('CASH_IN_POST');
     $el->addOption('BACS_WAITING');
     $el->addOption('PAID');
     $el->addOption('WAITING_LIST - Used for when the event has run out of seats.', 'WAITING_LIST');
     $el->addOption('CONFIRMED - Can select seat even if not paid', 'CONFIRMED');
     $el->addOption('DELETE - Only delete testing singups. Dont delete cancellations!', 'DELETE');
     return $el;
 }
 private function getEventListElement()
 {
     $el = new ElementSelect('eventList', 'Event');
     foreach (Events::getAllUpcommingEvents() as $event) {
         $el->addOption($event['name'], $event['id']);
     }
     return $el;
 }
 private function getGroupSelection()
 {
     $el = new ElementSelect('selectedGroup', 'Group');
     foreach ($this->getAvailableGroups() as $group) {
         $el->addOption($group['title'], $group['id']);
     }
     return $el;
 }
 private function getElementImageDirectories()
 {
     $el = new ElementSelect('dir', 'Directory');
     if (Session::getUser()->hasPriv('UPLOAD_GALLERY_IMAGE')) {
         $sql = 'SELECT g.id, e.name, g.folderName, g.title FROM events e JOIN galleries g ON e.gallery = g.id ORDER BY e.date';
         $stmt = DatabaseFactory::getInstance()->prepare($sql);
         $stmt->execute();
         foreach ($stmt->fetchAll() as $gallery) {
             $this->directoryAliases['gallery' . $gallery['id']] = array('path' => 'resources/images/galleries/' . $gallery['folderName'], 'settings' => 'gallery');
             $el->addOption('Event: ' . $gallery['title'], 'gallery' . $gallery['id']);
         }
     }
     if (Session::getUser()->hasPriv('UPLOAD_SCHEDULE_ICON')) {
         $this->directoryAliases['schedule'] = array('path' => 'resources/icons/games/', 'settings' => 'schedule');
         $el->addOption('Schedule Icons', 'schedule');
     }
     return $el;
 }
 private function getElementSiteTheme($settingTheme)
 {
     $el = new ElementSelect('theme', 'Theme', $settingTheme);
     foreach (scandir('resources/themes/') as $theme) {
         if ($theme[0] == '.') {
             continue;
         }
         $el->addOption($theme);
     }
     return $el;
 }
 private function getElementUsername()
 {
     $el = new ElementSelect('username', 'Who did you give the money to?');
     $sql = 'SELECT a.id, u.username FROM finance_account_allocations al JOIN finance_accounts a ON al.account = a.id JOIN users u ON a.assigned_to = u.id ';
     $stmt = DatabaseFactory::getInstance()->prepare($sql);
     $stmt->execute();
     foreach ($stmt->fetchAll() as $account) {
         $el->addOption($account['username'], $account['id']);
     }
     return $el;
 }
 private function getVenueElement()
 {
     global $db;
     $el = new ElementSelect('venue', 'Venue', null, 'Where is it? ');
     $sql = 'SELECT id, name FROM venues';
     $result = $db->query($sql);
     foreach ($result->fetchAll() as $venue) {
         $el->addOption($venue['name'], $venue['id']);
     }
     return $el;
 }
 public function __construct()
 {
     parent::__construct('editGallery', 'Edit Gallery');
     $gallery = Galleries::getById(Sanitizer::getInstance()->filterUint('id'));
     $this->addElement(new ElementHidden('mode', null, 'edit'));
     $this->addElement(new ElementHidden('id', null, $gallery['id']));
     $this->addElement(new ElementInput('title', 'Title', $gallery['title']));
     $this->addElement(new ElementInput('folderName', 'Folder Name', $gallery['folderName']));
     $this->addElement(new ElementInput('coverImage', 'Cover Image', $gallery['coverImage'], 'The filename of the THUMBNAIL already in the gallery that will be the cover image.'));
     $this->addElement(new ElementNumeric('ordinal', 'Ordinal', $gallery['ordinal'], 'Used for organizing the gallery.'));
     $this->addElement(new ElementAlphaNumeric('description', 'Description', $gallery['description'], 'A description that is shown when people view the gallery.'));
     $this->getElement('description')->setPunctuationAllowed(true);
     $this->getElement('description')->setMinMaxLengths(0, 64);
     $elStatus = new ElementSelect('status', 'Status', $gallery['status']);
     $elStatus->addOption('Open');
     $elStatus->addOption('Closed');
     $elStatus->addOption('Staff');
     $this->addElement($elStatus);
     $this->addDefaultButtons();
 }
 public function getIconElement()
 {
     $el = new ElementSelect('icon', 'Icon');
     $contents = scandir('resources/images/icons/games/');
     foreach ($contents as $icon) {
         if ($icon[0] == '.') {
             continue;
         }
         $el->addOption($icon);
     }
     return $el;
 }
 public function __construct($events)
 {
     parent::__construct('payForFriend', 'Pay for friend');
     $eventsSel = new ElementSelect('event', 'Event');
     foreach ($events as $event) {
         $eventsSel->addOption($event['name'], $event['id']);
     }
     $this->addElement($eventsSel);
     $this->addElement(new ElementInput('username', 'Your friends username'));
     $this->addElement(new ElementHidden('action', null, 'add'));
     $this->addDefaultButtons('Add friends ticket to basket');
 }
 private function getPermissionElement()
 {
     global $db;
     $el = new ElementSelect('privileges', 'Privileges', null, 'The permission to grant to the group. If the group already has the permission it will not appear in the list.');
     $sql = 'SELECT `key`, id, description FROM permissions WHERE id NOT IN (SELECT gp.permission FROM privileges_g gp WHERE `group` = :groupId)';
     $stmt = $db->prepare($sql);
     $stmt->bindValue(':groupId', $this->getElementValue('id'));
     $stmt->execute();
     foreach ($stmt->fetchAll() as $priv) {
         $el->addOption($priv['key'] . (empty($priv['description']) ? null : ' - ' . $priv['description']), $priv['id']);
     }
     return $el;
 }
 private function addAccountAllocation($paymentType, $title)
 {
     $el = new ElementSelect($paymentType, $title);
     foreach ($this->availableAccounts as $account) {
         $el->addOption($account['title'], $account['id']);
     }
     if (isset($this->availableAccounts[$paymentType])) {
         $el->setValue($this->availableAccounts[$paymentType]['id']);
     } else {
         $el->setvalue(1);
     }
     $this->allocatedPaymentTypes[] = array('paymentType' => $paymentType);
     $this->addElement($el);
 }