function meta_box_part_when() { global $post; $event = new Eab_EventModel($post); $content = ''; $content .= '<div class="eab_meta_box">'; $content .= '<div class="eab_meta_column_box" id="incsub_event_times_label">' . __('Event times and dates', self::TEXT_DOMAIN) . '</div>'; $content .= '<input type="hidden" name="incsub_event_when_meta" value="1" />'; $start_dates = $event->get_start_dates(); $content .= $this->_meta_box_part_recurring_add($event); if (!$event->is_recurring()) { $content .= '<div id="eab-add-more-rows">'; if ($start_dates) { foreach ($start_dates as $key => $date) { $start = $event->get_start_timestamp($key); $no_start = $event->has_no_start_time($key) ? 'checked="checked"' : ''; $end = $event->get_end_timestamp($key); $no_end = $event->has_no_end_time($key) ? 'checked="checked"' : ''; $content .= '<div class="eab-section-block">'; $content .= '<div class="eab-section-heading">' . sprintf(__('Part %d', self::TEXT_DOMAIN), $key + 1) . ' ' . '<a href="#remove" class="eab-event-remove_time">' . __('Remove', self::TEXT_DOMAIN) . '</a></div>'; $content .= '<div class="misc-eab-section eab-start-section"><label for="incsub_event_start_' . $key . '">'; $content .= __('Start', self::TEXT_DOMAIN) . ':</label> '; $content .= '<input type="text" name="incsub_event_start[' . $key . ']" id="incsub_event_start_' . $key . '" class="incsub_event_picker incsub_event incsub_event_date incsub_event_start" value="' . date('Y-m-d', $start) . '" size="10" /> '; $content .= '<input type="text" name="incsub_event_start_time[' . $key . ']" id="incsub_event_start_time_' . $key . '" class="incsub_event incsub_event_time incsub_event_start_time" value="' . date('H:i', $start) . '" size="3" />'; $content .= ' <input type="checkbox" name="incsub_event_no_start_time[' . $key . ']" id="incsub_event_no_start_time_' . $key . '" class="incsub_event incsub_event_time incsub_event_no_start_time" value="1" ' . $no_start . ' />'; $content .= ' <label for="incsub_event_no_start_time_' . $key . '">' . __('No start time', self::TEXT_DOMAIN) . '</label>'; $content .= '</div>'; $content .= '<div class="misc-eab-section"><label for="incsub_event_end_' . $key . '">'; $content .= __('End', self::TEXT_DOMAIN) . ':</label> '; $content .= '<input type="text" name="incsub_event_end[' . $key . ']" id="incsub_event_end_' . $key . '" class="incsub_event_picker incsub_event incsub_event_date incsub_event_end" value="' . date('Y-m-d', $end) . '" size="10" /> '; $content .= '<input type="text" name="incsub_event_end_time[' . $key . ']" id="incsub_event_end_time_' . $key . '" class="incsub_event incsub_event_time incsub_event_end_time" value="' . date('H:i', $end) . '" size="3" />'; $content .= ' <input type="checkbox" name="incsub_event_no_end_time[' . $key . ']" id="incsub_event_no_end_time_' . $key . '" class="incsub_event incsub_event_time incsub_event_no_end_time" value="1" ' . $no_end . ' />'; $content .= ' <label for="incsub_event_no_end_time_' . $key . '">' . __('No end time', self::TEXT_DOMAIN) . '</label>'; $content .= '</div>'; $content .= '</div>'; } } else { $i = 0; $content .= '<div class="eab-section-block">'; $content .= '<div class="eab-section-heading">' . sprintf(__('Part %d', self::TEXT_DOMAIN), $i + 1) . ' ' . '<a href="#remove" class="eab-event-remove_time">' . __('Remove', self::TEXT_DOMAIN) . '</a></div>'; $content .= '<div class="misc-eab-section eab-start-section"><label for="incsub_event_start_' . $i . '">'; $content .= __('Start', self::TEXT_DOMAIN) . ':</label> '; $content .= '<input type="text" name="incsub_event_start[' . $i . ']" id="incsub_event_start_' . $i . '" class="incsub_event_picker incsub_event incsub_event_date incsub_event_start" value="" size="10" /> '; $content .= '<input type="text" name="incsub_event_start_time[' . $i . ']" id="incsub_event_start_time_' . $i . '" class="incsub_event incsub_event_time incsub_event_start_time" value="" size="3" />'; $content .= ' <input type="checkbox" name="incsub_event_no_start_time[' . $i . ']" id="incsub_event_no_start_time_' . $i . '" class="incsub_event incsub_event_time incsub_event_no_start_time" value="1" />'; $content .= ' <label for="incsub_event_no_start_time_' . $i . '">' . __('No start time', self::TEXT_DOMAIN) . '</label>'; $content .= '</div>'; $content .= '<div class="misc-eab-section"><label for="incsub_event_end_' . $i . '">'; $content .= __('End', self::TEXT_DOMAIN) . ':</label> '; $content .= '<input type="text" name="incsub_event_end[' . $i . ']" id="incsub_event_end_' . $i . '" class="incsub_event_picker incsub_event incsub_event_date incsub_event_end" value="" size="10" /> '; $content .= '<input type="text" name="incsub_event_end_time[' . $i . ']" id="incsub_event_end_time_' . $i . '" class="incsub_event incsub_event_time incsub_event_end_time" value="" size="3" />'; $content .= ' <input type="checkbox" name="incsub_event_no_end_time[' . $i . ']" id="incsub_event_no_end_time_' . $i . '" class="incsub_event incsub_event_time incsub_event_no_end_time" value="1" />'; $content .= ' <label for="incsub_event_no_end_time_' . $i . '">' . __('No end time', self::TEXT_DOMAIN) . '</label>'; $content .= '</div>'; $content .= '</div>'; } $content .= '</div>'; $content .= '<div id="eab-add-more"><input type="button" name="eab-add-more-button" id="eab-add-more-button" class="eab_add_more" value="' . __('Click here to add another date to event', self::TEXT_DOMAIN) . '"/></div>'; $i = !empty($i) ? $i : 0; $content .= '<div id="eab-add-more-bank">'; $content .= '<div class="eab-section-block">'; $content .= '<div class="eab-section-heading">' . sprintf(__('Part bank', self::TEXT_DOMAIN), $i + 1) . ' ' . '<a href="#remove" class="eab-event-remove_time">' . __('Remove', self::TEXT_DOMAIN) . '</a></div>'; $content .= '<div class="misc-eab-section eab-start-section"><label for="incsub_event_start_bank" >'; $content .= __('Start', self::TEXT_DOMAIN) . ':</label> '; $content .= '<input type="text" name="incsub_event_start_b[bank]" id="incsub_event_start_bank" class="incsub_event_picker_b incsub_event incsub_event_date incsub_event_start_b" value="" size="10" /> '; $content .= '<input type="text" name="incsub_event_start_time_b[bank]" id="incsub_event_start_time_bank" class="incsub_event incsub_event_time incsub_event_start_time_b" value="" size="3" />'; $content .= ' <input type="checkbox" name="incsub_event_no_start_time[bank]" id="incsub_event_no_start_time_bank" class="incsub_event incsub_event_time incsub_event_no_start_time" value="1" />'; $content .= ' <label for="incsub_event_no_start_time_bank">' . __('No start time', self::TEXT_DOMAIN) . '</label>'; $content .= '</div>'; $content .= '<div class="misc-eab-section eab-end-section"><label for="incsub_event_end_bank">'; $content .= __('End', self::TEXT_DOMAIN) . ':</label> '; $content .= '<input type="text" name="incsub_event_end_b[bank]" id="incsub_event_end_bank" class="incsub_event_picker_b incsub_event incsub_event_date incsub_event_end_b" value="" size="10" /> '; $content .= '<input type="text" name="incsub_event_end_time_b[bank]" id="incsub_event_end_time_bank" class="incsub_event incsub_event_time incsub_event_end_time_b" value="" size="3" />'; $content .= ' <input type="checkbox" name="incsub_event_no_end_time[bank]" id="incsub_event_no_end_time_bank" class="incsub_event incsub_event_time incsub_event_no_end_time" value="1" />'; $content .= ' <label for="incsub_event_no_end_time_bank">' . __('No end time', self::TEXT_DOMAIN) . '</label>'; $content .= '</div></div>'; $content .= '</div>'; } else { $content .= $this->_meta_box_part_recurring_edit($event); } $content .= '</div>'; return $content; }
protected function _get_item_data($post) { if (isset($post->blog_id)) { // Originates from network switch_to_blog($post->blog_id); $event = new Eab_EventModel($post); $event_starts = $event->get_start_dates(); $event_ends = $event->get_end_dates(); restore_current_blog(); } else { // Originates from this blog $event = $post instanceof Eab_EventModel ? $post : new Eab_EventModel($post); $event_starts = $event->get_start_dates(); $event_ends = $event->get_end_dates(); } $res = array('id' => $event->get_id(), 'title' => $event->get_title(), 'event_starts' => $event_starts, 'event_ends' => $event_ends, 'status_class' => Eab_Template::get_status_class($event), 'event_venue' => $event->get_venue_location(), 'categories' => $event->get_categories()); if (isset($post->blog_id)) { $res['blog_id'] = $post->blog_id; } return $res; }