function list3Action() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $page = $this->_getParam('page') ? $this->_getParam('page') : 1; $limit = 10; $start = $limit * ($page - 1); sleep(2); $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $decorator = new Pandamp_BeanContext_Decorator($modelCatalog); $rowset = $decorator->getCatalogByGuidAsEntity($catalogGuid); $st = $rowset->getShortTitle(); $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment(); $decorator = new Pandamp_BeanContext_Decorator($modelComment); $rows = $decorator->getCommentByGuidwAjaxAsEntity($catalogGuid, $start, $limit); $tree = new Pandamp_Lib_TuneTree($rows); $items = $tree->get(); $num_rows = $modelComment->getCommentCount($catalogGuid); $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>"; } $this->view->rows = $items; // check is AJAX request or not if (!$this->getRequest()->isXmlHttpRequest()) { $this->view->pagination = $pagination; } $this->view->catalogGuid = $catalogGuid; $this->view->parent = $rows ? $rows[0]->getParent() : 0; }
function commentAction() { $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $rowset = $modelCatalog->fetchAll("profileGuid='comment'"); foreach ($rowset as $row) { $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute(); try { $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment(); $comment = $modelComment->fetchNew(); $tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem(); $rowsetRelatedItem = $tblRelatedItem->fetchRow("itemGuid='" . $row->guid . "' AND relateAs='RELATED_COMMENT'"); $comment->object_id = $rowsetRelatedItem->relatedGuid; $comment->userid = 0; $rowsetCatalogAttribute = $row->findDependentRowsetCatalogAttribute(); $comment->name = $rowsetCatalogAttribute->findByAttributeGuid('fixedName')->value; $comment->email = $rowsetCatalogAttribute->findByAttributeGuid('fixedEmail')->value; $comment->title = $rowsetCatalogAttribute->findByAttributeGuid('fixedJudul')->value; $comment->comment = $rowsetCatalogAttribute->findByAttributeGuid('fixedComment')->value; $comment->ip = 0; $comment->date = $row->createdDate; $comment->published = $row->status; $comment->checked_out_time = $row->publishedDate; $comment->save(); echo $comment->title . ' saved<br>'; } catch (Zend_Exception $e) { echo $e->getMessage() . '<br>'; } } }
public function fetchCommentAction() { $start = $this->_getParam('start') ? $this->_getParam('start') : 0; $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10; $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment(); $decorator = new Pandamp_BeanContext_Decorator($modelComment); $rowset = $decorator->fetchCommentAsEntity($start, $end); $num_rows = $modelComment->getNumOfComment(); $gShort = new Pandamp_Controller_Action_Helper_GetCatalogShortTitle(); $a = array(); $a['totalCount'] = $num_rows; $ii = 0; if ($a['totalCount'] != 0) { foreach ($rowset as $row) { $a['comment'][$ii]['guid'] = $row->getId(); $a['comment'][$ii]['title'] = $row->getTitle(); $a['comment'][$ii]['description'] = $row->getComment(); $a['comment'][$ii]['user_email'] = $row->getEmail(); $a['comment'][$ii]['guid_article'] = $row->getobjectId(); $a['comment'][$ii]['shortarticle'] = $gShort->getCatalogShortTitle($row->getobjectId()); $a['comment'][$ii]['createdby'] = $row->getName(); $a['comment'][$ii]['ip'] = $row->getIp() != 0 ? $row->getIp() : '-'; $a['comment'][$ii]['createdDate'] = Pandamp_Lib_Formater::get_date($row->getDate()); $a['comment'][$ii]['status'] = $row->getPublished(); $ii++; } } if ($a['totalCount'] == 0) { $a['comment'][0]['guid'] = 'XXX'; $a['comment'][0]['title'] = "No Data"; $a['comment'][0]['description'] = "-"; $a['comment'][0]['createdDate'] = ''; } echo Zend_Json::encode($a); }
public function save($aData) { $aResult = array(); $parent = $aData['parent_id']; $objectId = $aData['guid']; $name = $aData['name']; $email = $aData['email']; $title = $aData['title']; $comment = $aData['comment']; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $userId = $auth->getIdentity()->kopel; } else { $userId = 0; } $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment(); $catalogGuid = $modelComment->addComment(array('parent' => $parent, 'object_id' => $objectId, 'userid' => $userId, 'name' => $name, 'email' => $email, 'title' => $title, 'comment' => $comment, 'ip' => Pandamp_Lib_Formater::getRealIpAddr(), 'date' => new Zend_Db_Expr('NOW()'))); return $catalogGuid; }
function deleteAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment(); $rowset = $modelComment->find($catalogGuid); try { $row = $rowset->current(); //$cache = Zend_Registry::get('cache'); //$cacheKey = "comment"; //$cache->remove($cacheKey); $row->delete(); $response['success'] = true; $response['message'] = "Comment deletion success"; } catch (Zend_Exception $e) { $response['success'] = false; $response['error'] = $e->getMessage(); } echo Zend_Json::encode($response); }
public function getNumOfComment($parent) { $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment(); $count = $modelComment->getCommentParentCount($parent); return $count != 0 ? $count . ' Tanggapan' : ''; }
protected function _delete() { $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment(); $modelComment->delete("parent=" . $this->id); }
function detailIndexWartaAction() { $this->_helper->layout->disableLayout(); $folderGuid = $this->_getParam('folderGuid') ? $this->_getParam('folderGuid') : ''; $start = $this->_getParam('start') ? $this->_getParam('start') : 0; $limit = $this->_getParam('limit') ? $this->_getParam('limit') : 0; $a = array(); $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $decorator = new Pandamp_BeanContext_Decorator($modelCatalog); //$rowset = $decorator->fetchFromFolderAsEntity($folderGuid,$start,$limit,'fg_'.$folderGuid.'_detail_warta_s_'.$start.'_e_'.$limit); $rowset = $decorator->fetchFromFolderAsEntity($folderGuid, $start, $limit); $a['folderGuid'] = $folderGuid; $a['totalCount'] = $modelCatalog->getWartaCount($folderGuid); $ii = 0; if ($a['totalCount'] != 0) { foreach ($rowset as $row) { $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute(); //$tblRelatedItem = new Pandamp_Modules_Dms_Catalog_Model_RelatedItem(); //$rowSumComment = $tblRelatedItem->getSumComment($row->getId(), "RELATED_COMMENT"); $modelComment = new Pandamp_Modules_Extension_Comment_Model_Comment(); $rowSumComment = $modelComment->getParentCommentCount($row->getId()); $a['index'][$ii]['title'] = $modelCatalogAttribute->getCatalogAttributeValue($row->getId(), 'fixedTitle'); $a['index'][$ii]['shortTitle'] = $row->getShortTitle(); $a['index'][$ii]['createdDate'] = date("d/m/y", strtotime($row->getCreatedDate())); $a['index'][$ii]['guid'] = $row->getId(); $a['index'][$ii]['comment'] = $rowSumComment != 0 ? '(' . $rowSumComment . ' tanggapan)' : ''; $ii++; } } if ($a['totalCount'] == 0) { $a['index'][0]['title'] = "-"; $a['index'][0]['shortTitle'] = "-"; $a['index'][0]['createdDate'] = "-"; $a['index'][0]['guid'] = "-"; $a['index'][0]['comment'] = "-"; } echo Zend_Json::encode($a); }