[eluser]reset[/eluser]
Hi all,
I've a validation helper for dates and another functions. That's the code:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
if (! function_exists('_compara_fecha_sysdate')){
function _compara_fecha_sysdate($date){
$fecha_actual = date('Ymd');
$date = substr($date,6).substr($date,3,2).substr($date,0,2);
if ($date > $fecha_actual)
return TRUE;
return FALSE;
}
}
if (! function_exists('_validar_formato_fecha')){
function _validar_formato_fecha($date){
$ddmmyyyy='(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.](19|20)[0-9]{2}';
if(preg_match("/$ddmmyyyy$/", $date))
return TRUE;
return FALSE;
}
}
if (! function_exists('_check_fecha')){
function _check_fecha($date){
if (checkdate((int) substr($date,3,2),(int) substr($date,0,2), (int) substr($date,6)))
return TRUE;
return FALSE;
}
}
?>
I would like use this functions in diferents controllers, but if I use validation->set_rules(...) with that rules, it doesn't work:
Code:
$this->load->helper('date_validation');
...
$rules['date'] = 'call_back__check_fecha';
//Other option
$rules['date'] = '_check_fecha';
...
$this->validation->set_rules($rules);
...
How I can use my helper for validation with CI_Validation library?
Thanks,