PEAK XOOPS - Show am/pm is dropdown when adding events HACK in englishin japanese

Show am/pm is dropdown when adding events HACK

List posts in the topic

question Show am/pm is dropdown when adding events HACK

msg# 1.2
depth:
1
Previous post - Next post | Parent - Children.1 | Posted on 2004/8/30 15:54
AZNative  一等兵 From: Phoenix, Arizona, USA  Posts: 12
This hack changes the dropdown menus when creating/adding event. Currently, the dropdowns show the 24-hour clock, 0-23. This hack changes those drop down to use the 12-hour clock, making it easier for your users to add events.

Open the piCal.php file and do a search for the method
function get_schedule_edit_htm
. Scroll down through the method and find the following FOR LOOP CODE
		$select_start_hour = "<select name='StartHour' $allday_select>\n" ;

for( $h = 0 ; $h < 24 ; $h ++ ) {
. Replace the entire FOR LOOP (between the { }) with the following code:

	for( $h = 0 ; $h < 24 ; $h ++ ) {
                // Convert 24-hour clock to 12-hour clock
                if ($h == 0) {
                  $x = 12;
                  $y = "am";
                } else if ($h == 12) {
                  $x = 12;
                  $y = "pm";
                } else if ($h >= 13) {
                  $x = $h - 12;
                  $y = "pm";
                } else {
                  $x = $h;
                  $y = "am";
                }

		if ($h == $start_hour) {
                  $select_start_hour .= "<option value='$h' selected='selected'>$x $y</option>\n" ;
                } else {
                  $select_start_hour .= "<option value='$h'>$x $y</option>\n" ;
                }

	}

Now find the FOR LOOP for the end hour
	$select_end_hour = "<select name='EndHour' $allday_select>\n" ;
	for( $h = 0 ; $h < 24 ; $h ++ ) {

and replace the entire FOR LOOP with the following code

	for( $h = 0 ; $h < 24 ; $h ++ ) {
                // Convert 24-hour clock to 12-hour clock
                if ($h == 0) {
                  $x = 12;
                  $y = "am";
                } else if ($h == 12) {
                  $x = 12;
                  $y = "pm";
                } else if ($h >= 13) {
                  $x = $h - 12;
                  $y = "pm";
                } else {
                  $x = $h;
                  $y = "am";
                }

		if ($h == $end_hour) {
                  $select_end_hour .= "<option value='$h' selected='selected'>$x $y</option>\n" ;
                } else {
                  $select_end_hour .= "<option value='$h'>$x $y</option>\n" ;
                }
	}
Votes:0 Average:0.00

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!