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; } }
/** * * @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; } }
public function HtmlDecode($string, $mode = 1) { $custom = new Budpar_Custom_Common(); return $custom->htmlDecode($string, $mode); }