<?php 
        }
        ?>
          <li class='threecol<?php 
        if (($index + 1) % 4 == 0) {
            ?>
 last<?php 
        }
        ?>
'>
            <a href="<?php 
        echo get_permalink($item['ID']);
        ?>
">
              <img src="<?php 
        echo honor_ssl_for_attachments($item_pod->get_field('snapshot.guid'));
        ?>
" />
            </a>
            <p>
              <a href="<?php 
        echo get_permalink($item['ID']);
        ?>
">
                <?php 
        echo $item_pod->get_field('name');
        ?>
              </a>
            </p>
          </li>
        <?php 
$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();
}
?>
        ?>
                  <li>
                    <a class='downloadthis pdf button' href="<?php 
        echo $pdf_uri;
        ?>
">Download this article as PDF</a>
                  </li>
                  <?php 
    }
    ?>
                  <?php 
    if (is_array($attachments)) {
        foreach ($attachments as $attachment) {
            ?>
                      <li><a class='downloadthis pdf button' href="<?php 
            echo honor_ssl_for_attachments($attachment['guid']);
            ?>
" /><?php 
            echo $attachment['post_title'];
            ?>
</a></li>
                  <?php 
        }
    }
    ?>
                  </ul>
                </div>
                <?php 
}
?>
           
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) {
    $project_partners .= $project_partner['name'] . ', ';
}
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;
}
$pod_abstract = do_shortcode($pod->get_field('abstract'));
// get tiles for heading slider
$heading_slides = array();
echo var_trace($pod->get_field('heading_slides.slug'), $TRACE_PREFIX . '--heading_slides.slug', $TRACE_ENABLED);
$slider_pod = new Pod('slide', $pod->get_field('heading_slides.slug'));
foreach ((array) $slider_pod->get_field('tiles.slug') as $tile_slug) {
    echo var_trace($tile_slug, $TRACE_PREFIX . '--tiles.slug', $TRACE_ENABLED);
    $tile = new Pod('tile', $tile_slug);
    if ($tile) {
        array_push($heading_slides, honor_ssl_for_attachments($tile->get_field('image.guid')));
    }
}
$pod_pdf = $pod->get_field('publication_pdf.guid') ? honor_ssl_for_attachments($pod->get_field('publication_pdf.guid')) : $pod->get_field('publication_pdf_uri');
$pod_alt_pdf = $pod->get_field('publication_alt_pdf.guid') ? honor_ssl_for_attachments($pod->get_field('publication_alt_pdf.guid')) : $pod->get_field('publication_alt_pdf_uri');
$pod_pdf_lang2 = $pod->get_field('publication_pdf_lang2.guid') ? honor_ssl_for_attachments($pod->get_field('publication_pdf_lang2.guid')) : $pod->get_field('publication_pdf_lang2_uri');
$pod_alt_pdf_lang2 = $pod->get_field('publication_alt_pdf_lang2.guid') ? honor_ssl_for_attachments($pod->get_field('publication_alt_pdf_lang2.guid')) : $pod->get_field('publication_alt_pdf_lang2_uri');
$extra_publication_metadata = $pod->get_field('extra_publication_metadata');
$publication_authors_list = $pod->get_field('authors', 'family_name ASC');
foreach ($publication_authors_list as $publication_author) {
    $publication_authors .= $publication_author['name'] . ' ' . $publication_author['family_name'] . ', ';
}
$publication_authors = substr($publication_authors, 0, -2);
$publication_editors_list = $pod->get_field('editors', 'family_name ASC');
foreach ($publication_editors_list as $publication_editor) {
    $publication_editors .= $publication_editor['name'] . ' ' . $publication_editor['family_name'] . ', ';
}
$publication_editors = substr($publication_editors, 0, -2);
$publication_contributors_list = $pod->get_field('contributors', 'family_name ASC');
foreach ($publication_contributors_list as $publication_contributor) {
    $publication_contributors .= $publication_contributor['name'] . ' ' . $publication_contributor['family_name'] . ', ';
}
$event_date_string = $event_date_start->format("l j F Y | ");
$event_date_string .= '<time class="dt-start dtstart" itemprop="startDate" datetime="' . $event_dtstart . '">' . $event_date_start->format("H:i") . '</time>';
$event_date_string .= '-' . '<time class="dt-end dtend" itemprop="endDate" datetime="' . $event_dtend . '">' . $event_date_end->format("H:i") . '</time>';
$datetime_now = new DateTime('now');
$is_future_event = $event_date_start > $datetime_now ? true : false;
$event_location = $pod->get_field('venue.name');
$eventseries = $pod->get_field('eventseries');
$event_type = $pod->get_field('event_type.name');
$event_series = $pod->get_field('event_series.name');
$event_host_organizations = orgs_list((array) $pod->get_field('hosted_by'));
$event_partner_organizations = orgs_list((array) $pod->get_field('partners'));
$event_info = '';
if ($event_type) {
    $event_info .= '<em>' . ucfirst($event_type) . '</em> ';
} else {
    $event_info .= 'An event ';
}
if ($event_series) {
    $event_info .= 'of the <em>' . $event_series . '</em> event series ';
}
if ($event_host_organizations) {
    $event_info .= 'hosted by ' . $event_host_organizations . ' ';
} else {
    $event_info .= 'hosted by LSE Cities ';
}
if ($event_partner_organizations) {
    $event_info .= 'in partnership with ' . $event_partner_organizations;
}
$poster_pdf = $pod->get_field('poster_pdf');
$poster_pdf = honor_ssl_for_attachments($poster_pdf[0]['guid']);