PluginProbe
MBE eShip / trunk
MBE eShip vtrunk
2.8.1 trunk 1.0.0 1.1.0 1.1.3 1.2.1 1.2.2 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.7.1 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.0 2.1.1 2.1.2 2.2.1 All 37 releases
mail-boxes-etc / lib / Metaboxes / DepartmentAddressData.php

DepartmentAddressData.php in MBE eShip trunk, at lib/Metaboxes/DepartmentAddressData.php

68 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Metaboxes;
4
5 abstract class DepartmentAddressData {
6
7 public static function add( $item, $screens = [] ) {
8 $screens = ! is_array( $screens ) ? [ $screens ] : $screens;
9 add_meta_box( MBE_ESHIP_ID . '_department_address_data_form_meta_box',
10 ' ',
11 [ self::class, 'html' ],
12 $screens,
13 'normal',
14 'default',
15 $item
16 );
17 }
18
19 public static function html( $orderIds ) {
20 $helper = new \Mbe_Shipping_Helper_Data();
21 $departmentsAddressList = $helper->getMolDepartmentsAddress();
22 $selectedAddress = count($orderIds)===1?$helper->getOrderDepartmentAddressId($orderIds[0]):null; // set the selected value for single order
23 ?>
24 <table style="width: 100%;" class="form-table">
25 <tbody>
26 <tr class="form-field">
27 <th scope="row">
28 <label for="address"><?php esc_html_e( 'Order list', 'mail-boxes-etc' ) ?></label>
29 </th>
30 <td>
31 <div style="width: 95%; height: auto">
32 <?php
33 foreach ( $orderIds as $order ) {
34 ?>
35 <span style="font-size: smaller; float: left; color:#0a4b78; border: solid 1px #0a4b78; padding:4px ;text-align: center;border-radius: 5px; margin: 3px;">
36 <?php esc_attr_e( $order ) ?>
37 </span>
38 <?php
39 }
40 ?>
41 </div>
42 </td>
43 </tr>
44 <tr class="form-field">
45 <th scope="row">
46 <label for="address"><?php esc_html_e( 'Department address', 'mail-boxes-etc' ) ?></label>
47 <span style="color: #c03939">*</span>
48 </th>
49 <td>
50 <select id="department_address_id" name="department_address_id" required>
51 <?php
52 foreach ( $departmentsAddressList as $key=>$value ) {
53 ?>
54 <option value=<?php echo esc_attr($key) ?> <?php echo $key==$selectedAddress?'selected':'' ?> >
55 <?php esc_html_e($value) ?>
56 </option>
57 <?php
58 }
59 ?>
60 </select>
61 </td>
62 </tr>
63 </tbody>
64 </table>
65 <?php
66 }
67
68 }