Edit default Action
- Single Page
Posted 14 November 2011 - 21:35 PM
[color=#333333][font=arial, sans-serif][size=4]for me[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]it is very important[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]because[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]a[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]DELETE[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]to edit[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]the table[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]I[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]do not want[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]a particular user[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]then[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]it is deleted[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]when a[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]user presses[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]DELETE[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]on[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]I want to check[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]if the user is[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]to be deleted[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]or not.[/size][/font][/color]
[color=#333333][font=arial, sans-serif][size=4]For[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]example,[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]if the user[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]is ADMIN[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]can not be deleted[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]if it is not[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]otherwise[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]come[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]ADMIN[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]deleted[/size][/font][/color]
Posted 26 November 2011 - 23:10 PM
[color=#333333][font=arial, sans-serif][size=4]as I said[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]I would[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]change the behavior[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]of the[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]DELETE method[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4].[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]how can I[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]do?[/size][/font][/color]
Posted 04 December 2011 - 09:44 AM
Posted 04 December 2011 - 10:05 AM
Posted 04 December 2011 - 23:35 PM
[color=#333333][font=arial, sans-serif][size=4]if I want to[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]change the[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]action "[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]EDIT[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]"[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]or "[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]DELETE[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]"[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]how can I[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]do?[/size][/font][/color]
[color=#333333][font=arial, sans-serif][size=4]for me[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]it is very important[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]because[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]a[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]DELETE[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]to edit[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]the table[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]I[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]do not want[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]a particular user[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]then[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]it is deleted[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]when a[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]user presses[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]DELETE[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]on[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]I want to check[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]if the user is[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]to be deleted[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]or not.[/size][/font][/color]
[color=#333333][font=arial, sans-serif][size=4]For[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]example,[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]if the user[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]is ADMIN[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]can not be deleted[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]if it is not[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]otherwise[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]come[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]ADMIN[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]deleted[/size][/font][/color]
[/quote]
A simple way to do that is to use the add_action method. First of all don't forget to unset_delete() and have your own action control about delete or everything you like to add at actions column. For more you can see an example at: http://www.grocerycr...mple/add_action
You can also check the parameters that add_action method takes at http://www.grocerycrud.com/crud/function_name/add_action
Posted 04 December 2011 - 23:50 PM
Posted 07 December 2011 - 19:26 PM
Posted 10 December 2011 - 19:06 PM
$crud->callback_escape_delete(array($this, 'escape_delete'));instead. Then you can something like this
in the actual function which will execute instead of the actual DELETE.
function escape_delete($PKeyValue)
{
//echo 'In Escape Delete';
echo 'The PKey Value is .. '.$PKeyValue;
$this->db->update('users', array('active' => 0,
'last_edit_user' => $this->session->userdata('username'),
'last_edit_date_time' => standard_date('DATE_ISO8601', time()),
'comments' => 'Deleted'), array('id' => $PKeyValue));
return TRUE;
}
hope this helps.