function listcommentAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $page = $this->_getParam('page') ? $this->_getParam('page') : 1; $limit = 25; $start = $limit * ($page - 1); sleep(2); $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem(); $rowset = $tblRelatedItem->fetchAll("relatedGuid='{$catalogGuid}' AND relateAs='RELATED_COMMENT'"); $relatedGuid = array(); foreach ($rowset as $related) { $relatedGuid[] = $related->itemGuid; } if ($relatedGuid) { $data = Pandamp_Lib_Formater::implode_with_keys(", ", $relatedGuid, "'"); $tblCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $rowset = $tblCatalog->fetchAll("guid in({$data}) AND status=99", '', $limit, $start); $rowset1 = $tblCatalog->fetchAll("guid in({$data}) AND status=99"); $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $decorator = new Pandamp_BeanContext_Decorator($modelCatalog); $row = $decorator->getCatalogByGuidAsEntity($catalogGuid); $st = $row->getShortTitle(); $num_rows = count($rowset1); $numPage = ceil($num_rows / $limit); $pagination = ''; for ($i = 1; $i <= $numPage; $i++) { $pagination .= "<li><a href='/berita/baca/{$catalogGuid}/{$st}/p/{$i}' title='Halaman {$i}' rev='{$i}'>{$i}</a></li>"; } // check is AJAX request or not if (!$this->getRequest()->isXmlHttpRequest()) { $this->view->pagination = $pagination; } $this->view->catalogGuid = $catalogGuid; $this->view->numberOfRows = $num_rows; $this->view->rows = $rowset; $this->view->limit = $limit; } }