public function indexAction() { // params $limit = 3; // model $destinationDb = new Model_DbTable_Destination(); $newsDb = new Model_DbTable_News(); $eventDb = new Model_DbTable_Event(); // data $latestculture = $destinationDb->getLatestPost($limit); $latestdraft = $destinationDb->getLatestDraft($limit); $latestnews = $newsDb->getLatestPost($limit); $latestnewsdraft = $newsDb->getLatestPost($limit); $latestevent = $eventDb->getLatestPost($limit); $latesteventdraft = $eventDb->getLatestDraft($limit); $messages = $this->_helper->flashMessenger->getMessages(); // view $this->view->latestdraft = $latestdraft; $this->view->latestculture = $latestculture; $this->view->latestnews = $latestnews; $this->view->latestnewsdraft = $latestnewsdraft; $this->view->latestevent = $latestevent; $this->view->latesteventdraft = $latesteventdraft; $this->view->messages = $messages; }
public function insertReviewRating($poiId, $userId, $fbname = '', $newRate) { $destDb = new Model_DbTable_Destination(); $review = $this->getByPoiIdUserId($poiId, $userId); $avgRating = 0; if (count($review)) { $oldRate = $review['rate']; $avgRating = $destDb->updateRating($poiId, $data, $oldRate, $newRate); } else { $data = array('poi_id' => $poiId, 'user_id' => $userId, 'rate' => $newRate); if (!empty($fbname)) { $data['isfb'] = 1; } $reviewId = $this->insert($data); $avgRating = $destDb->updateRating($poiId, $data); } $this->editRating($poiId, $userId, $newRate); return $avgRating; }
/** * Fungsi untuk menentukan header image destinasi */ protected function _generateHeaderImage() { // Param $destId = $this->_getParam('destId'); // Model $destinationDb = new Model_DbTable_Destination(); // Check jika spesial destinasi $this->_isSpecialDestination = $destinationDb->checkSpecialDestination($destId); $this->view->specialDestination = $this->_isSpecialDestination; if (!$this->_isSpecialDestination) { $destinationModel = new Model_Destination(); if ($this->_languageId == 2) { $destHeaderImage = $destinationModel->getHeaderSmallIndo(); } else { $destHeaderImage = $destinationModel->getHeaderSmall(); } $this->view->destHeaderImage = $destHeaderImage; } }
public function cultureWidget($limit, $show_thumbnails = false, $side_space = true) { $languageId = Zend_Registry::get('languageId'); $cache = Zend_Registry::get('cache'); if (($widget = $cache->load('widget_kebudayaan')) === false) { $title = $this->view->translate('popular_culture'); $tbl_culture = new Model_DbTable_Destination(); $cultures = $tbl_culture->getFeaturedCulture($languageId, $limit); $list = "<ul>"; $thumbnails = ''; foreach ($cultures as $culture) { $urlFormat = $this->view->makeUrlFormat($culture['name']); $link = $this->view->baseUrl("culture/{$culture['poi_id']}/{$urlFormat}"); if ($show_thumbnails) { $source = 'default.jpg'; $width = 50; $height = 50; $quality = 100; $culture_image = 'upload/culture/' . $culture['image']; if (!file_exists(IMAGE_FOLDER . $culture_image) || empty($culture['image'])) { $culture_image = $source; } $timthumb = $this->view->imageUrl("timthumb.php?src={$culture_image}&w={$width}&h={$height}&q={$quality}"); $thumbnails = "<img class='thumbnail' src='{$timthumb}' alt='{$culture['name']}' />"; } $list .= "<li>{$thumbnails}<a href='{$link}'><span class='desc'>{$culture['name']}</span></a></li>"; } $list .= "</ul>"; $list .= "<div class='clear'></div>"; if ($side_space) { $side_space_class = 'side-space'; } $widget = <<<HTML <div class="widget-half-list {$side_space_class}"> <h2>{$title}</h2> {$list} </div> HTML; $cache->save($widget); } return $widget; }
/** * IS: - * FS: Mengirimkan ke viewer: destination, news, event, destSearchForm, * activitySearchForm, highlight, video * Desc: Fungsi untuk menampilkan halaman depan */ public function indexAction() { $this->_helper->layout->setLayout('kebudayaan'); // Form $destSearchForm = new Form_DestSearchHomeForm(); $activitySearchForm = new Form_ActivitySearchHomeForm(); $destSearchForm->setNameLabel($this->view->translate('name')); // Model $destinationDb = new Model_DbTable_Destination(); $eventDb = new Model_DbTable_Event(); $highlightDb = new Model_DbTable_Highlight(); // $videoModel = new Model_Video; $galleryModel = new Model_DbTable_Image(); // Data $galleryHeader = $highlightDb->getGalleryHeader(); $featured_culture = $destinationDb->getFeaturedCulture($this->_languageId, 4); //generate news $news = $this->news->getLastNews($this->_languageId, 4); $event = $eventDb->getFourClosestEvent($this->_languageId); $highlightMed = $highlightDb->getMainType(2, $this->_languageId); // $videos = $videoModel->getMostViewedVideos($startIndexVideo, $maxResultVideo); $latestImage = $galleryModel->getTenLastImage(1, false, true); $this->view->activeHeaders = $highlightDb->getActiveHeaders(); // Passing ke view $this->view->galleryHeader = $galleryHeader; $this->view->latestImage = $latestImage; $this->view->featured_culture = $featured_culture; $this->view->news = $news->toArray(); $this->view->event = $event; $this->view->destSearchForm = $destSearchForm; $this->view->useFeaturedSlideshow = true; $this->view->featuredCulture = $featured_culture; $this->view->activitySearchForm = $activitySearchForm; $this->view->highlight = $highlightMed; // $this->view->videos = $videos; $this->view->languageID = $this->_languageId; $this->view->useGoogleExperiment = true; $this->view->langId = $this->_languageId; $this->view->homepage = true; $this->view->figures = $this->figure->findAll($this->_languageId, 2)->toArray(); }
/** * IS: - * FS: Mengirimkan ke viewer: destination, news, event, destSearchForm, * activitySearchForm, highlight, video * Desc: Fungsi untuk menampilkan halaman depan */ public function indexAction() { $this->_helper->layout->setLayout('kebudayaan'); // Model $destinationDb = new Model_DbTable_Destination(); $eventDb = new Model_DbTable_Event(); $highlightDb = new Model_DbTable_Highlight(); // $videoModel = new Model_Video; $galleryModel = new Model_DbTable_Image(); // Data $galleryHeader = $highlightDb->getGalleryHeader(); $featured_culture = $destinationDb->getFeaturedCulture($this->_languageId, 4); //generate news $news = $this->news->getLastNews($this->_languageId, 4); $event = $eventDb->getFourClosestEvent($this->_languageId); $highlightMed = $highlightDb->getMainType(2, $this->_languageId); // $videos = $videoModel->getMostViewedVideos($startIndexVideo, $maxResultVideo); $latestImage = $galleryModel->getTenLastImage(1, false, true); $activeHeaders = $highlightDb->getActiveHeaders($this->_languageId); if (count($activeHeaders) == 0) { $activeHeaders = $highlightDb->getActiveHeaders(); } $this->view->activeHeaders = $activeHeaders; // Passing ke view $this->view->galleryHeader = $galleryHeader; $this->view->latestImage = $latestImage; $this->view->featured_culture = $featured_culture; $this->view->news = $news->toArray(); $this->view->event = $event; $this->view->useFeaturedSlideshow = true; $this->view->featuredCulture = $featured_culture; $this->view->highlight = $highlightMed; // $this->view->videos = $videos; $this->view->languageID = $this->_languageId; $this->view->useGoogleExperiment = true; $this->view->langId = $this->_languageId; $this->view->homepage = true; $this->view->figures = $this->figure->findAll($this->_languageId, 2)->toArray(); $this->view->headMeta()->appendName('keywords', join(', ', $this->_meta)); $this->view->headMeta()->appendName('description', "kebudayaanindonesia.net adalah laman referensi kebudayaan Indonesia untuk mewujudkan bangsa Indonesia yang cerdas dan berbudaya"); }
* FS: * Desc: Fungsi untuk mendapatkan destinasi berdasarkan area * Digunakan untuk map */ public function destinationByAreaAction() { // Tidak pake view $this->_helper->viewRenderer->setNoRender(true); // Param $areaId = $this->_getParam('areaId'); // Model $destDescDb = new Model_DbTable_DestinationDescription(); // Data $destination = $destDescDb->getAllByAreaList($areaId, $this->_languageId);
protected function randomDestination() { $db = new Model_DbTable_Destination(); $data = $db->getRandomDestination(3, $this->_languageId); return $data; }
protected function countView($poi_id) { $db = new Model_DbTable_Destination(); $data = $db->pageViewer($poi_id); return $data; }
$class_list = $table_classtotourism->getallClassIdNameByTourismId($tourism_id); $this->view->class_list = $class_list; } /** * IS: * FS: * Desc: */ public function poiautocompleteAction() { $languageId = $this->_getParam('languageID'); if (!isset($languageId)) { $languageId = 1;
protected function countView() { $db = new Model_DbTable_Destination(); $data = $db->pageViewer($this->_destId); return $data; }
// create instance of event model $model = new Model_DbTable_Event(); // get all events from database $events = $model->getAllWithDesc(); // initialize empty array for result data $data = array(); // loop through events object foreach ($events as $index => $event) { $month = ""; // convert mysql datetime to date only $start = date('d F Y', strtotime($event->date_start)); $end = date('d F Y', strtotime($event->date_end)); // get start time $start_time = date('H:i:s', strtotime($event->date_start)); $description = $this->view->truncate($event->description, 100); $txt_mulai = $this->_languageId == 1 ? "Mulai" : "Start"; $txt_selesai = $this->_languageId == 1 ? "Selesai" : "End"; $html = <<<HTML {$txt_mulai} <strong>{$start}</strong> ·  {$txt_selesai} <strong>{$end}</strong> <br/> HTML; $data[] = array("date" => date('Y-m-d h:i:s', strtotime($event->date_start)), "title" => $event->name, "description" => $html, "url" => $view->url(array('id' => $event['event_id'], 'slug' => $view->makeUrlFormat($event['name'])), $this->_languageId == 1 ? 'detail-kegiatan' : 'event-detail')); } // return json result to client echo json_encode($data); } } public function pingomaticAction() { $debug = true; $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $articleDB = new Model_DbTable_Destination(); $articles = $articleDB->findAllWithDescription($this->_languageId); $content = '<?xml version="1.0"?>'; $content .= '<methodCall>'; $content .= '<methodName>weblogUpdates.ping</methodName>'; $content .= '<params>'; foreach ($articles as $article) { $content .= '<param>'; $content .= '<value>' . $article->name . '</value>'; $content .= '</param>'; $content .= '<param>'; $content .= '<value>' . 'http://www.kebudayaanindonesia.net/id/culture/' . $article->poi_id . '/' . $this->view->makeUrlFormat($article->name) . '</value>'; $content .= '</param>'; } $content .= ' </params>'; $content .= '</methodCall>';
public function deletetranslationAction() { $this->_helper->viewRenderer->setNoRender(); $id = $this->_getParam('id'); if (null != $id) { $tbl = new Model_DbTable_Destination(); $tbl_description = new Model_DbTable_DestinationDescription(); $culture = $tbl->find($id)->current(); if (null != $culture) { $tbl_description->fetchRow(array('poi_id = ?' => $id, 'language_id = ?' => 2))->delete(); $this->loggingaction('Culture', 'Delete', $id, 2); $this->_helper->flashMessenger->addMessage('Translasi berhasil dihapus.'); } } $this->_helper->redirector('index'); }
/** * IS: Parameter id terdeklarasi * FS: Mengirimkan ke viewer: poi_id, form, gkey, header_image * Desc: Mengatur aksi yang dilakukan untuk halaman edit */ public function editAction() { /*retrieving parameter and creating form*/ $poi_id = $this->_getParam('id'); $language_id = $this->_getParam('lang'); //create instance of destination table and get destination data $table_destination = new Model_DbTable_Destination(); $table_destination_description = new Model_DbTable_DestinationDescription(); $table_category = new Model_DbTable_Category(); $table_categorytopoi = new Model_DbTable_CategoryToPoi(); $table_area = new Model_DbTable_Area(); $table_areatopoi = new Model_DbTable_AreaToPoi(); $table_relatedpoi = new Model_DbTable_RelatedPoi(); $data = null; $form = new Admin_Form_PoiFormIndo(); $table_related_article_poi = new Model_DbTable_RelatedArticlePoi(); //get realated article data // @param = article_id $ralated_poi = $table_related_article_poi->getByPoiId($poi_id, $language_id); $this->view->edit = 1; $this->view->ralated_poi = $ralated_poi; $this->view->poi_id = $poi_id; /*Update Process*/ if ($this->getRequest()->isPost()) { //if the form is valid if ($form->isValid($_POST)) { //check if it is a special destination or not if ($language_id != 2) { $indo = $table_destination_description->checkForEnglish($poi_id); if (!$indo) { if ($_POST['SpecialDestination'] == 1) { $header_image = preg_replace("/'/", "'", $_POST['HeaderImage']); } else { $header_image = null; } $PoiName = preg_replace("/'/", "'", $_POST['PoiName']); $PoiTagLine = preg_replace("/'/", "'", $_POST['PoiTagline']); $PoiInformation = preg_replace("/'/", "'", $_POST['PoiInformation']); $PoiHowToGetThere = preg_replace("/'/", "'", $_POST['PoiHowToGetThere']); $PoiHowToGetAround = preg_replace("/'/", "'", $_POST['PoiHowToGetAround']); $PoiWhatToDo = preg_replace("/'/", "'", $_POST['PoiWhatToDo']); $PoiWhereToEat = preg_replace("/'/", "'", $_POST['PoiWhereToEat']); $PoiWhereToStay = preg_replace("/'/", "'", $_POST['PoiWhereToStay']); $PoiWhatToBuy = preg_replace("/'/", "'", $_POST['PoiWhatToBuy']); $PoiTips = preg_replace("/'/", "'", $_POST['PoiTips']); $desc = array('poi_id' => $poi_id, 'language_id' => $language_id, 'name' => $PoiName, 'tagline' => $PoiTagLine, 'description' => $PoiInformation, 'howToGetThere' => $PoiHowToGetThere, 'howToGetAround' => $PoiHowToGetAround, 'whatToDo' => $PoiWhatToDo, 'whereToEat' => $PoiWhereToEat, 'whereToStay' => $PoiWhereToStay, 'whatToBuy' => $PoiWhatToBuy, 'tips' => $PoiTips, 'header_image' => $header_image); //updating data to the database $table_destination_description->insertPoiDescription($desc); } else { if ($_POST['SpecialDestination'] == 1) { $header_image = preg_replace("/'/", "'", $_POST['HeaderImage']); } else { $header_image = null; } $PoiName = preg_replace("/'/", "'", $_POST['PoiName']); $PoiTagLine = preg_replace("/'/", "'", $_POST['PoiTagline']); $PoiInformation = preg_replace("/'/", "'", $_POST['PoiInformation']); $PoiHowToGetThere = preg_replace("/'/", "'", $_POST['PoiHowToGetThere']); $PoiHowToGetAround = preg_replace("/'/", "'", $_POST['PoiHowToGetAround']); $PoiWhatToDo = preg_replace("/'/", "'", $_POST['PoiWhatToDo']); $PoiWhereToEat = preg_replace("/'/", "'", $_POST['PoiWhereToEat']); $PoiWhereToStay = preg_replace("/'/", "'", $_POST['PoiWhereToStay']); $PoiWhatToBuy = preg_replace("/'/", "'", $_POST['PoiWhatToBuy']); $PoiTips = preg_replace("/'/", "'", $_POST['PoiTips']); $desc = array('poi_id' => $poi_id, 'language_id' => 1, 'name' => $PoiName, 'tagline' => $PoiTagLine, 'description' => $PoiInformation, 'howToGetThere' => $PoiHowToGetThere, 'howToGetAround' => $PoiHowToGetAround, 'whatToDo' => $PoiWhatToDo, 'whereToEat' => $PoiWhereToEat, 'whereToStay' => $PoiWhereToStay, 'whatToBuy' => $PoiWhatToBuy, 'tips' => $PoiTips, 'header_image' => $header_image); //updating data to the database $table_destination_description->UpdatePoiDescription($desc, $poi_id, 1); } } else { if ($_POST['SpecialDestination'] == 1) { //if it was a special destination but no image uploaded if ($_POST['HeaderImage'] == '') { $this->_flash->addMessage('3\\Warning: Data is saved without image! You should upload an image for a featured destination.'); } else { $header_image = preg_replace("/'/", "'", $_POST['HeaderImage']); } } else { $header_image = null; } $PoiName = preg_replace("/'/", "'", $_POST['PoiName']); $PoiAddress = preg_replace("/'/", "'", $_POST['PoiAddress']); $PoiPhone = preg_replace("/'/", "'", $_POST['PoiPhone']); $PoiWebsite = preg_replace("/'/", "'", $_POST['PoiWebsite']); if ($_POST['SpecialDestination'] == 0) { $SpecialDestination = 0; } else { $SpecialDestination = 1; } /*preparing data for Poi table*/ $data = array('pointX' => $_POST['pointx'], 'pointY' => $_POST['pointy'], 'address' => $PoiAddress, 'phone' => $PoiPhone, 'website' => $PoiWebsite, 'main_category' => $_POST['MainCategory'], 'popular' => $_POST['PopularSelect'], 'status' => $_POST['SaveStatus'], 'special' => $SpecialDestination, 'header_image' => ' '); /*updating data to Poi table and get the last inserted poi id*/ $table_destination->updatePoi($data, $poi_id); /*preparing data for poi description table*/ $PoiTagLine = preg_replace("/'/", "'", $_POST['PoiTagline']); $PoiInformation = preg_replace("/'/", "'", $_POST['PoiInformation']); $PoiHowToGetThere = preg_replace("/'/", "'", $_POST['PoiHowToGetThere']); $PoiHowToGetAround = preg_replace("/'/", "'", $_POST['PoiHowToGetAround']); $PoiWhatToDo = preg_replace("/'/", "'", $_POST['PoiWhatToDo']); $PoiWhereToEat = preg_replace("/'/", "'", $_POST['PoiWhereToEat']); $PoiWhereToStay = preg_replace("/'/", "'", $_POST['PoiWhereToStay']); $PoiWhatToBuy = preg_replace("/'/", "'", $_POST['PoiWhatToBuy']); $PoiTips = preg_replace("/'/", "'", $_POST['PoiTips']); $desc = array('poi_id' => $poi_id, 'language_id' => 2, 'name' => $PoiName, 'tagline' => $PoiTagLine, 'description' => $PoiInformation, 'howToGetThere' => $PoiHowToGetThere, 'howToGetAround' => $PoiHowToGetAround, 'whatToDo' => $PoiWhatToDo, 'whereToEat' => $PoiWhereToEat, 'whereToStay' => $PoiWhereToStay, 'whatToBuy' => $PoiWhatToBuy, 'tips' => $PoiTips, 'header_image' => $header_image); //updating data to the database $table_destination_description->UpdatePoiDescription($desc, $poi_id, 2); /*preparing data for categorytopoi table *Get category count and data*/ $category_count = $this->_getParam('MaxCategory'); $category_stack = array(); for ($i = 0; $i <= $category_count; $i++) { if (!empty($_POST['catValue' . $i])) { array_push($category_stack, $_POST['catValue' . $i]); } } /*inserting data for categorytopoi table*/ $category_list = $table_categorytopoi->getCategoryIdByPoiId($poi_id); /*convert to non associative array*/ $saved_category = array(); foreach ($category_list as $temp_cat) { array_push($saved_category, $temp_cat['category_id']); } /*processing the data if the posted data not found on saved category id list then insert the data */ foreach ($category_stack as $category_new) { if (!in_array($category_new, $saved_category)) { $category_poi = array('category_id' => $category_new, 'poi_id' => $poi_id); $table_categorytopoi->insertCategoryToPoi($category_poi, 2); } } /*complement check, if the data on saved category list not found on posted category then delete that data on the database*/ foreach ($saved_category as $old_category) { if (!in_array($old_category, $category_stack)) { $table_categorytopoi->deleteCategoryToPoi($old_category, $poi_id); } } /* We do it the same way for processing the area data * First, we obtain the data from the database and then convert it * to a non assoc. array*/ $areatopoi_list = $table_areatopoi->getPoiAreaId($poi_id); $saved_area = array(); foreach ($areatopoi_list as $temp_area) { array_push($saved_area, $temp_area['area_id']); } /* Obtain the list of the new area data posted from the form*/ $area_count = $this->_getParam('MaxArea'); $area_stack = array(); for ($i = 0; $i <= $area_count; $i++) { if (!empty($_POST['areaValue' . $i])) { array_push($area_stack, $_POST['areaValue' . $i]); } } /* Compare the new area list with the old area list * if its not in the old area list then insert to the database*/ foreach ($area_stack as $new_area) { if (!in_array($new_area, $saved_area)) { $area_poi = array('area_id' => $new_area, 'poi_id' => $poi_id); $table_areatopoi->insertAreaToPoi($area_poi); } } /* Now we do the complement action * compare the old list with the new list, * delete if not found on the new list*/ foreach ($saved_area as $old_area) { if (!in_array($old_area, $area_stack)) { $table_areatopoi->deleteAreaToPoi($old_area, $poi_id); } } /*related poi data processing*/ $relpoi_stack = array(); $relCtr = $_POST['relPoi_counter']; for ($i = 0; $i <= $relCtr; $i++) { if (!empty($_POST['relpoi' . $i])) { array_push($relpoi_stack, $_POST['relpoi' . $i]); } } $saved_relpoi = $table_relatedpoi->getAllRelatedByPoiIdLangId($poi_id, $language_id); $old_relpoi = array(); if (sizeof($saved_relpoi) > 0) { foreach ($saved_relpoi as $value) { array_push($old_relpoi, $value['related_poi']); } } foreach ($relpoi_stack as $value) { if (!in_array($value, $old_relpoi)) { $data = array('poi_id' => $poi_id, 'related_poi' => $value); $table_relatedpoi->insertRelatedPoi($data); } } foreach ($old_relpoi as $value) { if (!in_array($value, $relpoi_stack)) { $table_relatedpoi->deleteSpecificRelatedPoi($poi_id, $value); } } } ////$this->_helper->layout()->disableLayout(); ////$this->_helper->viewRenderer->setNoRender(true); /* update related article */ //param // this part add related if ($_POST['counterRelated'] > 0) { $counter = $_POST['counterRelated']; for ($i = 1; $i <= $counter; $i++) { //echo $_POST['link'.$i]; //cek existing label and link in database // if $cek having value = false, then data will be saved if (isset($_POST['label' . $i])) { $cek = $table_related_article_poi->cek_existing($_POST['label' . $i], $_POST['link' . $i]); if (!$cek or $cek == false) { $data = array('poi_id' => $poi_id, 'label' => $_POST['label' . $i], 'link' => $_POST['link' . $i], 'language_id' => $language_id); $table_related_article_poi->insertRelated($data); } } } } //bagian untuk menghapus data related artikel if ($_POST['counterDel'] > 0) { $counterDel = $_POST['counterDel']; for ($i = 1; $i <= $counterDel; $i++) { //cek existing label and link in database // if found, data will be removed if (isset($_POST['labeldel' . $i])) { $cek = $table_related_article_poi->cek_existing_forDel($_POST['labeldel' . $i], $_POST['linkdel' . $i]); } } } //Send a success message via flashmessenger $this->loggingaction('destination', 'edit', $poi_id, $language_id); $this->_flash->addMessage('1\\Destination English Update Success!'); //redirect to the destination list page $this->_redirect($this->view->rootUrl('/admin/destinationindo/')); } } /*load data from the database preparing for view process*/ if ($language_id == 2) { $data = $table_destination->getAllByIdLangForIndo($poi_id, $language_id); $parent_category = $table_category->getparentCategoryId($data['main_category']); $parent_area = $table_areatopoi->getPoiAreaId($poi_id); } else { $indo = $table_destination_description->checkForEnglish($poi_id); if ($indo) { $data = $table_destination->getAllByIdLangForIndo($poi_id, $language_id); } } $tesheader = $table_destination_description->getheaderimagebyid2($poi_id, $language_id); /*Set every element Value*/ if ($data != null) { $form->Poi_Name->setValue($this->view->HtmlDecode($data['name'])); $form->Popular_Select->setValue($this->view->HtmlDecode($data['popular'])); $form->Poi_Address->setValue($this->view->HtmlDecode(strip_tags($data['address']))); $form->Poi_Website->setValue($data['website']); $form->Poi_Phone->setValue($data['phone']); $form->Poi_TagLine->setValue($this->view->HtmlDecode($data['tagline'])); $form->Poi_Information->setValue($this->view->HtmlDecode($data['description'])); $form->Poi_HowToGetThere->setValue($this->view->HtmlDecode($data['howToGetThere'])); $form->Poi_HowToGetAround->setValue($this->view->HtmlDecode($data['howToGetAround'])); $form->Poi_WhatToDo->setValue($this->view->HtmlDecode($data['whatToDo'])); $form->Poi_WhereToEat->setValue($this->view->HtmlDecode($data['whereToEat'])); $form->Poi_WhereToStay->setValue($this->view->HtmlDecode($data['whereToStay'])); $form->Poi_WhatToBuy->setValue($this->view->HtmlDecode($data['whatToBuy'])); $form->Poi_Tips->setValue($this->view->HtmlDecode($data['tips'])); $form->Poi_x->setValue($data['pointX']); $form->Poi_y->setValue($data['pointY']); $form->HeaderImage->setValue($tesheader['header_image']); } /*check if this is a special destination, if it is, then checkbox value to true*/ if ($table_destination->checkSpecialDestination($poi_id)) { $form->SpecialDestination->setChecked(true); $this->view->state_special = TRUE; } else { $form->SpecialDestination->setChecked(false); $this->view->state_special = FALSE; } /*send data image filename to the view*/ $this->view->header_image = $data['header_image']; /*set another value to the form element*/ $area_amount = $table_areatopoi->countAreaByPoiId($poi_id); $category_amount = $table_categorytopoi->countCategoryByPoiId($poi_id); $main_category = $table_destination->getMainCategoryById($poi_id); $form->Category_counter->setValue($category_amount); $form->Count_category->setValue($category_amount); $form->Main_category->setValue($main_category['main_category']); $form->Area_counter->setValue($area_amount); $form->Count_area->setValue($area_amount); /*send form to view class*/ $this->view->poi_id = $poi_id; $this->view->form = $form; $this->view->language_id = $language_id; /*get google map key from zend registry and send it to the view*/ }
public function destpagingAction() { $this->_helper->layout->disableLayout(); /* disable layout */ $this->_helper->viewRenderer->setNoRender(true); /* supaya tidak render view */ $limit = $this->_getParam(urldecode('paramLimit')); $offset = $this->_getParam(urldecode('paramOffset')); $param = $this->_getParam(urldecode('paramKey')); $generateDest = new Model_DbTable_Destination(); $getResultDest = $generateDest->searchDestBaru($param, $limit, $offset, $this->_languageId); $data['result'] = ''; foreach ($getResultDest as $rowDest) { $title = $this->view->boldStyle(strtolower($rowDest['name']), $param); $data['result'] .= '<li>'; $data['result'] .= '<a href="' . $this->_request->getBaseUrl() . '/' . $this->lang . '/culture/' . $rowDest['poi_id'] . '/' . $this->view->makeUrlFormat($rowDest['name']) . '" title="' . $rowDest['name'] . '">' . ltrim($title) . '</a>'; $data['result'] .= '<br /><br />' . substr(strip_tags($this->view->htmlDecode($rowDest['description'])), 0, 225) . ' ...'; $data['result'] .= '</li>'; } /* - - - - - - - - - - - link pages - - - - - - - - - - - - - - - - -*/ $action_query = $this->_getParam(urldecode('actionQuery')); switch ($action_query) { case 'next': $curpageDest = $this->_getParam(urldecode('paramPage')) + 1; break; case 'prev': $curpageDest = $this->_getParam(urldecode('paramPage')) - 1; break; default: $curpageDest = $this->_getParam(urldecode('paramPage')) + 1; break; } $num_linkDest = NUM_LINKS; $per_pageDest = $limit; $getTotalDest = $generateDest->numbRowsDest($param, $this->_languageId); $num_pageDest = ceil($getTotalDest / $limit); $startDest = $curpageDest - $num_linkDest > 0 ? $curpageDest - ($num_linkDest - 1) : 1; $endDest = $curpageDest + $num_linkDest < $num_pageDest ? $curpageDest + $num_linkDest : $num_pageDest; $data['start'] = $startDest; $data['end'] = $endDest; $data['per_pages'] = $per_pageDest; $data['cur_pages'] = $curpageDest; $data['all_page'] = $getTotalDest; /* - - - - - - - - - - - end link pages - - - - - - - - - - - - - - -*/ $data['offset'] = $offset + $limit; $data['curpages'] = $curpageDest; echo json_encode($data); }
public function rssAction() { // Tidak pake layout $this->_helper->layout->disableLayout(); // Model $destDb = new Model_DbTable_Destination(); $lang_id = $this->_languageId; // Data $destQuery = $destDb->getAllWithDescForRss($lang_id, 10); $dest = $destDb->fetchAll($destQuery); // Start building XML untuk RSS for ($i = 0; $i < count($dest); $i++) { $string = $dest[$i]['name']; $string = str_replace('“', ' ', $string); $string = str_replace('”', ' ', $string); $string = str_replace('�', ' ', $string); $string = str_replace('�', ' ', $string); $dest[$i]['name'] = $this->xmlEntities(htmlentities($string, ENT_QUOTES)); $string = $dest[$i]['description']; $string = str_replace('“', ' ', $string); $string = str_replace('”', ' ', $string); $string = str_replace('�', ' ', $string); $string = str_replace('�', ' ', $string); $dest[$i]['description'] = $this->xmlEntities(htmlentities($string, ENT_QUOTES)); } $this->view->data = $dest; }
/** * IS: Parameter sortby, sortorder, searchname terdeklarasi * FS: Mengirimkan ke viewer: pageTitle, sectionTitle, sectionContent, * searchName * Desc: Fungsi untuk menampilkan list souvenir di destinasi */ public function findsouvenirAction() { $this->_helper->layout->setLayout('one-column'); // Param $sortBy = $this->_getParam('sortby'); $sortOrder = $this->_getParam('sortorder', 'asc'); $searchName = $this->_getParam('searchname', ''); // Model $tourismOperatorDb = new Model_DbTable_TourismOperator(); // untuk mengenerate koordinate google map $destinationDb = new Model_DbTable_Destination(); $destination = $destinationDb->getAllByIdLang($this->_destId, $this->_languageId); $this->view->pointX = $destination['pointX']; $this->view->pointY = $destination['pointY']; // Data $souvenir = $tourismOperatorDb->getTourismoperatorById($this->_destId, 4, $this->_languageId, array('sort_by' => $sortBy, 'sort_order' => $sortOrder, 'search_name' => $searchName)); $this->_generateSorter($sortBy, $sortOrder); if ($this->_languageId != 2) { $textfind = 'Find Souvenir'; } else { $textfind = 'Cari Suvenir'; } // Breadcrumb $this->_generateFindBreadcrumb($textfind); if ($this->_languageId != 2) { $textsectitle = 'SOUVENIR'; } else { $textsectitle = 'SUVENIR'; } // Passing ke view $this->view->pageTitle = $this->_destTitle . ' - Souvenir'; $this->view->sectionTitle = $textsectitle; $this->view->sectionContent = parent::setPaginator($souvenir); $this->view->searchName = $searchName; // Render $this->render('index'); }