Ejemplo n.º 1
0
            // create instance of event model
            $model = new Model_DbTable_Event();
            // get all events from database
            $events = $model->getAllWithDesc();
            // initialize empty array for result data
            $data = array();
            // loop through events object
            foreach ($events as $index => $event) {
                $month = "";
                // convert mysql datetime to date only
                $start = date('d F Y', strtotime($event->date_start));
                $end = date('d F Y', strtotime($event->date_end));
                // get start time
                $start_time = date('H:i:s', strtotime($event->date_start));
                $description = $this->view->truncate($event->description, 100);
                $txt_mulai = $this->_languageId == 1 ? "Mulai" : "Start";
                $txt_selesai = $this->_languageId == 1 ? "Selesai" : "End";
                $html = <<<HTML
                        {$txt_mulai} <strong>{$start}</strong> 
                        &nbsp;&middot;&nbsp
                        {$txt_selesai} <strong>{$end}</strong> <br/>
HTML;
                $data[] = array("date" => date('Y-m-d h:i:s', strtotime($event->date_start)), "title" => $event->name, "description" => $html, "url" => $view->url(array('id' => $event['event_id'], 'slug' => $view->makeUrlFormat($event['name'])), $this->_languageId == 1 ? 'detail-kegiatan' : 'event-detail'));
            }
            // return json result to client
            echo json_encode($data);
        }
    }
    public function pingomaticAction()
    {
        $debug = true;
        $this->_helper->layout()->disableLayout();
        $this->_helper->viewRenderer->setNoRender();
        $articleDB = new Model_DbTable_Destination();
        $articles = $articleDB->findAllWithDescription($this->_languageId);
        $content = '<?xml version="1.0"?>';
        $content .= '<methodCall>';
        $content .= '<methodName>weblogUpdates.ping</methodName>';
        $content .= '<params>';
        foreach ($articles as $article) {
            $content .= '<param>';
            $content .= '<value>' . $article->name . '</value>';
            $content .= '</param>';
            $content .= '<param>';
            $content .= '<value>' . 'http://www.kebudayaanindonesia.net/id/culture/' . $article->poi_id . '/' . $this->view->makeUrlFormat($article->name) . '</value>';
            $content .= '</param>';
        }
        $content .= ' </params>';
        $content .= '</methodCall>';
 /**
  * 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()
 {
     $tbl = new Model_DbTable_Destination();
     $tbl_categories = new Model_DbTable_Category();
     $pageNumber = $this->_getParam('page');
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         switch ($post['action']) {
             case 'delete':
                 $cultures = $post['cultures'];
                 foreach ($cultures as $id) {
                     $culture = $tbl->find($id)->current();
                     if (null != $culture) {
                         if ($culture->status != 0) {
                             $culture->setFromArray(array('status' => 0))->save();
                             $this->loggingaction('Culture', 'Archive', $id, 1);
                         } else {
                             //                $culture->delete();
                             //                $this->loggingaction('Culture', 'Delete', $id, 1);
                         }
                     }
                 }
                 $this->_helper->flashMessenger->addMessage('Item kebudayaan berhasil dihapus.');
                 break;
             case 'filter':
                 $this->filter->culture = $post['filter'];
                 break;
             case 'reset':
                 $this->filter->unsetAll();
                 break;
             case 'sort':
                 $this->filter->culture = $post['filter'];
                 if ($this->filter->culture['order'] == 'ASC') {
                     $this->filter->culture['order'] = 'DESC';
                 } else {
                     $this->filter->culture['order'] = 'ASC';
                 }
                 break;
             default:
                 break;
         }
         $this->_helper->redirector("index");
     }
     $data = $tbl->findAllWithDescription(1, $this->filter->culture);
     $statusesCount = $tbl->findStatusesCount();
     if (!$this->_userInfo->canApprove) {
         $data = $tbl->findAllWithDescription(1, $this->filter->culture, $this->_userInfo->id);
         $statusesCount = $tbl->findStatusesCount($this->_userInfo->id);
     }
     $cultures = Zend_Paginator::factory($data);
     $cultures->setItemCountPerPage(5);
     $cultures->setCurrentPageNumber($pageNumber);
     if (isset($this->filter->culture['row'])) {
         $cultures->setItemCountPerPage($this->filter->culture['row']);
     }
     $categories = $tbl_categories->getCategories();
     array_unshift($categories, 'Tampilkan Semua');
     $messages = $this->_helper->flashMessenger->getMessages();
     $this->view->categories = $categories;
     $this->view->statusesCount = $statusesCount;
     $this->view->filter = $this->filter->culture;
     $this->view->userInfo = $this->_userInfo;
     $this->view->messages = $messages;
     $this->view->cultures = $cultures;
 }