What not working?
public function index(){ $crud = new grocery_CRUD(); echo $state = $crud->getState(); $state_info = $crud->getStateInfo(); $crud->set_table('proxsorteios'); $crud->unset_jquery(); $crud->set_theme('datatables'); $crud->set_subject('Proximo Sorteio'); $crud->order_by('id', 'desc'); $crud->limit(5); $crud->columns('id', 'data', 'proxExtracao'); $crud->set_field_upload('img_cautela','assets/uploads/files/proxsorteios'); if($state === 'list'){ $output = $crud->render(); } if($state === 'insert'){ print_r($_POST); $output = $crud->render(); } if($state === 'add'){ echo "<script>alert('Entrei')</script>"; // $crud->set_table('proxsorteios'); $crud->unset_jquery(); $crud->set_theme('datatables'); $crud->set_subject('Adicionar Proximo Sorteio'); $crud->unset_add_fields('desc_rodada2','foto_premio1','foto_premio2', 'foto_premio3', 'foto_premio4'); $crud->fields('data','n_susep', 'desc_rodada', 'separador', 'desc_premio1', 'desc_premio2', 'desc_premio3', 'desc_premio4', 'img_cautela', 'proxExtracao'); $crud->field_type('data', 'date'); $crud->callback_before_insert(array($this, '_callback_before')); $output = $crud->render(); } $this->_example_output($output); } public function _callback_before($post_array) { echo "<script>alert('callback_before_insert')</script>"; // return $post_array; return true; } public function _example_output($output = null) { $this->load->model("config_model"); $config_site = $this->config_model->buscaConfig(); $head = array( 'author' => 'Rodrigo Barbosa', 'description' => '', 'title' => 'Painel de Controle - Site' ); $nav = array( 'site' => $config_site['site'], ); $this->load->view('head', $head); $this->load->view('layout-bootstrap/css/template-bootstrap-css'); $this->load->view('layout-bootstrap/nav.php', $nav); // $this->load->view('dashboard'); $this->load->view('usuarios',(array)$output); $this->load->view('layout-bootstrap/js/template-bootstrap-js'); }