PluginProbe
Welcart e-Commerce / 2.12.3
Welcart e-Commerce v2.12.3
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 1.4.13 All 291 releases
usc-e-shop / includes / member_list.php

member_list.php in Welcart e-Commerce 2.12.3, at includes/member_list.php

345 lines 16.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 require_once( USCES_PLUGIN_DIR . "/classes/dataList.class.php" );
3 global $wpdb;
4
5 $tableName = usces_get_tablename( 'usces_member' );
6 $arr_column = array(
7 __('membership number', 'usces') => 'ID',
8 __('name', 'usces') => 'name',
9 __('Address', 'usces') => 'address',
10 __('Phone number', 'usces') => 'tel',
11 __('e-mail', 'usces') => 'email',
12 __('Strated date', 'usces') => 'date',
13 __('current point', 'usces') => 'point');
14 if( !usces_is_membersystem_point() ) {
15 array_pop($arr_column);
16 }
17
18 $DT = new dataList($tableName, $arr_column);
19 $res = $DT->MakeTable();
20 $arr_search = $DT->GetSearchs();
21 $arr_header = $DT->GetListheaders();
22 $dataTableNavigation = $DT->GetDataTableNavigation();
23 $rows = $DT->rows;
24
25 $usces_admin_path = '';
26 $admin_perse = explode('/', $_SERVER['REQUEST_URI']);
27 $apct = count($admin_perse) - 1;
28 for($ap=0; $ap < $apct; $ap++){
29 $usces_admin_path .= $admin_perse[$ap] . '/';
30 }
31
32 $csmb_meta = usces_has_custom_field_meta('member');
33 $usces_opt_member = get_option('usces_opt_member');
34 $chk_mem = (isset($usces_opt_member['chk_mem'])) ? $usces_opt_member['chk_mem'] : [];
35 $applyform = usces_get_apply_addressform($this->options['system']['addressform']);
36
37 $member_list_delete_link = ( isset( $this->options['system']['member_list_delete_link'] ) ) ? $this->options['system']['member_list_delete_link'] : 0;
38
39 ?>
40 <script type="text/javascript">
41 function deleteconfirm(member_id){
42 if(confirm(<?php _e("'Are you sure of deleting your membership number ' + member_id + ' ?'", 'usces'); ?>)){
43 return true;
44 }else{
45 return false;
46 }
47 }
48
49 jQuery(document).ready(function($){
50 $("table#mainDataTable tr:even").addClass("rowSelection_even");
51 $("table#mainDataTable tr").hover(function() {
52 $(this).addClass("rowSelection_hilight");
53 },
54 function() {
55 $(this).removeClass("rowSelection_hilight");
56 });
57
58 $(document).on( "click", "#searchVisiLink", function() {
59 if( $("#searchBox").css("display") == "block" ) {
60 $("#searchBox").css("display", "none");
61 $("#searchVisiLink").html('<?php _e('Show the Operation field', 'usces'); ?>');
62 } else {
63 $("#searchBox").css("display", "block");
64 $("#searchVisiLink").html('<?php _e('Hide the Operation field', 'usces'); ?>');
65 }
66 });
67
68 (function setCookie() {
69 <?php
70 $data_cookie = [];
71 $data_cookie['placeholder_escape'] = $DT->placeholder_escape;
72 $data_cookie['startRow'] = $DT->startRow; //表示開始行番号
73 $data_cookie['sortColumn'] = $DT->sortColumn; //現在ソート中のフィールド
74 $data_cookie['totalRow'] = $DT->totalRow; //�
75 �行数
76 $data_cookie['selectedRow'] = $DT->selectedRow; //絞り込まれた行数
77 $data_cookie['currentPage'] = $DT->currentPage; //現在のページNo
78 $data_cookie['previousPage'] = $DT->previousPage; //前のページNo
79 $data_cookie['nextPage'] = $DT->nextPage; //次のページNo
80 $data_cookie['lastPage'] = $DT->lastPage; //最終ページNo
81 $data_cookie['userHeaderNames'] = $DT->userHeaderNames;//�
82 �てのフィールド
83 $data_cookie['sortSwitchs'] = $DT->sortSwitchs; //各フィールド毎の昇順降順スイッチ
84 $data_cookie['searchSql'] = $DT->searchSql;
85 $data_cookie['arr_search'] = $DT->arr_search;
86 $data_cookie['searchSwitchStatus'] = $DT->searchSwitchStatus;
87 ?>
88 $.cookie('<?php echo esc_attr( "{$DT->table}_path" ); ?>', '<?php echo esc_attr( $usces_admin_path ); ?>', { path: "<?php echo esc_attr( $usces_admin_path ); ?>", domain: ""});
89 $.cookie('<?php echo esc_attr( "{$DT->table}" );?>', '<?php echo str_replace( "'", "\'", json_encode( $data_cookie ) ); ?>', { path: "<?php echo esc_attr( $usces_admin_path ); ?>", domain: ""});
90 })();
91
92 $("#dlMemberListDialog").dialog({
93 bgiframe: true,
94 autoOpen: false,
95 height: 400,
96 width: 700,
97 resizable: true,
98 modal: true,
99 buttons: {
100 '<?php _e('close', 'usces'); ?>': function() {
101 $(this).dialog('close');
102 }
103 },
104 close: function() {
105 }
106 });
107
108 $("input[name='allcheck']").click(function () {
109 if ($(this).prop("checked")) {
110 $("input[name*='listcheck']").prop("checked", true);
111 } else {
112 $("input[name*='listcheck']").prop("checked", false);
113 }
114 });
115 $('#dl_mem').click(function() {
116 var listcheck = [];
117 $("input[name='listcheck[]']:checked").each(function() {
118 listcheck.push($(this).val());
119 });
120
121 var form = $('<form>', {
122 action: "<?php echo USCES_ADMIN_URL; ?>?page=usces_memberlist&member_action=dlmemberlist&noheader=true",
123 method: 'post'
124 });
125 form.append($('<input>', { type: 'hidden', name: 'search[column]', value: $(':input[name="search[column]"]').val() }));
126 form.append($('<input>', { type: 'hidden', name: 'search[word]', value: $(':input[name="search[word]"]').val() }));
127 form.append($('<input>', { type: 'hidden', name: 'searchSwitchStatus', value: $(':input[name="searchSwitchStatus"]').val() }));
128 form.append($('<input>', { type: 'hidden', name: 'ftype', value: 'csv' }));
129 form.append($('<input>', { type: 'hidden', name: 'wc_nonce', value: '<?php echo wp_create_nonce( "post_member" ); ?>' }));
130
131 $('*[class=check_member]').each(function() {
132 if($(this).prop('checked')) {
133 form.append($('<input>', { type: 'hidden', name: 'check['+$(this).val()+']', value: 'on' }));
134 }
135 });
136
137 if (listcheck.length > 0) {
138 form.append($('<input>', { type: 'hidden', name: 'listcheck', value: listcheck.join(',') }));
139 }
140
141 form.appendTo('body').submit().remove();
142 });
143 $('#dl_memberlist').click(function() {
144 $('#dlMemberListDialog').dialog('open');
145 });
146
147
148 <?php do_action('usces_action_member_list_page_js'); ?>
149 });
150 </script>
151 <div class="wrap">
152 <div class="usces_admin">
153 <h1>Welcart Management <?php _e('List of Members','usces'); ?></h1>
154 <p class="version_info">Version <?php echo esc_html( USCES_VERSION ); ?></p>
155 <?php usces_admin_action_status(); ?>
156
157 <div id="datatable">
158 <div id="tablenavi"><?php wel_esc_script_e( $dataTableNavigation ); ?></div>
159
160 <div id="tablesearch">
161 <div id="searchBox">
162 <form action="<?php echo USCES_ADMIN_URL . '?page=usces_memberlist'; ?>" method="post" name="tablesearch">
163 <table id="search_table">
164 <tr>
165 <td><?php _e('search fields', 'usces'); ?></td>
166 <td><select name="search[column]" class="searchselect">
167 <option value="none"> </option>
168 <?php foreach ((array)$arr_column as $key => $value):
169 if($value == $arr_search['column']){
170 $selected = ' selected="selected"';
171 }else{
172 $selected = '';
173 }
174 ?>
175 <option value="<?php echo esc_attr( $value ); ?>"<?php echo esc_attr( $selected ); ?>><?php echo esc_html( $key ); ?></option>
176 <?php endforeach; ?>
177
178 <?php foreach ((array)$csmb_meta as $key => $value):
179 $csmb_key = 'csmb_'.$key;
180 if($csmb_key == $arr_search['column']){
181 $selected = ' selected="selected"';
182 }else{
183 $selected = '';
184 }
185 ?>
186 <option value="<?php echo esc_attr($csmb_key); ?>"<?php echo esc_attr( $selected ); ?>><?php echo esc_html($value['name']); ?></option>
187 <?php endforeach; ?>
188
189 </select></td>
190 <td><?php _e('key words', 'usces'); ?></td>
191 <td><input name="search[word]" type="text" value="<?php echo esc_attr($arr_search['word']); ?>" class="searchword" maxlength="50" /></td>
192 <td><input name="searchIn" type="submit" class="searchbutton button" value="<?php _e('Search', 'usces'); ?>" />
193 <input name="searchOut" type="submit" class="searchbutton button" value="<?php _e('Cancellation', 'usces'); ?>" />
194 <input name="searchSwitchStatus" id="searchSwitchStatus" type="hidden" value="<?php echo esc_attr($DT->searchSwitchStatus); ?>" />
195 </td>
196 </tr>
197 </table>
198 <table id="dl_list_table">
199 <tr>
200 <?php do_action( 'usces_action_dl_member_list_table' ); ?>
201 <td><input type="button" id="dl_memberlist" class="searchbutton button" value="<?php _e('Download Member List', 'usces'); ?>" /></td>
202 </tr>
203 </table>
204 </form>
205 </div>
206 </div>
207
208 <table id="mainDataTable" cellspacing="1">
209 <tr>
210 <th scope="col"><input name="allcheck" type="checkbox" value="" /></th>
211 <?php foreach ( (array)$arr_header as $value ) : ?>
212 <th scope="col"><?php wel_esc_script_e( $value ); ?></th>
213 <?php endforeach; ?>
214
215 <?php if ( $member_list_delete_link ) : ?>
216 <th scope="col">&nbsp;</th>
217 <?php endif; ?>
218
219
220 </tr>
221 <?php foreach ( (array)$rows as $array ) : ?>
222 <tr>
223 <td align="center"><input name="listcheck[]" type="checkbox" value="<?php echo esc_attr( $array['ID'] ); ?>" /></td>
224 <?php foreach ( (array)$array as $key => $value ) : ?>
225 <?php if( WCUtils::is_blank($value) ) $value = '&nbsp;'; ?>
226 <?php if( $key == 'ID' ): ?>
227 <td><a href="<?php echo esc_url( USCES_ADMIN_URL . '?page=usces_memberlist&member_action=edit&member_id=' . $value . '&wc_nonce=' . wp_create_nonce( 'member_list' ) ); ?>"><?php echo esc_html( $value ); ?></a></td>
228 <?php elseif( $key == 'name' ): ?>
229 <td>
230 <?php
231 $names = explode(' ', $value);
232 usces_localized_name( esc_html($names[0]), esc_html($names[1]));
233 ?>
234 </td>
235 <?php elseif( $key == 'address' ):
236 $pos = strpos( $value, __('-- Select --','usces') );
237 if( $pos !== false ) $value = '&nbsp;';
238 ?>
239 <td><?php echo esc_html($value); ?></td>
240 <?php elseif( $key == 'point' ): ?>
241 <td class="right"><?php echo esc_html($value); ?></td>
242 <?php else: ?>
243 <td><?php echo esc_html($value); ?></td>
244 <?php endif; ?>
245 <?php endforeach; ?>
246
247 <?php if ( $member_list_delete_link ) : ?>
248 <td><a href="<?php echo esc_url( USCES_ADMIN_URL ); ?>?page=usces_memberlist&member_action=delete&member_id=<?php echo esc_html( $array['ID'] ); ?>&wc_nonce=<?php echo wp_create_nonce( 'delete_member' ); ?>" onclick="return deleteconfirm('<?php echo esc_js( $array['ID'] ); ?>');"><span style="color:#FF0000; font-size:9px;"><?php _e( 'Delete', 'usces' ); ?></span></a></td>
249 <?php endif; ?>
250
251 </tr>
252 <?php endforeach; ?>
253 </table>
254
255 </div>
256 <div id="dlMemberListDialog" title="<?php _e('Download Member List', 'usces'); ?>">
257 <p><?php _e('Select the item you want, please press the download.', 'usces'); ?></p>
258 <fieldset>
259 <input type="button" class="button" id="dl_mem" value="<?php _e('Download', 'usces'); ?>" />
260 </fieldset>
261 <fieldset><legend><?php _e('Membership information', 'usces'); ?></legend>
262 <label for="chk_mem[ID]"><input type="checkbox" class="check_member" id="chk_mem[ID]" value="ID" checked disabled /><?php _e('membership number', 'usces'); ?></label>
263 <label for="chk_mem[email]"><input type="checkbox" class="check_member" id="chk_mem[email]" value="email"<?php usces_checked($chk_mem, 'email'); ?> /><?php _e('e-mail', 'usces'); ?></label>
264 <?php
265 if(!empty($csmb_meta)) {
266 foreach($csmb_meta as $key => $entry) {
267 if($entry['position'] == 'name_pre') {
268 $csmb_key = 'csmb_'.$key;
269 $checked = usces_checked( $chk_mem, $csmb_key, 'return' );
270 $name = $entry['name'];
271 echo '<label for="chk_mem['.$csmb_key.']"><input type="checkbox" class="check_member" id="chk_mem['.esc_attr($csmb_key).']" value="'.esc_attr($csmb_key).'"'.$checked.' />'.esc_html($name).'</label>'."\n";
272 }
273 }
274 }
275 ?>
276 <label for="chk_mem[name]"><input type="checkbox" class="check_member" id="chk_mem[name]" value="name" checked disabled /><?php _e('name', 'usces'); ?></label>
277 <?php
278 switch($applyform) {
279 case 'JP':
280 ?>
281 <label for="chk_mem[kana]"><input type="checkbox" class="check_member" id="chk_mem[kana]" value="kana"<?php usces_checked($chk_mem, 'kana'); ?> /><?php _e('furigana','usces'); ?></label>
282 <?php
283 break;
284 }
285
286 if(!empty($csmb_meta)) {
287 foreach($csmb_meta as $key => $entry) {
288 if($entry['position'] == 'name_after') {
289 $csmb_key = 'csmb_'.$key;
290 $checked = usces_checked( $chk_mem, $csmb_key, 'return' );
291 $name = $entry['name'];
292 echo '<label for="chk_mem['.esc_attr($csmb_key).']"><input type="checkbox" class="check_member" id="chk_mem['.esc_attr($csmb_key).']" value="'.esc_attr($csmb_key).'"'.$checked.' />'.esc_html($name).'</label>'."\n";
293 }
294 }
295 }
296
297 switch($applyform) {
298 case 'JP':
299 ?>
300 <label for="chk_mem[zip]"><input type="checkbox" class="check_member" id="chk_mem[zip]" value="zip"<?php usces_checked($chk_mem, 'zip'); ?> /><?php _e('Zip/Postal Code', 'usces'); ?></label>
301 <label for="chk_mem[country]"><input type="checkbox" class="check_member" id="chk_mem[country]" value="country" checked disabled /><?php _e('Country', 'usces'); ?></label>
302 <label for="chk_mem[pref]"><input type="checkbox" class="check_member" id="chk_mem[pref]" value="pref" checked disabled /><?php _e('Province', 'usces'); ?></label>
303 <label for="chk_mem[address1]"><input type="checkbox" class="check_member" id="chk_mem[address1]" value="address1" checked disabled /><?php _e('city', 'usces'); ?></label>
304 <label for="chk_mem[address2]"><input type="checkbox" class="check_member" id="chk_mem[address2]" value="address2" checked disabled /><?php _e('numbers', 'usces'); ?></label>
305 <label for="chk_mem[address3]"><input type="checkbox" class="check_member" id="chk_mem[address3]" value="address3" checked disabled /><?php _e('building name', 'usces'); ?></label>
306 <label for="chk_mem[tel]"><input type="checkbox" class="check_member" id="chk_mem[tel]" value="tel"<?php usces_checked($chk_mem, 'tel'); ?> /><?php _e('Phone number', 'usces'); ?></label>
307 <label for="chk_mem[fax]"><input type="checkbox" class="check_member" id="chk_mem[fax]" value="fax"<?php usces_checked($chk_mem, 'fax'); ?> /><?php _e('FAX number', 'usces'); ?></label>
308 <?php
309 break;
310 case 'US':
311 default:
312 ?>
313 <label for="chk_mem[address2]"><input type="checkbox" class="check_member" id="chk_mem[address2]" value="address2" checked disabled /><?php _e('Address Line1', 'usces'); ?></label>
314 <label for="chk_mem[address3]"><input type="checkbox" class="check_member" id="chk_mem[address3]" value="address3" checked disabled /><?php _e('Address Line2', 'usces'); ?></label>
315 <label for="chk_mem[address1]"><input type="checkbox" class="check_member" id="chk_mem[address1]" value="address1" checked disabled /><?php _e('city', 'usces'); ?></label>
316 <label for="chk_mem[pref]"><input type="checkbox" class="check_member" id="chk_mem[pref]" value="pref" checked disabled /><?php _e('State', 'usces'); ?></label>
317 <label for="chk_mem[country]"><input type="checkbox" class="check_member" id="chk_mem[country]" value="country" checked disabled /><?php _e('Country', 'usces'); ?></label>
318 <label for="chk_mem[zip]"><input type="checkbox" class="check_member" id="chk_mem[zip]" value="zip"<?php usces_checked($chk_mem, 'zip'); ?> /><?php _e('Zip', 'usces'); ?></label>
319 <label for="chk_mem[tel]"><input type="checkbox" class="check_member" id="chk_mem[tel]" value="tel"<?php usces_checked($chk_mem, 'tel'); ?> /><?php _e('Phone number', 'usces'); ?></label>
320 <label for="chk_mem[fax]"><input type="checkbox" class="check_member" id="chk_mem[fax]" value="fax"<?php usces_checked($chk_mem, 'fax'); ?> /><?php _e('FAX number', 'usces'); ?></label>
321 <?php
322 break;
323 }
324
325 if(!empty($csmb_meta)) {
326 foreach($csmb_meta as $key => $entry) {
327 if($entry['position'] == 'fax_after') {
328 $csmb_key = 'csmb_'.$key;
329 $checked = usces_checked( $chk_mem, $csmb_key, 'return' );
330 $name = $entry['name'];
331 echo '<label for="chk_mem['.esc_attr($csmb_key).']"><input type="checkbox" class="check_member" id="chk_mem['.esc_attr($csmb_key).']" value="'.esc_attr($csmb_key).'"'.$checked.' />'.esc_html($name).'</label>'."\n";
332 }
333 }
334 }
335 ?>
336 <label for="chk_mem[date]"><input type="checkbox" class="check_member" id="chk_mem[date]" value="date"<?php usces_checked($chk_mem, 'date'); ?> /><?php _e('Strated date','usces'); ?></label>
337 <label for="chk_mem[point]"><input type="checkbox" class="check_member" id="chk_mem[point]" value="point"<?php usces_checked($chk_mem, 'point'); ?> /><?php _e('current point','usces'); ?></label>
338 <label for="chk_mem[rank]"><input type="checkbox" class="check_member" id="chk_mem[rank]" value="rank"<?php usces_checked($chk_mem, 'rank'); ?> /><?php _e('Rank', 'usces'); ?></label>
339 <?php do_action( 'usces_action_chk_mem', $chk_mem ); ?>
340 </fieldset>
341 </div>
342 <?php do_action( 'usces_action_member_list_footer' ); ?>
343 </div><!--usces_admin-->
344 </div><!--wrap-->
345