Example #1
0
 private function _getMainImage($row)
 {
     $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
     $imageDb = new Model_DbTable_Image();
     $result = $imageDb->getImageById($row['poi_id']);
     $mainImage = "";
     if (count($result) > 0) {
         $linkImage = $baseUrl . '/media/images/upload/poi/' . $result[0]['source'];
         $mainImage = "<img class='mapImageBox' src='" . $linkImage . "' alt='" . $row['descname'] . "' title='" . $row['descname'] . "'  />";
     }
     return $mainImage;
 }
 /**
  * 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");
 }
 /**
  * IS: -
  * FS: -
  * Desc: Fungsi inisialisasi
  */
 public function init()
 {
     parent::init();
     switch ($this->_languageId) {
         case 1:
             $langLocale = 'en';
             break;
         case 2:
             $langLocale = 'id';
             break;
     }
     $this->view->languageID = $langLocale;
     if ($this->_hasParam('destId')) {
         $imageDb = new Model_DbTable_Image();
         $imageGallery = $imageDb->getAllImageGalleryByPoiId($this->_destId);
         $this->view->imageGallery = $imageGallery;
     }
     $category = $this->getRequest()->getParam('category');
     $title = $this->getTitle($category);
     $this->view->bigPageTitle = $title;
     $this->view->bgClass = "orange";
 }
 protected function queryGallery($offset, $poi_id)
 {
     $imageDb = new Model_DbTable_Image();
     $imageGallery = $imageDb->pagingGallery($offset, $poi_id);
     return $imageGallery;
 }
 /**
  * Fungsi untuk mengambil sejumlah destinasi special yang diambil secara acak untuk
  * ditampilkan di home
  *
  * @param integer $numb
  * @param integer $lang_id
  * @return array
  */
 public function getRandomSpecialDestination($numberRandom, $langId = 1)
 {
     $data = $this->select()->from($this->_name, array('poi_id'))->join($this->_poidesc, "{$this->_name}.poi_id = {$this->_poidesc}.poi_id", array('name', 'description'))->setIntegrityCheck(false)->where("{$this->_name}.special = 1")->where("{$this->_name}.status != 0")->where("{$this->_poidesc}.language_id = ?", $langId)->order('RAND()')->limit($numberRandom, 0);
     $result = $this->fetchAll($data);
     $return = $result->toArray();
     $imageDb = new Model_DbTable_Image();
     for ($i = 0; $i < count($return); $i++) {
         $image = $imageDb->getMainImageSource($return[$i]['poi_id']);
         $return[$i]['source'] = $image['source'];
     }
     return $return;
 }
     $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
 $table_highlight = new Model_DbTable_Highlight();
 $status = $table_highlight->getFlagById($highlight_id);
 if ($status == 1) {
     $new_status = 0;
 } elseif ($status == 0) {
     $new_status = 1;
 }
 $data = array('flag' => $new_status);
 $table_highlight->updateHighlight($data, $highlight_id, $language_id);
 if ($new_status == 1) {
     $this->view->message = 'shown';
 } elseif ($new_status == 0) {
     $this->view->message = 'not shown';
 /**
  * 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()
 {
     $culture_id = $this->_getParam('id');
     $language_id = $this->_getParam('lang');
     $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_areatopoi = new Model_DbTable_AreaToPoi();
     $table_relatedpoi = new Model_DbTable_RelatedPoi();
     $this->table_cultureVideo = new Model_DbTable_CultureVideo();
     $form = new Admin_Form_PoiForm();
     $culture = null;
     $table_file = new Model_DbTable_FileAttachments();
     $table_gallery = new Model_DbTable_Image();
     $table_related_article_poi = new Model_DbTable_RelatedArticlePoi();
     // get realated article data
     // untuk menampilkan related link pada destinasi yang bersangkutan
     $ralated_poi = $table_related_article_poi->getByPoiId($culture_id, $language_id);
     $cultureVideos = $this->table_cultureVideo->findByCultureId($culture_id);
     $this->view->ralated_poi = $ralated_poi;
     $this->view->poi_id = $culture_id;
     $this->view->ralated_news = $ralated_poi;
     $this->view->cultureVideos = $cultureVideos;
     $this->view->files = $table_file->getByPoiId($culture_id);
     $this->view->images = $table_gallery->getByPoiId($culture_id);
     /* Update Process */
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $status = Model_DbTable_Destination::DRAFT;
             if (isset($_POST['Submit'])) {
                 if ($this->_userInfo->canApprove) {
                     $status = Model_DbTable_Destination::PUBLISH;
                 } else {
                     $status = Model_DbTable_Destination::PENDING;
                 }
             }
             $culture = array('pointX' => $_POST['pointx'], 'pointY' => $_POST['pointy'], 'main_category' => $_POST['MainCategory'], 'featured' => $_POST['Featured'], 'status' => $status);
             if ($form->header_image->isUploaded()) {
                 $file = pathinfo($form->header_image->getFileName());
                 $form->header_image->addFilter('Rename', UPLOAD_FOLDER . 'culture/' . $file['filename'] . '_' . time() . '.' . $file['extension']);
                 if ($form->header_image->receive()) {
                     $culture['image'] = $form->header_image->getValue();
                 }
             }
             $table_destination->updatePoi($culture, $culture_id);
             $culture_description = array('poi_id' => $culture_id, 'name' => $_POST['Name'], 'description' => $_POST['Description'], 'updated_by' => $this->_userInfo->id, 'updated_at' => Date('Y-m-d H:i:s'));
             $table_destination_description->UpdatePoiDescription($culture_description, $culture_id, 1);
             /* 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($culture_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' => $culture_id);
                     $table_categorytopoi->insertCategoryToPoi($category_poi);
                 }
             }
             /* 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, $culture_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($culture_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' => $culture_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, $culture_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($culture_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' => $culture_id, 'related_poi' => $value);
                     $table_relatedpoi->insertRelatedPoi($data);
                 }
             }
             foreach ($old_relpoi as $value) {
                 if (!in_array($value, $relpoi_stack)) {
                     $table_relatedpoi->deleteSpecificRelatedPoi($culture_id, $value);
                 }
             }
             ////$this->_helper->layout()->disableLayout();
             ////$this->_helper->viewRenderer->setNoRender(true);
             /* update related article */
             // this part add related
             if ($_POST['counterRelated'] > 0) {
                 $counter = $_POST['counterRelated'];
                 for ($i = 1; $i <= $counter; $i++) {
                     //cek existing data ke database
                     // if jika data link dan label yang dikirim dari viwer
                     // blm ada di database, maka akan di simpan
                     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' => $culture_id, 'label' => $_POST['label' . $i], 'link' => $_POST['link' . $i], 'language_id' => $language_id);
                             $table_related_article_poi->insertRelated($data);
                         }
                     }
                 }
             }
             $this->handleInsertVideoLink($culture_id);
             $upload_dir = UPLOAD_FOLDER . 'documents/';
             $upload_image_dir = UPLOAD_FOLDER . 'culture/';
             $upload = new Zend_File_Transfer_Adapter_Http();
             $files = $upload->getFileInfo();
             $i = 0;
             $j = 0;
             echo "<pre>" . print_r($files, true) . "</pre>";
             foreach ($files as $file => $info) {
                 $info['destination'] = $upload_image_dir;
                 if (strstr($file, 'files')) {
                     $file = array('poi_id' => $culture_id, 'title' => $_POST['titles'][$i], 'name' => $info['name'], 'size' => $info['size']);
                     $table_file->insert($file);
                     $upload->setDestination($upload_dir);
                     $i++;
                 } else {
                     if (strstr($file, 'images')) {
                         $image = array('poi_id' => $culture_id, 'source' => $info['name'], 'name' => $_POST['imageTitles'][$j]);
                         $table_gallery->insert($image);
                         $upload->setDestination($upload_image_dir);
                         $j++;
                     }
                 }
                 $upload->receive($info['name']);
             }
             if (isset($_POST['existingFiles'])) {
                 $existingFiles = $_POST['existingFiles'];
                 foreach ($existingFiles as $id => $file) {
                     $data = array('title' => $file['title']);
                     $table_file->update($data, "id = {$id}");
                 }
             }
             if (isset($_POST['existingImages'])) {
                 $existingImages = $_POST['existingImages'];
                 foreach ($existingImages as $id => $image) {
                     $data = array('name' => $image['name']);
                     $table_gallery->update($data, "gallery_id = {$id}");
                 }
             }
             // part untuk menghapus data dari database
             // bagian ini akan dijalankan apabila ada triger hapus
             // delete dari viewer
             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', $culture_id, $language_id);
             $this->_flash->addMessage('Sunting Kebudayaan Berhasil!');
             //redirect to the destination list page
             $this->_redirect($this->view->rootUrl('/admin/culture/'));
         }
     }
     /* load data from the database preparing for view process */
     if (!$this->_userInfo->canApprove) {
         $form->submit->setLabel('Sunting Untuk Pratinjau');
         $form->draft->setLabel('Jadikan Sebagai Draft');
     } else {
         $form->submit->setLabel('Sunting');
     }
     if ($language_id == 1) {
         $culture = $table_destination->getAllByIdLang($culture_id, $language_id, false);
         $parent_category = $table_category->getparentCategoryId($culture['main_category']);
         $parent_area = $table_areatopoi->getPoiAreaId($culture_id);
         $related_poi = $table_relatedpoi->getAllRelatedByPoiIdLangId($culture_id, $language_id);
     } else {
         $indo = $table_destination_description->checkForIndo($culture_id);
         if ($indo) {
             $culture = $table_destination->getAllByIdLang($culture_id, $language_id);
         }
     }
     $checkSpecial = $table_destination->checkDestSpecialById($culture_id);
     $this->view->destSpecial = $checkSpecial;
     //    $tesheader               = $table_destination_description->getheaderimagebyid2($culture_id, $language_id);
     if ($culture != null) {
         $form->name->setValue($this->view->HtmlDecode($culture['name']));
         $form->description->setValue($this->view->HtmlDecode($culture['description']));
         $form->Poi_x->setValue($culture['pointX']);
         $form->Poi_y->setValue($culture['pointY']);
         $form->featured->setChecked($culture['featured']);
         $this->view->header_image = $table_destination->find($culture_id)->current()->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 */
     //    /* set another value to the form element */
     $area_amount = $table_areatopoi->countAreaByPoiId($culture_id);
     $category_amount = $table_categorytopoi->countCategoryByPoiId($culture_id);
     $main_category = $table_destination->getMainCategoryById($culture_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->userCanApprove = $this->_userInfo->canApprove;
     $this->view->poi_id = $culture_id;
     $this->view->form = $form;
     $this->view->language_id = $language_id;
 }
 /**
  * IS: Parameter id terdeklarasi
  * FS: Mengirimkan ke viewer: form, poi_id, image
  * Desc: Mengatur aksi yang dilakukan untuk halaman edit
  */
 public function editAction()
 {
     $form = new Admin_Form_ImageForm();
     $gallery_id = $this->_getParam('id');
     $tableImage = new Model_DbTable_Image();
     $tableImageDescription = new Model_DbTable_ImageDescription();
     $this->view->state_edit = TRUE;
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $old_source = $tableImage->getImageSource($gallery_id);
             $old_type = $tableImage->getImageType($gallery_id);
             switch ($_POST['ImageSelect']) {
                 case 'poi':
                     $new_type = 1;
                     break;
                 case 'news':
                     $new_type = 2;
                     break;
             }
             switch ($old_type) {
                 case 1:
                     $old_dir = 'culture';
                     break;
                 case 4:
                     $old_dir = 'news';
                     break;
             }
             $image_upload = FALSE;
             $olduploaddir = UPLOAD_FOLDER . $old_dir . '/';
             $uploaddir = UPLOAD_FOLDER . $_POST['ImageSelect'] . '/';
             $oldthumbdir = $olduploaddir . 'thumbnails/';
             $thumbdir = $uploaddir . 'thumbnails/';
             $uploadfile = $uploaddir . basename($_FILES['ImageUpload']['name']);
             $ext = array('jpg', 'png', 'gif', 'jpeg');
             $extensions = $this->get_file_extension($_FILES['ImageUpload']['name']);
             $update_status = TRUE;
             if ($_FILES['ImageUpload']['name'] != '') {
                 if (!file_exists($uploadfile)) {
                     if ($_FILES['ImageUpload']['size'] <= 2000000) {
                         if (in_array(strtolower($extensions), $ext)) {
                             if (move_uploaded_file($_FILES['ImageUpload']['tmp_name'], $uploadfile)) {
                                 $this->_flash->addMessage("1\\Image successfully uploaded to " . $_POST['ImageSelect'] . " directory!");
                                 $image_upload = TRUE;
                                 $thumbfile = $thumbdir . basename($_FILES['ImageUpload']['name']);
                                 $this->make_thumb($uploadfile, $thumbfile, 150, 130, strtolower($extensions));
                                 if ($old_source != basename($_FILES['ImageUpload']['name'])) {
                                     if (file_exists($uploaddir . $old_source)) {
                                         unlink($uploaddir . $old_source);
                                         unlink($uploaddir . '/thumbnails/' . $old_source);
                                     }
                                 }
                             } else {
                                 $this->_flash->addMessage("2\\Image Upload Failed!");
                                 $update_status = FALSE;
                             }
                         } else {
                             $this->_flash->addMessage("2\\Image Upload Failed! Extensions Error!, Update Canceled");
                             $update_status = FALSE;
                         }
                     } else {
                         $this->_flash->addMessage("2\\Image Upload Failed! Image Size Limit Exceeded, Update Canceled");
                         $update_status = FALSE;
                     }
                 } else {
                     $this->_flash->addMessage("2\\Image Upload Failed! Image with that Name Already Exists!, Update Canceled");
                     $update_status = FALSE;
                 }
             } else {
                 if ($old_type != $new_type) {
                     $uploadfile = $uploaddir . $old_source;
                     $olduploadfile = $olduploaddir . $old_source;
                     if (!file_exists($uploadfile)) {
                         $thumbfile = $thumbdir . $old_source;
                         $oldthumbfile = $oldthumbdir . $old_source;
                         rename($olduploadfile, $uploadfile);
                         rename($oldthumbfile, $thumbfile);
                     } else {
                         $this->_flash->addMessage("2\\Image Upload Failed! Image with that Name Already Exists!");
                     }
                 }
             }
             switch ($_POST['ImageSelect']) {
                 case 'culture':
                     $image_type = 1;
                     break;
                 case 'news':
                     $image_type = 2;
                     break;
             }
             $table_gallery = new Model_DbTable_Image();
             if ($update_status) {
                 if ($_FILES['ImageUpload']['name'] != '') {
                     $new_image = $_FILES['ImageUpload']['name'];
                 } else {
                     $new_image = $old_source;
                 }
                 $input = array('poi_id' => $_POST['poivalue'], 'name' => $_POST['ImageName'], 'source' => $new_image, 'type' => $image_type);
                 $table_gallery->updateImage($input, $gallery_id);
                 $input = array('gallery_id' => $gallery_id, 'language_id' => 1, 'name_language' => $_POST['ImageName'], 'desc_language' => $_POST['ImageDescription']);
                 $table_gallerydesc = new Model_DbTable_ImageDescription();
                 $table_gallerydesc->updateImageDescription($input, $gallery_id);
                 $this->loggingaction('image', 'edit', $gallery_id);
                 $this->_flash->addMessage("1\\Image Update Success!");
             }
         }
         $this->_redirect($this->view->rootUrl('/admin/image/'));
     }
     $data = $tableImage->getImageByIdLang($gallery_id);
     switch ($data['type']) {
         case 0:
             $type_value = 'culture';
             break;
         case 1:
             $type_value = 'culture';
             break;
         case 2:
             $type_value = 'news';
             break;
     }
     if ($data['poi_id'] > 0) {
         $poi_name = $this->view->poiName($data['poi_id']);
     }
     $form->image_name->setValue($data['name_language']);
     $form->image_poi->setValue($poi_name);
     $form->image_description->setValue($data['desc_language']);
     $form->image_type->setValue($type_value);
     $image = $this->view->imageUrl('/upload/' . $type_value . '/thumbnails/' . $data['source']);
     $this->view->poi_id = $data['poi_id'];
     $this->view->image = $image;
     $this->view->form = $form;
 }