Browse Source

Homepage time format selector

Cerothen 9 years ago
parent
commit
fcd464445c
5 changed files with 33 additions and 8 deletions
  1. 2 1
      config/configDefaults.php
  2. 8 0
      functions.php
  3. 1 1
      homepage.php
  4. 2 1
      lang/en.ini
  5. 20 5
      settings.php

+ 2 - 1
config/configDefaults.php

@@ -57,5 +57,6 @@ return array(
 	"loadingScreen" => "true",
 	"enableMail" => "false",
 	"slimBar" => "true",
-	"gravatar" => "true"
+	"gravatar" => "true",
+	"CALTIMEFORMAT" => "h(:mm)t",
 );

+ 8 - 0
functions.php

@@ -1004,6 +1004,14 @@ function removeFiles($path) {
 	}
 }
 
+// Lazy select options
+function resolveSelectOptions($array, $selected = '') {
+	$output = array();
+	foreach ($array as $key => $value) {
+		$output[] = '<option value="'.$value.'"'.($selected===$value?' selected':'').'>'.$key.'</option>';
+	}
+	return implode('',$output);
+}
 
 // ==============
 

+ 1 - 1
homepage.php

@@ -587,7 +587,7 @@ endif; ?>
 
                     editable: false,
                     droppable: false,
-
+					timeFormat: '<?php echo CALTIMEFORMAT; ?>',
                 });
             
             });

+ 2 - 1
lang/en.ini

@@ -238,4 +238,5 @@ ONLY = "Only"
 NO_CREATE = "Do Not Create Accounts"
 YES_CREATE = "Create Accounts As Needed"
 RECENT_CONTENT = "Recently Added Content"
-SETTINGS_SAVED = "Settings have been Saved"
+SETTINGS_SAVED = "Settings have been Saved"
+CALTIMEFORMAT = "Select time format"

+ 20 - 5
settings.php

@@ -1610,18 +1610,33 @@ endif;?></textarea>
                                                                 
                                                                 <div class="form-group">
 
-                                                                <input type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57' class="form-control material input-sm" name="calendarStartDay" placeholder="<?php echo $language->translate("CALENDAR_START_DATE");?>" autocorrect="off" autocapitalize="off" value="<?php echo CALENDARSTARTDAY;?>">
-                                                                <p class="help-text"><?php echo $language->translate("CALENDAR_START_DATE");?></p>
+																	<input type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57' class="form-control material input-sm" name="calendarStartDay" placeholder="<?php echo $language->translate("CALENDAR_START_DATE");?>" autocorrect="off" autocapitalize="off" value="<?php echo CALENDARSTARTDAY;?>">
+																	<p class="help-text"><?php echo $language->translate("CALENDAR_START_DATE");?></p>
 
                                                                 </div>
                                                                 
                                                                 <div class="form-group">
 
-                                                                <input type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57' class="form-control material input-sm" name="calendarEndDay" placeholder="<?php echo $language->translate("CALENDAR_END_DATE");?>" autocorrect="off" autocapitalize="off" value="<?php echo CALENDARENDDAY;?>">
-                                                                <p class="help-text"><?php echo $language->translate("CALENDAR_END_DATE");?></p>
+																	<input type="text" onkeypress='return event.charCode >= 48 && event.charCode <= 57' class="form-control material input-sm" name="calendarEndDay" placeholder="<?php echo $language->translate("CALENDAR_END_DATE");?>" autocorrect="off" autocapitalize="off" value="<?php echo CALENDARENDDAY;?>">
+																	<p class="help-text"><?php echo $language->translate("CALENDAR_END_DATE");?></p>
 
                                                                 </div>
-
+																
+                                                                <div class="form-group">
+																	<select name="calTimeFormat" class="form-control material input-sm" required>
+																		<?php
+																			echo resolveSelectOptions(array(
+																				'6p' => 'h(:mm)t',
+																				'6:00p' => 'h:mmt',
+																				'6:00' => 'h:mm',
+																				'18' => 'H(:mm)',
+																				'18:00' => 'H:mm',
+																			), CALTIMEFORMAT);
+																		?>
+																	</select>
+																	<p class="help-text"><?php echo $language->translate("CALTIMEFORMAT");?></p>
+                                                                </div>
+																
                                                             </div>
 
                                                         </div>