⚠ 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

Manual setting of default actions fails



Kor Dahar Master
  • profile picture
  • Member

Posted 29 November 2016 - 17:46 PM

Hello fellow programmers. Hello John.

 

First, I have been unable to access my account, so I had to create a new one. I tried the password recovery, but the system doesn't send me the recovery e-mail. :/

 

Anyways...

 

I came across with a annoying problem regarding the framework, which I don't know if it is part of the normal behaviour of the framework or it is a bug.

 

Here's the problem:

 

I want to unset the default actions of the grid and set them manually if a certain condition is satisfied. The problem is that when I try to edit a record, I get an PHP exception error:

An uncaught Exception was encountered

Type: Exception

Message: You don't have permissions for this operation

Filename: C:\xampp\htdocs\protocolo\application\libraries\Grocery_CRUD.php

Here's my code:

$this->grocery_crud->unset_add();
$this->grocery_crud->unset_edit();
$this->grocery_crud->unset_delete();

$this->grocery_crud->add_action('Excluir Protocolo', '/protocolo/pics/close.png', '', 'delete-row', array($this,'set_url_exclui_protocolo'));
$this->grocery_crud->add_action('Alterar Protocolo', '/protocolo/pics/edit.png', '', 'edit_button', array($this,'set_url_altera_protocolo'));
$this->grocery_crud->add_action('Visualizar Protocolo', '/protocolo/pics/magnifier.png', 'edit_button', '', array($this,'set_url_visualiza_protocolo'));

The callback functions:

function set_url_exclui_protocolo($primary_key, $row){
   
  return (site_url(strtolower(__CLASS__) . '/index/delete/' . $primary_key));    
    
}

function set_url_visualiza_protocolo($primary_key, $row){
    
  return (site_url(strtolower(__CLASS__) . '/index/read/' . $primary_key));    
    
}

function set_url_altera_protocolo($primary_key, $row){
    
  return (site_url(strtolower(__CLASS__) . '/index/edit/' . $primary_key));    
    
}

Any hints?

 

Thanks for listening.