コード例 #1
0
ファイル: RoutePresenter.php プロジェクト: svobodni/web
 public function renderDefault()
 {
     $cache = new Cache($this->cacheStorage, static::CACHE_NAMESPACE . '-' . $this->pageId);
     $values = $cache->load('values');
     if ($values === null) {
         try {
             $values = $this->pageService->getTransfers($this->getExtendedPage()->getAccountNumber());
         } catch (InvalidStateException $e) {
             $this->flashMessage('Nepodařilo se načíst data z transparentního účtu, zkuste to za chvíli znovu.');
             return;
         }
         $cache->save('values', $values, array(Cache::EXPIRE => '30 minutes'));
     }
     $this->template->transfers = $values['transfers'];
     $this->template->state = $values['state'];
 }
コード例 #2
0
ファイル: FioElement.php プロジェクト: svobodni/web
 public function renderDefault()
 {
     if ($this->getExtendedElement()->getPage() === null) {
         $this->template->warning = true;
         return;
     }
     $cache = new Cache($this->cacheStorage, static::CACHE_NAMESPACE . '-' . $this->getExtendedElement()->getPage()->getId());
     $values = $cache->load('values');
     if ($values === null) {
         try {
             $values = $this->pageService->getTransfers($this->getExtendedElement()->getPage()->getAccountNumber(), $this->getExtendedElement()->getItemsPerPage(), null, null);
         } catch (InvalidStateException $e) {
             $this->template->error = true;
             return;
         }
         $cache->save('values', $values, array(Cache::EXPIRE => '30 minutes'));
     }
     $this->template->transfers = $values['transfers'];
     $this->template->state = $values['state'];
 }