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;
 }
Exemple #2
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;
 }
 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}?";
     });
 }
 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}?";
     });
 }
Exemple #5
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;
 }
 public function createComponentUsersGrid($name)
 {
     $groupId = $this->getParameter('groupId');
     $grid = new Grid($this, $name);
     $grid->setModel($this->userModel->findAll($groupId));
     $grid->addColumnText('username', 'Užívateľ')->setSortable()->setFilterText();
     $grid->addColumnText('email', 'Email-ová adresa')->setSortable()->setFilterText();
     $grid->addColumnNumber('last_login', 'Posledné prihlásenie')->setSortable();
     $grid->filterRenderType = $this->filterRenderType;
     $grid->hasActions(false);
 }
Exemple #7
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');
 }
 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');
 }
Exemple #9
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;
 }
 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');
 }
Exemple #11
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;
 }
 protected function createComponentSearchGrid($name)
 {
     if ($this->groupsOutput) {
         $grid = new Grid($this, $name);
         $grid->setModel($this->groupsOutput);
         $grid->setPrimaryKey('id');
         $grid->addColumnText('name', 'Názov')->setSortable();
         $grid->addColumnText('desc', 'Popis')->setSortable();
         $grid->addColumnNumber('pocet', 'Počet ľudí')->setSortable();
         //            $operation = array('join' => 'Pripojiť sa', 'leave' => 'Odísť');
         //            $grid->setOperation($operation, $this->handleOperations)
         //                ->setConfirm('delete', 'Are you sure you want to delete %i items?');
         $grid->filterRenderType = $this->filterRenderType;
     }
 }
 public function createComponentUserMotivationGrid($name)
 {
     try {
         $seasons = [null => null] + $this->seasonService->getSelectSeasons();
         //$users = [null=>null]+$this->userService->getSelectUsers();
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataLoad(null, self::LAST_CHANCE_REDIRECT, $ex);
     }
     $grid = new Grid($this, $name);
     $grid->setModel($this->entryService->getEntriesDataSource($this->getUser()->getIdentity()));
     $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.protected.grid.season"))->setSortable()->setFilterSelect($seasons);
     $headerSeas = $grid->getColumn('season')->headerPrototype;
     $headerSeas->class[] = 'center';
     $grid->addColumnText('amount', $this->tt("motivationModule.protected.grid.amount"))->setSortable()->setFilterText();
     $headerAmnt = $grid->getColumn('amount')->headerPrototype;
     $headerAmnt->class[] = 'center';
     $grid->addColumnDate("updated", $this->tt("motivationModule.protected.grid.updated"), self::DATE_FORMAT)->setSortable();
     $headerOd = $grid->getColumn('updated')->headerPrototype;
     $headerOd->class[] = 'center';
     $grid->addColumnText('type', $this->tt("motivationModule.protected.grid.type"))->setSortable()->setReplacement(MotivationEntryType::getOptions())->setFilterSelect([null => null] + MotivationEntryType::getOptions());
     $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->setFilterRenderType($this->filterRenderType);
     $grid->setExport("protected-motivation" . date("Y-m-d H:i:s", time()));
 }
 /**
  * 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;
 }
Exemple #15
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');
 }
Exemple #16
0
 /**
  * @return \Grido\Grid
  */
 protected function createComponentTable()
 {
     $table = new Grid();
     $table->setModel(new ArraySource($this->workerManager->getWorkers()));
     $table->addColumnText('id', 'ID')->getCellPrototype()->width = '40%';
     $table->addColumnText('state', 'State')->setCustomRender(function ($data) {
         $lastCheck = \DateTime::createFromFormat('Y-m-d H:i:s', $data['lastCheck']);
         $lastCheck->modify('+' . ($this->workerManager->getInterval() + 7) . ' second');
         return $lastCheck < new \DateTime() ? 'break' : $data['state'];
     })->getCellPrototype()->width = '20%';
     $table->addColumnText('lastCheck', 'Last check')->getCellPrototype()->width = '30%';
     $table->addColumnText('lastJob', 'Last job')->getCellPrototype()->width = '30%';
     $table->addActionEvent('debug', 'Debug')->onClick[] = $this->tableDebugClick;
     $table->addActionEvent('restart', 'Restart')->onClick[] = $this->tableRestartClick;
     $table->addActionEvent('stop', 'Stop')->onClick[] = $this->tableStopClick;
     return $table;
 }
Exemple #17
0
 /**
  *
  * @param string $name
  * @param string $label
  * @param boolean $default
  * @return \Grido\Components\Columns\Text
  */
 public function addColumnLongText($name, $label, $default = TRUE)
 {
     $column = parent::addColumnText($name, $label);
     if ($default === TRUE) {
         $column->setFilterText()->setSuggestion();
     }
     return $column;
 }
 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');
 }
 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');
 }
 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;
 }
Exemple #21
0
 /**
  * @param $name
  * @return Grid
  * @throws \Grido\Exception
  */
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->translator->lang = 'cs';
     $fluent = $this->searchRepository->getAll();
     $grid->model = $fluent;
     $grid->addColumnText('term', 'Hledaný termín')->setSortable()->setFilterText();
     $grid->getColumn('term')->headerPrototype->style['width'] = '75%';
     $grid->addColumnNumber('count', 'Počet hledání')->setSortable();
     $grid->getColumn('term')->headerPrototype->style['width'] = '25%';
     $grid->setDefaultPerPage(50);
     $grid->filterRenderType = $this->filterRenderType;
     $grid->setExport();
     return $grid;
 }
Exemple #22
0
 /**
  * @return \Grido\Grid
  */
 protected function createComponentTable()
 {
     $table = new Grid();
     $table->setModel(new ArraySource($this->getFiles()));
     $table->addColumnText('id', 'Link')->setSortable()->getCellPrototype()->width = '70%';
     $table->addColumnDate('date', 'Date', 'Y.m.d H:i:s')->setSortable()->getCellPrototype()->width = '30%';
     $event = $table->addActionEvent('show', 'Show');
     $event->onClick[] = $this->handleShow;
     $event = $table->addActionEvent('delete', 'Delete');
     $event->getElementPrototype()->class[] = 'ajax';
     $event->onClick[] = $this->handleDelete;
     $event->setConfirm(function () {
         return 'Really delete?';
     });
     return $table;
 }
Exemple #23
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;
 }
Exemple #24
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()));
 }
Exemple #25
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;
 }
Exemple #26
0
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->entry->listAll());
     $grid->addColumnText('lname', 'Příjmení')->setSortable()->setFilterText()->setSuggestion();
     $grid->addColumnText('fname', 'Jméno')->setSortable()->setFilterText()->setSuggestion();
     $grid->addColumnText('nick', 'Nick')->setFilterText();
     $grid->addColumnText('registration', 'Reg.')->setSortable()->setFilterText();
     $grid->addColumnText('si_number', 'SI')->setSortable()->setFilterText();
     $grid->addColumnText('category', 'Kat.')->setColumn(function ($i) {
         return $i->category['name'];
     });
     $grid->addColumnNumber('start', 'Start')->setSortable();
     $grid->addColumnText('start_opt', 'Volby')->setColumn(function ($i) {
         return self::$start_options[$i->start_opt];
     });
     $cats = $this->race->listCategories()->fetchPairs('id', 'name');
     $catselect = array('' => '');
     foreach ($cats as $k => $v) {
         $catselect[$k] = $v;
     }
     $grid->addFilterSelect('category', 'Kat.', $catselect)->setColumn('category_id');
     $grid->filterRenderType = \Grido\Components\Filters\Filter::RENDER_INNER;
     $grid->setExport();
 }
Exemple #27
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;
 }
Exemple #28
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()));
 }
Exemple #29
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()));
 }
Exemple #30
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()));
 }