MDL-19793 Upgraded calls to print_time_selector and print_date_selector

This commit is contained in:
nicolasconnault
2009-08-06 01:08:13 +00:00
parent 85ed1699f4
commit 127f1670ee
2 changed files with 36 additions and 8 deletions
+19 -4
View File
@@ -1,3 +1,18 @@
<?php
$startselectors = moodle_select::make_time_selectors(array(
'days' => 'startday',
'months' => 'startmon',
'years' => 'startyr',
'hours' => 'starthr',
'minutes' => 'startmin'), $form->timestart);
$endselectors = moodle_select::make_time_selectors(array(
'days' => 'endday',
'months' => 'endmon',
'years' => 'endyr',
'hours' => 'endhr',
'minutes' => 'endmin'), $form->timestart + $form->timeduration);
?>
<form method="post" action="event.php" id="eventform">
<table cellpadding="5" cellspacing="0">
<tr>
@@ -23,9 +38,9 @@
<tr>
<td style="vertical-align: top; text-align: right;"><?php print_string('eventdate', 'calendar'); ?>:</td>
<td>
<?php print_date_selector('startday', 'startmon', 'startyr', $form->timestart);?>
<?php echo $OUTPUT->select($startselectors[0]) . $OUTPUT->select($startselectors[1]) . $OUTPUT->select($startselectors[2]);?>
<?php print_string('eventtime', 'calendar');?>
<?php print_time_selector('starthr', 'startmin', $form->timestart) ?>
<?php echo $OUTPUT->select($startselectors[3]) . $OUTPUT->select($startselectors[4]);?>
<?php if (isset($err['timestart'])) formerr($err['timestart']); ?>
</td>
</tr>
@@ -45,9 +60,9 @@
<label for="duration_yes">
<?php print_string('durationuntil', 'calendar'); ?>
</label>
<?php print_date_selector('endday', 'endmon', 'endyr', $form->timestart + $form->timeduration);?>
<?php echo $OUTPUT->select($endselectors[0]) . $OUTPUT->select($endselectors[1]) . $OUTPUT->select($endselectors[2]);?>
<?php print_string('eventtime', 'calendar');?>
<?php print_time_selector('endhr', 'endmin', $form->timestart + $form->timeduration) ?>
<?php echo $OUTPUT->select($endselectors[3]) . $OUTPUT->select($endselectors[4]);?>
<?php if (isset($err['timeduration'])) formerr($err['timeduration']); ?>
</div>
<div>
+17 -4
View File
@@ -1,6 +1,19 @@
<?php
// The following is a hack to fix bug 1488
$course = $DB->get_record('course', array('id'=>($form->courseid ? $form->courseid : $site->id)));
$startselectors = moodle_select::make_time_selectors(array(
'days' => 'startday',
'months' => 'startmon',
'years' => 'startyr',
'hours' => 'starthr',
'minutes' => 'startmin'), (int) $form->timestart);
$endselectors = moodle_select::make_time_selectors(array(
'days' => 'endday',
'months' => 'endmon',
'years' => 'endyr',
'hours' => 'endhr',
'minutes' => 'endmin'), $form->timestart + $form->timeduration);
?>
<form method="post" action="event.php" id="eventform">
<table cellpadding="5">
@@ -29,9 +42,9 @@
<?php print_string('eventdate', 'calendar'); ?>:
</td>
<td>
<?php print_date_selector('startday', 'startmon', 'startyr', (int)$form->timestart);?>
<?php echo $OUTPUT->select($startselectors[0]) . $OUTPUT->select($startselectors[1]) . $OUTPUT->select($startselectors[2]);?>
<?php print_string('eventtime', 'calendar');?>
<?php print_time_selector('starthr', 'startmin', (int)$form->timestart) ?>
<?php echo $OUTPUT->select($startselectors[3]) . $OUTPUT->select($startselectors[4]);?>
<?php if (isset($err['timestart'])) formerr($err['timestart']); ?>
</td>
</tr>
@@ -47,9 +60,9 @@
<div>
<input type="radio" name="duration" value="1" id="duration_yes" <?php if($form->duration == 1) echo 'checked="checked"'; ?>/>
<label for="duration_yes"><?php print_string('durationuntil', 'calendar'); ?></label>
<?php print_date_selector('endday', 'endmon', 'endyr', $form->timestart + $form->timeduration);?>
<?php echo $OUTPUT->select($endselectors[0]) . $OUTPUT->select($endselectors[1]) . $OUTPUT->select($endselectors[2]);?>
<?php print_string('eventtime', 'calendar');?>
<?php print_time_selector('endhr', 'endmin', $form->timestart + $form->timeduration) ?>
<?php echo $OUTPUT->select($endselectors[3]) . $OUTPUT->select($endselectors[4]);?>
<?php if (isset($err['timeduration'])) formerr($err['timeduration']); ?>
</div>
<div>