public function createPresenters() { parent::createPresenters(); $table = new Table(Gallery::find()->addSort('Order'), 50, 'Table'); $this->addPresenters($table, $up = new Button('Up', 'Up', function ($id) { $gallery = new Gallery($id); if ($gallery->Order == null) { $gallery->Order = 0; } $gallery->Order--; $gallery->save(); }), $down = new Button('down', 'down', function ($id) { $gallery = new Gallery($id); if ($gallery->Order == null) { $gallery->Order = 0; } $gallery->Order++; $gallery->save(); }), $delete = new Button('delete', 'delete', function ($id) { $g = new Gallery($id); $g->delete(); })); $table->addTableCssClass(['table']); $table->NoDataHtml = '<h3 class="center-align">Oops! Nav galerijas</h3>'; $delete->addCssClassName('btn-danger'); $delete->setConfirmMessage('Vai jūs tiešam gribat dzēst šo galeriju?'); $table->Columns = ['Nosaukums' => 'Title', 'Indekss' => 'Order', '' => new FixedWidthColumn($up), ' ' => new FixedWidthColumn($down), ' ' => new FixedWidthColumn($delete)]; }
public function createPresenters() { parent::createPresenters(); $this->addPresenters(new TextBox($this->usernameColumnName), new Password("Password"), new Button("Login", "Login", function () { $this->raiseEvent("AttemptLogin"); })); }
protected function printViewContent() { parent::printViewContent(); $htmlPageSettings = new HtmlPageSettings(); $htmlPageSettings->PageTitle = "You're up and running!"; ?> <p>Add more URLs by configuring URL Handlers in the settings/app.config.php file</p> <?php }
protected function onBeforePrintViewContent() { parent::onBeforePrintViewContent(); $restModel = $this->raiseEvent("GetRestModel"); if (is_object($restModel)) { $pageSettings = new HtmlPageSettings(); if ($restModel instanceof Model) { if ($restModel->isNewRecord()) { $pageSettings->PageTitle = "Add a " . $restModel->getModelName(); } else { $pageSettings->PageTitle = "Editing " . $restModel->getModelName() . " '" . $restModel->getLabel() . "'"; } } elseif ($restModel instanceof Collection) { $pageSettings->PageTitle = StringTools::pluralise($restModel->getModelName(), 2); } } }