示例#1
0
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->service->getFinder()->getGriditoModel());
     // columns
     $grid->addColumn("id", "ID")->setSortable(true);
     $grid->addColumn("name", "Název")->setSortable(true);
     $grid->addColumn("url", "URL")->setSortable(true);
     $grid->addColumn("description", "Popis")->setSortable(true);
     $grid->addColumn("allowed", "Samostatný")->setSortable(true);
     // buttons
     $presenter = $this;
     $service = $this->service;
     $grid->addButton("edit", "Upravit", array("icon" => "ui-icon-pencil", "link" => function ($page) use($presenter) {
         return $presenter->link("edit", array("id" => $page->id));
     }, "showText" => false));
     $grid->addButton("delete", "Smazat", array("icon" => "ui-icon-closethick", "handler" => function ($entity) use($service, $presenter) {
         $service->delete($entity);
         $presenter->flashMessage("Stránka byla úspěšně smazána.");
         $presenter->redirect("default");
     }, "confirmationQuestion" => function ($page) {
         return "Opravdu chcete smazat stránku '{$page->name}'?";
     }, "showText" => false));
     // toolbar
     $grid->addToolbarButton("new", "Nová stránka", array("icon" => "ui-icon-plusthick", "link" => $this->link("add")));
 }
示例#2
0
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->service->getFinder()->getGriditoModel());
     // columns
     $grid->addColumn("name", "Jméno")->setSortable(true);
     $grid->addColumn("surname", "Příjmení")->setSortable(true);
     $grid->addColumn("username", "Uživatelské jméno")->setSortable(true);
     $grid->addColumn("mail", "E-mail")->setSortable(true);
     // buttons
     $presenter = $this;
     $service = $this->service;
     $grid->addButton("edit", "Upravit", array("icon" => "ui-icon-pencil", "link" => function ($entity) use($presenter) {
         return $presenter->link("edit", array("id" => $entity->id));
     }));
     $grid->addButton("delete", "Smazat", array("icon" => "ui-icon-closethick", "handler" => function ($entity) use($service, $presenter) {
         $service->delete($entity);
         $presenter->flashMessage("Uživatel byl úspěšně smazán.");
         $presenter->redirect("default");
     }, "confirmationQuestion" => function ($entity) {
         return "Opravdu chcete smazat uživatele '{$entity->name}'?";
     }));
     // toolbar
     $grid->addToolbarButton("newuser", "Nový uživatel", array("icon" => "ui-icon-plusthick", "link" => $this->link("add")));
 }
示例#3
0
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->service->getFinder()->getGriditoModel());
     $grid->addColumn("name", "Název")->setSortable(true);
     $grid->addColumn("itemCount", "Počet článků")->setSortable(true);
     $presenter = $this;
     $grid->addButton("edit", "Upravit", array("icon" => "ui-icon-pencil", "link" => function ($entity) use($presenter) {
         return $presenter->link("edit", $entity->getId());
     }));
     $service = $this->service;
     $grid->addButton("delete", "Smazat", array("icon" => "ui-icon-closethick", "handler" => function ($entity) use($presenter, $service) {
         $service->delete($entity);
         $presenter->flashMessage("Tag byl smazán.");
         $presenter->redirect("this");
     }));
     $grid->addToolbarButton("add", "Přidat", array("icon" => "ui-icon-plusthick", "link" => $this->link("add")));
 }
示例#4
0
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->service->getFinder()->getGriditoModel());
     $grid->addColumn("insertKey", "Klíč")->setSortable(true);
     $presenter = $this;
     $grid->addButton("edit", "Upravit", array("icon" => "ui-icon-pencil", "link" => function ($entity) use($presenter) {
         return $presenter->link("edit", $entity->getId());
     }));
     $service = $this->service;
     $grid->addButton("delete", "Smazat", array("icon" => "ui-icon-closethick", "handler" => function ($entity) use($presenter, $service) {
         $service->delete($entity);
         $presenter->flashMessage("Výstřižek byl smazán");
         $presenter->redirect("this");
     }, "confirmationQuestion" => function ($entity) {
         return "Smazat výstřižek {$entity->insertKey}?";
     }));
     $grid->addToolbarButton("add", "Přidat", array("icon" => "ui-icon-plusthick", "link" => $this->link("add")));
 }
示例#5
0
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $gallery = $this->galleryService->find($this->getParam('id'));
     $model = $this->service->getFinder()->whereGallery($gallery)->orderByOrder()->getGriditoModel();
     $grid->setModel($model);
     // columns
     $template = $this->createTemplate()->setFile(__DIR__ . "/../templates/Photo/@thumb.phtml");
     $grid->addColumn("image", "Náhled")->setRenderer(function ($photo) use($template) {
         $template->image = $photo;
         $template->render();
     });
     $grid->addColumn("description", "Popis")->setSortable(true);
     $grid->addColumn('itemOrder', 'Pořadí')->setSortable(true);
     // buttons
     $presenter = $this;
     $grid->addToolbarButton("edit", "Upravit galerii", array("icon" => "ui-icon-pencil", "link" => $this->link("edit", $this->getParam("id"))));
     $grid->addToolbarButton("sort", "Řadit fotografie", array("icon" => "ui-icon-arrow-4", "link" => $this->link("sortPhotos", $this->getParam("id"))));
     $photoService = $this->service;
     $grid->addButton("editPhoto", "Upravit", array("icon" => "ui-icon-pencil", "link" => function ($entity) use($presenter) {
         return $presenter->link("editPhoto", $entity->getId());
     }));
     $grid->addButton("delete", "Smazat", array("handler" => function ($entity) use($photoService, $presenter, $grid) {
         $photoService->delete($entity);
         $galleryId = $entity->getGallery()->getId();
         $presenter->flashMessage("Fotografie byl úspěšně smazána.");
         $grid->redirect("this");
     }, "icon" => "ui-icon-closethick", "confirmationQuestion" => "Opravdu chcete smazat fotografii?"));
 }