/** * editAction * Get a record and populate the application form * @return unknown_type */ public function editAction() { $form = $this->getForm('/admin/newsletter/process'); $id = $this->getRequest()->getParam('id'); if (!empty($id) && is_numeric($id)) { $fields = "news_id, subject, DATE_FORMAT(sendat, '%d/%m/%Y %H:%i:%s') as sendat, DATE_FORMAT(sent, '%d/%m/%Y %H:%i:%s') as sent, subject, message"; $rs = $this->newsletter->getAllInfo($id, $fields, true); if (!empty($rs[0])) { $form->populate($rs[0]); $this->view->record = $rs[0]; // Get the queue $this->view->queue = array('records' => NewslettersHistory::get_queue_by_newsletter_id($id, "newsletter_id, nh.date_added as added, nh.date_sent as sent, ns.email as email, c.lastname as user")); // Hide these fields and values inside the vertical grid object $this->view->data = array('records' => $rs); // Create the buttons in the edit form $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/newsletter/sendtest//id/{$id}", "label" => $this->translator->translate('Test'), "params" => array('css' => null)), array("url" => "/admin/newsletter/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null)), array("url" => "/admin/newsletter/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/newsletter/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null))); } } $this->view->title = $this->translator->translate("Newsletter edit"); $this->view->description = $this->translator->translate("Here you can edit the newsletter."); $this->view->form = $form; $this->render('applicantform'); }