r44410 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44409‎ | r44410 | r44411 >
Date:16:32, 10 December 2008
Author:yaron
Status:deferred
Tags:
Comment:
Added handling of new $sfg24HourTime global variable when generating form output
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc
@@ -670,7 +670,7 @@
671671 $year = date("Y", $cur_time);
672672 $month = date("n", $cur_time);
673673 $day = date("j", $cur_time);
674 - global $wgAmericanDates;
 674+ global $wgAmericanDates, $sfg24HourTime;
675675 if ($wgAmericanDates == true) {
676676 $month_names = sffGetMonthNames();
677677 $month_name = $month_names[$month - 1];
@@ -679,11 +679,19 @@
680680 $cur_value_in_template = "$year/$month/$day";
681681 }
682682 if ($input_type == 'datetime' || $input_type == 'datetime with timezone') {
683 - $hour = str_pad(intval(substr(date("g", $cur_time),0,2)),2,'0',STR_PAD_LEFT);
 683+ if ($sfg24HourTime) {
 684+ $hour = str_pad(intval(substr(date("G", $cur_time),0,2)),2,'0',STR_PAD_LEFT);
 685+ } else {
 686+ $hour = str_pad(intval(substr(date("g", $cur_time),0,2)),2,'0',STR_PAD_LEFT);
 687+ }
684688 $minute = str_pad(intval(substr(date("i", $cur_time),0,2)),2,'0',STR_PAD_LEFT);
685689 $second = str_pad(intval(substr(date("s", $cur_time),0,2)),2,'0',STR_PAD_LEFT);
686 - $ampm = date("A", $cur_time);
687 - $cur_value_in_template .= " $hour:$minute:$second $ampm";
 690+ if ($sfg24HourTime) {
 691+ $cur_value_in_template .= " $hour:$minute:$second";
 692+ } else {
 693+ $ampm = date("A", $cur_time);
 694+ $cur_value_in_template .= " $hour:$minute:$second $ampm";
 695+ }
688696 }
689697 if ($input_type == 'datetime with timezone') {
690698 $timezone = date("T", $cur_time);

Status & tagging log