-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmit_page.php
155 lines (138 loc) · 5.78 KB
/
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
149
150
151
152
153
154
<?php
//
// submit用のページを生成
//
//print the items
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
{
echo '<form action="submit.php" method="post" onsubmit=" ">';
//echo '<fieldset>'; // for mobile viewer
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
$params = array('apply_id' => $apply->id, 'required' => 1);
$countreq = $DB->count_records('apply_item', $params);
if ($countreq>0) {
echo '<span class="apply_required_mark">(*)';
echo get_string('items_are_required', 'apply');
echo '</span>';
}
//
echo $OUTPUT->box_start('generalbox');
{
unset($start_item);
$select = 'apply_id=? AND hasvalue=1 AND position<?';
$params = array($apply->id, $start_position);
$last_break_position = 0;
foreach ($items as $item) {
//
if (!isset($start_item)) {
if ($item->typ=='pagebreak') continue;
$start_item = $item;
}
if ($item->dependitem>0) {
$compare_value = apply_compare_item_value($submit_id, $item->dependitem, $item->dependvalue);
if (!isset($submit_id) OR !$compare_value) {
$last_item = $item;
$last_break_position = $item->position;
continue;
}
}
// restore value
$value = '';
$frmvaluename = $item->typ.'_'.$item->id;
if (isset($save_return)) {
if (isset($formdata->{$frmvaluename})) {
$value = $formdata->{$frmvaluename};
$value = apply_clean_input_value($item, $value);
}
else {
//$value = apply_get_item_value($submit_id, $item->id, 0); // from draft
$value = apply_get_item_value($submit_id, $item->id, $submit_ver);
}
}
else {
if (isset($submit)) {
$value = apply_get_item_value($submit_id, $item->id, $submit_ver);
}
}
//
$last_break_position = $item->position; //last item-pos (item or pagebreak)
if ($item->typ!='pagebreak') {
if ($item->label!=APPLY_ADMIN_REPLY_TAG and $item->label!=APPLY_ADMIN_ONLY_TAG and $item->typ!='fixedtitle') {
apply_print_line_space();
echo $OUTPUT->box_start('apply_print_item');
apply_print_item_submit($item, $value, $highlightrequired);
echo $OUTPUT->box_end();
}
$last_item = $item;
}
else {
break;
}
}
if ($Table_in) { // テーブルはまだ閉じられていない.
echo $OUTPUT->box_start('apply_print_item');
apply_close_table_tag();
echo $OUTPUT->box_end();
//echo '<div style="color:#c00000">['.get_string('not_close_table','apply').']</div>';
}
}
echo $OUTPUT->box_end();
//
echo '<input type="hidden" name="id" value="'.$id.'" />';
echo '<input type="hidden" name="apply_id" value="'.$apply->id.'" />';
echo '<input type="hidden" name="last_page" value="'.$go_page.'" />';
//
echo '<input type="hidden" name="submit_id" value="'.$submit_id.'" />';
echo '<input type="hidden" name="submit_ver" value="'.$submit_ver.'" />';
echo '<input type="hidden" name="courseid" value="'.$courseid.'" />';
echo '<input type="hidden" name="prev_values" value="1" />';
if (isset($start_item)) {
echo '<input type="hidden" name="start_itempos" value="'.$start_item->position.'" />';
echo '<input type="hidden" name="last_itempos" value="'.$last_item->position.'" />';
}
// Button
echo '<br />';
// Previus and Next Button
if ($is_pagebreak and $last_break_position>$first_pagebreak->position) {
$input_value = 'value="'.get_string('previous_page_button', 'apply').'"';
echo '<input name="go_prev_page" type="submit" '.$input_value.' />';
echo ' ';
}
if ($last_break_position<$max_item_count) {
$input_value = 'value="'.get_string('next_page_button', 'apply').'"';
echo '<input name="go_next_page" type="submit" '.$input_value.' />';
echo ' ';
}
if (($is_pagebreak and $last_break_position>$first_pagebreak->position) or $last_break_position<$max_item_count) {
echo '<br /><br />';
}
//
//if ($last_break_position>=$max_item_count) { //last page
$input_value = 'value="'.get_string('save_entry_button', 'apply').'"';
echo '<input name="save_values" type="submit" '.$input_value.' />';
echo ' ';
//echo ' ';
$input_value = 'value="'.get_string('save_draft_button', 'apply').'"';
echo '<input name="save_draft" type="submit" '.$input_value.' />';
echo ' ';
//
echo '<input type="reset" value="'.get_string('clear').'" />';
//echo '</fieldset>'; // for mobile viewer
echo '</form>';
//
//
echo '<br />';
echo $OUTPUT->box_start('apply_submit_cancel');
{
$action = 'action="'.$CFG->wwwroot.'/mod/apply/view.php?id='.$id.'"';
echo '<form '.$action.' method="post" onsubmit=" ">';
echo '<fieldset>';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<input type="hidden" name="courseid" value="'. $courseid . '" />';
echo '<button type="submit">'.get_string('back_button', 'apply').'</button>';
echo '</fieldset>';
echo '</form>';
}
echo $OUTPUT->box_end();
}
echo $OUTPUT->box_end();