| 1 |
<?php |
| 2 |
/** |
| 3 |
* Welcart Calendar Widget |
| 4 |
* |
| 5 |
* @package Welcart |
| 6 |
*/ |
| 7 |
|
| 8 |
require_once USCES_PLUGIN_DIR . '/classes/calendar.class.php'; |
| 9 |
|
| 10 |
/* This month */ |
| 11 |
list( $todayyy, $todaymm, $todaydd ) = getToday(); |
| 12 |
$cal1 = new calendarData(); |
| 13 |
$cal1->setToday( $todayyy, $todaymm, $todaydd ); |
| 14 |
$cal1->setCalendarData(); |
| 15 |
$caption1 = __( 'This month', 'usces' ) . '(' . sprintf( __( '%2$s/%1$s', 'usces' ), $todayyy, $todaymm ) . ')'; |
| 16 |
/* Next month */ |
| 17 |
list( $nextyy, $nextmm, $nextdd ) = getAfterMonth( $todayyy, $todaymm, 1, 1 ); |
| 18 |
$cal2 = new calendarData(); |
| 19 |
$cal2->setToday( $nextyy, $nextmm, $nextdd ); |
| 20 |
$cal2->setCalendarData(); |
| 21 |
$caption2 = __( 'Next month', 'usces' ) . '(' . sprintf( __( '%2$s/%1$s', 'usces' ), $nextyy, $nextmm ) . ')'; |
| 22 |
ob_start(); |
| 23 |
?> |
| 24 |
<div class="this-month"> |
| 25 |
<table cellspacing="0" class="usces_calendar"> |
| 26 |
<caption><?php echo apply_filters( 'usces_filter_calendar_widget_cap1', $caption1, $todayyy, $todaymm ); ?></caption> |
| 27 |
<thead> |
| 28 |
<tr> |
| 29 |
<th><?php esc_html_e( 'Sun', 'usces' ); ?></th> |
| 30 |
<th><?php esc_html_e( 'Mon', 'usces' ); ?></th> |
| 31 |
<th><?php esc_html_e( 'Tue', 'usces' ); ?></th> |
| 32 |
<th><?php esc_html_e( 'Wed', 'usces' ); ?></th> |
| 33 |
<th><?php esc_html_e( 'Thu', 'usces' ); ?></th> |
| 34 |
<th><?php esc_html_e( 'Fri', 'usces' ); ?></th> |
| 35 |
<th><?php esc_html_e( 'Sat', 'usces' ); ?></th> |
| 36 |
</tr> |
| 37 |
</thead> |
| 38 |
<tbody> |
| 39 |
<?php |
| 40 |
$cal1_row = $cal1->getRow(); |
| 41 |
for ( $i = 0; $i < $cal1_row; $i++ ) : |
| 42 |
?> |
| 43 |
<tr> |
| 44 |
<?php |
| 45 |
for ( $d = 0; $d <= 6; $d++ ) : |
| 46 |
$mday = $cal1->getDateText( $i, $d ); |
| 47 |
if ( '' != $mday ) : |
| 48 |
$business = ( isset( $usces->options['business_days'][ $todayyy ][ $todaymm ][ $mday ] ) ) ? (int) $usces->options['business_days'][ $todayyy ][ $todaymm ][ $mday ] : 1; |
| 49 |
if ( $mday == $todaydd ) { |
| 50 |
if ( 1 === $business ) { |
| 51 |
$style = ' class="businesstoday"'; |
| 52 |
} else { |
| 53 |
$style = ' class="businessday businesstoday"'; |
| 54 |
} |
| 55 |
} else { |
| 56 |
$style = ( 1 === $business ) ? '' : ' class="businessday"'; |
| 57 |
} |
| 58 |
?> |
| 59 |
<td <?php wel_esc_script_e( $style ); ?>><?php echo esc_html( $mday ); ?></td> |
| 60 |
<?php else : ?> |
| 61 |
<td> </td> |
| 62 |
<?php endif; ?> |
| 63 |
<?php endfor; ?> |
| 64 |
</tr> |
| 65 |
<?php endfor; ?> |
| 66 |
</tbody> |
| 67 |
</table> |
| 68 |
</div> |
| 69 |
<div class="next-month"> |
| 70 |
<table cellspacing="0" class="usces_calendar"> |
| 71 |
<caption><?php echo apply_filters( 'usces_filter_calendar_widget_cap2', $caption2, $nextyy, $nextmm ); ?></caption> |
| 72 |
<thead> |
| 73 |
<tr> |
| 74 |
<th><?php esc_html_e( 'Sun', 'usces' ); ?></th> |
| 75 |
<th><?php esc_html_e( 'Mon', 'usces' ); ?></th> |
| 76 |
<th><?php esc_html_e( 'Tue', 'usces' ); ?></th> |
| 77 |
<th><?php esc_html_e( 'Wed', 'usces' ); ?></th> |
| 78 |
<th><?php esc_html_e( 'Thu', 'usces' ); ?></th> |
| 79 |
<th><?php esc_html_e( 'Fri', 'usces' ); ?></th> |
| 80 |
<th><?php esc_html_e( 'Sat', 'usces' ); ?></th> |
| 81 |
</tr> |
| 82 |
</thead> |
| 83 |
<tbody> |
| 84 |
<?php |
| 85 |
$cal2_row = $cal2->getRow(); |
| 86 |
for ( $i = 0; $i < $cal2_row; $i++ ) : |
| 87 |
?> |
| 88 |
<tr> |
| 89 |
<?php |
| 90 |
for ( $d = 0; $d <= 6; $d++ ) : |
| 91 |
$mday = $cal2->getDateText( $i, $d ); |
| 92 |
if ( '' != $mday ) : |
| 93 |
$business = ( isset( $usces->options['business_days'][ $nextyy ][ $nextmm ][ $mday ] ) ) ? (int) $usces->options['business_days'][ $nextyy ][ $nextmm ][ $mday ] : 1; |
| 94 |
$style = ( 1 === $business ) ? '' : ' class="businessday"'; |
| 95 |
?> |
| 96 |
<td <?php wel_esc_script_e( $style ); ?>><?php echo esc_html( $mday ); ?></td> |
| 97 |
<?php else : ?> |
| 98 |
<td> </td> |
| 99 |
<?php endif; ?> |
| 100 |
<?php endfor; ?> |
| 101 |
</tr> |
| 102 |
<?php endfor; ?> |
| 103 |
</tbody> |
| 104 |
</table> |
| 105 |
</div> |
| 106 |
<?php |
| 107 |
$html = ob_get_contents(); |
| 108 |
ob_end_clean(); |
| 109 |
$html = apply_filters( 'usces_filter_widget_calendar_form', $html ); |
| 110 |
echo $html; |
| 111 |
?> |
| 112 |
<?php |
| 113 |
$afterword = '(<span class="business_days_exp_box businessday"> </span> ' . __( 'Holiday for Shipping Operations', 'usces' ) . ')' . "\n"; |
| 114 |
echo apply_filters( 'usces_filter_widget_calendar', $afterword ); |
| 115 |
|