function widget($args, $instance) { global $wp_query; extract($args); $levels = Conferencer::get_posts('sponsor_level'); foreach ($levels as $id => $level) { $levels[$id]->sponsors = array(); } foreach (Conferencer::get_posts('sponsor') as $sponsor) { Conferencer::add_meta($sponsor); $levels[$sponsor->level]->sponsors[$sponsor->ID] = $sponsor; } foreach ($levels as $id => $level) { shuffle($levels[$id]->sponsors); } $title = apply_filters('widget_title', empty($instance['title']) ? 'Sponsors' : $instance['title'], $instance, $this->id_base); echo $before_widget . $before_title . $title . $after_title; foreach ($levels as $level) { ?> <?php if (count($level->sponsors)) { ?> <div class="sponsor_level sponsor_<?php echo $level->post_name; ?> "> <h4><?php echo $level->post_title; ?> </h4> <div class="sponsors"> <?php foreach ($level->sponsors as $sponsor) { ?> <div class="sponsor"> <?php $html = $sponsor->post_title; if (has_post_thumbnail($sponsor->ID)) { $html = get_the_post_thumbnail($sponsor->ID, "sponsors_widget_{$sponsor->level}", array('alt' => $sponsor->post_title, 'title' => $sponsor->post_title)); } if (!empty($sponsor->url)) { $html = "<a href='{$sponsor->url}' target='_blank'>{$html}</a>"; } echo $html; ?> </div> <?php } ?> </div> </div> <?php } ?> <?php } // foreach echo $after_widget; }
function content() { extract($this->options); $post = get_post($post_id); if (!$post) { return "[Shortcode error (speaker_meta): Invalid post_id. If not used within a speaker page, you must provide a speaker ID using 'post_id'.]"; } if ($post->post_type != 'speaker') { if ($post_id) { return "[Shortcode error (speaker_meta): <a href='" . get_permalink($post_id) . "'>{$post->post_title}</a> (ID: {$post_id}, type: {$post->post_type}) is not a speaker.]"; } else { return "[Shortcode error (speaker_meta): This post is not a speaker. Maybe you meant to supply a speaker using post_id.]"; } } Conferencer::add_meta($post); $meta = array(); foreach (explode(',', $show) as $type) { $type = trim($type); switch ($type) { case 'title': $html = $post->title; if ($link_title) { $html = "<a href='" . get_permalink($post->ID) . "'>{$html}</a>"; } $meta[] = "<span class='title'>" . $title_prefix . $html . $title_suffix . "</span>"; break; case 'company': if ($post->company) { $html = get_the_title($post->company); if ($link_company) { $html = "<a href='" . get_permalink($post->company) . "'>{$html}</a>"; } $meta[] = "<span class='company'>" . $company_prefix . $html . $company_suffix . "</span>"; } break; case 'speaker': $html = $post->post_title; if ($link_speaker) { $html = "<a href='" . get_permalink($post->ID) . "'>{$html}</a>"; } $meta[] = "<span class='speaker'>" . $speaker_prefix . $html . $speaker_suffix . "</span>"; break; default: $meta[] = "Unknown speaker attribute"; } } return count($meta) ? "<p class='speaker_meta'>" . implode("<br />", $meta) . "</p>" : ''; }
function column($column) { parent::column($column); global $post; switch (str_replace('conferencer_speaker_', '', $column)) { case 'title': echo $post->title; break; case 'company': if ($post->company) { echo "<a href='post.php?action=edit&post={$post->company}'>" . get_the_title($post->company) . "</a>"; } break; case 'sessions': $links = array(); foreach (Conferencer::get_sessions($post->ID) as $session) { $links[] = "<a href='post.php?action=edit&post={$session->ID}'>" . get_the_title($session->ID) . "</a>"; } echo implode(', ', $links); break; } }
function options($post, $modified = array()) { $time_slots = Conferencer::get_posts('time_slot', false, 'time_sort'); $this->earliest_time_slot_date = count($time_slots) ? get_post_meta(reset($time_slots)->ID, '_conferencer_starts', true) : false; parent::options($post, $modified); }
<fieldset id="conference_options"> <table> <?php Conferencer::add_meta($post); $user_option_count = 0; ?> <?php foreach ($this->options as $name => $option) { ?> <?php if ($option['type'] == 'internal') { continue; } $user_option_count++; $value = isset(${$name}) ? ${$name} : $post->{$name}; $name = "conferencer_{$name}"; ?> <tr> <td class="label"> <label for="<?php echo $name; ?> "> <?php echo $option['label']; ?> </label> </td> <td class="input">
function column($column) { global $post; Conferencer::add_meta($post); switch (str_replace('conferencer_' . $this->slug . '_', '', $column)) { case 'session_count': echo $post->non_session ? "not allowed" : count(Conferencer::get_sessions($post->ID)); break; } }
function content() { extract($this->options); $type_rendered = "session"; $post = get_post($post_id); if (!$post) { return "[Shortcode error (session_meta): Invalid post_id. If not used within a session page, you must provide a session ID using 'post_id'.]"; } if ($post->post_type != 'session') { if ($post_id) { return "[Shortcode error (session_meta): <a href='" . get_permalink($post_id) . "'>{$post->post_title}</a> (ID: {$post_id}, type: {$post->post_type}) is not a session.]"; } else { return "[Shortcode error (session_meta): This post is not a session. Maybe you meant to supply a session using post_id.]"; } } Conferencer::add_meta($post); $output = $output_session = $output_content = ""; // $user_sessions = get_user_sessions(); //$user_session_selected = false; // if(in_array($post->ID, $user_sessions)){ // $user_session_selected = true; //} foreach (explode(',', $show) as $type) { $type = trim($type); switch ($type) { case 'session': case 'double-session': case 'keynote': $type_rendered = $type; $output .= '<td data-session-id="' . $post->ID . '"'; if ($type == 'keynote') { $output .= ' headers="vide"'; } $output .= ' class="session'; $terms = wp_get_post_terms($post->ID, 'theme', array("fields" => "slugs")); $output .= ' filter-all'; if (!empty($terms)) { $output .= ' filter-' . implode(' filter-', $terms); } if ($user_session_selected) { $output .= ' bookmarked'; } $starts = get_post_meta($post->time_slot, '_conferencer_starts', true); $ends = get_post_meta($post->time_slot, '_conferencer_ends', true); $duration = $ends - $starts; if ($type == 'keynote' && !$post->room && $duration < 2000) { $output .= ' break small'; $type_rendered = 'break'; } else { if ($type == 'keynote' && !$post->room) { $output .= ' break'; $type_rendered = 'break'; } else { if ($type == 'keynote') { $output .= ' keynote'; } } } if ($post->room) { $room = get_post($post->room); $output .= ' ' . $room->post_name; } if (count($speakers = Conferencer::get_posts('speaker', $post->speakers))) { if (count($speakers) > 1) { $output .= ' panel'; } else { if (count($speakers) == 1) { $speaker = array_shift($speakers); $thumb = get_post_thumbnail_id($speaker->ID); $img_url = wp_get_attachment_url($thumb, 'full'); if (!empty($img_url)) { $output .= ' speaker-thumb'; } } } } else { $output .= ' no-speaker'; } $output .= '"'; if ($type == 'double-session' || !empty($rowspan)) { if (empty($rowspan)) { $rowspan = 2; } $output .= ' rowspan="' . $rowspan . '"'; } if ($type == 'keynote') { $output .= ' colspan="' . $colspan . '"'; } if ($post->room) { $output .= ' itemprop="subEvent" itemscope itemtype="http://schema.org/Event"'; } $output .= '>'; break; case 'title': $html = $post->post_title; if ($link_title && $type_rendered != 'break') { $html = "<a href='" . get_permalink($post->ID) . "'>{$html}</a>"; } $output_content .= '<span class="session-title" itemprop="name">' . $title_prefix . $html . $title_suffix . "</span>"; break; case 'time': if ($post->time_slot && $type_rendered == 'keynote') { $starts = get_post_meta($post->time_slot, '_conferencer_starts', true); $ends = get_post_meta($post->time_slot, '_conferencer_ends', true); //$html = date($date_format, $starts).", ".date($time_format, $starts).$time_separator.date($time_format, $ends); $html = ""; $html .= '<span class="session-time-slot" itemprop="subEvent">'; $html .= '<span><time itemprop="startDate" datetime="' . date("c", $starts) . '">' . date("G:i", $starts) . '</time></span> à '; $html .= '<span><time itemprop="endDate" datetime="' . date("c", $ends) . '">' . date("G:i", $ends) . '</time></span>'; $html .= '</span>'; $output_content .= $time_prefix . $html . $time_suffix; } else { $starts = get_post_meta($post->time_slot, '_conferencer_starts', true); $ends = get_post_meta($post->time_slot, '_conferencer_ends', true); $date_a = new DateTime(); $date_a->setTimestamp($starts); $date_b = new DateTime(); $date_b->setTimestamp($ends); $interval = $date_a->diff($date_b); //$html = date($date_format, $starts).", ".date($time_format, $starts).$time_separator.date($time_format, $ends); $html = ""; $html .= '<span class="visuallyhidden">Durée : '; if ($interval->h > 0) { $html .= $interval->h . ' heure' . ($interval->h > 1 ? 's' : '') . ' '; } if ($interval->i > 0) { $html .= $interval->i . ' minute' . ($interval->i > 1 ? 's' : ''); } $html .= '</span>'; $output_content .= $time_prefix . $html . $time_suffix; } break; case 'speakers': if (count($speakers = Conferencer::get_posts('speaker', $post->speakers))) { $html = ""; if (count($speakers) > 1) { $html .= '<span class="session-description" itemprop="description">Panel</span>'; } else { $speaker = array_shift($speakers); $html .= '<span class="session-speaker" itemprop="performer" itemscope itemtype="http://schema.org/Person">'; $html .= '<span itemprop="name">' . $speaker->post_title . '</span>'; $html .= '</span>'; } $output_content .= $speakers_prefix . $html . $speaker_suffix; } break; case 'speakers_w_photos': if (count($speakers = Conferencer::get_posts('speaker', $post->speakers))) { $html = ""; if (count($speakers) > 1) { $output_content .= '<span class="session-description" itemprop="description">Panel</span>'; } else { $speaker = array_shift($speakers); $thumb = get_post_thumbnail_id($speaker->ID); $img_url = wp_get_attachment_url($thumb, 'full'); if (function_exists('aq_resize')) { $image = aq_resize($img_url, 187, 160, true); if (!$image) { $image = aq_resize($img_url, 187, 160, false); if (!$image) { $image = $img_url; } } } else { $image = $img_url; } if ($image) { $output_session .= '<span class="session-speaker-thumb"><!-- position: absolute -->'; $output_session .= '<img src="' . $image . '" alt="">'; $output_session .= '</span>'; } $output_content .= '<span class="session-speaker" itemprop="performer" itemscope itemtype="http://schema.org/Person">'; $output_content .= '<span itemprop="name">' . $speaker->post_title . '</span>'; $output_content .= '</span>'; } $meta[] = $speakers_prefix . $html . $speaker_suffix; } break; case 'room': if ($post->room) { $html = get_the_title($post->room); if ($link_room) { $html = "<a href='" . get_permalink($post->room) . "'><span itemprop='name'>{$html}</span></a>"; } $output_content .= '<span class="session-room" itemprop="location" itemscope itemtype="http://schema.org/Place"><span itemprop="name">' . $room_prefix . $html . $room_suffix . "</span></span>"; } break; case 'track': if ($post->track) { $html = get_the_title($post->track); if ($link_track) { $html = "<a href='" . get_permalink($post->track) . "'>{$html}</a>"; } $output_content .= "<span class='track'>" . $track_prefix . $html . $track_suffix . "</span>"; } break; case 'sponsors': if (count($sponsors = Conferencer::get_posts('sponsor', $post->sponsors))) { $html = comma_separated_post_titles($sponsors, $link_sponsors); $output_content .= "<span class='sponsors'>" . $sponsors_prefix . $html . $sponsors_suffix . "</span>"; } break; default: //$meta[] = "Unknown session attribute"; } } $output .= '<div class="session-wrapper"><!-- position: relative -->'; $output .= '<div class="session-content"><!-- table-cell --> <div class="session-content-wrapper"><!-- position: relative -->'; $output .= $output_content; $output .= '</div></div>'; $output .= $output_session; $output .= '<button class="session-bookmark add"><span class="visuallyhidden">Ajouter cette conférence à mon horaire</span></button>'; $output .= '</div></td>'; return $output; }
function save() { if (isset($_POST['conferencer_cache_settings']) && check_admin_referer('nonce_conferencer_cache')) { if (isset($_POST['conferencer_disable_cache'])) { update_option('conferencer_caching', false); Conferencer::add_admin_notice("Caching disabled."); } else { if (isset($_POST['conferencer_enable_cache'])) { update_option('conferencer_caching', true); Conferencer::add_admin_notice("Caching enabled."); } else { if (isset($_POST['conferencer_clear_cache'])) { Conferencer_Shortcode::clear_cache(); Conferencer::add_admin_notice("Cach cleared."); } } } header("Location: " . $_SERVER['REQUEST_URI']); die; } }
function content() { extract($this->options); $errors = array(); if (empty($post_ids)) { $errors[] = "No posts ID provided"; } foreach ($post_ids as $post_id) { $post = get_post($post_id); if (!$post) { $errors[] = "{$post_id} is not a valid post ID"; } else { if (!in_array(get_post_type($post), self::$post_types_with_sessions)) { $errors[] = "<a href='" . get_permalink($post->ID) . "'>{$post->post_title}</a> is not the correct type of post"; } } } if (count($errors)) { return "[Shortcode errors (sessions): " . implode(', ', $errors) . "]"; } $sessions = Conferencer::get_sessions($post_ids); ob_start(); if (!empty($sessions) || !empty($no_sessions_message)) { ?> <div class="session-list"> <<?php echo $title_tag; ?> > <?php if (!$title) { ?> Sessions for <?php $titles = array(); foreach ($post_ids as $post_id) { $html = get_the_title($post_id); if ($link_post) { $html = "<a href='" . get_permalink($post_id) . "'>{$html}</a>"; } $titles[] = $html; } echo implode_with_serial_and($titles); ?> <?php } else { echo $title; } ?> </<?php echo $title_tag; ?> > <?php if (empty($sessions)) { ?> <p><?php echo $no_sessions_message; ?> </p> <?php } else { ?> <ul> <?php foreach ($sessions as $session) { ?> <li> <?php $html = $session->post_title; if ($link_sessions) { $html = "<a href='" . get_permalink($session->ID) . "'>{$html}</a>"; } echo $html; ?> </li> <?php } ?> </ul> <?php } ?> </div> <?php } return ob_get_clean(); }
function save() { if (isset($_POST['conferencer_reordering']) && check_admin_referer('nonce_conferencer_reordering_order')) { foreach (self::$priority_post_types as $slug => $heading) { if (isset($_POST['conferencer_' . $slug . '_id'])) { foreach ($_POST['conferencer_' . $slug . '_id'] as $order => $id) { update_post_meta(intVal($id), '_conferencer_order', $order); } } } Conferencer::add_admin_notice("Ordering saved."); header("Location: " . $_SERVER['REQUEST_URI']); die; } }
function column($column) { parent::column($column); global $post; switch (str_replace('conferencer_session_', '', $column)) { case 'keynote': echo $post->keynote ? "keynote" : ""; break; case 'speakers': $links = array(); foreach (Conferencer::get_posts('speaker', $post->speakers) as $speaker) { $links[] = "<a href='post.php?action=edit&post={$speaker->ID}'>" . str_replace(' ', ' ', $speaker->post_title) . "</a>"; } echo implode(', ', $links); break; case 'sponsors': $links = array(); foreach (Conferencer::get_posts('sponsor', $post->sponsors) as $sponsor) { $links[] = "<a href='post.php?action=edit&post={$sponsor->ID}'>" . str_replace(' ', ' ', $sponsor->post_title) . "</a>"; } echo implode(', ', $links); break; case 'track': if ($post->track) { echo "<a href='post.php?action=edit&post={$post->track}'>" . get_the_title($post->track) . "</a>"; } break; case 'room': if ($post->room) { echo "<a href='post.php?action=edit&post={$post->room}'>" . get_the_title($post->room) . "</a>"; } break; case 'time_slot': if ($post->time_slot) { $starts = floatVal(get_post_meta($post->time_slot, '_conferencer_starts', true)); $ends = floatVal(get_post_meta($post->time_slot, '_conferencer_ends', true)); echo "<a href='post.php?action=edit&post={$post->time_slot}'>"; echo date('n/j/y', $starts); echo '<br />'; echo date('g:ia', $starts); if ($ends) { echo '—' . date('g:ia', $ends); } echo "</a>"; } break; } }
function content() { extract($this->options); $conferencer_options = get_option('conferencer_options'); // Define main agenda variable $agenda = array(); // Fill agenda with empty time slot rows foreach (Conferencer::get_posts('time_slot', false, 'start_time_sort') as $time_slot_id => $time_slot) { $starts = get_post_meta($time_slot_id, '_conferencer_starts', true); $agenda[$starts][$time_slot_id] = array(); } $agenda[0] = array(); // for unscheduled time slots // If the agenda is split into columns, fill rows with empty "cell" arrays if ($column_type) { $column_post_counts = array(-1 => 0, 0 => 0); $column_posts = Conferencer::get_posts($column_type); foreach ($agenda as $time => $time_slots) { foreach ($time_slots as $time_slot_id => $time_slot) { foreach ($column_posts as $column_post_id => $column_post) { $column_post_counts[$column_post_id] = 0; $agenda[$time][$time_slot_id][$column_post_id] = array(); } $agenda[$time][$time_slot_id][0] = array(); } } } // Get all session information $sessions = Conferencer::get_posts('session', false, 'title_sort'); foreach (array_keys($sessions) as $id) { Conferencer::add_meta($sessions[$id]); } // Put sessions into agenda variable foreach ($sessions as $session) { $time_slot_id = $session->time_slot ? $session->time_slot : 0; $starts = get_post_meta($time_slot_id, '_conferencer_starts', true); if ($column_type) { $column_id = $session->{$column_type} ? $session->{$column_type} : 0; if ($keynote_spans_tracks && $session->keynote) { $column_id = -1; } $agenda[$starts][$time_slot_id][$column_id][$session->ID] = $session; $column_post_counts[$column_id]++; } else { $agenda[$starts][$time_slot_id][$session->ID] = $session; } } // Remove empty unscheduled rows if (deep_empty($agenda[0])) { unset($agenda[0]); } // Conditionally remove empty rows and columns if (!$show_empty_rows) { foreach ($agenda as $time => $time_slots) { foreach ($time_slots as $time_slot_id => $cells) { $non_session = get_post_meta($time_slot_id, '_conferencer_non_session', true); if (!$non_session && deep_empty($cells)) { unset($agenda[$time_slot_id]); } } } } if (!$show_empty_columns) { $empty_column_post_ids = array(); foreach ($column_posts as $column_post_id => $column_post) { if (!$column_post_counts[$column_post_id]) { $empty_column_post_ids[] = $column_post_id; } } foreach ($agenda as $time => $time_slots) { foreach ($time_slots as $time_slot_id => $cells) { foreach ($empty_column_post_ids as $empty_column_post_id) { unset($agenda[$time_slot_id][$empty_column_post_id]); } } } } // Set up tabs if ($tabs) { $tab_headers = array(); foreach ($agenda as $time => $time_slots) { foreach ($time_slots as $time_slot_id => $cells) { if ($tabs == 'days') { if ($starts = get_post_meta($time_slot_id, '_conferencer_starts', true)) { $tab_headers[] = get_day($starts); } else { $tab_headers[] = 0; } } } } $tab_headers = array_unique($tab_headers); if (count($tab_headers) < 2) { $tabs = false; } } // Set up column headers if ($column_type) { $column_headers = array(); // post column headers foreach ($column_posts as $column_post) { if (!$show_empty_columns && in_array($column_post->ID, $empty_column_post_ids)) { continue; } $column_headers[] = array('title' => $column_post->post_title, 'class' => 'column_' . $column_post->post_name, 'link' => $link_columns ? get_permalink($column_post->ID) : false); } if ($show_unassigned_column && count($column_post_counts[0])) { // extra column header for sessions not assigned to a column $column_headers[] = array('title' => $unassigned_column_header_text, 'class' => 'column_not_applicable', 'link' => false); } else { // remove cells if no un-assigned sessions foreach ($agenda as $time => $time_slots) { foreach ($time_slots as $time_slot_id => $cells) { unset($agenda[$time_slot_id][0]); } } } } // Remove unscheduled time slot, if without sessions //if (deep_empty($agenda[0])) unset($agenda[0]); // Start buffering output ob_start(); //echo '<pre>'; var_dump($agenda); echo '</pre>'; $output = ""; $output .= '<div class="schedule-wrapper">'; /*if (isset($conferencer_options['details_toggle']) && $conferencer_options['details_toggle']) { $output .= '<a href="#" class="conferencer_session_detail_toggle">'; $output .= '<span class="show">display session details</span>'; $output .= '<span class="hide">hide session details</span>'; $output .= '</a>'; }*/ /** Days buttons // Buttons jours **/ if ($tabs) { $output .= '<header class="days-buttons">'; foreach ($tab_headers as $tab_header) { if ($tabs == 'days') { $output .= '<button>'; if ($tab_header) { $output .= '<time datetime="' . strftime($tab_day_dt_strf, $tab_header) . '"><span>' . strftime($tab_day_strf, $tab_header) . '</span></time>'; } $output .= '</button>'; } } $output .= '</header><div class="js-slider"><div class="js-slider-container">'; } else { $output .= '<div class="js-slider"><div class="js-slider-container"><div class="day-wrapper slide">'; $output .= '<table class="grid">'; if ($column_type) { $output .= $this->display_headers($column_headers); } $output .= '<tbody>'; } $row_starts = $last_row_starts = $second_table = false; $currentDayTab = -1; $rowspan_nosession = array(); foreach ($agenda as $time => $time_slots) { $total_cells = array(); $fake_slot_id = null; $number_of_time_slots = 0; foreach ($time_slots as $time_slot_id => $cells) { //$total_cells = array_merge($total_cells,$cells); foreach ($cells as $key => $value) { $total_cells[$key][] = $value; } $fake_slot_id = $time_slot_id; $number_of_time_slots++; } $cells = $total_cells; $time_slot_id = $fake_slot_id; //echo '<pre>'; var_dump($cells); echo '</pre>'; // Set up row information $last_row_starts = $row_starts; $row_starts = get_post_meta($time_slot_id, '_conferencer_starts', true); $row_ends = get_post_meta($time_slot_id, '_conferencer_ends', true); $non_session = get_post_meta($time_slot_id, '_conferencer_non_session', true); $no_sessions = deep_empty($cells); // Show day seperators //$show_next_day = $row_day_format !== false && date('', $row_starts) != date('w', $last_row_starts); $show_next_day = $row_day_format !== false && $currentDayTab == date('z', $row_starts) ? false : true; $currentDayTab = date('z', $row_starts); if ($show_next_day) { if ($tabs) { if ($second_table) { $output .= '</tbody>'; $output .= '</table>'; $output .= '</div>'; } else { $second_table = true; } //$output .= '<div id="conferencer_agenda_tab_'.get_day($row_starts).'">'; $output .= '<div class="day-wrapper slide">'; $output .= '<table class="grid">'; $output .= '<caption>Événements pour le <time datetime="' . strftime($tab_day_dt_strf, $row_starts) . '"><span>' . lcfirst(strftime($tab_day_strf, $row_starts)) . '</span></time></caption>'; if ($column_type) { $output .= $this->display_headers($column_headers); } $output .= '<tbody>'; } else { $output .= '<tr class="day">'; $output .= '<td colspan="' . ($column_type ? count($column_headers) + 1 : 2) . '">'; $output .= $row_starts ? date($row_day_format, $row_starts) : $unscheduled_row_text; $output .= '</td>'; $output .= '</tr>'; } } // Set row classes $classes = array(); if ($non_session) { $classes[] = 'non-session'; } else { if ($no_sessions) { $classes[] = 'no-sessions'; } } $output .= '<tr' . output_classes($classes, false) . '>'; // Time slot column -------------------------- $output .= '<td class="time-slot">'; if ($time_slot_id) { $time_slot_link = get_post_meta($time_slot_id, '_conferencer_link', true) or $time_slot_link = get_permalink($time_slot_id); $html = date($row_time_format, $row_starts); if ($show_row_ends) { $html .= '<span class="time-slot-end"> à ' . date($row_time_format, $row_ends) . '</span>'; } if ($link_time_slots) { $html = "<a href='{$time_slot_link}'>{$html}</a>"; } $output .= $html; } $output .= '</td>'; // Display session cells --------------------- $colspan = $column_type ? count($column_headers) : 1; if ($non_session) { // display a non-sessioned time slot $output .= '<td class="session" colspan="' . $colspan . '"><p>'; $html = get_the_title($time_slot_id); if ($link_time_slots) { $html = "<a href='{$time_slot_link}'>{$html}</a>"; } $output .= $html; $output .= '</p></td>'; } else { if (isset($cells[-1])) { //$output .= '<td class="session keynote" colspan="'.$colspan.'">'; foreach ($cells[-1] as $sessions) { foreach ($sessions as $session) { $session->colspan = $colspan; $output .= $this->display_session($session, 'keynote,title,speakers_w_photos,room,time'); } } //$output .= '</td>'; } else { if ($column_type) { // if split into columns, multiple cells $smallest_duration = 999999999999.0; foreach ($cells as $cell_sessions) { foreach ($cell_sessions as $sessions) { foreach ($sessions as $key => $session) { $starts = get_post_meta($session->time_slot, '_conferencer_starts', true); $ends = get_post_meta($session->time_slot, '_conferencer_ends', true); $duration = $ends - $starts; if ($duration < $smallest_duration) { $smallest_duration = $duration; } } } } foreach ($cells as $track => $cell_sessions) { if (isset($rowspan_nosession[$track]) && $rowspan_nosession[$track] != 0) { $rowspan_nosession[$track] = $rowspan_nosession[$track] - 1; } if (!empty($cell_sessions)) { $no_sessions = true; foreach ($cell_sessions as $sessions) { if (!empty($sessions)) { foreach ($sessions as $key => $session) { $no_sessions = false; $time_slot_id = $session->time_slot ? $session->time_slot : 0; $starts = get_post_meta($time_slot_id, '_conferencer_starts', true); $ends = get_post_meta($time_slot_id, '_conferencer_ends', true); $duration = $ends - $starts; if ($duration > $smallest_duration) { $rowspan_calc = intval(ceil($duration / $smallest_duration)); $rowspan_nosession[$track] = $rowspan_calc; $session->rowspan = $rowspan_calc; } else { $rowspan_nosession[$track] = 0; } //$output .= '<td class="session' . (empty($cell_sessions) ? ' no-sessions':'') . '" '.(($ends-$starts) > 3600 ? ' rowspan="2"' : '').'>'; $output .= $this->display_session($session, (empty($cell_sessions) ? 'no-session,' : 'session,') . 'title,speakers,room,time'); //$output .= '</td>'; } } } if ($no_sessions && $track > 0 && empty($rowspan_nosession[$track])) { $output .= '<td class="empty"></td>'; } } } } else { $output .= '<td class="session ' . (empty($cells) ? 'no-sessions' : '') . '">'; foreach ($cells as $sessions) { foreach ($sessions as $session) { $output .= $this->display_session($session); } } $output .= '</td>'; } } } $output .= '</tr>'; } $output .= '</tbody>'; $output .= '</table>'; if ($tabs) { $output .= '</div>'; } $output .= '</div></div></div>'; // Retrieve and return buffer echo $output; return ob_get_clean(); }