Jump to content


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


  • Please log in to reply
2 replies to this topic

#1 nunenthal

nunenthal

    Member

  • Members
  • PipPip
  • 23 posts
  • LocationFrance

Posted 01 March 2019 - 07: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);
        }

 



#2 nunenthal

nunenthal

    Member

  • Members
  • PipPip
  • 23 posts
  • LocationFrance

Posted 02 March 2019 - 03: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.



#3 nunenthal

nunenthal

    Member

  • Members
  • PipPip
  • 23 posts
  • LocationFrance

Posted 02 March 2019 - 03:28 PM

Finally, is working fine by adding

 

$crud->unsetDeleteMultiple();

 

 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users