Merged revisions 4035,4037-4048 via svnmerge from

file:///home/developper/svn/phpcompta/branches/rel550

........
  r4037 | danydb | 2011-03-05 14:03:18 +0100 (Sat, 05 Mar 2011) | 2 lines
  
  Add request_to_hidden, post_to_hidden functions
........
  r4038 | danydb | 2011-03-05 14:04:31 +0100 (Sat, 05 Mar 2011) | 2 lines
  
  add doc. function get_to_hidden post_to_hidden
........
  r4039 | danydb | 2011-03-05 14:37:20 +0100 (Sat, 05 Mar 2011) | 1 line
  
  Fix javascript problem with date
........
  r4040 | danydb | 2011-03-05 16:29:52 +0100 (Sat, 05 Mar 2011) | 2 lines
  
  Bug cannot get the last date
........
  r4041 | danydb | 2011-03-05 16:52:57 +0100 (Sat, 05 Mar 2011) | 1 line
  
  Add default_value, request_to_hidden function 
........
  r4042 | danydb | 2011-03-05 16:53:15 +0100 (Sat, 05 Mar 2011) | 1 line
  
  Add sublevel to balance 
........
  r4043 | danydb | 2011-03-05 16:53:32 +0100 (Sat, 05 Mar 2011) | 1 line
  
  Add bank saldo 
........
  r4044 | danydb | 2011-03-05 17:06:37 +0100 (Sat, 05 Mar 2011) | 2 lines
  
  234 limite dans les dossier afficher en administration
........
  r4045 | danydb | 2011-03-05 17:12:33 +0100 (Sat, 05 Mar 2011) | 2 lines
  
  bug 234
........
  r4046 | danydb | 2011-03-07 13:05:48 +0100 (Mon, 07 Mar 2011) | 1 line
  
  add_todo_list was removed
........
  r4047 | danydb | 2011-03-07 13:13:48 +0100 (Mon, 07 Mar 2011) | 1 line
  
  Bug IDate
........
This commit is contained in:
Dany De Bontridder 2011-03-07 14:30:26 +00:00
parent ac1a34ee84
commit ab4cc9bd10
10 changed files with 220 additions and 35 deletions

View file

@ -467,19 +467,83 @@ class HtmlInput
return $r;
}
/**
*transform get to hidden
*transform request data to hidden
*@param $array is an of indices
*@param $request name of the superglobal $_POST $_GET $_REQUEST(default)
*@return html string with the hidden data
*/
static function array_to_hidden($array,$global_array )
{
$r="";
if ( count($global_array )==0) return '';
foreach ($array as $a)
{
if (isset($global_array [$a])) $r.=HtmlInput::hidden($a,$global_array [$a]);
}
return $r;
}
/**
*transform $_GET data to hidden
*@param $array is an of indices
*@see HtmlInput::request_to_hidden
*@return html string with the hidden data
*/
static function get_to_hidden($array)
{
if ( count($_GET) == 0) return "";
$r="";
foreach ( $array as $a)
{
if (isset($_GET[$a])) $r.=HtmlInput::hidden($a,$_GET[$a]);
}
$r=self::array_to_hidden($array,$_GET );
return $r;
}
/**
*transform $_POST data to hidden
*@param $array is an of indices
*@see HtmlInput::request_to_hidden
*@return html string with the hidden data
*/
static function post_to_hidden($array)
{
$r=self::array_to_hidden($array,$_POST );
return $r;
}
/**
*transform $_REQUEST data to hidden
*@param $array is an of indices
*@see HtmlInput::request_to_hidden
*@return html string with the hidden data
*/
static function request_to_hidden($array)
{
$r=self::array_to_hidden($array,$_REQUEST );
return $r;
}
}
/**
* generate an unique id for a widget,
*@param $p_prefix prefix
*@see HtmlInput::IDate
*@return string with a unique id
*/
static function generate_id($p_prefix)
{
$r=sprintf('%s_%d',$p_prefix,mt_rand(0,999999));
return $r;
}
/**
* return default if the value if the array doesn't exist
*@param $ind the index to check
*@param $default the value to return
*@param $array the array
*/
static function default_value($ind,$default,$array)
{
if ( ! isset($array[$ind]))
{
return $default;
}
return $array[$ind];
}
}