public function update_resource_details() { if (!$this->user->canModify('common/resource_library')) { $error = new AError(''); return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), 'common/resource_library'), 'reset_value' => true)); } //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); if (!$this->request->post) { $error = new AError(''); return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => 'Error: No data to save!', 'reset_value' => true)); } if (!$this->request->post['name']) { $error = new AError(''); return $error->toJSONResponse('VALIDATION_ERROR_406', array('error_text' => $this->language->get('error_name'), 'reset_value' => true)); } $this->request->post['resource_code'] = html_entity_decode($this->request->post['resource_code'], ENT_COMPAT, 'UTF-8'); $rm = new AResourceManager(); $language_id = (int) $this->request->post['language_id']; $language_id = !$language_id ? $this->language->getContentLanguageID() : $language_id; if (!is_array($this->request->post['name'])) { $this->request->post['name'] = array($language_id => $this->request->post['name']); $this->request->post['title'] = array($language_id => $this->request->post['title']); $this->request->post['description'] = array($language_id => $this->request->post['description']); } $result = $rm->updateResource($this->request->get['resource_id'], $this->request->post); //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); $this->load->library('json'); $this->response->addJSONHeader(); $this->response->setOutput(AJson::encode($result)); }