Beispiel #1
0
 private function _getDescription($row)
 {
     // Variable
     $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
     // Kelas
     $custom = new Budpar_Custom_Common();
     // Data deskripsi destinasi
     $description = $custom->truncate($row['description'], 200);
     $description = strip_tags($description);
     // Format url dari nama destinasi
     $formatUrlName = $custom->makeUrlFormat($row['descname']);
     // Tambahin read more
     $description .= "<span class='read-more'><a onclick=window.open('" . $baseUrl . "/destination/" . $row['poi_id'] . "/" . $formatUrlName . "')>Read More &raquo;</a></span>";
     return $description;
 }
 /**
  *
  * @param integer $poi_id
  * @param integer $language_id
  * @return array
  */
 public function getAllByIdLang($poi_id, $language_id, $isPublish = true, $isApproved = false)
 {
     $custom = new Budpar_Custom_Common();
     $query = $this->select()->from($this->_name, array('poi_id', 'pointX', 'pointY', 'address', 'phone', 'website', 'main_category', 'featured', 'popular', 'image', '(totalrate/totalrater) AS rating', 'totalrater'))->join($this->_poidesc, "{$this->_poidesc}.poi_id = {$this->_name}.poi_id", array('*'))->joinLeft(array("created" => $this->_account), "{$this->_poidesc}.created_by = created.admin_id", array('created_by' => 'IFNULL(created.name, created.username)'))->joinLeft(array("updated" => $this->_account), "{$this->_poidesc}.updated_by = updated.admin_id", array('updated_by' => 'IFNULL(updated.name, updated.username)'))->setIntegrityCheck(false)->where("{$this->_poidesc}.language_id = ?", $language_id)->where("{$this->_name}.poi_id = ?", $poi_id);
     if ($isPublish) {
         $query->where("{$this->_name}.status = ?", self::PUBLISH);
     }
     if ($isApproved) {
         $query->where("{$this->_name}.status = ?", self::PENDING);
     }
     $check = $this->fetchRow($query);
     if ($check != null) {
         $data = $this->fetchRow($query)->toArray();
         if ($data['name'] != null) {
             if ($language_id != 2) {
                 if ($data['tagline']) {
                     $data['fullname'] = $custom->htmlDecode($data['name']) . ": " . $custom->htmlDecode($data['tagline']);
                 } else {
                     $data['fullname'] = $custom->htmlDecode($data['name']);
                 }
             }
             if ($data['description'] == null) {
                 $data['text'] = "Sorry, these destinations do not have a description in English";
             }
             return $data;
         } else {
             //                $query2 = $this->select()
             //                        ->from($this->_name, array('name'))
             //                        ->where("{$this->_name}.poi_id = ?", $poi_id);
             //                $data2 = $this->fetchRow($query2)->toArray();
             $data['fullname'] = "Maaf, destinasi ini belum memiliki terjemahan bahasa Indonesia";
             if ($data['description'] == null) {
                 $data['text'] = "Maaf, destinasi ini belum memiliki terjemahan dalam bahasa Indonesia";
             }
             //                echo '$data[]';
             //                echo $query->__toString();
             return $data;
         }
     } else {
         $query2 = $this->select()->from($this->_name, array('poi_id', 'pointX', 'pointY', 'address', 'phone', 'website', 'main_category', 'featured', 'popular', 'image', '(totalrate/totalrater) AS rating', 'totalrater'))->where("{$this->_name}.poi_id = ?", $poi_id);
         $result = $this->fetchRow($query2);
         if (count($result)) {
             $data = $result->toArray();
         } else {
             $data = array();
             $data['fullname'] = "Sorry, these destinations do not have a description in English";
             $data['text'] = "Sorry, these destinations do not have a description in English";
         }
         return $data;
     }
 }
     $this->_helper->viewRenderer->setNoRender(true);
     // Param
     $name = $this->_getParam('name');
     // Model
     $destDescDb = new Model_DbTable_DestinationDescription();
     // Data
     $destination = $destDescDb->getSearchByName($name, $this->_languageId);
     $destinationData = $this->_createArrayDestination($destination);
     echo json_encode($destinationData);
 }
 /**
  * IS: 
  * FS: 
  * Desc: Fungsi untuk mendapatkan destinasi berdasarkan id yang diberikan
  */
 public function destinationByIdAction()
 {
     // Tidak pake view
 public function getAllByIdLangForIndo($poi_id, $language_id)
 {
     $custom = new Budpar_Custom_Common();
     $query = $this->select()->from($this->_name, array('poi_id', 'pointX', 'pointY', 'address', 'phone', 'website', 'main_category', 'featured', 'popular', 'header_image', '(totalrate/totalrater) AS rating', 'totalrater'))->join($this->_poidesc, "{$this->_poidesc}.poi_id = {$this->_name}.poi_id", array('*', 'header_image as banner'))->setIntegrityCheck(false)->where("{$this->_poidesc}.language_id = ?", $language_id)->where("{$this->_name}.poi_id = ?", $poi_id);
     $check = $this->fetchRow($query);
     if ($check != null) {
         $data = $this->fetchRow($query)->toArray();
         if ($data['name'] != null) {
             if ($language_id != 1) {
                 if ($data['tagline']) {
                     $data['fullname'] = $custom->htmlDecode($data['name']) . ": " . $custom->htmlDecode($data['tagline']);
                 } else {
                     $data['fullname'] = $custom->htmlDecode($data['name']);
                 }
             }
             if ($data['description'] == null) {
                 $data['text'] = "Maaf, destinasi ini belum memiliki terjemahan dalam bahasa Indonesia";
             }
             return $data;
         } else {
             $data['fullname'] = "Sorry, this destination does not have English translation";
             if ($data['description'] == null) {
                 $data['text'] = "Sorry, this destination does not have English translation";
             }
             return $data;
         }
     } else {
         $query2 = $this->select()->from($this->_name, array('poi_id', 'pointX', 'pointY', 'address', 'phone', 'website', 'main_category', 'featured', 'popular', 'header_image', '(totalrate/totalrater) AS rating', 'totalrater'))->where("{$this->_name}.poi_id = ?", $poi_id);
         $data = $this->fetchRow($query2)->toArray();
         $data['fullname'] = "Maaf, destinasi ini belum memiliki terjemahan dalam bahasa Indonesia";
         $data['text'] = "Maaf, destinasi ini belum memiliki terjemahan dalam bahasa Indonesia";
         return $data;
     }
 }
 public function HtmlDecode($string, $mode = 1)
 {
     $custom = new Budpar_Custom_Common();
     return $custom->htmlDecode($string, $mode);
 }
 /**
  * Fungsi truncate
  *
  * @param string $fullcontent
  * @param integer $character batasan karakter yg mau di-truncate
  *
  * @return string hasil yang sudah di-truncate
  */
 public function truncate($fullcontent, $character = 85)
 {
     $custom = new Budpar_Custom_Common();
     return $custom->truncate($fullcontent, $character);
 }