Пример #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()));
 }
Пример #2
0
 private function getSelectSeasons()
 {
     try {
         if (!isset($this->selectSeasons)) {
             $this->selectSeasons = $this->seasonService->getSelectSeasons();
         }
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataLoad(null, self::LAST_CHANCE_REDIRECT, $ex);
     }
     return $this->selectSeasons;
 }
Пример #3
0
 /**
  * @Secured(resource="setSeasonCurrent")
  */
 public function handleSetSeasonCurrent($id)
 {
     if (!is_numeric($id)) {
         $this->handleBadArgument($id);
     }
     try {
         $this->seasonService->setSeasonCurrent($id);
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataSave($id, "this", $ex);
     }
     $this->redirect("this");
 }
Пример #4
0
 private function entrySeasonTypeHandle(MotivationEntry $t)
 {
     if ($t == null) {
         throw new Exceptions\NullPointerException("Argument MotivationTax cannot be null");
     }
     try {
         $season = $this->getMixId($t->getSeason());
         $sportGroup = $this->seasonService->getSeason($season, false);
         $t->setSeason($sportGroup);
         return $t;
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
Пример #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()));
 }
Пример #6
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;
 }
Пример #7
0
 protected function createComponentSeasonInfoControl($name)
 {
     $current = null;
     $c = new SeasonInfoControl($this, $name);
     try {
         $current = $this->seasonService->getCurrentSeason();
     } catch (\App\Model\Misc\Exceptions\DataErrorException $ex) {
     }
     $c->setSeason($current);
     return $c;
 }