-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoperate_submit_page.php
149 lines (126 loc) · 5.18 KB
/
operate_submit_page.php
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
<?php
// needs $submit, $items, $name_pattern, $user
require_once('jbxl/jbxl_moodle_tools.php');
if ($submit) {
//
echo '<form action="operate_submit.php" method="post">';
//echo '<fieldset>';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<input type="hidden" name="operate" value="operate" />';
//
$align = right_to_left() ? 'right' : 'left';
$student = $DB->get_record('user', array('id'=>$submit->user_id));
$user_name = jbxl_get_user_name($student, $name_pattern);
$title = $user_name.' ('.userdate($submit->time_modified, '%Y/%m/%d %H:%M').')';
if ($submit_ver==0) $title .= ' '.get_string('title_draft','apply');
echo '<div align="center">';
echo $OUTPUT->heading($title, 3);
echo '</div>';
//echo '<br />';
//
if ($err_message!='') {
echo $OUTPUT->box_start('mform error boxaligncenter boxwidthwide');
echo $err_message;
echo $OUTPUT->box_end();
}
//
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
foreach ($items as $item) {
//get the values
$params = array('submit_id'=>$submit->id, 'item_id'=>$item->id, 'version'=>$submit_ver);
$value = $DB->get_record('apply_value', $params);
echo $OUTPUT->box_start('apply_print_item');
if ($item->typ!='pagebreak' and $item->label!=APPLY_SUBMIT_ONLY_TAG
and $item->label!=APPLY_ADMIN_REPLY_TAG and $item->label!=APPLY_ADMIN_ONLY_TAG and $item->typ!='fixedtitle') {
apply_print_line_space();
if (isset($value->value)) {
apply_print_item_show_value($item, $value->value);
}
else {
apply_print_item_show_value($item, false);
}
}
else if ($item->label==APPLY_ADMIN_REPLY_TAG or $item->label==APPLY_ADMIN_ONLY_TAG and $item->typ!='fixedtitle') {
apply_print_line_space();
if (isset($value->value)) {
apply_print_item_submit($item, $value->value);
}
else {
apply_print_item_submit($item, false);
}
}
echo $OUTPUT->box_end();
}
require('entry_info.php');
echo $OUTPUT->box_end();
//
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
echo '<table border="0" class="operation_submit">';
if ($apply->email_notification_user) {
$email_str = get_string('email_entry', 'apply');
echo '<tr>';
echo '<td><input type="checkbox" name="send_email" value="1" /><strong> '.$email_str.'</strong></td>';
echo '<td> </td>';
echo '<td> </td>';
echo '</tr>';
}
$accept = '';
$reject = '';
if ($submit->acked==APPLY_ACKED_ACCEPT) $accept = 'checked';
else if ($submit->acked==APPLY_ACKED_REJECT) $reject = 'checked';
$accept_str = get_string('accept_entry', 'apply');
$reject_str = get_string('reject_entry', 'apply');
//
echo '<tr>';
echo '<td><input type="radio" name="radiobtn_accept" value="accept" '.$accept.'/><strong> '.$accept_str.'</strong></td>';
echo '<td> </td>';
echo '<td><input type="radio" name="radiobtn_accept" value="reject" '.$reject.'/><strong> '.$reject_str.'</strong></td>';
echo '</tr>';
if (!$apply->only_acked_accept) {
if ($submit->execd==APPLY_EXECD_DONE) $checked = 'checked';
else $checked = '';
$execd_str = get_string('execd_entry', 'apply');
echo '<tr>';
echo '<td><input type="checkbox" name="checkbox_execd" value="execd" '.$checked.'/><strong> '.$execd_str.'</strong></td>';
echo '<td> </td>';
echo '<td> </td>';
echo '</tr>';
}
echo '</table>';
echo $OUTPUT->box_end();
//
$submit_value = 'value="'.get_string('operate_submit_button', 'apply').'"';
$back_value = 'value="'.get_string('back_button', 'apply').'"';
$reset_value = 'value="'.get_string('clear').'"';
$submit_button = '<input name="operate_values" type="submit" '.$submit_value.' />';
$back_button = '<input name="back_to_entries" type="submit" '.$back_value.' />';
$reset_button = '<input type="reset" '.$reset_value.' />';
//
echo '<input type="hidden" name="id" value="'.$cm->id.'" />';
echo '<input type="hidden" name="submit_id" value="'.$submit->id.'" />';
echo '<input type="hidden" name="submit_ver" value="'.$submit->version.'" />';
//
echo '<br />';
echo '<div align="center">';
echo '<table border="0">';
echo '<tr>';
echo '<td>'.$submit_button.'</td>';
echo '<td> </td>';
echo '<td>'.$reset_button.'</td>';
echo '<td> </td>';
echo '<td>'.$back_button.'</td>';
echo '</tr>';
echo '</table>';
echo '</div>';
//echo '</fieldset>';
echo '</form>';
}
//
else {
$back_button = $OUTPUT->single_button($back_url, get_string('back_button', 'apply'));
//
echo '<div align="center">';
echo $OUTPUT->heading(get_string('no_submit_data', 'apply'), 3);
echo $back_button;
echo '</div>';
}