⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Problem return GRID



hunterbit
  • profile picture
  • Member

Posted 04 December 2011 - 11:38 AM

[color=#333333][font=arial, sans-serif][size=4]Hello to[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]everyone.[/size][/font][/color]
[color=#333333][font=arial, sans-serif][size=4]I have a problem[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]when I[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]insert[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]a record[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]in my database[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4].[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]I want[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]that once[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]carried[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]the insert[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]is[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]a redirect[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]to the[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]grid[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]automatically[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4].[/size][/font][/color]

[color=#333333][font=arial, sans-serif][size=4]This[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]is the[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]method that performs[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]input and[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]redirects[/size][/font][/color]

if (count($result) <= 0) {
// insert
if (!$this->upload->do_upload('file')) {
$error = array('error' => $this->upload->display_errors());
$this->load->view('admin/updateFile', $error);
} else{
$file = array('upload_data' => $this->upload->data());
// impostiamo il path dell'immagine appena caricata
$contenuto['srcImage'] = $file['upload_data']['file_name'];
// salviamo il tutto nel db
$id = $this->admin_model->insert('galleria_contenuto', $contenuto);
// ritorniamo alla view nel caso si vuole rieditare il file o tornare
// alla lista delle immagini caricate
$contenuto[id]=$id;
$data['contenuto']= $contenuto;
//$this->load->view('admin/elenco-files', $data);
$this->elencoFiles();
}


[color=#333333][font=arial, sans-serif][size=4]This[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]is the method[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]that configures[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]and calls the[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]grid[/size][/font][/color]
[color=#333333][font=arial, sans-serif][size=4]
[/size][/font][/color]
public function elencoFiles() {
// controlla se lo user fa parte del gruppo admin esegue
// la funzione altrimenti viene reinviato alla pagina di login
$this->checkAdmin();
$data = array(
'titolo' => 'ADMIN AREA - IMMAGINI',
'sezione' => 'ELENCO IMMAGINI',
'no_css_js' => 'si',
);
$this->grocery_crud->set_theme('datatables');
$this->grocery_crud->set_table('galleria_contenuto')
->set_subject('File')
->columns('titolo', 'descrizione', 'categoria', 'srcImage')
->display_as('srcImage', 'Immagini')
->display_as('categoria', 'Galleria');
$this->grocery_crud->fields('titolo', 'descrizione', 'categoria', 'srcImage');
$this->grocery_crud->required_fields('titolo');
$this->grocery_crud->set_field_upload('srcImage', 'public/uploads/images');
$this->grocery_crud->set_relation('categoria', 'galleria_categoria', 'titolo');
$this->grocery_crud->unset_add();
$output = $this->grocery_crud->render();
$this->load->view('admin/variabili', $data);
$this->load->view('admin/elenco-files', $output);
}


[color=#333333][font=arial, sans-serif][size=4]Also[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]attach[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]a picture[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]that gives me[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]the error[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4].[/size][/font][/color]
[color=#333333][font=arial, sans-serif][size=4]Thanks[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]to all[/size][/font][/color]