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($table = new Table(CustomUser::find(new Equals('Enabled', true)), 25, 'UserTable'), $delete = new Button('Dzēst', 'Dzēst', function ($a) { try { $user = new CustomUser($a); $user->Enabled = false; $user->save(); } catch (RecordNotFoundException $ex) { } }), $edit = new Button('Mainīt', 'Mainīt', function ($a) { throw new ForceResponseException(new RedirectResponse('/users/' . $a . '/edit/')); })); $delete->addCssClassName('btn-danger'); $delete->setConfirmMessage('Vai jūs tiešam gribat dzēst šo lietotāju?'); $table->addTableCssClass(['table table-striped table-bordered']); $this->presenters['UserTable']->Columns = ['Lietotaja vārds' => 'Username', 'Vārds' => 'Forename', 'Uzvārds' => 'Surname', 'E - pasts' => 'Email', '' => new FixedWidthColumn($edit), ' ' => new FixedWidthColumn($delete)]; }
public function createPresenters() { parent::createPresenters(); $images = Image::find(new Equals('GalleryID', $this->getData('GalleryID')))->addSort('Order'); $this->addPresenters($table = new Table($images, 25, 'Images'), $delete = new Button('Dzēst', 'Dzēst', function ($id) { $image = new Image($id); $image->delete(); }), $down = new Button('down', 'Uz leju', function ($id) { $image = new Image($id); $image->Order++; $image->save(); }), $up = new Button('up', 'Uz augšu', function ($id) { $image = new Image($id); $image->Order--; $image->save(); })); $delete->setConfirmMessage('Vai jūs tiešam gribat dzēst šo lietotāju?'); $table->addTableCssClass(['table']); $table->Columns = ['Bilde' => '<img style="max-width: 250px;" src="{Thumbnail}">', 'Indekss' => 'Order', ' ' => new FixedWidthColumn($delete), '  ' => new FixedWidthColumn($up), '   ' => new FixedWidthColumn($down)]; }