if date_widget is readonly: just generate a label with the Date in the form spec. in the user-prefs

This commit is contained in:
Ralf Becker 2002-10-12 16:39:10 +00:00
parent ec1ffc81be
commit 7a07eef5b5

View File

@ -65,10 +65,23 @@
'd' => date('d',$value) '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 = new etemplate;
$tpl->init('*** generated fields for date','','',0,'',0,0); // make an empty template $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'); $fields = array('Y' => 'year', 'm' => 'month', 'd' => 'day');
$row = array(); $row = array();
for ($n=0; $n < 3; ++$n) for ($n=0; $n < 3; ++$n)
@ -140,4 +153,4 @@
} }
return True; return True;
} }
} }