protected function Form_Create() { parent::Form_Create(); $objShowcases = ShowcaseItem::LoadArrayByLiveFlag(true); $this->objShowcaseArray = array(); while (count($this->objShowcaseArray) < 14 && count($objShowcases)) { $intKeyArray = array_keys($objShowcases); $intRandomKey = $intKeyArray[rand(0, count($intKeyArray) - 1)]; $this->objShowcaseArray[] = $objShowcases[$intRandomKey]; unset($objShowcases[$intRandomKey]); } $this->btnNew = new RoundedLinkButton($this); $this->btnNew->Text = 'Submit a Project or Site'; $this->btnNew->AddAction(new QClickEvent(), new QAjaxAction('btnNew_Click')); $this->btnNew->AddAction(new QClickEvent(), new QTerminateAction()); $this->pxyItem = new QControlProxy($this); $this->pxyItem->AddAction(new QClickEvent(), new QAjaxAction('pxyItem_Click')); $this->pxyItem->AddAction(new QClickEvent(), new QTerminateAction()); if (ShowcaseItem::IsAdminableForPerson(QApplication::$Person)) { $this->btnAdmin = new RoundedLinkButton($this); $this->btnAdmin->Text = 'Administer Showcase Items'; $this->btnAdmin->LinkUrl = '/showcase/admin.php'; } $this->dlgBox = new QDialogBox($this); $this->dlgBox->MatteClickable = true; $this->dlgBox->HideDialogBox(); $this->btnClose = new QButton($this->dlgBox); $this->btnClose->AddAction(new QClickEvent(), new QHideDialogBox($this->dlgBox)); $this->txtName = new QTextBox($this->dlgBox); $this->txtName->Required = true; $this->txtDescription = new QTextBox($this->dlgBox); $this->txtDescription->TextMode = QTextMode::MultiLine; $this->txtUrl = new UrlTextBox($this->dlgBox); $this->txtUrl->Required = true; $this->flcImage = new QFileControl($this->dlgBox); $this->flcImage->Required = true; $this->btnOkay = new QButton($this->dlgBox); $this->btnOkay->CausesValidation = true; $this->btnOkay->AddAction(new QClickEvent(), new QServerAction('btnOkay_Click')); $this->btnCancel = new QLinkButton($this->dlgBox); $this->btnCancel->AddAction(new QClickEvent(), new QHideDialogBox($this->dlgBox)); $this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction()); }
<?php require '../../includes/prepend.inc.php'; if (!ShowcaseItem::IsAdminableForPerson(QApplication::$Person)) { QApplication::Redirect('/showcase/'); } class QcodoForm extends QcodoWebsiteForm { protected $strPageTitle = 'Showcase - Admin'; protected $intNavBarIndex = QApplication::NavAbout; protected $intSubNavIndex = QApplication::NavAboutShowcase; protected $dtgShowcaseItems; protected $pxyView; protected $pxyToggle; protected $lstLiveFlag; protected $objSelectedShowcase; protected $dlgBox; protected $btnClose; protected function Form_Create() { parent::Form_Create(); $this->dtgShowcaseItems = new ShowcaseItemDataGrid($this); $this->dtgShowcaseItems->Paginator = new QPaginator($this->dtgShowcaseItems); $this->dtgShowcaseItems->AlternateRowStyle->CssClass = 'alternate'; $this->dtgShowcaseItems->Noun = 'showcase item'; $this->dtgShowcaseItems->NounPlural = 'showcase items'; $this->dtgShowcaseItems->SetDataBinder('dtgShowcaseItems_Bind'); $this->dtgShowcaseItems->ItemsPerPage = 20; $this->dtgShowcaseItems->AddColumn(new QDataGridColumn('Actions', '<?= $_FORM->RenderActions($_ITEM); ?>', 'HtmlEntities=false', 'Width=100px', 'FontSize=10px')); $this->dtgShowcaseItems->MetaAddColumn('Name', 'Width=400px'); $this->dtgShowcaseItems->MetaAddColumn('Url', 'Width=285px');