function dpProEventCalendar_settings() { global $dpProEventCalendar, $current_user; if (!is_array($dpProEventCalendar['user_roles'])) { $dpProEventCalendar['user_roles'] = array(); } if (!in_array(dpProEventCalendar_get_user_role(), $dpProEventCalendar['user_roles']) && dpProEventCalendar_get_user_role() != "administrator" && !is_super_admin($current_user->ID)) { return; } // Add a new submenu under Options: add_menu_page('Event Calendar', __('Event Calendar', 'dpProEventCalendar'), 'edit_posts', 'dpProEventCalendar-admin', 'dpProEventCalendar_calendars_page', dpProEventCalendar_plugin_url('images/dpProEventCalendar_icon.gif'), '139.2'); add_submenu_page('dpProEventCalendar-admin', __('Categories', 'dpProEventCalendar'), __('Categories', 'dpProEventCalendar'), 'edit_posts', 'edit-tags.php?taxonomy=pec_events_category'); if (dpProEventCalendar_get_user_role() != 'editor' && dpProEventCalendar_get_user_role() != 'contributor' && dpProEventCalendar_get_user_role() != 'author') { add_submenu_page('dpProEventCalendar-admin', __('Calendars', 'dpProEventCalendar'), __('Calendars', 'dpProEventCalendar'), 'edit_posts', 'dpProEventCalendar-admin', 'dpProEventCalendar_calendars_page'); add_submenu_page('dpProEventCalendar-admin', __('Special Dates', 'dpProEventCalendar'), __('Special Dates / Event Color', 'dpProEventCalendar'), 'edit_posts', 'dpProEventCalendar-special', 'dpProEventCalendar_special_page'); add_submenu_page('dpProEventCalendar-admin', __('Settings', 'dpProEventCalendar'), __('Settings', 'dpProEventCalendar'), 'edit_posts', 'dpProEventCalendar-settings', 'dpProEventCalendar_settings_page'); add_submenu_page('dpProEventCalendar-admin', __('Custom Shortcodes', 'dpProEventCalendar'), __('Custom Shortcodes', 'dpProEventCalendar'), 'edit_posts', 'dpProEventCalendar-custom-shortcodes', 'dpProEventCalendar_custom_shortcodes_page'); } //add_submenu_page('dpProEventCalendar-admin', __('Documentation', 'dpProEventCalendar'), __('Documentation', 'dpProEventCalendar'), 'edit_posts', 'dpProEventCalendar-documentation', 'dpProEventCalendar_documentation_page'); //add_submenu_page('dpProEventCalendar-admin', __('Display Data in Event Page', 'dpProEventCalendar'), __('Display Data in Event Page', 'dpProEventCalendar'), 'edit_posts', 'dpProEventCalendar-eventdata', 'dpProEventCalendar_eventdata_page'); }
function output($print = false) { global $dpProEventCalendar, $dp_pec_payments; $width = ""; $html = ""; if ($this->type == 'calendar') { if (isset($this->calendar_obj->width) && !$this->is_admin && empty($this->event_id) && !$this->widget) { $width = 'style="width: ' . $this->calendar_obj->width . $this->calendar_obj->width_unity . ' " '; } if ($this->is_admin) { $html .= ' <div class="dpProEventCalendar_ModalCalendar">'; } $skin = ""; if ($this->opts['skin'] != "") { $skin = 'pec_skin_' . $this->opts['skin']; } $html .= ' <div class="dp_pec_wrapper dp_pec_calendar_' . $this->calendar_obj->id . ' dp_pec_' . ($this->is_admin || !empty($this->event_id) ? 'monthly' : $this->calendar_obj->view) . ' ' . $skin . '" id="dp_pec_id' . $this->nonce . '" ' . $width . '>'; if (!$this->is_admin && ($this->calendar_obj->ical_active || $this->calendar_obj->rss_active || $this->calendar_obj->subscribe_active || $this->calendar_obj->show_view_buttons)) { $html .= ' <div class="dp_pec_options_nav">'; if ($this->calendar_obj->show_view_buttons) { $html .= ' <a href="javascript:void(0);" class="dp_pec_view dp_pec_view_action ' . ($this->calendar_obj->view == "monthly" || $this->calendar_obj->view == "monthly-all-events" ? "active" : "") . '" data-pec-view="monthly">' . $this->translation['TXT_MONTHLY'] . '</a> <a href="javascript:void(0);" class="dp_pec_view dp_pec_view_action ' . ($this->calendar_obj->view == "weekly" ? "active" : "") . '" data-pec-view="weekly">' . $this->translation['TXT_WEEKLY'] . '</a> <a href="javascript:void(0);" class="dp_pec_view dp_pec_view_action ' . ($this->calendar_obj->view == "daily" ? "active" : "") . '" data-pec-view="daily">' . $this->translation['TXT_DAILY'] . '</a> '; } $html .= ' <div class="dp_pec_options_nav_divider"></div>'; if ($this->calendar_obj->ical_active) { $html .= "<a class='dpProEventCalendar_feed' href='" . dpProEventCalendar_plugin_url('includes/ical.php?calendar_id=' . $this->id_calendar) . "'>iCal</a>"; } if ($this->calendar_obj->rss_active) { $html .= "<a class='dpProEventCalendar_feed' href='" . dpProEventCalendar_plugin_url('includes/rss.php?calendar_id=' . $this->id_calendar) . "'>RSS</a>"; } if ($this->calendar_obj->subscribe_active) { $html .= "<a class='dpProEventCalendar_feed dpProEventCalendar_subscribe' href='javascript:void(0);'>" . $this->translation['TXT_SUBSCRIBE'] . "</a>"; } $html .= ' <div class="dp_pec_clear"></div> </div> '; } $allow_user_add_event_roles = explode(',', $this->calendar_obj->allow_user_add_event_roles); $allow_user_add_event_roles = array_filter($allow_user_add_event_roles); if (!is_array($allow_user_add_event_roles) || empty($allow_user_add_event_roles) || $allow_user_add_event_roles == "") { $allow_user_add_event_roles = array('all'); } if ($this->calendar_obj->allow_user_add_event && !$this->is_admin && (in_array(dpProEventCalendar_get_user_role(), $allow_user_add_event_roles) || in_array('all', $allow_user_add_event_roles) || !is_user_logged_in() && !$this->calendar_obj->assign_events_admin)) { $html .= ' <div class="dp_pec_add_nav">'; $html .= ' <a href="javascript:void(0);" class="dp_pec_view dp_pec_add_event pec_action_btn dp_pec_btnright">' . $this->translation['TXT_ADD_EVENT'] . '</a> <a href="javascript:void(0);" class="dp_pec_view dp_pec_cancel_event pec_action_btn dp_pec_btnright">' . $this->translation['TXT_CANCEL'] . '</a> <div class="dp_pec_clear"></div> '; $html .= ' <div class="dp_pec_add_form">'; if (!is_user_logged_in() && !$this->calendar_obj->assign_events_admin) { $html .= ' <div class="dp_pec_notification_box dp_pec_visible"> ' . $this->translation['TXT_EVENT_LOGIN'] . ' </div>'; } else { $html .= ' <div class="dp_pec_notification_box dp_pec_notification_event_succesfull"> ' . $this->translation['TXT_EVENT_THANKS'] . ' </div>'; $html .= ' <form name="dp_pec_event_form" class="add_new_event_form" enctype="multipart/form-data" method="post"> <div class="pec-add-body"> <div class=""> <div class="dp_pec_row"> <input type="text" value="" placeholder="' . $this->translation['TXT_EVENT_TITLE'] . '" id="" class="dp_pec_form_title" name="title" /> </div> '; if ($this->calendar_obj->form_show_description) { $html .= ' <div class="dp_pec_row">'; if ($this->calendar_obj->form_text_editor) { // Turn on the output buffer ob_start(); // Echo the editor to the buffer wp_editor('', $this->nonce . '_event_description', array('media_buttons' => false, 'textarea_name' => 'description', 'quicktags' => false, 'textarea_rows' => 5, 'teeny' => true)); // Store the contents of the buffer in a variable $editor_contents = ob_get_clean(); $html .= $editor_contents; } else { $html .= '<textarea placeholder="' . $this->translation['TXT_EVENT_DESCRIPTION'] . '" id="" name="description" cols="50" rows="5"></textarea>'; } $html .= ' </div> '; } $html .= ' <div class="dp_pec_row dp_pec_cal_new_sub"> <div class="dp_pec_col6"> '; if ($this->calendar_obj->form_show_category) { $cat_args = array('taxonomy' => 'pec_events_category', 'hide_empty' => 0); if ($this->calendar_obj->category_filter_include != "") { $cat_args['include'] = $this->calendar_obj->category_filter_include; } $categories = get_categories($cat_args); if (count($categories) > 0) { $html .= ' <div class="dp_pec_row"> <div class="dp_pec_col12"> <span class="dp_pec_form_desc">' . $this->translation['TXT_CATEGORY'] . '</span> '; foreach ($categories as $category) { $html .= '<div class="pec_checkbox_list">'; $html .= '<input type="checkbox" name="category-' . $category->term_id . '" class="checkbox" value="' . $category->term_id . '" />'; $html .= $category->cat_name; $html .= '</div>'; } $html .= ' <div class="dp_pec_clear"></div> </div> </div> '; } } $html .= ' <div class="dp_pec_row"> <div class="dp_pec_col6"> <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_START_DATE'] . '</span> <input type="text" readonly="readonly" name="date" maxlength="10" id="" class="large-text dp_pec_date_input" value="' . date('Y-m-d') . '" style="width:80px;" /> </div> <div class="dp_pec_col6"> <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_END_DATE'] . '</span> <input type="text" readonly="readonly" name="end_date" maxlength="10" id="" class="large-text dp_pec_end_date_input" value="" style="width:80px;" /> <button type="button" class="dp_pec_clear_end_date"> <img src="' . dpProEventCalendar_plugin_url('images/admin/clear.png') . '" alt="Clear" title="Clear"> </button> </div> <div class="dp_pec_clear"></div> </div> <div class="dp_pec_row"> <div class="dp_pec_col6"> <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_START_TIME'] . '</span> <select name="time_hours" class="dp_pec_new_event_time" id="" style="width:' . ($this->calendar_obj->format_ampm ? '70' : '50') . 'px;">'; for ($i = 0; $i <= 23; $i++) { $hour = str_pad($i, 2, "0", STR_PAD_LEFT); if ($this->calendar_obj->format_ampm) { $hour = ($hour > 12 ? $hour - 12 : ($hour == '00' ? '12' : $hour)) . ' ' . date('A', mktime($hour, 0)); } $html .= ' <option value="' . str_pad($i, 2, "0", STR_PAD_LEFT) . '">' . $hour . '</option>'; } $html .= ' </select> <select name="time_minutes" class="dp_pec_new_event_time" id="pec_time_minutes" style="width:50px;">'; for ($i = 0; $i <= 59; $i += 5) { $html .= ' <option value="' . str_pad($i, 2, "0", STR_PAD_LEFT) . '">' . str_pad($i, 2, "0", STR_PAD_LEFT) . '</option>'; } $html .= ' </select> </div> <div class="dp_pec_col6"> <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_END_TIME'] . '</span> <select name="end_time_hh" class="dp_pec_new_event_time" id="" style="width:' . ($this->calendar_obj->format_ampm ? '70' : '50') . 'px;"> <option value="">--</option>'; for ($i = 0; $i <= 23; $i++) { $hour = str_pad($i, 2, "0", STR_PAD_LEFT); if ($this->calendar_obj->format_ampm) { $hour = ($hour > 12 ? $hour - 12 : ($hour == '00' ? '12' : $hour)) . ' ' . date('A', mktime($hour, 0)); } $html .= ' <option value="' . str_pad($i, 2, "0", STR_PAD_LEFT) . '">' . $hour . '</option>'; } $html .= ' </select> <select name="end_time_mm" class="dp_pec_new_event_time" id="" style="width:50px;"> <option value="">--</option>'; for ($i = 0; $i <= 59; $i += 5) { $html .= ' <option value="' . str_pad($i, 2, "0", STR_PAD_LEFT) . '">' . str_pad($i, 2, "0", STR_PAD_LEFT) . '</option>'; } $html .= ' </select> </div> <div class="dp_pec_clear"></div> </div> <div class="dp_pec_row"> '; if ($this->calendar_obj->form_show_hide_time) { $html .= ' <div class="dp_pec_col6"> <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_HIDE_TIME'] . '</span> <select name="hide_time"> <option value="0">' . $this->translation['TXT_NO'] . '</option> <option value="1">' . $this->translation['TXT_YES'] . '</option> </select> <div class="dp_pec_clear"></div> '; if ($this->calendar_obj->form_show_all_day) { $html .= ' <input type="checkbox" class="checkbox" name="all_day" id="" value="1" /> <span class="dp_pec_form_desc dp_pec_form_desc_left">' . $this->translation['TXT_EVENT_ALL_DAY'] . '</span>'; } $html .= ' </div>'; } elseif ($this->calendar_obj->form_show_all_day) { $html .= ' <div class="dp_pec_col6"> <input type="checkbox" class="checkbox" name="all_day" id="" value="1" /> <span class="dp_pec_form_desc dp_pec_form_desc_left">' . $this->translation['TXT_EVENT_ALL_DAY'] . '</span> </div>'; } if ($this->calendar_obj->form_show_frequency) { $html .= ' <div class="dp_pec_col6"> <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_FREQUENCY'] . '</span> <select name="recurring_frecuency" id="pec_recurring_frecuency" class="pec_recurring_frequency"> <option value="0">' . $this->translation['TXT_NONE'] . '</option> <option value="1">' . $this->translation['TXT_EVENT_DAILY'] . '</option> <option value="2">' . $this->translation['TXT_EVENT_WEEKLY'] . '</option> <option value="3">' . $this->translation['TXT_EVENT_MONTHLY'] . '</option> <option value="4">' . $this->translation['TXT_EVENT_YEARLY'] . '</option> </select> '; $html .= ' <div class="pec_daily_frequency" style="display:none;"> <div class="dp_pec_clear"></div> <div id="pec_daily_every_div">' . __('Every', 'dpProEventCalendar') . ' <input type="number" min="1" max="99" style="width:60px;padding: 5px 10px;margin-bottom: 10px !important;" maxlength="2" class="dp_pec_new_event_text" name="pec_daily_every" id="pec_daily_every" value="1" /> ' . __('days', 'dpProEventCalendar') . ' </div> <div class="dp_pec_clear"></div> <div id="pec_daily_working_days_div"><input type="checkbox" name="pec_daily_working_days" id="pec_daily_working_days" class="checkbox" onclick="pec_check_daily_working_days(this);" value="1" />' . __('All working days', 'dpProEventCalendar') . '</div> </div>'; $html .= ' <div class="pec_weekly_frequency" style="display:none;"> <div class="dp_pec_clear"></div> ' . __('Repeat every', 'dpProEventCalendar') . ' <input type="number" min="1" max="99" style="width:60px;padding: 5px 10px;margin-bottom: 10px !important;" class="dp_pec_new_event_text" maxlength="2" name="pec_weekly_every" value="1" /> ' . __('week(s) on:', 'dpProEventCalendar') . ' <div class="dp_pec_clear"></div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="1" name="pec_weekly_day[]" /> ' . __('Mon', 'dpProEventCalendar') . ' </div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="2" name="pec_weekly_day[]" /> ' . __('Tue', 'dpProEventCalendar') . ' </div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="3" name="pec_weekly_day[]" /> ' . __('Wed', 'dpProEventCalendar') . ' </div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="4" name="pec_weekly_day[]" /> ' . __('Thu', 'dpProEventCalendar') . ' </div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="5" name="pec_weekly_day[]" /> ' . __('Fri', 'dpProEventCalendar') . ' </div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="6" name="pec_weekly_day[]" /> ' . __('Sat', 'dpProEventCalendar') . ' </div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="7" name="pec_weekly_day[]" /> ' . __('Sun', 'dpProEventCalendar') . ' </div> </div>'; $html .= ' <div class="pec_monthly_frequency" style="display:none;"> <div class="dp_pec_clear"></div> ' . __('Repeat every', 'dpProEventCalendar') . ' <input type="number" min="1" max="99" style="width:60px;padding: 5px 10px;margin-bottom: 10px !important;" class="dp_pec_new_event_text" maxlength="2" name="pec_monthly_every" value="1" /> ' . __('month(s) on:', 'dpProEventCalendar') . ' <div class="dp_pec_clear"></div> <select name="pec_monthly_position" id="pec_monthly_position" style="width:90px;"> <option value=""> ' . __('Recurring Option', 'dpProEventCalendar') . '</option> <option value="first"> ' . __('First', 'dpProEventCalendar') . '</option> <option value="second"> ' . __('Second', 'dpProEventCalendar') . '</option> <option value="third"> ' . __('Third', 'dpProEventCalendar') . '</option> <option value="fourth"> ' . __('Fourth', 'dpProEventCalendar') . '</option> <option value="last"> ' . __('Last', 'dpProEventCalendar') . '</option> </select> <select name="pec_monthly_day" id="pec_monthly_day" style="width:150px;"> <option value=""> ' . __('Recurring Option', 'dpProEventCalendar') . '</option> <option value="monday"> ' . __('Monday', 'dpProEventCalendar') . '</option> <option value="tuesday"> ' . __('Tuesday', 'dpProEventCalendar') . '</option> <option value="wednesday"> ' . __('Wednesday', 'dpProEventCalendar') . '</option> <option value="thursday"> ' . __('Thursday', 'dpProEventCalendar') . '</option> <option value="friday"> ' . __('Friday', 'dpProEventCalendar') . '</option> <option value="saturday"> ' . __('Saturday', 'dpProEventCalendar') . '</option> <option value="sunday"> ' . __('Sunday', 'dpProEventCalendar') . '</option> </select> </div> </div>'; } if ($this->calendar_obj->form_show_booking_enable) { $html .= ' <input type="checkbox" class="checkbox" name="booking_enable" id="" value="1" /> <span class="dp_pec_form_desc dp_pec_form_desc_left">' . __('Allow Bookings?', 'dpProEventCalendar') . '</span>'; } $html .= ' <div class="dp_pec_row">'; if ($this->calendar_obj->form_show_booking_price && is_plugin_active('dp-pec-payments/dp-pec-payments.php')) { $html .= ' <div class="dp_pec_col6"> <input type="number" min="0" value="" style="width: 120px;" placeholder="' . __('Price', 'dpProEventCalendar') . '" id="" name="price" /> <span class="dp_pec_form_desc dp_pec_form_desc_left">' . $dp_pec_payments['currency'] . '</span> </div>'; } if ($this->calendar_obj->form_show_booking_limit) { $html .= ' <div class="dp_pec_col6"> <input type="number" min="0" value="" style="width: 120px;" placeholder="' . __('Booking Limit', 'dpProEventCalendar') . '" id="" name="limit" /> </div>'; } $html .= ' </div>'; $html .= ' <div class="dp_pec_clear"></div> </div> '; $html .= ' <div class="dp_pec_clear"></div> </div> <div class="dp_pec_col6"> '; if ($this->calendar_obj->form_show_image) { $rand_image = rand(); $html .= ' <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_IMAGE'] . '</span> <div class="dp_pec_add_image_wrap"> <label for="event_image_' . $this->nonce . '_' . $rand_image . '"> <span class="dp_pec_add_image"></span> </label> <input type="text" class="dp_pec_new_event_text" value="" readonly="readonly" id="event_image_lbl" name="" /> </div> <input type="file" name="event_image" id="event_image_' . $this->nonce . '_' . $rand_image . '" class="event_image" style="visibility:hidden; position: absolute;" /> '; } if ($this->calendar_obj->form_show_link) { $html .= ' <input type="text" value="" placeholder="' . $this->translation['TXT_EVENT_LINK'] . '" id="" name="link" />'; } if ($this->calendar_obj->form_show_share) { $html .= ' <input type="text" value="" placeholder="' . $this->translation['TXT_EVENT_SHARE'] . '" id="" name="share" />'; } if ($this->calendar_obj->form_show_location) { $html .= ' <input type="text" value="" placeholder="' . $this->translation['TXT_EVENT_LOCATION'] . '" id="" name="location" />'; } if ($this->calendar_obj->form_show_phone) { $html .= ' <input type="text" value="" placeholder="' . $this->translation['TXT_EVENT_PHONE'] . '" id="" name="phone" />'; } if ($this->calendar_obj->form_show_map) { $html .= ' <input type="text" value="" placeholder="' . $this->translation['TXT_EVENT_GOOGLEMAP'] . '" id="" name="googlemap" />'; } if (is_array($dpProEventCalendar['custom_fields_counter'])) { $counter = 0; foreach ($dpProEventCalendar['custom_fields_counter'] as $key) { if ($dpProEventCalendar['custom_fields']['type'][$counter] == "checkbox") { $html .= ' <div class="dp_pec_wrap_checkbox"> <input type="checkbox" class="checkbox" value="1" id="" name="pec_custom_' . $dpProEventCalendar['custom_fields']['id'][$counter] . '" /> ' . $dpProEventCalendar['custom_fields']['placeholder'][$counter] . ' </div>'; } else { $html .= ' <input type="text" class="dp_pec_new_event_text" value="" placeholder="' . $dpProEventCalendar['custom_fields']['placeholder'][$counter] . '" id="" name="pec_custom_' . $dpProEventCalendar['custom_fields']['id'][$counter] . '" />'; } $counter++; } } $html .= ' </div> <div class="dp_pec_clear"></div> </div> </div> <div class="dp_pec_clear"></div> </div> <div class="pec-add-footer"> <a href="javascript:void(0);" class="dp_pec_view dp_pec_submit_event pec_action_btn dp_pec_btnright">' . $this->translation['TXT_SUBMIT_FOR_REVIEW'] . '</a> </div> </form>'; } $html .= ' </div>'; $html .= ' <div class="dp_pec_clear"></div> </div> '; } $html .= ' <div class="dp_pec_nav dp_pec_nav_monthly" ' . ($this->calendar_obj->view == "monthly" || $this->is_admin || !empty($this->event_id) ? "" : "style='display:none;'") . '> <span class="next_month"><strong>' . $this->translation['NEXT_MONTH'] . '</strong> »</span> <span class="prev_month">« <strong>' . $this->translation['PREV_MONTH'] . '</strong></span> <select class="pec_switch_month"> '; foreach ($this->translation['MONTHS'] as $key) { $html .= ' <option value="' . $key . '" ' . ($key == $this->translation['MONTHS'][$this->datesObj->currentMonth - 1] ? 'selected="selected"' : '') . '>' . $key . '</option>'; } $html .= ' </select> <select class="pec_switch_year"> '; for ($i = date('Y') - 2; $i <= date('Y') + 3; $i++) { $html .= ' <option value="' . $i . '" ' . ($i == $this->datesObj->currentYear ? 'selected="selected"' : '') . '>' . $i . '</option>'; } $html .= ' </select> <div class="dp_pec_clear"></div> </div> '; $html .= ' <div class="dp_pec_nav dp_pec_nav_daily" ' . ($this->calendar_obj->view == "daily" && !$this->is_admin && empty($this->event_id) ? "" : "style='display:none;'") . '> <span class="next_day"><strong>' . $this->translation['NEXT_DAY'] . '</strong> »</span> <span class="prev_day">« <strong>' . $this->translation['PREV_DAY'] . '</strong></span> <span class="actual_day">' . date_i18n(get_option('date_format'), $this->defaultDate) . '</span> <div class="dp_pec_clear"></div> </div> '; if ($this->calendar_obj->first_day == 1) { $weekly_first_date = strtotime('last monday', $this->defaultDate + 24 * 60 * 60); $weekly_last_date = strtotime('next sunday', $this->defaultDate - 24 * 60 * 60); } else { $weekly_first_date = strtotime('last sunday', $this->defaultDate + 24 * 60 * 60); $weekly_last_date = strtotime('next saturday', $this->defaultDate - 24 * 60 * 60); } $weekly_format = get_option('date_format'); $weekly_format = 'd F, Y'; $weekly_txt = date_i18n('d F', $weekly_first_date) . ' - ' . date_i18n($weekly_format, $weekly_last_date); if (date('m', $weekly_first_date) == date('m', $weekly_last_date)) { $weekly_txt = date('d', $weekly_first_date) . ' - ' . date_i18n($weekly_format, $weekly_last_date); } if (date('Y', $weekly_first_date) != date('Y', $weekly_last_date)) { $weekly_txt = date_i18n($weekly_format, $weekly_first_date) . ' - ' . date_i18n($weekly_format, $weekly_last_date); } $html .= ' <div class="dp_pec_nav dp_pec_nav_weekly" ' . ($this->calendar_obj->view == "weekly" && !$this->is_admin && empty($this->event_id) ? "" : "style='display:none;'") . '> <span class="next_week"><strong>' . $this->translation['NEXT_WEEK'] . '</strong> »</span> <span class="prev_week">« <strong>' . $this->translation['PREV_WEEK'] . '</strong></span> <span class="actual_week">' . $weekly_txt . '</span> <div class="dp_pec_clear"></div> </div> '; if (!$this->is_admin) { $specialDatesList = $this->getSpecialDatesList(); $html .= ' <div class="dp_pec_layout">'; if ($this->calendar_obj->show_references) { $html .= ' <a href="javascript:void(0);" class="dp_pec_references dp_pec_btnleft">' . $this->translation['TXT_REFERENCES'] . '</a> <div class="dp_pec_references_div"> <a href="javascript:void(0);" class="dp_pec_references_close">x</a>'; $html .= ' <div class="dp_pec_references_div_sp"> <div class="dp_pec_references_color" style="background-color: ' . $this->calendar_obj->current_date_color . '"></div> <div class="dp_pec_references_title">' . $this->translation['TXT_CURRENT_DATE'] . '</div> <div style="clear:both;"></div> </div>'; if (count($specialDatesList) > 0) { foreach ($specialDatesList as $key) { $html .= ' <div class="dp_pec_references_div_sp"> <div class="dp_pec_references_color" style="background-color: ' . $key->color . '"></div> <div class="dp_pec_references_title">' . $key->title . '</div> <div style="clear:both;"></div> </div>'; } } $html .= ' </div>'; } $html .= ' <a href="javascript:void(0);" class="dp_pec_view_all dp_pec_btnleft">' . $this->translation['TXT_VIEW_ALL_EVENTS'] . '</a>'; if ($this->calendar_obj->show_category_filter && empty($this->category)) { $html .= '<select name="pec_categories" class="pec_categories_list"> <option value="">' . $this->translation['TXT_ALL_CATEGORIES'] . '</option>'; $cat_args = array('taxonomy' => 'pec_events_category', 'hide_empty' => 0); if ($this->calendar_obj->category_filter_include != "") { $cat_args['include'] = $this->calendar_obj->category_filter_include; } $categories = get_categories($cat_args); foreach ($categories as $category) { $html .= '<option value="' . $category->term_id . '">'; $html .= $category->cat_name; $html .= '</option>'; } $html .= ' </select>'; } if ($this->calendar_obj->show_search) { $html .= ' <form method="post" class="dp_pec_search_form"> <input type="text" class="dp_pec_search" value="" placeholder="' . $this->translation['TXT_SEARCH'] . '"> <input type="submit" class="no-replace dp_pec_search_go" value=""> </form> <div style="clear:both;"></div>'; } $html .= ' </div> '; } $html .= ' <div style="clear:both;"></div> <div class="dp_pec_content"> '; if ($this->calendar_obj->view == "monthly" || $this->is_admin || !empty($this->event_id)) { $html .= $this->monthlyCalendarLayout(); } if ($this->calendar_obj->view == "daily" && !$this->is_admin && empty($this->event_id)) { $html .= $this->dailyCalendarLayout(); } if ($this->calendar_obj->view == "weekly" && !$this->is_admin && empty($this->event_id)) { $html .= $this->weeklyCalendarLayout(); } $html .= ' </div> </div>'; if ($this->is_admin) { $html .= ' </div>'; } } elseif ($this->type == 'upcoming') { $html .= ' <div class="dp_pec_wrapper dp_pec_calendar_' . $this->calendar_obj->id . '" id="dp_pec_id' . $this->nonce . '" ' . $width . '> '; $html .= ' <div style="clear:both;"></div> <div class="dp_pec_content"> '; $html .= $this->upcomingCalendarLayout(); $html .= ' </div> </div>'; } elseif ($this->type == 'past') { $html .= ' <div class="dp_pec_wrapper dp_pec_calendar_' . $this->calendar_obj->id . '" id="dp_pec_id' . $this->nonce . '" ' . $width . '> '; $html .= ' <div style="clear:both;"></div> <div class="dp_pec_content"> '; if (empty($this->from)) { $this->from = "1970-01-01"; } $html .= $this->upcomingCalendarLayout(false, $this->limit, '', null, null, true, false, true, false, true); $html .= ' </div> </div>'; } elseif ($this->type == 'accordion') { $skin = ""; if ($this->opts['skin'] != "") { $skin = 'pec_skin_' . $this->opts['skin']; } $html .= ' <div class="dp_pec_accordion_wrapper dp_pec_calendar_' . $this->calendar_obj->id . ' ' . $skin . '" id="dp_pec_id' . $this->nonce . '" ' . $width . '> '; if ($this->calendar_obj->ical_active) { $html .= "<a class='dpProEventCalendar_feed' href='" . dpProEventCalendar_plugin_url('includes/ical.php?calendar_id=' . $this->id_calendar) . "'>iCal</a>"; } if ($this->calendar_obj->rss_active) { $html .= "<a class='dpProEventCalendar_feed' href='" . dpProEventCalendar_plugin_url('includes/rss.php?calendar_id=' . $this->id_calendar) . "'>RSS</a>"; } if ($this->calendar_obj->subscribe_active) { $html .= "<a class='dpProEventCalendar_feed dpProEventCalendar_subscribe' href='javascript:void(0);'>" . $this->translation['TXT_SUBSCRIBE'] . "</a>"; } $html .= ' <div style="clear:both;"></div> <div class="dp_pec_content_header"> <span class="events_loading"><i class="fa fa-cog fa-spin"></i></span> <h2 class="actual_month">' . $this->translation['MONTHS'][$this->datesObj->currentMonth - 1] . ' ' . $this->datesObj->currentYear . '</h2> <div class="month_arrows"> <span class="prev_month"><i class="fa fa-angle-left"></i></span> <span class="next_month"><i class="fa fa-angle-right"></i></span> </div> <span class="return_layout"><i class="fa fa-angle-double-left"></i></span> </div> '; if ($this->calendar_obj->show_search) { $html .= ' <div class="dp_pec_content_search"> <input type="text" class="dp_pec_content_search_input" placeholder="' . $this->translation['TXT_SEARCH'] . '" /> <a href="javascript:void(0);" class="dp_pec_icon_search" data-results_lang="' . addslashes($this->translation['TXT_RESULTS_FOR']) . '"><i class="fa fa-search"></i></a> </div>'; } $html .= ' <div class="dp_pec_content"> '; $year = $this->datesObj->currentYear; $next_month_days = cal_days_in_month(CAL_GREGORIAN, str_pad($this->datesObj->currentMonth, 2, "0", STR_PAD_LEFT), $year); $month_number = str_pad($this->datesObj->currentMonth, 2, "0", STR_PAD_LEFT); global $dpProEventCalendar_cache; if (!$this->is_admin && isset($dpProEventCalendar_cache['calendar_id_' . $this->id_calendar]) && isset($dpProEventCalendar_cache['calendar_id_' . $this->id_calendar]['accordionLayout'][$year . "-" . $month_number]) && $this->calendar_obj->cache_active && empty($this->category) && empty($this->event_id) && empty($this->author) && $this->limit_description == 0) { $html .= $dpProEventCalendar_cache['calendar_id_' . $this->id_calendar]['accordionLayout'][$year . "-" . $month_number]['html']; //echo '<pre>'; //print_r($dpProEventCalendar_cache['calendar_id_'.$this->id_calendar]); //echo '</pre>'; } else { $html_month_list = ""; $html_month_list = $this->eventsMonthList($year . "-" . $month_number . "-01 00:00:00", $year . "-" . $month_number . "-" . $next_month_days . " 23:59:59"); $html .= $html_month_list; if (!$this->is_admin && empty($this->category) && empty($this->event_id) && empty($this->author) && $this->limit_description == 0) { $cache = array('calendar_id_' . $this->id_calendar => array('accordionLayout' => array($year . "-" . $month_number => array('html' => $html_month_list, 'lastUpdate' => time())))); if (!$dpProEventCalendar_cache) { update_option('dpProEventCalendar_cache', $cache); } else { if ($html_month_list != "") { //$dpProEventCalendar_cache[] = $cache; $dpProEventCalendar_cache['calendar_id_' . $this->id_calendar]['accordionLayout'][$year . "-" . $month_number] = array('html' => $html_month_list, 'lastUpdate' => time()); //print_r($dpProEventCalendar_cache); update_option('dpProEventCalendar_cache', $dpProEventCalendar_cache); } } } } $html .= ' </div> </div>'; } elseif ($this->type == 'accordion-upcoming') { $skin = ""; if ($this->opts['skin'] != "") { $skin = 'pec_skin_' . $this->opts['skin']; } $html .= ' <div class="dp_pec_accordion_wrapper dp_pec_calendar_' . $this->calendar_obj->id . ' ' . $skin . '" id="dp_pec_id' . $this->nonce . '" ' . $width . '> '; $html .= ' <div style="clear:both;"></div> <div class="dp_pec_content"> '; $html .= $this->eventsMonthList(null, null, $this->limit); $html .= ' </div> </div>'; } elseif ($this->type == 'grid-upcoming') { $html .= ' <div class="dp_pec_grid_wrapper" id="dp_pec_id' . $this->nonce . '" ' . $width . '> '; $html .= ' <div style="clear:both;"></div> <div class="dp_pec_content"> <ul> '; $html .= $this->gridMonthList(null, null, $this->limit); $html .= ' </ul> </div> </div>'; } elseif ($this->type == 'gmap-upcoming') { $html .= ' <div class="dp_pec_gmap_wrapper" id="dp_pec_id' . $this->nonce . '" ' . $width . '> '; $event_list = $this->upcomingCalendarLayout(true, $this->limit, '', null, null, true, false, false, true); $unique_events = array(); $event_marker = ""; $first_loc = ""; if (is_array($event_list)) { foreach ($event_list as $obj) { if ($obj->id == "") { $obj->id = $obj->ID; } if (!is_object($unique_events[$obj->id])) { $unique_events[$obj->id] = $obj; if ($this->calendar_obj->format_ampm) { $time = date('h:i A', strtotime($obj->date)); } else { $time = date('H:i', strtotime($obj->date)); } $end_date = ''; $end_year = ''; if ($obj->end_date != "" && $obj->end_date != "0000-00-00" && $obj->recurring_frecuency == 1) { $end_day = date('d', strtotime($obj->end_date)); $end_month = date('n', strtotime($obj->end_date)); $end_year = date('Y', strtotime($obj->end_date)); //$end_date = ' / <br />'.$end_day.' '.substr($this->translation['MONTHS'][($end_month - 1)], 0, 3).', '.$end_year; $end_date = ' / ' . date_i18n(get_option('date_format'), strtotime($obj->end_date)); } $end_time = ""; if ($obj->end_time_hh != "" && $obj->end_time_mm != "") { $end_time = str_pad($obj->end_time_hh, 2, "0", STR_PAD_LEFT) . ":" . str_pad($obj->end_time_mm, 2, "0", STR_PAD_LEFT); } if ($end_time != "") { if ($this->calendar_obj->format_ampm) { $end_time_tmp = date('h:i A', strtotime("2000-01-01 " . $end_time . ":00")); } else { $end_time_tmp = date('H:i', strtotime("2000-01-01 " . $end_time . ":00")); } $end_time = " / " . $end_time_tmp; if ($end_time_tmp == $time) { $end_time = ""; } } if ($event->all_day) { $time = $this->translation['TXT_ALL_DAY']; $end_time = ""; } $title = $obj->title; if ($this->calendar_obj->link_post) { $title = '<a href="' . get_permalink($obj->id) . '">' . addslashes($title) . '</a>'; } $event_marker .= 'codeAddress("' . $obj->map . '", \'' . addslashes($title) . '\', \'' . get_the_post_thumbnail($obj->id, 'medium') . '\', \'' . date_i18n(get_option('date_format'), strtotime($obj->date)) . $end_date . ($this->calendar_obj->show_time && !$event->hide_time || $event->all_day ? ' - ' . $time . $end_time : '') . '\'); '; } if ($first_loc == "") { $first_loc = $obj->map; } } $html .= ' <div style="clear:both;"></div> <div class="dp_pec_map_canvas" id="dp_pec_map_canvas' . $this->nonce . '"></div> <script type="text/javascript"> jQuery(document).ready(function() { var geocoder; var map; function initialize' . $this->nonce . '() { geocoder = new google.maps.Geocoder(); geocoder.geocode( { "address": "' . $first_loc . '"}, function(results, status) { var latlng = results[0].geometry.location; var mapOptions = { zoom: ' . ($dpProEventCalendar['google_map_zoom'] == "" ? 10 : $dpProEventCalendar['google_map_zoom']) . ', center: latlng } map = new google.maps.Map(document.getElementById("dp_pec_map_canvas' . $this->nonce . '"), mapOptions); }); '; $html .= $event_marker; $html .= ' } var infowindow = new google.maps.InfoWindow(); function getInfoWindowEvent(marker, content) { infowindow.close(); infowindow.setContent(content); infowindow.open(map, marker); } function codeAddress(address, title, image, eventdate) { geocoder.geocode( { "address": address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { //map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); google.maps.event.addListener(marker, "click", function() { infowindow.close(); var content = \'<div class="dp_pec_map_infowindow">\' +\'<span class="dp_pec_map_title">\'+title+\'</span><span class="dp_pec_map_date">\'+eventdate+\'</span><span class="dp_pec_map_location">\'+address+\'</span><div class="dp_pec_clear"></div>\'+image+\'\' +\'</div>\'; getInfoWindowEvent(marker, content); }); } else { console.log("Geocode was not successful for the following reason: " + status); } }); } google.maps.event.addDomListener(window, "load", initialize' . $this->nonce . '); }); </script>'; } else { $html .= '<div class="dp_pec_accordion_event dp_pec_accordion_no_events"><span>' . $this->translation['TXT_NO_EVENTS_FOUND'] . '</span></div>'; } $html .= ' </div>'; } elseif ($this->type == 'add-event') { $allow_user_add_event_roles = explode(',', $this->calendar_obj->allow_user_add_event_roles); $allow_user_add_event_roles = array_filter($allow_user_add_event_roles); if (!is_array($allow_user_add_event_roles) || empty($allow_user_add_event_roles) || $allow_user_add_event_roles == "") { $allow_user_add_event_roles = array('all'); } if (in_array(dpProEventCalendar_get_user_role(), $allow_user_add_event_roles) || in_array('all', $allow_user_add_event_roles) || !is_user_logged_in() && !$this->calendar_obj->assign_events_admin) { $skin = ""; if ($this->opts['skin'] != "") { $skin = 'pec_skin_' . $this->opts['skin']; } $html .= ' <div class="dp_pec_new_event_wrapper ' . $skin . '" id="dp_pec_id' . $this->nonce . '" ' . $width . '> '; $html .= ' <div style="clear:both;"></div> <div class="dp_pec_content_header"> <span class="events_loading"></span> <h2 class="actual_month">' . $this->translation['TXT_ADD_EVENT'] . '</h2> </div> <div class="dp_pec_content"> '; if (!is_user_logged_in() && !$this->calendar_obj->assign_events_admin) { $html .= '<div class="dp_pec_new_event_login"><span>' . $this->translation['TXT_EVENT_LOGIN'] . '</span></div>'; } else { $html .= ' <div class="dp_pec_new_event_login dp_pec_notification_event_succesfull"> ' . $this->translation['TXT_EVENT_THANKS'] . ' </div>'; $html .= ' <form enctype="multipart/form-data" method="post" class="add_new_event_form"> <input type="text" class="dp_pec_new_event_text dp_pec_form_title" placeholder="' . $this->translation['TXT_EVENT_TITLE'] . '" name="title" /> '; if ($this->calendar_obj->form_show_description) { if ($this->calendar_obj->form_text_editor) { // Turn on the output buffer ob_start(); // Echo the editor to the buffer wp_editor('', $this->nonce . '_event_description', array('media_buttons' => false, 'textarea_name' => 'description', 'quicktags' => false, 'textarea_rows' => 5, 'teeny' => true)); // Store the contents of the buffer in a variable $editor_contents = ob_get_clean(); $html .= $editor_contents; } else { $html .= '<textarea placeholder="' . $this->translation['TXT_EVENT_DESCRIPTION'] . '" class="dp_pec_new_event_text" id="" name="description" cols="50" rows="5"></textarea>'; } } $html .= ' <div class="dp_pec_row"> <div class="dp_pec_col6"> '; if ($this->calendar_obj->form_show_category) { $cat_args = array('taxonomy' => 'pec_events_category', 'hide_empty' => 0); if ($this->calendar_obj->category_filter_include != "") { $cat_args['include'] = $this->calendar_obj->category_filter_include; } $categories = get_categories($cat_args); if (count($categories) > 0) { $html .= ' <div class="dp_pec_row"> <div class="dp_pec_col12"> <span class="dp_pec_form_desc">' . $this->translation['TXT_CATEGORY'] . '</span> '; foreach ($categories as $category) { $html .= '<div class="pec_checkbox_list">'; $html .= '<input type="checkbox" name="category-' . $category->term_id . '" class="checkbox" value="' . $category->term_id . '" />'; $html .= $category->cat_name; $html .= '</div>'; } $html .= ' <div class="dp_pec_clear"></div> </div> </div> '; } } $html .= ' <div class="dp_pec_row"> <div class="dp_pec_col6"> <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_START_DATE'] . '</span> <div class="dp_pec_clear"></div> <input type="text" readonly="readonly" name="date" maxlength="10" id="" class="dp_pec_new_event_text dp_pec_date_input" value="' . date('Y-m-d') . '" /> </div> <div class="dp_pec_col6 dp_pec_end_date_form"> <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_END_DATE'] . '</span> <div class="dp_pec_clear"></div> <input type="text" readonly="readonly" name="end_date" maxlength="10" id="" class="dp_pec_new_event_text dp_pec_end_date_input" value="" /> <button type="button" class="dp_pec_clear_end_date"> <img src="' . dpProEventCalendar_plugin_url('images/admin/clear.png') . '" alt="Clear" title="Clear"> </button> </div> <div class="dp_pec_clear"></div> </div> <div class="dp_pec_row"> <div class="dp_pec_col6"> <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_START_TIME'] . '</span> <div class="dp_pec_clear"></div> <select class="dp_pec_new_event_time" name="time_hours" id="" style="width:' . ($this->calendar_obj->format_ampm ? '70' : '50') . 'px;">'; for ($i = 0; $i <= 23; $i++) { $hour = str_pad($i, 2, "0", STR_PAD_LEFT); if ($this->calendar_obj->format_ampm) { $hour = date('A', mktime($hour, 0)) . ' ' . ($hour > 12 ? $hour - 12 : ($hour == '00' ? '12' : $hour)); } $html .= ' <option value="' . str_pad($i, 2, "0", STR_PAD_LEFT) . '">' . $hour . '</option>'; } $html .= ' </select> <select class="dp_pec_new_event_time" name="time_minutes" id="pec_time_minutes" style="width:50px;">'; for ($i = 0; $i <= 59; $i += 5) { $html .= ' <option value="' . str_pad($i, 2, "0", STR_PAD_LEFT) . '">' . str_pad($i, 2, "0", STR_PAD_LEFT) . '</option>'; } $html .= ' </select> </div> <div class="dp_pec_col6"> <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_END_TIME'] . '</span> <div class="dp_pec_clear"></div> <select class="dp_pec_new_event_time" name="end_time_hh" id="" style="width:' . ($this->calendar_obj->format_ampm ? '70' : '50') . 'px;"> <option value="">--</option>'; for ($i = 0; $i <= 23; $i++) { $hour = str_pad($i, 2, "0", STR_PAD_LEFT); if ($this->calendar_obj->format_ampm) { $hour = date('A', mktime($hour, 0)) . ' ' . ($hour > 12 ? $hour - 12 : ($hour == '00' ? '12' : $hour)); } $html .= ' <option value="' . str_pad($i, 2, "0", STR_PAD_LEFT) . '">' . $hour . '</option>'; } $html .= ' </select> <select class="dp_pec_new_event_time" name="end_time_mm" id="" style="width:50px;"> <option value="">--</option>'; for ($i = 0; $i <= 59; $i += 5) { $html .= ' <option value="' . str_pad($i, 2, "0", STR_PAD_LEFT) . '">' . str_pad($i, 2, "0", STR_PAD_LEFT) . '</option>'; } $html .= ' </select> </div> <div class="dp_pec_clear"></div> </div> <div class="dp_pec_row"> '; if ($this->calendar_obj->form_show_hide_time) { $html .= ' <div class="dp_pec_col6"> <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_HIDE_TIME'] . '</span> <select name="hide_time"> <option value="0">' . $this->translation['TXT_NO'] . '</option> <option value="1">' . $this->translation['TXT_YES'] . '</option> </select> '; if ($this->calendar_obj->form_show_all_day) { $html .= ' <input type="checkbox" class="checkbox" name="all_day" id="" value="1" /> <span class="dp_pec_form_desc dp_pec_form_desc_left">' . $this->translation['TXT_EVENT_ALL_DAY'] . '</span>'; } $html .= ' </div>'; } elseif ($this->calendar_obj->form_show_all_day) { $html .= ' <div class="dp_pec_col6"> <input type="checkbox" class="checkbox" name="all_day" id="" value="1" /> <span class="dp_pec_form_desc dp_pec_form_desc_left">' . $this->translation['TXT_EVENT_ALL_DAY'] . '</span> </div>'; } if ($this->calendar_obj->form_show_frequency) { $html .= ' <div class="dp_pec_col6"> <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_FREQUENCY'] . '</span> <select name="recurring_frecuency" id="pec_recurring_frecuency" class="pec_recurring_frequency"> <option value="0">' . $this->translation['TXT_NONE'] . '</option> <option value="1">' . $this->translation['TXT_EVENT_DAILY'] . '</option> <option value="2">' . $this->translation['TXT_EVENT_WEEKLY'] . '</option> <option value="3">' . $this->translation['TXT_EVENT_MONTHLY'] . '</option> <option value="4">' . $this->translation['TXT_EVENT_YEARLY'] . '</option> </select> '; $html .= ' <div class="pec_daily_frequency" style="display:none;"> <div id="pec_daily_every_div">' . __('Every', 'dpProEventCalendar') . ' <input type="number" min="1" max="99" style="width:60px;padding: 5px 10px;margin-bottom: 10px !important;" maxlength="2" class="dp_pec_new_event_text" name="pec_daily_every" id="pec_daily_every" value="1" /> ' . __('days', 'dpProEventCalendar') . ' </div> <div id="pec_daily_working_days_div"><input type="checkbox" name="pec_daily_working_days" id="pec_daily_working_days" class="checkbox" onclick="pec_check_daily_working_days(this);" value="1" />' . __('All working days', 'dpProEventCalendar') . '</div> </div>'; $html .= ' <div class="pec_weekly_frequency" style="display:none;"> <div class="dp_pec_clear"></div> ' . __('Repeat every', 'dpProEventCalendar') . ' <input type="number" min="1" max="99" style="width:60px;padding: 5px 10px;margin-bottom: 10px !important;" class="dp_pec_new_event_text" maxlength="2" name="pec_weekly_every" value="1" /> ' . __('week(s) on:', 'dpProEventCalendar') . ' <div class="dp_pec_clear"></div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="1" name="pec_weekly_day[]" /> ' . __('Mon', 'dpProEventCalendar') . ' </div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="2" name="pec_weekly_day[]" /> ' . __('Tue', 'dpProEventCalendar') . ' </div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="3" name="pec_weekly_day[]" /> ' . __('Wed', 'dpProEventCalendar') . ' </div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="4" name="pec_weekly_day[]" /> ' . __('Thu', 'dpProEventCalendar') . ' </div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="5" name="pec_weekly_day[]" /> ' . __('Fri', 'dpProEventCalendar') . ' </div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="6" name="pec_weekly_day[]" /> ' . __('Sat', 'dpProEventCalendar') . ' </div> <div class="pec_checkbox_list"> <input type="checkbox" class="checkbox" value="7" name="pec_weekly_day[]" /> ' . __('Sun', 'dpProEventCalendar') . ' </div> </div>'; $html .= ' <div class="pec_monthly_frequency" style="display:none;"> <div class="dp_pec_clear"></div> ' . __('Repeat every', 'dpProEventCalendar') . ' <input type="number" min="1" max="99" style="width:60px;padding: 5px 10px;margin-bottom: 10px !important;" class="dp_pec_new_event_text" maxlength="2" name="pec_monthly_every" value="1" /> ' . __('month(s) on:', 'dpProEventCalendar') . ' <div class="dp_pec_clear"></div> <select name="pec_monthly_position" id="pec_monthly_position" style="width:90px;"> <option value=""> ' . __('Recurring Option', 'dpProEventCalendar') . '</option> <option value="first"> ' . __('First', 'dpProEventCalendar') . '</option> <option value="second"> ' . __('Second', 'dpProEventCalendar') . '</option> <option value="third"> ' . __('Third', 'dpProEventCalendar') . '</option> <option value="fourth"> ' . __('Fourth', 'dpProEventCalendar') . '</option> <option value="last"> ' . __('Last', 'dpProEventCalendar') . '</option> </select> <select name="pec_monthly_day" id="pec_monthly_day" style="width:150px;"> <option value=""> ' . __('Recurring Option', 'dpProEventCalendar') . '</option> <option value="monday"> ' . __('Monday', 'dpProEventCalendar') . '</option> <option value="tuesday"> ' . __('Tuesday', 'dpProEventCalendar') . '</option> <option value="wednesday"> ' . __('Wednesday', 'dpProEventCalendar') . '</option> <option value="thursday"> ' . __('Thursday', 'dpProEventCalendar') . '</option> <option value="friday"> ' . __('Friday', 'dpProEventCalendar') . '</option> <option value="saturday"> ' . __('Saturday', 'dpProEventCalendar') . '</option> <option value="sunday"> ' . __('Sunday', 'dpProEventCalendar') . '</option> </select> </div> </div>'; } if ($this->calendar_obj->form_show_booking_enable) { $html .= ' <input type="checkbox" class="checkbox" name="booking_enable" id="" value="1" /> <span class="dp_pec_form_desc dp_pec_form_desc_left">' . __('Allow Bookings?', 'dpProEventCalendar') . '</span>'; } $html .= ' <div class="dp_pec_row">'; if ($this->calendar_obj->form_show_booking_price && is_plugin_active('dp-pec-payments/dp-pec-payments.php')) { $html .= ' <div class="dp_pec_col6"> <input type="number" min="0" value="" class="dp_pec_new_event_text" style="width: 120px;" placeholder="' . __('Price', 'dpProEventCalendar') . '" id="" name="price" /> <span class="dp_pec_form_desc dp_pec_form_desc_left">' . $dp_pec_payments['currency'] . '</span> </div>'; } if ($this->calendar_obj->form_show_booking_limit) { $html .= ' <div class="dp_pec_col6"> <input type="number" min="0" value="" class="dp_pec_new_event_text" style="width: 120px;" placeholder="' . __('Booking Limit', 'dpProEventCalendar') . '" id="" name="limit" /> </div>'; } $html .= ' </div>'; $html .= ' <div class="dp_pec_clear"></div> </div> '; $html .= ' <div class="dp_pec_clear"></div> </div> <div class="dp_pec_col6"> '; if ($this->calendar_obj->form_show_image) { $rand_image = rand(); $html .= ' <span class="dp_pec_form_desc">' . $this->translation['TXT_EVENT_IMAGE'] . '</span> <div class="dp_pec_add_image_wrap"> <label for="event_image_' . $this->nonce . '_' . $rand_image . '"> <span class="dp_pec_add_image"></span> </label> <input type="text" class="dp_pec_new_event_text" value="" readonly="readonly" id="event_image_lbl" name="" /> </div> <input type="file" name="event_image" id="event_image_' . $this->nonce . '_' . $rand_image . '" class="event_image" style="visibility:hidden; position: absolute;" /> '; } if ($this->calendar_obj->form_show_link) { $html .= ' <input type="text" class="dp_pec_new_event_text" value="" placeholder="' . $this->translation['TXT_EVENT_LINK'] . '" id="" name="link" />'; } if ($this->calendar_obj->form_show_share) { $html .= ' <input type="text" class="dp_pec_new_event_text" value="" placeholder="' . $this->translation['TXT_EVENT_SHARE'] . '" id="" name="share" />'; } if ($this->calendar_obj->form_show_location) { $html .= ' <input type="text" class="dp_pec_new_event_text" value="" placeholder="' . $this->translation['TXT_EVENT_LOCATION'] . '" id="" name="location" />'; } if ($this->calendar_obj->form_show_phone) { $html .= ' <input type="text" class="dp_pec_new_event_text" value="" placeholder="' . $this->translation['TXT_EVENT_PHONE'] . '" id="" name="phone" />'; } if ($this->calendar_obj->form_show_map) { $html .= ' <input type="text" class="dp_pec_new_event_text" value="" placeholder="' . $this->translation['TXT_EVENT_GOOGLEMAP'] . '" id="" name="googlemap" />'; } if (is_array($dpProEventCalendar['custom_fields_counter'])) { $counter = 0; foreach ($dpProEventCalendar['custom_fields_counter'] as $key) { if ($dpProEventCalendar['custom_fields']['type'][$counter] == "checkbox") { $html .= ' <div class="dp_pec_wrap_checkbox"> <input type="checkbox" class="checkbox" value="1" id="" name="pec_custom_' . $dpProEventCalendar['custom_fields']['id'][$counter] . '" /> ' . $dpProEventCalendar['custom_fields']['placeholder'][$counter] . ' </div>'; } else { $html .= ' <input type="text" class="dp_pec_new_event_text" value="" placeholder="' . $dpProEventCalendar['custom_fields']['placeholder'][$counter] . '" id="" name="pec_custom_' . $dpProEventCalendar['custom_fields']['id'][$counter] . '" />'; } $counter++; } } $html .= ' </div> </div> <div class="dp_pec_clear"></div> <div class="pec-add-footer"> <button class="dp_pec_submit_event">' . $this->translation['TXT_SUBMIT_FOR_REVIEW'] . '</button> <div class="dp_pec_clear"></div> </div> </form>'; } $html .= ' </div> <div class="dp_pec_clear"></div> </div>'; } } elseif ($this->type == 'list-author') { $html .= ' <div class="dp_pec_wrapper dp_pec_calendar_' . $this->calendar_obj->id . '" id="dp_pec_id' . $this->nonce . '" ' . $width . '> '; $html .= ' <div style="clear:both;"></div> <div class="dp_pec_content"> '; $html .= $this->upcomingCalendarLayout(false, 10, '', null, null, true, true); $html .= ' </div> </div>'; } elseif ($this->type == 'bookings-user') { global $current_user; $html .= ' <div class="dp_pec_wrapper dp_pec_calendar_' . $this->calendar_obj->id . '" id="dp_pec_id' . $this->nonce . '" ' . $width . '> '; $html .= ' <div style="clear:both;"></div> <div class="dp_pec_content"> '; foreach ($this->getBookingsByUser($current_user->ID) as $key) { $title = '<span class="dp_pec_event_title_sp">' . get_the_title($key->id_event) . '</span>'; if ($this->calendar_obj->link_post) { $title = '<a href="' . get_permalink($key->id_event) . '">' . $title . '</a>'; } $html .= '<div class="dp_pec_date_event"> <h1 class="dp_pec_event_title"> ' . $title . ' </h1> <div class="dp_pec_clear"></div> <span><i class="fa fa-clock-o"></i>' . date_i18n(get_option('date_format'), strtotime($key->event_date)) . ' ' . date_i18n(get_option('time_format'), strtotime(get_post_meta($key->id_event, 'pec_date', true))) . '</span> '; $map = get_post_meta($key->id_event, 'pec_map', true); if ($map != '') { $html .= ' <div class="dp_pec_date_event_map_overlay" onClick="style.pointerEvents=\'none\'"></div> <iframe class="dp_pec_date_event_map_iframe" width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&source=s_q&q=' . urlencode($map) . '&ie=UTF8&output=embed"></iframe>'; } $html .= ' </div>'; } $html .= ' </div> </div>'; } elseif ($this->type == 'today-events') { $html .= ' <div class="dp_pec_wrapper dp_pec_calendar_' . $this->calendar_obj->id . ' dp_pec_today_events" id="dp_pec_id' . $this->nonce . '" ' . $width . '> '; $html .= ' <div style="clear:both;"></div> <div class="dp_pec_content"> '; //$html .= date('Y-m-d H:i:s', $this->defaultDate).'<br>'; //date_default_timezone_set( get_option('timezone_string')); // set the PHP timezone to match WordPress //$html .= date('Y-m-d H:i:s', $this->defaultDate).'<br>'; $html .= $this->eventsListLayout(date('Y-m-d', $this->defaultDate), false); $html .= ' </div> </div>'; } if ($print) { echo $html; } else { return $html; } }