Hello, "auto-solution found"
In the two methods that i've mentioned the "solution" (i think there are one better like redirect or something else) is throwing an Exception.
Original code:
protected function showEditForm($state_info)
{
$this->set_js_lib($this->default_javascript_path.'/'.grocery_CRUD::JQUERY);
$data = $this->get_common_data();
$data->types = $this->get_field_types();
$data->field_values = $this->get_edit_values($state_info->primary_key);
$data->add_url = $this->getAddUrl();
$data->list_url = $this->getListUrl();
$data->update_url = $this->getUpdateUrl($state_info);
$data->delete_url = $this->getDeleteUrl($state_info);
$data->read_url = $this->getReadUrl($state_info->primary_key);
$data->input_fields = $this->get_edit_input_fields($data->field_values);
$data->unique_hash = $this->get_method_hash();
$data->fields = $this->get_edit_fields();
$data->hidden_fields = $this->get_edit_hidden_fields();
$data->unset_back_to_list = $this->unset_back_to_list;
$data->validation_url = $this->getValidationUpdateUrl($state_info->primary_key);
$data->is_ajax = $this->_is_ajax();
$this->_theme_view('edit.php',$data);
$this->_inline_js("var js_date_format = '".$this->js_date_format."';");
$this->_get_ajax_results();
}
protected function showReadForm($state_info)
{
$this->set_js_lib($this->default_javascript_path.'/'.grocery_CRUD::JQUERY);
$data = $this->get_common_data();
$data->types = $this->get_field_types();
$data->field_values = $this->get_edit_values($state_info->primary_key);
$data->add_url = $this->getAddUrl();
$data->list_url = $this->getListUrl();
$data->update_url = $this->getUpdateUrl($state_info);
$data->delete_url = $this->getDeleteUrl($state_info);
$data->read_url = $this->getReadUrl($state_info->primary_key);
$data->input_fields = $this->get_read_input_fields($data->field_values);
$data->unique_hash = $this->get_method_hash();
$data->fields = $this->get_read_fields();
$data->hidden_fields = $this->get_edit_hidden_fields();
$data->unset_back_to_list = $this->unset_back_to_list;
$data->validation_url = $this->getValidationUpdateUrl($state_info->primary_key);
$data->is_ajax = $this->_is_ajax();
$this->_theme_view('read.php',$data);
$this->_inline_js("var js_date_format = '".$this->js_date_format."';");
$this->_get_ajax_results();
}
Updated code:
protected function showEditForm($state_info)
{
$this->set_js_lib($this->default_javascript_path.'/'.grocery_CRUD::JQUERY);
$data = $this->get_common_data();
$data->types = $this->get_field_types();
$data->field_values = $this->get_edit_values($state_info->primary_key);
if(empty($data->field_values))
{
throw new Exception('You don\'t have permissions for this operation');
die();
}
$data->add_url = $this->getAddUrl();
$data->list_url = $this->getListUrl();
$data->update_url = $this->getUpdateUrl($state_info);
$data->delete_url = $this->getDeleteUrl($state_info);
$data->read_url = $this->getReadUrl($state_info->primary_key);
$data->input_fields = $this->get_edit_input_fields($data->field_values);
$data->unique_hash = $this->get_method_hash();
$data->fields = $this->get_edit_fields();
$data->hidden_fields = $this->get_edit_hidden_fields();
$data->unset_back_to_list = $this->unset_back_to_list;
$data->validation_url = $this->getValidationUpdateUrl($state_info->primary_key);
$data->is_ajax = $this->_is_ajax();
$this->_theme_view('edit.php',$data);
$this->_inline_js("var js_date_format = '".$this->js_date_format."';");
$this->_get_ajax_results();
}
protected function showReadForm($state_info)
{
$this->set_js_lib($this->default_javascript_path.'/'.grocery_CRUD::JQUERY);
$data = $this->get_common_data();
$data->types = $this->get_field_types();
$data->field_values = $this->get_edit_values($state_info->primary_key);
if(empty($data->field_values))
{
throw new Exception('You don\'t have permissions for this operation');
die();
}
$data->add_url = $this->getAddUrl();
$data->list_url = $this->getListUrl();
$data->update_url = $this->getUpdateUrl($state_info);
$data->delete_url = $this->getDeleteUrl($state_info);
$data->read_url = $this->getReadUrl($state_info->primary_key);
$data->input_fields = $this->get_read_input_fields($data->field_values);
$data->unique_hash = $this->get_method_hash();
$data->fields = $this->get_read_fields();
$data->hidden_fields = $this->get_edit_hidden_fields();
$data->unset_back_to_list = $this->unset_back_to_list;
$data->validation_url = $this->getValidationUpdateUrl($state_info->primary_key);
$data->is_ajax = $this->_is_ajax();
$this->_theme_view('read.php',$data);
$this->_inline_js("var js_date_format = '".$this->js_date_format."';");
$this->_get_ajax_results();
}
Greetings!