I have managed to quickly create small table where one field is IP address. As the better way to store Ip is int(11) then I have tried to use GroceryCrud this way.
What I have done is:
$crud = new grocery_CRUD();
$crud->set_table('tickety');
$crud->field_type('ip', 'string');
$crud->callback_before_insert(array($this,'change_ip_insert_callback'));
$crud->callback_before_update(array($this,'change_ip_update_callback'));
$crud->callback_column('ip',array($this,'change_ip_show_callback'));
$output = $crud->render();
$this->_example_output($output);
It works this way and uses some php functions like:
function __convertIpToString($ip)
{
$long = 4294967295 - ($ip - 1);
return long2ip(-$long);
}
function __convertIpToLong($ip)
{
return sprintf("%u", ip2long($ip));
}
However how to teach CodeIgniter to use such convertion also when doing "search" function? Like before search on IP collumn please do convertIPToString and then compare.
Also since the field is limited to int(11) GroceryCrud limits the size of this field how I can change the char limit on it?
Thank you very much for your help in advance!