コード例 #1
0
ファイル: ErrorsController.php プロジェクト: reith2004/frapi
    public function editAction()
    {
        $request = $this->getRequest();
        $id      = $request->getParam('id');
        if ($id === null) {
            $this->addErrorMessage($this->tr->_('ACTION_MISSING_ID'));
            return;
        }

        $form  = new Default_Form_Error;
        $model = new Default_Model_Error;
        if ($request->isPost()) {
            if ($form->isValid($request->getPost())) {
                // Save data
                $model->update($form->getValues(), $id);
                $model->refreshAPCCache();
                $this->addMessage(sprintf($this->tr->_('ERROR_UPDATE_SUCCESS'), $request->getParam('name')));
                $this->_redirect('/errors/edit/id/' . $id);
            }
        } else {

            $data = $model->get($id);

            $form->populate($data);
        }

        $this->view->form = $form;
    }
コード例 #2
0
 public function editAction()
 {
     $request = $this->getRequest();
     $id = $request->getParam('id');
     if ($id === null) {
         $this->addErrorMessage('ID parameter is missing.');
         return;
     }
     $form = new Default_Form_Error();
     $model = new Default_Model_Error();
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             // Save data
             $model->update($form->getValues(), $id);
             $model->refreshAPCCache();
             $this->addMessage('Error code ' . $request->getParam('name') . ' updated.');
             $this->_redirect('/errors/edit/id/' . $id);
         }
     } else {
         $data = $model->get($id);
         $form->populate($data);
     }
     $this->view->form = $form;
 }