1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
<?php
class orddd_time_settings {
public static function orddd_delivery_time_settings_callback() { }
public static function orddd_enable_delivery_time_capture_callback( $args ) {
$enable_delivery_time = "";
if ( get_option( 'orddd_enable_delivery_time' ) == 'on' ) {
$enable_delivery_time = "checked";
}
echo '<input type="checkbox" name="orddd_enable_delivery_time" id="orddd_enable_delivery_time" class="day-checkbox" ' . $enable_delivery_time . '/>';
$html = '<label for="orddd_enable_delivery_time"> ' . $args[0] . '</label>';
echo $html;
}
public static function orddd_time_range_callback( $args ) {
echo '<select name="orddd_delivery_from_hours" id="orddd_delivery_from_hours" size="1">';
$delivery_from_hours = get_option( 'orddd_delivery_from_hours' );
$delivery_to_hours = get_option( 'orddd_delivery_to_hours' );
for ( $i = 1 ; $i <= 23 ; $i++ ) {
printf( "<option %s value='%s'>%s</option>\n",
selected( $i, get_option( 'orddd_delivery_from_hours' ), false ),
esc_attr( $i ),
$i
);
}
echo '</select> : ' . __( '00 minutes ', 'order-delivery-date' );
echo '<select name="orddd_delivery_to_hours" id="orddd_delivery_to_hours" size="1">';
for ( $i = 1 ; $i <= 23 ; $i++ ) {
printf( "<option %s value='%s'>%s</option>\n",
selected( $i, get_option('orddd_delivery_to_hours'), false ),
esc_attr( $i ),
$i
);
}
echo '</select> : ' . __('59 minutes', 'order-delivery-date' );
$html = '<label for="orddd_time_range"> ' . $args[0] . '</label>';
echo $html;
}
public static function orddd_same_day_delivery_callback() { }
public static function orddd_enable_same_day_delivery_callback( $args ) {
$enable_same_day_delivery = "";
if ( get_option( 'orddd_enable_same_day_delivery' ) == 'on' ) {
$enable_same_day_delivery = "checked";
}
echo '<input type="checkbox" name="orddd_enable_same_day_delivery" id="orddd_enable_same_day_delivery" class="day-checkbox" ' . $enable_same_day_delivery . '/>';
$html = '<label for="orddd_enable_same_day_delivery"> ' . $args[0] . '</label>';
echo $html;
}
public static function orddd_cutoff_time_for_same_day_delivery_orders_callback( $args ) {
echo __( 'Hours:', 'order-delivery-date' ) . '<select name="orddd_disable_same_day_delivery_after_hours" id="orddd_disable_same_day_delivery_after_hours" size="1">';
$cut_off_hour = get_option( 'orddd_disable_same_day_delivery_after_hours' );
$cut_off_minute = get_option( 'orddd_disable_same_day_delivery_after_minutes' );
for ( $i = 0 ; $i <= 23 ; $i++ ) {
$selected = "";
if ( $cut_off_hour == $i ) {
$selected = "selected";
}
echo '<option value="' . $i . '" ' . $selected.'>' . $i . '</option>';
}
echo '</select> ' . __( 'Mins:', 'order-delivery-date' ).'<select name="orddd_disable_same_day_delivery_after_minutes" id="orddd_disable_same_day_delivery_after_minutes" size="1">';
for ( $i = 0 ; $i <= 59 ; $i++ ){
$selected = "";
if ( $cut_off_minute == $i ){
$selected = "selected";
}
echo '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>';
}
echo '</select>';
$html = '<label for="cutoff_time_for_same_day_delivery_orders"> ' . $args[0] . '</label>';
echo $html;
}
public static function orddd_additional_charges_for_same_day_delivery_callback( $args ) {
echo '<input type="text" name="orddd_same_day_additional_charges" id="orddd_same_day_additional_charges" value="' . get_option( "orddd_same_day_additional_charges" ) . '"/>';
$html = '<label for="orddd_same_day_additional_charges"> ' . $args[0] . '</label>';
echo $html;
}
public static function orddd_next_day_delivery_callback() { }
public static function orddd_enable_next_day_delivery_callback( $args ) {
$enable_next_day_delivery = "";
if ( get_option( 'orddd_enable_next_day_delivery' ) == 'on' ) {
$enable_next_day_delivery = "checked";
}
echo '<input type="checkbox" name="orddd_enable_next_day_delivery" id="orddd_enable_next_day_delivery" class="day-checkbox" ' . $enable_next_day_delivery . '/>';
$html = '<label for="orddd_enable_next_day_delivery"> ' . $args[0] . '</label>';
echo $html;
}
public static function orddd_cutoff_time_for_next_day_delivery_orders_callback( $args ) {
echo __( 'Hours:', 'order-delivery-date' ) . '<select name="orddd_disable_next_day_delivery_after_hours" id="orddd_disable_next_day_delivery_after_hours" size="1">';
$cut_off_hour = get_option( 'orddd_disable_next_day_delivery_after_hours' );
$cut_off_minute = get_option( 'orddd_disable_next_day_delivery_after_minutes' );
for ( $i = 0 ; $i <= 23 ; $i++ ) {
$selected = "";
if ( $cut_off_hour == $i ) {
$selected = " selected ";
}
echo '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>';
}
echo '</select> ' . __( 'Mins:', 'order-delivery-date' ) . '<select name="orddd_disable_next_day_delivery_after_minutes" id="orddd_disable_next_day_delivery_after_minutes" size="1">';
for ( $i = 0 ; $i <= 59 ; $i++ ){
$selected = "";
if ( $cut_off_minute == $i ){
$selected = "selected";
}
echo '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>';
}
printf('</select>');
$html = '<label for="cutoff_time_for_next_day_delivery_orders"> ' . $args[0] . '</label>';
echo $html;
}
public static function orddd_additional_charges_for_next_day_delivery_callback( $args ) {
printf(
'<input type="text" name="orddd_next_day_additional_charges" id="orddd_next_day_additional_charges" value="' . get_option( "orddd_next_day_additional_charges" ) . '"/>'
);
$html = '<label for="orddd_next_day_additional_charges"> ' . $args[0] . '</label>';
echo $html;
}
}