File: /var/www/vhosts/creativefellows.nl/test.creativefellows.nl/nec-enterprise.com/pages/page.news.php
<?php
echo '<div class="header-spacer"></div>';
$html = "";
/*
* blocks overview
*/
if($post_eid == null)
{
$categories_in_section = $cassette->getCategories($section);
foreach($categories_in_section as $cs)
{
if(isset($category) && $category != "" && $cs["naam"] != $category) continue;
$show_items = isset($category) && $category != "" && $cs["naam"] == $category ? null : 5;
$html .= '<div class="col24"><h2 class="">'. ucfirst($cs["naam"]) .'</h2></div>';
$sidebar_entries = $cassette->entries($section,$cs["naam"],null,null,null,$show_items);
/*
* loop items
*/
foreach($sidebar_entries as $data)
{
$resource = $cassette->entries(null,null,$data->resources[0][0]);
$html .= '<div class="col8 block"><div class="'.($resource && $resource[0]->resource_type == "whitepaper" ? "whitepaper" : "").'">';
$fn = $data->first_field;
$link_label = $data->$fn;
$link = vl($section .'/'. $cs["naam"] .'/'.$data->$fn.'-'. $data->unique_id);
$html .= '<h4>'. ucfirst($data->title) .'</h3>';
if($resource && $resource[0]->resource_type == "whitepaper") $html .= '<img src="'. $data->image[0] .'" class="preview-img">';
else $html .= makeIntro($data->text,300,true," ...");
$html .= '<a href="'. $link .'"'.$active.' class="hidden-button">Read more</a>';
$html .= '</div></div>';
}
/*
* Show more
*/
if(count($sidebar_entries) == 5)
{
$html .= '<div class="col8 block orange"><div>';
$fn = $data->first_field;
$link_label = $data->$fn;
$link = vl($section .'/'. $cs["naam"]);
$html .= '<h4>Show all '. $cs["naam"] .'</h3>';
$html .= '<a href="'. $link .'" class="hidden-button">Show more</a>';
$html .= '</div></div>';
}
}
}
else{
/*
* drag-drop contents
*/
$html = '<div class="col16 offset1 content">';
$html .= '<h1>'. $e[0]->title .'</h1>';
if($e[0]->image[0]) $html .= '<div class="article-image '. (strtolower($category)) .'"><img src="'. $e[0]->image[0] .'" /></div>';
$html .= '<h2>'. $e[0]->subtitle .'</h2>';
$html .= $e[0]->text;
/*
* Resources
*/
if($e[0]->resources && count($e[0]->resources) > 0)
{
$html .= '<div class="resources placed-inline"><h2>Downloads</h2>';
$html .= "<ul>";
foreach($e[0]->resources as $resource)
{
$resources_data = $cassette->entries(null,null,$resource[0]);
$resource_type = $resources_data[0]->resource_type;
$resource_name = preg_replace("/$resource_type/i","",$resources_data[0]->title);
switch(strtolower($resource_type))
{
case "link":
case "video":
$resource_link = $resources_data[0]->external_link[0][0];
break;
default:
$hash = hash_hmac('sha256', $resources_data[0]->unique_id, $security_key);
$resource_link = 'documents?id='.$resources_data[0]->unique_id.'&hash='.$hash;//.$resources_data[0]->upload[0][0];
break;
}
$html .= '<li class="col12"><a href="'. $resource_link .'" class="'. vl($resources_data[0]->resource_type) .'" target="_blank"><strong>'. $resources_data[0]->resource_type .'</strong><span>'. $resource_name .'</span></a></li>';
}
$html .= "</ul></div>";
}
// share page
$html .= '<h4>Share this page</h4>';
$html .= '<div id="share-article"></div><br />';
$html .= '</div>';
$html .= '<div class="col7 sidebar">';
$html .= '<div class="menu">';
$html .= '<h3>'. dp($category == null ? ucfirst($section) : ucfirst($category) ) .'</h3>';
$sidebar_entries = $cassette->entries($section,$category);
$html .= '<ul class="sidebar-navigation">';
foreach($sidebar_entries as $data)
{
$fn = $data->first_field;
$link_label = $data->$fn;
$link = vl($section .'/'. $category .'/'.$data->$fn.'-'. $data->unique_id);
$active = $data->unique_id == $post_eid ? ' class="active"' : '';
$html .= '<li>';
$html .= '<a href="'. $link .'"'.$active.'>'. $link_label .'</a>';
$html .= '</li>';
}
$html .= '</ul>';
/*$categories_in_section = $cassette->getCategories($section);
//$html .= '<ul class="sidebar-navigation">';
foreach($categories_in_section as $cs){
$html .= '<h3>'. ucfirst($cs["naam"]) .'</h3>';
$sidebar_entries = $cassette->entries($section,$cs["naam"],null,null,null,5);
$html .= '<ul class="sidebar-navigation">';
foreach($sidebar_entries as $data)
{
$fn = $data->first_field;
$link_label = $data->$fn;
$link = vl($section .'/'. $category .'/'.$data->$fn.'-'. $data->unique_id);
$active = $data->unique_id == $post_eid ? ' class="active"' : '';
$html .= '<li>';
$html .= '<a href="'. $link .'"'.$active.'>'. $link_label .'</a>';
$html .= '</li>';
}
$html .= '</ul>';
}
//$html .= '</ul>';*/
$html .= '</div>';
}
/*
* Output html
*/
echo $cassette->wrapAsSection($html,"","newsroom");
/*
* conversion form
if($e[0]->form_id)
{
$form_id = $e[0]->form_id;
$hide_headers = true;
require_once "sections/section.form.php";
echo $cassette->wrapAsSection('<div class="col24">'. $return .'</div>',"","contact-form");
}
*/
/*
* contact NEC footer
*/
// if($e[0]->contact != 1) require_once "sections/section.contact-us.php";
?>