-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoneslotform.html
More file actions
190 lines (182 loc) · 7.31 KB
/
oneslotform.html
File metadata and controls
190 lines (182 loc) · 7.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!-- This page defines the form to move an appointment slot -->
<!-- it is used from view.php -->
<?php echo $action; ?>
<?php $usehtmleditor = can_use_html_editor(); ?>
<form name="add" method="post" action="view.php?id=<?php p($cm->id) ?>">
<input type="hidden" name="what" value="<?php p($form->what) ?>" />
<input type="hidden" name="id" value="<?php p($cm->id) ?>" />
<input type="hidden" name="page" value="<?php p($page) ?>" />
<input type="hidden" name="subaction" value="" />
<input type="hidden" name="offset" value="<?php p($offset) ?>" />
<input type="hidden" name="studentid" value="" /><!-- for appointments managment, and scheduling only -->
<input type="hidden" name="groupid" value="" /><!-- for group scheduling only -->
<input type="hidden" name="appointments" value="<?php p(serialize($form->appointments)) ?>" />
<?php
if (!has_capability('mod/simplescheduler:canscheduletootherteachers', $context)){
?>
<input type="hidden" name="teacherid" value="<?php p($form->teacherid) ?>" />
<?php
}
if ($action == 'updateslot'){
?>
<input type="hidden" name="slotid" value="<?php p($slotid) ?>" />
<?php
}
elseif ($action == 'schedule'){
?>
<input type="hidden" name="seen" value="<?php p($form->seen) ?>" />
<?php
}
?>
<center>
<table cellpadding="5">
<?php
if($action == 'schedule' or $action == 'schedulegroup'){
if ($form->availableslots){
?>
<tr valign="top">
<td align="right"><b><?php print_string('chooseexisting', 'simplescheduler') ?>:</b></td>
<td align="left">
<?php
$startdatemem = '';
$starttimemem = '';
foreach($form->availableslots as $aSlot){
$startdatecnv = simplescheduler_userdate($aSlot->starttime,1);
$starttimecnv = simplescheduler_usertime($aSlot->starttime,1);
$startdatestr = ($startdatemem != '' and $startdatemem == $startdatecnv) ? "-----------------" : $startdatecnv ;
$starttimestr = ($starttimemem != '' and $starttimemem == $starttimecnv) ? '' : $starttimecnv ;
$startdatemem = $startdatecnv;
$starttimemem = $starttimecnv;
$form->availableslotsmenu[$aSlot->id] = "$startdatestr $starttimestr";
}
echo html_writer::select($form->availableslotsmenu, 'slotid', $form->slotid, array(''=>'choosedots'), array('id'=>'slotchooser'));
?>
</td>
</tr>
<?php
}
}
?>
<tr valign="top">
<td align="right"><b><?php print_string('date', 'simplescheduler') ?>:</b></td>
<td align="left" <?php print_error_class(@$errors, 'rangestart') ?> >
<?php
echo html_writer::select_time('days', 'day', $form->starttime);
echo html_writer::select_time('months', 'month', $form->starttime);
echo html_writer::select_time('years', 'year', $form->starttime);
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('starttime', 'simplescheduler') ?>:</b></td>
<td align="left">
<?php
echo html_writer::select_time('hours', 'hour', $form->starttime);
echo html_writer::select_time('minutes', 'minute', $form->starttime);
echo $OUTPUT->help_icon('choosingslotstart', 'simplescheduler');
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('duration', 'simplescheduler') ?>:</b></td>
<td align="left">
<input type="text" size="3" maxlength="3" name="duration" value="<?php echo $form->duration?>" />
<?php print_string('minutes', 'simplescheduler') ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('multiplestudents', 'simplescheduler') ?>:</b></td>
<td align="left" <?php print_error_class(@$errors, 'exclusivity') ?> >
<script type="text/javascript">
</script>
<?php
$maxexclusive = $CFG->simplescheduler_maxstudentsperslot;
$exclusivemenu['0'] = get_string('unlimited', 'simplescheduler');
$knownslots = count($form->appointments);
if ($knownslots == 0) $knownslots++;
for($i = $knownslots ; $i <= $maxexclusive; $i++){
$exclusivemenu[(string)$i] = $i;
}
echo html_writer::select($exclusivemenu, 'exclusivity', $form->exclusivity, array(), array('id'=>'exclusivechooser'));
echo $OUTPUT->help_icon('exclusivity', 'simplescheduler', get_string('groupsession', 'simplescheduler'));
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('location', 'simplescheduler') ?>:</b></td>
<td align="left">
<input type="text" size="30" maxlength="50" name="appointmentlocation" value="<?php echo $form->appointmentlocation ?>" />
<?php echo $OUTPUT->help_icon('location', 'simplescheduler'); ?>
</td>
</tr>
<?php
if (has_capability('mod/simplescheduler:canscheduletootherteachers', $context)){
?>
<tr valign="top">
<td align="right"><b><?php p(simplescheduler_get_teacher_name($simplescheduler)); ?>:</b></td>
<td align="left" <?php print_error_class(@$errors, 'teacherid') ?> >
<?php
$attendants = simplescheduler_get_attendants($cm->id);
$attendantsmenu = array();
if ($attendants){
foreach($attendants as $attendant){
$attendantsmenu[$attendant->id] = fullname($attendant);
}
echo html_writer::select($attendantsmenu, 'teacherid', $form->teacherid);
} else {
print_string('noteachershere', 'simplescheduler', s(simplescheduler_get_teacher_name($simplescheduler)));
}
echo $OUTPUT->help_icon('bookwithteacher', 'simplescheduler');
?>
</td>
</tr>
<?php
}
?>
<tr valign="top">
<td align="right"><b><?php print_string('displayfrom', 'simplescheduler') ?>:</b></td>
<td align="left">
<?php
echo html_writer::select_time('days', 'displayday', $form->hideuntil);
echo html_writer::select_time('months', 'displaymonth', $form->hideuntil);
echo html_writer::select_time('years', 'displayyear', $form->hideuntil);
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('comments', 'simplescheduler') ?>:</b></td>
<td align="left">
<?php
if (!isset($form->notes)) {
$form->notes = '';
}
print_textarea($usehtmleditor, 20, 60, 680, 400, 'notes', $form->notes);
if ($usehtmleditor) {
echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
} else {
echo '<p align="right">';
echo $OUTPUT->help_icon('textformat', get_string('formattexttype'));
print_string('formattexttype');
echo ': ';
if (!$form->format) {
$form->format = 'MOODLE';
}
echo html_writer::select(format_text_menu(), 'format', $form->format);
echo '</p>';
}
?>
</td>
</tr>
<tr>
<td colspan="2">
<?php
echo $OUTPUT->box_start(get_string('appointments', 'simplescheduler'), 'center');
echo $OUTPUT->box_end();
?>
</td>
</tr>
</table>
<input type="submit" value="<?php print_string('save', 'simplescheduler') ?>" />
<input type="button" value="<?php print_string('cancel') ?>" onclick="self.location.href='view.php?id=<?php echo $cm->id?>'" />
</center>
</form>