fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9754] move back functions - called from bookingfront


From: Sigurd Nes
Subject: [Fmsystem-commits] [9754] move back functions - called from bookingfrontend
Date: Mon, 09 Jul 2012 18:22:26 +0000

Revision: 9754
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9754
Author:   sigurdne
Date:     2012-07-09 18:22:26 +0000 (Mon, 09 Jul 2012)
Log Message:
-----------
move back functions - called from bookingfrontend

Modified Paths:
--------------
    trunk/booking/inc/class.uicommon.inc.php

Removed Paths:
-------------
    trunk/booking/inc/functions.inc.php

Modified: trunk/booking/inc/class.uicommon.inc.php
===================================================================
--- trunk/booking/inc/class.uicommon.inc.php    2012-07-06 14:25:50 UTC (rev 
9753)
+++ trunk/booking/inc/class.uicommon.inc.php    2012-07-09 18:22:26 UTC (rev 
9754)
@@ -1,7 +1,75 @@
 <?php
        phpgw::import_class('phpgwapi.yui');
        
+       /**
+        * Cherry pick selected values into a new array
+        * 
+        * @param array $array    input array
+        * @param array $keys     array of keys to pick
+        *
+        * @return array containg values from $array for the keys in $keys.
+        */
+       function extract_values($array, $keys, $options = array())
+       {
+               static $default_options = array(
+                       'prefix' => '',
+                       'suffix' => '', 
+                       'preserve_prefix' => false,
+                       'preserve_suffix' => false
+               );
+               
+               $options = array_merge($default_options, $options);
+               
+               $result = array();
+               foreach($keys as $write_key)
+               {
+                       $array_key = 
$options['prefix'].$write_key.$options['suffix'];
+                       if(isset($array[$array_key])) {
+                               $result[($options['preserve_prefix'] ? 
$options['prefix'] : '').$write_key.($options['preserve_suffix'] ? 
$options['suffix'] : '')] = $array[$array_key];
+                       }
+               }
+               return $result;
+       }
        
+       function array_set_default(&$array, $key, $value)
+       {
+               if(!isset($array[$key])) $array[$key] = $value;
+       }
+
+
+       /**
+        * Reformat an ISO timestamp into norwegian format
+        * 
+        * @param string $date    date
+        *
+        * @return string containg timestamp in norwegian format
+        */
+       function pretty_timestamp($date)
+       {
+               if (empty($date)) return "";
+               
+               if(is_array($date) && is_object($date[0]) && $date[0] 
instanceof DOMNode)
+               {
+                       $date = $date[0]->nodeValue;
+               }
+               preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2})( 
([0-9]{2}):([0-9]{2}))?/', $date, $match);
+
+               $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+               if($match[4]) 
+               {
+                       $dateformat .= ' H:i';
+                       $timestamp = mktime($match[5], $match[6], 0, $match[2], 
$match[3], $match[1]);
+               }
+               else
+               {
+                       $timestamp = mktime(0, 0, 0, $match[2], $match[3], 
$match[1]);
+               }
+               $text = date($dateformat,$timestamp);
+                       
+               return $text;
+       }
+
+       
        abstract class booking_uicommon
        {
                const UI_SESSION_FLASH = 'flash_msgs';

Deleted: trunk/booking/inc/functions.inc.php
===================================================================
--- trunk/booking/inc/functions.inc.php 2012-07-06 14:25:50 UTC (rev 9753)
+++ trunk/booking/inc/functions.inc.php 2012-07-09 18:22:26 UTC (rev 9754)
@@ -1,76 +0,0 @@
-<?php
-       /**
-       * @package booking
-       * @subpackage utilities
-       * @version $Id: functions.inc.php 9188 2012-04-19 20:13:58Z sigurdne $
-       */
-
-       /**
-        * Cherry pick selected values into a new array
-        * 
-        * @param array $array    input array
-        * @param array $keys     array of keys to pick
-        *
-        * @return array containg values from $array for the keys in $keys.
-        */
-       function extract_values($array, $keys, $options = array())
-       {
-               static $default_options = array(
-                       'prefix' => '',
-                       'suffix' => '', 
-                       'preserve_prefix' => false,
-                       'preserve_suffix' => false
-               );
-               
-               $options = array_merge($default_options, $options);
-               
-               $result = array();
-               foreach($keys as $write_key)
-               {
-                       $array_key = 
$options['prefix'].$write_key.$options['suffix'];
-                       if(isset($array[$array_key])) {
-                               $result[($options['preserve_prefix'] ? 
$options['prefix'] : '').$write_key.($options['preserve_suffix'] ? 
$options['suffix'] : '')] = $array[$array_key];
-                       }
-               }
-               return $result;
-       }
-       
-       function array_set_default(&$array, $key, $value)
-       {
-               if(!isset($array[$key])) $array[$key] = $value;
-       }
-
-
-       /**
-        * Reformat an ISO timestamp into norwegian format
-        * 
-        * @param string $date    date
-        *
-        * @return string containg timestamp in norwegian format
-        */
-       function pretty_timestamp($date)
-       {
-               if (empty($date)) return "";
-               
-               if(is_array($date) && is_object($date[0]) && $date[0] 
instanceof DOMNode)
-               {
-                       $date = $date[0]->nodeValue;
-               }
-               preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2})( 
([0-9]{2}):([0-9]{2}))?/', $date, $match);
-
-               $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-               if($match[4]) 
-               {
-                       $dateformat .= ' H:i';
-                       $timestamp = mktime($match[5], $match[6], 0, $match[2], 
$match[3], $match[1]);
-               }
-               else
-               {
-                       $timestamp = mktime(0, 0, 0, $match[2], $match[3], 
$match[1]);
-               }
-               $text = date($dateformat,$timestamp);
-                       
-               return $text;
-       }
-
-




reply via email to

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