/** * @return obj */ public function show() { if (!isset(self::$_instance)) { $show = __CLASS__; self::$_instance = new $show(); } return self::$_instance; }
function klideAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $ip = Pandamp_Lib_Formater::getRealIpAddr(); $rowset = App_Model_Show_Catalog::show()->getCatalogByGuid($catalogGuid); if ($rowset) { $rowAsset = App_Model_Show_AssetSetting::show()->getAssetNumOfClick($catalogGuid); $data = array('guid' => $catalogGuid, 'application' => 'ASSET', 'part' => 'MOST_READABLE_CLINIC', 'valueType' => $ip, 'valueInt' => 1, 'valueText' => 'klinik'); $asset = App_Model_Show_AssetSetting::show()->addCounterAsset($rowset['guid'], $data); $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedCommentTitle'); $question = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedCommentQuestion'); $category = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedKategoriKlinik'); $answer = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedAnswer'); $author = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedSelectNama'); $source = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedSelectMitra'); $dateDiff = new Pandamp_Lib_DateDiff(); $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['createdBy']; //$this->view->publishedDate = Pandamp_Lib_Formater::get_date($rowset['publishedDate']); //$this->view->publishedDate = $dateDiff->ago(strftime('%Y-%m-%d %H:%M:%S',strtotime($rowset['publishedDate']))); $this->view->publishedDate = date("d/m/Y", strtotime($rowset['publishedDate'])); $this->view->createdDate = $dateDiff->ago(strftime('%Y-%m-%d %H:%M:%S', strtotime($rowset['createdDate']))); $this->view->numofclick = isset($rowAsset) ? $rowAsset['valueInt'] : 0; // get votes $rowRate = App_Model_Show_Vote::show()->getRating($catalogGuid, $ip); $val = $rowRate ? $rowRate['value'] : 0; $counter = $rowRate ? $rowRate['counter'] : 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; } }
function detailAction() { $catalogGuid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; // get current ip address $ip = Pandamp_Lib_Formater::getRealIpAddr(); $rowset = App_Model_Show_Catalog::show()->getCatalogByGuid($catalogGuid); if (isset($rowset)) { $rowAsset = App_Model_Show_AssetSetting::show()->getAssetNumOfClick($catalogGuid); } $data = array('guid' => $catalogGuid, 'application' => 'ASSET', 'part' => 'MOST_READABLE_TICKER', 'valueType' => $ip, 'valueInt' => 1, 'valueText' => 'TICKER'); $asset = App_Model_Show_AssetSetting::show()->addCounterAsset($rowset['guid'], $data); $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedTitle'); $subtitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedSubTitle'); $content = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedContent'); $description = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedDescription'); $author = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset['guid'], 'fixedAuthor'); $array_hari = array(1 => "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu"); $hari = $array_hari[date("N", strtotime($rowset['createdDate']))]; // get votes $rowRate = App_Model_Show_Vote::show()->getRating($catalogGuid, $ip); $val = $rowRate ? $rowRate['value'] : 0; $counter = $rowRate ? $rowRate['counter'] : 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['publishedDate'])); $this->view->numOfClick = isset($rowAsset) ? $rowAsset['valueInt'] : 0; $this->view->drawrating = $drawrating; $this->view->catalogGuid = $catalogGuid; }
public function dcAction() { $request = $this->getRequest(); $y = $request->getParam('y'); $sort = $request->getParam('sort') ? $request->getParam('sort') : ''; $p = $request->getParam('p') ? $request->getParam('p') : ''; $by = $request->getParam('by') ? $request->getParam('by') : ''; $author = $request->getParam('author') ? $request->getParam('author') : ''; $ac = $request->getParam('authorclinic') ? $request->getParam('authorclinic') : ''; $regulation = $request->getParam('regulation') ? $request->getParam('regulation') : ''; $pageIndex = $request->getParam('page', 1); $perPage = $request->getParam('perpage', 10); $offset = ($pageIndex - 1) * $perPage; $pageRange = 10; if ($sort) { $sort = ';' . $sort; } else { $sort = ''; } if ($by) { $createdBy = ' createdBy:' . $by; } else { $createdBy = ''; } if ($author) { $fauthor = ' author:' . $author; } else { $fauthor = ''; } if ($ac) { $fac = ' kontributor:' . $ac; } else { $fac = ''; } if ($regulation) { $regulationType = ' regulationType:' . $regulation; } else { $regulationType = ''; } if ($p == 'peraturan') { $profile = 'profile:(kutu_peraturan OR kutu_peraturan_kolonial OR kutu_rancangan_peraturan)'; } else { if ($p == 'article') { $profile = 'profile:(article OR isuhangat)'; } else { if ($p == 'klinik') { $profile = 'profile:klinik'; } else { $profile = 'profile:kutu_putusan'; } } } $querySolr = $profile . $regulationType . $createdBy . $fauthor . $fac . " createdDate:{$y}*{$sort}"; /* $db = Zend_Db_Table::getDefaultAdapter()->query ("SELECT guid from KutuCatalog where profileGuid IN ('kutu_peraturan','kutu_peraturan_kolonial','kutu_rancangan_peraturan') AND YEAR(createdDate)='". $y ."'"); $rowset = $db->fetchAll(Zend_Db::FETCH_OBJ); $numi = count($rowset); */ $solrAdapter = Pandamp_Search::manager(); /* $sSolr = "id:("; for($i=0;$i<$numi;$i++) { $row = $rowset[$i]; $sSolr .= $row->guid .' '; } $sSolr .= ')'; if(!$numi) $sSolr="id:(hfgjhfdfka)"; */ $solrResult = $solrAdapter->find($querySolr, $offset, $perPage); $solrNumFound = count($solrResult->response->docs); /*$solrResult = $solrAdapter->findAndSort($sSolr,$offset,$perPage, 'date desc'); $solrNumFound = $solrResult->response->numFound;*/ $content = 0; $data = array(); if ($solrNumFound == 0) { } else { for ($ii = 0; $ii < $solrNumFound; $ii++) { if (isset($solrResult->response->docs[$ii])) { $row = $solrResult->response->docs[$ii]; if (!empty($row)) { $data[$ii][0] = $row->id; $data[$ii][1] = $row->title; $data[$ii][2] = $row->createdDate; $data[$ii][3] = $row->modifiedDate; $data[$ii][4] = $row->createdBy; $data[$ii][5] = $row->modifiedBy; if ($p == 'peraturan') { $rowAssetDesktop = App_Model_Show_AssetSetting::show()->getHits($row->id, 'pusatdata'); $rowAssetMobile = App_Model_Show_AssetSetting::show()->getHits($row->id, 'pusatdata-mobile'); $data[$ii][6] = $rowAssetDesktop ? $rowAssetDesktop['valueInt'] . ' hits' : ''; $data[$ii][7] = $rowAssetMobile ? $rowAssetMobile['valueInt'] . ' hits' : ''; $data[$ii][8] = isset($row->number) ? $row->number : ''; $data[$ii][9] = $row->year; $data[$ii][10] = isset($row->date) ? $row->date : ''; $data[$ii][11] = isset($row->regulationType) ? $row->regulationType : ''; } else { if ($p == 'article') { $rowAssetDesktop = App_Model_Show_AssetSetting::show()->getHits($row->id, 'TICKER'); $rowAssetMobile = App_Model_Show_AssetSetting::show()->getHits($row->id, 'TICKER-MOBILE'); $data[$ii][6] = $rowAssetDesktop ? $rowAssetDesktop['valueInt'] . ' hits' : ''; $data[$ii][7] = $rowAssetMobile ? $rowAssetMobile['valueInt'] . ' hits' : ''; $data[$ii][8] = isset($row->publishedDate) ? $row->publishedDate : ''; $data[$ii][9] = isset($row->author) ? $row->author : ''; } } } } } $this_url = $this->getRequest()->getRequestUri(); $this_url = str_replace("&page={$pageIndex}", "", $this_url); if (strpos($this_url, '?')) { $sAddition = '&'; } else { $sAddition = '?'; } /** * Paginator */ $paginator = Zend_Paginator::factory($solrResult->response->numFound); $paginator->setCurrentPagenumber($pageIndex); $paginator->setItemCountPerPage($perPage); $paginator->setPageRange($pageRange); $scrollType = 'Sliding'; //change this to 'All', 'Elastic', 'Sliding' or 'Jumping' to test all scrolling types $paginator = get_object_vars($paginator->getPages($scrollType)); $this->view->assign('this_url', $this_url . $sAddition); $this->view->assign('pageIndex', $pageIndex); $this->view->assign('paginator', $paginator); $this->view->assign('data', $data); $this->view->assign('numberOfRows', $solrNumFound); } $this->view->assign('y', $y); $this->view->assign('p', $p); $this->view->assign('by', $by); $this->view->assign('sort', $sort); $this->view->assign('author', $author); $this->view->assign('authorclinic', $ac); $this->view->assign('perpage', $perPage); $this->view->assign('regulation', $regulation); //$this->view->assign('totalOfRows', $numi); $this->view->assign('totalOfRows', $solrResult->response->numFound); }
function peraturanpilihanAction() { $rowset = App_Model_Show_AssetSetting::show()->getAsset("valueText='pusatdata'", 3); $content = 0; $data = array(); foreach ($rowset as $row) { $rowCatalog = App_Model_Show_Catalog::show()->getCatalogByGuid($row['guid']); if ($rowCatalog) { $title = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowCatalog['guid'], 'fixedTitle'); $subTitle = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowCatalog['guid'], 'fixedSubTitle'); $data[$content][0] = $title; $data[$content][1] = isset($subTitle) ? $subTitle : ''; $data[$content][2] = $row['guid']; $data[$content][3] = $row['detail']; } $content++; } $num_rows = count($rowset); $this->view->numberOfRows = $num_rows; $this->view->data = $data; }