fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9059] api: custom fields - datetime


From: Sigurd Nes
Subject: [Fmsystem-commits] [9059] api: custom fields - datetime
Date: Wed, 28 Mar 2012 16:17:50 +0000

Revision: 9059
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9059
Author:   sigurdne
Date:     2012-03-28 16:17:49 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
api: custom fields - datetime

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.custom_fields.inc.php
    trunk/property/inc/class.custom_fields.inc.php
    trunk/property/templates/base/attributes_form.xsl

Modified: trunk/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.custom_fields.inc.php      2012-03-28 13:23:21 UTC 
(rev 9058)
+++ trunk/phpgwapi/inc/class.custom_fields.inc.php      2012-03-28 16:17:49 UTC 
(rev 9059)
@@ -471,6 +471,13 @@
                                                $ts = 
phpgwapi_datetime::date_to_timestamp($attrib['value']);
                                                $attrib['value'] = 
date($this->_dateformat, $ts);
                                                break;
+
+                                       case 'DT':
+                                               
+                                               $date_array     = 
phpgwapi_datetime::date_array($attrib['value']['date']);
+                                               $ts = mktime 
((int)$attrib['value']['hour'], (int)$attrib['value']['min'], 0, 
$date_array['month'], $date_array['day'], $date_array['year']);
+                                               $attrib['value'] = 
date($this->_datetimeformat, $ts);
+                                               break;
                                }
                        }
                        return $values_attribute;

Modified: trunk/property/inc/class.custom_fields.inc.php
===================================================================
--- trunk/property/inc/class.custom_fields.inc.php      2012-03-28 13:23:21 UTC 
(rev 9058)
+++ trunk/property/inc/class.custom_fields.inc.php      2012-03-28 16:17:49 UTC 
(rev 9059)
@@ -102,8 +102,20 @@
 
                                        if(isset($attributes['value']) && 
$attributes['value'])
                                        {
-                                               $timestamp_date= 
mktime(0,0,0,date('m',strtotime($attributes['value'])),date('d',strtotime($attributes['value'])),date('y',strtotime($attributes['value'])));
-                                               $attributes['value']            
= $GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
+                                               if($attributes['datatype'] == 
'DT')
+                                               {
+                                                       $timestamp= 
strtotime($attributes['value']);
+                                                       $attributes['value'] = 
array();
+                                                       
$attributes['value']['date'] = 
$GLOBALS['phpgw']->common->show_date($timestamp,$dateformat);
+                                                       
$attributes['value']['hour'] = date('H', $timestamp);
+                                                       
$attributes['value']['min'] = date('i', $timestamp);
+//                                                     
_debug_array($attributes);die();
+                                               }
+                                               else
+                                               {
+                                                       $timestamp_date= 
mktime(0,0,0,date('m',strtotime($attributes['value'])),date('d',strtotime($attributes['value'])),date('y',strtotime($attributes['value'])));
+                                                       $attributes['value']    
        = $GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
+                                               }
                                        }
                                }
                                else if($attributes['datatype'] == 'AB')

Modified: trunk/property/templates/base/attributes_form.xsl
===================================================================
--- trunk/property/templates/base/attributes_form.xsl   2012-03-28 13:23:21 UTC 
(rev 9058)
+++ trunk/property/templates/base/attributes_form.xsl   2012-03-28 16:17:49 UTC 
(rev 9059)
@@ -16,6 +16,8 @@
 
        <!-- New template-->
        <xsl:template xmlns:php="http://php.net/xsl"; match="attributes">
+               <xsl:variable name="lang_hour"><xsl:value-of 
select="php:function('lang', 'hour')" /></xsl:variable>
+               <xsl:variable name="lang_min"><xsl:value-of 
select="php:function('lang', 'minute')" /></xsl:variable>
                <xsl:variable name="statustext">
                        <xsl:value-of select="statustext"/>
                </xsl:variable>
@@ -355,6 +357,52 @@
                                                                </input>
                                                                <img 
id="values_attribute_{counter}-trigger" src="{img_cal}" alt="{lang_datetitle}" 
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;"/>
                                                        </xsl:when>
+                                                       <xsl:when 
test="datatype='DT'">
+                                                               <table>
+                                                                       <tr>
+                                                                               
<td>
+                                                                               
        <input type="text" id="values_attribute_{counter}" 
name="values_attribute[{counter}][value][date]" value="{value/date}" size="12" 
maxlength="12">
+                                                                               
                <xsl:attribute name="readonly">
+                                                                               
                        <xsl:text> readonly</xsl:text>
+                                                                               
                </xsl:attribute>
+                                                                               
                <xsl:choose>
+                                                                               
                        <xsl:when test="disabled!=''">
+                                                                               
                                <xsl:attribute name="disabled">
+                                                                               
                                        <xsl:text> disabled</xsl:text>
+                                                                               
                                </xsl:attribute>
+                                                                               
                        </xsl:when>
+                                                                               
                </xsl:choose>
+                                                                               
        </input>
+                                                                               
        <img id="values_attribute_{counter}-trigger" src="{img_cal}" 
alt="{lang_datetitle}" title="{lang_datetitle}" style="cursor:pointer; 
cursor:hand;"/>
+                                                                               
</td>
+                                                                               
<td>
+                                                                               
        <input type="text" id="values_attribute_{counter}_hour" 
name="values_attribute[{counter}][value][hour]" value="{value/hour}" size="2" 
maxlength="2" title="{$lang_hour}">
+                                                                               
                <xsl:choose>
+                                                                               
                        <xsl:when test="disabled!=''">
+                                                                               
                                <xsl:attribute name="disabled">
+                                                                               
                                        <xsl:text> disabled</xsl:text>
+                                                                               
                                </xsl:attribute>
+                                                                               
                        </xsl:when>
+                                                                               
                </xsl:choose>
+                                                                               
        </input>
+                                                                               
</td>
+                                                                               
<td>
+                                                                               
        <xsl:text> : </xsl:text>
+                                                                               
</td>
+                                                                               
<td>
+                                                                               
        <input type="text" id="values_attribute_{counter}_min" 
name="values_attribute[{counter}][value][min]" value="{value/min}" size="2" 
maxlength="2" title="{$lang_min}">
+                                                                               
                <xsl:choose>
+                                                                               
                        <xsl:when test="disabled!=''">
+                                                                               
                                <xsl:attribute name="disabled">
+                                                                               
                                        <xsl:text> disabled</xsl:text>
+                                                                               
                                </xsl:attribute>
+                                                                               
                        </xsl:when>
+                                                                               
                </xsl:choose>
+                                                                               
        </input>
+                                                                               
</td>
+                                                                       </tr>
+                                                               </table>
+                                                       </xsl:when>
                                                        <xsl:when 
test="datatype='T'">
                                                                <textarea 
cols="{//textareacols}" rows="{//textarearows}" 
name="values_attribute[{counter}][value]">
                                                                        
<xsl:choose>




reply via email to

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