Exemplo n.º 1
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;
 }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
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;
 }
Exemplo n.º 5
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()));
 }
Exemplo n.º 6
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()));
 }
Exemplo n.º 7
0
 public function createComponentTaxesGrid($name)
 {
     try {
         $seasons = [null => null] + $this->seasonService->getSelectSeasons();
         $groups = [null => null] + $this->groupService->getSelectApplicablegroups();
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataLoad(null, self::LAST_CHANCE_REDIRECT, $ex);
     }
     $grid = new Grid($this, $name);
     $grid->setModel($this->taxService->getTaxesDataSource());
     $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('sportGroup', $this->tt("motivationModule.admin.grid.group"))->setSortable()->setFilterSelect($groups);
     $headerGrp = $grid->getColumn('sportGroup')->headerPrototype;
     $headerGrp->class[] = 'center';
     $grid->addColumnText('credit', $this->tt("motivationModule.admin.grid.credit"))->setSortable()->setFilterText();
     $headerCr = $grid->getColumn('credit')->headerPrototype;
     $headerCr->class[] = 'center';
     $grid->addColumnDate("orderedDate", $this->tt("motivationModule.admin.grid.orderedDate"), self::DATE_FORMAT)->setSortable();
     $headerOd = $grid->getColumn('orderedDate')->headerPrototype;
     $headerOd->class[] = 'center';
     $grid->addColumnText('publicNote', $this->tt("motivationModule.admin.grid.note"))->setTruncate(20)->setSortable()->setFilterText();
     $headerNote = $grid->getColumn('publicNote')->headerPrototype;
     $headerNote->class[] = 'center';
     $grid->addActionHref('delete', '', "deleteTax!")->setIcon('trash')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("motivationModule.admin.grid.update")]))->setConfirm(function ($u) {
         return $this->tt("motivationModule.admin.grid.rlyDeleteTaxId", null, ["id" => $u->getId()]);
     });
     $grid->addActionHref("update", "", "updateTax")->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-taxes" . date("Y-m-d H:i:s", time()));
 }
Exemplo n.º 8
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;
 }
Exemplo n.º 9
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.º 10
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()));
 }
Exemplo n.º 11
0
 /**
  * User's payments grid factory
  * @param string $name
  * @return Grid
  */
 public function createComponentUserPaymentsGrid($name)
 {
     try {
         $seasons = $this->seasonService->getSelectSeasons();
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataLoad(null, ":System:Default:userRoot", $ex);
     }
     $grid = new Grid($this, $name);
     $grid->setModel($this->paymentService->getPaymentsDataSource($this->getUser()->getIdentity()));
     $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->addColumnNumber('amount', $this->tt('paymentsModule.admin.grid.amount'))->setSortable()->setFilterNumber();
     $headerAm = $grid->getColumn('amount')->headerPrototype;
     $headerAm->class[] = 'center';
     $grid->addColumnText('subject', $this->tt('paymentsModule.admin.grid.subject'))->setCustomRender($this->subjectRender)->setSortable()->setFilterText();
     $headerSeas = $grid->getColumn('subject')->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';
     $states = [null => null] + PaymentStatus::getOptions();
     $grid->addColumnText('status', $this->tt('paymentsModule.admin.grid.status'))->setTruncate(9)->setSortable()->setCustomRender($this->statusRender)->setFilterSelect($states);
     $grid->addColumnText('season', $this->tt('paymentsModule.admin.grid.season'))->setSortable()->setFilterSelect($seasons);
     $headerSeas = $grid->getColumn('season')->headerPrototype;
     $headerSeas->class[] = 'center';
     $headerSta = $grid->getColumn('status')->headerPrototype;
     $headerSta->class[] = 'center';
     $grid->addActionHref("show", "", "paymentDetails")->setIcon("eye-open");
     $grid->addActionHref("markAsSent", "", "markAsSent!")->setIcon("check")->setConfirm(function ($u) {
         return $this->tt("paymentsModule.protected.grid.messages.rlyMarkAsSent", null, ["id" => $u->getId()]);
     });
     $grid->setFilterRenderType($this->filterRenderType);
     return $grid;
 }
Exemplo n.º 12
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;
 }
Exemplo n.º 13
0
 public function createComponentEventsGrid($name)
 {
     $eventTypes = [null => null] + EventType::getOptions();
     $grid = new Grid($this, $name);
     $grid->setModel($this->eventsService->getEventsDataSource());
     $grid->setTranslator($this->getTranslator());
     $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', 'Titulek')->setTruncate(20)->setSortable()->setFilterText();
     $headerTitle = $grid->getColumn('title')->headerPrototype;
     $headerTitle->class[] = 'center';
     $grid->addColumnText('eventType', 'Typ')->setCustomRender($this->typeRender)->setSortable()->setFilterSelect($eventTypes);
     $headerType = $grid->getColumn('eventType')->headerPrototype;
     $headerType->class[] = 'center';
     $grid->addColumnDate('takePlaceSince', 'Od', self::DATETIME_FORMAT)->setSortable()->setFilterDateRange();
     $headerSince = $grid->getColumn('takePlaceSince')->headerPrototype;
     $headerSince->class[] = 'center';
     $grid->addColumnDate('takePlaceTill', 'Do', self::DATETIME_FORMAT)->setSortable()->setFilterDateRange();
     $headerTill = $grid->getColumn('takePlaceTill')->headerPrototype;
     $headerTill->class[] = 'center';
     $grid->addColumnDate('confirmUntil', 'Potvrdit', self::DATETIME_FORMAT)->setSortable();
     $headerDead = $grid->getColumn('confirmUntil')->headerPrototype;
     $headerDead->class[] = 'center';
     $grid->addActionHref('delete', '', 'deleteEvent!')->setIcon('trash')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("eventsModule.grid.deleteEvent")]))->setConfirm(function ($u) {
         return $this->tt("eventsModule.admin.grid.rlyDelEvent", null, ["id" => $u->getId()]);
     });
     $grid->addActionHref("participation", "", "updateParticipation")->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("eventsModule.grid.updateParticipation")]))->setIcon("list-alt");
     $grid->addActionHref('edit', '', 'updateEvent')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("eventsModule.grid.updateEvent")]))->setIcon('pencil');
     $grid->setOperation(["delete" => "Delete"], $this->eventsGridOperationHandler)->setConfirm('delete', 'Are you sure you want to delete %i items?');
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->setExport("admin-events" . date("Y-m-d H:i:s", time()));
 }
Exemplo n.º 14
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;
 }
Exemplo n.º 15
0
 protected function createComponentSongList($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->songy->findAll());
     $grid->addColumnDate("datum", "Datum", "d.m.y")->setSortable()->setFilterDateRange();
     $grid->addColumnText("interpret_name", "Interpret")->setCustomRender(function ($item) {
         return $item->interpret_name . ($item->interpret ? " " . Html::el('i')->addAttributes(['class' => 'fa fa-ticket', 'title' => 'Asociován s ' . $item->interpret->nazev]) : null);
     })->setSortable()->setFilterText()->setSuggestion();
     $grid->addColumnText("name", "Song")->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)")->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("pecka", "Pecka")->setReplacement(array(0 => '', 1 => Html::el('i')->addAttributes(['class' => 'fa fa-check'])))->setFilterCheck()->setCondition(" = 1");
     $grid->addColumnText("instro", "Instro")->setReplacement(array(0 => '', 1 => Html::el('i')->addAttributes(['class' => 'fa fa-check'])))->setFilterCheck()->setCondition(" = 1");
     $grid->addColumnText("remix", "Remix")->setReplacement(array(0 => '', 1 => Html::el('i')->addAttributes(['class' => 'fa fa-check'])))->setFilterCheck()->setCondition(" = 1");
     $grid->addColumnNumber("likes", Html::el('i')->addAttributes(['class' => 'fa fa-heart']))->setCustomRender(function ($item) {
         return $item->related("song_likes")->count();
     });
     $grid->addActionHref("editor", "Editovat")->setIcon("pencil");
     $grid->addActionHref('delete', 'Smazat', 'deleteSong!')->setIcon('trash')->setConfirm('Opravdu chcete smazat tento song?');
     $grid->setFilterRenderType(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;
 }
Exemplo n.º 16
0
 /**
  * @param $name
  * @return Grid
  * @throws \Grido\Exception
  */
 protected function createComponentGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->translator->lang = 'cs';
     $fluent = $this->commentsRepository->getAll();
     $grid->model = $fluent;
     $grid->addColumnText('author', 'Autor')->setSortable()->setFilterText();
     $grid->addColumnDate('date', 'Datum')->setSortable()->setFilterText();
     $grid->addColumnText('allowed', 'Schváleno')->setCustomRender(function ($item) {
         if ($item['allowed'] === 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("allowed!", $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("allowed!", $item['id']))->setHtml($i);
         }
         return $el;
     })->cellPrototype->class[] = 'center';
     $grid->addColumnText('text', 'Text')->setCustomRender(function ($item) {
         $el = Html::el('span')->setText(Strings::substring($item['text'], 0, 80));
         return $el;
     });
     $grid->getColumn('text')->headerPrototype->style['width'] = '90%';
     $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->setDefaultSort(['date' => 'DESC']);
     $grid->setDefaultPerPage(50);
     $grid->filterRenderType = $this->filterRenderType;
     $grid->setExport();
     return $grid;
 }
Exemplo n.º 17
0
 /**
  * Component factory for Roles administration grid
  * @param string $name
  */
 public function createComponentRolesGrid($name)
 {
     $grid = new \Grido\Grid($this, $name);
     $grid->setModel($this->roleService->getRolesDatasource());
     $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', 'Jméno')->setSortable()->setFilterText();
     $grid->getColumn('name')->getEditableControl()->setRequired('Name is required.');
     $headerName = $grid->getColumn('name')->headerPrototype;
     $headerName->class[] = 'center';
     $grid->addColumnText('parents', 'Rodiče')->setSortable()->setFilterText();
     $grid->getColumn('parents')->setCustomRender(callback($this, 'roleParColToString'));
     $headerParent = $grid->getColumn('parents')->headerPrototype;
     $headerParent->class[] = 'center';
     $grid->addColumnDate('added', 'Přidáno')->setSortable();
     $headerAdded = $grid->getColumn('added')->headerPrototype;
     $headerAdded->class[] = 'center';
     $grid->addColumnText('note', 'Poznámka')->setCustomRender($this->noteGridRender)->setSortable()->setTruncate(20)->setFilterText();
     $headerNote = $grid->getColumn('note')->headerPrototype;
     $headerNote->class[] = 'center';
     $grid->addActionHref('delete', '', 'deleteRole!')->setIcon('trash')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("securityModule.admin.grid.delete")]))->setConfirm(function ($u) {
         return $this->tt("securityModule.admin.grid.rlyDeleteRole", null, ["pos" => $u]);
     });
     $grid->addActionHref('edit', '', 'updateRole')->setIcon('pencil')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("securityModule.admin.grid.update")]));
     $grid->setOperation(["delete" => $this->tt("system.common.delete")], $this->roleGridOpsHandler);
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->setExport("admin-roles " . date("Y-m-d H:i:s", time()));
 }
Exemplo n.º 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;
 }
Exemplo n.º 19
0
 /**
  * Component factory of UsersGrid
  * @param string $name
  * @return \Grido\Grid
  */
 public function createComponentUsersGrid($name)
 {
     $grid = new Grid($this, $name);
     $grid->setModel($this->userService->getUsersDatasource());
     $grid->translator->lang = $this->getLocale();
     $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('surname', 'Příjmení')->setSortable()->setFilterText();
     $headerSurname = $grid->getColumn('surname')->headerPrototype;
     $headerSurname->class[] = 'center';
     $grid->addColumnText('name', 'Jméno')->setSortable()->setFilterText();
     $headerName = $grid->getColumn('name')->headerPrototype;
     $headerName->class[] = 'center';
     //	$grid->addFilterCustom('nameOrSurname', new \Nette\Forms\Controls\TextArea('Jméno nebo příjmení'))
     //		->setColumn('name')
     //		->setColumn('surname', \Grido\Components\Filters\Condition::OPERATOR_OR)
     //		->setCondition('LIKE ?')
     //		->setFormatValue('%%value%');
     //$grid->getColumn('name')->getCellPrototype()->class('textleft');
     $y = $this->tt("system.common.yes");
     $n = $this->tt("system.common.no");
     $activeList = [null => null, true => $y, false => $n];
     $grid->addColumnNumber('active', 'Aktivní')->setReplacement([true => $y, null => $n])->setSortable()->setFilterSelect($activeList);
     $headerActive = $grid->getColumn('active')->headerPrototype;
     $headerActive->class[] = 'center';
     $grid->addColumnDate('lastLogin', 'Posl. přihl.', self::DATETIME_FORMAT)->setSortable()->setReplacement([NULL => $this->tt("usersModule.admin.grid.never")])->setFilterDateRange();
     $headerLast = $grid->getColumn('lastLogin')->headerPrototype;
     $headerLast->class[] = 'center';
     $grid->addColumnDate('created', 'Registrován')->setSortable();
     $headerCreated = $grid->getColumn('created')->headerPrototype;
     $headerCreated->class[] = 'center';
     $grid->addActionHref("regenPassword", "", 'regenPassword!')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("usersModule.admin.grid.pwRegen")]))->setIcon('lock')->setConfirm(function ($u) {
         return "Are you sure you want to regenerate password for user {$u->surname} {$u->name} ({$u->id})?";
     });
     $grid->addActionHref('delete', '', "deleteUser!")->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("usersModule.admin.grid.delete")]))->setIcon('trash')->setConfirm(function ($u) {
         return "Are you sure you want to delete user {$u->surname} {$u->name} ({$u->id})?";
     });
     $grid->addActionHref('update', '', 'updateUser')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("usersModule.admin.grid.update")]))->setIcon('pencil');
     $grid->addActionHref('webProfile', '', 'updateWebProfile')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("usersModule.admin.grid.updateWp")]))->setIcon('th-list');
     $operation = array('delete' => 'Delete', 'activeToggle' => 'ActiveToggle');
     $grid->setOperation($operation, $this->usersGridOperationsHandler)->setConfirm('delete', $this->tt("usersModule.admin.grid.reallyDeleteItems"));
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->setExport("admin-users " . date("Y-m-d H:i:s", time()));
     return $grid;
 }
Exemplo n.º 20
0
 /**
  *
  * @param string $name
  * @param string $label
  * @param boolean $default
  * @return \Grido\Components\Columns\Date
  */
 public function addColumnTime($name, $label, $dateFormat = 'H:i:s', $default = TRUE)
 {
     $column = parent::addColumnDate($name, $label, $dateFormat);
     if ($default === TRUE) {
         $column->setSortable()->setFilterDate();
     }
     return $column;
 }
Exemplo n.º 21
0
 public function createComponentForumGrid($name)
 {
     $users = [null => null] + $this->getSelectUsers();
     $grid = new Grid($this, $name);
     $grid->setModel($this->forumService->getForumDataSource());
     $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', "communicationModule.admin.grid.title")->setTruncate(20)->setSortable()->setFilterText();
     $headerTitle = $grid->getColumn('title')->headerPrototype;
     $headerTitle->class[] = 'center';
     $grid->addColumnText('author', "communicationModule.admin.grid.author")->setSortable()->setFilterSelect($users);
     $headerAuthor = $grid->getColumn('author')->headerPrototype;
     $headerAuthor->class[] = 'center';
     $grid->addColumnDate('updated', "communicationModule.admin.grid.change", self::DATETIME_FORMAT)->setSortable()->setFilterDateRange();
     $headerAuthor = $grid->getColumn('updated')->headerPrototype;
     $headerAuthor->class[] = 'center';
     $grid->addActionHref('delete', '', 'deleteForum!')->setIcon('trash')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("communicationModule.admin.grid.delete")]))->setConfirm(function ($u) {
         return $this->tt("communicationModule.admin.grid.messages.rlyDelForum", null, ["id" => $u->getId()]);
     });
     $grid->addActionHref('edit', '', 'updateForum')->setIcon('pencil')->setElementPrototype(\Nette\Utils\Html::el("a")->addAttributes(["title" => $this->tt("communicationModule.admin.grid.update")]));
     $grid->setOperation(["delete" => "communicationModule.admin.grid.delete"], $this->forumGridOpsHandler)->setConfirm("delete", "communicationModule.admin.grid.messages.rlyDelForumItems");
     $grid->setFilterRenderType($this->filterRenderType);
     $grid->setExport("admin-forum" . date("Y-m-d H:i:s", time()));
     return $grid;
 }