Example #1
0
 /**
  * @return obj
  */
 public function show()
 {
     if (!isset(self::$_instance)) {
         $show = __CLASS__;
         self::$_instance = new $show();
     }
     return self::$_instance;
 }
Example #2
0
 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;
     }
 }
Example #3
0
 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;
 }
Example #4
0
 private function uvote($catalogGuid)
 {
     // get current ip address
     $ip = Pandamp_Lib_Formater::getRealIpAddr();
     // 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)';
     return $drawrating;
 }