{
    /**
     * IS: -
     * FS: -
     * Desc: Fungsi inisialisasi
     */
    public function init()
    {
        parent::init();
    }
    /**
     * IS: Parameter page terdeklarasi
     * FS: Mengirimkan ke viewer: video, itemPerPage, current, totalItems
     * Desc: Fungsi untuk menampilkan daftar video
     */
    public function indexAction()
    {
        $index = $this->getParam('index', 0);
        if ($index > 0 && !$this->_request->isXmlHttpRequest()) {
            throw new Zend_Controller_Action_Exception('This page does not exist', 404);
        }
        $search = $this->getParam('search');
     $this->lang = $lang->language_name;
     $this->_helper->layout->setLayout('kebudayaan');
     //$destinationDesc = new Model_DbTable_DestinationDescription;
     //$a = $destinationDesc->getNameById(33,1);
     //
     //echo $a;
 }
 public function indexAction()
 {
     /*
       $filterSpace = keyword;
      */
     $filterSpace = strip_tags($this->_getParam(urldecode('keyword')));
     $filterSpace = filter_var($filterSpace, FILTER_SANITIZE_SPECIAL_CHARS);
     if ($filterSpace == NULL) {
         $this->view->emptyResult = $this->_languageId == 1 ? 'Masukan kata kunci' : 'Please enter a keyword!';
     } else {
         $param = str_replace("  ", " ", $filterSpace);
         $limit = LIMIT;
         /* limit perpage */
         $offset = 0;
         /* default offset */
         /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
         /*                          query news content                         */
         /* - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - */
         $searchNews = new Model_DbTable_News();
         $getResultNews = $searchNews->searchNewsBaru($param, $limit, $offset, $this->_languageId);
         //$getResultNews = $searchNews->searchNews($param,$limit,$offset,$this->_languageId);
         $news = '';
         if (count($getResultNews) > 0) {
             foreach ($getResultNews as $rowNews) {
                 $url = $this->view->url(array('id' => $rowNews['id'], 'slug' => $this->view->makeUrlFormat($rowNews['title'])), $this->_languageId == 1 ? 'detail-berita' : 'news-detail');
                 $title = $this->view->boldStyle(strtolower($rowNews['title']), $param);
                 $news .= '<li>';
                 $news .= '<h4><a href="' . $url . '" title="' . $rowNews['title'] . '">' . ltrim($title, "\t") . '</a></h4>';
                 $news .= substr(strip_tags($this->view->htmlDecode($rowNews['content'])), 0, 225) . ' ...';
                 $news .= '</li>';
             }
         } else {
             //                $news = '<li><a href="#">no data that matches with keyword you enter : <b>'.$param.'</b></a></li>';
         }
         $this->view->news = $news;
         $getTotalNews = $searchNews->numbRowsNews($param, $this->_languageId);
         $this->view->totalpage_news = ceil($getTotalNews / $limit);
         /* - - - - - - - - - - - link pages news  - - - - - - -  - - - - -  - - */
         $curpageNews = 1;
         $num_linkNews = NUM_LINKS;
         $per_pageNews = $limit;
         // Calculate the start and end numbers. These determine
         // which number to start and end the digit links with
         $num_pageNews = ceil($getTotalNews / $limit);
         $startNews = $curpageNews - $num_linkNews > 0 ? $curpageNews - ($num_linkNews - 1) : 1;
         $endNews = $curpageNews + $num_linkNews < $num_pageNews ? $curpageNews + $num_linkNews : $num_pageNews;
         // Write the digit links
         $linkNews = '';
         for ($loop = $startNews - 1; $loop <= $endNews; $loop++) {
             $i = $loop * $per_pageNews - $per_pageNews;
             $get_curpage = $loop;
             //$get_curpage  = $loop - 1;
             if ($i >= 0) {
                 if ($curpageNews == $loop) {
                     $linkNews .= '<div class="cur_page">' . $loop . '</div>';
                     // Current page
                 } else {
                     $n = $i == 0 ? '' : $i;
                     $linkNews .= '<div class="pages news" title="' . $get_curpage . '">' . $loop . '</div>';
                     //$linkNews .= '<div class="pages news" id="'.$loop.'" title="'.$get_curpage.'">'.$loop.'</div>';
                 }
             }
         }
         $this->view->linkpage_news = $linkNews;
         /* - - - - - - - - - - - end link pages news- - - - - - - -  - - - - -  - - */
         /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - */
         /*                       end query news                                     */
         /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - */
         /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
         /*                         query event  content                         */
         /* - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - */
         $searchEvent = new Model_DbTable_Event();
         $getResultEvent = $searchEvent->searchEventBaru($param, $limit, $offset, $this->_languageId);
         //$getResultEvent = $searchEvent->searchEvent($param,$limit,$offset,$this->_languageId);
         if (count($getResultEvent) > 0) {
             $event = '';
             foreach ($getResultEvent as $rowEvent) {
                 $title = $this->view->boldStyle(strtolower($rowEvent['name']), $param);
                 $event .= '<li>';
                 $event .= '<h4><a href="' . $this->_request->getBaseUrl() . '/' . $this->lang . '/' . ($this->_languageId == 1 ? 'kegiatan' : 'event') . '/detail/' . $rowEvent['event_id'] . '/' . $this->view->makeUrlFormat($rowEvent['name']) . '" title="' . $rowEvent['name'] . '">' . ltrim($title) . '</a></h4>';
                 $event .= substr(strip_tags($this->view->htmlDecode($rowEvent['description'])), 0, 225) . ' ...';
                 $event .= '</li>';
             }
         } else {
             $event = '';
         }
         $this->view->event = $event;
         $getTotalEvent = $searchEvent->numbRowsEvent($param, $this->_languageId);
         $this->view->totalpage_event = ceil($getTotalEvent / $limit);
         /* - - - - - - - - - - - link pages event - - - - - - -  - - - - -  - - */
         $curpageEvent = 1;
         $num_linkEvent = NUM_LINKS;
         $per_pageEvent = $limit;
         // Calculate the start and end numbers. These determine
         // which number to start and end the digit links with
         $num_pageEvent = ceil($getTotalEvent / $limit);
         $startEvent = $curpageEvent - $num_linkEvent > 0 ? $curpageEvent - ($num_linkEvent - 1) : 1;
         $endEvent = $curpageEvent + $num_linkEvent < $num_pageEvent ? $curpageEvent + $num_linkEvent : $num_pageEvent;
         // Write the digit links
         $linkEvent = '';
         for ($loop = $startEvent - 1; $loop <= $endEvent; $loop++) {
             $i = $loop * $per_pageEvent - $per_pageEvent;
             $get_curpage = $loop;
             //$get_curpage  = $loop - 1;
             if ($i >= 0) {
                 if ($curpageEvent == $loop) {
                     $linkEvent .= '<div class="cur_page">' . $loop . '</div>';
                     // Current page
                 } else {
                     $n = $i == 0 ? '' : $i;
                     $linkEvent .= '<div class="pages event" title="' . $get_curpage . '">' . $loop . '</div>';
                     //$linkEvent .= '<div class="pages event" id="'.$loop.'" title="'.$get_curpage.'">'.$loop.'</div>';
                 }
             }
         }
         $this->view->linkpage_event = $linkEvent;
         /* - - - - - - - - - - - end link pages event - - - - - - - -  - - - - -  - - */
         /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - */
         /*                       end query event                                    */
         /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - */
         /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
         /*                         query destination content                    */
         /* - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - */
         $searchDest = new Model_DbTable_Destination();
         $getResultDest = $searchDest->searchDestBaru($param, $limit, $offset, $this->_languageId);
         //$getResultDest = $searchDest->searchDest($param,$limit,$offset,$this->_languageId);
         $dest = '';
         if (count($getResultDest) > 0) {
             foreach ($getResultDest as $rowDest) {
                 $url = $this->view->url(array('destId' => $rowDest['poi_id'], 'slug' => $this->view->makeUrlFormat($rowDest['name'])), $this->_languageId == 1 ? 'detail-kebudayaan' : 'culture-detail');
                 $title = $this->view->boldStyle(strtolower($rowDest['name']), $param);
                 $dest .= '<li>';
                 $dest .= '<h4><a href="' . $url . '" title="' . $rowDest['name'] . '">' . ltrim($title) . '</a></h4>';
                 $dest .= substr(strip_tags($this->view->htmlDecode($rowDest['description'])), 0, 225) . ' ...';
                 $dest .= '</li>';
             }
         }
         $this->view->destination = $dest;
         $getTotalDest = $searchDest->numbRowsDest($param, $this->_languageId);
         $this->view->totalpage_dest = ceil($getTotalDest / $limit);
         //            link pages dest
         $curpageDest = 1;
         $num_linkDest = NUM_LINKS;
         $per_pageDest = $limit;
         $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;
         $linkDest = '';
         for ($loop = $startDest - 1; $loop <= $endDest; $loop++) {
             $i = $loop * $per_pageDest - $per_pageDest;
             $get_curpage = $loop;
             if ($i >= 0) {
                 if ($curpageDest == $loop) {
                     $linkDest .= '<div class="cur_page">' . $loop . '</div>';
                 } else {
                     $n = $i == 0 ? '' : $i;
                     $linkDest .= '<div class="pages dest" title="' . $get_curpage . '">' . $loop . '</div>';
                 }
             }
         }
         $this->view->linkpage_dest = $linkDest;
         /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - */
         /*                       end query destination                             */
         /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - */
         $searchArticle = new Model_DbTable_Figure();
         $getResultArticle = $searchArticle->searchFig($param, $limit, $offset, $this->_languageId);
         //$getResultDest = $searchDest->searchDest($param,$limit,$offset,$this->_languageId);
         if (count($getResultArticle) > 0) {
             $article = '';
             foreach ($getResultArticle as $rowArticle) {
                 $url = $this->view->url(array('id' => $rowArticle['figure_id'], 'slug' => $rowArticle['name']), $this->_languageId == 1 ? 'detail-sosok' : 'figure-detail');
                 $title = $this->view->boldStyle(strtolower($rowArticle['name']), $param);
                 $article .= '<li>';
                 $article .= '<h4><a href="' . $url . '" title="' . $rowArticle['name'] . '">' . ltrim($title) . '</a></h4>';
                 $article .= substr(strip_tags($this->view->htmlDecode($rowArticle['description'])), 0, 225) . ' ...';
                 $article .= '</li>';
             }
         } else {
             $article = '';
         }
         $this->view->article = $article;
         $getTotalArticle = $searchArticle->numbRowsFigure($param, $this->_languageId);
         $this->view->totalpage_article = ceil($getTotalArticle / $limit);
         //            link pages dest
         $curpageArticle = 1;
         $num_linkArticle = NUM_LINKS;
         $per_pageArticle = $limit;
         $num_pageArticle = ceil($getTotalArticle / $limit);
         $startArticle = $curpageArticle - $num_linkArticle > 0 ? $curpageArticle - ($num_linkArticle - 1) : 1;
         $endArticle = $curpageArticle + $num_linkArticle < $num_pageArticle ? $curpageArticle + $num_linkArticle : $num_pageArticle;
         $linkArticle = '';
         for ($loop = $startArticle - 1; $loop <= $endArticle; $loop++) {
             $i = $loop * $per_pageArticle - $per_pageArticle;
             $get_curpage = $loop;
             if ($i >= 0) {
                 if ($curpageArticle == $loop) {
                     $linkArticle .= '<div class="cur_page">' . $loop . '</div>';
                 } else {
                     $n = $i == 0 ? '' : $i;
                     $linkArticle .= '<div class="pages dest" title="' . $get_curpage . '">' . $loop . '</div>';
                 }
             }
         }
         $this->view->linkpage_article = $linkArticle;
         //            end link figure