/**
  * IS: Terdeklarasinya page_row
  * FS: Mengirimkan ke viewer: cleanUrl, message, page_row, paginator,
  *     classification_list, island_list
  * Desc: Mengatur aksi yang dilakukan untuk halaman index tourism operator
  */
 public function indexAction()
 {
     //send this page url to the view
     $this->view->cleanurl = $this->_cleanUrl;
     //get messages from CRUD process
     $message = $this->_flash->getMessages();
     if (!empty($message)) {
         $this->view->message = $message;
     }
     //create table instance
     $table_tourismoperator = new Model_DbTable_TourismOperator();
     $table_classification = new Model_DbTable_Classification();
     $table_area = new Model_DbTable_Area();
     //set the variable initial value
     $filter = null;
     $new_search = FALSE;
     //get the filter params
     if ($this->getRequest()->isPost()) {
         $filter = $_POST['filterPage'];
         $new_search = TRUE;
         $this->_paginator_sess->tpfilter = $filter;
         switch ($filter) {
             case 1:
                 $param = $_POST['filtertitle'];
                 break;
             case 2:
                 $param = $_POST['filterclass'];
                 break;
             case 3:
                 $param = $_POST['filterarea'];
                 break;
         }
         $this->_paginator_sess->param = $param;
     }
     //get the params from session and create paginator
     $filter = $this->_paginator_sess->tpfilter;
     $param = $this->_paginator_sess->param;
     $select = $table_tourismoperator->getQueryAllByLang($filter, $param);
     //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);
     }
     //Processing data for view element
     $classification_list = $table_classification->getAllClassification();
     $column = array('id' => 'area_id');
     $island_list = $table_area->getAllParentArea($column);
     //send data to the view
     $this->view->classification_list = $classification_list;
     $this->view->island_list = $island_list;
     $this->view->paginator = $paginator;
     /** Return alert to view on filter selected */
     switch ($filter) {
         case 0:
             $filter_alert = "Show all tourism operators";
             break;
         case 1:
             $filter_alert = "Tourism operator which name with keyword '" . $param . "'";
             break;
         case 2:
             foreach ($classification_list as $class) {
                 $parent[$class['id']] = $class['name'];
             }
             $filter_alert = "Tourism operators with '" . $parent[$param] . "' classification";
             break;
         case 3:
             $filter_alert = "Tourism operator located  in '" . $this->view->areaName($param) . "'";
     }
     $this->view->alert = $filter_alert;
 }
 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));
 }