PluginProbe
Welcart e-Commerce / 2.12.4
Welcart e-Commerce v2.12.4
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
← All changes | classes/orderList.class.php +864 -620 1.3.162.12.4 View file →
@@ -1,620 +1,864 @@
1 -<?php
2 -class dataList
3 -{
4 - var $table; //テーブル名
5 - var $rows; //データ
6 - var $action; //アクション
7 - var $startRow; //表示開始行番号
8 - var $maxRow; //最大表示行数
9 - var $currentPage; //現在のページNo
10 - var $firstPage; //最初のページNo
11 - var $previousPage; //前のページNo
12 - var $nextPage; //次のページNo
13 - var $lastPage; //最終ページNo
14 - var $naviMaxButton; //ページネーション・ナビのボタンの数
15 - var $dataTableNavigation; //ナヴィゲーションhtmlコード
16 - var $arr_period; //表示データ期間
17 - var $arr_search; //サーチ条件
18 - var $searchSql; //簡易絞込みSQL
19 - var $searchSwitchStatus; //サーチ表示スイッチ
20 - var $columns; //データカラム
21 - var $sortColumn; //現在ソート中のフィールド
22 - var $sortOldColumn;
23 - var $sortSwitchs; //各フィールド毎の昇順降順スイッチ
24 - var $userHeaderNames; //ユーザー指定のヘッダ名
25 - var $action_status, $action_message;
26 -//20101202ysk start
27 - var $pageLimit; //ページ制限
28 -//20101202ysk end
29 - var $management_status; //処理ステータス
30 - var $selectSql;
31 - var $joinTableSql;
32 -
33 - //Constructor
34 - function dataList($tableName, $arr_column)
35 - {
36 - $this->table = $tableName;
37 - $this->columns = $arr_column;
38 - $this->rows = array();
39 -
40 - $this->maxRow = 30;
41 - $this->naviMaxButton = 11;
42 - $this->firstPage = 1;
43 - $this->action_status = 'none';
44 - $this->action_message = '';
45 -//20101202ysk start
46 - $this->pageLimit = 'on';
47 -//20101202ysk end
48 - $this->selectSql = '';
49 - $this->joinTableSql = '';
50 -
51 - $this->SetParamByQuery();
52 -
53 - $arr_period = array(__('This month', 'usces'), __('Last month', 'usces'), __('The past one week', 'usces'), __('Last 30 days', 'usces'), __('Last 90days', 'usces'), __('All', 'usces'));
54 - $this->arr_period = apply_filters( 'usces_filter_order_list_arr_period', $arr_period, $this );
55 -
56 - $management_status = array(
57 - 'duringorder' => __('temporaly out of stock', 'usces'),
58 - 'cancel' => __('Cancel', 'usces'),
59 - 'completion' => __('It has sent it out.', 'usces'),
60 - 'estimate' => __('An estimate', 'usces'),
61 - 'adminorder' => __('Management of Note', 'usces'),
62 - 'continuation' => __('Continuation', 'usces'),
63 - 'termination' => __('Termination', 'usces')
64 - );
65 - $this->management_status = apply_filters( 'usces_filter_management_status', $management_status, $this );
66 -
67 - $this->SetSelects();
68 - $this->SetJoinTables();
69 - }
70 -
71 - function SetSelects()
72 - {
73 - $status_sql = '';
74 - foreach( $this->management_status as $status_key => $status_name ) {
75 - $status_sql .= " WHEN LOCATE('".$status_key."', order_status) > 0 THEN '".$status_name."'";
76 - }
77 -
78 - $select = array(
79 - "ID",
80 - "meta.meta_value AS deco_id",
81 - "DATE_FORMAT(order_date, '%Y-%m-%d %H:%i') AS date",
82 - "mem_id",
83 - "CONCAT(order_name1, ' ', order_name2) AS name",
84 - "order_pref AS pref",
85 - "order_delivery_method AS delivery_method",
86 - "(order_item_total_price - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax) AS total_price",
87 - "order_payment_name AS payment_name",
88 - "CASE WHEN LOCATE('noreceipt', order_status) > 0 THEN '".__('unpaid', 'usces')."'
89 - WHEN LOCATE('receipted', order_status) > 0 THEN '".__('payment confirmed', 'usces')."'
90 - WHEN LOCATE('pending', order_status) > 0 THEN '".__('Pending', 'usces')."'
91 - ELSE '&nbsp;'
92 - END AS receipt_status",
93 - "CASE {$status_sql}
94 - ELSE '".__('new order', 'usces')."'
95 - END AS order_status",
96 - "order_modified"
97 - );
98 - $this->selectSql = apply_filters( 'usces_filter_order_list_sql_select', $select, $status_sql, $this );
99 - }
100 -
101 - function SetJoinTables()
102 - {
103 - global $wpdb;
104 - $meta_table = $wpdb->prefix.'usces_order_meta';
105 - $join_table = array(
106 - "LEFT JOIN {$meta_table} AS meta ON ID = meta.order_id AND meta.meta_key = 'dec_order_id'"
107 - );
108 - $this->joinTableSql = apply_filters( 'usces_filter_order_list_sql_jointable', $join_table, $meta_table, $this );
109 - }
110 -
111 - function MakeTable()
112 - {
113 - $this->SetParam();
114 -
115 - switch ($this->action){
116 -
117 - case 'searchIn':
118 - $this->SearchIn();
119 - //$this->SetSelectedRow();
120 - $res = $this->GetRows();
121 - break;
122 -
123 - case 'searchOut':
124 - $this->SearchOut();
125 - //$this->SetSelectedRow();
126 - $res = $this->GetRows();
127 - break;
128 -
129 - case 'changeSort':
130 - $res = $this->GetRows();
131 - break;
132 -
133 - case 'changePage':
134 - $res = $this->GetRows();
135 - break;
136 -
137 - case 'collective_order_reciept':
138 - usces_all_change_order_reciept($this);
139 - $res = $this->GetRows();
140 - break;
141 -
142 - case 'collective_order_status':
143 - usces_all_change_order_status($this);
144 - $res = $this->GetRows();
145 - break;
146 -
147 - case 'collective_delete':
148 - usces_all_delete_order_data($this);
149 - $this->SetTotalRow();
150 - $res = $this->GetRows();
151 - break;
152 -
153 - case 'refresh':
154 - default:
155 - $this->SetDefaultParam();
156 - $res = $this->GetRows();
157 - break;
158 - }
159 -
160 - $this->SetNavi();
161 - $this->SetHeaders();
162 - $this->SetSESSION();
163 -
164 - if($res){
165 -
166 - return TRUE;
167 -
168 - }else{
169 - return FALSE;
170 - }
171 - }
172 -
173 - //DefaultParam
174 - function SetDefaultParam()
175 - {
176 - unset($_SESSION[$this->table]);
177 - $this->startRow = 0;
178 - $this->currentPage = 1;
179 - if(isset($_SESSION[$this->table]['arr_search'])){
180 - $this->arr_search = $_SESSION[$this->table]['arr_search'];
181 - }else{
182 - $arr_search = array( 'period'=>'3', 'column'=>'', 'word'=>'' );
183 - $this->arr_search = apply_filters( 'usces_filter_order_list_arr_search', $arr_search, $this );
184 - }
185 - if(isset($_SESSION[$this->table]['searchSwitchStatus'])){
186 - $this->searchSwitchStatus = $_SESSION[$this->table]['searchSwitchStatus'];
187 - }else{
188 - $this->searchSwitchStatus = 'OFF';
189 - }
190 - $this->searchSql = '';
191 - $this->sortColumn = 'ID';
192 - foreach($this->columns as $value ){
193 - $this->sortSwitchs[$value] = 'DESC';
194 - }
195 -
196 - $this->SetTotalRow();
197 - //$this->SetSelectedRow();
198 - }
199 -
200 - function SetParam()
201 - {
202 - $this->startRow = ($this->currentPage-1) * $this->maxRow;
203 - }
204 -
205 - function SetParamByQuery()
206 - {
207 - if(isset($_REQUEST['changePage'])){
208 -
209 - $this->action = 'changePage';
210 - $this->currentPage = $_REQUEST['changePage'];
211 - $this->sortColumn = $_SESSION[$this->table]['sortColumn'];
212 - $this->sortSwitchs = $_SESSION[$this->table]['sortSwitchs'];
213 - $this->userHeaderNames = $_SESSION[$this->table]['userHeaderNames'];
214 - $this->searchSwitchStatus = $_SESSION[$this->table]['searchSwitchStatus'];
215 - $this->searchSql = $_SESSION[$this->table]['searchSql'];
216 - $this->arr_search = $_SESSION[$this->table]['arr_search'];
217 - $this->totalRow = $_SESSION[$this->table]['totalRow'];
218 - $this->selectedRow = $_SESSION[$this->table]['selectedRow'];
219 -
220 - }else if(isset($_REQUEST['changeSort'])){
221 -
222 - $this->action = 'changeSort';
223 - $this->sortOldColumn = $this->sortColumn;
224 - $this->sortColumn = $_REQUEST['changeSort'];
225 - $this->sortSwitchs = $_SESSION[$this->table]['sortSwitchs'];
226 - $this->sortSwitchs[$this->sortColumn] = $_REQUEST['switch'];
227 - $this->currentPage = $_SESSION[$this->table]['currentPage'];
228 - $this->userHeaderNames = $_SESSION[$this->table]['userHeaderNames'];
229 - $this->searchSql = $_SESSION[$this->table]['searchSql'];
230 - $this->arr_search = $_SESSION[$this->table]['arr_search'];
231 - $this->searchSwitchStatus = $_SESSION[$this->table]['searchSwitchStatus'];
232 - $this->totalRow = $_SESSION[$this->table]['totalRow'];
233 - $this->selectedRow = $_SESSION[$this->table]['selectedRow'];
234 -
235 - } else if(isset($_REQUEST['searchIn'])){
236 -
237 - $this->action = 'searchIn';
238 - $this->arr_search['column'] = isset($_REQUEST['search']['column']) ? $_REQUEST['search']['column'] : '';
239 - $this->arr_search['word'] = isset($_REQUEST['search']['word']) ? $_REQUEST['search']['word'] : '';
240 - $this->arr_search['period'] = isset($_REQUEST['search']['period']) ? (int)$_REQUEST['search']['period'] : 0;
241 - $this->searchSwitchStatus = isset($_REQUEST['searchSwitchStatus']) ? $_REQUEST['searchSwitchStatus'] : '';
242 - $this->currentPage = 1;
243 - $this->sortColumn = $_SESSION[$this->table]['sortColumn'];
244 - $this->sortSwitchs = $_SESSION[$this->table]['sortSwitchs'];
245 - $this->userHeaderNames = $_SESSION[$this->table]['userHeaderNames'];
246 - $this->totalRow = $_SESSION[$this->table]['totalRow'];
247 -
248 - }else if(isset($_REQUEST['searchOut'])){
249 -
250 - $this->action = 'searchOut';
251 - $this->arr_search['column'] = '';
252 - $this->arr_search['word'] = '';
253 - $this->arr_search['period'] = $_SESSION[$this->table]['arr_search']['period'];
254 - $this->searchSwitchStatus = isset($_REQUEST['searchSwitchStatus']) ? $_REQUEST['searchSwitchStatus'] : '';
255 - $this->currentPage = 1;
256 - $this->sortColumn = $_SESSION[$this->table]['sortColumn'];
257 - $this->sortSwitchs = $_SESSION[$this->table]['sortSwitchs'];
258 - $this->userHeaderNames = $_SESSION[$this->table]['userHeaderNames'];
259 - $this->totalRow = $_SESSION[$this->table]['totalRow'];
260 -
261 - }else if(isset($_REQUEST['refresh'])){
262 -
263 - $this->action = 'refresh';
264 - $this->currentPage = $_SESSION[$this->table]['currentPage'];
265 - $this->sortColumn = $_SESSION[$this->table]['sortColumn'];
266 - $this->sortSwitchs = $_SESSION[$this->table]['sortSwitchs'];
267 - $this->userHeaderNames = $_SESSION[$this->table]['userHeaderNames'];
268 - $this->searchSql = $_SESSION[$this->table]['searchSql'];
269 - $this->arr_search = $_SESSION[$this->table]['arr_search'];
270 - $this->searchSwitchStatus = $_SESSION[$this->table]['searchSwitchStatus'];
271 - $this->totalRow = $_SESSION[$this->table]['totalRow'];
272 - $this->selectedRow = $_SESSION[$this->table]['selectedRow'];
273 -
274 - }else if(isset($_REQUEST['collective'])){
275 -
276 - $this->action = 'collective_' . $_POST['allchange']['column'];
277 - $this->currentPage = $_SESSION[$this->table]['currentPage'];
278 - $this->sortColumn = $_SESSION[$this->table]['sortColumn'];
279 - $this->sortSwitchs = $_SESSION[$this->table]['sortSwitchs'];
280 - $this->userHeaderNames = $_SESSION[$this->table]['userHeaderNames'];
281 - $this->searchSql = $_SESSION[$this->table]['searchSql'];
282 - $this->arr_search = $_SESSION[$this->table]['arr_search'];
283 - $this->searchSwitchStatus = $_SESSION[$this->table]['searchSwitchStatus'];
284 - $this->totalRow = $_SESSION[$this->table]['totalRow'];
285 - $this->selectedRow = $_SESSION[$this->table]['selectedRow'];
286 -
287 - }else{
288 -
289 - $this->action = 'default';
290 - }
291 - }
292 -
293 - //GetRows
294 - function GetRows()
295 - {
296 - global $wpdb;
297 - //$meta_table = $wpdb->prefix . 'usces_order_meta';
298 - $where = $this->GetWhere();
299 - $order = ' ORDER BY `' . $this->sortColumn . '` ' . $this->sortSwitchs[$this->sortColumn];
300 - $order = apply_filters( 'usces_filter_order_list_get_orderby', $order, $this );
301 - //$limit = ' LIMIT ' . $this->startRow . ', ' . $this->maxRow;
302 -
303 -/* $status_sql = '';
304 - foreach ($this->management_status as $status_key => $status_name){
305 - $status_sql .= " WHEN LOCATE('" . $status_key . "', order_status) > 0 THEN '" . $status_name . "'";
306 - }
307 -
308 - $query = $wpdb->prepare("SELECT ID, meta.meta_value AS deco_id, DATE_FORMAT(order_date, %s) AS date, mem_id,
309 - CONCAT(order_name1, ' ', order_name2) AS name, order_pref AS pref, order_delivery_method AS delivery_method,
310 - (order_item_total_price - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax) AS total_price,
311 - order_payment_name AS payment_name,
312 - CASE WHEN LOCATE('noreceipt', order_status) > 0 THEN %s
313 - WHEN LOCATE('receipted', order_status) > 0 THEN %s
314 - WHEN LOCATE('pending', order_status) > 0 THEN %s
315 - ELSE %s
316 - END AS receipt_status,
317 - CASE {$status_sql}
318 - ELSE %s
319 - END AS order_status,
320 - order_modified
321 - FROM {$this->table}
322 - LEFT JOIN {$meta_table} AS meta ON ID = meta.order_id AND meta.meta_key = 'dec_order_id' ",
323 - '%Y-%m-%d %H:%i', __('unpaid', 'usces'), __('payment confirmed', 'usces'), __('Pending', 'usces'), '&nbsp;', __('new order', 'usces'));
324 -
325 - $query .= $where . $order;// . $limit;
326 -*/
327 - $select = '';
328 - foreach( $this->selectSql as $value ) {
329 - $select .= $value.", ";
330 - }
331 - $select = rtrim( $select, ", " );
332 - $join_table = '';
333 - foreach( $this->joinTableSql as $value ) {
334 - $join_table .= $value." ";
335 - }
336 - $query = "SELECT ".$select." FROM {$this->table} ".$join_table.$where.$order;
337 - $query = apply_filters( 'usces_filter_order_list_get_rows', $query, $this);
338 - //var_dump($query);
339 - $wpdb->show_errors();
340 -
341 - $rows = $wpdb->get_results($query, ARRAY_A);
342 - $this->selectedRow = count($rows);
343 -//20101202ysk start
344 - if($this->pageLimit == 'off') {
345 - $this->rows = (array)$rows;
346 - } else {
347 -//20101202ysk end
348 - $this->rows = array_slice((array)$rows, $this->startRow, $this->maxRow);
349 -//20101202ysk start
350 - }
351 -//20101202ysk end
352 -
353 - return $this->rows;
354 - }
355 -
356 - function SetTotalRow()
357 - {
358 - global $wpdb;
359 - $query = "SELECT COUNT(ID) AS ct FROM {$this->table}".apply_filters( 'usces_filter_order_list_sql_where', '', $this );
360 - $query = apply_filters( 'usces_filter_order_list_set_total_row', $query, $this);
361 - $res = $wpdb->get_var($query);
362 - $this->totalRow = $res;
363 - }
364 -
365 -/* function SetSelectedRow()
366 - {
367 - global $wpdb;
368 - $where = $this->GetWhere();
369 - $query = $wpdb->prepare("SELECT ID, DATE_FORMAT(order_date, %s) AS date, mem_id,
370 - CONCAT(order_name1, ' ', order_name2) AS name, order_pref AS pref, order_delivery_method AS delivery_method,
371 - (order_item_total_price - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax) AS total_price,
372 - order_payment_name AS payment_name,
373 - CASE WHEN LOCATE('noreceipt', order_status) > 0 THEN %s
374 - WHEN LOCATE('receipted', order_status) > 0 THEN %s
375 - ELSE %s
376 - END AS receipt_status,
377 - CASE WHEN LOCATE('estimate', order_status) > 0 THEN %s
378 - WHEN LOCATE('adminorder', order_status) > 0 THEN %s
379 - WHEN LOCATE('duringorder', order_status) > 0 THEN %s
380 - WHEN LOCATE('cancel', order_status) > 0 THEN %s
381 - WHEN LOCATE('completion', order_status) > 0 THEN %s
382 - ELSE %s
383 - END AS order_status,
384 - order_modified
385 - FROM {$this->table}",
386 - '%Y-%m-%d %H:%i', '未', '済', '&nbsp;', '見積り', '管理受注', '取り寄せ中', 'キャンセル', '発送済', '新規受付');
387 -
388 - $query .= $where;
389 - $rows = $wpdb->get_results($query, ARRAY_A);
390 - $this->selectedRow = count($rows);
391 -
392 - }*/
393 -
394 - function GetWhere()
395 - {
396 - $str = '';
397 - $thismonth = date('Y-m-01 00:00:00');
398 - $lastmonth = date('Y-m-01 00:00:00', mktime(0, 0, 0, date('m')-1, 1, date('Y')));
399 - $lastweek = date('Y-m-d 00:00:00', mktime(0, 0, 0, date('m'), date('d')-7, date('Y')));
400 - $last30 = date('Y-m-d 00:00:00', mktime(0, 0, 0, date('m'), date('d')-30, date('Y')));
401 - $last90 = date('Y-m-d 00:00:00', mktime(0, 0, 0, date('m'), date('d')-90, date('Y')));
402 - switch ( $this->arr_search['period'] ) {
403 - case 0:
404 - $str = " WHERE order_date >= '{$thismonth}'";
405 - break;
406 - case 1:
407 - $str = " WHERE order_date >= '{$lastmonth}' AND order_date < '{$thismonth}'";
408 - break;
409 - case 2:
410 - $str = " WHERE order_date >= '{$lastweek}'";
411 - break;
412 - case 3:
413 - $str = " WHERE order_date >= '{$last30}'";
414 - break;
415 - case 4:
416 - $str = " WHERE order_date >= '{$last90}'";
417 - break;
418 - case 5:
419 - $str = "";
420 - break;
421 - }
422 - $str = apply_filters( 'usces_filter_order_list_sql_where', $str, $this );
423 - if( WCUtils::is_blank($str) && !WCUtils::is_blank($this->searchSql) ){
424 - $str = ' HAVING ' . $this->searchSql;
425 - }else if($str != '' && $this->searchSql != ''){
426 - $str .= ' HAVING ' . $this->searchSql;
427 - }
428 - return apply_filters( 'usces_filter_order_list_get_where', $str, $this );
429 - }
430 -
431 - function SearchIn()
432 - {
433 - switch ($this->arr_search['column']) {
434 - case 'ID':
435 - $column = 'ID';
436 - $this->searchSql = $column . ' = ' . (int)$this->arr_search['word']['ID'];
437 - break;
438 - case 'deco_id':
439 - $column = 'deco_id';
440 - $this->searchSql = $column . ' LIKE '."'%" . esc_sql($this->arr_search['word']['deco_id']) . "%'";
441 - break;
442 - case 'date':
443 - $column = 'date';
444 - $this->searchSql = $column . ' LIKE '."'%" . esc_sql($this->arr_search['word']['date']) . "%'";
445 - break;
446 - case 'mem_id':
447 - $column = 'mem_id';
448 - $this->searchSql = $column . ' = ' . (int)$this->arr_search['word']['mem_id'];
449 - break;
450 - case 'name':
451 - $column = 'name';
452 - $this->searchSql = $column . ' LIKE '."'%" . esc_sql($this->arr_search['word']['name']) . "%'";
453 - break;
454 - case 'order_modified':
455 - $column = 'order_modified';
456 - $this->searchSql = $column . ' LIKE '."'%" . esc_sql($this->arr_search['word']['order_modified']) . "%'";
457 - break;
458 - case 'pref':
459 - $column = 'pref';
460 - $this->searchSql = $column . " = '" . esc_sql($this->arr_search['word']['pref']) . "'";
461 - break;
462 - case 'delivery_method':
463 - $column = 'delivery_method';
464 - $this->searchSql = $column . " = '" . esc_sql($this->arr_search['word']['delivery_method']) . "'";
465 - break;
466 - case 'payment_name':
467 - $column = 'payment_name';
468 - $this->searchSql = $column . " = '" . esc_sql($this->arr_search['word']['payment_name']) . "'";
469 - break;
470 - case 'receipt_status':
471 - $column = 'receipt_status';
472 - $this->searchSql = $column . " = '" . esc_sql($this->arr_search['word']['receipt_status']) . "'";
473 - break;
474 - case 'order_status':
475 - $column = 'order_status';
476 - $this->searchSql = $column . " = '" . esc_sql($this->arr_search['word']['order_status']) . "'";
477 - break;
478 - }
479 - }
480 -
481 - function SearchOut()
482 - {
483 - $this->searchSql = '';
484 - }
485 -
486 - function SetNavi()
487 - {
488 - $this->lastPage = ceil($this->selectedRow / $this->maxRow);
489 - $this->previousPage = ($this->currentPage - 1 == 0) ? 1 : $this->currentPage - 1;
490 - $this->nextPage = ($this->currentPage + 1 > $this->lastPage) ? $this->lastPage : $this->currentPage + 1;
491 -
492 - for($i=0; $i<$this->naviMaxButton; $i++){
493 - if($i > $this->lastPage-1) break;
494 - if($this->lastPage <= $this->naviMaxButton) {
495 - $box[] = $i+1;
496 - }else{
497 - if($this->currentPage <= 6) {
498 - $label = $i + 1;
499 - $box[] = $label;
500 - }else{
501 - $label = $i + 1 + $this->currentPage - 6;
502 - $box[] = $label;
503 - if($label == $this->lastPage) break;
504 - }
505 - }
506 - }
507 -
508 - $html = '';
509 - $html .= '<ul class="clearfix">'."\n";
510 - $html .= '<li class="rowsnum">' . $this->selectedRow . ' / ' . $this->totalRow . ' ' . __('cases', 'usces') . '</li>' . "\n";
511 - if(($this->currentPage == 1) || ($this->selectedRow == 0)){
512 - $html .= '<li class="navigationStr">first&lt;&lt;</li>' . "\n";
513 - $html .= '<li class="navigationStr">prev&lt;</li>'."\n";
514 - }else{
515 - $html .= '<li class="navigationStr"><a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changePage=1">first&lt;&lt;</a></li>' . "\n";
516 - $html .= '<li class="navigationStr"><a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changePage=' . $this->previousPage . '">prev&lt;</a></li>'."\n";
517 - }
518 - if($this->selectedRow > 0) {
519 - for($i=0; $i<count($box); $i++){
520 - if($box[$i] == $this->currentPage){
521 - $html .= '<li class="navigationButtonSelected">' . $box[$i] . '</li>'."\n";
522 - }else{
523 - $html .= '<li class="navigationButton"><a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changePage=' . $box[$i] . '">' . $box[$i] . '</a></li>'."\n";
524 - }
525 - }
526 - }
527 - if(($this->currentPage == $this->lastPage) || ($this->selectedRow == 0)){
528 - $html .= '<li class="navigationStr">&gt;next</li>'."\n";
529 - $html .= '<li class="navigationStr">&gt;&gt;last</li>'."\n";
530 - }else{
531 - $html .= '<li class="navigationStr"><a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changePage=' . $this->nextPage . '">&gt;next</a></li>'."\n";
532 - $html .= '<li class="navigationStr"><a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changePage=' . $this->lastPage . '">&gt;&gt;last</a></li>'."\n";
533 - }
534 - if($this->searchSwitchStatus == 'OFF'){
535 - $html .= '<li class="rowsnum"><a style="cursor:pointer;" id="searchVisiLink" onclick="toggleVisibility(\'searchBox\');">' . __('Show the Operation field', 'usces') . '</a>'."\n";
536 - }else{
537 - $html .= '<li class="rowsnum"><a style="cursor:pointer;" id="searchVisiLink" onclick="toggleVisibility(\'searchBox\');">' . __('hide the Operation field', 'usces') . '</a>'."\n";
538 - }
539 -
540 - $html .= '<li class="refresh"><a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&refresh">' . __('updates it to latest information', 'usces') . '</a></li>' . "\n";
541 - $html .= '</ul>'."\n";
542 -
543 - $this->dataTableNavigation = $html;
544 - }
545 -
546 - function SetSESSION()
547 - {
548 - $_SESSION[$this->table]['startRow'] = $this->startRow; //表示開始行番号
549 - $_SESSION[$this->table]['sortColumn'] = $this->sortColumn; //現在ソート中のフィールド
550 - $_SESSION[$this->table]['totalRow'] = $this->totalRow; //全行数
551 - $_SESSION[$this->table]['selectedRow'] = $this->selectedRow; //絞り込まれた行数
552 - $_SESSION[$this->table]['currentPage'] = $this->currentPage; //現在のページNo
553 - $_SESSION[$this->table]['previousPage'] = $this->previousPage; //前のページNo
554 - $_SESSION[$this->table]['nextPage'] = $this->nextPage; //次のページNo
555 - $_SESSION[$this->table]['lastPage'] = $this->lastPage; //最終ページNo
556 - $_SESSION[$this->table]['userHeaderNames'] = $this->userHeaderNames;//全てのフィールド
557 - $_SESSION[$this->table]['headers'] = $this->headers;//表示するヘッダ文字列
558 - $_SESSION[$this->table]['rows'] = $this->rows; //表示する行オブジェクト
559 - $_SESSION[$this->table]['sortSwitchs'] = $this->sortSwitchs; //各フィールド毎の昇順降順スイッチ
560 - $_SESSION[$this->table]['dataTableNavigation'] = $this->dataTableNavigation;
561 - $_SESSION[$this->table]['searchSql'] = $this->searchSql;
562 - $_SESSION[$this->table]['arr_search'] = $this->arr_search;
563 - $_SESSION[$this->table]['searchSwitchStatus'] = $this->searchSwitchStatus;
564 - do_action( 'usces_action_order_list_set_session', $this );
565 - }
566 -
567 - function SetHeaders()
568 - {
569 - foreach ($this->columns as $key => $value){
570 - if($value == $this->sortColumn){
571 - if($this->sortSwitchs[$value] == 'ASC'){
572 - $str = __('[ASC]', 'usces');
573 - $switch = 'DESC';
574 - }else{
575 - $str = __('[DESC]', 'usces');
576 - $switch = 'ASC';
577 - }
578 - $this->headers[$value] = '<a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changeSort=' . $value . '&switch=' . $switch . '"><span class="sortcolumn">' . $key . ' ' . $str . '</span></a>';
579 - }else{
580 - $switch = $this->sortSwitchs[$value];
581 - $this->headers[$value] = '<a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changeSort=' . $value . '&switch=' . $switch . '"><span>' . $key . '</span></a>';
582 - }
583 - }
584 - //$this->headers = array_keys($this->columns);
585 - }
586 -
587 - function GetSearchs()
588 - {
589 - return $this->arr_search;
590 - }
591 -
592 - function GetListheaders()
593 - {
594 - return $this->headers;
595 - }
596 -
597 - function GetDataTableNavigation()
598 - {
599 - return $this->dataTableNavigation;
600 - }
601 -
602 - function set_action_status($status, $message)
603 - {
604 - $this->action_status = $status;
605 - $this->action_message = $message;
606 - }
607 -
608 - function get_action_status()
609 - {
610 - return $this->action_status;
611 - }
612 -
613 - function get_action_message()
614 - {
615 - return $this->action_message;
616 - }
617 -}
618 -
619 -
620 -?>
1 +<?php
2 +/**
3 + * Order List Class.
4 + * - Old type.
5 + *
6 + * @package Welcart
7 + */
8 +class dataList {
9 + var $table; /* テーブル名 */
10 + var $rows; /* データ */
11 + var $action; /* アクション */
12 + var $startRow; /* 表示開始行番号 */
13 + var $maxRow; /* 最大表示行数 */
14 + var $currentPage; /* 現在のページNo */
15 + var $firstPage; /* 最初のページNo */
16 + var $previousPage; /* 前のページNo */
17 + var $nextPage; /* 次のページNo */
18 + var $lastPage; /* 最終ページNo */
19 + var $naviMaxButton; /* ページネーション・ナビのボタンの数 */
20 + var $dataTableNavigation; /* ナヴィゲーションhtmlコード */
21 + var $arr_period; /* 表示データ期間 */
22 + var $arr_search; /* サーチ条件 */
23 + var $searchSql; /* 簡易絞込みSQL */
24 + var $searchSkuSql; /* SKU絞り込み */
25 + var $searchSwitchStatus; /* サーチ表示スイッチ */
26 + var $columns; /* データカラム */
27 + var $sortColumn; /* 現在ソート中のフィールド */
28 + var $sortOldColumn;
29 + var $sortSwitchs; /* 各フィールド毎の昇順降順スイッチ */
30 + var $userHeaderNames; /* ユーザー指定のヘッダ名 */
31 + var $action_status, $action_message;
32 + var $pageLimit; /* ページ制限 */
33 + var $management_status; /* 処理ステータス */
34 + var $selectSql;
35 + var $joinTableSql;
36 + var $period_initial_index;
37 + var $period_specified_index;
38 + var $placeholder_escape;
39 + var $data_cookie;
40 + var $startdate;
41 + var $enddate;
42 +
43 + public $listOption;
44 + public $cookie_key;
45 + public $totalRow;
46 + public $selectedRow;
47 + public $headers;
48 +
49 + /**
50 + * Constructor.
51 + *
52 + * @param string $tableName Table name.
53 + * @param array $arr_column Column.
54 + */
55 + public function __construct( $tableName, $arr_column ) {
56 + global $wpdb;
57 + $this->table = $tableName;
58 + $this->columns = $arr_column;
59 + $this->rows = array();
60 +
61 + // 旧受注リストは新受注リスト(WlcOrderList)と同じ Cookie キーを共有すると, 検索条件やページング状態が
62 + // 混在して警告や表示崩れの原因になる. 受注リストのみ専用の Cookie キーを使い, 状態を完全に分離する.
63 + $this->cookie_key = ( $wpdb->prefix . 'usces_order' === $this->table ) ? $this->table . '_old' : $this->table;
64 +
65 + $this->maxRow = apply_filters( 'usces_filter_orderlist_maxrow', 30 );
66 + $this->naviMaxButton = 11;
67 + $this->firstPage = 1;
68 + $this->action_status = 'none';
69 + $this->action_message = '';
70 + $this->pageLimit = 'on';
71 + $this->selectSql = '';
72 + $this->joinTableSql = '';
73 +
74 + $this->period_initial_index = apply_filters( 'usces_filter_order_list_arr_period_initial_index', 3, $this );
75 + $this->period_specified_index = apply_filters( 'usces_filter_order_list_arr_period_specified_index', 6, $this );
76 +
77 + $this->getCookie();
78 + $this->SetDefaultParam();
79 + $this->SetParamByQuery();
80 + $this->validationSearchParameters();
81 +
82 + $arr_period = array(
83 + __( 'This month', 'usces' ),
84 + __( 'Last month', 'usces' ),
85 + __( 'The past one week', 'usces' ),
86 + __( 'Last 30 days', 'usces' ),
87 + __( 'Last 90days', 'usces' ),
88 + __( 'All', 'usces' ),
89 + __( 'Period specified', 'usces' ),
90 + );
91 + $this->arr_period = apply_filters( 'usces_filter_order_list_arr_period', $arr_period, $this );
92 +
93 + $management_status = array(
94 + 'duringorder' => __( 'temporaly out of stock', 'usces' ),
95 + 'cancel' => __( 'Cancel', 'usces' ),
96 + 'completion' => __( 'It has sent it out.', 'usces' ),
97 + 'estimate' => __( 'An estimate', 'usces' ),
98 + 'adminorder' => __( 'Management of Note', 'usces' ),
99 + 'continuation' => __( 'Continuation', 'usces' ),
100 + 'termination' => __( 'Termination', 'usces' ),
101 + );
102 + $this->management_status = apply_filters( 'usces_filter_management_status', $management_status, $this );
103 +
104 + $this->SetSelects();
105 + $this->SetJoinTables();
106 + }
107 +
108 + /**
109 + * Set Selects.
110 + */
111 + public function SetSelects() {
112 + global $wpdb;
113 +
114 + $status_sql = '';
115 + foreach ( $this->management_status as $status_key => $status_name ) {
116 + $status_sql .= $wpdb->prepare( " WHEN LOCATE( %s, order_status ) > 0 THEN %s", $status_key, $status_name );
117 + }
118 +
119 + if ( defined( 'WCEX_AUTO_DELIVERY' ) && version_compare( WCEX_AUTO_DELIVERY_VERSION, '1.4.0', '>=' ) ) {
120 + $select = array(
121 + "ID",
122 + "meta1.meta_value AS `deco_id`",
123 + "IFNULL( reg_id, meta2.meta_value ) AS `reg_id`",
124 + "DATE_FORMAT( order_date, '%Y-%m-%d %H:%i' ) AS `date`",
125 + "mem_id",
126 + "CONCAT( order_name1, ' ', order_name2 ) AS `name`",
127 + "order_pref AS `pref`",
128 + "order_delivery_method AS `delivery_method`",
129 + "( order_item_total_price - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax ) AS `total_price`",
130 + "order_payment_name AS `payment_name`",
131 + "CASE WHEN LOCATE( 'noreceipt', order_status ) > 0 THEN '" . __( 'unpaid', 'usces' ) . "'
132 + WHEN LOCATE( 'receipted', order_status ) > 0 THEN '" . __( 'payment confirmed', 'usces' ) . "'
133 + WHEN LOCATE( 'pending', order_status ) > 0 THEN '" . __( 'Pending', 'usces' ) . "'
134 + ELSE '&nbsp;'
135 + END AS `receipt_status`",
136 + "CASE {$status_sql}
137 + ELSE '" . __( 'new order', 'usces' ) . "'
138 + END AS `order_status`",
139 + "order_modified",
140 + "IFNULL( reg_id, '' ) AS `reg_parent_id`",
141 + "IFNULL( meta3.meta_value, '' ) AS `acting_zeus_card`",
142 + );
143 + } else {
144 + $select = array(
145 + "ID",
146 + "meta.meta_value AS `deco_id`",
147 + "DATE_FORMAT( order_date, '%Y-%m-%d %H:%i' ) AS `date`",
148 + "mem_id",
149 + "CONCAT( order_name1, ' ', order_name2 ) AS `name`",
150 + "order_pref AS `pref`",
151 + "order_delivery_method AS `delivery_method`",
152 + "( order_item_total_price - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax ) AS `total_price`",
153 + "order_payment_name AS `payment_name`",
154 + "CASE WHEN LOCATE( 'noreceipt', order_status) > 0 THEN '" . __( 'unpaid', 'usces' ) . "'
155 + WHEN LOCATE( 'receipted', order_status) > 0 THEN '" . __( 'payment confirmed', 'usces' ) . "'
156 + WHEN LOCATE( 'pending', order_status) > 0 THEN '" . __( 'Pending', 'usces' ) . "'
157 + ELSE '&nbsp;'
158 + END AS `receipt_status`",
159 + "CASE {$status_sql}
160 + ELSE '" . __( 'new order', 'usces' ) . "'
161 + END AS `order_status`",
162 + "order_modified",
163 + );
164 + }
165 + $this->selectSql = apply_filters( 'usces_filter_order_list_sql_select', $select, $status_sql, $this );
166 + }
167 +
168 + /**
169 + * Set Join Tables.
170 + */
171 + public function SetJoinTables() {
172 + global $wpdb;
173 + $meta_table = $wpdb->prefix . 'usces_order_meta';
174 + $ordercart_table = $wpdb->prefix . 'usces_ordercart';
175 + $ordercartmeta_table = $wpdb->prefix . 'usces_ordercart_meta';
176 + if ( defined( 'WCEX_AUTO_DELIVERY' ) && version_compare( WCEX_AUTO_DELIVERY_VERSION, '1.4.0', '>=' ) ) {
177 + $regular_table = $wpdb->prefix . 'usces_regular';
178 + $join_table = array(
179 + "LEFT JOIN {$meta_table} AS `meta1` ON ID = meta1.order_id AND meta1.meta_key = 'dec_order_id' ",
180 + "LEFT JOIN {$meta_table} AS `meta2` ON ID = meta2.order_id AND meta2.meta_key = 'regular_id' ",
181 + "LEFT JOIN {$meta_table} AS `meta3` ON ID = meta3.order_id AND meta3.meta_key = 'acting_zeus_card' ",
182 + "LEFT JOIN {$ordercart_table} AS `cart` ON ID = cart.order_id ",
183 + "LEFT JOIN {$regular_table} ON ID = reg_order_id ",
184 + );
185 + } else {
186 + $join_table = array(
187 + " LEFT JOIN {$meta_table} AS `meta` ON ID = meta.order_id AND meta.meta_key = 'dec_order_id'" . " \n",
188 + " LEFT JOIN {$ordercart_table} AS `cart` ON ID = cart.order_id" . " \n",
189 + );
190 + }
191 + $this->joinTableSql = apply_filters( 'usces_filter_order_list_sql_jointable', $join_table, $meta_table, $this );
192 + }
193 +
194 + /**
195 + * Action.
196 + *
197 + * @return mixed
198 + */
199 + public function MakeTable() {
200 + $this->SetParam();
201 + switch ( $this->action ) {
202 +
203 + case 'searchOut':
204 + $this->SearchOut();
205 + $res = $this->GetRows();
206 + break;
207 +
208 + case 'collective_order_reciept':
209 + check_admin_referer( 'order_list', 'wc_nonce' );
210 + usces_all_change_order_reciept( $this );
211 + $res = $this->GetRows();
212 + break;
213 +
214 + case 'collective_order_status':
215 + check_admin_referer( 'order_list', 'wc_nonce' );
216 + usces_all_change_order_status( $this );
217 + $res = $this->GetRows();
218 + break;
219 +
220 + case 'collective_delete':
221 + check_admin_referer( 'order_list', 'wc_nonce' );
222 + usces_all_delete_order_data( $this );
223 + $this->SetTotalRow();
224 + $res = $this->GetRows();
225 + break;
226 +
227 + case 'searchIn':
228 + case 'refresh':
229 + case 'returnList':
230 + case 'changeSort':
231 + case 'changePage':
232 + default:
233 + $this->SearchIn();
234 + $res = $this->GetRows();
235 + break;
236 + }
237 +
238 + $this->SetNavi();
239 + $this->SetHeaders();
240 +
241 + if ( $res ) {
242 + return true;
243 + } else {
244 + return false;
245 + }
246 + }
247 +
248 + /**
249 + * Default Parameters.
250 + */
251 + public function SetDefaultParam() {
252 + $this->startRow = isset( $this->data_cookie['startRow'] ) ? $this->data_cookie['startRow'] : 0;
253 + $this->currentPage = isset( $this->data_cookie['currentPage'] ) ? $this->data_cookie['currentPage'] : 1;
254 + $this->sortColumn = ( isset( $this->data_cookie['sortColumn'] ) ) ? $this->data_cookie['sortColumn'] : 'ID';
255 + $this->searchSwitchStatus = ( isset( $this->data_cookie['searchSwitchStatus'] ) ) ? $this->data_cookie['searchSwitchStatus'] : 'OFF';
256 + $this->searchSql = ( isset( $this->data_cookie['searchSql'] ) ) ? $this->data_cookie['searchSql'] : '';
257 + $this->searchSkuSql = ( isset( $this->data_cookie['searchSkuSql'] ) ) ? $this->data_cookie['searchSkuSql'] : '';
258 + if ( isset( $this->data_cookie['arr_search'] ) ) {
259 + $this->arr_search = $this->data_cookie['arr_search'];
260 + } else {
261 + $arr_search = array(
262 + 'period' => $this->period_initial_index,
263 + 'column' => '',
264 + 'word' => '',
265 + 'sku' => '',
266 + 'skuword' => '',
267 + );
268 + $this->arr_search = apply_filters( 'usces_filter_order_list_arr_search', $arr_search, $this );
269 + }
270 + if ( isset( $this->data_cookie['sortSwitchs'] ) ) {
271 + $this->sortSwitchs = $this->data_cookie['sortSwitchs'];
272 + foreach ( $this->columns as $key => $value ) {
273 + if ( ! isset( $this->sortSwitchs[ $value ] ) ) {
274 + $this->sortSwitchs[ $value ] = 'DESC';
275 + }
276 + }
277 + } else {
278 + foreach ( $this->columns as $key => $value ) {
279 + $this->sortSwitchs[ $value ] = 'DESC';
280 + }
281 + }
282 + // startdate / enddate は画面のフォーム value や JS へ出力される. 書式外を空に落とし, 反映型 XSS を防ぐ.
283 + $this->startdate = $this->sanitize_search_date( ( isset( $_REQUEST['startdate'] ) ) ? $_REQUEST['startdate'] : ( ( isset( $this->data_cookie['startdate'] ) ) ? $this->data_cookie['startdate'] : '' ) );
284 + $this->enddate = $this->sanitize_search_date( ( isset( $_REQUEST['enddate'] ) ) ? $_REQUEST['enddate'] : ( ( isset( $this->data_cookie['enddate'] ) ) ? $this->data_cookie['enddate'] : '' ) );
285 + $this->SetTotalRow();
286 + }
287 +
288 + /**
289 + * Set Parameters.
290 + */
291 + public function SetParam() {
292 + $this->startRow = ( $this->currentPage - 1 ) * $this->maxRow;
293 + }
294 +
295 + /**
296 + * Set Parameters.
297 + */
298 + public function SetParamByQuery() {
299 + global $wpdb;
300 + if ( isset( $_REQUEST['changePage'] ) ) {
301 +
302 + $this->action = 'changePage';
303 + $this->currentPage = (int) $_REQUEST['changePage'];
304 + $this->sortColumn = ( isset( $data_cookie['sortColumn'] ) ) ? $this->data_cookie['sortColumn'] : $this->sortColumn;
305 + $this->sortSwitchs = ( isset( $this->data_cookie['sortSwitchs'] ) ) ? $this->data_cookie['sortSwitchs'] : $this->sortSwitchs;
306 + $this->userHeaderNames = ( isset( $this->data_cookie['userHeaderNames'] ) ) ? $this->data_cookie['userHeaderNames'] : $this->userHeaderNames;
307 + $this->searchSwitchStatus = ( isset( $this->data_cookie['searchSwitchStatus'] ) ) ? $this->data_cookie['searchSwitchStatus'] : $this->searchSwitchStatus;
308 + $this->searchSql = ( isset( $this->data_cookie['searchSql'] ) ) ? $this->data_cookie['searchSql'] : $this->searchSql;
309 + $this->searchSkuSql = ( isset( $this->data_cookie['searchSkuSql'] ) ) ? $this->data_cookie['searchSkuSql'] : $this->searchSkuSql;
310 + $this->arr_search = ( isset( $this->data_cookie['arr_search'] ) ) ? $this->data_cookie['arr_search'] : $this->arr_search;
311 + $this->totalRow = ( isset( $this->data_cookie['totalRow'] ) ) ? $this->data_cookie['totalRow'] : $this->totalRow;
312 + $this->selectedRow = ( isset( $this->data_cookie['selectedRow'] ) ) ? $this->data_cookie['selectedRow'] : $this->selectedRow;
313 + $this->placeholder_escape = ( isset( $this->data_cookie['placeholder_escape'] ) ) ? $this->data_cookie['placeholder_escape'] : $this->placeholder_escape;
314 +
315 + } elseif ( isset( $_REQUEST['changeSort'] ) ) {
316 +
317 + $this->action = 'changeSort';
318 + $this->sortOldColumn = $this->sortColumn;
319 + // Validate sortColumn.
320 + if ( in_array( $_REQUEST['changeSort'], $this->columns ) ) {
321 + $this->sortColumn = $_REQUEST['changeSort'];
322 + } else {
323 + $this->sortColumn = 'ID'; // default.
324 + }
325 + $this->sortSwitchs = ( isset( $this->data_cookie['sortSwitchs'] ) ) ? $this->data_cookie['sortSwitchs'] : $this->sortSwitchs;
326 + // Validate sortSwitchs.
327 + if (isset($_REQUEST['switch']) && in_array($_REQUEST['switch'], array('ASC', 'DESC'))) {
328 + $this->sortSwitchs[$this->sortColumn] = $_REQUEST['switch'];
329 + } else {
330 + $this->sortSwitchs[$this->sortColumn] = 'DESC'; // default.
331 + }
332 + $this->currentPage = ( isset( $this->data_cookie['currentPage'] ) ) ? $this->data_cookie['currentPage'] : $this->currentPage;
333 + $this->userHeaderNames = ( isset( $this->data_cookie['userHeaderNames'] ) ) ? $this->data_cookie['userHeaderNames'] : $this->userHeaderNames;
334 + $this->searchSql = ( isset( $this->data_cookie['searchSql'] ) ) ? $this->data_cookie['searchSql'] : $this->searchSql;
335 + $this->searchSkuSql = ( isset( $this->data_cookie['searchSkuSql'] ) ) ? $this->data_cookie['searchSkuSql'] : $this->searchSkuSql;
336 + $this->arr_search = ( isset( $this->data_cookie['arr_search'] ) ) ? $this->data_cookie['arr_search'] : $this->arr_search;
337 + $this->totalRow = ( isset( $this->data_cookie['totalRow'] ) ) ? $this->data_cookie['totalRow'] : $this->totalRow;
338 + $this->selectedRow = ( isset( $this->data_cookie['selectedRow'] ) ) ? $this->data_cookie['selectedRow'] : $this->selectedRow;
339 + $this->placeholder_escape = ( isset( $this->data_cookie['placeholder_escape'] ) ) ? $this->data_cookie['placeholder_escape'] : $this->placeholder_escape;
340 +
341 + } elseif ( isset( $_REQUEST['searchIn'] ) ) {
342 +
343 + $this->action = 'searchIn';
344 + $this->arr_search['column'] = isset( $_REQUEST['search']['column'] ) ? str_replace( '`', '', $_REQUEST['search']['column'] ) : '';
345 + $this->arr_search['sku'] = isset( $_REQUEST['search']['sku'] ) ? $_REQUEST['search']['sku'] : '';
346 + $this->arr_search['word'] = isset( $_REQUEST['search']['word'] ) ? $_REQUEST['search']['word'] : '';
347 + $this->arr_search['skuword'] = isset( $_REQUEST['search']['skuword'] ) ? $_REQUEST['search']['skuword'] : '';
348 + $this->arr_search['period'] = isset( $_REQUEST['search']['period'] ) ? (int) $_REQUEST['search']['period'] : $this->period_initial_index;
349 + if ( $this->period_specified_index != $this->arr_search['period'] ) {
350 + $this->startdate = '';
351 + $this->enddate = '';
352 + $this->data_cookie['startdate'] = '';
353 + $this->data_cookie['enddate'] = '';
354 + }
355 + $this->searchSwitchStatus = isset( $_REQUEST['searchSwitchStatus'] ) ? $_REQUEST['searchSwitchStatus'] : '';
356 + $this->currentPage = 1;
357 + $this->sortColumn = ( isset( $this->data_cookie['sortColumn'] ) ) ? $this->data_cookie['sortColumn'] : $this->sortColumn;
358 + $this->sortSwitchs = ( isset( $this->data_cookie['sortSwitchs'] ) ) ? $this->data_cookie['sortSwitchs'] : $this->sortSwitchs;
359 + $this->userHeaderNames = ( isset( $this->data_cookie['userHeaderNames'] ) ) ? $this->data_cookie['userHeaderNames'] : $this->userHeaderNames;
360 + $this->totalRow = ( isset( $this->data_cookie['totalRow'] ) ) ? $this->data_cookie['totalRow'] : $this->totalRow;
361 + $this->placeholder_escape = $wpdb->placeholder_escape();
362 +
363 + } elseif ( isset( $_REQUEST['searchOut'] ) ) {
364 +
365 + $this->action = 'searchOut';
366 + $this->arr_search['column'] = '';
367 + $this->arr_search['word'] = '';
368 + $this->arr_search['sku'] = '';
369 + $this->arr_search['skuword'] = '';
370 + $this->arr_search['period'] = ( isset( $this->data_cookie['arr_search']['period'] ) ) ? $this->data_cookie['arr_search']['period'] : $this->arr_search['period'];
371 + $this->searchSwitchStatus = isset( $_REQUEST['searchSwitchStatus'] ) ? str_replace( ',', '', $_REQUEST['searchSwitchStatus'] ) : '';
372 + $this->currentPage = 1;
373 + $this->sortColumn = ( isset( $this->data_cookie['sortColumn'] ) ) ? $this->data_cookie['sortColumn'] : $this->sortColumn;
374 + $this->sortSwitchs = ( isset( $this->data_cookie['sortSwitchs'] ) ) ? $this->data_cookie['sortSwitchs'] : $this->sortSwitchs;
375 + $this->userHeaderNames = ( isset( $this->data_cookie['userHeaderNames'] ) ) ? $this->data_cookie['userHeaderNames'] : $this->userHeaderNames;
376 + $this->totalRow = ( isset( $this->data_cookie['totalRow'] ) ) ? $this->data_cookie['totalRow'] : $this->totalRow;
377 + $this->placeholder_escape = '';
378 +
379 + } elseif ( isset( $_REQUEST['refresh'] ) ) {
380 +
381 + $this->action = 'refresh';
382 + $this->currentPage = ( isset( $this->data_cookie['currentPage'] ) ) ? $this->data_cookie['currentPage'] : $this->currentPage;
383 + $this->sortColumn = ( isset( $this->data_cookie['sortColumn'] ) ) ? $this->data_cookie['sortColumn'] : $this->sortColumn;
384 + $this->sortSwitchs = ( isset( $this->data_cookie['sortSwitchs'] ) ) ? $this->data_cookie['sortSwitchs'] : $this->sortSwitchs;
385 + $this->userHeaderNames = ( isset( $this->data_cookie['userHeaderNames'] ) ) ? $this->data_cookie['userHeaderNames'] : $this->userHeaderNames;
386 + $this->searchSwitchStatus = ( isset( $this->data_cookie['searchSwitchStatus'] ) ) ? $this->data_cookie['searchSwitchStatus'] : $this->searchSwitchStatus;
387 + $this->searchSql = ( isset( $this->data_cookie['searchSql'] ) ) ? $this->data_cookie['searchSql'] : $this->searchSql;
388 + $this->searchSkuSql = ( isset( $this->data_cookie['searchSkuSql'] ) ) ? $this->data_cookie['searchSkuSql'] : $this->searchSkuSql;
389 + $this->arr_search = ( isset( $this->data_cookie['arr_search'] ) ) ? $this->data_cookie['arr_search'] : $this->arr_search;
390 + $this->totalRow = ( isset( $this->data_cookie['totalRow'] ) ) ? $this->data_cookie['totalRow'] : $this->totalRow;
391 + $this->selectedRow = ( isset( $this->data_cookie['selectedRow'] ) ) ? $this->data_cookie['selectedRow'] : $this->selectedRow;
392 + $this->placeholder_escape = '';
393 +
394 + } elseif ( isset( $_REQUEST['collective'] ) ) {
395 +
396 + $this->action = 'collective_' . str_replace( ',', '', $_POST['allchange']['column'] );
397 + $this->currentPage = ( isset( $this->data_cookie['currentPage'] ) ) ? $this->data_cookie['currentPage'] : $this->currentPage;
398 + $this->sortColumn = ( isset( $this->data_cookie['sortColumn'] ) ) ? $this->data_cookie['sortColumn'] : $this->sortColumn;
399 + $this->sortSwitchs = ( isset( $this->data_cookie['sortSwitchs'] ) ) ? $this->data_cookie['sortSwitchs'] : $this->sortSwitchs;
400 + $this->userHeaderNames = ( isset( $this->data_cookie['userHeaderNames'] ) ) ? $this->data_cookie['userHeaderNames'] : $this->userHeaderNames;
401 + $this->searchSwitchStatus = ( isset( $this->data_cookie['searchSwitchStatus'] ) ) ? $this->data_cookie['searchSwitchStatus'] : $this->searchSwitchStatus;
402 + $this->searchSql = ( isset( $this->data_cookie['searchSql'] ) ) ? $this->data_cookie['searchSql'] : $this->searchSql;
403 + $this->searchSkuSql = ( isset( $this->data_cookie['searchSkuSql'] ) ) ? $this->data_cookie['searchSkuSql'] : $this->searchSkuSql;
404 + $this->arr_search = ( isset( $this->data_cookie['arr_search'] ) ) ? $this->data_cookie['arr_search'] : $this->arr_search;
405 + $this->totalRow = ( isset( $this->data_cookie['totalRow'] ) ) ? $this->data_cookie['totalRow'] : $this->totalRow;
406 + $this->selectedRow = ( isset( $this->data_cookie['selectedRow'] ) ) ? $this->data_cookie['selectedRow'] : $this->selectedRow;
407 + $this->placeholder_escape = ( isset( $this->data_cookie['placeholder_escape'] ) ) ? $this->data_cookie['placeholder_escape'] : $this->placeholder_escape;
408 +
409 + } else {
410 +
411 + $this->action = 'default';
412 + $this->placeholder_escape = '';
413 + }
414 + }
415 +
416 + /**
417 + * Validation Search Parameters.
418 + */
419 + public function validationSearchParameters() {
420 + $default_sku_columns = [ 'item_code', 'item_name' ];
421 + if ( ! empty( $this->arr_search['column'] ) && 'none' != $this->arr_search['column'] && ! in_array( $this->arr_search['column'], $this->columns ) ) {
422 + if ( ! empty( $this->arr_search['word'] ) && is_array( $this->arr_search['word'] ) && count( $this->arr_search['word'] ) && in_array( $key = key( $this->arr_search['word'] ), $this->columns ) ) {
423 + $this->arr_search['column'] = $key;
424 + } else {
425 + $this->arr_search['column'] = 'none';
426 + }
427 + }
428 + if ( ! empty( $this->arr_search['sku'] ) && 'none' != $this->arr_search['sku'] && ! in_array( $this->arr_search['sku'], $default_sku_columns ) ) {
429 + if ( ! empty( $this->arr_search['skuword'] ) && is_array( $this->arr_search['skuword'] ) && count( $this->arr_search['skuword'] ) && in_array( $key = key( $this->arr_search['skuword'] ), $default_sku_columns ) ) {
430 + $this->arr_search['sku'] = $key;
431 + } else {
432 + $this->arr_search['sku'] = 'none';
433 + }
434 + }
435 + }
436 +
437 + /**
438 + * Get Rows.
439 + *
440 + * @return array
441 + */
442 + public function GetRows() {
443 + global $wpdb;
444 + $where = $this->GetWhere();
445 +
446 + $init_column = 'ID';
447 + $sort_column = in_array( $this->sortColumn, $this->columns, true ) ? $this->sortColumn : $init_column;
448 + $init_switch = 'DESC';
449 + $sort_switch = $this->sortSwitchs[ $sort_column ] ?? $init_switch;
450 + $sort_switch = in_array( strtoupper( $sort_switch ), array( 'ASC', 'DESC' ), true ) ? $sort_switch : $init_switch;
451 + $order = ' ORDER BY ' . esc_sql( $sort_column ) . ' ' . esc_sql( $sort_switch );
452 + $order = apply_filters( 'usces_filter_order_list_get_orderby', $order, $this );
453 +
454 + $select = '';
455 + foreach ( $this->selectSql as $value ) {
456 + $select .= $value . ', ';
457 + }
458 + $select = rtrim( $select, ', ' );
459 + $select .= ', item_name, item_code';
460 + $query = apply_filters( 'usces_filter_order_list_select', $select, $this );
461 + $join_table = '';
462 + foreach ( $this->joinTableSql as $value ) {
463 + $join_table .= $value;
464 + }
465 + $query = 'SELECT ' . $select . " \n" . "FROM {$this->table} " . "\n" . $join_table . $where . "\n" . $order;
466 + $query = apply_filters( 'usces_filter_order_list_get_rows', $query, $this );
467 + $wpdb->show_errors();
468 +
469 + if ( $this->placeholder_escape ) {
470 + add_filter( 'query', array( $this, 'remove_ph' ) );
471 + }
472 +
473 + $rows = $wpdb->get_results( $query, ARRAY_A );
474 + $this->selectedRow = ( $rows && is_array( $rows ) ) ? count( $rows ) : 0;
475 + if ( 'on' == $this->pageLimit ) {
476 + $this->rows = array_slice( (array) $rows, $this->startRow, $this->maxRow );
477 + } else {
478 + $this->rows = (array) $rows;
479 + }
480 +
481 + return $this->rows;
482 + }
483 +
484 + /**
485 + * Placeholder clear.
486 + *
487 + * @param string $query Query.
488 + * @return string
489 + */
490 + public function remove_ph( $query ) {
491 + return str_replace( $this->placeholder_escape, '%', $query );
492 + }
493 +
494 + /**
495 + * 期間検索の日付をサニタイズする
496 + *
497 + * リクエストまたは検索条件 Cookie 由来の startdate / enddate は、
498 + * WHERE 句へ文字列連結される. 書式に合わない値は空文字に落とし、
499 + * 「日付指定なし」として扱う.
500 + *
501 + * @param mixed $date Date string.
502 + * @return string
503 + */
504 + private function sanitize_search_date( $date ) {
505 + if ( ! is_scalar( $date ) ) {
506 + return '';
507 + }
508 + $date = trim( (string) $date );
509 + return ( preg_match( '/^\d{4}-\d{2}-\d{2}$/', $date ) ) ? $date : '';
510 + }
511 +
512 + /**
513 + * Set Total Rows.
514 + */
515 + public function SetTotalRow() {
516 + global $wpdb;
517 + $where = '';
518 + if ( $this->period_specified_index == $this->arr_search['period'] ) {
519 + if ( isset( $_REQUEST['startdate'] ) ) {
520 + $startdate = $this->sanitize_search_date( $_REQUEST['startdate'] );
521 + } else {
522 + $startdate = $this->sanitize_search_date( $this->data_cookie['startdate'] );
523 + }
524 +
525 + if ( isset( $_REQUEST['enddate'] ) ) {
526 + $enddate = $this->sanitize_search_date( $_REQUEST['enddate'] );
527 + } else {
528 + $enddate = $this->sanitize_search_date( $this->data_cookie['enddate'] );
529 + }
530 + if ( '' != $startdate || '' != $enddate ) {
531 + if ( '' == $enddate ) {
532 + $where = " WHERE order_date >= '{$startdate}'";
533 + } elseif ( '' == $startdate ) {
534 + $where = " WHERE order_date <= '{$enddate}'";
535 + } elseif ( $startdate == $enddate ) {
536 + $where = " WHERE order_date BETWEEN '{$startdate} 00:00:00' AND '{$startdate} 23:59:59'";
537 + } else {
538 + $where = " WHERE order_date >= '{$startdate}' AND order_date <= '{$enddate}'";
539 + }
540 + }
541 + }
542 + $query = "SELECT COUNT(ID) AS `ct` FROM {$this->table}" . apply_filters( 'usces_filter_order_list_sql_where', $where, $this );
543 + $query = apply_filters( 'usces_filter_order_list_set_total_row', $query, $this );
544 + $res = $wpdb->get_var( $query );
545 + $this->totalRow = $res;
546 + }
547 +
548 + /**
549 + * Where Condition.
550 + *
551 + * @return string
552 + */
553 + public function GetWhere() {
554 + global $wpdb;
555 + $str = '';
556 + $where = '';
557 + if ( $this->period_specified_index == $this->arr_search['period'] ) {
558 + if ( isset( $_REQUEST['startdate'] ) ) {
559 + $startdate = $this->sanitize_search_date( $_REQUEST['startdate'] );
560 + } else {
561 + $startdate = $this->sanitize_search_date( $this->data_cookie['startdate'] );
562 + }
563 +
564 + if ( isset( $_REQUEST['enddate'] ) ) {
565 + $enddate = $this->sanitize_search_date( $_REQUEST['enddate'] );
566 + } else {
567 + $enddate = $this->sanitize_search_date( $this->data_cookie['enddate'] );
568 + }
569 + if ( '' != $startdate || '' != $enddate ) {
570 + if ( '' == $enddate ) {
571 + $where = " WHERE order_date >= '{$startdate}'";
572 + } elseif ( '' == $startdate ) {
573 + $where = " WHERE order_date <= '{$enddate}'";
574 + } elseif ( $startdate == $enddate ) {
575 + $where = " WHERE order_date BETWEEN '{$startdate} 00:00:00' AND '{$startdate} 23:59:59'";
576 + } else {
577 + $where = " WHERE order_date >= '{$startdate}' AND order_date <= '{$enddate}'";
578 + }
579 + }
580 + } else {
581 + $thismonth = date_i18n( 'Y-m-01 00:00:00' );
582 + $lastmonth = date_i18n( 'Y-m-01 00:00:00', mktime( 0, 0, 0, date_i18n( 'm' ) - 1, 1, date_i18n( 'Y' ) ) );
583 + $lastweek = date_i18n( 'Y-m-d 00:00:00', mktime( 0, 0, 0, date_i18n( 'm' ), date_i18n( 'd' ) - 7, date_i18n( 'Y' ) ) );
584 + $last30 = date_i18n( 'Y-m-d 00:00:00', mktime( 0, 0, 0, date_i18n( 'm' ), date_i18n( 'd' ) - 30, date_i18n( 'Y' ) ) );
585 + $last90 = date_i18n( 'Y-m-d 00:00:00', mktime( 0, 0, 0, date_i18n( 'm' ), date_i18n( 'd' ) - 90, date_i18n( 'Y' ) ) );
586 + switch ( $this->arr_search['period'] ) {
587 + case 0:
588 + $where = $wpdb->prepare( " WHERE order_date >= %s ", $thismonth );
589 + break;
590 + case 1:
591 + $where = $wpdb->prepare( " WHERE order_date >= %s AND order_date < %s ", $lastmonth, $thismonth );
592 + break;
593 + case 2:
594 + $where = $wpdb->prepare( " WHERE order_date >= %s ", $lastweek );
595 + break;
596 + case 3:
597 + $where = $wpdb->prepare( " WHERE order_date >= %s ", $last30 );
598 + break;
599 + case 4:
600 + $where = $wpdb->prepare( " WHERE order_date >= %s ", $last90 );
601 + break;
602 + case 5:
603 + $where = '';
604 + break;
605 + }
606 + }
607 + if ( ! WCUtils::is_blank( $where ) ) {
608 + if ( ! WCUtils::is_blank( $this->searchSkuSql ) ) {
609 + $where .= ' AND ' . $this->searchSkuSql;
610 + }
611 + } else {
612 + if ( ! WCUtils::is_blank( $this->searchSkuSql ) ) {
613 + $where = ' WHERE ' . $this->searchSkuSql;
614 + }
615 + }
616 + $str = apply_filters( 'usces_filter_order_list_sql_where', $where, $this );
617 +
618 + $str .= ' GROUP BY `ID` ';
619 +
620 + $having = '';
621 + if ( ! WCUtils::is_blank( $this->searchSql ) ) {
622 + $having = ' HAVING ' . $this->searchSql;
623 + }
624 + $having = apply_filters( 'usces_filter_order_list_sql_having', $having, $this );
625 +
626 + if ( ! WCUtils::is_blank( $having ) ) {
627 + $str .= $having;
628 + }
629 +
630 + return apply_filters( 'usces_filter_order_list_get_where', $str, $this );
631 + }
632 +
633 + /**
634 + * Search.
635 + */
636 + public function SearchIn() {
637 + global $wpdb;
638 + switch ( $this->arr_search['column'] ) {
639 + case 'ID':
640 + $column = 'ID';
641 + $this->searchSql = $wpdb->prepare( '`' . $column . '` = %d', $this->arr_search['word']['ID'] );
642 + break;
643 + case 'deco_id':
644 + $column = 'deco_id';
645 + $this->searchSql = $wpdb->prepare( '`' . $column . '` LIKE %s', "%" . $this->arr_search['word']['deco_id'] . "%" );
646 + break;
647 + case 'date':
648 + $column = 'date';
649 + $this->searchSql = $wpdb->prepare( '`' . $column . '` LIKE %s', "%" . $this->arr_search['word']['date'] . "%" );
650 + break;
651 + case 'mem_id':
652 + $column = 'mem_id';
653 + $this->searchSql = $wpdb->prepare( '`' . $column . '` = %d', $this->arr_search['word']['mem_id'] );
654 + break;
655 + case 'name':
656 + $column = 'name';
657 + $this->searchSql = $wpdb->prepare( '`' . $column . '` LIKE %s', "%" . $this->arr_search['word']['name'] . "%" );
658 + break;
659 + case 'order_modified':
660 + $column = 'order_modified';
661 + $this->searchSql = $wpdb->prepare( '`' . $column . '` LIKE %s', "%" . $this->arr_search['word']['order_modified'] . "%" );
662 + break;
663 + case 'pref':
664 + $column = 'pref';
665 + $this->searchSql = $wpdb->prepare( '`' . $column . "` = %s", $this->arr_search['word']['pref'] );
666 + break;
667 + case 'delivery_method':
668 + $column = 'delivery_method';
669 + $this->searchSql = $wpdb->prepare( '`' . $column . "` = %s", $this->arr_search['word']['delivery_method'] );
670 + break;
671 + case 'payment_name':
672 + $column = 'payment_name';
673 + $this->searchSql = $wpdb->prepare( '`' . $column . "` = %s", $this->arr_search['word']['payment_name'] );
674 + break;
675 + case 'receipt_status':
676 + $column = 'receipt_status';
677 + $this->searchSql = $wpdb->prepare( '`' . $column . "` = %s", $this->arr_search['word']['receipt_status'] );
678 + break;
679 + case 'order_status':
680 + $column = 'order_status';
681 + $this->searchSql = $wpdb->prepare( '`' . $column . "` = %s", $this->arr_search['word']['order_status'] );
682 + break;
683 + }
684 + switch ( $this->arr_search['sku'] ) {
685 + case 'item_code':
686 + $column = 'item_code';
687 + $this->searchSkuSql = $wpdb->prepare( '`' . $column . '` LIKE %s', "%" . $this->arr_search['skuword']['item_code'] . "%" );
688 + break;
689 + case 'item_name':
690 + $column = 'item_name';
691 + $this->searchSkuSql = $wpdb->prepare( '`' . $column . '` LIKE %s', "%" . $this->arr_search['skuword']['item_name'] . "%" );
692 + break;
693 + }
694 + }
695 +
696 + /**
697 + * Search clear.
698 + */
699 + public function SearchOut() {
700 + $this->searchSql = '';
701 + $this->searchSkuSql = '';
702 + }
703 +
704 + /**
705 + * Set Navigation.
706 + */
707 + public function SetNavi() {
708 + $this->lastPage = ceil( $this->selectedRow / $this->maxRow );
709 + $this->previousPage = ( $this->currentPage - 1 == 0 ) ? 1 : $this->currentPage - 1;
710 + $this->nextPage = ( $this->currentPage + 1 > $this->lastPage ) ? $this->lastPage : $this->currentPage + 1;
711 + $box = array();
712 +
713 + for ( $i = 0; $i < $this->naviMaxButton; $i++ ) {
714 + if ( $i > $this->lastPage - 1 ) {
715 + break;
716 + }
717 + if ( $this->lastPage <= $this->naviMaxButton ) {
718 + $box[] = $i + 1;
719 + } else {
720 + if ( $this->currentPage <= 6 ) {
721 + $label = $i + 1;
722 + $box[] = $label;
723 + } else {
724 + $label = $i + 1 + $this->currentPage - 6;
725 + $box[] = $label;
726 + if ( $label == $this->lastPage ) {
727 + break;
728 + }
729 + }
730 + }
731 + }
732 +
733 + $html = '';
734 + $html .= '<ul class="clearfix">';
735 + $html .= '<li class="rowsnum">' . $this->selectedRow . ' / ' . $this->totalRow . ' ' . __( 'cases', 'usces' ) . '</li>';
736 + if ( ( 1 == $this->currentPage ) || ( 0 == $this->selectedRow ) ) {
737 + $html .= '<li class="navigationStr">first&lt;&lt;</li>';
738 + $html .= '<li class="navigationStr">prev&lt;</li>';
739 + } else {
740 + $html .= '<li class="navigationStr"><a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changePage=1">first&lt;&lt;</a></li>';
741 + $html .= '<li class="navigationStr"><a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changePage=' . $this->previousPage . '">prev&lt;</a></li>';
742 + }
743 + if ( $this->selectedRow > 0 ) {
744 + $box_count = count( $box );
745 + for ( $i = 0; $i < $box_count; $i++ ) {
746 + if ( $box[ $i ] == $this->currentPage ) {
747 + $html .= '<li class="navigationButtonSelected">' . $box[ $i ] . '</li>';
748 + } else {
749 + $html .= '<li class="navigationButton"><a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changePage=' . $box[ $i ] . '">' . $box[ $i ] . '</a></li>';
750 + }
751 + }
752 + }
753 + if ( ( $this->currentPage == $this->lastPage ) || ( 0 == $this->selectedRow ) ) {
754 + $html .= '<li class="navigationStr">&gt;next</li>';
755 + $html .= '<li class="navigationStr">&gt;&gt;last</li>';
756 + } else {
757 + $html .= '<li class="navigationStr"><a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changePage=' . $this->nextPage . '">&gt;next</a></li>';
758 + $html .= '<li class="navigationStr"><a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changePage=' . $this->lastPage . '">&gt;&gt;last</a></li>';
759 + }
760 + if ( 'OFF ' == $this->searchSwitchStatus ) {
761 + $html .= '<li class="rowsnum"><a style="cursor:pointer;" id="searchVisiLink">' . __( 'Hide the Operation field', 'usces' ) . '<span class="dashicons dashicons-arrow-up"></a>';
762 + } else {
763 + $html .= '<li class="rowsnum"><a style="cursor:pointer;" id="searchVisiLink">' . __( 'Show the Operation field', 'usces' ) . '<span class="dashicons dashicons-arrow-down"></a>';
764 + }
765 +
766 + $html .= '<li class="refresh"><a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&refresh">' . __( 'updates it to latest information', 'usces' ) . '</a></li>';
767 + $html .= '</ul>';
768 +
769 + $this->dataTableNavigation = $html;
770 + }
771 +
772 + /**
773 + * Get Cookie.
774 + */
775 + public function getCookie() {
776 + $this->data_cookie = ( isset( $_COOKIE[ $this->cookie_key ] ) ) ? json_decode( str_replace( "\'", "'", str_replace( '\"', '"', $_COOKIE[ $this->cookie_key ] ) ), true ) : array();
777 + }
778 +
779 + /**
780 + * Set Headers.
781 + */
782 + public function SetHeaders() {
783 + foreach ( $this->columns as $key => $value ) {
784 + if ( $value == $this->sortColumn ) {
785 + if ( 'ASC' == $this->sortSwitchs[ $value ] ) {
786 + $str = __( '[ASC]', 'usces' );
787 + $switch = 'DESC';
788 + } else {
789 + $str = __( '[DESC]', 'usces' );
790 + $switch = 'ASC';
791 + }
792 + $this->headers[ $value ] = '<a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changeSort=' . $value . '&switch=' . $switch . '"><span class="sortcolumn">' . $key . ' ' . $str . '</span></a>';
793 + } else {
794 + $switch = $this->sortSwitchs[ $value ];
795 + $this->headers[ $value ] = '<a href="' . site_url() . '/wp-admin/admin.php?page=usces_orderlist&changeSort=' . $value . '&switch=' . $switch . '"><span>' . $key . '</span></a>';
796 + }
797 + }
798 + }
799 +
800 + /**
801 + * Get Search.
802 + *
803 + * @return string
804 + */
805 + public function GetSearchs() {
806 + return $this->arr_search;
807 + }
808 +
809 + /**
810 + * Get Headers.
811 + *
812 + * @return string
813 + */
814 + public function GetListheaders() {
815 + return $this->headers;
816 + }
817 +
818 + /**
819 + * Get Navigation.
820 + *
821 + * @return string
822 + */
823 + public function GetDataTableNavigation() {
824 + return $this->dataTableNavigation;
825 + }
826 +
827 + /**
828 + * Set Action Status and Action Message.
829 + *
830 + * @param string $status Action status.
831 + * @param string $message Action message.
832 + */
833 + public function set_action_status( $status, $message ) {
834 + $this->action_status = $status;
835 + $this->action_message = $message;
836 + }
837 +
838 + /**
839 + * Get Action Status.
840 + *
841 + * @return string
842 + */
843 + public function get_action_status() {
844 + return $this->action_status;
845 + }
846 +
847 + /**
848 + * Get Action Message.
849 + *
850 + * @return string
851 + */
852 + public function get_action_message() {
853 + return $this->action_message;
854 + }
855 +
856 + /**
857 + * Get Period Specified.
858 + *
859 + * @return int
860 + */
861 + public function get_period_specified_index() {
862 + return $this->period_specified_index;
863 + }
864 +}