| 1 |
<?php |
| 2 |
global $usces_settings; |
| 3 |
|
| 4 |
require_once( USCES_PLUGIN_DIR . "/classes/memberList.class.php" ); |
| 5 |
$csmb_meta = usces_has_custom_field_meta('member'); |
| 6 |
$DT = new WlcMemberList(); |
| 7 |
$arr_column = $DT->get_column(); |
| 8 |
$res = $DT->MakeTable(); |
| 9 |
$arr_search = $DT->GetSearchs(); |
| 10 |
$arr_header = $DT->GetListheaders(); |
| 11 |
$dataTableNavigation = $DT->GetDataTableNavigation(); |
| 12 |
$rows = $DT->rows; |
| 13 |
$status = apply_filters( 'usces_member_list_action_status', $DT->get_action_status() ); |
| 14 |
$message = apply_filters( 'usces_member_list_action_message', $DT->get_action_message() ); |
| 15 |
|
| 16 |
$usces_admin_path = ''; |
| 17 |
$admin_perse = explode('/', $_SERVER['REQUEST_URI']); |
| 18 |
$apct = count($admin_perse) - 1; |
| 19 |
for($ap=0; $ap < $apct; $ap++){ |
| 20 |
$usces_admin_path .= $admin_perse[$ap] . '/'; |
| 21 |
} |
| 22 |
$list_option = get_option( 'usces_memberlist_option' ); |
| 23 |
$usces_opt_member = get_option('usces_opt_member'); |
| 24 |
$usces_opt_member = apply_filters( 'usces_filter_opt_member', $usces_opt_member ); |
| 25 |
$chk_mem = ( isset( $usces_opt_member['chk_mem'] ) ) ? $usces_opt_member['chk_mem'] : array(); |
| 26 |
$applyform = usces_get_apply_addressform($this->options['system']['addressform']); |
| 27 |
$member_status = $this->member_status; |
| 28 |
$member_country = $usces_settings['country']; |
| 29 |
$curent_url = urlencode(esc_url(USCES_ADMIN_URL . '?' . $_SERVER['QUERY_STRING'])); |
| 30 |
|
| 31 |
$member_list_delete_link = ( isset( $this->options['system']['member_list_delete_link'] ) ) ? $this->options['system']['member_list_delete_link'] : 0; |
| 32 |
|
| 33 |
?> |
| 34 |
<div class="wrap"> |
| 35 |
<div class="usces_admin"> |
| 36 |
<h1>Welcart Management <?php _e('List of Members','usces'); ?></h1> |
| 37 |
<p class="version_info">Version <?php echo USCES_VERSION; ?></p> |
| 38 |
<?php usces_admin_action_status( $status, $message ); ?> |
| 39 |
|
| 40 |
<?php do_action( 'usces_action_member_list_header' ); ?> |
| 41 |
|
| 42 |
<form action="<?php echo USCES_ADMIN_URL.'?page=usces_memberlist'; ?>" method="post" name="tablesearch" id="form_tablesearch"> |
| 43 |
<div id="datatable"> |
| 44 |
<div class="usces_tablenav usces_tablenav_top"> |
| 45 |
<?php wel_esc_script_e( $dataTableNavigation ); ?> |
| 46 |
<div id="searchVisiLink" class="screen-field"><?php _e('Show the Operation field', 'usces'); ?><span class="dashicons dashicons-arrow-down"></span></div> |
| 47 |
<?php |
| 48 |
$url = admin_url( 'admin.php?page=usces_memberlist&refresh' ); |
| 49 |
$nonce_url = wp_nonce_url( $url, 'member_list', 'wc_nonce' ); |
| 50 |
?> |
| 51 |
<div class="refresh"><a href="<?php echo esc_url( $nonce_url ); ?>"><span class="dashicons dashicons-update"></span><?php _e('updates it to latest information', 'usces'); ?></a></div> |
| 52 |
</div> |
| 53 |
|
| 54 |
<div id="tablesearch" class="usces_tablesearch"> |
| 55 |
<div id="searchBox"> |
| 56 |
<table class="search_table"> |
| 57 |
<tr> |
| 58 |
<td class="label"><?php _e( 'Member Search', 'usces' ); ?></td> |
| 59 |
<td> |
| 60 |
<div class="member_search_item search_item"> |
| 61 |
<p class="search_item_label"><?php _e('From member information', 'usces'); ?></p> |
| 62 |
<p> |
| 63 |
<select name="search[member_column][0]" id="searchmemberselect_0" class="searchselect"> |
| 64 |
<option value=""> </option> |
| 65 |
<?php foreach ((array)$arr_column as $key => $value): |
| 66 |
if( 'csod_' == substr($key, 0, 5) ) |
| 67 |
continue; |
| 68 |
|
| 69 |
if($key == $arr_search['member_column'][0]){ |
| 70 |
$selected = ' selected="selected"'; |
| 71 |
}else{ |
| 72 |
$selected = ''; |
| 73 |
} |
| 74 |
?> |
| 75 |
<option value="<?php echo esc_attr( $key ); ?>"<?php echo esc_attr( $selected ); ?>><?php echo esc_html( $value ); ?></option> |
| 76 |
<?php endforeach; ?> |
| 77 |
</select> |
| 78 |
<span id="searchmemberword_0"> |
| 79 |
<input name="search[member_word][0]" type="text" value="<?php echo esc_attr($arr_search['member_word'][0]); ?>" class="regular-text" maxlength="50" /> |
| 80 |
<select name="search[member_word_term][0]" class="termselect"> |
| 81 |
<option value="contain"<?php echo ( 'contain' == $arr_search['member_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('Contain', 'usces'); ?></option> |
| 82 |
<option value="notcontain"<?php echo ( 'notcontain' == $arr_search['member_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('Not Contain', 'usces'); ?></option> |
| 83 |
<option value="equal"<?php echo ( 'equal' == $arr_search['member_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('Equal', 'usces'); ?></option> |
| 84 |
<option value="morethan"<?php echo ( 'morethan' == $arr_search['member_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('More than', 'usces'); ?></option> |
| 85 |
<option value="lessthan"<?php echo ( 'lessthan' == $arr_search['member_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('Less than', 'usces'); ?></option> |
| 86 |
</select> |
| 87 |
</span> |
| 88 |
</p> |
| 89 |
<p> |
| 90 |
<select name="search[member_term]" class="termselect"> |
| 91 |
<option value="AND">AND</option> |
| 92 |
<option value="OR"<?php echo ( 'OR' == $arr_search['member_term'] ? ' selected="selected"' : ''); ?>>OR</option> |
| 93 |
</select> |
| 94 |
</p> |
| 95 |
<p> |
| 96 |
<select name="search[member_column][1]" id="searchmemberselect_1" class="searchselect"> |
| 97 |
<option value=""> </option> |
| 98 |
<?php foreach ((array)$arr_column as $key => $value): |
| 99 |
if( 'csod_' == substr($key, 0, 5) ) |
| 100 |
continue; |
| 101 |
|
| 102 |
if($key == $arr_search['member_column'][1]){ |
| 103 |
$selected = ' selected="selected"'; |
| 104 |
}else{ |
| 105 |
$selected = ''; |
| 106 |
} |
| 107 |
?> |
| 108 |
<option value="<?php echo esc_attr( $key ); ?>"<?php echo esc_attr( $selected ); ?>><?php echo esc_html( $value ); ?></option> |
| 109 |
<?php endforeach; ?> |
| 110 |
</select> |
| 111 |
<span id="searchmemberword_1"> |
| 112 |
<input name="search[member_word][1]" type="text" value="<?php echo esc_attr($arr_search['member_word'][1]); ?>" class="regular-text" maxlength="50" /> |
| 113 |
<select name="search[member_word_term][1]" class="termselect"> |
| 114 |
<option value="contain"<?php echo ( 'contain' == $arr_search['member_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('Contain', 'usces'); ?></option> |
| 115 |
<option value="notcontain"<?php echo ( 'notcontain' == $arr_search['member_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('Not Contain', 'usces'); ?></option> |
| 116 |
<option value="equal"<?php echo ( 'equal' == $arr_search['member_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('Equal', 'usces'); ?></option> |
| 117 |
<option value="morethan"<?php echo ( 'morethan' == $arr_search['member_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('More than', 'usces'); ?></option> |
| 118 |
<option value="lessthan"<?php echo ( 'lessthan' == $arr_search['member_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('Less than', 'usces'); ?></option> |
| 119 |
</select> |
| 120 |
</span> |
| 121 |
</p> |
| 122 |
</div> |
| 123 |
<div class="search_separate">AND</div> |
| 124 |
<div class="order_search_item search_item"> |
| 125 |
<p class="search_item_label"><?php _e('From order information', 'usces'); ?></p> |
| 126 |
<p> |
| 127 |
<select name="search[order_column][0]" id="searchorderselect_0" class="searchselect"> |
| 128 |
<option value=""> </option> |
| 129 |
<?php foreach ((array)$arr_column as $key => $value): |
| 130 |
if( 'csod_' != substr($key, 0, 5) ) |
| 131 |
continue; |
| 132 |
|
| 133 |
if($key == $arr_search['order_column'][0]){ |
| 134 |
$selected = ' selected="selected"'; |
| 135 |
}else{ |
| 136 |
$selected = ''; |
| 137 |
} |
| 138 |
?> |
| 139 |
<option value="<?php echo esc_attr( $key ); ?>"<?php echo esc_attr( $selected ); ?>><?php echo esc_html( $value ); ?></option> |
| 140 |
<?php endforeach; ?> |
| 141 |
<option value="item_code"<?php echo( 'item_code' == $arr_search['order_column'][0] ? ' selected="selected"' : ''); ?>><?php _e('item code', 'usces' ); ?></option> |
| 142 |
<option value="item_name"<?php echo( 'item_name' == $arr_search['order_column'][0] ? ' selected="selected"' : ''); ?>><?php _e('item name', 'usces' ); ?></option> |
| 143 |
<option value="sku_code"<?php echo( 'sku_code' == $arr_search['order_column'][0] ? ' selected="selected"' : ''); ?>><?php _e('SKU code', 'usces' ); ?></option> |
| 144 |
<option value="sku_name"<?php echo( 'sku_name' == $arr_search['order_column'][0] ? ' selected="selected"' : ''); ?>><?php _e('SKU name', 'usces' ); ?></option> |
| 145 |
|
| 146 |
|
| 147 |
</select> |
| 148 |
<span id="searchorderword_0"> |
| 149 |
<input name="search[order_word][0]" type="text" value="<?php echo esc_attr($arr_search['order_word'][0]); ?>" class="regular-text" maxlength="50" /> |
| 150 |
<select name="search[order_word_term][0]" class="termselect"> |
| 151 |
<option value="contain"<?php echo ( 'contain' == $arr_search['order_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('Contain', 'usces'); ?></option> |
| 152 |
<option value="notcontain"<?php echo ( 'notcontain' == $arr_search['order_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('Not Contain', 'usces'); ?></option> |
| 153 |
<option value="equal"<?php echo ( 'equal' == $arr_search['order_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('Equal', 'usces'); ?></option> |
| 154 |
<option value="morethan"<?php echo ( 'morethan' == $arr_search['order_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('More than', 'usces'); ?></option> |
| 155 |
<option value="lessthan"<?php echo ( 'lessthan' == $arr_search['order_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('Less than', 'usces'); ?></option> |
| 156 |
</select> |
| 157 |
</span> |
| 158 |
</p> |
| 159 |
<p> |
| 160 |
<select name="search[order_term]" class="termselect"> |
| 161 |
<option value="AND">AND</option> |
| 162 |
<option value="OR"<?php echo ( 'OR' == $arr_search['order_term'] ? ' selected="selected"' : ''); ?>>OR</option> |
| 163 |
</select> |
| 164 |
</p> |
| 165 |
<p> |
| 166 |
<select name="search[order_column][1]" id="searchorderselect_1" class="searchselect"> |
| 167 |
<option value=""> </option> |
| 168 |
<?php foreach ((array)$arr_column as $key => $value): |
| 169 |
if( 'csod_' != substr($key, 0, 5) ) |
| 170 |
continue; |
| 171 |
|
| 172 |
if($key == $arr_search['order_column'][1]){ |
| 173 |
$selected = ' selected="selected"'; |
| 174 |
}else{ |
| 175 |
$selected = ''; |
| 176 |
} |
| 177 |
?> |
| 178 |
<option value="<?php echo esc_attr( $key ); ?>"<?php echo esc_attr( $selected ); ?>><?php echo esc_html( $value ); ?></option> |
| 179 |
<?php endforeach; ?> |
| 180 |
<option value="item_code"<?php echo( 'item_code' == $arr_search['order_column'][1] ? ' selected="selected"' : ''); ?>><?php _e('item code', 'usces' ); ?></option> |
| 181 |
<option value="item_name"<?php echo( 'item_name' == $arr_search['order_column'][1] ? ' selected="selected"' : ''); ?>><?php _e('item name', 'usces' ); ?></option> |
| 182 |
<option value="sku_code"<?php echo( 'sku_code' == $arr_search['order_column'][1] ? ' selected="selected"' : ''); ?>><?php _e('SKU code', 'usces' ); ?></option> |
| 183 |
<option value="sku_name"<?php echo( 'sku_name' == $arr_search['order_column'][1] ? ' selected="selected"' : ''); ?>><?php _e('SKU name', 'usces' ); ?></option> |
| 184 |
|
| 185 |
</select> |
| 186 |
<span id="searchorderword_1"> |
| 187 |
<input name="search[order_word][1]" type="text" value="<?php echo esc_attr($arr_search['order_word'][1]); ?>" class="regular-text" maxlength="50" /> |
| 188 |
<select name="search[order_word_term][1]" class="termselect"> |
| 189 |
<option value="contain"<?php echo ( 'contain' == $arr_search['order_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('Contain', 'usces'); ?></option> |
| 190 |
<option value="notcontain"<?php echo ( 'notcontain' == $arr_search['order_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('Not Contain', 'usces'); ?></option> |
| 191 |
<option value="equal"<?php echo ( 'equal' == $arr_search['order_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('Equal', 'usces'); ?></option> |
| 192 |
<option value="morethan"<?php echo ( 'morethan' == $arr_search['order_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('More than', 'usces'); ?></option> |
| 193 |
<option value="lessthan"<?php echo ( 'lessthan' == $arr_search['order_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('Less than', 'usces'); ?></option> |
| 194 |
</select> |
| 195 |
</span> |
| 196 |
</p> |
| 197 |
</div> |
| 198 |
<div class="search_submit"> |
| 199 |
<input name="searchIn" type="submit" class="button button-primary" value="<?php _e('Search', 'usces'); ?>" /> |
| 200 |
<input name="searchOut" type="submit" class="button" value="<?php _e('Cancellation', 'usces'); ?>" /> |
| 201 |
</div> |
| 202 |
</td> |
| 203 |
</tr> |
| 204 |
<tr> |
| 205 |
<td class="label"><?php _e( 'Oparation in bulk', 'usces' ); ?></td> |
| 206 |
<td id="change_list_table"> |
| 207 |
<div> |
| 208 |
<select name="allchange[column]" class="searchselect" id="changeselect"> |
| 209 |
<option value=""> </option> |
| 210 |
<option value="rank"><?php _e('Rank', 'usces'); ?></option> |
| 211 |
<option value="point"><?php _e('Points', 'usces'); ?></option> |
| 212 |
<option value="delete"><?php _e('Delete in bulk', 'usces'); ?></option> |
| 213 |
</select> |
| 214 |
<span id="changefield"></span> |
| 215 |
<input name="collective_change_member" type="button" class="button" id="collective_change_member" value="<?php _e('Run updating', 'usces'); ?>" /> |
| 216 |
<input name="collective" id="memberlistaction" type="hidden" /> |
| 217 |
</div> |
| 218 |
</td> |
| 219 |
</tr> |
| 220 |
<tr> |
| 221 |
<td class="label"><?php _e( 'Action', 'usces' ); ?></td> |
| 222 |
<td id="dl_list_table"> |
| 223 |
<div class="action_button"> |
| 224 |
<input type="button" id="dl_memberlist" class="button" value="<?php _e('Download Member List', 'usces'); ?>" /> |
| 225 |
<?php do_action( 'usces_action_dl_member_list_table' ); ?> |
| 226 |
</div> |
| 227 |
</td> |
| 228 |
</tr> |
| 229 |
</table> |
| 230 |
</div><!-- searchBox --> |
| 231 |
<?php do_action( 'usces_action_member_list_searchbox' ); ?> |
| 232 |
</div><!-- tablesearch --> |
| 233 |
|
| 234 |
<table id="mainDataTable" class="new-table member-new-table"> |
| 235 |
<?php |
| 236 |
$list_header = '<th scope="col"><input name="allcheck" type="checkbox" value="" /></th>'; |
| 237 |
foreach ( (array)$arr_header as $htkey => $value ){ |
| 238 |
if( 'ID' != $htkey && (isset($list_option['view_column'][$htkey]) && !$list_option['view_column'][$htkey]) ) |
| 239 |
continue; |
| 240 |
|
| 241 |
$list_header .= '<th scope="col">' . $value . '</th>'; |
| 242 |
} |
| 243 |
|
| 244 |
$usces_serchorder_column = array( 'item_code', 'item_name', 'sku_code', 'sku_name' ); |
| 245 |
if( in_array( $arr_search['order_column'][0], $usces_serchorder_column ) || in_array( $arr_search['order_column'][1], $usces_serchorder_column ) ){ |
| 246 |
$list_header .= '<th scope="col">' . __('item code', 'usces' ) . '</th>' . "\n"; |
| 247 |
$list_header .= '<th scope="col">' . __('item name', 'usces' ) . '</th>' . "\n"; |
| 248 |
$list_header .= '<th scope="col">' . __('SKU code', 'usces' ) . '</th>' . "\n"; |
| 249 |
$list_header .= '<th scope="col">' . __('SKU name', 'usces' ) . '</th>' . "\n"; |
| 250 |
} |
| 251 |
|
| 252 |
if ( $member_list_delete_link ) { |
| 253 |
$list_header .= '<th scope="col"> </th>'; |
| 254 |
} |
| 255 |
|
| 256 |
?> |
| 257 |
<thead> |
| 258 |
<tr> |
| 259 |
<?php echo apply_filters('usces_filter_memberlist_header', $list_header, $arr_header); ?> |
| 260 |
</tr> |
| 261 |
</thead> |
| 262 |
|
| 263 |
<?php |
| 264 |
foreach ( (array)$rows as $array ) : |
| 265 |
|
| 266 |
$list_detail = '<td align="center"><input name="listcheck[]" type="checkbox" value="' . esc_attr($array['ID']) . '" /></td>'; |
| 267 |
|
| 268 |
foreach ( (array)$array as $key => $value ){ |
| 269 |
if( 'ID' != $key && (isset($list_option['view_column'][$key]) && !$list_option['view_column'][$key]) ) |
| 270 |
continue; |
| 271 |
|
| 272 |
if( 'meta_value' == $key ) |
| 273 |
continue; |
| 274 |
|
| 275 |
if( !in_array( $arr_search['order_column'][0], $usces_serchorder_column ) && !in_array( $arr_search['order_column'][1], $usces_serchorder_column ) ){ |
| 276 |
if( in_array( $key, $usces_serchorder_column ) ) |
| 277 |
continue; |
| 278 |
} |
| 279 |
|
| 280 |
if( WCUtils::is_blank($value) ) |
| 281 |
$value = ' '; |
| 282 |
|
| 283 |
if( 'csmb_' == substr($key, 0, 5) ){ |
| 284 |
$multi_value = wel_safe_maybe_unserialize($value); |
| 285 |
if( is_array($multi_value) ){ |
| 286 |
$value = ''; |
| 287 |
foreach( $multi_value as $str ){ |
| 288 |
$value .= $str . ' '; |
| 289 |
} |
| 290 |
trim($value); |
| 291 |
} |
| 292 |
} |
| 293 |
|
| 294 |
$detail = ''; |
| 295 |
switch( $key ){ |
| 296 |
|
| 297 |
case 'ID': |
| 298 |
$detail = '<td><a href="' . USCES_ADMIN_URL . '?page=usces_memberlist&member_action=edit&member_id=' . $value . '&wc_nonce=' . wp_create_nonce( 'member_list' ) . '">' . $value . '</a></td>'; |
| 299 |
break; |
| 300 |
|
| 301 |
case 'rank': |
| 302 |
$detail = '<td>' . esc_html($member_status[$value]) . '</td>'; |
| 303 |
break; |
| 304 |
|
| 305 |
case 'point': |
| 306 |
$detail = '<td class="right">' . esc_html($value) . '</td>'; |
| 307 |
break; |
| 308 |
|
| 309 |
case 'pref': |
| 310 |
if( $value == __('-- Select --','usces') || $value == '-- Select --' ) { |
| 311 |
$detail = '<td> </td>'; |
| 312 |
} else { |
| 313 |
$detail = '<td>'.esc_html($value).'</td>'; |
| 314 |
} |
| 315 |
break; |
| 316 |
|
| 317 |
default: |
| 318 |
$detail = '<td>' . esc_html($value) . '</td>'; |
| 319 |
break; |
| 320 |
} |
| 321 |
|
| 322 |
$list_detail .= apply_filters( 'usces_filter_memberlist_detail_value', $detail, $value, $key, $array['ID'] ); |
| 323 |
|
| 324 |
} |
| 325 |
|
| 326 |
if ( $member_list_delete_link ) { |
| 327 |
$list_detail .= '<td><a href="' . USCES_ADMIN_URL . '?page=usces_memberlist&member_action=delete&member_id=' . $array['ID'] . '&wc_nonce=' . wp_create_nonce( 'delete_member' ) . '" onclick="return deleteconfirm(\'' . $array['ID'] . '\');"><span style="color:#FF0000; font-size:9px;">' . __('Delete', 'usces') . '</span></a></td>'; |
| 328 |
} |
| 329 |
?> |
| 330 |
<tbody> |
| 331 |
<tr<?php echo apply_filters('usces_filter_memberlist_detail_trclass', '', $array); ?>> |
| 332 |
<?php echo apply_filters('usces_filter_memberlist_detail', $list_detail, $array, $curent_url); ?> |
| 333 |
</tr> |
| 334 |
</tbody> |
| 335 |
<?php |
| 336 |
endforeach; |
| 337 |
?> |
| 338 |
</table> |
| 339 |
<?php wp_nonce_field( 'member_list', 'wc_nonce' ); ?> |
| 340 |
|
| 341 |
|
| 342 |
<div class="usces_tablenav usces_tablenav_bottom" ><?php wel_esc_script_e( $dataTableNavigation ); ?></div> |
| 343 |
|
| 344 |
</div><!-- datatable --> |
| 345 |
|
| 346 |
</form> |
| 347 |
|
| 348 |
<div id="dlMemberListDialog" title="<?php _e('Download Member List', 'usces'); ?>"> |
| 349 |
<p><?php _e('Select the item you want, please press the download.', 'usces'); ?></p> |
| 350 |
<fieldset> |
| 351 |
<input type="button" class="button" id="dl_mem" value="<?php _e('Download', 'usces'); ?>" /> |
| 352 |
</fieldset> |
| 353 |
<fieldset><legend><?php _e('Membership information', 'usces'); ?></legend> |
| 354 |
<?php |
| 355 |
foreach( $arr_column as $key => $label ){ |
| 356 |
if( 'csod_' == substr($key, 0, 5) ) |
| 357 |
continue; |
| 358 |
?> |
| 359 |
<label for="chk_mem[<?php echo esc_attr( $key ); ?>]"><input type="checkbox" class="check_member" id="chk_mem[<?php echo esc_attr( $key ); ?>]" value="<?php echo esc_attr( $key ); ?>"<?php usces_checked( $chk_mem, $key ); ?>/><?php echo esc_html( $label ); ?></label> |
| 360 |
<?php |
| 361 |
} |
| 362 |
?> |
| 363 |
<?php do_action( 'usces_action_chk_mem', $chk_mem ); ?> |
| 364 |
</fieldset> |
| 365 |
</div> |
| 366 |
|
| 367 |
<?php do_action( 'usces_action_member_list_footer' ); ?> |
| 368 |
|
| 369 |
</div><!--usces_admin--> |
| 370 |
</div><!--wrap--> |
| 371 |
<script type="text/javascript"> |
| 372 |
function deleteconfirm(member_id){ |
| 373 |
if(confirm(<?php _e("'Are you sure of deleting your membership number ' + member_id + ' ?'", 'usces'); ?>)){ |
| 374 |
return true; |
| 375 |
}else{ |
| 376 |
return false; |
| 377 |
} |
| 378 |
} |
| 379 |
|
| 380 |
jQuery(document).ready(function($){ |
| 381 |
$('table#mainDataTable tbody input[type=checkbox]').change( |
| 382 |
function() { |
| 383 |
$('input').closest('tbody').removeClass('select'); |
| 384 |
$(':checked').closest('tbody').addClass('select'); |
| 385 |
} |
| 386 |
).trigger('change'); |
| 387 |
|
| 388 |
$("#searchVisiLink").click(function() { |
| 389 |
if ( $("#searchBox").css("display") != "block" ){ |
| 390 |
$("#searchBox").slideDown(300); |
| 391 |
$("#searchVisiLink").html('<?php _e('Hide the Operation field', 'usces'); ?><span class="dashicons dashicons-arrow-up"></span>'); |
| 392 |
$.cookie("memberSearchBox", 1, { path: "<?php wel_esc_script_e( $usces_admin_path ); ?>", domain: ""}) == true; |
| 393 |
}else{ |
| 394 |
$("#searchBox").slideUp(300); |
| 395 |
$("#searchVisiLink").html('<?php _e('Show the Operation field', 'usces'); ?><span class="dashicons dashicons-arrow-down"></span>'); |
| 396 |
$.cookie("memberSearchBox", 0, { path: "<?php wel_esc_script_e( $usces_admin_path ); ?>", domain: ""}) == true; |
| 397 |
} |
| 398 |
}); |
| 399 |
|
| 400 |
(function setCookie() { |
| 401 |
<?php |
| 402 |
$data_cookie = []; |
| 403 |
$data_cookie['placeholder_escape'] = $DT->placeholder_escape; |
| 404 |
$data_cookie['startRow'] = $DT->startRow; //表示開始行番号 |
| 405 |
$data_cookie['sortColumn'] = $DT->sortColumn; //現在ソート中のフィールド |
| 406 |
$data_cookie['totalRow'] = $DT->totalRow; //� |
| 407 |
�行数 |
| 408 |
$data_cookie['selectedRow'] = $DT->selectedRow; //絞り込まれた行数 |
| 409 |
$data_cookie['currentPage'] = $DT->currentPage; //現在のページNo |
| 410 |
$data_cookie['previousPage'] = $DT->previousPage; //前のページNo |
| 411 |
$data_cookie['nextPage'] = $DT->nextPage; //次のページNo |
| 412 |
$data_cookie['lastPage'] = $DT->lastPage; //最終ページNo |
| 413 |
$data_cookie['userHeaderNames'] = $DT->userHeaderNames;//� |
| 414 |
�てのフィールド |
| 415 |
$data_cookie['sortSwitchs'] = $DT->sortSwitchs; //各フィールド毎の昇順降順スイッチ |
| 416 |
$data_cookie['arr_search'] = $DT->arr_search; |
| 417 |
?> |
| 418 |
$.cookie('<?php echo "{$DT->table}" . "_path"?>', '<?php wel_esc_script_e( $usces_admin_path ); ?>', { path: "<?php wel_esc_script_e( $usces_admin_path ); ?>", domain: ""}); |
| 419 |
$.cookie('<?php echo "{$DT->table}"?>', '<?php echo str_replace("'", "\'",json_encode($data_cookie)) ; ?>', { path: "<?php wel_esc_script_e( $usces_admin_path ); ?>", domain: ""}); |
| 420 |
// save list current_page_ids to localStorage. |
| 421 |
window.localStorage.setItem('wel_member_current_page_ids', <?php echo wp_json_encode( $DT->currentPageIds ); ?>); |
| 422 |
})(); |
| 423 |
|
| 424 |
$("#dlMemberListDialog").dialog({ |
| 425 |
bgiframe: true, |
| 426 |
autoOpen: false, |
| 427 |
height: 400, |
| 428 |
width: 700, |
| 429 |
resizable: true, |
| 430 |
modal: true, |
| 431 |
buttons: { |
| 432 |
'<?php _e('close', 'usces'); ?>': function() { |
| 433 |
$(this).dialog('close'); |
| 434 |
} |
| 435 |
}, |
| 436 |
close: function() { |
| 437 |
} |
| 438 |
}); |
| 439 |
$('#dl_mem').click(function() { |
| 440 |
var listcheck = []; |
| 441 |
$("input[name='listcheck[]']:checked").each(function() { |
| 442 |
listcheck.push($(this).val()); |
| 443 |
}); |
| 444 |
|
| 445 |
var form = $('<form>', { |
| 446 |
action: "<?php echo USCES_ADMIN_URL; ?>?page=usces_memberlist&member_action=dlmembernewlist&noheader=true", |
| 447 |
method: 'post' |
| 448 |
}); |
| 449 |
form.append($('<input>', { type: 'hidden', name: 'search[column]', value: $(':input[name="search[column]"]').val() })); |
| 450 |
form.append($('<input>', { type: 'hidden', name: 'search[word]', value: $(':input[name="search[word]"]').val() })); |
| 451 |
form.append($('<input>', { type: 'hidden', name: 'ftype', value: 'csv' })); |
| 452 |
form.append($('<input>', { type: 'hidden', name: 'wc_nonce', value: $("#wc_nonce").val() })); |
| 453 |
|
| 454 |
$('*[class=check_member]').each(function() { |
| 455 |
if($(this).prop('checked')) { |
| 456 |
form.append($('<input>', { type: 'hidden', name: 'check['+$(this).val()+']', value: 'on' })); |
| 457 |
} |
| 458 |
}); |
| 459 |
|
| 460 |
if (listcheck.length > 0) { |
| 461 |
form.append($('<input>', { type: 'hidden', name: 'listcheck', value: listcheck.join(',') })); |
| 462 |
} |
| 463 |
|
| 464 |
form.appendTo('body').submit().remove(); |
| 465 |
}); |
| 466 |
$('#dl_memberlist').click(function() { |
| 467 |
$('#dlMemberListDialog').dialog('open'); |
| 468 |
}); |
| 469 |
|
| 470 |
if ($.cookie("memberSearchBox") == true){ |
| 471 |
$("#searchVisiLink").html('<?php _e('Hide the Operation field', 'usces'); ?><span class="dashicons dashicons-arrow-up"></span>'); |
| 472 |
$("#searchBox").show(); |
| 473 |
}else if ($.cookie("memberSearchBox") == false){ |
| 474 |
$("#searchVisiLink").html('<?php _e('Show the Operation field', 'usces'); ?><span class="dashicons dashicons-arrow-down"></span>'); |
| 475 |
$("#searchBox").hide(); |
| 476 |
} |
| 477 |
|
| 478 |
$("input[name='allcheck']").click(function () { |
| 479 |
if( $(this).prop("checked") ){ |
| 480 |
$("input[name*='listcheck']").prop({checked: true}); |
| 481 |
}else{ |
| 482 |
$("input[name*='listcheck']").prop({checked: false}); |
| 483 |
} |
| 484 |
}); |
| 485 |
|
| 486 |
operation = { |
| 487 |
change_member_search_field_0 :function (is_change = true){ |
| 488 |
|
| 489 |
var html = ''; |
| 490 |
var column = $("#searchmemberselect_0").val(); |
| 491 |
|
| 492 |
if( column == 'rank' ) { |
| 493 |
|
| 494 |
html = '<select name="search[member_word][0]" class="searchselect">'; |
| 495 |
<?php |
| 496 |
foreach((array)$member_status as $dkey => $dvalue){ |
| 497 |
if( isset($arr_search['member_word'][0]) && $dkey == $arr_search['member_word'][0]){ |
| 498 |
$dselected = ' selected="selected"'; |
| 499 |
}else{ |
| 500 |
$dselected = ''; |
| 501 |
} |
| 502 |
?> |
| 503 |
html += '<option value="<?php echo esc_attr( $dkey ); ?>"<?php echo esc_attr( $dselected ); ?>><?php echo esc_html( $dvalue ); ?></option>'; |
| 504 |
<?php |
| 505 |
} |
| 506 |
?> |
| 507 |
html += '</select>'; |
| 508 |
|
| 509 |
}else if( column == 'country' ) { |
| 510 |
|
| 511 |
html = '<select name="search[member_word][0]" class="searchselect">'; |
| 512 |
<?php |
| 513 |
foreach((array)$member_country as $dkey => $dvalue){ |
| 514 |
if( isset($arr_search['member_word'][0]) && $dkey == $arr_search['member_word'][0]){ |
| 515 |
$dselected = ' selected="selected"'; |
| 516 |
}else{ |
| 517 |
$dselected = ''; |
| 518 |
} |
| 519 |
?> |
| 520 |
html += '<option value="<?php echo esc_attr( $dkey ); ?>"<?php echo esc_attr( $dselected ); ?>><?php echo esc_html( $dvalue ); ?></option>'; |
| 521 |
<?php |
| 522 |
} |
| 523 |
?> |
| 524 |
html += '</select>'; |
| 525 |
|
| 526 |
}else{ |
| 527 |
|
| 528 |
html = '<input name="search[member_word][0]" type="text" value="'+ (!is_change ? "<?php echo esc_attr($arr_search['member_word'][0]); ?>" : '') +'" class="regular-text" maxlength="50" />'; |
| 529 |
html += '<select name="search[member_word_term][0]" class="termselect">'; |
| 530 |
html += '<option value="contain"<?php echo ( 'contain' == $arr_search['member_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('Contain', 'usces'); ?></option>'; |
| 531 |
html += '<option value="notcontain"<?php echo ( 'notcontain' == $arr_search['member_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('Not Contain', 'usces'); ?></option>'; |
| 532 |
html += '<option value="equal"<?php echo ( 'equal' == $arr_search['member_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('Equal', 'usces'); ?></option>'; |
| 533 |
html += '<option value="morethan"<?php echo ( 'morethan' == $arr_search['member_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('More than', 'usces'); ?></option>'; |
| 534 |
html += '<option value="lessthan"<?php echo ( 'lessthan' == $arr_search['member_word_term'][0] ? ' selected="selected"' : ''); ?>><?php _e('Less than', 'usces'); ?></option>'; |
| 535 |
html += '</select>'; |
| 536 |
|
| 537 |
} |
| 538 |
|
| 539 |
$("#searchmemberword_0").html( html ); |
| 540 |
|
| 541 |
}, |
| 542 |
|
| 543 |
change_member_search_field_1 :function (is_change = true){ |
| 544 |
|
| 545 |
var html = ''; |
| 546 |
var column = $("#searchmemberselect_1").val(); |
| 547 |
|
| 548 |
if( column == 'rank' ) { |
| 549 |
|
| 550 |
html = '<select name="search[member_word][1]" class="searchselect">'; |
| 551 |
<?php |
| 552 |
foreach((array)$member_status as $dkey => $dvalue){ |
| 553 |
if( isset($arr_search['member_word'][1]) && $dkey == $arr_search['member_word'][1]){ |
| 554 |
$dselected = ' selected="selected"'; |
| 555 |
}else{ |
| 556 |
$dselected = ''; |
| 557 |
} |
| 558 |
?> |
| 559 |
html += '<option value="<?php echo esc_attr( $dkey ); ?>"<?php echo esc_attr( $dselected ); ?>><?php echo esc_html( $dvalue ); ?></option>'; |
| 560 |
<?php |
| 561 |
} |
| 562 |
?> |
| 563 |
html += '</select>'; |
| 564 |
|
| 565 |
}else if( column == 'country' ) { |
| 566 |
|
| 567 |
html = '<select name="search[member_word][1]" class="searchselect">'; |
| 568 |
<?php |
| 569 |
foreach((array)$member_country as $dkey => $dvalue){ |
| 570 |
if( isset($arr_search['member_word'][1]) && $dkey == $arr_search['member_word'][1]){ |
| 571 |
$dselected = ' selected="selected"'; |
| 572 |
}else{ |
| 573 |
$dselected = ''; |
| 574 |
} |
| 575 |
?> |
| 576 |
html += '<option value="<?php echo esc_attr( $dkey ); ?>"<?php echo esc_attr( $dselected ); ?>><?php echo esc_html( $dvalue ); ?></option>'; |
| 577 |
<?php |
| 578 |
} |
| 579 |
?> |
| 580 |
html += '</select>'; |
| 581 |
|
| 582 |
}else{ |
| 583 |
|
| 584 |
html = '<input name="search[member_word][1]" type="text" value="'+ (!is_change ? "<?php echo esc_attr($arr_search['member_word'][1]); ?>" : "") +'" class="regular-text" maxlength="50" />'; |
| 585 |
html += '<select name="search[member_word_term][1]" class="termselect">'; |
| 586 |
html += '<option value="contain"<?php echo ( 'contain' == $arr_search['member_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('Contain', 'usces'); ?></option>'; |
| 587 |
html += '<option value="notcontain"<?php echo ( 'notcontain' == $arr_search['member_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('Not Contain', 'usces'); ?></option>'; |
| 588 |
html += '<option value="equal"<?php echo ( 'equal' == $arr_search['member_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('Equal', 'usces'); ?></option>'; |
| 589 |
html += '<option value="morethan"<?php echo ( 'morethan' == $arr_search['member_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('More than', 'usces'); ?></option>'; |
| 590 |
html += '<option value="lessthan"<?php echo ( 'lessthan' == $arr_search['member_word_term'][1] ? ' selected="selected"' : ''); ?>><?php _e('Less than', 'usces'); ?></option>'; |
| 591 |
html += '</select>'; |
| 592 |
|
| 593 |
} |
| 594 |
|
| 595 |
$("#searchmemberword_1").html( html ); |
| 596 |
|
| 597 |
}, |
| 598 |
|
| 599 |
change_collective_field :function (){ |
| 600 |
|
| 601 |
var html = ''; |
| 602 |
var column = $("#changeselect").val(); |
| 603 |
|
| 604 |
if( column == 'rank' ) { |
| 605 |
|
| 606 |
html = '<select name="change[word]" class="searchselect">'; |
| 607 |
<?php |
| 608 |
foreach((array)$member_status as $dkey => $dvalue){ |
| 609 |
?> |
| 610 |
html += '<option value="<?php echo esc_attr($dkey); ?>"><?php echo esc_html($dvalue); ?></option>'; |
| 611 |
<?php |
| 612 |
} |
| 613 |
?> |
| 614 |
html += '</select>'; |
| 615 |
|
| 616 |
}else if( column == 'point' ){ |
| 617 |
|
| 618 |
html = '<input name="change[word]" type="text" value="" class="regular-text" maxlength="50" />'; |
| 619 |
|
| 620 |
}else{ |
| 621 |
|
| 622 |
html = ''; |
| 623 |
|
| 624 |
} |
| 625 |
|
| 626 |
$("#changefield").html( html ); |
| 627 |
|
| 628 |
} |
| 629 |
}; |
| 630 |
|
| 631 |
$("#searchmemberselect_0").change(function () { |
| 632 |
operation.change_member_search_field_0(); |
| 633 |
}); |
| 634 |
$("#searchmemberselect_1").change(function () { |
| 635 |
operation.change_member_search_field_1(); |
| 636 |
}); |
| 637 |
$("#changeselect").change(function () { |
| 638 |
operation.change_collective_field(); |
| 639 |
}); |
| 640 |
operation.change_member_search_field_0(false); |
| 641 |
operation.change_member_search_field_1(false); |
| 642 |
operation.change_collective_field(); |
| 643 |
|
| 644 |
$("#collective_change_member").click(function () { |
| 645 |
if( $("#changeselect option:selected").val() == '' ) { |
| 646 |
$("#memberlistaction").val(''); |
| 647 |
return false; |
| 648 |
} |
| 649 |
if( $("input[name*='listcheck']:checked").length == 0 ) { |
| 650 |
alert("<?php _e('Choose the data.', 'usces'); ?>"); |
| 651 |
$("#memberlistaction").val(''); |
| 652 |
return false; |
| 653 |
} |
| 654 |
var coll = $("#changeselect").val(); |
| 655 |
var mes = ''; |
| 656 |
if( coll == 'rank' ){ |
| 657 |
mes = <?php echo sprintf(__("%s + ' which you have checked will be changed in to ' + %s + '. %sDo you agree?'", 'usces'), |
| 658 |
'$("#changeselect").val()', |
| 659 |
'$("select\[name=\"change\[word\]\"\] option:selected").html()', |
| 660 |
'\n\n'); ?>; |
| 661 |
}else if( coll == 'point' ){ |
| 662 |
mes = <?php echo sprintf(__("%s + ' which you have cheked will be changed in to ' + %s + '. %sDo you agree?'", 'usces'), |
| 663 |
'$("#changeselect").val()', |
| 664 |
'$("input\[name=\"change\[word\]\"\]").val()', |
| 665 |
'\n\n'); ?>; |
| 666 |
}else if(coll == 'delete'){ |
| 667 |
mes = '<?php _e('Are you sure of deleting all the checked data in bulk?', 'usces'); ?>'; |
| 668 |
} |
| 669 |
if( mes != '' ) { |
| 670 |
if( !confirm(mes) ){ |
| 671 |
$("#memberlistaction").val(''); |
| 672 |
return false; |
| 673 |
} |
| 674 |
} |
| 675 |
<?php do_action( 'usces_action_member_list_collective_change_js' ); ?> |
| 676 |
$("#memberlistaction").val('collective'); |
| 677 |
$('#form_tablesearch').submit(); |
| 678 |
}); |
| 679 |
|
| 680 |
<?php do_action('usces_action_member_list_page_js'); ?> |
| 681 |
}); |
| 682 |
</script> |
| 683 |
|