/**
  * IS: Terdeklarasinya filter dan param di session, dan page_row
  * FS: Mengirimkan ke viewer: cleanUrl, message, filter_alert, page_row,
  *     all_category, dan paginator
  * Desc: Mengatur aksi yang dilakukan untuk halaman index event
  */
 public function indexAction()
 {
     $pageNumber = $this->_getParam('page');
     // Menangani permintaan POST
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         $action = $post['action'];
         switch ($action) {
             case 'delete':
                 if (isset($post['events'])) {
                     $events = $post['events'];
                     foreach ($events as $id) {
                         $event = $this->event->find($id)->current();
                         if (null != $event) {
                             if ($event->status != self::STATUS_ARCHIVED) {
                                 $event->setFromArray(array('status' => self::STATUS_ARCHIVED))->save();
                                 $this->loggingaction('Event', 'Archive', $id);
                             } else {
                                 $event->delete();
                                 $this->loggingaction('Event', 'Delete', $id);
                             }
                         }
                     }
                     $this->_helper->flashMessenger->addMessage('Kegiatan berhasil dihapus.');
                 }
                 break;
             case 'restore':
                 if (isset($post['events'])) {
                     $events = $post['events'];
                     foreach ($events as $id) {
                         $event = $this->event->find($id)->current();
                         if (null != $event && $event->status == self::STATUS_ARCHIVED) {
                             $event->setFromArray(array('status' => self::STATUS_DRAFT))->save();
                             $this->loggingaction('Event', 'Restore', $id, self::LANGUAGE_ID);
                         }
                     }
                     $this->_helper->flashMessenger('Muat ulang kegiatan berhasil');
                 }
                 break;
             case 'filter':
                 $this->filter->event = $post['filter'];
                 break;
             case 'sort':
                 $this->filter->event = $post['filter'];
                 if ($this->filter->event['order'] == 'ASC') {
                     $this->filter->event['order'] = 'DESC';
                 } else {
                     $this->filter->event['order'] = 'ASC';
                 }
                 break;
             case 'reset':
                 $this->filter->unsetAll();
                 break;
             default:
                 break;
         }
         $this->_helper->redirector('index');
     }
     $messages = $this->_helper->flashMessenger->getMessages();
     $data = $this->event->findAll($this->filter->event, self::LANGUAGE_ID);
     $statusesCount = $this->event->findStatusesCount();
     if (!$this->_userInfo->canApprove) {
         $data = $this->event->findAll($this->filter->event, self::LANGUAGE_ID, $this->_userInfo->id);
         $statusesCount = $this->event->findStatusesCount($this->_userInfo->id);
     }
     $events = Zend_Paginator::factory($data);
     $events->setCurrentPageNumber($pageNumber);
     $events->setItemCountPerPage(5);
     if (isset($this->filter->event['row'])) {
         $events->setItemCountPerPage($this->filter->event['row']);
     }
     $this->view->userInfo = $this->_userInfo;
     $this->view->statusesCount = $statusesCount;
     $this->view->filter = $this->filter->event;
     $this->view->messages = $messages;
     $this->view->events = $events;
 }