Exemplo n.º 1
0
 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()));
 }
Exemplo n.º 2
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()));
 }
Exemplo n.º 3
0
 public function getTypes()
 {
     return MotivationEntryType::getOptions();
 }