Esempio n. 1
0
 /**
  * makes sure that all needed vars are initialised
  * also makes sure that all vars are passed to the strategy
  *
  * @access protected
  * @todo implement strategy init
  */
 protected function prepare()
 {
     if ($this->_prepared) {
         return;
     }
     $this->_prepared = true;
     $router = new RequestRouter();
     $req = $router->getRequestAndArgs();
     if (!$this->page_url) {
         $this->page_url = $req->request_uri;
     }
     if (!$this->active_page) {
         $this->active_page = ($page = $this->checkRequestForPageNumber($req)) ? $page : 1;
     }
     $this->cleanPageUrl();
     // need to adjust active page index
     if ($this->active_page > $this->numberOfPages()) {
         $this->active_page = $this->numberOfPages();
     }
     if ($this->active_page < 1) {
         $this->active_page = 1;
     }
     // todo: init strategy object here
     $this->pager_strategy->pager = $this;
     $this->pager_strategy->pages = $this->numberOfPages();
     $this->pager_strategy->active_page = $this->active_page;
 }