コード例 #1
0
ファイル: Pagination.php プロジェクト: jinshana/tangocms
 /**
  * Makes a correct URL needed for all of the pagination links
  *
  * @param int $page
  * @return string
  */
 protected function makeUrl($page = 1)
 {
     $page = abs($page);
     if ($this->requestPath) {
         $url = new Router_Url($this->requestPath);
     } else {
         // Use the current parsed URL as a base
         $url = new Router_Url($this->_router->getRawRequestPath());
         if ($this->appendQuery) {
             $url->queryArgs($this->_router->getParsedUrl()->getAllQueryArgs());
         }
     }
     if ($page > 1) {
         $url->queryArgs(array($this->urlArgument => $page));
     } else {
         $url->removeQueryArgs($this->urlArgument);
     }
     return $url->make();
 }