-
Notifications
You must be signed in to change notification settings - Fork 0
/
entry_button.php
74 lines (69 loc) · 2.78 KB
/
entry_button.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
<?php
// needs $submit, $items, $name_pattern, $user
$back_button = $OUTPUT->single_button($back_url->out(), get_string('back_button', 'apply'));
if ($req_own_data and $submit->class!=APPLY_CLASS_CANCEL) {
if ($submit->acked==APPLY_ACKED_ACCEPT) {
// Update
$change_label = get_string('update_entry_button', 'apply');
$change_params = array('id'=>$id, 'submit_id'=>$submit->id, 'submit_ver'=>$submit_ver, 'courseid'=>$courseid, 'go_page'=>0);
$change_action = 'submit.php';
// Discard
if ($apply->can_discard) {
$discard_label = get_string('cancel_entry_button', 'apply');
$discard_params = array('id'=>$id, 'submit_id'=>$submit->id);
$discard_action = 'delete_submit.php';
}
}
else {
// Edit
$change_label = get_string('edit_entry_button', 'apply');
$change_params = array('id'=>$id, 'submit_id'=>$submit->id, 'submit_ver'=>$submit_ver, 'courseid'=>$courseid, 'go_page'=>0);
$change_action = 'submit.php';
// Discard
if ($apply->can_discard) {
$discard_label = get_string('delete_entry_button', 'apply');
$discard_params = array('id'=>$id, 'submit_id'=>$submit->id, 'acked'=>$submit->acked);
$discard_action = 'delete_submit.php';
}
}
//
$change_url = new moodle_url($CFG->wwwroot.'/mod/apply/'.$change_action, $change_params);
if ($apply->can_discard) $discard_url = new moodle_url($CFG->wwwroot.'/mod/apply/'.$discard_action, $discard_params);
//
echo '<div align="center">';
echo '<table border="0">';
echo '<tr>';
echo '<td>'.$back_button.'</td>';
echo '<td> </td>';
echo '<td>'.$OUTPUT->single_button($change_url, $change_label). '</td>';
//
if ($submit->version==$submit_ver) {
echo '<td> </td>';
if ($apply->can_discard) echo '<td>'.$OUTPUT->single_button($discard_url, $discard_label).'</td>';
}
echo '</tr>';
echo '</table>';
echo '</div>';
}
else {
echo '<div align="center">';
//
if (!$req_own_data and $submit->version==$submit_ver) {
$operate_params = array('id'=>$id, 'submit_id'=>$submit->id, 'submit_ver'=>$submit->version, 'courseid'=>$courseid);
$operate_label = get_string('operate_submit', 'apply');
$operate_url = new moodle_url($CFG->wwwroot.'/mod/apply/operate_submit.php', $operate_params);
//
echo '<table border="0">';
echo '<tr>';
echo '<td>'.$back_button.'</td>';
echo '<td> </td>';
echo '<td>'.$OUTPUT->single_button($operate_url, $operate_label). '</td>';
echo '</tr>';
echo '</table>';
}
else {
echo $back_button;
}
//
echo '</div>';
}