From 7a07eef5b556ce7e62ca752ec2f211cad957ec83 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 12 Oct 2002 16:39:10 +0000 Subject: [PATCH] if date_widget is readonly: just generate a label with the Date in the form spec. in the user-prefs --- etemplate/inc/class.date_widget.inc.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.date_widget.inc.php b/etemplate/inc/class.date_widget.inc.php index 94154d2cf4..68044ac423 100644 --- a/etemplate/inc/class.date_widget.inc.php +++ b/etemplate/inc/class.date_widget.inc.php @@ -65,10 +65,23 @@ 'd' => date('d',$value) ); } + $format = split('[/.-]',$sep=$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']); + $sep = $sep[1]; + if ($cell['readonly'] || $readonlys) // is readonly + { + for ($str='',$n = 0; $n < 3; ++$n) + { + $str .= ($str != '' ? $sep : ''); + $str .= $value[$format[$n]]; + } + $value = $str; + $cell['type'] = 'label'; + $cell['no_lang'] = True; + return True; + } $tpl = new etemplate; $tpl->init('*** generated fields for date','','',0,'',0,0); // make an empty template - $format = split('[/.-]',$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']); $fields = array('Y' => 'year', 'm' => 'month', 'd' => 'day'); $row = array(); for ($n=0; $n < 3; ++$n) @@ -140,4 +153,4 @@ } return True; } - } \ No newline at end of file + }