function detailAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $page = $this->_getParam('page') ? $this->_getParam('page') : ''; // get current ip address $ip = Pandamp_Lib_Formater::getRealIpAddr(); $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute(); $decorator = new Pandamp_BeanContext_Decorator($modelCatalog); $rowset = $decorator->getCatalogByGuidAsEntity($catalogGuid); if (isset($rowset)) { $modelAsset = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting(); } $decorator = new Pandamp_BeanContext_Decorator($modelAsset); $rowAsset = $decorator->getAssetNumOfClickAsEntity($catalogGuid); $data = array('guid' => $catalogGuid, 'application' => 'ASSET', 'part' => 'MOST_READABLE_TICKER', 'valueType' => $ip, 'valueInt' => 1, 'valueText' => 'TICKER'); $asset = $modelAsset->addCounterAsset($rowset->getId(), $data); $title = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedTitle'); $subtitle = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedSubTitle'); $content = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedContent'); $description = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedDescription'); $author = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedAuthor'); $array_hari = array(1 => "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu"); $hari = $array_hari[date("N", strtotime($rowset->getCreatedDate()))]; // get votes $modelVote = new Pandamp_Modules_Extension_Vote_Model_Vote(); $decorator = new Pandamp_BeanContext_Decorator($modelVote); $rowRate = $decorator->getRatingAsEntity($catalogGuid, $ip); $val = $rowRate ? $rowRate->getValue() : 0; $counter = $rowRate ? $rowRate->getCounter() : 0; if ($counter < 1) { $count = 0; } else { $count = $counter; //how many votes total } $current_rating = $val; $tense = $count == 1 ? "vote" : "votes"; //plural form votes/vote $rating = @number_format($current_rating / $count, 1); $drawrating = '(' . $count . ' ' . $tense . ', average: ' . $rating . ' out of 5)'; $this->view->title = $title; $this->view->subtitle = $subtitle; $this->view->content = $content; $this->view->description = $description; $this->view->author = $author; $this->view->date = $hari . ', ' . date("d F Y", strtotime($rowset->getPublishedDate())); $this->view->numOfClick = isset($rowAsset) ? $rowAsset->getValueInt() : 0; $this->view->drawrating = $drawrating; $this->view->catalogGuid = $catalogGuid; $this->view->page = $page; }
function klideAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $ip = Pandamp_Lib_Formater::getRealIpAddr(); $modelCatalog = new Pandamp_Modules_Dms_Catalog_Model_Catalog(); $modelCatalogAttribute = new Pandamp_Modules_Dms_Catalog_Model_CatalogAttribute(); $decorator = new Pandamp_BeanContext_Decorator($modelCatalog); $rowset = $decorator->getCatalogByGuidAsEntity($catalogGuid); if ($rowset) { $modelAsset = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting(); $decorator = new Pandamp_BeanContext_Decorator($modelAsset); $rowAsset = $decorator->getAssetNumOfClickAsEntity($catalogGuid); $data = array('guid' => $catalogGuid, 'application' => 'ASSET', 'part' => 'MOST_READABLE_CLINIC', 'valueType' => $ip, 'valueInt' => 1, 'valueText' => 'klinik'); $asset = $modelAsset->addCounterAsset($rowset->getId(), $data); $title = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedCommentTitle'); $question = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedCommentQuestion'); $category = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedKategoriKlinik'); $answer = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedAnswer'); $author = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedSelectNama'); $source = $modelCatalogAttribute->getCatalogAttributeValue($rowset->getId(), 'fixedSelectMitra'); $this->view->title = isset($title) ? $title : ''; $this->view->question = isset($question) ? $question : ''; $this->view->category = isset($category) ? $category : ''; $this->view->answer = isset($answer) ? $answer : ''; $this->view->author = isset($author) ? $author : ''; $this->view->source = isset($source) ? $source : ''; $this->view->createdBy = $rowset->getCreatedBy(); $this->view->publishedDate = Pandamp_Lib_Formater::get_date($rowset->getPublishedDate()); $this->view->numofclick = isset($rowAsset) ? $rowAsset->getValueInt() : 0; // get votes $modelVote = new Pandamp_Modules_Extension_Vote_Model_Vote(); $decorator = new Pandamp_BeanContext_Decorator($modelVote); $rowRate = $decorator->getRatingAsEntity($catalogGuid, $ip); $val = $rowRate ? $rowRate->getValue() : 0; $counter = $rowRate ? $rowRate->getCounter() : 0; if ($counter < 1) { $count = 0; } else { $count = $counter; //how many votes total } $current_rating = $val; $tense = $count == 1 ? "vote" : "votes"; //plural form votes/vote $rating = @number_format($current_rating / $count, 1); $drawrating = '(' . $count . ' ' . $tense . ', average: ' . $rating . ' out of 5)'; $this->view->drawrating = $drawrating; $this->view->catalogGuid = $catalogGuid; } }