Author: danydb
Date: 2011-05-06 20:34:30 +0200 (Fri, 06 May 2011)
New Revision: 4078

Modified:
   phpcompta/trunk/include/class_html_input.php
Log:
Add the function 
    request_to_string
    get_to_string
    post_to_string


Modified: phpcompta/trunk/include/class_html_input.php
===================================================================
--- phpcompta/trunk/include/class_html_input.php        2011-05-06 18:33:31 UTC 
(rev 4077)
+++ phpcompta/trunk/include/class_html_input.php        2011-05-06 18:34:30 UTC 
(rev 4078)
@@ -522,6 +522,64 @@
     }
 
     /**
+     *transform request data  to string
+     *@param $array is an of indices 
+     *@param $request name of the superglobal $_POST $_GET $_REQUEST(default) 
+     *@return html string with the string data
+     */
+    static function array_to_string($array,$global_array )
+    {
+
+      $r="?";
+
+      if ( count($global_array )==0) return '';
+      $and=""; 
+      foreach ($array  as $a)
+       {
+         if (isset($global_array [$a]))
+            $r.=$and."&$a=".$global_array [$a];
+         $and="";
+       }
+      
+      return $r;
+    }
+    /**
+     *transform $_GET   data  to string
+     *@param $array is an of indices 
+     *@see HtmlInput::request_to_string
+     *@return html string with the string data
+     */
+    static function get_to_string($array)
+    {
+      $r=self::array_to_string($array,$_GET );
+      return $r;
+    }
+
+    /**
+     *transform $_POST  data  to string
+     *@param $array is an of indices 
+     *@see HtmlInput::request_to_string
+     *@return html string with the string data
+     */
+    static function post_to_string($array)
+    {
+      $r=self::array_to_string($array,$_POST );
+      return $r;
+    }
+
+    /**
+     *transform $_REQUEST   data  to string
+     *@param $array is an of indices 
+     *@see HtmlInput::request_to_string
+     *@return html string with the string data
+     */
+    static function request_to_string($array)
+    {
+      $r=self::array_to_string($array,$_REQUEST  );
+      return $r;
+    }
+
+    /**
      * generate an unique id for a widget, 
      *@param $p_prefix prefix
      *@see HtmlInput::IDate


_______________________________________________
Phpcompta-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/phpcompta-dev

Reply via email to