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(); }
<?php require_once 'includes/widgets/header.php'; require_once 'includes/widgets/sidebar.php'; use libAllure\Sanitizer; use libAllure\Session; $gallery = Galleries::getById(Sanitizer::getInstance()->filterUint('id')); $files = $gallery->fetchImages(); try { $tpl->assign('event', Events::getByGalleryId($gallery['id'])); } catch (Exception $e) { $tpl->assign('event', null); } $tpl->assign('privViewUnpublished', Session::hasPriv('GALLERY_VIEW_UNPUBLISHED')); $tpl->assign('files', $files); $tpl->assign('gallery', $gallery); $tpl->display('viewGallery.tpl'); require_once 'includes/widgets/footer.php';