コード例 #1
0
ファイル: SendStatsForm.php プロジェクト: jaromir92/Sportwin
 public function sendStatsFormSucceeded(Form $form, $values)
 {
     $month = $form->getPresenter()->month;
     $year = $form->getPresenter()->year;
     try {
         $stats = $this->statisticFacade->findAll($month, $year);
     } catch (EntitiesNotFoundException $ex) {
         \Tracy\Debugger::log($ex);
         $stats = null;
     }
     $monthInWords = DateTimeUtils::getMonthByIndex($month);
     $this->mailSender->send("*****@*****.**", $values->email, "Statistiky za {$monthInWords} {$year}", $this->createSendStatisticTemplate($form, $stats, $monthInWords, $year));
     $form->getPresenter()->flashMessage("Statistiky za {$monthInWords} {$year} byly úspěšně odeslány.", "alert-success");
     $form->getPresenter()->redirect("this");
 }
コード例 #2
0
 public function actionDefault()
 {
     if ($this->firstLoad) {
         $this->template->stats = null;
         $this->template->firstLoad = true;
     } else {
         try {
             $this->template->stats = $this->statisticFacade->findAll($this->month, $this->year);
         } catch (EntitiesNotFoundException $ex) {
             \Tracy\Debugger::log($ex);
             $this->template->stats = null;
         } finally {
             $this["generateStatsForm"]->setDefaults(array("month" => $this->month, "year" => $this->year));
             $this->template->firstLoad = false;
             $this->template->month = DateTimeUtils::getMonthByIndex($this->month);
             $this->template->year = $this->year;
         }
     }
 }
コード例 #3
0
 public function renderDefault()
 {
     try {
         $this->template->articles = $this->articleFacade->findByArticlesFilter($this->month, $this->year, $this->userId);
     } catch (EntityNotFoundException $ex) {
         \Tracy\Debugger::log($ex);
         $this->template->articles = false;
     } finally {
         $this->template->month = DateTimeUtils::getMonthByIndex($this->month);
         $this->template->year = $this->year;
         if ($this->userId > 0) {
             $this->template->filterUser = $this->userFacade->findOneById($this->userId);
         } else {
             $this->template->filterUser = false;
         }
     }
 }