UPGRADE NOTE: Do not edit or add to this file if you wish to upgrade AbanteCart to newer versions in the future. If you wish to customize AbanteCart for your needs please refer to http://www.AbanteCart.com for more information. ------------------------------------------------------------------------------*/ if (!defined('DIR_CORE') || !IS_ADMIN) { header('Location: static_pages/'); } class ControllerResponsesListingGridStore extends AController { /** * update only one field * * @return void */ public function update_field() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); if (!$this->user->canModify('listing_grid/store')) { $error = new AError(''); return $error->toJSONResponse('NO_PERMISSIONS_402', array( 'error_text' => sprintf($this->language->get('error_permission_modify'), 'listing_grid/store'), 'reset_value' => true )); } $this->loadLanguage('setting/store'); $this->loadModel('setting/store'); if (isset($this->request->get[ 'id' ])) { //request sent from edit form. ID in url foreach ($this->request->post as $key => $value) { $err = $this->_validateField($key, $value); if (!empty($err)) { $error = new AError(''); return $error->toJSONResponse('VALIDATION_ERROR_406', array( 'error_text' => $err )); } $data = array( $key => $value ); $this->model_setting_store->editStore($this->request->get[ 'id' ], $data); } return null; } //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); } private function _validateField($field, $value) { $err = ''; switch ($field) { case 'config_name' : if (!$value) { $err = $this->language->get('error_name'); } break; case 'config_url' : if (!$value) { $err = $this->language->get('error_url'); } break; } return $err; } private function _validateDelete($id) { return null; } }