Exemplo n.º 1
0
 public function save()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $output = array();
     $this->loadLanguage('tool/rl_manager');
     $this->document->setTitle($this->language->get('heading_title'));
     if ($this->request->is_POST() && $this->_validateRLTypeForm($this->request->post)) {
         $post_data = $this->request->post;
         $rm = new AResourceManager();
         if ($rm->updateResourceType($post_data)) {
             $output['result_text'] = $this->language->get('text_success');
             $this->load->library('json');
             $this->response->addJSONHeader();
             $this->response->setOutput(AJson::encode($output));
         } else {
             $error = new AError('');
             $err_data = array('error_text' => 'Unable to save resource type');
             return $error->toJSONResponse('VALIDATION_ERROR_406', $err_data);
         }
     } else {
         $error = new AError('');
         $err_data = array('error_text' => $this->error);
         return $error->toJSONResponse('VALIDATION_ERROR_406', $err_data);
     }
     //update controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }