-
Notifications
You must be signed in to change notification settings - Fork 0
/
entry_header.php
180 lines (158 loc) · 6.56 KB
/
entry_header.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
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
<?php
// needs $req_own_data, $table, $courseid, $show_all, ....
$title_ttl = get_string('title_title', 'apply');
$title_date = get_string('date');
$title_ver = get_string('title_version','apply');
$title_clss = get_string('title_class', 'apply');
$title_ack = get_string('title_ack', 'apply');
$title_exec = get_string('title_exec', 'apply');
$title_chk = get_string('title_check', 'apply');
$title_bfr = get_string('title_before', 'apply');
//
if ($req_own_data) {
$title_draft = get_string('title_draft', 'apply');
$table_columns = array('title', 'time_modified', 'version', 'class', 'draft', 'acked');
$table_headers = array($title_ttl, $title_date, $title_ver, $title_clss, $title_draft, $title_ack);
$table_widths = array('240px', '$120px', '30px', '40px', '60px', '60px');
if (!$apply->only_acked_accept) {
$table_columns = array_merge($table_columns, array('execd'));
$table_headers = array_merge($table_headers, array($title_exec));
$table_widths = array_merge($table_widths, array('60px'));
}
$table_columns = array_merge($table_columns, array('before', 'edit'));
$table_headers = array_merge($table_headers, array($title_bfr, '-'));
$table_widths = array_merge($table_widths, array('120x', ''));
if ($apply->can_discard) {
$table_columns = array_merge($table_columns, array('discard'));
$table_headers = array_merge($table_headers, array('-'));
$table_widths = array_merge($table_widths, array(''));
}
}
else {
$user_pic = get_string('user_pic', 'apply');
$table_columns = array('userpic');
$table_headers = array($user_pic);
$table_widths = array('24px');
if ($name_pattern=='firstname') {
$table_columns = array_merge($table_columns, array('firstname'));
$table_headers = array_merge($table_headers, array(get_string('firstname')));
$table_widths = array_merge($table_widths, array('100px'));
}
else if ($name_pattern=='lastname') {
$table_columns = array_merge($table_columns, array('lastname'));
$table_headers = array_merge($table_headers, array(get_string('lastname')));
$table_widths = array_merge($table_widths, array('100px'));
}
else if ($name_pattern=='firstlastname') {
$table_columns = array_merge($table_columns, array('firstname', 'lastname'));
$table_headers = array_merge($table_headers, array(get_string('firstname'), get_string('lastname')));
$table_widths = array_merge($table_widths, array('80px', '100px'));
}
else if ($name_pattern=='lastfirstname') {
$table_columns = array_merge($table_columns, array('lastname', 'firstname'));
$table_headers = array_merge($table_headers, array(get_string('lastname'), get_string('firstname')));
$table_widths = array_merge($table_widths, array('80px', '100px'));
}
else {
$table_columns = array_merge($table_columns, array('fullname'));
$table_headers = array_merge($table_headers, array(get_string('fullname')));
$table_widths = array_merge($table_widths, array('100px'));
}
$table_columns = array_merge($table_columns, array('title', 'time_modified', 'version', 'class', 'acked'));
$table_headers = array_merge($table_headers, array($title_ttl, $title_date, $title_ver, $title_clss, $title_ack));
$table_widths = array_merge($table_widths, array('240px', '120px', '30px', '40px', '60px'));
if (!$apply->only_acked_accept) {
$table_columns = array_merge($table_columns, array('execd'));
$table_headers = array_merge($table_headers, array($title_exec));
$table_widths = array_merge($table_widths, array('60px'));
}
$table_columns = array_merge($table_columns, array('before', 'operation'));
$table_headers = array_merge($table_headers, array($title_bfr, '-'));
$table_widths = array_merge($table_widths, array('120px', ''));
if ($apply->enable_deletemode) {
$table_columns = array_merge($table_columns, array('delete'));
$table_headers = array_merge($table_headers, array('-'));
$table_widths = array_merge($table_widths, array(''));
}
}
//
$table->define_columns($table_columns);
$table->define_headers($table_headers);
$table->define_baseurl($base_url);
// set width
$num = 0;
foreach ($table_columns as $column) {
$table->column_style[$column]['width'] = $table_widths[$num];
$num++;
}
//
if ($req_own_data) {
$table->sortable(true, 'time_modified', SORT_DESC);
$table->no_sorting('lastname');
$table->no_sorting('firstname');
$table->no_sorting('edit');
$table->no_sorting('draft');
$table->no_sorting('before');
if ($apply->can_discard) $table->no_sorting('discard');
}
else {
$table->sortable(true, 'time_modified', SORT_DESC);
//
if ($name_pattern=='lastname') {
$table->sortable(true, 'lastname', SORT_ASC);
$table->no_sorting('firstname');
}
else if ($name_pattern=='firstname') {
$table->sortable(true, 'firstname', SORT_ASC);
$table->no_sorting('lastname');
}
else {
$table->sortable(true, 'firstname', SORT_ASC);
$table->sortable(true, 'lastname', SORT_ASC);
}
$table->no_sorting('before');
$table->no_sorting('operation');
if ($apply->enable_deletemode) $table->no_sorting('delete');
}
//
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'show_entrytable');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter');
/*
$table->set_control_variables(array(
TABLE_VAR_SORT => 'ssort',
TABLE_VAR_IFIRST=> 'sifirst',
TABLE_VAR_ILAST => 'silast',
TABLE_VAR_PAGE => 'spage'
));
*/
$table->setup();
//
if (!$sort) {
$sort = $table->get_sql_sort();
if (!$sort) $sort = '';
}
list($where, $params) = $table->get_sql_where();
if ($where) $where .= ' AND ';
//
$sifirst = optional_param('sifirst', '', PARAM_ALPHA);
if ($sifirst) {
$where .= "firstname LIKE :sifirst ESCAPE '\\\\' AND ";
$params['sifirst'] = $sifirst.'%';
}
$silast = optional_param('silast', '', PARAM_ALPHA);
if ($silast) {
$where .= "lastname LIKE :silast ESCAPE '\\\\' AND ";
$params['silast'] = $silast.'%';
}
//
//$table->initialbars(true); // フィルター用イニシャルのテーブル
if ($show_all) {
$start_page = false;
$page_count = false;
}
else {
$table->pagesize($perpage, $matchcount);
$start_page = $table->get_page_start();
$page_count = $table->get_page_size();
}