| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | 4 | exit; // Exit if accessed directly. |
| @@ -173,10 +173,10 @@ | ||
| 173 | 173 | $my_unavailable .= '</td></tr></tbody></table>'; |
| 174 | 174 | $my_unavailable .= '</div>'; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - // Resource Unavailable. | |
| 178 | - if ( 1 ) { | |
| 177 | + // Resource Unavailable. | |
| 178 | + if ( 1 ) { | |
| 179 | 179 | $my_resource_unavailable = '<div class="datepick-inline wpbc_calendar_legend_table_width_height">'; // FixIn: 9.3.1.4. |
| 180 | 180 | $my_resource_unavailable .= '<table class="datepick wpbc_calendar" style=""><tbody><tr>'; |
| 181 | 181 | $my_resource_unavailable .= '<td class="datepick-days-cell resource_unavailable date_user_unavailable wpbc_calendar_legend_day_cell_height">'; |
| 182 | 182 | $my_resource_unavailable .= '<div class="wpbc-cell-box">'; |
| @@ -186,10 +186,42 @@ | ||
| 186 | 186 | $my_resource_unavailable .= ' <div class="date-content-bottom"></div>'; |
| 187 | 187 | $my_resource_unavailable .= ' </div>'; |
| 188 | 188 | $my_resource_unavailable .= '</div>'; |
| 189 | 189 | $my_resource_unavailable .= '</td></tr></tbody></table>'; |
| 190 | - $my_resource_unavailable .= '</div>'; | |
| 191 | - } | |
| 190 | + $my_resource_unavailable .= '</div>'; | |
| 191 | + } | |
| 192 | + | |
| 193 | + // Some Resources unavailable in an aggregate calendar. | |
| 194 | + if ( 1 ) { | |
| 195 | + $my_resources_partially_unavailable = '<div class="datepick-inline wpbc_calendar_legend_table_width_height">'; | |
| 196 | + $my_resources_partially_unavailable .= '<table class="datepick wpbc_calendar" style=""><tbody><tr>'; | |
| 197 | + $my_resources_partially_unavailable .= '<td class="datepick-days-cell date_available wpbc_resources_partially_unavailable wpbc_calendar_legend_day_cell_height">'; | |
| 198 | + $my_resources_partially_unavailable .= '<div class="wpbc-cell-box">'; | |
| 199 | + $my_resources_partially_unavailable .= ' <div class="date-cell-content">'; | |
| 200 | + $my_resources_partially_unavailable .= ' <div class="date-content-top"></div>'; | |
| 201 | + $my_resources_partially_unavailable .= ' <span>' . esc_html( $params['text_for_day_cell'] ) . '</span>'; | |
| 202 | + $my_resources_partially_unavailable .= ' <div class="date-content-bottom"></div>'; | |
| 203 | + $my_resources_partially_unavailable .= ' </div>'; | |
| 204 | + $my_resources_partially_unavailable .= '</div>'; | |
| 205 | + $my_resources_partially_unavailable .= '</td></tr></tbody></table>'; | |
| 206 | + $my_resources_partially_unavailable .= '</div>'; | |
| 207 | + } | |
| 208 | + | |
| 209 | + // One or more Resources have bookings in an aggregate calendar. | |
| 210 | + if ( 1 ) { | |
| 211 | + $my_resources_have_bookings = '<div class="datepick-inline wpbc_calendar_legend_table_width_height">'; | |
| 212 | + $my_resources_have_bookings .= '<table class="datepick wpbc_calendar" style=""><tbody><tr>'; | |
| 213 | + $my_resources_have_bookings .= '<td class="datepick-days-cell date_available wpbc_resources_have_bookings wpbc_calendar_legend_day_cell_height">'; | |
| 214 | + $my_resources_have_bookings .= '<div class="wpbc-cell-box">'; | |
| 215 | + $my_resources_have_bookings .= ' <div class="date-cell-content">'; | |
| 216 | + $my_resources_have_bookings .= ' <div class="date-content-top"></div>'; | |
| 217 | + $my_resources_have_bookings .= ' <span>' . esc_html( $params['text_for_day_cell'] ) . '</span>'; | |
| 218 | + $my_resources_have_bookings .= ' <div class="date-content-bottom"></div>'; | |
| 219 | + $my_resources_have_bookings .= ' </div>'; | |
| 220 | + $my_resources_have_bookings .= '</div>'; | |
| 221 | + $my_resources_have_bookings .= '</td></tr></tbody></table>'; | |
| 222 | + $my_resources_have_bookings .= '</div>'; | |
| 223 | + } | |
| 192 | 224 | |
| 193 | 225 | |
| 194 | 226 | |
| 195 | 227 | $items_arr = array( 'available' => array( |
| @@ -228,14 +260,24 @@ | ||
| 228 | 260 | ) |
| 229 | 261 | , 'text_for_day_cell' => $my_unavailable |
| 230 | 262 | , 'css_class' => '' //'datepick-days-cell datepick-unselectable date_user_unavailable' |
| 231 | 263 | ) |
| 232 | - , 'resource_unavailable' => array( | |
| 233 | - 'title' => ( ! empty( $params['titles']['resource_unavailable'] ) ) ? $params['titles']['resource_unavailable'] : __( 'Resource unavailable days', 'booking' ) | |
| 234 | - , 'text_for_day_cell' => $my_resource_unavailable | |
| 235 | - , 'css_class' => '' //'datepick-days-cell resource_unavailable date_user_unavailable' | |
| 236 | - ) | |
| 237 | - ); | |
| 264 | + , 'resource_unavailable' => array( | |
| 265 | + 'title' => ( ! empty( $params['titles']['resource_unavailable'] ) ) ? $params['titles']['resource_unavailable'] : __( 'Resource unavailable days', 'booking' ) | |
| 266 | + , 'text_for_day_cell' => $my_resource_unavailable | |
| 267 | + , 'css_class' => '' //'datepick-days-cell resource_unavailable date_user_unavailable' | |
| 268 | + ) | |
| 269 | + , 'resources_partially_unavailable' => array( | |
| 270 | + 'title' => ( ! empty( $params['titles']['resources_partially_unavailable'] ) ) ? $params['titles']['resources_partially_unavailable'] : __( 'Some booking items unavailable', 'booking' ) | |
| 271 | + , 'text_for_day_cell' => $my_resources_partially_unavailable | |
| 272 | + , 'css_class' => '' | |
| 273 | + ) | |
| 274 | + , 'resources_have_bookings' => array( | |
| 275 | + 'title' => ( ! empty( $params['titles']['resources_have_bookings'] ) ) ? $params['titles']['resources_have_bookings'] : __( 'Bookings exist for one or more booking items', 'booking' ) | |
| 276 | + , 'text_for_day_cell' => $my_resources_have_bookings | |
| 277 | + , 'css_class' => '' | |
| 278 | + ) | |
| 279 | + ); | |
| 238 | 280 | |
| 239 | 281 | $calendar_legend_html = '<div class="block_hints datepick ' . ( ( $params['is_vertical'] ) ? ' block_hints_vertical ' : '' ) . '">'; |
| 240 | 282 | |
| 241 | 283 | foreach ( $params['items'] as $item_name ) { |
| @@ -266,9 +308,9 @@ | ||
| 266 | 308 | * Example of shortcode parameters: |
| 267 | 309 | * [legend_items items="available,unavailable,pending,approved,partially" text_for_day_cell="31"] |
| 268 | 310 | * [legend_items is_vertical="1"] |
| 269 | 311 | * [legend_items] |
| 270 | - * [legend_items items="resource_unavailable,available,unavailable,pending,approved,partially" text_for_day_cell="31" titles="resource_unavailable={Resource unavailable days} unavailable={Season unavailable}"] | |
| 312 | + * [legend_items items="resource_unavailable,resources_partially_unavailable,resources_have_bookings,available,unavailable,pending,approved,partially" text_for_day_cell="31" titles="resource_unavailable={Resource unavailable days} unavailable={Season unavailable}"] | |
| 271 | 313 | * |
| 272 | 314 | * PHP code example with escaping single and double quotes: |
| 273 | 315 | * echo wpbc_replace_shortcodes_in_booking_form__legend_items( '[legend_items' |
| 274 | 316 | . ' items="unavailable,available,pending,approved,partially"' |