Esempio n. 1
0
 /**
  * Renders paginator.
  * @return void
  */
 public function render()
 {
     $page = $this->paginator->page;
     if ($this->paginator->pageCount < 2) {
         $steps = array($page);
     } else {
         $arr = range(max($this->paginator->firstPage, $page - 3), min($this->paginator->lastPage, $page + 3));
         $count = 4;
         $quotient = ($this->paginator->pageCount - 1) / $count;
         for ($i = 0; $i <= $count; $i++) {
             $arr[] = round($quotient * $i) + $this->paginator->firstPage;
         }
         sort($arr);
         $steps = array_values(array_unique($arr));
     }
     $template = new NTemplate();
     $template->registerFilter(new NLatteFilter());
     $template->steps = $steps;
     $template->url = $this->url;
     $template->var_name = $this->var_name;
     $template->paginator = $this->paginator;
     $template->setFile(dirname(__FILE__) . '/template.phtml');
     return $template->render();
 }
Esempio n. 2
0
File: loader.php Progetto: GE3/GE3
 static function getCacheStorage()
 {
     if (self::$cacheStorage === NULL) {
         self::$cacheStorage = new NTemplateCacheStorage(NEnvironment::getVariable('tempDir'));
     }
     return self::$cacheStorage;
 }