From 41a7e43d1baa27416188de0835e33cfdf2df9ff8 Mon Sep 17 00:00:00 2001
From: Ralf Becker
Date: Fri, 9 Mar 2007 11:23:26 +0000
Subject: [PATCH] date widget can now prefix (readonly) dates with the
week-number
---
etemplate/doc/reference.html | 3 ++-
etemplate/inc/class.date_widget.inc.php | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/etemplate/doc/reference.html b/etemplate/doc/reference.html
index ec7278760a..f52c64f10a 100644
--- a/etemplate/doc/reference.html
+++ b/etemplate/doc/reference.html
@@ -672,7 +672,8 @@ implement only a subset of XUL. Here are the main differences:
the up-to-date date (via javascript)
one-min-steps: if set (&4) the minute-selectbox uses one minutes steps, default 5min steps
ro-suppress-0h0: if set (&8) the time is suppressed for readonly and a time of 0h0
- day-of-week-prefix: if set (&16) readonly dates get prefixed with the day of week
+ day-of-week-prefix: if set (&16) readonly dates get prefixed with the day of week
+ week-number-prefix: if set (&32) readonly dates get prefixed with lang('Wk') & weeknumber
Sub-widgets: date-time: a date and a time and date-timeonly or date-houronly: only a time / hour
These widgets allow the input of times too or only, they use 12h am/pm or 24h format as
specified in the user prefs.
diff --git a/etemplate/inc/class.date_widget.inc.php b/etemplate/inc/class.date_widget.inc.php
index 842c3e44bc..9950d36c09 100644
--- a/etemplate/inc/class.date_widget.inc.php
+++ b/etemplate/inc/class.date_widget.inc.php
@@ -20,6 +20,7 @@
* &4 = 1min steps for time (default is 5min, with fallback to 1min if value is not in 5min-steps),
* &8 = dont show time for readonly and type date-time if time is 0:00,
* &16 = prefix r/o display with dow
+ * &32 = prefix r/o display with week-number
*
* This widget is independent of the UI as it only uses etemplate-widgets and has therefor no render-function.
* Uses the adodb datelibary to overcome the windows-limitation to not allow dates before 1970
@@ -183,6 +184,10 @@
{
$str = lang(adodb_date('l',adodb_mktime(12,0,0,$value['m'],$value['d'],$value['Y']))).' ';
}
+ if (!$n && $options & 32 )
+ {
+ $str = lang('Wk').adodb_date('W',adodb_mktime(12,0,0,$value['m'],$value['d'],$value['Y'])).' ';
+ }
$str .= ($str != '' ? $sep[$n] : '') .
(is_numeric($value[$format[$n]]) ? sprintf('%02d',$value[$format[$n]]) : $value[$format[$n]]);
}