phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.7,1.8


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.7,1.8
Date: Sun, 09 Jun 2002 17:34:24 -0400

Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv23884

Modified Files:
        class.boetemplate.inc.php 
Log Message:
splitt save_appsession in appsession_id and save_appsession
added function complete_array_merge

Index: class.boetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.boetemplate.inc.php   2 Jun 2002 21:10:24 -0000       1.7
--- class.boetemplate.inc.php   9 Jun 2002 21:34:21 -0000       1.8
***************
*** 162,167 ****
                }
  
                /*!
!               @function save_appsession()
                @abstract saves content,readonlys,template-keys, ... via the 
appsession function
                @discussion As a user may open several windows with the same 
content/template wie generate a location-id from microtime
--- 162,175 ----
                }
  
+               function appsession_id()
+               {
+                       list($msec,$sec) = explode(' ',microtime());
+                       $id = $GLOBALS['phpgw_info']['flags']['currentapp'] . 
(intval(1000000 * $msec) + 1000000 * ($sec % 100000));
+                       //echo "<p>microtime()=".microtime().", sec=$sec, 
msec=$msec, id=$id</p>\n";
+                       return $id;
+               }
+ 
                /*!
!               @function save_appsession($data,$id='')
                @abstract saves content,readonlys,template-keys, ... via the 
appsession function
                @discussion As a user may open several windows with the same 
content/template wie generate a location-id from microtime
***************
*** 169,180 ****
                @discussion is then saved as a hidden-var in the form. The 
above mentions session-id has nothing to do / is different
                @discussion from the session-id which is constant for all 
windows opened in one session.
                @returns the location-id
                */
!               function save_appsession($data)
                {
!                       list($msec,$sec) = explode(' ',microtime());
!                       $id = $GLOBALS['phpgw_info']['flags']['currentapp'] . 
(intval(1000000 * $msec) + 1000000 * ($sec % 100000));
!                       //echo "<p>microtime()=".microtime().", sec=$sec, 
msec=$msec, id=$id</p>\n";
! 
                        
$GLOBALS['phpgw']->session->appsession($id,'etemplate',$data);
  
--- 177,190 ----
                @discussion is then saved as a hidden-var in the form. The 
above mentions session-id has nothing to do / is different
                @discussion from the session-id which is constant for all 
windows opened in one session.
+               @param $data the data to save
+               @param $id the id to use or '' to generate a new id
                @returns the location-id
                */
!               function save_appsession($data,$id='')
                {
!                       if (!$id)
!                       {
!                               $id = $this->appsession_id;
!                       }
                        
$GLOBALS['phpgw']->session->appsession($id,'etemplate',$data);
  
***************
*** 183,187 ****
  
                /*!
!               @function get_appsession()
                @abstract gets content,readonlys,template-keys, ... back from 
the appsession function
                @param $id the location-id
--- 193,197 ----
  
                /*!
!               @function get_appsession($id)
                @abstract gets content,readonlys,template-keys, ... back from 
the appsession function
                @param $id the location-id
***************
*** 305,308 ****
--- 315,341 ----
                        }
                        return $val;
+               }
+ 
+               /*!
+               @function complete_array_merge($old,$new)
+               @abstract merges $old and $new, content of $new has precedence 
over $old
+               @note THIS IS NOT THE SAME AS PHP4: array_merge (as it calls 
itself recursive for values which are arrays,
+               @note if there key does NOT start with a '_' (array_merge just 
overwrites the old (sub)array)
+               */
+               function complete_array_merge($old,$new)
+               {
+                       reset($new);
+                       while (list($k,$v) = each($new))
+                       {
+                               if (!is_array($v) || !isset($old[$k]) || $k[0] 
== '_')
+                               {
+                                       $old[$k] = $v;
+                               }
+                               else
+                               {
+                                       $old[$k] = 
$this->complete_array_merge($old[$k],$v);
+                               }
+                       }
+                       return $old;
                }
        };




reply via email to

[Prev in Thread] Current Thread [Next in Thread]