/** * Fungsi inisialisasi form */ public function init() { parent::init(); $langId = Zend_Registry::get('languageId'); if ($langId == 2) { $textisland = 'Island'; $textprov = 'Province'; $textseeloc = 'See Location'; $textselisl = 'Select Island'; } else { $textisland = 'Pulau'; $textprov = 'Provinsi'; $textseeloc = 'Lihat Lokasi'; $textselisl = 'Pilih Pulau'; } // Form Attribute $this->setMethod('post'); $this->addAttribs(array('id' => 'mapLocationForm', 'action' => '', 'accept-charset' => 'utf-8')); // -> Island $areaDb = new Model_DbTable_Area(); $islandData = $areaDb->getAllAreaChildByParent(0, $textselisl); $island = $this->createElement('select', 'island'); $island->setLabel($textisland)->setMultiOptions($islandData)->setDecorators($this->elementDecorators); $this->addElement($island); // -> Province $province = $this->createElement('select', 'province'); $province->setLabel($textprov)->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'id' => 'subarea')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $this->addElement($province); // -> Submit $submit = $this->createElement('submit', 'submitarea'); $submit->setLabel($textseeloc)->setDecorators($this->buttonDecorators); $submit->setAttrib('class', 'button button-grey'); $this->addElement($submit); }
public function init() { $this->draft = new Zend_Form_Element_Submit('action'); $this->draft->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setAttrib('class', 'btn'); $this->submit = new Zend_Form_Element_Submit('action'); $this->submit->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setAttrib('class', 'btn btn-success'); $tableArea = new Model_DbTable_Area(); $this->article_title = $this->createElement('text', 'ArticleTitle'); $this->article_title->removeDecorator('HtmlTag'); $this->article_title->removeDecorator('DtDdWrapper'); $this->article_title->removeDecorator('Label'); $this->article_title->setAttrib('class', 'mediumele'); $this->article_title->setRequired(TRUE); $this->SaveStatus = $this->createElement('hidden', 'SaveStatus'); $this->SaveStatus->removeDecorator('HtmlTag'); $this->SaveStatus->removeDecorator('DtDdWrapper'); $this->SaveStatus->removeDecorator('Label'); $this->SaveStatus->setValue(1); $this->articleSortOrder = $this->createElement('text', 'articleSortOrder'); $this->articleSortOrder->removeDecorator('HtmlTag'); $this->articleSortOrder->removeDecorator('DtDdWrapper'); $this->articleSortOrder->removeDecorator('Label'); $this->articleSortOrder->setAttrib('class', 'smallele'); $this->articleSortOrder->setValue(0); $this->article_content = $this->createElement('textarea', 'ArticleContent'); $this->article_content->removeDecorator('HtmlTag'); $this->article_content->removeDecorator('DtDdWrapper'); $this->article_content->removeDecorator('Label'); $this->article_content->setAttribs(array('cols' => 5, 'rows' => 5)); $this->article_content->setRequired(TRUE); $this->article_status = $this->createElement('hidden', 'ArticlePoi'); $this->article_status->removeDecorator('HtmlTag'); $this->article_status->removeDecorator('DtDdWrapper'); $this->article_status->removeDecorator('Label'); $this->article_status->setAttrib('minlength', '2'); $this->article_status->setRequired(TRUE); $this->article_poi_id = $this->createElement('hidden', 'PoiId'); $this->article_poi_id->removeDecorator('HtmlTag'); $this->article_poi_id->removeDecorator('DtDdWrapper'); $this->article_poi_id->removeDecorator('Label'); $this->article_poi_id->setRequired(TRUE); $data = $tableArea->setAreaForSelectElement($this->languageID); // $data = $tableArea->setAreaForSelectElement(1); $temp = array(0 => 'select Island'); $area_data = $temp + $data; $data = array("multiOptions" => $area_data); $this->island_select = $this->createElement('select', 'IslandListOptions', $data); $this->island_select->removeDecorator('HtmlTag'); $this->island_select->removeDecorator('DtDdWrapper'); $this->island_select->removeDecorator('Label'); $this->island_select->setAttrib('onchange', "getAreaList(this.value,0," . $this->languageID . ");"); $this->article_main_image = $this->createElement('text', 'ArticleMainImage'); $this->article_main_image->removeDecorator('HtmlTag'); $this->article_main_image->removeDecorator('DtDdWrapper'); $this->article_main_image->removeDecorator('Label'); }
private function getMainAreaContentForSelectForm() { $areaDb = new Model_DbTable_Area(); $areasearch = $areaDb->getAreaNameByParentLanguage(0, $this->_languageId); $areainput = array("" => "--Choose Island--"); foreach ($areasearch as $row) { $areainput[$row['area_id']] = $row['area_name']; } return $areainput; }
public function getTourismoperatorById($poiId, $classification_id, $languageId, $sortingOptions = null) { $areaDb = new Model_DbTable_Area(); $areaList = $areaDb->getCitiesByPoiId($poiId, $languageId); $query = $this->select()->from($this->_name)->join($this->_to, "{$this->_to}.tourismoperator_id = {$this->_name}.tourismoperator_id")->join($this->_ctt, "{$this->_ctt}.tourismoperator_id = {$this->_name}.tourismoperator_id", array('classification_id'))->join($this->_td, "{$this->_td}.tourismoperator_id = {$this->_name}.tourismoperator_id", array('name AS nama', 'description'))->setIntegrityCheck(false)->where("{$this->_td}.language_id = ?", $languageId)->where("{$this->_ctt}.classification_id = ?", $classification_id)->where("{$this->_name}.area_id IN (?)", $areaList); $sortBy = $this->_getSortBy($sortingOptions['sort_by'], $sortingOptions['sort_order']); $query->order($sortBy); //echo $query->__toString(); return $query; }
public function getAllClassIDByPoiId($poiId, $languageId) { $areaDb = new Model_DbTable_Area(); $areaList = $areaDb->getCitiesByPoiId($poiId, $languageId); if (count($areaList) > 0) { $query = $this->select()->from($this->_name, array('classification_id'))->join($this->_tourism, "{$this->_tourism}.tourismoperator_id = {$this->_name}.tourismoperator_id", array())->setIntegrityCheck(false)->where("{$this->_tourism}.area_id IN (?)", $areaList); return $this->fetchAll($query)->toArray(); } return array(); //echo $query->__toString(); }
$destinationData = $this->_createArrayDestination($destination); echo json_encode($destinationData); } /** * IS: * FS: * Desc: Fungsi untuk mendapatkan destinasi berdasarkan nama * Digunakan di map */ public function destinationByNameAction() { // Tidak pake view
/** * IS: Parameter id terdeklarasi * FS: Mengirimkan ke viewer: pageTitle, areaType, region, staticType, * menuType * Desc: Fungsi untuk menampilkan detail region */ public function regionDetailAction() { $this->_helper->layout->setLayout('one-column'); // Param $areaId = $this->_getParam('id'); // Model $areaDb = new Model_DbTable_Area(); $regionalDb = new Model_DbTable_Regional(); // Data $areaType = $areaDb->getAreaTypeById($areaId); $region = $regionalDb->getAllByIdLang($areaId, $this->_languageId); $texthomelink = $this->view->translate('id_menu_home'); // Breadcrumb $links = array($texthomelink => $this->view->baseUrl('/'), $this->view->translate('id_static_list') => $this->view->baseUrl('/discover-indonesia/region-list'), $region['area_name'] => ''); Zend_Registry::set('breadcrumb', $links); //if regional_description is empty, will be redirecting to regional list if ($region['regional_description']) { // View $this->view->pageTitle = $region['area_name']; $this->view->areaType = $areaType; $this->view->region = $region; $this->view->staticType = 'list'; $this->view->menuType = 'discover'; } else { $this->_redirector->gotoUrl($this->view->baseUrl('/discover-indonesia/region-list/')); } $this->view->staticType = 'list'; $this->view->isdetail = true; $this->render('index'); }
/** * */ public function getCitiesByPoiId($poiId, $languageId) { // Variabel $areaList = array(); $island = array(); $city = array(); $province = array(); // Model $areaDb = new Model_DbTable_Area(); // Data $result = $areaDb->getAllAreaByPoiId($poiId, $languageId); // Dapetin semua area dari poi // Kumpulkan mana yg masuk island, province dan city foreach ($result as $area) { if ($area['area_type'] == 0) { $island[] = $area['area_id']; } elseif ($area['area_type'] == 1) { $province[] = $area['area_id']; } elseif ($area['area_type'] == 2) { $city[] = $area['area_id']; } } // Jika city-nya ada, langsung diambil if (count($city) > 0) { $areaList = $city; } elseif (count($province) > 0) { // Jika provinsi ada, cari city-nya for ($i = 0; $i < count($province); $i++) { $areaCity = $areaDb->getAllAreaIdChildByParent($province[$i]); if (is_array($areaCity)) { $areaList = array_merge($areaList, $areaCity); } } } elseif (count($island) > 0) { // Jika island ada, cari city-nya for ($i = 0; $i < count($island); $i++) { $areaProvince = $areaDb->getAllAreaIdChildByParent($island[$i]); for ($j = 0; $j < count($areaProvince); $j++) { $areaCity = $areaDb->getAllAreaIdChildByParent($areaProvince[$j]); if (is_array($areaCity)) { $areaList = array_merge($areaList, $areaCity); } } } } return $areaList; }
/** * IS: Parameter id terdeklarasi * FS: Mengirimkan ke viewer: form, gkey, area, data, tourismid * Desc: Mengatur aksi yang dilakukan untuk halaman edit */ public function editAction() { /*Creating table instances*/ $table_classification = new Model_DbTable_Classification(); $table_area = new Model_DbTable_Area(); $table_tourism = new Model_DbTable_TourismOperator(); $table_tourismdescription = new Model_DbTable_TourismOperatorDescription(); $table_classtotourism = new Model_DbTable_ClassificationToTourismOperator(); $table_coveragearea = new Model_DbTable_CoverageArea(); $form = new Admin_Form_TourismOperatorForm(); $island_list = $table_area->getAllParentArea(); $tourism_id = $this->_getParam('id'); $language_id = $this->_getParam('lang'); $this->view->state_edit = TRUE; if ($this->getRequest()->isPost()) { if ($form->isValid($_POST)) { /*preparing data for tourismoperator table*/ if ($language_id != 1) { $indo = $table_tourismdescription->checkForIndo($tourism_id); if ($indo) { $data = array('tourismoperator_id' => $tourism_id, 'language_id' => 2, 'name' => $_POST['TourismOperatorLangName'], 'description' => $_POST['TourismOperatorDescription']); $table_tourismdescription->updateTourismOperatorDescription($data, $tourism_id); } else { $data = array('tourismoperator_id' => $tourism_id, 'language_id' => 2, 'name' => $_POST['TourismOperatorLangName'], 'description' => $_POST['TourismOperatorDescription']); $table_tourismdescription->insertTourismOperatorDescription($data); } } else { $data = array('area_id' => $_POST['TourismArea'], 'phone' => $_POST['TourismOperatorPhone'], 'website' => $_POST['TourismOperatorWebsite'], 'address' => $_POST['TourismOperatorAddress'], 'pointX' => $_POST['Pointx'], 'pointY' => $_POST['Pointy'], 'star' => $_POST['TourismOperatorStar'], 'fax' => $_POST['TourismOperatorFax'], 'email' => $_POST['TourismOperatorEmail']); /*updating data to the tourismoperator table*/ $table_tourism->updateTourismOperator($data, $tourism_id); /*preparing data for tourismoperatordescription table*/ $data = array('tourismoperator_id' => $tourism_id, 'language_id' => 1, 'name' => $_POST['TourismOperatorLangName'], 'description' => $_POST['TourismOperatorDescription']); /*updating data to the tourismoperator description table*/ $table_tourismdescription->updateTourismOperatorDescription($data, $tourism_id); /*get all saved classification*/ $temp_class = $table_classtotourism->getAllClassByTourismId($tourism_id); $saved_class = array(); foreach ($temp_class as $class_id) { array_push($saved_class, $class_id['class']); } /*get all added classification*/ $class_count = $_POST['MaxClass']; $class_stack = array(); for ($i = 0; $i < $class_count; $i++) { if (!empty($_POST['classValue' . $i])) { array_push($class_stack, $_POST['classValue' . $i]); } } /*if not exist insert classification to the database*/ foreach ($class_stack as $class_id) { if (!in_array($class_id, $saved_class)) { $class_tourism = array('classification_id' => $class_id, 'tourismoperator_id' => $tourism_id); $table_classtotourism->insertClassificationTourism($class_tourism); } } /*complementary check*/ foreach ($saved_class as $class_id) { if (!in_array($class_id, $class_stack)) { $table_classtotourism->deleteClassificationTourism($class_id, $tourism_id); } } if (in_array(3, $class_stack)) { /*get coverage area list from the database*/ $table_coveragearea = new Model_DbTable_CoverageArea(); $area_list = $table_coveragearea->getAllAreaByTourismId($tourism_id); $old_area = array(); foreach ($area_list as $value) { array_push($old_area, $value['area_id']); } $area_count = $this->_getParam('MaxArea'); $area_stack = array(); for ($i = 0; $i <= $area_count; $i++) { if (!empty($_POST['areaCoverValue' . $i])) { array_push($area_stack, $_POST['areaCoverValue' . $i]); } } foreach ($area_stack as $new_area) { if (!in_array($new_area, $old_area)) { $data = array('area_id' => $new_area, 'tourismoperator_id' => $tourism_id); $table_coveragearea->insertCoverageArea($data); } } foreach ($old_area as $saved_area) { if (!in_array($saved_area, $area_stack)) { $table_coveragearea->deleteSpecificCoverage($tourism_id, $saved_area); } } } } $this->loggingaction('tourismoperator', 'edit', $tourism_id); $this->_flash->addMessage('1\\Tourism Operator Update Success!'); $this->_redirect($this->view->rootUrl('/admin/tourismoperator/')); } } $data_amount = $table_classtotourism->countClassByTourismId($tourism_id); if ($language_id != 1) { $indo = $table_tourismdescription->checkForIndo($tourism_id); if ($indo) { $data = $table_tourism->getAllTourismDataByIdLang($tourism_id, $language_id); } } else { $data = $table_tourism->getAllTourismDataByIdLang($tourism_id, $language_id); } /** *Set every element Value *Below are standard element value set that doesnt require any further database select operation */ $form->TourismOperatorEmail->setValue($data['email']); $form->TourismOperatorPhone->setValue($data['phone']); $form->TourismOperatorArea->setValue($data['area_id']); $form->TourismOperatorWebsite->setValue($data['website']); $form->Pointx->setValue($data['pointX']); $form->Pointy->setValue($data['pointY']); $form->TourismOperatorAddress->setValue($this->view->HtmlDecode($data['address'])); $form->TourismOperatorStar->setValue($data['star']); $form->TourismOperatorFax->setValue($data['fax']); $form->TourismOperatorLangName->setValue($data['langname']); $form->TourismOperatorDescription->setValue($this->view->HtmlDecode($data['description'])); /*Count tourismoperator classification*/ $form->Count_class->setValue($data_amount); $form->Class_counter->setValue($data_amount); /*Send variable to the view*/ $this->view->form = $form; $this->view->language_id = $language_id; $this->view->gkey = Zend_Registry::get('gmap_key'); $this->view->area = $data['area_id']; $this->view->data = $data; $this->view->tourismid = $tourism_id; }
public function init() { $tableArea = new Model_DbTable_Area(); $tableCategory = new Model_DbTable_Category(); $this->Poi_Name = $this->createElement('text', 'PoiName'); $this->Poi_Name->removeDecorator('HtmlTag'); $this->Poi_Name->removeDecorator('DtDdWrapper'); $this->Poi_Name->removeDecorator('Label'); $this->Poi_Name->setRequired(TRUE); $this->Poi_Name->setAttrib('class', 'mediumele'); $popular = array("multiOptions" => array(0 => "No", 1 => "Yes")); $this->Popular_Select = $this->createElement('select', 'PopularSelect', $popular); $this->Popular_Select->removeDecorator('HtmlTag'); $this->Popular_Select->removeDecorator('DtDdWrapper'); $this->Popular_Select->removeDecorator('Label'); $this->Poi_TagLine = $this->createElement('text', 'PoiTagline'); $this->Poi_TagLine->removeDecorator('HtmlTag'); $this->Poi_TagLine->removeDecorator('DtDdWrapper'); $this->Poi_TagLine->removeDecorator('Label'); $this->Poi_TagLine->setAttrib('class', 'mediumele'); $this->Poi_Address = $this->createElement('text', 'PoiAddress'); $this->Poi_Address->setAttrib('class', 'tableFormInputLong'); $this->Poi_Address->removeDecorator('HtmlTag'); $this->Poi_Address->removeDecorator('DtDdWrapper'); $this->Poi_Address->removeDecorator('Label'); $this->Poi_Address->setAttrib('class', 'mediumele'); $this->Poi_Phone = $this->createElement('text', 'PoiPhone'); $this->Poi_Phone->removeDecorator('HtmlTag'); $this->Poi_Phone->removeDecorator('DtDdWrapper'); $this->Poi_Phone->removeDecorator('Label'); $this->Poi_Phone->setAttrib('class', 'mediumele'); $this->Poi_Website = $this->createElement('text', 'PoiWebsite'); $this->Poi_Website->removeDecorator('HtmlTag'); $this->Poi_Website->removeDecorator('DtDdWrapper'); $this->Poi_Website->removeDecorator('Label'); $this->Poi_Website->setAttrib('class', 'mediumele'); $this->SpecialDestination = $this->createElement('checkbox', 'SpecialDestination'); $this->SpecialDestination->removeDecorator('HtmlTag'); $this->SpecialDestination->removeDecorator('DtDdWrapper'); $this->SpecialDestination->removeDecorator('Label'); $this->SpecialDestination->setCheckedValue(1); $this->SpecialDestination->setUncheckedValue(0); $this->SpecialDestination->setAttrib('onclick', 'showHeaderImage($(this));'); $this->HeaderImage = $this->createElement('text', 'HeaderImage'); $this->HeaderImage->removeDecorator('HtmlTag'); $this->HeaderImage->removeDecorator('DtDdWrapper'); $this->HeaderImage->removeDecorator('Label'); $this->HeaderImage->setAttrib('class', 'disabled'); $category = $tableCategory->getAllParentIdNameForSelectByLangId(2); $this->Category_Select = $this->createElement('select', 'CategorySelect', $category); $this->Category_Select->removeDecorator('HtmlTag'); $this->Category_Select->removeDecorator('DtDdWrapper'); $this->Category_Select->removeDecorator('Label'); $this->Category_Select->setAttrib('onchange', 'getChildCategoryIndo(this.value);'); $category_child = $tableCategory->getAllChildIdNameByParentIdLangId(null, 2); $this->Category_Child = $this->createElement('select', 'CategoryChild', $category_child); $this->Category_Child->removeDecorator('HtmlTag'); $this->Category_Child->removeDecorator('DtDdWrapper'); $this->Category_Child->removeDecorator('Label'); $data = $tableArea->setAreaForSelectElement(1); $temp = array(0 => 'select Island'); $area_data = $temp + $data; $data = array("multiOptions" => $area_data); $this->Island_Select = $this->createElement('select', 'IslandListOptions', $data); $this->Island_Select->removeDecorator('HtmlTag'); $this->Island_Select->removeDecorator('DtDdWrapper'); $this->Island_Select->removeDecorator('Label'); $this->Island_Select->setAttrib('onchange', 'getAreaList(this.value,0);'); $this->Poi_x = $this->createElement('text', 'pointx'); $this->Poi_x->removeDecorator('HtmlTag'); $this->Poi_x->setAttrib('class', 'required'); $this->Poi_x->removeDecorator('DtDdWrapper'); $this->Poi_x->removeDecorator('Label'); $this->Poi_x->setAttrib('onkeyup', 'UpdatePosition();'); $this->Poi_x->setAttrib('class', 'smallele'); $this->Poi_x->setRequired(TRUE); $this->Poi_y = $this->createElement('text', 'pointy'); $this->Poi_y->removeDecorator('HtmlTag'); $this->Poi_y->setAttrib('class', 'required'); $this->Poi_y->removeDecorator('DtDdWrapper'); $this->Poi_y->removeDecorator('Label'); $this->Poi_y->setAttrib('onkeyup', 'UpdatePosition();'); $this->Poi_y->setAttrib('class', 'smallele'); $this->Poi_y->setRequired(TRUE); $this->Poi_Information = $this->createElement('textarea', 'PoiInformation'); $this->Poi_Information->removeDecorator('HtmlTag'); $this->Poi_Information->removeDecorator('DtDdWrapper'); $this->Poi_Information->removeDecorator('Label'); $this->Poi_Information->setAttribs(array('cols' => 5, 'rows' => 5)); $this->Poi_HowToGetThere = $this->createElement('textarea', 'PoiHowToGetThere'); $this->Poi_HowToGetThere->removeDecorator('HtmlTag'); $this->Poi_HowToGetThere->removeDecorator('DtDdWrapper'); $this->Poi_HowToGetThere->removeDecorator('Label'); $this->Poi_HowToGetAround = $this->createElement('textarea', 'PoiHowToGetAround'); $this->Poi_HowToGetAround->removeDecorator('HtmlTag'); $this->Poi_HowToGetAround->removeDecorator('DtDdWrapper'); $this->Poi_HowToGetAround->removeDecorator('Label'); $this->Poi_WhatToDo = $this->createElement('textarea', 'PoiWhatToDo'); $this->Poi_WhatToDo->removeDecorator('HtmlTag'); $this->Poi_WhatToDo->removeDecorator('DtDdWrapper'); $this->Poi_WhatToDo->removeDecorator('Label'); $this->Poi_WhereToEat = $this->createElement('textarea', 'PoiWhereToEat'); $this->Poi_WhereToEat->removeDecorator('HtmlTag'); $this->Poi_WhereToEat->removeDecorator('DtDdWrapper'); $this->Poi_WhereToEat->removeDecorator('Label'); $this->Poi_WhereToStay = $this->createElement('textarea', 'PoiWhereToStay'); $this->Poi_WhereToStay->removeDecorator('HtmlTag'); $this->Poi_WhereToStay->removeDecorator('DtDdWrapper'); $this->Poi_WhereToStay->removeDecorator('Label'); $this->Poi_WhatToBuy = $this->createElement('textarea', 'PoiWhatToBuy'); $this->Poi_WhatToBuy->removeDecorator('HtmlTag'); $this->Poi_WhatToBuy->removeDecorator('DtDdWrapper'); $this->Poi_WhatToBuy->removeDecorator('Label'); $this->Poi_Tips = $this->createElement('textarea', 'PoiTips'); $this->Poi_Tips->removeDecorator('HtmlTag'); $this->Poi_Tips->removeDecorator('DtDdWrapper'); $this->Poi_Tips->removeDecorator('Label'); /*hidden element*/ $this->relPoi_counter = $this->createElement('hidden', 'relPoi_counter'); $this->relPoi_counter->removeDecorator('HtmlTag'); $this->relPoi_counter->removeDecorator('DtDdWrapper'); $this->relPoi_counter->removeDecorator('Label'); $this->relPoi_counter->setValue(0); $this->SaveStatus = $this->createElement('hidden', 'SaveStatus'); $this->SaveStatus->removeDecorator('HtmlTag'); $this->SaveStatus->removeDecorator('DtDdWrapper'); $this->SaveStatus->removeDecorator('Label'); $this->SaveStatus->setValue(1); /** * This element will be used for maximum area counter storage, * when you remove an area this counter number wont be decreased */ $this->Count_area = $this->createElement('hidden', 'MaxArea'); $this->Count_area->removeDecorator('HtmlTag'); $this->Count_area->removeDecorator('DtDdWrapper'); $this->Count_area->removeDecorator('Label'); $this->Count_area->setValue(0); /** * This element will be used for maximum category counter storage, * when you remove a category this counter number wont be decreased */ $this->Count_category = $this->createElement('hidden', 'MaxCategory'); $this->Count_category->removeDecorator('HtmlTag'); $this->Count_category->removeDecorator('DtDdWrapper'); $this->Count_category->removeDecorator('Label'); $this->Count_category->setValue(0); $this->Area_counter = $this->createElement('hidden', 'AreaCounter'); $this->Area_counter->removeDecorator('HtmlTag'); $this->Area_counter->removeDecorator('DtDdWrapper'); $this->Area_counter->removeDecorator('Label'); $this->Area_counter->setValue(0); $this->Category_counter = $this->createElement('hidden', 'CategoryCounter'); $this->Category_counter->removeDecorator('HtmlTag'); $this->Category_counter->removeDecorator('DtDdWrapper'); $this->Category_counter->removeDecorator('Label'); $this->Category_counter->setValue(0); $this->Main_category = $this->createElement('hidden', 'MainCategory'); $this->Main_category->removeDecorator('HtmlTag'); $this->Main_category->removeDecorator('DtDdWrapper'); $this->Main_category->removeDecorator('Label'); $this->Main_category->setValue(0); }
public function init() { $tableArea = new Model_DbTable_Area(); $tableCategory = new Model_DbTable_Category(); $dateValidator = new Zend_Validate_Date(); $this->name = new Zend_Form_Element_Text('Name'); $this->name->setRequired(true)->setAttrib('class', 'span7')->setAttrib('placeholder', 'Masukan Nama Kebudayaan Disini...')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label'); $this->featured = new Zend_Form_Element_Checkbox('Featured'); $this->featured->setAttrib('class', 'checkbox')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label'); $this->description = new Zend_Form_Element_Textarea('Description'); $this->description->setAttrib('style', 'width:100%')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label'); $this->header_image = new Zend_Form_Element_File('Header_image'); $this->header_image->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label'); $this->submit = new Zend_Form_Element_Submit('Submit'); $this->submit->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setAttribs(array('class' => 'btn btn-success', 'id' => 'submit-btn')); $this->draft = new Zend_Form_Element_Submit('Draft'); $this->draft->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setAttribs(array('class' => 'btn', 'id' => 'draft-btn')); $this->videos = new Zend_Form_SubForm(); $category = $tableCategory->getAllParentIdNameForSelectByLangId(1); $this->Category_Select = $this->createElement('select', 'CategorySelect', $category); $this->Category_Select->removeDecorator('HtmlTag'); $this->Category_Select->removeDecorator('DtDdWrapper'); $this->Category_Select->removeDecorator('Label'); $this->Category_Select->setAttrib('onchange', 'getChildCategory(this.value);'); $category_child = $tableCategory->getAllChildIdNameByParentIdLangId(); $this->Category_Child = $this->createElement('select', 'CategoryChild', $category_child); $this->Category_Child->removeDecorator('HtmlTag'); $this->Category_Child->removeDecorator('DtDdWrapper'); $this->Category_Child->removeDecorator('Label'); $data = $tableArea->setAreaForSelectElement(1); $temp = array(0 => 'Pilih Area'); $area_data = $temp + $data; $data = array("multiOptions" => $area_data); $this->Island_Select = $this->createElement('select', 'IslandListOptions', $data); $this->Island_Select->removeDecorator('HtmlTag'); $this->Island_Select->removeDecorator('DtDdWrapper'); $this->Island_Select->removeDecorator('Label'); $this->Island_Select->setAttrib('onchange', 'getAreaList(this.value,0);'); $this->Poi_x = $this->createElement('hidden', 'pointx'); $this->Poi_x->removeDecorator('HtmlTag'); $this->Poi_x->setAttrib('class', 'required'); $this->Poi_x->removeDecorator('DtDdWrapper'); $this->Poi_x->removeDecorator('Label'); $this->Poi_x->setAttrib('onkeyup', 'updatePosition();'); $this->Poi_x->setAttrib('class', 'smallele'); $this->Poi_x->setRequired(TRUE); $this->Poi_y = $this->createElement('hidden', 'pointy'); $this->Poi_y->removeDecorator('HtmlTag'); $this->Poi_y->setAttrib('class', 'required'); $this->Poi_y->removeDecorator('DtDdWrapper'); $this->Poi_y->removeDecorator('Label'); $this->Poi_y->setAttrib('onkeyup', 'updatePosition();'); $this->Poi_y->setAttrib('class', 'smallele'); $this->Poi_y->setRequired(TRUE); /* hidden element */ $this->relPoi_counter = $this->createElement('hidden', 'relPoi_counter'); $this->relPoi_counter->removeDecorator('HtmlTag'); $this->relPoi_counter->removeDecorator('DtDdWrapper'); $this->relPoi_counter->removeDecorator('Label'); $this->relPoi_counter->setValue(0); $this->SaveStatus = $this->createElement('hidden', 'SaveStatus'); $this->SaveStatus->removeDecorator('HtmlTag'); $this->SaveStatus->removeDecorator('DtDdWrapper'); $this->SaveStatus->removeDecorator('Label'); $this->SaveStatus->setValue(1); /** * This element will be used for maximum area counter storage, * when you remove an area this counter number wont be decreased */ $this->Count_area = $this->createElement('hidden', 'MaxArea'); $this->Count_area->removeDecorator('HtmlTag'); $this->Count_area->removeDecorator('DtDdWrapper'); $this->Count_area->removeDecorator('Label'); $this->Count_area->setValue(0); /** * This element will be used for maximum category counter storage, * when you remove a category this counter number wont be decreased */ $this->Count_category = $this->createElement('hidden', 'MaxCategory'); $this->Count_category->removeDecorator('HtmlTag'); $this->Count_category->removeDecorator('DtDdWrapper'); $this->Count_category->removeDecorator('Label'); $this->Count_category->setValue(0); $this->Area_counter = $this->createElement('hidden', 'AreaCounter'); $this->Area_counter->removeDecorator('HtmlTag'); $this->Area_counter->removeDecorator('DtDdWrapper'); $this->Area_counter->removeDecorator('Label'); $this->Area_counter->setValue(0); $this->Category_counter = $this->createElement('hidden', 'CategoryCounter'); $this->Category_counter->removeDecorator('HtmlTag'); $this->Category_counter->removeDecorator('DtDdWrapper'); $this->Category_counter->removeDecorator('Label'); $this->Category_counter->setValue(0); $this->Main_category = $this->createElement('hidden', 'MainCategory'); $this->Main_category->removeDecorator('HtmlTag'); $this->Main_category->removeDecorator('DtDdWrapper'); $this->Main_category->removeDecorator('Label'); $this->Main_category->setValue(0); }
/** * IS: Parameter id terdeklarasi * FS: Mengirimkan ke viewer: form, gkey, area, data, tourismid * Desc: Mengatur aksi yang dilakukan untuk halaman edit */ public function editAction() { /*Creating table instances*/ $table_classification = new Model_DbTable_Classification(); $table_area = new Model_DbTable_Area(); $table_tourism = new Model_DbTable_TourismOperator(); $table_tourismdescription = new Model_DbTable_TourismOperatorDescription(); $table_classtotourism = new Model_DbTable_ClassificationToTourismOperator(); $table_coveragearea = new Model_DbTable_CoverageArea(); $form = new Admin_Form_VitoForm(); $island_list = $table_area->getAllParentArea(); $tourism_id = $this->_getParam('id'); $this->view->state_edit = TRUE; if ($this->getRequest()->isPost()) { if ($form->isValid($_POST)) { /*preparing data for tourismoperator table*/ $data = array('area_id' => $_POST['TourismArea'], 'phone' => $_POST['TourismOperatorPhone'], 'website' => $_POST['TourismOperatorWebsite'], 'address' => $_POST['TourismOperatorAddress'], 'pointX' => 0, 'pointY' => 0, 'star' => 0, 'fax' => $_POST['TourismOperatorFax'], 'email' => $_POST['TourismOperatorEmail']); /*updating data to the tourismoperator table*/ $table_tourism->updateTourismOperator($data, $tourism_id); /*preparing data for tourismoperatordescription table*/ $data = array('tourismoperator_id' => $tourism_id, 'language_id' => 1, 'name' => $_POST['TourismOperatorRegion'], 'description' => $_POST['TourismOperatorLangName']); /*updating data to the tourismoperator description table*/ $table_tourismdescription->updateTourismOperatorDescription($data, $tourism_id); $this->loggingaction('vito', 'edit', $tourism_id); $this->_flash->addMessage('1\\Vito Update Success!'); $this->_redirect($this->view->rootUrl('/admin/vito/')); } } $data_amount = $table_classtotourism->countClassByTourismId($tourism_id); $data = $table_tourism->getAllTourismDataByIdLang($tourism_id, 1); /** *Set every element Value *Below are standard element value set that doesnt require any further database select operation */ $form->TourismOperatorEmail->setValue($data['email']); $form->TourismOperatorPhone->setValue($data['phone']); $form->TourismOperatorArea->setValue($data['area_id']); $form->TourismOperatorWebsite->setValue($data['website']); $form->TourismOperatorAddress->setValue($this->view->HtmlDecode($data['address'])); $form->TourismOperatorFax->setValue($data['fax']); $form->TourismOperatorRegion->setValue($data['langname']); $form->TourismOperatorLangName->setValue($this->view->HtmlDecode($data['description'])); /*Count tourismoperator classification*/ /*Send variable to the view*/ $this->view->form = $form; $this->view->gkey = Zend_Registry::get('gmap_key'); $this->view->tourismid = $tourism_id; }
/** * IS: Parameter id terdeklarasi * FS: Mengirimkan ke viewer: form, language_id, parent_id, parent_data * Desc: Mengatur aksi yang dilakukan untuk halaman edit */ public function editAction() { //variable and class initiation $area_id = $this->_getParam('id'); $language_id = $this->_getParam('lang'); $form = new Admin_Form_AreaForm(); $table_area = new Model_DbTable_Area(); $table_regionalinfo = new Model_DbTable_Regional(); $parent_data = $table_area->getAllParentArea(array('area_id')); $area_data = null; //if this is a post request if ($this->getRequest()->isPost()) { if ($form->isValid($_POST)) { if ($language_id != 1) { $indo = $table_regionalinfo->checkForIndo($area_id); if ($indo) { $data = array('area_id' => $area_id, 'language_id' => $language_id, 'area_name' => $_POST['areaNameLan'], 'regional_description' => $_POST['areaDescription'], 'history' => $_POST['areaHistory'], 'people_and_customs' => $_POST['areaPeople'], 'entry' => $_POST['areaEntry'], 'cuisine' => $_POST['areaCuisine'], 'tourism_office' => $_POST['areaTourismOffice']); $table_regionalinfo->updateArea($area_id, $data, $language_id); } else { $data = array('area_id' => $area_id, 'language_id' => $language_id, 'area_name' => $_POST['areaNameLan'], 'regional_description' => $_POST['areaDescription'], 'history' => $_POST['areaHistory'], 'people_and_customs' => $_POST['areaPeople'], 'entry' => $_POST['areaEntry'], 'cuisine' => $_POST['areaCuisine'], 'tourism_office' => $_POST['areaTourismOffice']); $table_regionalinfo->insertArea($data); } } else { //get the parent area for determine area type $area_type = $table_area->getAreaTypeById($_POST['parentArea']) + 1; //preparing data for insert process $data = array('pointX' => $_POST['pointx'], 'pointY' => $_POST['pointy'], 'parent_id' => $_POST['parentArea'], 'area_type' => $area_type); $table_area->updateArea($area_id, $data); $data = array('area_id' => $area_id, 'language_id' => $language_id, 'area_name' => $_POST['areaNameLan'], 'regional_description' => $_POST['areaDescription'], 'history' => $_POST['areaHistory'], 'people_and_customs' => $_POST['areaPeople'], 'entry' => $_POST['areaEntry'], 'cuisine' => $_POST['areaCuisine'], 'tourism_office' => $_POST['areaTourismOffice']); $table_regionalinfo->updateArea($area_id, $data, 1); } $this->loggingaction('region', 'edit', $area_id, $language_id); $this->_flash->addMessage('1\\Region Update Success!'); $this->_redirect($this->view->rootUrl('/admin/region/')); } } if ($language_id != 1) { $indo = $table_regionalinfo->checkForIndo($area_id); if ($indo) { $area_data = $table_area->getAllById($area_id, $language_id); } } else { $area_data = $table_area->getAllById($area_id, $language_id); } //get data from the database and load it to the view // if($area_data !=null) // { $this->view->parent_id = $area_data['parent_id']; //set element value $form->areaDescription->setvalue($area_data['regional_description']); $form->areaEntry->setvalue($area_data['entry']); $form->areaHistory->setvalue($area_data['history']); $form->areaPeople->setvalue($area_data['people_and_customs']); $form->areaCuisine->setvalue($area_data['cuisine']); $form->areaTourismOffice->setvalue($area_data['tourism_office']); $form->areaNameLang->setvalue($area_data['area_name']); $form->Poi_x->setvalue($area_data['pointX']); $form->Poi_y->setvalue($area_data['pointY']); //send data to the view $this->view->language_id = $language_id; $this->view->parent_data = $parent_data; $this->view->form = $form; $this->view->gkey = Zend_Registry::get('gmap_key'); // } }
/** * IS: Terdeklarasinya filter dan param di session, dan page_row * FS: Mengirimkan ke viewer: cleanUrl, message, page_row, paginator, * all_area, all_category, filter_alert * Desc: Mengatur aksi yang dilakukan untuk halaman index */ public function indexAction() { //variable initiation and instance creation $this->view->cleanurl = $this->_cleanUrl; //get messages from CRUD process $message = $this->_flash->getMessages(); if (!empty($message)) { $this->view->message = $message; } //create table instances $table_destination = new Model_DbTable_Destination(); $table_area = new Model_DbTable_Area(); $table_category = new Model_DbTable_Category(); //set variable initial value $filter = null; $new_search = FALSE; //get params for the filter if ($this->getRequest()->isPost()) { $filter = $_POST['filterPage']; $new_search = TRUE; $this->_paginator_sess->filterDestinationIndo = $filter; switch ($filter) { case 0: $param = null; case 1: $param = $_POST['filterName']; break; case 2: $param = $_POST['filterArea']; break; case 3: $param = $_POST['filterCategory']; break; case 4: $param = $_POST['filterStatus']; break; case 5: $param = $_POST['filterSpecial']; break; } $this->_paginator_sess->param = $param; } //set paginator for list of destination data $filter = $this->_paginator_sess->filterDestinationIndo; $param = $this->_paginator_sess->param; $select = $table_destination->getQueryAllByLang($filter, $param, 2); //get pagerow setting and send to the paginator control $page_row = $this->_getParam('filterPageRow'); $this->view->row = $page_row; if ($page_row != null) { $paginator = parent::setPaginator($select, $page_row); } else { $paginator = parent::setPaginator($select); } //if this is a new search then return the page number back to the 1st page if ($new_search) { $paginator->setCurrentPageNumber(1); } //send data to the view $this->view->paginator = $paginator; $area_data = $table_area->getallAreaNameId(2); $this->view->all_area = $area_data; $category_data = $table_category->getAllCategoryIdNameByLangId(2); $this->view->all_category = $category_data; /** Return alert to view on filter selected */ switch ($filter) { case 0: $filter_alert = "Show all destinations"; break; case 1: $filter_alert = "Destinations which name with keyword '" . $param . "'"; break; case 2: foreach ($area_data as $area) { $parent[$area['area_id']] = $area['name']; } $filter_alert = "Destinations that located at '" . trim($parent[$param]) . "' area"; break; case 3: foreach ($category_data as $category) { $parent[$category['category_id']] = $category['name']; } $filter_alert = "Destinations with '" . $parent[$param] . "' category"; break; case 4: $param == '1' ? $state = 'Published' : ($state = 'Draft'); $filter_alert = "Destinations with '" . $state . "' status"; break; case 5: $param == '1' ? $state = 'Featured' : ($state = 'Non Featured'); $filter_alert = "Destinations that are '" . $state . "'"; break; } $this->view->alert = $filter_alert; }
public function getAllByAreaList($areaId, $languageId) { $areaDb = new Model_DbTable_Area(); $areaList = $areaDb->getAllAreaChildList($areaId); if (count($areaList)) { $query = $this->select()->setIntegrityCheck(false)->from($this->_name, array('poi_id', 'poi_name' => 'name', 'description'))->join($this->_desti, "{$this->_desti}.poi_id = {$this->_name}.poi_id", array('pointX', 'pointY', 'special'))->join($this->_atp, "{$this->_atp}.poi_id = {$this->_name}.poi_id", array(''))->where("{$this->_name}.language_id = ?", $languageId)->where("{$this->_atp}.area_id IN (?)", $areaList)->order("{$this->_desti}.special")->group("{$this->_name}.poi_id"); //echo $query->__toString(); $data = $this->fetchAll($query); if (count($data)) { return $data->toArray(); } } return array(); }
} switch ($type) { case 1: $uploaddir = UPLOAD_FOLDER . 'poi/header/'; break; case 2: $uploaddir = UPLOAD_FOLDER . 'article/'; break;
/** * IS: Parameter id terdeklarasi * FS: Mengirimkan ke viewer: pageTitle, areaType, region, staticType, * menuType * Desc: Fungsi untuk menampilkan detail region */ public function regionDetailAction() { // Param $areaId = $this->_getParam('id'); // Model $areaDb = new Model_DbTable_Area(); $regionalDb = new Model_DbTable_Regional(); // Data $areaType = $areaDb->getAreaTypeById($areaId); $region = $regionalDb->getAllByIdLang($areaId, $this->_languageId); $texthomelink = $this->view->translate('id_menu_home'); // Breadcrumb $links = array($texthomelink => $this->view->baseUrl('/'), $this->view->translate('id_static_list') => $this->view->baseUrl('/discover-indonesia/region-list'), $region['area_name'] => ''); Zend_Registry::set('breadcrumb', $links); // View $this->view->pageTitle = $region['area_name']; $this->view->areaType = $areaType; $this->view->region = $region; $this->view->staticType = 'list'; $this->view->menuType = 'discover'; }
public function init() { $table_classification = new Model_DbTable_Classification(); $table_area = new Model_DbTable_Area(); $this->Count_class = $this->createElement('hidden', 'MaxClass'); $this->Count_class->removeDecorator('HtmlTag'); $this->Count_class->removeDecorator('DtDdWrapper'); $this->Count_class->removeDecorator('Label'); $this->Count_class->setValue(0); $this->TourismOperatorArea = $this->createElement('hidden', 'TourismArea'); $this->TourismOperatorArea->removeDecorator('HtmlTag'); $this->TourismOperatorArea->removeDecorator('DtDdWrapper'); $this->TourismOperatorArea->removeDecorator('Label'); $this->TourismOperatorArea->setValue(0); $this->Class_counter = $this->createElement('hidden', 'ClassCounter'); $this->Class_counter->removeDecorator('HtmlTag'); $this->Class_counter->removeDecorator('DtDdWrapper'); $this->Class_counter->removeDecorator('Label'); $this->Class_counter->setValue(0); $this->TourismOperatorFax = $this->createElement('text', 'TourismOperatorFax'); $this->TourismOperatorFax->removeDecorator('HtmlTag'); $this->TourismOperatorFax->removeDecorator('DtDdWrapper'); $this->TourismOperatorFax->setAttrib('class', 'mediumele'); $this->TourismOperatorFax->removeDecorator('Label'); $this->TourismOperatorStar = $this->createElement('text', 'TourismOperatorStar'); $this->TourismOperatorStar->removeDecorator('HtmlTag'); $this->TourismOperatorStar->removeDecorator('DtDdWrapper'); $this->TourismOperatorStar->setAttrib('class', 'smallele'); $this->TourismOperatorStar->removeDecorator('Label'); $this->TourismOperatorStar->setValue(0); $this->TourismOperatorEmail = $this->createElement('text', 'TourismOperatorEmail'); $this->TourismOperatorEmail->removeDecorator('HtmlTag'); $this->TourismOperatorEmail->removeDecorator('DtDdWrapper'); $this->TourismOperatorEmail->removeDecorator('Label'); $this->TourismOperatorEmail->setAttrib('class', 'mediumele'); $this->TourismOperatorEmail->setAttrib('class', 'tableFormInputNormal'); $this->TourismOperatorLangName = $this->createElement('text', 'TourismOperatorLangName'); $this->TourismOperatorLangName->removeDecorator('HtmlTag'); $this->TourismOperatorLangName->setAttrib('class', 'mediumele'); $this->TourismOperatorLangName->removeDecorator('DtDdWrapper'); $this->TourismOperatorLangName->removeDecorator('Label'); $this->TourismOperatorPhone = $this->createElement('text', 'TourismOperatorPhone'); $this->TourismOperatorPhone->removeDecorator('HtmlTag'); $this->TourismOperatorPhone->removeDecorator('DtDdWrapper'); $this->TourismOperatorPhone->setAttrib('class', 'mediumele'); $this->TourismOperatorPhone->removeDecorator('Label'); $this->TourismOperatorWebsite = $this->createElement('text', 'TourismOperatorWebsite'); $this->TourismOperatorWebsite->removeDecorator('HtmlTag'); $this->TourismOperatorWebsite->removeDecorator('DtDdWrapper'); $this->TourismOperatorWebsite->removeDecorator('Label'); $this->TourismOperatorWebsite->setAttrib('class', 'mediumele'); $this->Pointx = $this->createElement('text', 'Pointx'); $this->Pointx->removeDecorator('HtmlTag'); $this->Pointx->removeDecorator('DtDdWrapper'); $this->Pointx->removeDecorator('Label'); $this->Pointx->setAttrib('class', 'smallele'); $this->Pointx->setAttrib('onkeyup', 'UpdatePosition();'); $this->Pointy = $this->createElement('text', 'Pointy'); $this->Pointy->removeDecorator('HtmlTag'); $this->Pointy->removeDecorator('DtDdWrapper'); $this->Pointy->removeDecorator('Label'); $this->Pointy->setAttrib('onkeyup', 'UpdatePosition();'); $this->Pointy->setAttrib('class', 'smallele'); $classification_list = $table_classification->setClassificationForSelectElement(); $option_value = array("multiOptions" => $classification_list); $this->ClassificationSelect = $this->createElement('select', 'ClassSelect', $option_value); $this->ClassificationSelect->removeDecorator('HtmlTag'); $this->ClassificationSelect->removeDecorator('DtDdWrapper'); $this->ClassificationSelect->removeDecorator('Label'); $data = $table_area->setAreaForSelectElement(1); $temp = array(0 => 'select Island'); $area_data = $temp + $data; $data = array("multiOptions" => $area_data); $this->Island_Select = $this->createElement('select', 'IslandCoverOptions', $data); $this->Island_Select->removeDecorator('HtmlTag'); $this->Island_Select->removeDecorator('DtDdWrapper'); $this->Island_Select->removeDecorator('Label'); $this->Island_Select->setAttrib('onchange', 'getAreaCover(this.value,0);'); $data = $table_area->setAreaForSelectElement(1); $temp = array(0 => 'select Island'); $area_data = $temp + $data; $data = array("multiOptions" => $area_data); $this->AreaSelect = $this->createElement('select', 'IslandListOptions', $data); $this->AreaSelect->removeDecorator('HtmlTag'); $this->AreaSelect->removeDecorator('DtDdWrapper'); $this->AreaSelect->removeDecorator('Label'); $this->AreaSelect->setAttrib('onchange', 'getAreaList(this.value,0);'); $this->Poiselect = $this->createElement('select', 'PopularSelect', $popular); $this->Poiselect->removeDecorator('HtmlTag'); $this->Poiselect->removeDecorator('DtDdWrapper'); $this->Poiselect->removeDecorator('Label'); $this->TourismOperatorAddress = $this->createElement('textarea', 'TourismOperatorAddress'); $this->TourismOperatorAddress->removeDecorator('HtmlTag'); $this->TourismOperatorAddress->removeDecorator('DtDdWrapper'); $this->TourismOperatorAddress->removeDecorator('Label'); $this->TourismOperatorAddress->setAttribs(array('cols' => 20, 'rows' => 5)); $this->TourismOperatorDescription = $this->createElement('textarea', 'TourismOperatorDescription'); $this->TourismOperatorDescription->removeDecorator('HtmlTag'); $this->TourismOperatorDescription->removeDecorator('DtDdWrapper'); $this->TourismOperatorDescription->removeDecorator('Label'); $this->TourismOperatorDescription->setAttribs(array('cols' => 5, 'rows' => 5)); }