コード例 #1
0
 public function editAction()
 {
     $id = $this->_getParam('id');
     $emailTemplate1 = new Admin_Model_EmailTemplate();
     $emailTemplate = $emailTemplate1->find($id);
     $request = $this->getRequest();
     $form = new Admin_Form_EmailTemplate();
     $options = $request->getPost();
     if ($request->isPost()) {
         if ($form->isValid($options)) {
             $emailTemplate->setOptions($options);
             $emailTemplate->save();
             return $this->_helper->redirector('index', 'email-template', "admin", array('msg' => base64_encode("'{$emailTemplate->getName()}' has been updated successfully!")));
         } else {
             $form->reset();
             $form->populate($options);
         }
     }
     $form->getElement('name')->setValue($emailTemplate->getName());
     $form->getElement('body')->setValue($emailTemplate->getBody());
     $form->getElement('subject')->setValue($emailTemplate->getSubject());
     $this->view->form = $form;
 }
コード例 #2
0
 private function setModel($row)
 {
     $model = new Admin_Model_EmailTemplate();
     $model->setId($row->id)->setName($row->name)->setSubject($row->subject)->setIdentifire($row->identifire)->setBody($row->body);
     return $model;
 }