Example #1
0
 public function loadAction()
 {
     $perPage = (int) $this->getParam('limit', 10);
     $pageIndex = (int) $this->getParam('pageIndex', 1);
     $paramString = $this->getParam('paramString');
     $offset = (int) ($pageIndex - 1) * $perPage;
     /**
      * Get comments by paramString
      */
     $numComments = Modules_Comment_Services_Comment::countThreadComments($paramString, 'active');
     $comments = Modules_Comment_Services_Comment::getThreadComments($offset, $perPage, $paramString, 'active');
     $this->view->comments = $comments;
     $this->view->numComments = $numComments;
     // Pager
     require_once LIB_DIR . DS . 'PEAR' . DS . 'Pager' . DS . 'Sliding.php';
     $pagerOptions = array('mode' => 'Sliding', 'append' => false, 'perPage' => $perPage, 'delta' => 3, 'urlVar' => 'page', 'path' => '', 'fileName' => 'javascript: Comment.Widgets.Comment.loadComments(%d)', 'separator' => '', 'nextImg' => '<small class="icon arrow_right"></small>', 'prevImg' => '<small class="icon arrow_left"></small>', 'altNext' => '', 'altPrev' => '', 'altPage' => '', 'totalItems' => $numComments, 'currentPage' => $pageIndex, 'urlSeparator' => '/', 'spacesBeforeSeparator' => 0, 'spacesAfterSeparator' => 0, 'curPageSpanPre' => '<a href="javascript: void();" class="current">', 'curPageSpanPost' => '</a>');
     $pager = new Pager_Sliding($pagerOptions);
     $this->view->pager = $pager;
 }
Example #2
0
 public function threadAction()
 {
     $request = $this->getRequest();
     $perPage = 20;
     $pageIndex = (int) $request->getParam('page_index');
     if (null == $pageIndex || '' == $pageIndex || $pageIndex < 0) {
         $pageIndex = 1;
     }
     $start = ($pageIndex - 1) * $perPage;
     $this->view->pageIndex = $pageIndex;
     $paramsString = $request->getParam('params');
     $comments = Modules_Comment_Services_Comment::getThreadComments($start, $perPage, $paramsString);
     $total = Modules_Comment_Services_Comment::countThreadComments($paramsString);
     print_r($comments);
     die;
     $this->view->comments = $comments;
     // Pager
     require_once LIB_DIR . DS . 'PEAR' . DS . 'Pager' . DS . 'Sliding.php';
     $pagerPath = $this->view->url('comment_comment_thread', array('params' => $paramsString));
     $pagerOptions = array('mode' => 'Sliding', 'append' => false, 'perPage' => $perPage, 'delta' => 3, 'urlVar' => 'page', 'path' => $pagerPath, 'fileName' => 'page-%d', 'separator' => '', 'nextImg' => '<small class="icon arrow_right"></small>', 'prevImg' => '<small class="icon arrow_left"></small>', 'altNext' => '', 'altPrev' => '', 'altPage' => '', 'totalItems' => $total, 'currentPage' => $pageIndex, 'urlSeparator' => '/', 'spacesBeforeSeparator' => 0, 'spacesAfterSeparator' => 0, 'curPageSpanPre' => '<a href="javascript: void();" class="current">', 'curPageSpanPost' => '</a>');
     $pager = new Pager_Sliding($pagerOptions);
     $this->view->pager = $pager;
 }