protected function createComponentGridCiselnikPodskupina($name)
 {
     $grid = new Grid($this, $name);
     $grid->translator->lang = 'sk';
     $grid->filterRenderType = Filter::RENDER_INNER;
     $grid->setModel($this->ciselnikSkupinaRepository->findAll());
     $grid->addColumnText('nazov', 'nazov');
     $grid->addActionHref('edit', 'Edituj');
     $grid->addActionHref('delete', 'Zmaz');
 }
Пример #2
0
 protected function createComponentPages()
 {
     $grid = new Grid();
     $grid->setModel($this->pages->findAll());
     $grid->addColumnText('name', 'Název stránky (Target/SEO)')->setSortable();
     $grid->addColumnText('heading', 'Nadpis')->setSortable();
     $grid->addColumnText('hidden', 'Útržek')->setSortable();
     $grid->addActionHref('editor', 'Upravit')->setIcon('pencil');
     $grid->addActionHref('remove', 'Smazat', 'delete!')->setConfirm("Opravdu chcete smazat tuto stránku?")->setIcon('trash');
     return $grid;
 }
Пример #3
0
 protected function createComponentGridUle($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->ul->findAll());
     $grid->addColumnText('nazov', 'Názov úľa');
     $grid->addColumnText('idCiselnikTypUla', 'typ ula')->setColumn(function ($item) {
         return $item->ciselnikTypUla->nazov;
     });
     $grid->addActionHref('detail', 'Detail');
     $grid->addActionHref('delete', 'Zmaz');
 }
Пример #4
0
 protected function createComponentOsobaGrid($name)
 {
     $grid = new Grido\Grid($this, $name);
     $grid->setModel($this->database->table('osoba'));
     $grid->addColumnText('priezvisko', 'Priezvisko')->setFilterText();
     $grid->addColumnText('meno', 'Meno');
     $grid->addColumnText('cisloCrv', 'CRV');
     $grid->addColumnText('vcelstvaJar', 'Pocet jar');
     $grid->addColumnText('vcelstvaJesen', 'pocet jesen');
     $grid->addActionHref('edit', 'Edituj')->setIcon('pencil');
     $grid->addActionHref('delete', 'Zmaž')->setIcon('trash');
 }
Пример #5
0
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->groupModel->findAll());
     $grid->addColumnText('name', 'Názov')->setSortable()->setFilterText();
     $grid->addColumnText('desc', 'Popis')->setSortable()->setFilterText();
     $grid->addColumnNumber('pocet', 'Počet ľudí')->setSortable();
     $grid->filterRenderType = $this->filterRenderType;
     $grid->addActionHref('join', 'Pridať sa')->setIcon('plus');
     $grid->addActionHref('leave', 'Odísť')->setIcon('minus')->setConfirm(function ($item) {
         return "Are you sure you want to delete {$item->name}";
     });
     $grid->addActionHref('listUsers', 'Zoznam účastníkov')->setIcon('list');
 }
Пример #6
0
 protected function createComponentUserList()
 {
     $grid = new Grid();
     $grid->setModel($this->users->getUsers());
     $grid->addColumnDate('registered', 'Registrován')->setSortable()->setFilterDateRange();
     $grid->addColumnText('username', 'Uživatelské jméno')->setSortable()->setFilterText()->setSuggestion();
     $grid->addColumnText('realname', 'Skutečné jméno')->setSortable()->setFilterText()->setSuggestion();
     $grid->addColumnMail('email', 'Email')->setSortable()->setFilterText()->setSuggestion();
     $roles = ['' => 'Vše'] + $this->perms->getRoles();
     $grid->addColumnText('role', 'Role')->setSortable()->setFilterSelect($roles);
     $grid->addColumnText('auth_service', 'Aut. služba')->setSortable()->setFilterSelect(['' => 'Vše', 'twitter' => 'Twitter', 'songator' => 'Songator']);
     $grid->addActionHref('editor', 'Upravit')->setIcon('pencil');
     $grid->addActionHref('selete', 'Smazat', 'delete!')->setConfirm('Opravdu smazat tohoto uživatele?')->setIcon('trash');
     return $grid;
 }
Пример #7
0
 protected function createComponentGridUle($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->ul->findAll()->where('idVcelnica', $this->getParameter('id')));
     $grid->addColumnText('nazov', 'Názov ula');
     $grid->addActionHref('detail', 'Detail', 'Ul:detail');
 }
 /**
  * Builds listing grid
  *
  * @param string|null $name
  * @return Grid
  * @throws \Grido\Exception
  */
 public function createComponentDataGrid($name = NULL)
 {
     $data = $this->generateDataForGrid();
     $dataGrid = new Grid($this, $name);
     $dataGrid->setRowCallback(function ($row, $tr) {
         /** @var Nette\Utils\Html $tr */
         if (empty($row['translation'])) {
             $tr->attrs['class'][] = 'untranslated';
         }
         return $tr;
     });
     $dataGrid->setFilterRenderType(Filter::RENDER_INNER);
     $dataGrid->setModel(new ArraySource($data));
     $dataGrid->addActionHref('remove', 'Remove', 'remove');
     $dataGrid->setDefaultSort(array('translation' => 'ASC'));
     // Columns
     $catalogueColumn = $dataGrid->addColumnText('catalogue', 'Catalogue');
     $catalogueColumn->setCustomRender(function ($values) {
         return ucfirst($values['catalogue']);
     });
     $catalogueColumn->setFilterSelect($this->getCataloguesInModel($data));
     $catalogueColumn->setSortable();
     $dataGrid->addColumnText('id', 'Code')->setSortable()->setFilterText();
     $translationColumn = $dataGrid->addColumnText('translation', 'Translation');
     $translationColumn->setFilterText();
     $translationColumn->setCustomRender(function ($values) {
         $el = Nette\Utils\Html::el('textarea');
         $el->addAttributes(array('type' => 'text', 'class' => 'text', 'rows' => 1, 'data-translation-control-change-url' => $this->link('saveTranslation!', array('catalogue' => $values['catalogue'], 'code' => $values['id'], 'language' => $this->locale))));
         $el->add(str_replace('|', "|\n", $values['translation']));
         return $el;
     });
     return $dataGrid;
 }
Пример #9
0
 public function createComponentUserEventsGrid($name)
 {
     $eventTypes = [null => null] + EventType::getOptions();
     $partyTypes = [null => null] + EventParticipationType::getOptions();
     $grid = new Grid($this, $name);
     $grid->setModel($this->eventService->getUserEventsDataSource($this->getUser()->getIdentity()));
     $grid->setPrimaryKey("id");
     $grid->setTranslator($this->getTranslator());
     $grid->addColumnText('title', 'eventsModule.grid.title')->setCustomRender($this->titleRender)->setTruncate(20)->setSortable()->setFilterText();
     $headerTitle = $grid->getColumn('title')->headerPrototype;
     $headerTitle->class[] = 'center';
     $headerTitle->style["width"] = "20%";
     $grid->addColumnText('eventType', "eventsModule.grid.type")->setCustomRender($this->typeRender)->setSortable()->setFilterSelect($eventTypes);
     $headerType = $grid->getColumn('eventType')->headerPrototype;
     $headerType->class[] = 'center';
     $grid->addColumnDate('takePlaceSince', 'eventsModule.grid.takeSince', self::DATETIME_FORMAT)->setCustomRender($this->sinceRender)->setSortable();
     $headerSince = $grid->getColumn('takePlaceSince')->headerPrototype;
     $headerSince->class[] = 'center';
     $grid->addColumnDate('takePlaceTill', 'eventsModule.grid.takeTill', self::DATETIME_FORMAT)->setCustomRender($this->tillRender)->setSortable();
     $headerTill = $grid->getColumn('takePlaceTill')->headerPrototype;
     $headerTill->class[] = 'center';
     $grid->addColumnText("type", "eventsModule.participation.type")->setCustomRender($this->partyTypeRender)->setSortable()->setFilterSelect($partyTypes);
     $headerPart = $grid->getColumn('type')->headerPrototype;
     $headerPart->class[] = 'center';
     $grid->addActionHref("goto", "", "goToEvent")->setIcon("eye-open")->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("eventsModule.grid.view")]));
     $grid->setFilterRenderType($this->filterRenderType);
     return $grid;
 }
Пример #10
0
 public function create()
 {
     $grid = new Grid();
     $grid->model = $this->clientFacade->createDSDoctrine();
     $grid->addColumnText('name', 'Name')->setCustomRender(function ($item) {
         $href = $this->linkGenerator->link('Backend:Clients:update', array('id' => $item->id));
         return "<a href ='" . $href . "'>" . $item->name . "</a>";
         /* $el = Html::el('a');
            // $item represents whole row. So you can get here any filed you want.
            $el->setText($item->name);
            $el->addAttributes(array('target'=>"_blank"));
            $el->href = $this->linkGenerator->link(
                'Backend:Clients:product',    // this is how you can generate any link MODULE_NAME:PRESENTER_NAME:ACTION_NAME
                array(
                    // here is a place for path parameters. FE: here you are expecting /admin/<presenter>/<action>[/<id>]
                    // id is a parameter we can set here. FYI [/<id>] means that id is not required parameter, it can be NULL.
                    'id' => $item->id
                )
            );
            return $el;*/
     })->setSortable()->setFilterNumber();
     $grid->addColumnText('product', 'Product')->setCustomRender(function ($item) {
         return $item->product->name;
     })->setSortable()->setFilterText()->setSuggestion();
     $grid->addColumnText('address', 'Address')->setSortable()->setFilterText()->setSuggestion();
     $grid->addActionHref('update', 'Update')->setIcon('pencil');
     $grid->addActionEvent('delete', 'Delete', function ($item) {
         $this->clientFacade->delete($item);
     })->setIcon('trash-o')->setConfirm(function ($item) {
         return "Are you sure you want to delete {$item->name}?";
     });
     return $grid;
 }
Пример #11
0
 protected function setupGrid(Grid $grid)
 {
     $grid->addColumnText('name', 'Name')->setSortable()->setFilterText()->setSuggestion();
     $grid->addColumnText('content', 'Content')->setCustomRender($this->renderContent)->setSortable()->setFilterText();
     $grid->addColumnBoolean('active', 'Active')->setSortable()->setFilterSelect(['' => '', 1 => 'Yes', 0 => 'No']);
     $grid->addActionHref('update', 'Update')->setIcon('pencil');
     $grid->addActionEvent('delete', 'Delete', $this->delete)->setIcon('trash-o')->setConfirm(function ($item) {
         return "Are you sure you want to delete {$item->name}?";
     });
 }
Пример #12
0
 protected function setupGrid(Grid $grid)
 {
     $grid->addColumnText('name', 'Name')->setSortable()->setFilterText()->setSuggestion();
     $grid->addColumnEmail('email', 'Email')->setSortable()->setFilterText()->setSuggestion();
     $grid->addColumnText('role', 'Role')->setSortable()->setFilterText()->setSuggestion();
     $grid->addActionHref('update', 'Update')->setIcon('pencil');
     $grid->addActionEvent('delete', 'Delete', $this->delete)->setIcon('trash-o')->setConfirm(function ($item) {
         return "Are you sure you want to delete {$item->name}?";
     });
 }
Пример #13
0
 protected function createComponentInterpretList($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->interpreti->findAll());
     $grid->addColumnText("nazev", "Interpret")->setCustomRender(function ($item) {
         return !$item->interpret_id ? Html::el('b')->setText($item->nazev) : $item->nazev;
     })->setSortable()->setFilterText()->setSuggestion();
     $grid->addColumnText("alias", "Alias pro")->setColumn(function ($item) {
         return isset($item->interpret->nazev) ? $item->interpret->nazev : null;
     });
     $grid->addFilterCheck('interpret_id', 'Jen aliasy');
     $grid->addColumnText("desc", "Popis")->setCustomRender(function ($item) {
         return Strings::truncate($item->desc, 256);
     });
     $grid->addActionHref('edit', 'Editovat', 'editor')->setIcon('pencil');
     $grid->addActionHref('delete', 'Smazat', 'delete!')->setIcon('trash')->setConfirm('Opravdu chcete smazat tohoto interpreta?');
     //Set face for grid
     $gridTemplate = __DIR__ . "/../templates/components/Grid.latte";
     if (file_exists($gridTemplate)) {
         $grid->setTemplateFile($gridTemplate);
     }
     return $grid;
 }
Пример #14
0
 protected function createComponentGrid($name)
 {
     $grid = new Grid();
     $grid->setModel($this->userModel->findAll());
     $grid->setPrimaryKey('id');
     $grid->addColumnText('username', 'Používateľ')->setSortable()->setFilterText();
     $grid->addColumnText('email', 'E-mail')->setSortable()->setFilterText();
     $grid->addColumnDate('last_login', 'Posledné prihlásenie')->setSortable()->setFilterDate();
     $grid->filterRenderType = $this->filterRenderType;
     $grid->addActionHref('remove', 'Odstrániť užívateľa')->setIcon('minus')->setConfirm(function ($item) {
         return "Ste si istý, že chcete odstrániť užívateľa {$item->username}";
     });
     return $grid;
 }
Пример #15
0
 protected function createComponentGridHorninaObrazok($name)
 {
     $grid = new Grid($this, $name);
     $grid->translator->lang = 'sk';
     $grid->filterRenderType = Filter::RENDER_INNER;
     $grid->setModel($this->horninaObrazokRepository->findAll());
     $grid->addColumnText('nazov', 'nazov');
     $grid->addColumnText('popis', 'popis');
     $grid->addColumnText('nazovSuboru', 'Subor');
     $grid->addColumnText('idHornina', 'Hornina')->setColumn(function ($item) {
         return $item->hornina->nazov;
     });
     $grid->addActionHref('delete', 'Zmaz');
 }
Пример #16
0
 protected function createComponentGridHornina($name)
 {
     $grid = new Grid($this, $name);
     $grid->translator->lang = 'sk';
     $grid->filterRenderType = Filter::RENDER_INNER;
     $grid->setModel($this->horninaRepository->findAll());
     $grid->addColumnText('nazov', 'nazov');
     $grid->addColumnText('idCiselnikSkupina', 'Skupina')->setColumn(function ($item) {
         return $item->ciselnikSkupina->nazov;
     });
     $grid->addColumnText('idCiselnikFarba', 'Farba')->setColumn(function ($item) {
         return $item->ciselnikFarba->nazov;
     });
     $grid->addColumnText('idCiselnikPodskupina', 'Podskupina')->setColumn(function ($item) {
         return $item->ciselnikPodskupina->nazov;
     });
     $grid->addActionHref('edit', 'Detail');
 }
Пример #17
0
 public function createComponentWebProfilesPermitGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->userService->getWebProfilesToPermitDatasource());
     $grid->setTranslator($this->getTranslator());
     $grid->setDefaultPerPage(30);
     $grid->setPrimaryKey('id');
     $grid->addColumnNumber('id', '#')->cellPrototype->class[] = 'center';
     $headerId = $grid->getColumn('id')->headerPrototype;
     $headerId->class[] = 'center';
     $headerId->rowspan = "2";
     $headerId->style['width'] = '0.1%';
     $grid->addColumnText("personalLikes", "usersModule.admin.wpGrid.content.label")->setTruncate(100)->setCustomRender($this->wpDataRender)->cellPrototype->class[] = 'center';
     $headerData = $grid->getColumn('personalLikes')->headerPrototype;
     $headerData->class[] = 'center';
     $headerData->style['width'] = '70%';
     $grid->addColumnText("personalDisLikes", "usersModule.admin.wpGrid.photo.label")->setCustomRender($this->wpPhotoRender)->cellPrototype->class[] = 'center';
     $headerPhoto = $grid->getColumn('personalDisLikes')->headerPrototype;
     $headerPhoto->class[] = 'center';
     $headerPhoto->style['width'] = '8%';
     $y = $this->tt("system.common.yes");
     $n = $this->tt("system.common.no");
     $activeList = [null => null] + [true => $y, false => $n];
     $grid->addColumnText('publish', $this->tt("systemModule.admin.grid.active"))->setSortable()->setReplacement([true => $y, null => $n])->setFilterSelect($activeList);
     $headerAct = $grid->getColumn('publish')->headerPrototype;
     $headerAct->class[] = 'center';
     $headerAct->style['width'] = '0.1%';
     $grid->addActionHref('yes', '', "permitProfile!")->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("usersModule.admin.grid.permitProfile")]))->setIcon('ok')->setConfirm(function ($u) {
         return $this->tt("usersModule.admin.wpGrid.reallyPermitItem", null, ["id" => $u->getId()]);
     });
     $grid->addActionHref('no', '', "denyProfile!")->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("usersModule.admin.grid.denyProfile")]))->setIcon('remove')->setConfirm(function ($u) {
         return $this->tt("usersModule.admin.wpGrid.reallyDenyItem", null, ["id" => $u->getId()]);
     });
     $operation = array('yes' => 'Permit', 'no' => 'Deny');
     $grid->setOperation($operation, $this->wppGridOperationsHandler)->setConfirm("yes", $this->tt("usersModule.admin.wpGrid.reallyPermitItems"))->setConfirm("no", $this->tt("usersModule.admin.wpGrid.reallyDenyItems"));
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->setExport("admin-users " . date("Y-m-d H:i:s", time()));
     return $grid;
 }
Пример #18
0
 protected function createComponentSongList($name)
 {
     $grid = new Grido\Grid($this, $name);
     $grid->setModel($this->songy);
     $grid->addColumnDate("datum", "Datum", "d.m.y")->setSortable();
     $grid->addColumnText("interpret_name", "Interpret")->setCustomRender(function ($item) {
         $template = $this->createTemplate();
         $template->setFile(__DIR__ . "/../templates/components/Grid/interpret.latte");
         $template->song = $item;
         return $template;
     })->setSortable()->setFilterText()->setSuggestion();
     $grid->addColumnText("name", "Song")->setCustomRender(function ($item) {
         $template = $this->createTemplate();
         $template->setFile(__DIR__ . "/../templates/components/Grid/song.latte");
         $template->song = $item;
         return $template;
     })->setSortable()->setFilterText()->setSuggestion();
     $filter = array('' => 'Všechny');
     $filter = \Nette\Utils\Arrays::mergeTree($filter, $this->zanry->getList());
     $grid->addColumnText("zanr_id", "Žánr")->setCustomRender(function ($item) {
         return $item->zanr ? $item->zanr->name : null;
     })->setFilterSelect($filter);
     $grid->addColumnText("zadatel", "Přidal(a)")->setCustomRender(function ($item) {
         $template = $this->createTemplate();
         $template->setFile(__DIR__ . "/../templates/components/Grid/zadatel.latte");
         $template->song = $item;
         return $template;
     })->setSortable()->setFilterText()->setSuggestion();
     $statuses = array('' => 'Všechny', 'approved' => 'Zařazené', 'rejected' => 'Vyřazené', 'waiting' => 'Čekající');
     $grid->addColumnText("status", "Status")->setCustomRender(function ($item) {
         $status = $item->status;
         $revizor = $item->revisor ? $item->ref("user", "revisor")->username : "******";
         switch ($status) {
             case "approved":
                 return Html::el("span", array("class" => "label label-success", "title" => "Schválil(a) " . $revizor))->setText("Zařazen");
             case "waiting":
                 return Html::el("span", array("class" => "label label-warning", "title" => "Čeká ve frontě ke schválení"))->setText("Čeká");
             case "rejected":
                 return Html::el("span", array("class" => "label label-danger", "title" => "Zamítl(a) " . $revizor))->setText("Vyřazen");
             default:
                 return Html::el("i")->setText("Neznámý");
         }
     })->setSortable()->setFilterSelect($statuses);
     $grid->addColumnText("vzkaz", "Vzkaz DJovi")->setCustomRender(function ($item) {
         $elm = Html::el("span");
         if ($item->private_vzkaz) {
             if (!$this->user->isAllowed("privateMsg", "view") && $this->user->id != $item->user_id) {
                 $elm->addAttributes(array("class" => "msg-hidden", "title" => "Tento vzkaz je určen pouze pro DJe"));
                 $elm->setText("Soukromý vzkaz");
                 return $elm;
             }
             $elm->addAttributes(array("class" => "msg-private", "title" => "Tento vzkaz je určen pouze pro DJe"));
             $elm->setText($item->vzkaz);
         } else {
             return $item->vzkaz;
         }
         return $elm;
     });
     $myLikes = $this->songList->getMyLikes($this->user);
     $grid->addColumnText("likes", "")->setCustomRender(function ($item) use($myLikes) {
         $likes = count($item->related('song_likes'));
         $isLiked = isset($myLikes[$item->id]) ?: false;
         $el = Html::el('a')->addAttributes(['class' => 'like' . ($isLiked ? ' liked' : '')]);
         $el->add(Html::el('i')->addAttributes(['class' => 'glyphicon glyphicon-heart']));
         $el->add(Html::el()->setText(' ' . $likes));
         $el->href($this->link('like!', ['id' => $item->id]));
         return $el;
     });
     if ($this->user->isAllowed("song", "approve")) {
         $grid->addActionHref("approve", "")->setIcon("ok")->setElementPrototype(Html::el("a", array("class" => "btn btn-success", "data-toggle" => "modal", "data-target" => ".modal")));
     }
     if ($this->user->isAllowed("song", "reject")) {
         $grid->addActionHref("reject", "")->setIcon("remove")->setElementPrototype(Html::el("a", array("class" => "btn btn-danger", "data-toggle" => "modal", "data-target" => ".modal")));
     }
     if ($this->user->isAllowed("song", "play")) {
         $grid->addActionHref("play", "")->setDisable(function ($item) {
             if ($item->link) {
                 return false;
             }
             return true;
         })->setIcon("play")->setElementPrototype(Html::el("a", array("class" => "btn btn-info", "data-toggle" => "modal", "data-target" => ".modal")));
     }
     if ($this->user->isAllowed("song", "edit")) {
         $grid->addActionHref("edit", "", "admin:song:editor")->setIcon("pencil")->setElementPrototype(Html::el("a", array("class" => "btn btn-default", "target" => "_blank")));
     }
     $grid->setFilterRenderType(\Grido\Components\Filters\Filter::RENDER_OUTER);
     $grid->setDefaultSort(array("datum" => "DESC"));
     //Set face for grid
     $gridTemplate = __DIR__ . "/../templates/components/Grid.latte";
     if (file_exists($gridTemplate)) {
         $grid->setTemplateFile($gridTemplate);
     }
     return $grid;
 }
Пример #19
0
 /**
  * @param $name
  * @return Grid
  */
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->translator->lang = 'cs';
     $fluent = $this->usersRepository->getAll();
     $grid->model = $fluent;
     $grid->addColumnText('username', 'Username')->setSortable()->setFilterText();
     $grid->addColumnText('name', 'Name')->setSortable()->setFilterText();
     $grid->addColumnText('lastname', 'Lastname')->setSortable()->setFilterText();
     $grid->addColumnText('role', 'Role')->setSortable()->setFilterText();
     $grid->addActionHref('edit', '')->setIcon('pencil');
     $grid->addActionEvent('delete', '')->setCustomRender(function ($item) {
         $i = \Nette\Utils\Html::el('i', ['class' => 'fa fa-trash']);
         $el = \Nette\Utils\Html::el('a', ['class' => 'btn btn-default btn-xs btn-mini ajax'])->href($this->presenter->link("delete!", $item->id))->setHtml($i);
         return $el;
     });
     $grid->setDefaultPerPage(50);
     $grid->filterRenderType = $this->filterRenderType;
     $grid->setExport();
     return $grid;
 }
Пример #20
0
 /**
  * @param $name
  * @return Grid
  */
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->translator->lang = 'cs';
     $fluent = $this->sliderRepository->getAll();
     $grid->model = $fluent;
     $grid->addColumnText('imgName', 'Obrázek')->setCustomRender(function ($item) {
         $img = Html::el('img')->src($item->imgName)->width('200');
         return $img;
     });
     $grid->addColumnText('imgTitle', 'Titulek')->setSortable()->setFilterText();
     $grid->getColumn('imgTitle')->headerPrototype->style['width'] = '20%';
     $grid->addColumnText('imgDescription', 'Popisek')->setSortable()->setFilterText();
     $grid->getColumn('imgDescription')->headerPrototype->style['width'] = '40%';
     $grid->addActionHref('edit', '')->setIcon('pencil');
     $grid->addActionEvent('delete', '')->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("delete!", $item->id))->setHtml($i);
         return $el;
     });
     $grid->setDefaultPerPage(50);
     $grid->filterRenderType = $this->filterRenderType;
     $grid->setExport();
     return $grid;
 }
Пример #21
0
 protected function createComponentGenres()
 {
     $grid = new Grid();
     $grid->setModel($this->zanry->findAll());
     $grid->addColumnText('name', 'Žánr')->setSortable();
     $grid->addColumnText('popis', 'Krátký popis');
     $grid->addActionHref('genre', 'Upravit')->setIcon('pencil');
     $grid->addActionHref('remove', 'Smazat', 'deleteGenre!')->setConfirm("Opravdu chcete smazat tento žánr?")->setIcon('trash');
     return $grid;
 }
Пример #22
0
 /**
  * @param $name
  * @return Grid
  */
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->translator->lang = 'cs';
     $fluent = $this->pagesRepository->getAll();
     $pages = [];
     foreach ($fluent as $pageRow) {
         $pages[$pageRow->id] = $pageRow;
     }
     if (isset($grid->model)) {
         $grid->model = $fluent;
     }
     $grid->addColumnNumber('id', 'ID');
     $header = $grid->getColumn('id')->headerPrototype;
     $header->style['width'] = '0.5%';
     $grid->addColumnText('name', 'Název')->setFilterText()->setSuggestion();
     $grid->getColumn('name')->headerPrototype->style['width'] = '80%';
     $grid->addColumnText('active', 'Aktivní')->setCustomRender(function ($item) {
         if ($item->active == 0) {
             $i = Html::el('i', ['class' => 'glyphicon glyphicon-thumbs-down']);
             $el = Html::el('a', ['class' => 'btn btn-danger btn-xs btn-mini ajax'])->href($this->presenter->link("active!", $item->id))->setHtml($i);
         } else {
             $i = Html::el('i', ['class' => 'glyphicon glyphicon-thumbs-up']);
             $el = Html::el('a', ['class' => 'btn btn-success btn-xs btn-mini ajax'])->href($this->presenter->link("active!", $item->id))->setHtml($i);
         }
         return $el;
     })->cellPrototype->class[] = 'center';
     $grid->addColumnText('inMenu', 'Top menu')->setCustomRender(function ($item) {
         $menuItems = (array) json_decode($item->inMenu);
         if (!in_array('topMenu', $menuItems)) {
             $i = Html::el('i', ['class' => 'glyphicon glyphicon-thumbs-down']);
             $el = Html::el('a', ['class' => 'btn btn-danger btn-xs btn-mini ajax'])->href($this->presenter->link("inTopMenu!", $item->id))->setHtml($i);
         } else {
             $i = Html::el('i', ['class' => 'glyphicon glyphicon-thumbs-up']);
             $el = Html::el('a', ['class' => 'btn btn-success btn-xs btn-mini ajax'])->href($this->presenter->link("inTopMenu!", $item->id))->setHtml($i);
         }
         return $el;
     })->cellPrototype->class[] = 'center';
     $grid->addActionHref('edit', '')->setIcon('pencil');
     $grid->addActionEvent('delete', '')->setCustomRender(function ($item) {
         if ($item->parent === 0 || $item->rgt - $item->lft > 1) {
             $i = Html::el('i', ['class' => 'fa']);
             $el = Html::el('span', ['class' => 'btn btn-xs btn-mini'])->setHtml($i);
         } else {
             $i = Html::el('i', ['class' => 'fa fa-trash']);
             $el = Html::el('a', ['class' => 'btn btn-default btn-xs btn-mini ajax', 'data-grido-confirm' => "Opravdu chcete tuto položku odstranit?"])->href($this->presenter->link("delete!", $item->id))->setHtml($i);
         }
         return $el;
     });
     $grid->addActionEvent('moveup', '')->setCustomRender(function ($item) use($pages) {
         $first = $item->parent == 0 || $item->lft - 1 == $pages[$item->parent]['lft'];
         if ($first) {
             $i = Html::el('i', ['class' => 'fa']);
             $el = Html::el('span', ['class' => 'btn btn-xs btn-mini'])->setHtml($i);
         } else {
             $i = Html::el('i', ['class' => 'fa fa-arrow-up']);
             $el = Html::el('a', ['class' => 'btn btn-default btn-xs btn-mini ajax'])->href($this->presenter->link("move!", $item->id, self::UP))->setHtml($i);
         }
         return $el;
     });
     $grid->addActionEvent('movedn', '')->setCustomRender(function ($item) use($pages) {
         $last = $item->parent == 0 || $item->rgt + 1 == $pages[$item->parent]['rgt'];
         if ($last) {
             $i = Html::el('i', ['class' => 'fa']);
             $el = Html::el('span', ['class' => 'btn btn-xs btn-mini'])->setHtml($i);
         } else {
             $i = Html::el('i', ['class' => 'fa fa-arrow-down']);
             $el = Html::el('a', ['class' => 'btn btn-default btn-xs btn-mini ajax'])->href($this->presenter->link("move!", $item->id, self::DN))->setHtml($i);
         }
         return $el;
     });
     $grid->addActionHref('add', '')->setIcon('plus');
     $grid->setDefaultSort(['lft' => 'ASC']);
     $grid->setRememberState(TRUE);
     $grid->setPrimaryKey('id');
     $grid->setDefaultPerPage(50);
     $grid->setRowCallback(function ($item, $tr) {
         $tr->class[] = "level_{$item->level}";
         return $tr;
     });
     $grid->filterRenderType = $this->filterRenderType;
     $grid->setExport();
     return $grid;
 }
Пример #23
0
 /**
  * Admin payments grid control factory
  * @param string $name
  */
 public function createComponentPaymentsGrid($name)
 {
     try {
         $seasons = [null => null] + $this->seasonService->getSelectSeasons();
         $users = [null => null] + $this->getUsersService()->getSelectUsers();
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataLoad(null, "default", $ex);
     }
     $grid = new Grid($this, $name);
     $grid->setModel($this->getPaymentService()->getPaymentsDataSource());
     $grid->setPrimaryKey("id");
     $grid->addColumnNumber('id', '#')->cellPrototype->class[] = 'center';
     $headerId = $grid->getColumn('id')->headerPrototype;
     $headerId->class[] = 'center';
     $headerId->rowspan = "2";
     $headerId->style['width'] = '0.1%';
     $grid->addColumnText('owner', $this->tt('paymentsModule.admin.grid.user'))->setSortable()->setFilterSelect($users);
     $headerLabel = $grid->getColumn('owner')->headerPrototype;
     $headerLabel->class[] = 'center';
     $grid->addColumnText('season', $this->tt('paymentsModule.admin.grid.season'))->setSortable()->setFilterSelect($seasons);
     $headerSeas = $grid->getColumn('season')->headerPrototype;
     $headerSeas->class[] = 'center';
     $grid->addColumnDate('dueDate', $this->tt('paymentsModule.admin.grid.dueDate'), self::DATE_FORMAT)->setSortable()->setFilterDateRange();
     $headerOrdered = $grid->getColumn('dueDate')->headerPrototype;
     $headerOrdered->class[] = 'center';
     $grid->addColumnNumber('amount', $this->tt('paymentsModule.admin.grid.amount'))->setSortable()->setFilterNumber();
     $headerAm = $grid->getColumn('amount')->headerPrototype;
     $headerAm->class[] = 'center';
     $states = [null => null] + PaymentStatus::getOptions();
     $grid->addColumnText('status', $this->tt('paymentsModule.admin.grid.status'))->setTruncate(9)->setSortable()->setCustomRender($this->statusRender)->setFilterSelect($states);
     $headerSta = $grid->getColumn('status')->headerPrototype;
     $headerSta->class[] = 'center';
     $grid->addActionHref('delete', '', 'deletePayment!')->setIcon('trash')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("paymentsModule.admin.grid.delete")]))->setConfirm(function ($u) {
         return $this->tt("paymentsModule.admin.grid.messages.rlyDelPayment", null, ["id" => $u->getId()]);
     });
     $grid->addActionHref('edit', '', 'updatePayment')->setIcon('pencil')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("paymentsModule.admin.grid.update")]));
     $grid->setOperation(["delete" => $this->tt("system.common.delete"), "markCash" => $this->tt("paymentsModule.admin.grid.markDoneCash"), "markAcc" => $this->tt("paymentsModule.admin.grid.markDoneAcc"), "markSent" => $this->tt("paymentsModule.admin.grid.markSent")], $this->paymentsGridOpsHandler)->setConfirm("delete", $this->tt("paymentsModule.admin.grid.messages.rlyDelPaymentItems"));
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->setExport("admin-payments " . date("Y-m-d H:i:s", time()));
 }
Пример #24
0
 public function createComponentStaticPagesGrid($name)
 {
     try {
         //	    $users	= [null=>null] + $this->userService->getSelectUsers();
         //	    $pages	= [null=>null] + $this->staticPageService->getSelectStaticPages();
         $states = [null => null] + StaticPageStatus::getOptions();
         $commModes = [null => null] + CommentMode::getOptions();
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataLoad(null, ":System:Default:adminRoot", $ex);
     }
     $grid = new Grid($this, $name);
     $grid->setTranslator($this->getTranslator());
     $grid->setModel($this->staticPageService->getPagesDataSource());
     $grid->setPrimaryKey('id');
     $grid->addColumnNumber('id', '#')->cellPrototype->class[] = 'center';
     $headerId = $grid->getColumn('id')->headerPrototype;
     $headerId->class[] = 'center';
     $headerId->rowspan = "2";
     $headerId->style['width'] = '0.1%';
     $grid->addColumnText('title', $this->tt("systemModule.admin.grid.title"))->setSortable();
     $headerTt = $grid->getColumn('title')->headerPrototype;
     $headerTt->class[] = 'center';
     $grid->addColumnText('abbr', $this->tt("systemModule.admin.grid.abbr"))->setSortable()->setFilterText();
     $headerAb = $grid->getColumn('abbr')->headerPrototype;
     $headerAb->class[] = 'center';
     //	$grid->addColumnText('parent', $this->tt("systemModule.admin.grid.parent"))
     //		->setSortable()
     //		->setFilterSelect($pages);
     //	$headerParent = $grid->getColumn('parent')->headerPrototype;
     //	$headerParent->class[] = 'center';
     $grid->addColumnText('group', $this->tt("systemModule.admin.grid.group"))->setSortable()->setFilterSelect([null => null] + $this->getSelectSportGroups());
     $headerParent = $grid->getColumn('group')->headerPrototype;
     $headerParent->class[] = 'center';
     $grid->addColumnText('commentMode', $this->tt("systemModule.admin.grid.commMode"))->setSortable()->setCustomRender($this->spCommModeRender)->setFilterSelect($commModes);
     $headerCm = $grid->getColumn('commentMode')->headerPrototype;
     $headerCm->class[] = 'center';
     $grid->addColumnText('status', $this->tt("systemModule.admin.grid.status"))->setSortable()->setCustomRender($this->spStatusRender)->setFilterSelect($states);
     $headerSt = $grid->getColumn('status')->headerPrototype;
     $headerSt->class[] = 'center';
     $grid->addActionHref('delete', '', 'deleteStaticPage!')->setIcon('trash')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("systemModule.admin.grid.delete")]))->setConfirm(function ($u) {
         return $this->tt("systemModule.admin.grid.messages.rlyDelPage", null, ["id" => $u->getId()]);
     });
     $grid->addActionHref('edit', '', 'updateStaticPage')->setIcon('pencil')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("systemModule.admin.grid.update")]));
     $grid->setOperation(["delete" => $this->tt("systemModule.admin.grid.delete")], $this->staticPagesOpHandler)->setConfirm("delete", $this->tt("systemModule.admin.grid.messages.rlyDelPageItems"));
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->setExport("admin-types " . date("Y-m-d H:i:s", time()));
 }
Пример #25
0
 /**
  * Partners grid factory
  * @param string $name
  */
 public function createComponentPartnersGrid($name)
 {
     try {
         $users = [null => null] + $this->getUsersService()->getSelectUsers();
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataLoad(null, "default", $ex);
     }
     $grid = new Grid($this, $name);
     $grid->setTranslator($this->getTranslator());
     $grid->setModel($this->getPartnerService()->getPartnersDataSource());
     $grid->setPrimaryKey("id");
     $grid->addColumnNumber('id', '#')->cellPrototype->class[] = 'center';
     $headerId = $grid->getColumn('id')->headerPrototype;
     $headerId->class[] = 'center';
     $headerId->rowspan = "2";
     $headerId->style['width'] = '0.1%';
     $grid->addColumnText('name', 'partnersModule.admin.grid.name')->setSortable()->setCustomRender($this->nameRender);
     $headerName = $grid->getColumn('name')->headerPrototype;
     $headerName->class[] = 'center';
     //	$grid->addColumnText('referrer','partnersModule.admin.grid.referrer')
     //		->setSortable()
     //		->setFilterSelect($users);
     //	$headerRef = $grid->getColumn('referrer')->headerPrototype;
     //	$headerRef->class[] = 'center';
     $grid->addColumnDate('updated', 'partnersModule.admin.grid.updated', self::DATE_FORMAT)->setSortable()->setFilterDateRange();
     $headerUpdated = $grid->getColumn('updated')->headerPrototype;
     $headerUpdated->class[] = 'center';
     $y = $this->tt("system.common.yes");
     $n = $this->tt("system.common.no");
     $activeList = [null => null, true => $y, false => $n];
     $grid->addColumnNumber('active', 'partnersModule.admin.grid.active')->setReplacement([true => $y, null => $n])->setSortable()->setFilterSelect($activeList);
     $headerActive = $grid->getColumn('active')->headerPrototype;
     $headerActive->class[] = 'center';
     $grid->addColumnText('note', 'partnersModule.admin.grid.note')->setTruncate(30)->setSortable();
     $headerNote = $grid->getColumn('note')->headerPrototype;
     $headerNote->class[] = 'center';
     // actions
     $grid->addActionHref('delete', '', 'deletePartner!')->setIcon('trash')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("partnersModule.admin.grid.delete")]))->setConfirm(function ($u) {
         return $this->tt("partnersModule.admin.grid.messages.rlyDelPartner", null, ["id" => $u->getId()]);
     });
     $grid->addActionHref('edit', '', 'updatePartner')->setIcon('pencil')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("partnersModule.admin.grid.update")]));
     $grid->setOperation(["delete" => $this->tt("system.common.delete")], $this->partnersGridOpsHandler)->setConfirm("delete", $this->tt("partnersModule.admin.grid.messages.rlyDelPartnerItems"));
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->setExport("admin-partners " . date("Y-m-d H:i:s", time()));
 }
Пример #26
0
 /**
  * Admin articles grid factory.
  * @param string $name
  * @return Grid
  */
 public function createComponentArticlesGrid($name)
 {
     $articleStates = [null => null] + ArticleStatus::getOptions();
     $commentModes = [null => null] + CommentMode::getOptions();
     try {
         $users = [null => null] + $this->usersService->getSelectUsers();
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleException($ex);
     }
     $grid = new Grid($this, $name);
     $grid->setModel($this->articleService->getArticlesDataSource());
     $grid->setTranslator($this->getTranslator());
     $grid->setPrimaryKey("id");
     $grid->addColumnNumber("id", "#")->cellPrototype->class[] = "center";
     $headerId = $grid->getColumn("id")->headerPrototype;
     $headerId->class[] = "center";
     $headerId->rowspan = "2";
     $headerId->style["width"] = '0.1%';
     $grid->addColumnText('title', $this->tt("articlesModule.admin.grid.title"))->setSortable()->setCustomRender($this->titleRender)->setFilterText();
     $headerTitle = $grid->getColumn('title')->headerPrototype;
     $headerTitle->class[] = 'center';
     $grid->addColumnText('status', $this->tt("articlesModule.admin.grid.state"))->setSortable()->setCustomRender($this->statusRender)->setFilterSelect($articleStates);
     $headerStatus = $grid->getColumn('status')->headerPrototype;
     $headerStatus->class[] = 'center';
     $grid->addColumnText('commentMode', $this->tt("articlesModule.admin.grid.comments"))->setSortable()->setCustomRender($this->commentModeRender)->setFilterSelect($commentModes);
     $headerStatus = $grid->getColumn('commentMode')->headerPrototype;
     $headerStatus->class[] = 'center';
     $grid->addColumnText('author', $this->tt("articlesModule.admin.grid.author"))->setSortable()->setFilterSelect($users);
     $headerAuthor = $grid->getColumn('author')->headerPrototype;
     $headerAuthor->class[] = 'center';
     $grid->addColumnDate('updated', $this->tt("articlesModule.admin.grid.change"), self::DATETIME_FORMAT)->setSortable()->setFilterDateRange();
     $headerAuthor = $grid->getColumn('updated')->headerPrototype;
     $headerAuthor->class[] = 'center';
     $grid->addActionHref('delete', '', 'deleteArticle!')->setIcon('trash')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("articlesModule.admin.grid.delete")]))->setConfirm(function ($u) {
         return $this->tt("articlesModule.admin.grid.rlyDelArticle", null, ["id" => $u->getId()]);
     });
     $grid->addActionHref('edit', '', 'updateArticle')->setIcon('pencil')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("articlesModule.admin.grid.update")]));
     $grid->addActionHref("goto", "", "goToArticle")->setIcon('eye-open')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("articlesModule.admin.grid.view")]));
     $grid->setOperation(["delete" => $this->tt("system.common.delete")], $this->articlesGridOperationHandler);
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->setExport("admin-articles" . date("Y-m-d H:i:s", time()));
     return $grid;
 }
Пример #27
0
 public function createComponentEntriesGrid($name)
 {
     $seasons = [null => null] + $this->getSelectSeasons();
     $users = [null => null] + $this->getSelectUsers();
     $grid = new Grid($this, $name);
     $grid->setModel($this->entryService->getEntriesDataSource());
     $grid->setPrimaryKey("id");
     $grid->addColumnNumber('id', '#')->cellPrototype->class[] = 'center';
     $headerId = $grid->getColumn('id')->headerPrototype;
     $headerId->class[] = 'center';
     $headerId->rowspan = "2";
     $headerId->style['width'] = '0.1%';
     $grid->addColumnText('season', $this->tt("motivationModule.admin.grid.season"))->setSortable()->setFilterSelect($seasons);
     $headerSeas = $grid->getColumn('season')->headerPrototype;
     $headerSeas->class[] = 'center';
     $grid->addColumnText('owner', $this->tt("motivationModule.admin.grid.owner"))->setSortable()->setFilterSelect($users);
     $headerOwn = $grid->getColumn('owner')->headerPrototype;
     $headerOwn->class[] = 'center';
     $grid->addColumnText('amount', $this->tt("motivationModule.admin.grid.amount"))->setSortable()->setFilterText();
     $headerAmnt = $grid->getColumn('amount')->headerPrototype;
     $headerAmnt->class[] = 'center';
     $types = MotivationEntryType::getOptions();
     $grid->addColumnText('type', $this->tt("motivationModule.admin.grid.type"))->setSortable()->setReplacement($types)->setFilterSelect([null => null] + $types);
     $headerT = $grid->getColumn('type')->headerPrototype;
     $headerT->class[] = 'center';
     $grid->addColumnText('subject', $this->tt("motivationModule.protected.grid.subject"))->setSortable()->setFilterText();
     $headerSubj = $grid->getColumn('subject')->headerPrototype;
     $headerSubj->class[] = 'center';
     $grid->addActionHref('delete', '', "deleteEntry!")->setIcon('trash')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("motivationModule.admin.grid.delete")]))->setConfirm(function ($u) {
         return $this->tt("motivationModule.admin.grid.rlyDeleteEntryId", null, ["id" => $u->getId()]);
     });
     $grid->addActionHref("update", "", "updateEntry")->setIcon("pencil")->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("motivationModule.admin.grid.update")]));
     $operation = ['delete' => $this->tt("system.common.delete")];
     $grid->setOperation($operation, $this->entryGridOpsHandler)->setConfirm('delete', $this->tt("motivationModule.admin.grid.reallyDeleteItems"));
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->setExport("admin-motivation-entries" . date("Y-m-d H:i:s", time()));
 }
Пример #28
0
 /**
  * @param $name
  * @return Grid
  * @throws \Grido\Exception
  */
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->translator->lang = 'cs';
     $fluent = $this->newsRepository->getAll();
     $grid->model = $fluent;
     $grid->addColumnText('title', 'Titulek')->setSortable()->setFilterText();
     $grid->getColumn('title')->headerPrototype->style['width'] = '65%';
     $grid->addColumnDate('dateAdd', 'Datum')->setSortable()->setFilterText();
     $grid->addColumnText('active', 'Aktivní')->setCustomRender(function ($item) {
         if ($item->active === 0) {
             $i = Html::el('i', ['class' => 'glyphicon glyphicon-thumbs-down']);
             $el = Html::el('a', ['class' => 'btn btn-danger btn-xs btn-mini ajax'])->href($this->presenter->link("active!", $item->id))->setHtml($i);
         } else {
             $i = Html::el('i', ['class' => 'glyphicon glyphicon-thumbs-up']);
             $el = Html::el('a', ['class' => 'btn btn-success btn-xs btn-mini ajax'])->href($this->presenter->link("active!", $item->id))->setHtml($i);
         }
         return $el;
     })->cellPrototype->class[] = 'center';
     $grid->addActionEvent('delete', '')->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("delete!", $item->id))->setHtml($i);
         return $el;
     });
     $grid->addActionHref('edit', '')->setIcon('pencil');
     $grid->setDefaultSort(['dateAdd' => 'DESC']);
     $grid->setDefaultPerPage(50);
     $grid->filterRenderType = $this->filterRenderType;
     $grid->setExport();
     return $grid;
 }
Пример #29
0
 public function createComponentSeasonApplicationGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->getSeasonApplicationService()->getSeasonApplicationsDataSource());
     $grid->addColumnNumber('id', '#')->cellPrototype->class[] = 'center';
     $headerId = $grid->getColumn('id')->headerPrototype;
     $headerId->class[] = 'center';
     $headerId->rowspan = "2";
     $headerId->style['width'] = '0.1%';
     $grid->addColumnText('owner', 'Člen')->setSortable();
     $headerLabel = $grid->getColumn('owner')->headerPrototype;
     $headerLabel->class[] = 'center';
     $grid->addColumnText('season', 'Sezóna')->setSortable();
     $headerLabel = $grid->getColumn('season')->headerPrototype;
     $headerLabel->class[] = 'center';
     $grid->addColumnText('sportGroup', 'Skupina')->setSortable();
     $headerSince = $grid->getColumn('sportGroup')->headerPrototype;
     $headerSince->class[] = 'center';
     $grid->addColumnDate('enrolledTime', 'Podáno', self::DATETIME_FORMAT)->setSortable()->setCustomRender($this->appGridUpdatedRender);
     $headerTill = $grid->getColumn('enrolledTime')->headerPrototype;
     $headerTill->class[] = 'center';
     $grid->addColumnDate('updated', 'Změněno')->setSortable()->setCustomRender($this->appGridUpdatedRender);
     $headerTill = $grid->getColumn('updated')->headerPrototype;
     $headerTill->class[] = 'center';
     $grid->addColumnText('comment', 'Poznámka')->setSortable()->setTruncate(15);
     $headerNote = $grid->getColumn('comment')->headerPrototype;
     $headerNote->class[] = 'center';
     $grid->addActionHref('delete', '', 'deleteSeasonApplication!')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("seasonsModule.admin.grid.delete")]))->setIcon('trash')->setConfirm(function ($u) {
         return $this->tt("seasonsModule.admin.grid.reallyDeleteAppId", null, ["id" => $u->getId()]);
     });
     $grid->addActionHref('edit', '', 'updateSeasonApplication')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("seasonsModule.admin.grid.update")]))->setIcon('pencil');
     $grid->setOperation(["delete" => $this->tt("seasonsModule.admin.grid.delete")], null, $this->seasonAppOperationsHandler)->setConfirm('delete', $this->tt("usersModule.admin.grid.reallyDeleteItems"));
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->setExport("admin-season-applications " . date("Y-m-d H:i:s", time()));
 }
Пример #30
0
 public function createComponentDeletedGrid($name)
 {
     try {
         $users = $this->userService->getSelectUsers();
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataLoad(null, "default", $ex);
     }
     $grid = new Grid($this, $name);
     $grid->setTranslator($this->getTranslator());
     $grid->setModel($this->privateMessageService->getDeletedDatasource($this->getUser()->getIdentity()));
     $grid->addColumnText("starred", "communicationModule.pmForm.starred")->setSortable()->setCustomRender($this->starredRender);
     $headerStar = $grid->getColumn('starred')->headerPrototype;
     $headerStar->class[] = 'center';
     $headerStar->style['width'] = '1%';
     $grid->addColumnText("recipient", "communicationModule.pmForm.recipient")->setTruncate(17)->setCustomRender($this->recipientRender)->setSortable()->setFilterSelect([null => null] + $users);
     $headerSender = $grid->getColumn('recipient')->headerPrototype;
     $headerSender->class[] = 'center';
     $headerSender->style['width'] = '15%';
     $grid->addColumnText("subject", "communicationModule.pmForm.subject")->setCustomRender($this->subjectRender)->setSortable()->setFilterText();
     $headerSbj = $grid->getColumn('subject')->headerPrototype;
     $headerSbj->class[] = 'center';
     $headerSbj->style['width'] = '50%';
     $grid->addColumnDate("sent", "communicationModule.pmForm.delivered")->setCustomRender($this->sentRender)->setSortable();
     $headerSnt = $grid->getColumn('sent')->headerPrototype;
     $headerSnt->class[] = 'center';
     $headerSnt->style['width'] = '15%';
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->addActionHref("delete", "", "purgeMessage!")->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("communicationModule.user.grid.purgeMessage")]))->setIcon('trash')->setConfirm(function ($u) {
         return "communicationModule.user.grid.message.reallyPurgeMessage";
     });
     $grid->setOperation(["delete" => $this->tt("communicationModule.grid.delete"), "starToggle" => $this->tt("communicationModule.grid.starToggle")], $this->gridOperationsHandler);
     return $grid;
 }