mirror of
https://github.com/e107inc/e107.git
synced 2025-08-18 04:12:00 +02:00
Closes #108, Issue #133 and may correct Issue #335 - Datepicker updated and should now be working with times also. eg. 7:30PM
This commit is contained in:
@@ -611,7 +611,7 @@ class e_form
|
||||
* @param array or str
|
||||
* @example $frm->datepicker('my_field',time(),'type=date');
|
||||
* @example $frm->datepicker('my_field',time(),'type=datetime&inline=1');
|
||||
* @example $frm->datepicker('my_field',time(),'type=date&dateformat=yyyy-mm-dd');
|
||||
* @example $frm->datepicker('my_field',time(),'type=date&format=yyyy-mm-dd');
|
||||
*
|
||||
* @url http://trentrichardson.com/examples/timepicker/
|
||||
*/
|
||||
@@ -622,17 +622,23 @@ class e_form
|
||||
parse_str($options,$options);
|
||||
}
|
||||
|
||||
$dateFormat = varset($options['dateformat']) ? trim($options['dateformat']) :e107::getPref('inputdate', '%Y-%m-%d');
|
||||
$timeFormat = varset($options['timeformat']) ? trim($options['timeformat']) :e107::getPref('inputtime', '%H:%M:%S');
|
||||
|
||||
$type = varset($options['type']) ? trim($options['type']) : "date"; // 'datetime'
|
||||
$dateFormat = varset($options['format']) ? trim($options['format']) :e107::getPref('inputdate', '%Y-%m-%d');
|
||||
// $timeFormat = varset($options['timeformat']) ? trim($options['timeformat']) :e107::getPref('inputtime', '%H:%M:%S');
|
||||
|
||||
|
||||
|
||||
if($type == 'datetime' && !varset($options['format']))
|
||||
{
|
||||
$dateFormat .= " ".e107::getPref('inputtime', '%H:%M:%S');
|
||||
}
|
||||
|
||||
// echo "TYPE=".$type;
|
||||
|
||||
$ampm = (preg_match("/%l|%I|%p|%P/",$timeFormat)) ? 'true' : 'false';
|
||||
$ampm = (preg_match("/%l|%I|%p|%P/",$dateFormat)) ? 'true' : 'false';
|
||||
|
||||
$dformat = e107::getDate()->toMask($dateFormat);
|
||||
$tformat = e107::getDate()->toMask($timeFormat);
|
||||
// $tformat = e107::getDate()->toMask($timeFormat);
|
||||
|
||||
$id = $this->name2id($name);
|
||||
|
||||
@@ -645,7 +651,7 @@ class e_form
|
||||
$def = array(
|
||||
'date' => $dateFormat,
|
||||
// 'time' => $timeFormat,
|
||||
'datetime' => $dateFormat." ".$timeFormat
|
||||
'datetime' => $dateFormat // ." ".$timeFormat
|
||||
);
|
||||
|
||||
$defdisp = (isset($def[$type])) ? $def[$type] : $def['date'];
|
||||
@@ -665,7 +671,7 @@ class e_form
|
||||
|
||||
if(vartrue($options['inline']))
|
||||
{
|
||||
$text .= "<div class='{$class}' id='inline-{$id}' data-date-format='{$dformat}' data-time-format='{$tformat}' data-date-ampm='{$ampm}' data-date-firstday='{$firstDay}' ></div>
|
||||
$text .= "<div class='{$class}' id='inline-{$id}' data-date-format='{$dformat}' data-date-ampm='{$ampm}' data-date-firstday='{$firstDay}' ></div>
|
||||
<input type='hidden' name='{$name}' id='{$id}' value='{$value}' data-date-format='{$dformat}' data-time-format='{$tformat}' data-date-ampm='{$ampm}' data-date-firstday='{$firstDay}' />
|
||||
";
|
||||
}
|
||||
@@ -684,10 +690,11 @@ class e_form
|
||||
*/
|
||||
|
||||
|
||||
$text .= "<input class='{$class}' type='text' size='{$size}' name='{$name}' id='{$id}' value='{$value}' data-date-format='{$dformat}' data-time-format='{$tformat}' data-date-ampm='{$ampm}' data-date-firstday='{$firstDay}' {$required} />";
|
||||
$text .= "<input class='{$class} input-xlarge' type='text' size='{$size}' name='{$name}' id='{$id}' value='{$value}' data-date-format='{$dformat}' data-date-ampm='{$ampm}' data-date-firstday='{$firstDay}' {$required} />";
|
||||
}
|
||||
|
||||
// $text .= " ({$dformat}) ".$value;
|
||||
// $text .= "ValueFormat: ".$defdisp." Value: ".$value;
|
||||
// $text .= " ({$dformat}) type:".$defdisp." ".$value;
|
||||
|
||||
return $text;
|
||||
|
||||
|
Reference in New Issue
Block a user