Exemplo n.º 1
0
 /**
  * @param Form $form
  */
 public function formSucceeded(Form $form)
 {
     $values = $form->getValues();
     /** @var PicturesEntity $pictures */
     $pictures = $this->picturesRepository->get($values->id);
     $pictures->name($values->name);
     $pictures->description($values->description);
     $pictures->file($values->file);
     $pictures->order($values->order);
     $pictures->galleryId($values->galleryId);
     $this->picturesRepository->save($pictures);
 }
Exemplo n.º 2
0
 /**
  * @param $name
  * @return Grid
  * @throws \Grido\Exception
  */
 protected function createComponentGridPictures($name)
 {
     $grid = new Grid($this, $name);
     $grid->translator->lang = 'cs';
     $fluent = $this->picturesRepository->getAllWhere(['galleryId' => $this->getParameter('id')]);
     $grid->model = $fluent;
     $grid->addColumnText('id', 'ID')->setSortable();
     $grid->getColumn('id')->headerPrototype->style['width'] = '1%';
     $grid->addColumnText('name', 'Název')->setSortable()->setFilterText();
     $grid->getColumn('name')->headerPrototype->style['width'] = '25%';
     $grid->addColumnText('file', 'Soubor')->setSortable()->setFilterText();
     $grid->getColumn('file')->headerPrototype->style['width'] = '40%';
     $grid->addActionHref('editPicture', '')->setIcon('pencil');
     $grid->addActionEvent('deletePicture', '')->setCustomRender(function ($item) {
         $i = Html::el('i', ['class' => 'fa fa-trash']);
         $el = Html::el('a', ['class' => 'btn btn-default btn-xs btn-mini ajax'])->href($this->presenter->link("deletePicture!", $item->id))->setHtml($i);
         return $el;
     });
     $grid->setDefaultPerPage(50);
     $grid->filterRenderType = $this->filterRenderType;
     $grid->setExport();
     return $grid;
 }