Example #1
0
function booking_listing_table($bookings, $booking_types)
{
    //debuge($_REQUEST);
    $user = wp_get_current_user();
    $user_bk_id = $user->ID;
    $bk_url_listing = 'admin.php?page=' . WPDEV_BK_PLUGIN_DIRNAME . '/' . WPDEV_BK_PLUGIN_FILENAME . 'wpdev-booking';
    $bk_url_add = $bk_url_listing . '-reservation';
    $bk_url_resources = $bk_url_listing . '-resources';
    $bk_url_settings = $bk_url_listing . '-option';
    $bk_admin_url = get_params_in_url(array('page_num', 'wh_booking_type'));
    $booking_date_view_type = get_bk_option('booking_date_view_type');
    if ($booking_date_view_type == 'short') {
        $wide_days_class = ' hidden_items ';
        $short_days_class = '';
    } else {
        $wide_days_class = '';
        $short_days_class = ' hidden_items ';
    }
    $version = get_bk_version();
    if ($version == 'free') {
        $is_free = true;
    } else {
        $is_free = false;
    }
    ?>
         <div id="listing_visible_bookings">
          <?php 
    if (count($bookings) > 0) {
        ?>
          <div class="row-fluid booking-listing-header">
              <div class="booking-listing-collumn span1 wpbc_column_1" style="text-align: left;">&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" onclick="javascript:setCheckBoxInTable(this.checked, 'booking_list_item_checkbox');">&nbsp;&nbsp;&nbsp;<?php 
        echo 'ID';
        ?>
</div>
              <div class="booking-listing-collumn span<?php 
        echo $is_free ? '1' : '2';
        ?>
 wpbc_column_2"><?php 
        _e('Labels', 'wpdev-booking');
        if (!$is_free) {
            echo ' / ';
            _e('Actions', 'wpdev-booking');
        }
        ?>
</div>
              <div class="booking-listing-collumn span<?php 
        echo $is_free ? '5' : '6';
        ?>
 wpbc_column_4"><?php 
        _e('Booking Data', 'wpdev-booking');
        ?>
</div>
              <div class="booking-listing-collumn span3 wpbc_column_5"><?php 
        _e('Booking Dates', 'wpdev-booking');
        ?>
&nbsp;&nbsp;&nbsp;
                  <a href="javascript:void(0)" id="booking_dates_full" onclick="javascript:
                            jQuery('#booking_dates_full').hide();
                            jQuery('#booking_dates_small').show();
                            jQuery('.booking_dates_small').hide();
                            jQuery('.booking_dates_full').show();" data-original-title="<?php 
        _e('Show ALL dates of booking', 'wpdev-booking');
        ?>
"  rel="tooltip" class="tooltip_top <?php 
        echo $short_days_class;
        ?>
 "><i class="icon-resize-full" style=" margin-top: 2px;"></i></a>
                  <a href="javascript:void(0)" id="booking_dates_small" onclick="javascript:
                            jQuery('#booking_dates_small').hide();
                            jQuery('#booking_dates_full').show();
                            jQuery('.booking_dates_small').show();
                            jQuery('.booking_dates_full').hide();" data-original-title="<?php 
        _e('Show only check in/out dates', 'wpdev-booking');
        ?>
"  rel="tooltip" class="tooltip_top <?php 
        echo $wide_days_class;
        ?>
 " ><i class="icon-resize-small" style=" margin-top: 2px;"></i></a>
              </div>
              <?php 
        if ($is_free) {
            ?>
              <div class="booking-listing-collumn span2 wpbc_column_5"><?php 
            _e('Actions', 'wpdev-booking');
            ?>
</div>
              <?php 
        }
        ?>
          </div>
          <?php 
    } else {
        echo '<center><h3>' . __('Nothing found!', 'wpdev-booking') . '</h3></center>';
    }
    ?>
        <?php 
    // P
    $print_data = apply_bk_filter('get_bklist_print_header', array(array()));
    $is_alternative_color = true;
    $id_of_new_bookings = array();
    foreach ($bookings as $bk) {
        $is_selected_color = 0;
        //rand(0,1);
        $is_alternative_color = !$is_alternative_color;
        $booking_id = $bk->booking_id;
        // 100
        $is_new = isset($bk->is_new) ? $bk->is_new : '0';
        // 1
        $bk_modification_date = isset($bk->modification_date) ? $bk->modification_date : '';
        // 2012-02-29 16:01:58
        $bk_form = $bk->form;
        // select-one^rangetime5^10:00 - 12:00~text^name5^Jonny~text^secondname5^Smith~email^ ....
        $bk_form_show = $bk->form_show;
        // First Name:Jonny   Last Name:Smith   Email:email@server.com  Country:GB  ....
        $bk_form_data = $bk->form_data;
        // Array ([name] => Jonny... [_all_] => Array ( [rangetime5] => 10:00 - 12:00 [name5] => Jonny ... ) .... )
        $bk_dates = $bk->dates;
        // Array ( [0] => stdClass Object ( [booking_id] => 8 [booking_date] => 2012-04-16 10:00:01 [approved] => 0 [type_id] => )
        $bk_dates_short = $bk->dates_short;
        // Array ( [0] => 2012-04-16 10:00:01 [1] => - [2] => 2012-04-20 12:00:02 [3] => , [4] => 2012-04-16 10:00:01 ....
        //P
        $bk_booking_type = isset($bk->booking_type) ? $bk->booking_type : '1';
        // 3
        if (!class_exists('wpdev_bk_personal')) {
            $bk_booking_type_name = '<span class="label_resource_not_exist">' . __('Default', 'wpdev-booking') . '</span>';
        } else {
            if (isset($booking_types[$bk_booking_type])) {
                $bk_booking_type_name = $booking_types[$bk_booking_type]->title;
                // Default
                if (strlen($bk_booking_type_name) > 19) {
                    //$bk_booking_type_name = substr($bk_booking_type_name, 0,  13) . ' ... ' . substr($bk_booking_type_name, -3 );
                    $bk_booking_type_name = '<span style="cursor:pointer;" rel="tooltip" class="tooltip_top"  data-original-title="' . $bk_booking_type_name . '">' . substr($bk_booking_type_name, 0, 13) . ' ... ' . substr($bk_booking_type_name, -3) . '</span>';
                }
            } else {
                $bk_booking_type_name = '<span class="label_resource_not_exist">' . __('Resource not exist', 'wpdev-booking') . '</span>';
            }
        }
        $bk_hash = isset($bk->hash) ? $bk->hash : '';
        // 99c9c2bd4fd0207e4376bdbf5ee473bc
        $bk_remark = isset($bk->remark) ? $bk->remark : '';
        //
        //BS
        $bk_cost = isset($bk->cost) ? $bk->cost : '';
        // 150.00
        $bk_pay_status = isset($bk->pay_status) ? $bk->pay_status : '';
        // 30800
        $bk_pay_request = isset($bk->pay_request) ? $bk->pay_request : '';
        // 0
        $bk_status = isset($bk->status) ? $bk->status : '';
        //BL
        $bk_dates_short_id = array();
        if (count($bk->dates) > 0) {
            $bk_dates_short_id = isset($bk->dates_short_id) ? $bk->dates_short_id : array();
        }
        // Array ([0] => [1] => .... [4] => 6... [11] => [12] => 8 )
        $is_approved = 0;
        if (count($bk->dates) > 0) {
            $is_approved = $bk->dates[0]->approved;
        }
        //BS
        $is_paid = 0;
        $payment_status_titles_current = '';
        if (class_exists('wpdev_bk_biz_s')) {
            if (is_payment_status_ok(trim($bk_pay_status))) {
                $is_paid = 1;
            }
            $payment_status_titles = get_payment_status_titles();
            $payment_status_titles_current = array_search($bk_pay_status, $payment_status_titles);
            if ($payment_status_titles_current === FALSE) {
                $payment_status_titles_current = $bk_pay_status;
            }
        }
        if ($is_new == 1) {
            $id_of_new_bookings[] = $booking_id;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Get SHORT Dates showing data ////////////////////////////////////////////////////////////////////////////////////////////////////
        //$short_dates_content = wpdevbk_get_str_from_dates_short($bk_dates_short, $is_approved , $bk_dates_short_id , $booking_types );
        $short_dates_content = '';
        $dcnt = 0;
        foreach ($bk_dates_short as $dt) {
            if ($dt == '-') {
                $short_dates_content .= '<span class="date_tire"> - </span>';
            } elseif ($dt == ',') {
                $short_dates_content .= '<span class="date_tire">, </span>';
            } else {
                $short_dates_content .= '<a href="javascript:void(0)" class="field-booking-date ';
                if ($is_approved) {
                    $short_dates_content .= ' approved';
                }
                $short_dates_content .= '">';
                $bk_date = wpdevbk_get_date_in_correct_format($dt);
                $short_dates_content .= $bk_date[0];
                $short_dates_content .= '<sup class="field-booking-time">' . $bk_date[1] . '</sup>';
                // BL
                if (class_exists('wpdev_bk_biz_l')) {
                    if (!empty($bk_dates_short_id[$dcnt])) {
                        $bk_booking_type_name_date = $booking_types[$bk_dates_short_id[$dcnt]]->title;
                        // Default
                        if (strlen($bk_booking_type_name_date) > 19) {
                            $bk_booking_type_name_date = substr($bk_booking_type_name_date, 0, 13) . '...' . substr($bk_booking_type_name_date, -3);
                        }
                        $short_dates_content .= '<sup class="field-booking-time date_from_dif_type"> ' . $bk_booking_type_name_date . '</sup>';
                    }
                }
                $short_dates_content .= '</a>';
            }
            $dcnt++;
        }
        // Get WIDE Dates showing data /////////////////////////////////////////////////////////////////////////////////////////////////////
        $wide_dates_content = '';
        $dates_count = count($bk_dates);
        $dcnt = 0;
        foreach ($bk_dates as $dt) {
            $dcnt++;
            $wide_dates_content .= '<a href="javascript:void(0)" class="field-booking-date ';
            if ($is_approved) {
                $wide_dates_content .= ' approved';
            }
            $wide_dates_content .= ' ">';
            $bk_date = wpdevbk_get_date_in_correct_format($dt->booking_date);
            $wide_dates_content .= $bk_date[0];
            $wide_dates_content .= '<sup class="field-booking-time">' . $bk_date[1] . '</sup>';
            // BL
            if (class_exists('wpdev_bk_biz_l')) {
                if ($dt->type_id != '' && isset($booking_types[$dt->type_id])) {
                    $bk_booking_type_name_date = $booking_types[$dt->type_id]->title;
                    // Default
                    if (strlen($bk_booking_type_name_date) > 19) {
                        $bk_booking_type_name_date = substr($bk_booking_type_name_date, 0, 13) . '...' . substr($bk_booking_type_name_date, -3);
                    }
                    $wide_dates_content .= '<sup class="field-booking-time date_from_dif_type"> ' . $bk_booking_type_name_date . '</sup>';
                }
            }
            $wide_dates_content .= '</a>';
            if ($dcnt < $dates_count) {
                $wide_dates_content .= '<span class="date_tire">, </span>';
            }
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // BS
        $pay_print_status = '';
        if (class_exists('wpdev_bk_biz_s')) {
            if ($is_paid) {
                $pay_print_status = __('Paid OK', 'wpdev-booking');
                if ($payment_status_titles_current == 'Completed') {
                    $pay_print_status = $payment_status_titles_current;
                }
            } else {
                if (is_numeric($bk_pay_status) || $bk_pay_status == '') {
                    $pay_print_status = __('Unknown', 'wpdev-booking');
                } else {
                    $pay_print_status = $payment_status_titles_current;
                }
            }
        }
        ///// Print data  //////////////////////////////////////////////////////////////////////////////
        $print_data[] = apply_bk_filter('get_bklist_print_row', array(), $booking_id, $is_approved, $bk_form_show, $bk_booking_type_name, $is_paid, $pay_print_status, $booking_date_view_type == 'short' ? '<div class="booking_dates_small">' . $short_dates_content . '</div>' : '<div class="booking_dates_full">' . $wide_dates_content . '</div>', $bk_cost);
        //////////////////////////////////////////////////////////////////////////////////////////////
        ?>
          <div id="booking_mark_<?php 
        echo $booking_id;
        ?>
"  class="<?php 
        if ($is_new != '1') {
            echo ' hidden_items ';
        }
        ?>
 new-label clearfix-height">
              <a href="javascript:void(0)"  class="tooltip_bottom approve_bk_link  <?php 
        //if ($is_approved) echo ' hidden_items ';
        ?>
 "
                       onclick="javascript:mark_read_booking( '<?php 
        echo $booking_id;
        ?>
' ,
                                                      0, <?php 
        echo $user_bk_id;
        ?>
, '<?php 
        echo getBookingLocale();
        ?>
' );"
                       data-original-title="<?php 
        _e('Mark', 'wpdev-booking');
        echo ' ';
        _e('Unread', 'wpdev-booking');
        ?>
"  rel="tooltip" >
                        <img src="<?php 
        echo WPDEV_BK_PLUGIN_URL;
        ?>
/img/label_new_blue.png" style="width:24px; height:24px;"></a>
          </div>
          <div id="booking_row_<?php 
        echo $booking_id;
        ?>
"  class="row-fluid booking-listing-row clearfix-height<?php 
        if ($is_alternative_color) {
            echo ' row_alternative_color ';
        }
        if ($is_selected_color) {
            echo ' row_selected_color ';
        }
        //if ($is_new) echo ' row_unread_color ';
        $date_format = get_bk_option('booking_date_format');
        $time_format = get_bk_option('booking_time_format');
        if (empty($date_format)) {
            $date_format = "m / d / Y, D";
        }
        if (empty($time_format)) {
            $time_format = 'h:i a';
        }
        $cr_date = date_i18n($date_format, mysql2date('U', $bk_modification_date));
        $cr_time = date_i18n($time_format, mysql2date('U', $bk_modification_date));
        ?>
" >

              <div class="wpbc_column_1 booking-listing-collumn bktextcenter span1">
                    <input type="checkbox" class="booking_list_item_checkbox" 
                           onclick="javascript: if (jQuery(this).attr('checked') !== undefined ) { jQuery(this).parent().parent().addClass('row_selected_color'); } else {jQuery(this).parent().parent().removeClass('row_selected_color');}"
                           <?php 
        if ($is_selected_color) {
            echo ' checked="CHECKED" ';
        }
        ?>
                           id="booking_id_selected_<?php 
        echo $booking_id;
        ?>
"  name="booking_appr_<?php 
        $booking_id;
        ?>
"
                           /><span class="wpbc_mobile_legend clear" style="margin:0 -5px 0 25px"><?php 
        _e('ID', 'wpdev-booking');
        ?>
: </span><span class="field-id"><?php 
        echo $booking_id;
        ?>
</span>                  
              </div>

              <div class="wpbc_column_2 booking-listing-collumn bktextleft booking-labels span<?php 
        echo $is_free ? '1' : '2';
        ?>
 ">
                  <?php 
        make_bk_action('wpdev_bk_listing_show_resource_label', $bk_booking_type_name, $bk_admin_url . '&wh_booking_type=' . $bk_booking_type);
        ?>
                  <?php 
        make_bk_action('wpdev_bk_listing_show_payment_label', $is_paid, $pay_print_status, $payment_status_titles_current);
        ?>
                  <span class="label label-pending <?php 
        if ($is_approved) {
            echo ' hidden_items ';
        }
        ?>
 "><?php 
        _e('Pending', 'wpdev-booking');
        ?>
</span>
                  <span class="label label-approved <?php 
        if (!$is_approved) {
            echo ' hidden_items ';
        }
        ?>
"><?php 
        _e('Approved', 'wpdev-booking');
        ?>
</span>
              </div>

              <div class="wpbc_column_3 booking-listing-collumn bktextjustify span<?php 
        echo $is_free ? '5' : '6';
        ?>
 ">
                    <div style="text-align:left"><?php 
        echo $bk_form_show;
        ?>
</div>
              </div>

              <div class="wpbc_column_4 booking-listing-collumn bktextleft booking-dates span3">

                <div class="booking_dates_small <?php 
        echo $short_days_class;
        ?>
"><?php 
        echo $short_dates_content;
        ?>
</div>
                <div class="booking_dates_full  <?php 
        echo $wide_days_class;
        ?>
" ><?php 
        echo $wide_dates_content;
        ?>
</div>

              </div>

              <?php 
        $edit_booking_url = $bk_url_add . '&booking_type=' . $bk_booking_type . '&booking_hash=' . $bk_hash . '&parent_res=1';
        ?>

              <div class="wpbc_column_5 booking-listing-collumn booking-actions<?php 
        echo $is_free ? '0 span2 bktextcenter' : ' bktextleft ';
        ?>
 ">

                <?php 
        $is_can = true;
        //current_user_can( 'edit_posts' );
        if ($is_can) {
            ?>
                  
                  
                  <?php 
            make_bk_action('wpdev_bk_listing_show_cost_btn', $booking_id, $bk_cost);
            ?>
                  
                  <div class="actions-fields-group">
                    <?php 
            make_bk_action('wpdev_bk_listing_show_edit_btn', $booking_id, $edit_booking_url, $bk_remark, $bk_booking_type);
            ?>
<a    href="javascript:void(0)"  class="tooltip_top approve_bk_link button-secondary button  <?php 
            if ($is_approved) {
                echo ' hidden_items ';
            }
            ?>
 "
                            onclick="javascript:approve_unapprove_booking(<?php 
            echo $booking_id;
            ?>
,1, <?php 
            echo $user_bk_id;
            ?>
, '<?php 
            echo getBookingLocale();
            ?>
' , 1  );"
                            data-original-title="<?php 
            _e('Approve', 'wpdev-booking');
            ?>
"  rel="tooltip" 
                       ><i class="icon-ok-circle"></i><?php 
            /** ?><img src="<?php echo WPDEV_BK_PLUGIN_URL; ?>/img/accept-24x24.gif" style="width:14px; height:14px;"><?php /**/
            ?>
</a><a                     
                            href="javascript:void(0)"  class="tooltip_top pending_bk_link button-secondary button  <?php 
            if (!$is_approved) {
                echo ' hidden_items ';
            }
            ?>
 "
                            onclick="javascript:if ( bk_are_you_sure('<?php 
            echo esc_js(__('Do you really want to set booking as pending ?', 'wpdev-booking'));
            ?>
') ) approve_unapprove_booking(<?php 
            echo $booking_id;
            ?>
,0, <?php 
            echo $user_bk_id;
            ?>
, '<?php 
            echo getBookingLocale();
            ?>
' , 1  );"
                            data-original-title="<?php 
            _e('Reject', 'wpdev-booking');
            ?>
"  rel="tooltip" 
                        ><i class="icon-ban-circle"></i><?php 
            /** ?><img src="<?php echo WPDEV_BK_PLUGIN_URL; ?>/img/remove-16x16.png" style="width:15px; height:15px;"><?php /**/
            ?>
</a><a                     
                            href="javascript:void(0)" 
                            onclick="javascript:if ( bk_are_you_sure('<?php 
            echo esc_js(__('Do you really want to delete this booking ?', 'wpdev-booking'));
            ?>
') ) delete_booking(<?php 
            echo $booking_id;
            ?>
, <?php 
            echo $user_bk_id;
            ?>
, '<?php 
            echo getBookingLocale();
            ?>
' , 1   );"
                            data-original-title="<?php 
            _e('Delete', 'wpdev-booking');
            ?>
"  rel="tooltip" 
                            class="tooltip_top button-secondary button"
                        ><i class="icon-trash"></i><?php 
            /** ?><img src="<?php echo WPDEV_BK_PLUGIN_URL; ?>/img/delete_type.png" style="width:13px; height:13px;"><?php /**/
            ?>
</a><?php 
            make_bk_action('wpdev_bk_listing_show_print_btn', $booking_id);
            make_bk_action('wpdev_bk_listing_show_payment_status_btn', $booking_id);
            ?>
                      
                    <div class="field-date" style="<?php 
            echo $is_free ? 'margin-top:5px;float: none;white-space: normal;' : '';
            ?>
"><span ><?php 
            _e('Created', 'wpdev-booking');
            ?>
:</span> <span><?php 
            echo $cr_date, ' ', $cr_time;
            ?>
</span></div>
                  </div>
              <?php 
        }
        ?>
              </div>
       
              <?php 
        make_bk_action('wpdev_bk_listing_show_edit_fields', $booking_id, $bk_remark);
        ?>

              <?php 
        make_bk_action('wpdev_bk_listing_show_payment_status_cost_fields', $booking_id, $bk_pay_status);
        ?>
              
          </div>
        <?php 
    }
    ?>
        </div>

        <?php 
    //if  ( wpbc_is_field_in_table_exists('booking','is_new') != 0 )  renew_NumOfNewBookings($id_of_new_bookings); // Update num status if supported
    ?>

        <?php 
    make_bk_action('wpdev_bk_listing_show_change_booking_resources', $booking_types);
    ?>

        <?php 
    if (function_exists('wpdevbk_generate_print_loyout')) {
        wpdevbk_generate_print_loyout($print_data);
    }
}
Example #2
0
function wpdev_bk_timeline_header_row($start_date = false)
{
    if (isset($_REQUEST['wh_booking_type']) && strpos($_REQUEST['wh_booking_type'], ',') !== false) {
        $is_show_resources_matrix = true;
    } else {
        $is_show_resources_matrix = false;
    }
    $current_resource_id = '';
    // Initial  params
    $view_days_num = $_REQUEST['view_days_num'];
    if ($is_show_resources_matrix) {
        // MATRIX VIEW
        switch ($view_days_num) {
            case '1':
                $days_num = 1;
                $cell_width = '99%';
                $dwa = array(1 => __('Monday', 'wpdev-booking'), 2 => __('Tuesday', 'wpdev-booking'), 3 => __('Wednesday', 'wpdev-booking'), 4 => __('Thursday', 'wpdev-booking'), 5 => __('Friday', 'wpdev-booking'), 6 => __('Saturday', 'wpdev-booking'), 7 => __('Sunday', 'wpdev-booking'));
                $time_selles_num = 24;
                break;
            case '7':
                $days_num = 7;
                $cell_width = '13.8%';
                $dwa = array(1 => __('Monday', 'wpdev-booking'), 2 => __('Tuesday', 'wpdev-booking'), 3 => __('Wednesday', 'wpdev-booking'), 4 => __('Thursday', 'wpdev-booking'), 5 => __('Friday', 'wpdev-booking'), 6 => __('Saturday', 'wpdev-booking'), 7 => __('Sunday', 'wpdev-booking'));
                $dwa = array(1 => __('Mon'), 2 => __('Tue'), 3 => __('Wed'), 4 => __('Thu'), 5 => __('Fri'), 6 => __('Sat'), 7 => __('Sun'));
                $time_selles_num = 1;
                break;
            case '30':
                $days_num = 31;
                $cell_width = '3%';
                $dwa = array(1 => __('Mon'), 2 => __('Tue'), 3 => __('Wed'), 4 => __('Thu'), 5 => __('Fri'), 6 => __('Sat'), 7 => __('Sun'));
                $time_selles_num = 1;
                break;
            case '60':
                $days_num = 62;
                $cell_width = '1.5%';
                $dwa = array(1 => __('M'), 2 => __('T'), 3 => __('W'), 4 => __('T'), 5 => __('F'), 6 => __('S'), 7 => __('S'));
                $time_selles_num = 1;
                break;
            default:
                // 30
                $days_num = 31;
                $cell_width = '3%';
                $dwa = array(1 => __('Mon'), 2 => __('Tue'), 3 => __('Wed'), 4 => __('Thu'), 5 => __('Fri'), 6 => __('Sat'), 7 => __('Sun'));
                $time_selles_num = 1;
                break;
        }
    } else {
        switch ($view_days_num) {
            case '90':
                $days_num = 7;
                $cell_width = '13.8%';
                $dwa = array(1 => __('Monday', 'wpdev-booking'), 2 => __('Tuesday', 'wpdev-booking'), 3 => __('Wednesday', 'wpdev-booking'), 4 => __('Thursday', 'wpdev-booking'), 5 => __('Friday', 'wpdev-booking'), 6 => __('Saturday', 'wpdev-booking'), 7 => __('Sunday', 'wpdev-booking'));
                $time_selles_num = 1;
                break;
            case '365':
                $days_num = 32;
                $cell_width = '3%';
                $dwa = array(1 => __('M'), 2 => __('Tu'), 3 => __('W'), 4 => __('Th'), 5 => __('F'), 6 => __('Sa'), 7 => __('Su'));
                $time_selles_num = 1;
                break;
            default:
                // 30
                $days_num = 1;
                $cell_width = '99%';
                $dwa = array(1 => __('Mon'), 2 => __('Tue'), 3 => __('Wed'), 4 => __('Thu'), 5 => __('Fri'), 6 => __('Sat'), 7 => __('Sun'));
                $time_selles_num = 24;
                break;
        }
    }
    if ($start_date === false) {
        $start_year = date('Y');
        $start_month = date('n');
        $start_day = date('j');
        if (!empty($_REQUEST['scroll_start_date'])) {
            // scroll_start_date=2013-07-01
            $scroll_start_date = explode('-', $_REQUEST['scroll_start_date']);
            $start_year = $scroll_start_date[0];
            //2012
            $start_month = $scroll_start_date[1];
            //09
            $start_day = $scroll_start_date[2];
            //date("d");//1;     //31
        }
    } else {
        $start_year = date("Y", $start_date);
        //2012
        $start_month = date("m", $start_date);
        //09
        $start_day = date("d", $start_date);
        //31
    }
    ?>
    <div class="container-fluid <?php 
    if ($is_show_resources_matrix) {
        echo ' matrix_resources ';
    } else {
        echo ' single_resource ';
    }
    ?>
 bk_timeline_header"><div class="row-fluid"><div class="span12">
        <div id="timeline_scroller<?php 
    echo $current_resource_id;
    ?>
" class="calendar_timeline_scroller">
            <div class="calendar_timeline_frame" >
                <?php 
    $previous_month = '';
    $bk_admin_url_today = get_params_in_url(array('scroll_month', 'scroll_day', 'scroll_start_date'));
    for ($d_inc = 0; $d_inc < $days_num; $d_inc++) {
        $real_date = mktime(0, 0, 0, $start_month, $start_day + $d_inc, $start_year);
        if (date('m.d.Y') == date("m.d.Y", $real_date)) {
            $is_today = ' today_date ';
        } else {
            $is_today = '';
        }
        $yy = date("Y", $real_date);
        //2012
        $mm = date("m", $real_date);
        //09
        $dd = date("d", $real_date);
        //31
        $ww = date("N", $real_date);
        //7
        $day_week = $dwa[$ww];
        //Su
        $day_title = $dd . ' ' . $day_week;
        if ($is_show_resources_matrix) {
            if ($view_days_num == 1) {
                $day_title = wpdevbk_get_date_in_correct_format($yy . '-' . $mm . '-' . $dd . ' 00:00:00');
                $day_title = $day_week . ', ' . $day_title[0];
            }
            if ($view_days_num == 7) {
                $day_title = wpdevbk_get_date_in_correct_format($yy . '-' . $mm . '-' . $dd . ' 00:00:00');
                $day_title = $day_week . ', ' . $day_title[0];
            }
            if ($view_days_num == 30) {
                $day_title = $dd . ' ' . $day_week;
            }
            if ($view_days_num == 60) {
                $day_title = $dd . ' ' . $day_week;
            }
        } else {
            if ($view_days_num == 1) {
                $day_title = wpdevbk_get_date_in_correct_format($yy . '-' . $mm . '-' . $dd . ' 00:00:00');
                $day_title = $day_week . ', ' . $day_title[0];
            }
            if ($view_days_num == 7) {
                $day_title = wpdevbk_get_date_in_correct_format($yy . '-' . $mm . '-' . $dd . ' 00:00:00');
                $day_title = $day_week . ', ' . $dd;
            }
            if ($view_days_num == 30) {
                $day_title = __('Times', 'wpdev-booking');
            }
            if ($view_days_num == 90) {
                $day_title = $day_week;
            }
            if ($view_days_num == 365) {
                $day_title = $dd;
            }
        }
        $day_filter_id = $yy . '-' . $mm . '-' . $dd;
        if ($previous_month != $mm) {
            $previous_month = $mm;
            $month_title = date("F", $real_date);
            //09
            $month_class = ' new_month ';
        } else {
            $month_title = '';
            $month_class = '';
        }
        /*
                            // We are need to  stop DAY loop, if we are in Month view mode, and we are already out of this month
                            if (
                                 ( ($d_inc> 0 ) && ($month_class == ' new_month ') && (in_array($view_days_num ,array('365'))) && (! $is_show_resources_matrix) ) || 
                                 ( ($d_inc> 0 ) && ($month_class == ' new_month ') && (in_array($view_days_num ,array('30'))) && ($is_show_resources_matrix) )  
                               )     
                            {
                                ?>
                                <div id="cell_<?php  echo  $current_resource_id. '_' . $day_filter_id ; ?>" 
                                     class="calendar_overview_cell cell_header time_in_days_num_<?php echo $view_days_num;?> weekday<?php echo $ww . ' '.$day_filter_id.' '.$month_class ; ?>" 
                                     style="width:1px;"></div>
                                <?php
                                break;
                            }/**/
        ?>
                    <div id="cell_<?php 
        echo $current_resource_id . '_' . $day_filter_id;
        ?>
" 
                         class="calendar_overview_cell cell_header time_in_days_num_<?php 
        echo $view_days_num;
        ?>
 weekday<?php 
        echo $ww . ' ' . $day_filter_id . ' ' . $month_class;
        ?>
" 
                         style="<?php 
        echo 'width:' . $cell_width . ';';
        ?>
">

                           <?php 
        if ($month_title != '') {
            ?>
                           <div class="month_year"><?php 
            echo $month_title . ', ' . $yy;
            ?>
</div>
                           <?php 
        }
        if ($view_days_num == 30 || $view_days_num == 60) {
            ?>
<a href='<?php 
            echo $bk_admin_url_today . '&scroll_start_date=' . $yy . '-' . $mm . '-' . $dd;
            ?>
'><?php 
        }
        ?>
<div class="day_num"><?php 
        echo $day_title;
        ?>
</div><?php 
        if ($view_days_num == 30 || $view_days_num == 60) {
            ?>
</a><?php 
        }
        // T i m e   c e l l s
        $tm = floor(24 / $time_selles_num);
        for ($tt = 0; $tt < $time_selles_num; $tt++) {
            ?>
                                <div class="time_section_in_day time_section_in_day_header time_hour<?php 
            echo $tt * $tm;
            ?>
 time_in_days_num_<?php 
            echo $view_days_num;
            ?>
">
                                    <?php 
            echo $view_days_num < 31 ? ($tt * $tm < 10 ? '0' : '') . $tt * $tm . '<sup>:00</sup>' : '';
            ?>
                                </div>
                            <?php 
        }
        ?>
                    </div>
                    <?php 
    }
    ?>
            </div>
        </div>
    </div></div></div>
    <?php 
    return $real_date;
}
    public function showImportedEvents()
    {
        ////////////////////////////////////////////////////////////////////////
        ?>
        
        <table style="width:100%;margin-top:45px;" id="gcal_imported_events<?php 
        echo $this->getResource();
        ?>
" class="resource_table booking_table" cellpadding="0" cellspacing="0">
            <?php 
        if (function_exists('get_booking_title')) {
            echo '<tr><td colspan="6" style="padding:5px 10px;font-style:italic;"> <h4>', get_booking_title($this->getResource()), '</h4></td></tr>';
        }
        ?>
            <?php 
        // Headers
        ?>
            <tr>
                <th style="width:15px;"><input type="checkbox" onclick="javascript:jQuery('#gcal_imported_events<?php 
        echo $this->getResource();
        ?>
 .events_items').attr('checked', this.checked);" class="" id="events_items_all"  name="events_items_all" /></th>
                <th style="width:10px;height:35px;border-left: 1px solid #BBBBBB;"> <?php 
        _e('ID', 'booking');
        ?>
 </th>
                <th style="height:35px;width:220px;" style="border-left: 1px solid #ccc;"> <?php 
        _e('Title', 'booking');
        ?>
 </th>                
                <th style="text-align:center;"> <?php 
        _e('Info', 'booking');
        ?>
 </th>
                <th style="text-align:center;"> <?php 
        _e('Dates', 'booking');
        ?>
 </th>
                <th style="width:10px;height:35px;border-left: 1px solid #BBBBBB;"> <?php 
        _e('GID', 'booking');
        ?>
 </th>
            </tr>
            <?php 
        $alternative_color = '';
        if (!empty($this->events)) {
            foreach ($this->events as $bt) {
                if ($alternative_color == '') {
                    $alternative_color = ' class="alternative_color" ';
                } else {
                    $alternative_color = '';
                }
                ?>
                   <tr id="gcal_imported_events_id_<?php 
                echo $bt['id'];
                ?>
">
                        <td <?php 
                echo $alternative_color;
                ?>
 ><span class="wpbc_mobile_legend"><?php 
                _e('Selection', 'booking');
                ?>
:</span><input type="checkbox" class="events_items" id="events_items_<?php 
                echo $bt['id'];
                ?>
" value="<?php 
                echo $bt['id'];
                ?>
"  name="events_items_<?php 
                echo $bt['id'];
                ?>
" /></td>
                        <td style="border-left: 1px solid #ccc;text-align: center;" <?php 
                echo $alternative_color;
                ?>
 ><span class="wpbc_mobile_legend"><?php 
                _e('ID', 'booking');
                ?>
:</span><?php 
                echo $bt['id'];
                ?>
</td>
                        <td <?php 
                echo $alternative_color;
                ?>
 style="border-left: 1px solid #ccc;">
                            <span class="wpbc_mobile_legend"><?php 
                _e('Title', 'booking');
                ?>
:</span>
                            <span ><?php 
                echo $bt['title'];
                ?>
</span>
                        </td>                        
                        <td style="border-right: 0px;border-left: 1px solid #ccc;text-align: center;" <?php 
                echo $alternative_color;
                ?>
 >
                            <span class="wpbc_mobile_legend"><?php 
                _e('Info', 'booking');
                ?>
:</span>
                            <span ><?php 
                echo $bt['description'];
                ?>
</span><br/>
                            <?php 
                if (!empty($bt['location'])) {
                    echo '<span >', __('Location:', 'booking'), ': ', $bt['location'], '</span>';
                }
                ?>
                        </td>

                        <td style="border-right: 0px;border-left: 1px solid #ccc;text-align: center;" <?php 
                echo $alternative_color;
                ?>
 >
                            <span class="booking-listing-collumn booking-dates">
                                <span class="wpbc_mobile_legend"><?php 
                _e('Dates', 'booking');
                ?>
:</span>
                                <div class="booking_dates_full" style="font-size: 11px;padding:3px 5px;" ><?php 
                $bt['dates'] = explode(', ', $bt['dates']);
                foreach ($bt['dates'] as $keyd => $valued) {
                    $valued = explode('.', $valued);
                    $valued = wpdevbk_get_date_in_correct_format(sprintf("%04d-%02d-%02d", $valued[2], $valued[1], $valued[0]));
                    $bt['dates'][$keyd] = '<a href="javascript:void(0)" class="field-booking-date" style="font-weight: normal;">' . $valued[0] . '</a>';
                }
                $bt['dates'] = implode('<span class="date_tire" style="font-size: 12px;">, </span>', $bt['dates']);
                echo $bt['dates'];
                //date_i18n('d.m.Y H:i',$bt['start_time'] ), ' - ', date_i18n('d.m.Y H:i',$bt['end_time']);
                ?>
                                </div>
                            </span>
                        </td>
                        <td style="border-left: 1px solid #ccc;text-align: center;" <?php 
                echo $alternative_color;
                ?>
 ><span class="wpbc_mobile_legend"><?php 
                _e('GID', 'booking');
                ?>
:</span><?php 
                echo $bt['sync_gid'];
                ?>
</td>
                   </tr>                   
            <?php 
            }
        }
        ?>

            <tr class="wpbc_table_footer">
                <td colspan="6" style="text-align: center;"> 
                    <a href="javascript:void(0)" class="button button-primary" style="float:none;margin:10px;" 
                       onclick="javascript:location.reload();" ><?php 
        _e('Reload page', 'booking');
        ?>
</a>                    
                    <a href="javascript:void(0)" class="button" style="float:none;margin:10px;" 
                       onclick="javascript:jQuery('#gcal_imported_events<?php 
        echo $this->getResource();
        ?>
').remove();" ><?php 
        _e('Hide', 'booking');
        ?>
</a>                    
                    <a href="javascript:void(0)" class="button"  style="float:none;margin:10px;"                                        
                       onclick="javascript: if ( bk_are_you_sure('<?php 
        echo esc_js(__('Do you really want to delete selected booking(s) ?', 'booking'));
        ?>
') ) {
                                                    delete_booking( 
                                                                    get_selected_bookings_id_in_this_list('#gcal_imported_events<?php 
        echo $this->getResource();
        ?>
 .events_items', 13) 
                                                                    , <?php 
        echo $this->getUserID();
        ?>
                                                                    , '<?php 
        echo getBookingLocale();
        ?>
' 
                                                                    , 1  
                                                    ); 
                                            } "
                       ><?php 
        _e('Delete selected booking(s)', 'booking');
        ?>
</i></a>
                    
                </td>
            </tr>

        </table>
        <script type="text/javascript"> 
            jQuery("#gcal_imported_events<?php 
        echo $this->getResource();
        ?>
").insertAfter("#booking_listings_interface_header");
        </script>
        <?php 
    }