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 -626 1.3.22.12.4 View file →
@@ -1,626 +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 -
37 - $this->table = $tableName;
38 - $this->columns = $arr_column;
39 - $this->rows = array();
40 -
41 - $this->maxRow = 30;
42 - $this->naviMaxButton = 11;
43 - $this->firstPage = 1;
44 - $this->action_status = 'none';
45 - $this->action_message = '';
46 -//20101202ysk start
47 - $this->pageLimit = 'on';
48 -//20101202ysk end
49 - $this->selectSql = '';
50 - $this->joinTableSql = '';
51 -
52 - $this->SetParamByQuery();
53 -
54 - $this->arr_period = array(__('This month', 'usces'), __('Last month', 'usces'), __('The past one week', 'usces'), __('Last 30 days', 'usces'), __('Last 90days', 'usces'), __('All', 'usces'));
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 -
114 - $this->SetParam();
115 -
116 - switch ($this->action){
117 -
118 - case 'searchIn':
119 - $this->SearchIn();
120 - //$this->SetSelectedRow();
121 - $res = $this->GetRows();
122 - break;
123 -
124 - case 'searchOut':
125 - $this->SearchOut();
126 - //$this->SetSelectedRow();
127 - $res = $this->GetRows();
128 - break;
129 -
130 - case 'changeSort':
131 - $res = $this->GetRows();
132 - break;
133 -
134 - case 'changePage':
135 - $res = $this->GetRows();
136 - break;
137 -
138 - case 'collective_order_reciept':
139 - usces_all_change_order_reciept($this);
140 - $res = $this->GetRows();
141 - break;
142 -
143 - case 'collective_order_status':
144 - usces_all_change_order_status($this);
145 - $res = $this->GetRows();
146 - break;
147 -
148 - case 'collective_delete':
149 - usces_all_delete_order_data($this);
150 - $this->SetTotalRow();
151 - $res = $this->GetRows();
152 - break;
153 -
154 - case 'refresh':
155 - default:
156 - $this->SetDefaultParam();
157 - $res = $this->GetRows();
158 - break;
159 - }
160 -
161 - $this->SetNavi();
162 - $this->SetHeaders();
163 - $this->SetSESSION();
164 -
165 - if($res){
166 -
167 - return TRUE;
168 -
169 - }else{
170 - return FALSE;
171 - }
172 - }
173 -
174 - //DefaultParam
175 - function SetDefaultParam()
176 - {
177 - unset($_SESSION[$this->table]);
178 - $this->startRow = 0;
179 - $this->currentPage = 1;
180 - if(isset($_SESSION[$this->table]['arr_search'])){
181 - $this->arr_search = $_SESSION[$this->table]['arr_search'];
182 - }else{
183 - $this->arr_search = array('period'=>'3', 'column'=>'', 'word'=>'');
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 -
197 - $this->SetTotalRow();
198 - //$this->SetSelectedRow();
199 -
200 - }
201 -
202 - function SetParam()
203 - {
204 - $this->startRow = ($this->currentPage-1) * $this->maxRow;
205 - }
206 -
207 - function SetParamByQuery()
208 - {
209 -
210 - if(isset($_REQUEST['changePage'])){
211 -
212 - $this->action = 'changePage';
213 - $this->currentPage = $_REQUEST['changePage'];
214 -
215 - $this->sortColumn = $_SESSION[$this->table]['sortColumn'];
216 - $this->sortSwitchs = $_SESSION[$this->table]['sortSwitchs'];
217 - $this->userHeaderNames = $_SESSION[$this->table]['userHeaderNames'];
218 - $this->searchSwitchStatus = $_SESSION[$this->table]['searchSwitchStatus'];
219 - $this->searchSql = $_SESSION[$this->table]['searchSql'];
220 - $this->arr_search = $_SESSION[$this->table]['arr_search'];
221 - $this->totalRow = $_SESSION[$this->table]['totalRow'];
222 - $this->selectedRow = $_SESSION[$this->table]['selectedRow'];
223 -
224 - }else if(isset($_REQUEST['changeSort'])){
225 -
226 - $this->action = 'changeSort';
227 - $this->sortOldColumn = $this->sortColumn;
228 - $this->sortColumn = $_REQUEST['changeSort'];
229 - $this->sortSwitchs = $_SESSION[$this->table]['sortSwitchs'];
230 - $this->sortSwitchs[$this->sortColumn] = $_REQUEST['switch'];
231 -
232 - $this->currentPage = $_SESSION[$this->table]['currentPage'];
233 - $this->userHeaderNames = $_SESSION[$this->table]['userHeaderNames'];
234 - $this->searchSql = $_SESSION[$this->table]['searchSql'];
235 - $this->arr_search = $_SESSION[$this->table]['arr_search'];
236 - $this->searchSwitchStatus = $_SESSION[$this->table]['searchSwitchStatus'];
237 - $this->totalRow = $_SESSION[$this->table]['totalRow'];
238 - $this->selectedRow = $_SESSION[$this->table]['selectedRow'];
239 -
240 - } else if(isset($_REQUEST['searchIn'])){
241 -
242 - $this->action = 'searchIn';
243 - $this->arr_search['column'] = isset($_REQUEST['search']['column']) ? $_REQUEST['search']['column'] : '';
244 - $this->arr_search['word'] = isset($_REQUEST['search']['word']) ? $_REQUEST['search']['word'] : '';
245 - $this->arr_search['period'] = isset($_REQUEST['search']['period']) ? (int)$_REQUEST['search']['period'] : 0;
246 - $this->searchSwitchStatus = isset($_REQUEST['searchSwitchStatus']) ? $_REQUEST['searchSwitchStatus'] : '';
247 -
248 - $this->currentPage = 1;
249 - $this->sortColumn = $_SESSION[$this->table]['sortColumn'];
250 - $this->sortSwitchs = $_SESSION[$this->table]['sortSwitchs'];
251 - $this->userHeaderNames = $_SESSION[$this->table]['userHeaderNames'];
252 - $this->totalRow = $_SESSION[$this->table]['totalRow'];
253 -
254 - }else if(isset($_REQUEST['searchOut'])){
255 -
256 - $this->action = 'searchOut';
257 - $this->arr_search['column'] = '';
258 - $this->arr_search['word'] = '';
259 - $this->arr_search['period'] = $_SESSION[$this->table]['arr_search']['period'];
260 - $this->searchSwitchStatus = isset($_REQUEST['searchSwitchStatus']) ? $_REQUEST['searchSwitchStatus'] : '';
261 -
262 - $this->currentPage = 1;
263 - $this->sortColumn = $_SESSION[$this->table]['sortColumn'];
264 - $this->sortSwitchs = $_SESSION[$this->table]['sortSwitchs'];
265 - $this->userHeaderNames = $_SESSION[$this->table]['userHeaderNames'];
266 - $this->totalRow = $_SESSION[$this->table]['totalRow'];
267 -
268 - }else if(isset($_REQUEST['refresh'])){
269 -
270 - $this->action = 'refresh';
271 -
272 - $this->currentPage = $_SESSION[$this->table]['currentPage'];
273 - $this->sortColumn = $_SESSION[$this->table]['sortColumn'];
274 - $this->sortSwitchs = $_SESSION[$this->table]['sortSwitchs'];
275 - $this->userHeaderNames = $_SESSION[$this->table]['userHeaderNames'];
276 - $this->searchSql = $_SESSION[$this->table]['searchSql'];
277 - $this->arr_search = $_SESSION[$this->table]['arr_search'];
278 - $this->searchSwitchStatus = $_SESSION[$this->table]['searchSwitchStatus'];
279 - $this->totalRow = $_SESSION[$this->table]['totalRow'];
280 - $this->selectedRow = $_SESSION[$this->table]['selectedRow'];
281 -
282 - }else if(isset($_REQUEST['collective'])){
283 -
284 - $this->action = 'collective_' . $_POST['allchange']['column'];
285 - $this->currentPage = $_SESSION[$this->table]['currentPage'];
286 - $this->sortColumn = $_SESSION[$this->table]['sortColumn'];
287 - $this->sortSwitchs = $_SESSION[$this->table]['sortSwitchs'];
288 - $this->userHeaderNames = $_SESSION[$this->table]['userHeaderNames'];
289 - $this->searchSql = $_SESSION[$this->table]['searchSql'];
290 - $this->arr_search = $_SESSION[$this->table]['arr_search'];
291 - $this->searchSwitchStatus = $_SESSION[$this->table]['searchSwitchStatus'];
292 - $this->totalRow = $_SESSION[$this->table]['totalRow'];
293 - $this->selectedRow = $_SESSION[$this->table]['selectedRow'];
294 -
295 - }else{
296 -
297 - $this->action = 'default';
298 - }
299 - }
300 -
301 - //GetRows
302 - function GetRows()
303 - {
304 - global $wpdb;
305 - //$meta_table = $wpdb->prefix . 'usces_order_meta';
306 - $where = $this->GetWhere();
307 - $order = ' ORDER BY `' . $this->sortColumn . '` ' . $this->sortSwitchs[$this->sortColumn];
308 - //$limit = ' LIMIT ' . $this->startRow . ', ' . $this->maxRow;
309 -
310 -/* $status_sql = '';
311 - foreach ($this->management_status as $status_key => $status_name){
312 - $status_sql .= " WHEN LOCATE('" . $status_key . "', order_status) > 0 THEN '" . $status_name . "'";
313 - }
314 -
315 - $query = $wpdb->prepare("SELECT ID, meta.meta_value AS deco_id, DATE_FORMAT(order_date, %s) AS date, mem_id,
316 - CONCAT(order_name1, ' ', order_name2) AS name, order_pref AS pref, order_delivery_method AS delivery_method,
317 - (order_item_total_price - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax) AS total_price,
318 - order_payment_name AS payment_name,
319 - CASE WHEN LOCATE('noreceipt', order_status) > 0 THEN %s
320 - WHEN LOCATE('receipted', order_status) > 0 THEN %s
321 - WHEN LOCATE('pending', order_status) > 0 THEN %s
322 - ELSE %s
323 - END AS receipt_status,
324 - CASE {$status_sql}
325 - ELSE %s
326 - END AS order_status,
327 - order_modified
328 - FROM {$this->table}
329 - LEFT JOIN {$meta_table} AS meta ON ID = meta.order_id AND meta.meta_key = 'dec_order_id' ",
330 - '%Y-%m-%d %H:%i', __('unpaid', 'usces'), __('payment confirmed', 'usces'), __('Pending', 'usces'), '&nbsp;', __('new order', 'usces'));
331 -
332 - $query .= $where . $order;// . $limit;
333 -*/
334 - $select = '';
335 - foreach( $this->selectSql as $value ) {
336 - $select .= $value.", ";
337 - }
338 - $select = rtrim( $select, ", " );
339 - $join_table = '';
340 - foreach( $this->joinTableSql as $value ) {
341 - $join_table .= $value." ";
342 - }
343 - $query = "SELECT ".$select." FROM {$this->table} ".$join_table.$where.$order;
344 - $query = apply_filters( 'usces_filter_order_list_get_rows', $query, $this);
345 - //var_dump($query);
346 - $wpdb->show_errors();
347 -
348 - $rows = $wpdb->get_results($query, ARRAY_A);
349 - $this->selectedRow = count($rows);
350 -//20101202ysk start
351 - if($this->pageLimit == 'off') {
352 - $this->rows = (array)$rows;
353 - } else {
354 -//20101202ysk end
355 - $this->rows = array_slice((array)$rows, $this->startRow, $this->maxRow);
356 -//20101202ysk start
357 - }
358 -//20101202ysk end
359 -
360 - return $this->rows;
361 - }
362 -
363 - function SetTotalRow()
364 - {
365 - global $wpdb;
366 - $query = "SELECT COUNT(ID) AS ct FROM {$this->table}".apply_filters( 'usces_filter_order_list_sql_where', '' );
367 - $query = apply_filters( 'usces_filter_order_list_set_total_row', $query, $this);
368 - $res = $wpdb->get_var($query);
369 - $this->totalRow = $res;
370 - }
371 -
372 -/* function SetSelectedRow()
373 - {
374 - global $wpdb;
375 - $where = $this->GetWhere();
376 - $query = $wpdb->prepare("SELECT ID, DATE_FORMAT(order_date, %s) AS date, mem_id,
377 - CONCAT(order_name1, ' ', order_name2) AS name, order_pref AS pref, order_delivery_method AS delivery_method,
378 - (order_item_total_price - order_usedpoint + order_discount + order_shipping_charge + order_cod_fee + order_tax) AS total_price,
379 - order_payment_name AS payment_name,
380 - CASE WHEN LOCATE('noreceipt', order_status) > 0 THEN %s
381 - WHEN LOCATE('receipted', order_status) > 0 THEN %s
382 - ELSE %s
383 - END AS receipt_status,
384 - CASE WHEN LOCATE('estimate', order_status) > 0 THEN %s
385 - WHEN LOCATE('adminorder', order_status) > 0 THEN %s
386 - WHEN LOCATE('duringorder', order_status) > 0 THEN %s
387 - WHEN LOCATE('cancel', order_status) > 0 THEN %s
388 - WHEN LOCATE('completion', order_status) > 0 THEN %s
389 - ELSE %s
390 - END AS order_status,
391 - order_modified
392 - FROM {$this->table}",
393 - '%Y-%m-%d %H:%i', '未', '済', '&nbsp;', '見積り', '管理受注', '取り寄せ中', 'キャンセル', '発送済', '新規受付');
394 -
395 - $query .= $where;
396 - $rows = $wpdb->get_results($query, ARRAY_A);
397 - $this->selectedRow = count($rows);
398 -
399 - }*/
400 -
401 - function GetWhere()
402 - {
403 - $str = '';
404 - $thismonth = date('Y-m-01 00:00:00');
405 - $lastmonth = date('Y-m-01 00:00:00', mktime(0, 0, 0, date('m')-1, 1, date('Y')));
406 - $lastweek = date('Y-m-d 00:00:00', mktime(0, 0, 0, date('m'), date('d')-7, date('Y')));
407 - $last30 = date('Y-m-d 00:00:00', mktime(0, 0, 0, date('m'), date('d')-30, date('Y')));
408 - $last90 = date('Y-m-d 00:00:00', mktime(0, 0, 0, date('m'), date('d')-90, date('Y')));
409 - switch ( $this->arr_search['period'] ) {
410 - case 0:
411 - $str = " WHERE order_date >= '{$thismonth}'";
412 - break;
413 - case 1:
414 - $str = " WHERE order_date >= '{$lastmonth}' AND order_date < '{$thismonth}'";
415 - break;
416 - case 2:
417 - $str = " WHERE order_date >= '{$lastweek}'";
418 - break;
419 - case 3:
420 - $str = " WHERE order_date >= '{$last30}'";
421 - break;
422 - case 4:
423 - $str = " WHERE order_date >= '{$last90}'";
424 - break;
425 - case 5:
426 - $str = "";
427 - break;
428 - }
429 - $str = apply_filters( 'usces_filter_order_list_sql_where', $str );
430 - if( WCUtils::is_blank($str) && !WCUtils::is_blank($this->searchSql) ){
431 - $str = ' HAVING ' . $this->searchSql;
432 - }else if($str != '' && $this->searchSql != ''){
433 - $str .= ' HAVING ' . $this->searchSql;
434 - }
435 - return apply_filters( 'usces_filter_order_list_get_where', $str, $this );
436 - }
437 -
438 - function SearchIn()
439 - {
440 - switch ($this->arr_search['column']) {
441 - case 'ID':
442 - $column = 'ID';
443 - $this->searchSql = $column . ' = ' . (int)$this->arr_search['word']['ID'];
444 - break;
445 - case 'deco_id':
446 - $column = 'deco_id';
447 - $this->searchSql = $column . ' LIKE '."'%" . mysql_real_escape_string($this->arr_search['word']['deco_id']) . "%'";
448 - break;
449 - case 'date':
450 - $column = 'date';
451 - $this->searchSql = $column . ' LIKE '."'%" . mysql_real_escape_string($this->arr_search['word']['date']) . "%'";
452 - break;
453 - case 'mem_id':
454 - $column = 'mem_id';
455 - $this->searchSql = $column . ' = ' . (int)$this->arr_search['word']['mem_id'];
456 - break;
457 - case 'name':
458 - $column = 'name';
459 - $this->searchSql = $column . ' LIKE '."'%" . mysql_real_escape_string($this->arr_search['word']['name']) . "%'";
460 - break;
461 - case 'order_modified':
462 - $column = 'order_modified';
463 - $this->searchSql = $column . ' LIKE '."'%" . mysql_real_escape_string($this->arr_search['word']['order_modified']) . "%'";
464 - break;
465 - case 'pref':
466 - $column = 'pref';
467 - $this->searchSql = $column . " = '" . mysql_real_escape_string($this->arr_search['word']['pref']) . "'";
468 - break;
469 - case 'delivery_method':
470 - $column = 'delivery_method';
471 - $this->searchSql = $column . " = '" . mysql_real_escape_string($this->arr_search['word']['delivery_method']) . "'";
472 - break;
473 - case 'payment_name':
474 - $column = 'payment_name';
475 - $this->searchSql = $column . " = '" . mysql_real_escape_string($this->arr_search['word']['payment_name']) . "'";
476 - break;
477 - case 'receipt_status':
478 - $column = 'receipt_status';
479 - $this->searchSql = $column . " = '" . mysql_real_escape_string($this->arr_search['word']['receipt_status']) . "'";
480 - break;
481 - case 'order_status':
482 - $column = 'order_status';
483 - $this->searchSql = $column . " = '" . mysql_real_escape_string($this->arr_search['word']['order_status']) . "'";
484 - break;
485 - }
486 - }
487 -
488 - function SearchOut()
489 - {
490 - $this->searchSql = '';
491 - }
492 -
493 - function SetNavi()
494 - {
495 -
496 - $this->lastPage = ceil($this->selectedRow / $this->maxRow);
497 - $this->previousPage = ($this->currentPage - 1 == 0) ? 1 : $this->currentPage - 1;
498 - $this->nextPage = ($this->currentPage + 1 > $this->lastPage) ? $this->lastPage : $this->currentPage + 1;
499 -
500 - for($i=0; $i<$this->naviMaxButton; $i++){
501 - if($i > $this->lastPage-1) break;
502 - if($this->lastPage <= $this->naviMaxButton) {
503 - $box[] = $i+1;
504 - }else{
505 - if($this->currentPage <= 6) {
506 - $label = $i + 1;
507 - $box[] = $label;
508 - }else{
509 - $label = $i + 1 + $this->currentPage - 6;
510 - $box[] = $label;
511 - if($label == $this->lastPage) break;
512 - }
513 - }
514 - }
515 -
516 - $html = '';
517 - $html .= '<ul class="clearfix">'."\n";
518 - $html .= '<li class="rowsnum">' . $this->selectedRow . ' / ' . $this->totalRow . ' ' . __('cases', 'usces') . '</li>' . "\n";
519 - if(($this->currentPage == 1) || ($this->selectedRow == 0)){
520 - $html .= '<li class="navigationStr">first&lt;&lt;</li>' . "\n";
521 - $html .= '<li class="navigationStr">prev&lt;</li>'."\n";
522 - }else{
523 - $html .= '<li class="navigationStr"><a href="' . get_option('siteurl') . '/wp-admin/admin.php?page=usces_orderlist&changePage=1">first&lt;&lt;</a></li>' . "\n";
524 - $html .= '<li class="navigationStr"><a href="' . get_option('siteurl') . '/wp-admin/admin.php?page=usces_orderlist&changePage=' . $this->previousPage . '">prev&lt;</a></li>'."\n";
525 - }
526 - if($this->selectedRow > 0) {
527 - for($i=0; $i<count($box); $i++){
528 - if($box[$i] == $this->currentPage){
529 - $html .= '<li class="navigationButtonSelected">' . $box[$i] . '</li>'."\n";
530 - }else{
531 - $html .= '<li class="navigationButton"><a href="' . get_option('siteurl') . '/wp-admin/admin.php?page=usces_orderlist&changePage=' . $box[$i] . '">' . $box[$i] . '</a></li>'."\n";
532 - }
533 - }
534 - }
535 - if(($this->currentPage == $this->lastPage) || ($this->selectedRow == 0)){
536 - $html .= '<li class="navigationStr">&gt;next</li>'."\n";
537 - $html .= '<li class="navigationStr">&gt;&gt;last</li>'."\n";
538 - }else{
539 - $html .= '<li class="navigationStr"><a href="' . get_option('siteurl') . '/wp-admin/admin.php?page=usces_orderlist&changePage=' . $this->nextPage . '">&gt;next</a></li>'."\n";
540 - $html .= '<li class="navigationStr"><a href="' . get_option('siteurl') . '/wp-admin/admin.php?page=usces_orderlist&changePage=' . $this->lastPage . '">&gt;&gt;last</a></li>'."\n";
541 - }
542 - if($this->searchSwitchStatus == 'OFF'){
543 - $html .= '<li class="rowsnum"><a style="cursor:pointer;" id="searchVisiLink" onclick="toggleVisibility(\'searchBox\');">' . __('Show the Operation field', 'usces') . '</a>'."\n";
544 - }else{
545 - $html .= '<li class="rowsnum"><a style="cursor:pointer;" id="searchVisiLink" onclick="toggleVisibility(\'searchBox\');">' . __('hide the Operation field', 'usces') . '</a>'."\n";
546 - }
547 -
548 - $html .= '<li class="refresh"><a href="' . get_option('siteurl') . '/wp-admin/admin.php?page=usces_orderlist&refresh">' . __('updates it to latest information', 'usces') . '</a></li>' . "\n";
549 - $html .= '</ul>'."\n";
550 -
551 - $this->dataTableNavigation = $html;
552 - }
553 -
554 - function SetSESSION()
555 - {
556 -
557 - $_SESSION[$this->table]['startRow'] = $this->startRow; //表示開始行番号
558 - $_SESSION[$this->table]['sortColumn'] = $this->sortColumn; //現在ソート中のフィールド
559 - $_SESSION[$this->table]['totalRow'] = $this->totalRow; //全行数
560 - $_SESSION[$this->table]['selectedRow'] = $this->selectedRow; //絞り込まれた行数
561 - $_SESSION[$this->table]['currentPage'] = $this->currentPage; //現在のページNo
562 - $_SESSION[$this->table]['previousPage'] = $this->previousPage; //前のページNo
563 - $_SESSION[$this->table]['nextPage'] = $this->nextPage; //次のページNo
564 - $_SESSION[$this->table]['lastPage'] = $this->lastPage; //最終ページNo
565 - $_SESSION[$this->table]['userHeaderNames'] = $this->userHeaderNames;//全てのフィールド
566 - $_SESSION[$this->table]['headers'] = $this->headers;//表示するヘッダ文字列
567 - $_SESSION[$this->table]['rows'] = $this->rows; //表示する行オブジェクト
568 - $_SESSION[$this->table]['sortSwitchs'] = $this->sortSwitchs; //各フィールド毎の昇順降順スイッチ
569 - $_SESSION[$this->table]['dataTableNavigation'] = $this->dataTableNavigation;
570 - $_SESSION[$this->table]['searchSql'] = $this->searchSql;
571 - $_SESSION[$this->table]['arr_search'] = $this->arr_search;
572 - $_SESSION[$this->table]['searchSwitchStatus'] = $this->searchSwitchStatus;
573 - }
574 -
575 - function SetHeaders()
576 - {
577 - foreach ($this->columns as $key => $value){
578 - if($value == $this->sortColumn){
579 - if($this->sortSwitchs[$value] == 'ASC'){
580 - $str = __('[ASC]', 'usces');
581 - $switch = 'DESC';
582 - }else{
583 - $str = __('[DESC]', 'usces');
584 - $switch = 'ASC';
585 - }
586 - $this->headers[$value] = '<a href="' . get_option('siteurl') . '/wp-admin/admin.php?page=usces_orderlist&changeSort=' . $value . '&switch=' . $switch . '"><span class="sortcolumn">' . $key . ' ' . $str . '</span></a>';
587 - }else{
588 - $switch = $this->sortSwitchs[$value];
589 - $this->headers[$value] = '<a href="' . get_option('siteurl') . '/wp-admin/admin.php?page=usces_orderlist&changeSort=' . $value . '&switch=' . $switch . '"><span>' . $key . '</span></a>';
590 - }
591 - }
592 - //$this->headers = array_keys($this->columns);
593 - }
594 -
595 - function GetSearchs()
596 - {
597 - return $this->arr_search;
598 - }
599 -
600 - function GetListheaders()
601 - {
602 - return $this->headers;
603 - }
604 -
605 - function GetDataTableNavigation()
606 - {
607 - return $this->dataTableNavigation;
608 - }
609 -
610 - function set_action_status($status, $message)
611 - {
612 - $this->action_status = $status;
613 - $this->action_message = $message;
614 - }
615 - function get_action_status()
616 - {
617 - return $this->action_status;
618 - }
619 - function get_action_message()
620 - {
621 - return $this->action_message;
622 - }
623 -}
624 -
625 -
626 -?>
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 +}