function people_list($people, $heading_singular, $heading_plural) { $output = ''; $people_count = 0; $people_with_blurb_count = 0; if (is_array($people)) { if (count($people) > 1) { $output .= "<dt>{$heading_plural}</dt>\n"; } else { $output .= "<dt>{$heading_singular}</dt>\n"; } $output .= "<dd>\n"; foreach ($people as $person) { echo var_trace($person, 'people_list:$person', $TRACE_ENABLED); $people_count++; if ($person['profile_text']) { $output .= '<a href="#person-profile-' . $person['slug'] . '">' . $person['name'] . ' ' . $person['family_name'] . "</a>, \n"; $people_with_blurb_count++; } else { $output .= $person['name'] . ' ' . $person['family_name'] . ", \n"; } } $output = substr($output, 0, -3); $output .= "</dd>\n"; } return array('count' => $people_count, 'with_blurb' => $people_with_blurb_count, 'output' => $output, 'trace' => var_export($people, true)); }
function compose_slide($column_spans, $tiles) { global $TRACE_ENABLED; global $TILES_PER_COLUMN; echo var_trace('compose_slide|tiles: ' . var_export($tiles, true), $TRACE_PREFIX, $TRACE_ENABLED); $slide_content = array('columns' => array()); $tile_index = 0; $total_tiles = count($tiles); echo var_trace('column_spans: ' . var_export($column_spans, true), $TRACE_PREFIX, $TRACE_ENABLED); foreach ($column_spans as $column_span) { $tile_count = $column_span * $TILES_PER_COLUMN; $slide_column = array('layout' => 'col' . $column_span, 'tiles' => array()); while ($tile_count > 0 and $tile_index <= $total_tiles) { echo var_trace('tile[slug]: ' . var_export($tiles[$tile_index]['slug'], true), $TRACE_PREFIX, $TRACE_ENABLED); $tile = new Pod('tile', $tiles[$tile_index++]['slug']); $tile_layout = $tile->get_field('tile_layout.name'); echo var_trace('tile[layout]: ' . var_export($tile_layout, true), $TRACE_PREFIX, $TRACE_ENABLED); $this_tile_count = preg_replace('/x/', '*', $tile_layout); echo var_trace('this_tile_count: ' . var_export($this_tile_count, true), $TRACE_PREFIX, $TRACE_ENABLED); eval('$this_tile_count = ' . $this_tile_count . ';'); $tile_count -= $this_tile_count; echo var_trace('tile_countdown: ' . var_export($tile_count, true), $TRACE_PREFIX, $TRACE_ENABLED); unset($target_event_month, $target_event_day, $target_uri); if ($tile->get_field('target_event.date_start')) { $target_event_date = new DateTime($tile->get_field('target_event.date_start')); var_trace('target_event_date: ' . var_export($target_event_date, true), $TRACE_PREFIX, $TRACE_ENABLED); $target_event_month = $target_event_date->format('M'); $target_event_day = $target_event_date->format('j'); $target_event_slug = $tile->get_field('target_event.slug'); } if ($tile->get_field('target_event.slug')) { $target_uri = PODS_BASEURI_EVENTS . '/' . $tile->get_field('target_event.slug'); } elseif ($tile->get_field('target_research_project')) { $target_uri = PODS_BASEURI_RESEARCH_PROJECTS . '/' . $tile->get_field('target_research_project.slug'); } elseif ($tile->get_field('target_uri')) { $target_uri = $tile->get_field('target_uri'); } elseif ($tile->get_field('target_page.guid')) { $target_uri = honor_ssl_for_attachments($tile->get_field('target_page.guid')); } elseif ($tile->get_field('target_post.guid')) { $target_uri = honor_ssl_for_attachments($tile->get_field('target_post.guid')); } array_push($slide_column['tiles'], array('id' => $tile->get_field('slug'), 'element_class' => rtrim(get_tile_classes($tile_layout) . ' ' . $tile->get_field('class'), ' '), 'title' => $tile->get_field('name'), 'display_title' => $tile->get_field('display_title'), 'subtitle' => $tile->get_field('tagline'), 'blurb' => $tile->get_field('blurb'), 'plain_content' => $tile->get_field('plain_content'), 'posts_category' => $tile->get_field('posts_category.term_id'), 'target_uri' => $target_uri, 'image' => honor_ssl_for_attachments($tile->get_field('image.guid')), 'target_event' => array('month' => $target_event_month, 'day' => $target_event_day))); push_media_attribution($tile->get_field('image.ID')); } array_push($slide_content['columns'], $slide_column); } return $slide_content; }
function generate_section($section_slug, $section_heading = false, $mode = MODE_FULL_LIST) { $pod = new Pod('people_group', $section_slug); $people = (array) $pod->get_field('members', 'family_name ASC'); global $people_in_output_full, $people_in_output_summary; echo var_trace('group_members: ' . var_export($people, true), $TRACE_PREFIX, true); $output = "<section class='people-list {$section_slug}'>"; $output .= "<h1>{$section_heading}</h1>"; $output .= "<ul>"; foreach ($people as $person) { $display_after = new DateTime($person['display_after']); $display_until = new DateTime($person['display_until']); $datetime_now = new DateTime('now'); echo var_trace('display_after: ' . var_export($display_after, true), $TRACE_PREFIX, true); echo var_trace('display_until: ' . var_export($display_until, true), $TRACE_PREFIX, true); echo var_trace('datetime_now: ' . var_export($datetime_now, true), $TRACE_PREFIX, true); if ($display_after <= $datetime_now and $datetime_now <= $display_until) { if ($mode == MODE_FULL_LIST) { if (!in_array($person['slug'], $people_in_output_full)) { array_push($people_in_output_full, $person['slug']); $output .= generate_person_profile($person['slug'], false, MODE_FULL_LIST); } } elseif ($mode == MODE_SUMMARY) { if (!in_array($person['slug'], $people_in_output_summary)) { array_push($people_in_output_summary, $person['slug']); $output .= generate_person_profile($person['slug'], false, MODE_SUMMARY); } } } } echo var_trace('people_in_output_full: ' . var_export($people_in_output_full, true), $TRACE_PREFIX, true); echo var_trace('people_in_output_summary: ' . var_export($people_in_output_summary, true), $TRACE_PREFIX, true); $output .= " </ul>"; $output .= "</section>"; return $output; }
?> <div role="main"> <?php if (have_posts()) { the_post(); } ?> <div id="post-<?php the_ID(); ?> " <?php post_class('lc-article lc-list-of-pods-objects'); ?> > <?php echo var_trace($pod_type, $TRACE_PREFIX, $TRACE_ENABLED); ?> <div class='ninecol' id='contentarea'> <div class='top-content'> <article class='wireframe row'> <header> <h1><?php the_title(); ?> </h1> </header> <?php switch ($pod_type) { case 'upcoming_events': $HIDE_UPCOMING_EVENTS = false; $HIDE_PAST_EVENTS = true;
function push_media_attribution($attachment_ID) { global $META_media_attr; $attachment_metadata = wp_get_attachment_metadata($attachment_ID); echo var_trace($attachment_metadata, $TRACE_PREFIX . ': attachment_metadata', $TRACE_ENABLED); $attribution_uri = get_post_meta($attachment_ID, '_attribution_uri', true); $attribution_name = get_post_meta($attachment_ID, '_attribution_name', true); // array_push($GLOBALS['META_media_attributions'], array( array_push($META_media_attr, array('title' => get_the_title($attachment_ID), 'attribution_uri' => $attribution_uri, 'author' => $attribution_name)); }
} $conference_publication_blurb = $pod->get_field('conference_newspaper.blurb'); $conference_publication_cover = honor_ssl_for_attachments($pod->get_field('conference_newspaper.snapshot.guid')); $conference_publication_wp_page = honor_ssl_for_attachments($pod->get_field('conference_newspaper.publication_web_page.guid')); $conference_publication_pdf = $pod->get_field('conference_newspaper.publication_pdf_uri'); $conference_publication_issuu = $pod->get_field('conference_newspaper.issuu_uri'); $research_summary_title = $pod->get_field('research_summary.name'); $research_summary_blurb = $pod->get_field('research_summary.blurb'); // tiles is a multi-select pick field so in theory we could have more // than one tile to display here, however initially we only process the // first one and ignore the rest - later on we should deal with more // complex cases (e.g. as a slider or so) echo var_trace('tiles: ' . var_export($pod->get_field('research_summary.visualization_tiles'), true), $TRACE_PREFIX, $TRACE_ENABLED); $visualization_tiles = $pod->get_field('research_summary.visualization_tiles'); $tile_pod = new Pod('tile', $visualization_tiles[0]['slug']); echo var_trace('tile_image: ' . var_export($tile_pod->get_field('image'), true), $TRACE_PREFIX, $TRACE_ENABLED); $research_summary_tile_image = honor_ssl_for_attachments($tile_pod->get_field('image.guid')); $research_summary_pdf_uri = $pod->get_field('research_summary.data_section_pdf_uri'); ?> <?php get_header(); ?> <div role="main"> <?php if (have_posts()) { the_post(); } ?>
<?php } ?> </dl> </section> <?php } ?> <?php if ($people_with_blurb) { ?> <?php echo var_trace($event_all_the_people, $TRACE_PREFIX, $TRACE_ENABLED); ?> <section id='speaker-profiles' class='clearfix'> <header> <h1>Profiles</h1> </header> <ul class='people-list'> <?php $index = 0; foreach ($event_all_the_people as $key => $event_speaker) { echo "<!-- event_speaker : " . var_export($event_speaker, true) . "-->"; if ($event_speaker['profile_text']) { ?> <?php if ($index % 3 == 0 || $index == 0) { ?>
array_push($current_projects[$key], $project); } echo var_trace('projects (by stream): ' . var_export($current_projects, true), $TRACE_PREFIX, $TRACE_ENABLED); $past_projects_list = array(); $projects_pod->findRecords(array('where' => 'status.name = "completed"')); $past_projects = array(); while ($projects_pod->fetchRecord()) { array_push($past_projects_list, array('slug' => $projects_pod->get_field('slug'), 'name' => $projects_pod->get_field('name'), 'stream' => $projects_pod->get_field('research_stream.name'))); $past_projects[$projects_pod->get_field('research_stream.name')] = array(); } echo var_trace('projects: ' . var_export($current_projects, true), $TRACE_PREFIX, $TRACE_ENABLED); foreach ($past_projects_list as $project) { $key = $project['stream']; array_push($past_projects[$key], $project); } echo var_trace('past projects (by stream): ' . var_export($projects, true), $TRACE_PREFIX, $TRACE_ENABLED); ?> <?php if ($IN_CONTENT_AREA and !$HIDE_CURRENT_PROJECTS or !$IN_CONTENT_AREA and $HIDE_CURRENT_PROJECTS) { ?> <nav id="projectsmenu"> <div id="current-projects"> <?php if (!$IN_CONTENT_AREA) { ?> <h1>Current research</h1><?php } ?> <dl> <?php foreach ($current_projects as $stream_name => $stream_projects) {
if (!$pod_featured_item_thumbnail) { $pod_featured_item_thumbnail = '<img src="' . honor_ssl_for_attachments($pod->get_field('featured_item_image.guid')) . '" />'; } $pod_featured_item_permalink = get_permalink($page_id); $pod_featured_item_pod = new Pod($pod_type, get_post_meta($pod->get_field('featured_item.ID'), 'pod_slug', true)); $sort_order = $pod->get_field('sort_descending') ? 'DESC' : 'ASC'; $pod_list = $pod->get_field('list', "menu_order {$sort_order}"); ?> <?php get_header(); ?> <?php echo var_trace(var_export($pod_featured_item_permalink, true), $TRACE_PREFIX . ' - featured_item_permalink', $TRACE_ENABLED); echo var_trace(var_export($pod_list, true), $TRACE_PREFIX . ' - pod_list', $TRACE_ENABLED); ?> <div role="main" class="row"> <header class="entry-header twelvecol last"> <h1 class="entry-title"><?php echo $pod_title; ?> </h1> </header><!-- .entry-header --> <article id="post-<?php the_ID(); ?> " <?php
$pods_toplevel_ancestor = 306; } echo var_trace('pod_slug: ' . $pod_slug, $TRACE_PREFIX, $TRACE_ENABLED); $pod = new Pod('research_project', $pod_slug); global $this_pod; $this_pod = new LC\PodObject($pod, 'Research'); $pod_title = $pod->get_field('name'); $pod_tagline = $pod->get_field('tagline'); $pod_summary = do_shortcode($pod->get_field('summary')); $pod_blurb = do_shortcode($pod->get_field('blurb')); // get tiles for heading slider $heading_slides = array(); echo var_trace($pod->get_field('heading_slides.slug'), $TRACE_PREFIX, $TRACE_ENABLED); $slider_pod = new Pod('slide', $pod->get_field('heading_slides.slug')); foreach ($slider_pod->get_field('tiles.slug') as $tile_slug) { echo var_trace($tile_slug, $TRACE_PREFIX, $TRACE_ENABLED); $tile = new Pod('tile', $tile_slug); array_push($heading_slides, honor_ssl_for_attachments($tile->get_field('image.guid'))); } $project_contacts_list = $pod->get_field('contacts'); foreach ($project_contacts_list as $project_contact) { $project_contacts .= $project_contact['name'] . ' ' . $project_contact['family_name'] . ', '; } $project_contacts = substr($project_contacts, 0, -2); $project_researchers_list = $pod->get_field('researchers'); foreach ($project_researchers_list as $project_researcher) { $project_researchers .= $project_researcher['name'] . ' ' . $project_researcher['family_name'] . ', '; } $project_researchers = substr($project_researchers, 0, -2); $project_partners_list = $pod->get_field('contributors'); foreach ($project_partners_list as $project_partner) {
echo var_trace('events records found: ' . $events_pod->getTotalRows(), $TRACE_PREFIX, $TRACE_ENABLED); while ($events_pod->fetchRecord()) { // if event is past, add it to array if ($events_pod->get_field['date_start'] < $datetime_now) { if ($pod_slug == $events_pod->get_field('slug')) { $active_year = $year; } array_push($events[$year], array('slug' => $events_pod->get_field('slug'), 'name' => $events_pod->get_field('name'), 'date' => date('j F', strtotime($events_pod->get_field('date_start'))))); } } // if there are no events for this year, remove year's array altogether from full list if (!count($events[$year])) { $events = array_pop($events); } } echo var_trace('events array: ' . var_export($events, true), $TRACE_PREFIX, $TRACE_ENABLED); // sort by year, backwards from current year krsort($events); ?> <nav> <dl> <?php if ($IN_CONTENT_AREA) { if (!$HIDE_UPCOMING_EVENTS) { include 'nav-events-upcoming.php'; } if (!$HIDE_PAST_EVENTS) { include 'nav-events-past.php'; } } else {
echo $section['title']; ?> </h1><?php } mysql_data_seek($articles_pods->result, 0); while ($articles_pods->fetchRecord()) { if (preg_match("/^" . $section['id'] . "/", $articles_pods->get_field('sequence'))) { $article_authors = $articles_pods->get_field('authors'); $author_names = ''; foreach ($article_authors as $author) { $author_names = $author_names . $author['name'] . ' ' . $author['family_name'] . ', '; } // remove trailing comma $author_names = substr($author_names, 0, -2); $article_title = $articles_pods->get_field('name'); echo var_trace('article Pod object: ' . var_export($articles_pods, true), $TRACE_PREFIX, $TRACE_ENABLED); ?> <div class="article"> <h1> <a href="<?php echo PODS_BASEURI_ARTICLES . '/' . $articles_pods->get_field('slug'); ?> "><?php echo $article_title; ?> </a> </h1> <?php if ($author_names) { ?> <div class="authors">
} foreach ($sections as $section) { ?> <?php if ($section['title']) { ?> <h2><?php echo $section['title']; ?> </h2><?php } foreach ($publication_pod->get_field('articles') as $article) { if (preg_match("/^" . $section['id'] . "/", $article['sequence'])) { ?> <?php var_trace(var_export($article, true), 'article-pod-object', $TRACE_ENABLED); ?> <li> <a href="<?php echo PODS_BASEURI_ARTICLES . '/' . $article['slug']; ?> "><?php echo $article['name']; ?> </a> <?php if (!empty($article['language']['name'])) { ?> (English) - <a href="<?php echo PODS_BASEURI_ARTICLES . '/' . $article['slug'] . '/?lang=' . $article['language']['language_code']; ?>