public function perform() { $task = wpdevart_bc_Library::get_value('task'); $id = wpdevart_bc_Library::get_value('id', 0); if (method_exists($this, $task)) { $this->{$task}($id); } else { $this->display_extras(); } }
public function perform() { $task = wpdevart_bc_Library::get_value('task'); $id = wpdevart_bc_Library::get_value('id', 0); /* $task="edit"; $id=3;*/ if (method_exists($this, $task)) { $this->{$task}($id); } else { $this->display_themes(); } }
public function perform() { $task = wpdevart_bc_Library::get_value('task'); //$task="edit"; $id = wpdevart_bc_Library::get_value('id', 0); //$id=2; $action = wpdevart_bc_Library::get_value('action'); if (method_exists($this, $task)) { $this->{$task}($id); } else { $this->display_calendars(); } }
public function edit_extra($id = 0) { $wpdevart_extras = array('extra_field1' => array('name' => 'extra_field1', 'label' => __('Adults', 'booking-calendar'), 'type' => 'extras_field', 'items' => array('field_item1' => array('name' => 'field_item1', 'label' => '1', 'operation' => '+', 'price_type' => 'price', 'price_percent' => '0', 'order' => '1'), 'field_item2' => array('name' => 'field_item2', 'label' => '2', 'operation' => '+', 'price_type' => 'price', 'price_percent' => '0', 'order' => '2'), 'field_item3' => array('name' => 'field_item3', 'label' => '3', 'operation' => '+', 'price_type' => 'price', 'price_percent' => '0', 'order' => '3'), 'field_item4' => array('name' => 'field_item4', 'label' => '4', 'operation' => '+', 'price_type' => 'price', 'price_percent' => '0', 'order' => '4')), 'default' => ''), 'extra_field2' => array('name' => 'extra_field2', 'label' => __('Children ', 'booking-calendar'), 'type' => 'extras_field', 'items' => array('field_item1' => array('name' => 'field_item1', 'label' => '1', 'operation' => '+', 'price_type' => 'price', 'price_percent' => '0', 'order' => '1'), 'field_item2' => array('name' => 'field_item2', 'label' => '2', 'operation' => '+', 'price_type' => 'price', 'price_percent' => '0', 'order' => '2'), 'field_item3' => array('name' => 'field_item3', 'label' => '3', 'operation' => '+', 'price_type' => 'price', 'price_percent' => '0', 'order' => '3'), 'field_item4' => array('name' => 'field_item4', 'label' => '4', 'operation' => '+', 'price_type' => 'price', 'price_percent' => '0', 'order' => '4')), 'default' => '')); if ($id != 0) { $extra_rows = $this->model_obj->get_extra_rows($id); $value = json_decode($extra_rows->data, true); $wpdevart_extras = $value; $last_element = end($wpdevart_extras); $max_id = str_replace('extra_field', '', $last_element['name']); } else { $max_id = 2; } ?> <div id="wpdevart_extras" class="wpdevart-item-container wpdevart-main-item-container"> <?php if ($id != 0) { ?> <div class="div-for-clear"> <span class="admin_logo"></span> <h1>Edit Extra <a href="http://wpdevart.com/wordpress-booking-calendar-plugin/"><span class="pro_feature"> (Upgrade to Pro Version)</span></a></h1> </div> <?php } else { ?> <div class="div-for-clear"> <span class="admin_logo"></span> <h1>Edit Extra <a href="http://wpdevart.com/wordpress-booking-calendar-plugin/"><span class="pro_feature"> (Upgrade to Pro Version)</span></a></h1> </div> <?php } ?> <form action="?page=wpdevart-extras" method="post"> <div id="wpdevart_wpdevart-item_title"> <span>Extra Name</span> <input type="text" name="title" value="<?php if (isset($extra_rows->title)) { echo esc_attr($extra_rows->title); } ?> "> <input type="submit" value="Save" class="action-link wpda-input" name="save"> <input type="submit" value="Apply" class="action-link wpda-input" name="apply"> <div id="add_field_container"> <div id="add_extra_field" data-max="<?php echo $max_id; ?> "> </div> </div> </div> <?php ?> <div class="wpdevart-item-section"> <h3>Extras fields</h3> <div class="wpdevart-item-section-cont"> <?php foreach ($wpdevart_extras as $key => $wpdevart_extra) { $sett_value = $wpdevart_extras[$key]; wpdevart_bc_Library::wpdevart_extras_field($wpdevart_extra, $sett_value); } ?> <div id="new_extra_fields"> </div> </div> </div> <input type="hidden" name="task" value="save"> <input type="hidden" name="id" value="<?php echo $id; ?> "> </form> </div> <?php }
public function display_calendars() { $rows = $this->model_obj->get_calendars_rows(); $items_nav = $this->model_obj->items_nav(); $asc_desc = isset($_POST['asc_desc']) && $_POST['asc_desc'] == 'asc' ? 'asc' : 'desc'; $res_order_by = isset($_POST['order_by']) ? esc_html($_POST['order_by']) : 'id'; $res_order_class = 'sorted ' . $asc_desc; ?> <div id="wpdevart_calendars_container" class="wpdevart-list-container"> <div id="action-buttons" class="div-for-clear"> <div class="div-for-clear"> <span class="admin_logo"></span> <h1>Calendars <a href="http://wpdevart.com/wordpress-booking-calendar-plugin/"><span class="pro_feature"> (Upgrade to Pro Version)</span></a></h1> </div> <a href="" onclick="wpdevart_set_value('task','add'); wpdevart_form_submit(event, 'calendars_form')" class="action-link">Add Calendar</a> <a href="" onclick="wpdevart_set_value('task','delete_selected'); wpdevart_form_submit(event, 'calendars_form')" class="action-link delete-link">Delete</a> </div> <form action="admin.php?page=wpdevart-calendars" method="post" id="calendars_form"> <?php wpdevart_bc_Library::items_nav($items_nav['limit'], $items_nav['total'], 'calendars_form'); ?> <table class="wp-list-table widefat fixed pages wpdevart-table"> <tr> <thead> <th class="check-column"><input type="checkbox" name="check_all" onclick="check_all_checkboxes(this,'check_for_action');"></th> <th class="small-column">ID</th> <th>Title</th> <th>Shortcode</th> <th class="action-column">Edit</th> <th class="action-column">Delete</th> </thead> <tr> <?php foreach ($rows as $row) { ?> <tr> <td><input type="checkbox" name="check_for_action[]" class="check_for_action" value="<?php echo $row->id; ?> "></td> <td><?php echo $row->id; ?> </td> <td><a href="" onclick="wpdevart_set_value('task','edit'); wpdevart_set_value('cur_id','<?php echo $row->id; ?> '); wpdevart_form_submit(event, 'calendars_form')" ><?php echo $row->title; ?> </a></td> <td><input type="text" value="[wpdevart_booking_calendar id="<?php echo $row->id; ?> "]" onclick="this.focus();this.select();" readonly="readonly" size="32"></td> <td><a href="" onclick="wpdevart_set_value('task','edit'); wpdevart_set_value('cur_id','<?php echo $row->id; ?> '); wpdevart_form_submit(event, 'calendars_form')" >Edit</a></td> <td><a href="" onclick="wpdevart_set_value('task','delete'); wpdevart_set_value('cur_id','<?php echo $row->id; ?> '); wpdevart_form_submit(event, 'calendars_form')" >Delete</a></td> <tr> <?php } ?> </table> <input type="hidden" name="task" id="task" value=""> <input type="hidden" name="id" id="cur_id" value=""> <?php wpdevart_bc_Library::items_nav($items_nav['limit'], $items_nav['total'], 'calendars_form'); ?> </form> </div> <?php }
public function display_forms($error_msg = "", $delete = true) { $rows = $this->model_obj->get_forms_rows(); $items_nav = $this->model_obj->items_nav(); $asc_desc = isset($_POST['asc_desc']) && $_POST['asc_desc'] == 'asc' ? 'asc' : 'desc'; $res_order_by = isset($_POST['order_by']) ? esc_html($_POST['order_by']) : 'id'; $res_order_class = 'sorted ' . $asc_desc; ?> <div id="wpdevart_forms_container" class="wpdevart-list-container"> <div id="action-buttons" class="div-for-clear"> <div class="div-for-clear"> <span class="admin_logo"></span> <h1>Forms <a href="http://wpdevart.com/wordpress-booking-calendar-plugin/"><span class="pro_feature"> (Upgrade to Pro Version)</span></a></h1> </div> <a href="" onclick="wpdevart_set_value('task','add'); wpdevart_form_submit(event, 'forms_form')" class="action-link">Add Form</a> <a href="" onclick="wpdevart_set_value('task','delete_selected'); wpdevart_form_submit(event, 'forms_form')" class="action-link delete-link">Delete</a> </div> <?php if (isset($error_msg) && $error_msg != "") { $class = "error"; if ($delete === true) { $class = "updated"; } ?> <div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $error_msg; ?> </p></div> <?php } ?> <form action="admin.php?page=wpdevart-forms" method="post" id="forms_form"> <?php wpdevart_bc_Library::items_nav($items_nav['limit'], $items_nav['total'], 'forms_form'); ?> <table class="wp-list-table widefat fixed pages wpdevart-table"> <tr> <thead> <th class="check-column"><input type="checkbox" name="check_all" onclick="check_all_checkboxes(this,'check_for_action');"></th> <th class="small-column">ID</th> <th>Title</th> <th class="action-column">Edit</th> <th class="action-column">Delete</th> </thead> <tr> <?php foreach ($rows as $row) { ?> <tr> <td><input type="checkbox" name="check_for_action[]" class="check_for_action" value="<?php echo $row->id; ?> "></td> <td><?php echo $row->id; ?> </td> <td><a href="" onclick="wpdevart_set_value('task','edit'); wpdevart_set_value('cur_id','<?php echo $row->id; ?> '); wpdevart_form_submit(event, 'forms_form')" ><?php echo $row->title; ?> </a></td> <td><a href="" onclick="wpdevart_set_value('task','edit'); wpdevart_set_value('cur_id','<?php echo $row->id; ?> '); wpdevart_form_submit(event, 'forms_form')" >Edit</a></td> <td><a href="" onclick="wpdevart_set_value('task','delete'); wpdevart_set_value('cur_id','<?php echo $row->id; ?> '); wpdevart_form_submit(event, 'forms_form')" >Delete</a></td> <tr> <?php } ?> </table> <input type="hidden" name="task" id="task" value=""> <input type="hidden" name="id" id="cur_id" value=""> <?php wpdevart_bc_Library::items_nav($items_nav['limit'], $items_nav['total'], 'forms_form'); ?> </form> </div> <?php }
public function display_reservations($id = 0) { if (!isset($_SESSION["clendar_id"])) { $_SESSION["clendar_id"] = 0; } if (isset($_POST["clendar_id"])) { $_SESSION["clendar_id"] = $_POST["clendar_id"]; } $rows = $this->model_obj->get_reservations_rows($id); $calendar_rows = $this->model_obj->get_calendar_rows(); $theme_options = $this->model_obj->get_theme_rows($_SESSION["clendar_id"]); $items_nav = $this->model_obj->items_nav($id); $asc_desc = isset($_POST['asc_desc']) && $_POST['asc_desc'] == 'asc' ? 'asc' : 'desc'; $res_order_by = isset($_POST['order_by']) ? esc_html($_POST['order_by']) : 'id'; $res_order_class = 'sorted ' . $asc_desc; ?> <div id="wpdevart_reservations_container" class="wpdevart-list-container list-view"> <form action="admin.php?page=wpdevart-reservations" method="post" id="reservations_form"> <div id="action-buttons" class="div-for-clear"> <div id="reservation_header" class="div-for-clear"> <div class="div-for-clear"> <span class="admin_logo"></span> <h1>Reservations List View <a href="http://wpdevart.com/wordpress-booking-calendar-plugin/"><span class="pro_feature"> (Upgrade to Pro Version)</span></a></h1> </div> <select name="clendar_id" onchange="this.form.submit()"> <option value='0'>Select Calendar</option> <?php foreach ($calendar_rows as $calendar_row) { echo "<option value='" . $calendar_row["id"] . "' " . selected($_SESSION["clendar_id"], $calendar_row["id"]) . ">" . $calendar_row["title"] . "</option>"; } ?> </select> <span id="view_list"><span class="reservation-item-info">Reservation List View</span></span> <span id="view_calendar" class="pro-field"><span class="reservation-item-info">Reservation Month View<span class="pro_feature">(Pro Feature!)</span></span></span> <a id="add_reservation" href="" onclick="wpdevart_set_value('task','add'); wpdevart_form_submit(event, 'reservations_form')" class="add-reservation"><span class="plus">+</span><span class="reservation-item-info">Add Reservation</span></a> </div> <div id="resrv_action_filters"> <div class="reserv_actions_filters_tabs div-for-clear"> <div id="wpdevart_tab_1" class="wpdevart_tab show"> <span>Actions</span> </div> <div id="wpdevart_tab_2" class="wpdevart_tab"> <span>Filters</span> </div> </div> <div class="wpdevart_action_filters_container"> <div id="wpdevart_tab_1_container" class="wpdevart_container show"> <a href="" onclick="wpdevart_set_value('task','approve_selected'); wpdevart_form_submit(event, 'reservations_form')" class="action-button approve-button">Approve</a> <a href="" onclick="wpdevart_set_value('task','reject_selected');wpdevart_form_submit(event, 'reservations_form')" class="action-button reject-button">Reject</a> <a href="" onclick="wpdevart_set_value('task','canceled_selected');wpdevart_form_submit(event, 'reservations_form')" class="action-button cancel-button">Cancel</a> <a href="" onclick="wpdevart_set_value('task','delete_selected'); wpdevart_form_submit(event, 'reservations_form')" class="action-button delete-button">Delete</a> </div> <div id="wpdevart_tab_2_container" class="wpdevart_container div-for-clear"> <div class="filter_item status_filter_item"> <label class="filter_item_label">Select Status</label> <div class="filter_fild_item"> <input type="checkbox" name="reserv_status[]" id="res_approved" value="approved" <?php checked(isset($_POST["reserv_status"]) && in_array("approved", $_POST["reserv_status"])); ?> ><label for="res_approved">Approved</label> </div> <div class="filter_fild_item"> <input type="checkbox" name="reserv_status[]" id="res_canceled" value="canceled" <?php checked(isset($_POST["reserv_status"]) && in_array("canceled", $_POST["reserv_status"])); ?> ><label for="res_canceled">Canceled</label> </div> <div class="filter_fild_item"> <input type="checkbox" name="reserv_status[]" id="res_rejected" value="rejected" <?php checked(isset($_POST["reserv_status"]) && in_array("rejected", $_POST["reserv_status"])); ?> ><label for="res_rejected">Rejected</label> </div> <div class="filter_fild_item"> <input type="checkbox" name="reserv_status[]" id="res_pending" value="pending" <?php checked(isset($_POST["reserv_status"]) && in_array("pending", $_POST["reserv_status"])); ?> ><label for="res_pending">Pending</label> </div> </div> <div class="filter_item period_filter_item"> <label class="filter_item_label">Period</label> <div class="filter_fild_item"> <input type="text" name="reserv_period_start" value="<?php echo isset($_POST["reserv_period_start"]) ? esc_js($_POST["reserv_period_start"]) : ""; ?> " class="admin_datepicker" placeholder="Check In"> </div> <div class="filter_fild_item"> <input type="text" name="reserv_period_end" value="<?php echo isset($_POST["reserv_period_end"]) ? esc_js($_POST["reserv_period_end"]) : ""; ?> " class="admin_datepicker" placeholder="Check Out"> </div> </div> <div class="filter_item searchs_filter_item"> <label class="filter_item_label">Search</label> <div class="filter_fild_item"> <input type="text" name="wpdevart_serch" value="<?php echo isset($_POST["wpdevart_serch"]) ? esc_js($_POST["wpdevart_serch"]) : ""; ?> "> </div> </div> <input type="submit" value="Applay" class="action-link"> </div> </div> </div> </div> <?php if (isset($_SESSION["clendar_id"]) && $_SESSION["clendar_id"] != 0) { wpdevart_bc_Library::items_nav($items_nav['limit'], $items_nav['total'], 'reservations_form'); } ?> <table class="wp-list-table widefat fixed pages wpdevart-table wpdevart-reservations-table"> <tr> <thead> <th class="check-column"><input type="checkbox" name="check_all" onclick="check_all_checkboxes(this,'check_for_action');"></th> <th class="small-column <?php echo $res_order_by == 'id' ? $res_order_class : ""; ?> "><a onclick="wpdevart_set_value('order_by', 'id'); wpdevart_set_value('asc_desc', '<?php echo $res_order_by == 'id' && $asc_desc == 'asc' ? 'desc' : 'asc'; ?> ');wpdevart_form_submit(event, 'reservations_form')" href=""><span>ID</span><span class="sorting-indicator"></span></a></th> <th class="average-column <?php echo $res_order_by == 'status' ? $res_order_class : ""; ?> "><a onclick="wpdevart_set_value('order_by', 'status'); wpdevart_set_value('asc_desc', '<?php echo $res_order_by == 'status' && $asc_desc == 'asc' ? 'desc' : 'asc'; ?> ');wpdevart_form_submit(event, 'reservations_form')" href=""><span>Status</span><span class="sorting-indicator"></span></a></th> <th>Reservation information</th> <th class="medium-column">Reservation dates</th> <th class="medium-column">Actions</th> </thead> <tr> <?php if (isset($_SESSION["clendar_id"]) && $_SESSION["clendar_id"] != 0) { foreach ($rows as $row) { $form_data = $this->model_obj->get_form_data($row->form); $extras_data = $this->model_obj->get_extra_data($row); if (isset($theme_options["date_format"]) && $theme_options["date_format"] != "") { $date_format = $theme_options["date_format"]; } else { $date_format = "F d, Y"; } if ($row->check_in) { $check_in = date($date_format, strtotime($row->check_in)); $check_out = date($date_format, strtotime($row->check_out)); $day_count = abs($this->get_date_diff($row->check_in, $row->check_out)) + 1; } else { $single_day = date($date_format, strtotime($row->single_day)); $day_count = 1; } ?> <tr> <td><input type="checkbox" name="check_for_action[]" class="check_for_action" value="<?php echo $row->id; ?> "></td> <td><?php echo $row->id; ?> </td> <td><span class="reserv_status reserv_status_<?php echo $row->status; ?> "><?php echo $row->status; ?> <span></td> <td> <div class="reserv-info div-for-clear"> <div class='reserv-info-container'> <h5>Details</h5> <span class='form_info'><span class='form_label'>Item Count</span> <span class='form_value'><?php echo $row->count_item; ?> </span></span> <span class='form_info'><span class='form_label'>Price</span> <span class='form_value'><?php echo $row->price . $row->currency; ?> </span></span> <span class='form_info'><span class='form_label'>Total Price</span> <span class='form_value'><?php echo $row->total_price . $row->currency; ?> </span></span> </div> <span class="reserv-info-open"></span> </div> <div class="reserv-info-items div-for-clear"> <?php $reserv_info = ""; if (count($form_data)) { $reserv_info .= "<div class='reserv-info-container'>"; $reserv_info .= "<h5>Contact Information</h5>"; foreach ($form_data as $form_fild_data) { $reserv_info .= "<span class='form_info'><span class='form_label'>" . $form_fild_data["label"] . "</span> <span class='form_value'>" . $form_fild_data["value"] . "</span></span>"; } $reserv_info .= "</div>"; } if (count($extras_data)) { $reserv_info .= "<div class='reserv-info-container'>"; $reserv_info .= "<h5>Extra Information</h5>"; foreach ($extras_data as $extra_data) { $reserv_info .= "<h6>" . $extra_data["group_label"] . "</h6>"; $reserv_info .= "<span class='form_info'><span class='form_label'>" . $extra_data["label"] . "</span>"; $reserv_info .= "<span class='form_value'>"; if ($extra_data["price_type"] == "percent") { $reserv_info .= "<span class='price-percent'>" . $extra_data["operation"] . $extra_data["price_percent"] . "%</span>"; $reserv_info .= "<span class='price'>" . $extra_data["operation"] . $extra_data["price"] . $row->currency . "</span></span></span>"; } else { $reserv_info .= "<span class='price'>" . $extra_data["operation"] . $extra_data["price"] * $day_count . $row->currency . "</span></span></span>"; } } $reserv_info .= "<h6>Price change</h6>"; $reserv_info .= "<span class='form_info'><span class='form_label'></span><span class='form_value'>+" . $row->extras_price . $row->currency . "</span>"; $reserv_info .= "</div>"; } echo $reserv_info; ?> </div> </td> <td> <?php if (isset($check_in) && isset($check_out)) { echo $check_in . "-" . $check_out; } else { echo $single_day; } ?> </td> <td> <?php if ($row->status == "pending" || $row->status == "canceled" || $row->status == "rejected") { ?> <a href="" onclick="wpdevart_set_value('task','approve'); wpdevart_set_value('cur_id','<?php echo $row->id; ?> '); wpdevart_form_submit(event, 'reservations_form')" >Approve</a> <?php if ($row->status == "pending") { ?> <a href="" onclick="wpdevart_set_value('task','reject'); wpdevart_set_value('cur_id','<?php echo $row->id; ?> '); wpdevart_form_submit(event, 'reservations_form')" >Reject</a> <?php } ?> <?php } elseif ($row->status == "approved") { ?> <a href="" onclick="wpdevart_set_value('task','canceled'); wpdevart_set_value('cur_id','<?php echo $row->id; ?> '); wpdevart_form_submit(event, 'reservations_form')" >Cancel</a> <?php } ?> <a href="" onclick="wpdevart_set_value('task','delete'); wpdevart_set_value('cur_id','<?php echo $row->id; ?> '); wpdevart_form_submit(event, 'reservations_form')" >Delete</a></td> <tr> <?php } } ?> </table> <input type="hidden" name="task" id="task" value=""> <input type="hidden" name="id" id="cur_id" value=""> <input type="hidden" name="order_by" id="order_by" value="<?php echo isset($_POST['order_by']) ? esc_html($_POST['order_by']) : ""; ?> "/> <input type="hidden" name="asc_desc" id="asc_desc" value="<?php echo isset($_POST['asc_desc']) ? esc_html($_POST['asc_desc']) : ""; ?> "/> <?php if (isset($_SESSION["clendar_id"]) && $_SESSION["clendar_id"] != 0) { wpdevart_bc_Library::items_nav($items_nav['limit'], $items_nav['total'], 'reservations_form'); } ?> </form> </div> <?php }
public function wpdevart_add_extra_field_item() { $count = 0; $max_id = 0; if (isset($_POST['wpdevart_extra_field_item_max'])) { $max_id = esc_html($_POST['wpdevart_extra_field_item_max']); } if (isset($_POST['wpdevart_extra_field'])) { $extra_field = esc_html($_POST['wpdevart_extra_field']); } if (isset($_POST['wpdevart_extra_field_item_count'])) { $count = esc_html($_POST['wpdevart_extra_field_item_count']); } $args = array('name' => 'field_item' . ($max_id + 1 + $count), 'label' => $max_id + 1, 'operation' => '+', 'price_type' => 'price', 'price_percent' => '0', 'order' => $max_id + 1); wpdevart_bc_Library::wpdevart_extras_field_item($extra_field, $args); wp_die(); }