⚠ 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

$crud->unsetDelete(); don't work



nunenthal
  • profile picture
  • Member

Posted 01 March 2019 - 19:00 PM

Hello,

I use unsetDelete() but the delete still possible. If you click on the action checkbox, the delete appear, and it's possible to delete the row.

Big problem.

 

A solution ?

 

 public function accueil()
        {
        if ($this->session->aut != 1) exit;
        $crud = $this->_getGroceryCrudEnterprise();
$crud->setTable('accueil');
$crud->setSubject('Page d’accueil');
$crud->setLanguage('French');
$crud->unsetPrint();
$crud->unsetExport();
/************* unsetDelete set here ****************************/
$crud->unsetDelete();
/***** But delete is possible when click on action checkbox **********/
        $crud->unsetAdd();
        $crud->unsetSearchColumns(['titre', 'titre_en', 'texte','texte_en','photo1','photo2','photo3','video1','video2']);
        $crud->setFieldUpload('photo1', 'assets/images/accueil/photo1', 'assets/images/accueil/photo1');
        $crud->setFieldUpload('photo2', 'assets/images/accueil/photo2', 'assets/images/accueil/photo1');
        $crud->setFieldUpload('photo3', 'assets/images/accueil/photo3', 'assets/images/accueil/photo3');
        $crud->setTexteditor(["texte"]);
        $crud->setTexteditor(["texte_en"]);
        $crud->callbackAfterUpload(function ($data = null) {
        $nom=$data->filename;
        $path=$data->filePath;
        $fullPath = $path.$nom; 
        $config['image_library'] = 'gd2';
        $config['source_image'] = $fullPath;
        $config['create_thumb'] = FALSE;
        $config['maintain_ratio'] = TRUE;
        $config['width']         = 600;
        //$config['height']       = 50;
        $this->load->library('image_lib', $config);
        $this->image_lib->resize();
        return $data;
});
        $crud->where([ 'id = ?' => 1
]);
$output = $crud->render();
        $this->_header_admin_output($output);
        $this->load->view('admin_menu_v');
        $this->_admin_output($output);
        $this->_footer_admin_output($output);
        }

 


nunenthal
  • profile picture
  • Member

Posted 02 March 2019 - 15:15 PM

I use :

 

$crud->callbackDelete(function ($stateParameters) { return $stateParameters; }); //delete workaround

 

as workaround, just do that the delete action don't work. It's not a good solution, but do that the customer can't crash her web site !

 

Urgent solution needed.


nunenthal
  • profile picture
  • Member

Posted 02 March 2019 - 15:28 PM

Finally, is working fine by adding

 

$crud->unsetDeleteMultiple();