Skip to content

Commit

Permalink
MDL-19793 Upgraded calls to print_time_selector and print_date_selector
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasconnault committed Aug 6, 2009
1 parent 85ed169 commit 127f167
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
23 changes: 19 additions & 4 deletions calendar/event_edit.html
@@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down
21 changes: 17 additions & 4 deletions calendar/event_new.html
@@ -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">
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down

0 comments on commit 127f167

Please sign in to comment.