public function editAction() { $polling_id = $this->_getParam('id'); $polling = $this->tbl_polling->find($polling_id)->current(); $pollingAnswers = $this->tbl_answer->getAnswersName($polling_id); if (empty($polling)) { $this->_helper->redirector('index'); } $this->form->populate($polling->toArray()); $this->form->answerSubForm->populate($pollingAnswers); if ($this->getRequest()->isPost()) { $polling = $this->getRequest()->getPost('polling'); if ($this->form->isValid($polling)) { if ($polling['showstatus'] == 1) { $this->tbl_polling->update(array('showstatus' => 0), ''); } $this->tbl_polling->update(array('question' => $polling['question'], 'showstatus' => $polling['showstatus']), "polling_id = {$polling_id}"); $this->tbl_answer->delete("polling_id = {$polling_id}"); foreach ($polling['answer'] as $key => $answer) { $data = array('polling_id' => $polling_id, 'answer' => $answer); $this->tbl_answer->insert($data); } $this->_helper->redirector('index'); } } $this->view->form = $this->form; }
* Desc: Membuat halaman feed dalam format JSon untuk halaman calendar */ public function eventlistAction() { //get Start date and End date Parameter $startDate = $this->unixToMySQL($this->_getParam('start')); $endDate = $this->unixToMySQL($this->_getParam('end')); //create eventDb Instance $eventDb = new Model_DbTable_Event(); $data = $eventDb->getEventInRange($startDate, $endDate, $this->_languageId); if (sizeof($data) > 0) { $this->view->list = $this->formatFullCalendar($data->toArray()); } else { $this->view->fake = array(); } $this->view->layout()->disableLayout(); $this->render('generate-event'); }