Commit 677707cd authored by Juraj's avatar Juraj
Browse files

Adding new section to People.

Merge branch 'master' of http://git.app.uib.no/Asmund.Birkeland/visgroup-webpages
parents 607b8ff2 ac63f196
......@@ -104,6 +104,13 @@
</div>
@;url||pdf||pres@
@?git@
<div id="source" class="col-md-12">
<h2>Source Code</h2>
<a href="@git@">@git@</a>
</div>
@;git@
</div>
</div>
</article>
......
......@@ -78,7 +78,7 @@ global $teamPost;
?>
<div class="row team-entry" >
<div class="row team-entry" >
<div class="team-image">
<?php if (has_post_thumbnail()) { ?>
<!-- <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
......@@ -95,47 +95,33 @@ global $teamPost;
<?php the_title(); ?>
</a>
</h3>
<?php if ($teachers = get_field('course_teachers')): ?>
<p>Taught by:
<?php
foreach ($teachers as $teacher):
?>
<a href=<?php echo $teacher->post_permalink; ?> title="<?php echo $teacher->post_title; ?>">
<?php echo$teacher->post_title; ?>
</a>
<?php endforeach;
?>
</p>
<?php endif;
?>
<?php if ($office = get_field('course_room')): ?>
<p>Lecture room:
<?php if ($mazemapPOI = get_field('course_mazemap_poi')): ?>
<a href="https://use.mazemap.com/?v=1&sharepoitype=poi&campusid=34&left=5.3311&right=5.3321&top=60.3814&bottom=60.3811&sharepoi=<?php echo $mazemapPOI; ?>">HiB, room <?php echo $office; ?></a>
<?php else: ?>
HiB, room <?php echo $office; ?>
<?php endif; ?>
</p>
<?php endif; ?>
<?php if ($desc = get_field('course_description')): ?>
<div class="team-details">
<?php if ($desc = get_field('course_description')): ?>
<p>
<?php echo $desc; ?>
</p>
<?php endif; ?>
</div>
</div>
</th>
<ul class="fa-ul">
<?php if ($code = get_field("course_code")): ?>
<li><i class="fa fa-link fa-li"></i><a href="http://www.uib.no/en/course/<?php echo $code ?>" title="<?php echo $code; ?>@uib.no"><?php echo $code ?>@uib.no</a></li>
<?php endif; ?>
<?php if ($teachers = get_field('course_teachers')): ?>
<?php
foreach ($teachers as $teacher):
?>
<li><i class="fa fa-user fa-li"></i><a href="<?php echo get_permalink($teacher->ID); ?>" title="<?php echo get_the_title($teacher->ID); ?>"><?php echo get_the_title($teacher->ID); ?></a></li>
<?php
endforeach;
?>
<?php endif; ?>
</ul>
</div>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
......
......@@ -8,7 +8,7 @@ the_post();
$currentDate =date('Y-m-d');
$today = explode("/", date('Y-m-d'));
// Get 'team' posts
// Get 'team' upcoming posts
$event_posts_asc = query_posts( array(
'post_type' => 'events',
'order' => 'ASC',
......@@ -17,15 +17,16 @@ $event_posts_asc = query_posts( array(
'posts_per_page' => -1, // Unlimited posts
'meta_compare' => '>=',
'meta_value' => date('Y-m-d'),
) );
// Past posts
$event_posts_desc = query_posts (array(
'post_type' => 'events',
'order' => 'DESC',
'orderby' => 'meta_value',
'meta_key' => 'event_date',
'posts_per_page' => -1, // Unlimited posts
'meta_compare' => '<=',
'meta_compare' => '<',
'meta_value' => date('Y-m-d'),
) );
$categories = array();
......@@ -35,7 +36,7 @@ foreach ($event_posts_desc as $post):
if($cat_field[0]){
array_push($categories, $cat_field[0]);
}
endforeach;
$categories = array_unique($categories);
global $categories;
......@@ -44,7 +45,7 @@ global $event_posts_desc;
?>
<style>
<style>
tr { display: block; float: left; }
th, td { display: block; }
......@@ -69,15 +70,15 @@ global $event_posts_desc;
<div class="row">
<div class="col-md-8">
<div class="tab-content">
<?php
createTab("All","");
createTab("Upcoming events","All");
foreach ($categories as $cat ):
createTab($cat."s",$cat);
endforeach;
//createTab('All','');
//createTab('VCF','VCF');
//createTab('Workshops','Workshop');
......@@ -85,66 +86,65 @@ global $event_posts_desc;
//createTab('Seminars', 'Seminar');
?>
</div>
</div>
<aside class="sidebar col-md-3 col-md-offset-1 col-bordered" >
<hr class="visible-sm visible-xs lg">
<div class="widget_categories widget widget__sidebar" id="custom_sidebar" style="">
<h3 class="widget-title">Categories</h3>
<h3 class="widget-title">Categories</h3>
<ul class="nav nav-pills nav-stacked">
<li class="active"><a data-toggle="tab" href="#All">All</a></li>
<?php
foreach ($categories as $cat ):
echo "<li><a data-toggle='tab' href='#" . preg_replace('/\s+/', '_', $cat) ."'>".$cat."s</a></li>";
endforeach;
?>
</ul>
</div>
</aside>
</div>
</div>
</section>
<!-- Page Content / End -->
<!-- Page Content / End -->
<?php get_footer();
function createTab($title,$category){
global $event_posts_asc;
global $event_posts_desc;
global $post;
$category = preg_replace('/\s+/', '_', $category);
$active = '';
$events = $title;
if (!$category):
if ($category == 'All'):
$active = 'active';
$events = 'Events';
$category = 'All';
endif;
?>
<div id="<?php echo $category?>" class="tab-pane fade in <?php echo $active?>">
<h1><?php echo $title;?></h1>
<?php
foreach ($event_posts_asc as $post):
$cat = get_post_field('event_category',$post->ID);
$cat = preg_replace('/\s+/', '_',$cat);
if ($cat == $category or !$category):
if ($cat == $category or $category == 'All'):
presentPost($post, false);
endif;
......@@ -153,25 +153,25 @@ global $event_posts_desc;
foreach ($event_posts_desc as $post):
$cat = get_post_field('event_category',$post->ID);
$cat = preg_replace('/\s+/', '_',$cat);
if ($cat == $category or $category):
if ($cat == $category or $category == 'All'):
presentPost($post, true);
endif;
endforeach;
?>
</div>
<?php
}
function presentPost($post, $pastEvents)
{
global $post;
setup_postdata($post);
// Resize and CDNize thumbnails using Automattic Photon service
$thumb_src = null;
if (has_post_thumbnail($post->ID)) {
......@@ -191,7 +191,7 @@ function presentPost($post, $pastEvents)
<?php echo get_the_post_thumbnail($post->ID,'thumbnail');?>
<?php } ?>
</div>
<div class="team-info">
<h3>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
......@@ -237,7 +237,7 @@ function presentPost($post, $pastEvents)
</div>
</div>
</div><!-- /.profile -->
<?php
}
?>
......@@ -554,6 +554,41 @@ function woocommerce_result_count() {
}
@ini_set( 'upload_max_size' , '64M' );
/**
* Register `group` post type
*/
function group_post_type() {
// Labels
$labels = array(
'name' => _x("Groups", "post type general name"),
'singular_name' => _x("Group", "post type singular name"),
'menu_name' => 'Groups',
'add_new' => _x("Add New", "group"),
'add_new_item' => __("Add New Group"),
'edit_item' => __("Edit Group"),
'new_item' => __("New Group"),
'view_item' => __("View Group"),
'search_items' => __("Search Groups"),
'not_found' => __("No Groups Found"),
'not_found_in_trash' => __("No Groups Found in Trash"),
'parent_item_colon' => ''
);
// Register post type
register_post_type('groups' , array(
'labels' => $labels,
'public' => true,
'has_archive' => false,
'menu_icon' => 'dashicons-admin-users',
'rewrite' => true,
'supports' => array('title', 'editor', 'thumbnail')
) );
}
add_action( 'init', 'group_post_type', 0 );
/**
* Register `team` post type
*/
......@@ -564,7 +599,7 @@ function team_post_type() {
'name' => _x("Team", "post type general name"),
'singular_name' => _x("Team", "post type singular name"),
'menu_name' => 'People',
'add_new' => _x("Add New", "team item"),
'add_new' => _x("Add New", "team"),
'add_new_item' => __("Add New Profile"),
'edit_item' => __("Edit Profile"),
'new_item' => __("New Profile"),
......@@ -595,16 +630,16 @@ function project_post_type() {
// Labels
$labels = array(
'name' => _x("Projects", "post type general name"),
'singular_name' => _x("Projects", "post type singular name"),
'singular_name' => _x("Project", "post type singular name"),
'menu_name' => 'Projects',
'add_new' => _x("Add New", "Projects item"),
'add_new_item' => __("Add New Profile"),
'edit_item' => __("Edit Profile"),
'new_item' => __("New Profile"),
'view_item' => __("View Profile"),
'search_items' => __("Search Profiles"),
'not_found' => __("No Profiles Found"),
'not_found_in_trash' => __("No Profiles Found in Trash"),
'add_new' => _x("Add New", "project"),
'add_new_item' => __("Add New Project"),
'edit_item' => __("Edit Project"),
'new_item' => __("New Project"),
'view_item' => __("View Project"),
'search_items' => __("Search Projects"),
'not_found' => __("No Projects Found"),
'not_found_in_trash' => __("No Projects Found in Trash"),
'parent_item_colon' => ''
);
......@@ -625,16 +660,16 @@ function course_post_type() {
// Labels
$labels = array(
'name' => _x("Courses", "post type general name"),
'singular_name' => _x("Courses", "post type singular name"),
'singular_name' => _x("Course", "post type singular name"),
'menu_name' => 'Courses',
'add_new' => _x("Add New", "Courses item"),
'add_new_item' => __("Add New Profile"),
'edit_item' => __("Edit Profile"),
'new_item' => __("New Profile"),
'view_item' => __("View Profile"),
'search_items' => __("Search Profiles"),
'not_found' => __("No Profiles Found"),
'not_found_in_trash' => __("No Profiles Found in Trash"),
'add_new' => _x("Add New", "course"),
'add_new_item' => __("Add New Course"),
'edit_item' => __("Edit Course"),
'new_item' => __("New Course"),
'view_item' => __("View Course"),
'search_items' => __("Search Courses"),
'not_found' => __("No Courses Found"),
'not_found_in_trash' => __("No Courses Found in Trash"),
'parent_item_colon' => ''
);
......@@ -655,14 +690,14 @@ function event_post_type() {
// Labels
$labels = array(
'name' => _x("Events", "post type general name"),
'singular_name' => _x("Events", "post type singular name"),
'singular_name' => _x("Event", "post type singular name"),
'menu_name' => 'Events',
'add_new' => _x("Add New", "Events item"),
'add_new_item' => __("Add New Profile"),
'edit_item' => __("Edit Profile"),
'new_item' => __("New Profile"),
'view_item' => __("View Profile"),
'search_items' => __("Search Profiles"),
'add_new' => _x("Add New", "event"),
'add_new_item' => __("Add New Event"),
'edit_item' => __("Edit Event"),
'new_item' => __("New Event"),
'view_item' => __("View Event"),
'search_items' => __("Search Events"),
'not_found' => __("No Profiles Found"),
'not_found_in_trash' => __("No Profiles Found in Trash"),
'parent_item_colon' => ''
......
<?php
/**
* Template Name: Groups
*/
get_header();
the_post();
// Get 'team' posts
$groups_posts = get_posts(array(
'post_type' => 'groups',
'posts_per_page' => -1, // Unlimited posts
'orderby' => 'title', // Order alphabetically by name
'order' => 'ASC',
));
?>
<!-- Page Heading -->
<section class="page-heading">
<div class="container">
<div class="row">
<div class="col-md-6">
<h1><?php the_title(); ?></h1>
</div>
<div class="col-md-6">
<?php visgroup_breadcrumbs(); ?>
</div>
</div>
</div>
</section>
<!-- Page Content -->
<section class="page-content">
<div class="container">
<div class="row">
<div class="content col-md-8">
<div class="content col-md-12">
<?php
if (has_post_thumbnail())
{
$img_class = array('class' => 'img_responsive');
?>
<figure class="alignleft"> <?php the_post_thumbnail('visgroup_page_thumb', $img_class); ?> </figure>
<?php
}
the_content();
foreach ($groups_posts as $post):
present_post($post, false);
endforeach;
?>
</div>
</div>
<aside class="sidebar col-md-3 col-md-offset-1 col-bordered" >
<hr class="visible-sm visible-xs lg">
<div class="widget_categories widget widget__sidebar" id="custom_sidebar" style="">
<h3 class="widget-title"></h3>
<ul id="scroll_links">
<?php
foreach ($groups_posts as $group ):
echo "<li><a href=". get_permalink($group->ID) . ">" . get_the_title($group->ID) . "</a></li>";
endforeach;
?>
</ul>
</div>
</aside>
</div>
</div>
</section>
<!-- Page Content / End -->
<?php get_footer();
function present_post($post, $skipongoing)
{
setup_postdata($post);
$thumb_src = null;
if (has_post_thumbnail($post->ID)) {
$src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'team-thumb');
$thumb_src = $src[0];
}
$head = get_field('group_head');
?>
<div class="row team-entry" >
<div class="team-image" >
<?php if (has_post_thumbnail()) :
echo get_the_post_thumbnail($post->ID,'thumbnail');
elseif ($head and has_post_thumbnail($head->ID)):
$src = wp_get_attachment_image_src(get_post_thumbnail_id($head->ID), 'team-thumb');
$thumb_src = $src[0]; ?>
<img src="<?php echo $thumb_src ?>" alt="IMG"/>
<?php
//echo get_the_post_thumbnail($head->ID,'thumbnail');
else: ?>
<img src= "<?php bloginfo('template_directory'); ?>/images/noimage.png"/>
<?php endif; ?>
</div>
<div class="team-info">
<h3><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<h4><?php the_field('group_topics'); ?></h4>
<p>
<div class="team-details">
<ul class="fa-ul">
<?php if ($head): ?>
<li><i class="fa fa-user fa-li"></i><a href="<?php echo the_permalink(); ?>" title="<?php echo get_the_title($head->ID); ?>"><?php echo get_field("team_position",$head->ID) . " " . get_the_title($head->ID); ?></a></li>
<?php if ($email = get_field('team_email',$head->ID)): ?>
<li><i class="fa fa-envelope fa-li"></i><a href="mailto:<?php echo antispambot($email); ?>"><?php echo antispambot($email); ?></a></li>
<?php endif; ?>
<?php if ($phone = get_field('team_phone',$head->ID)): ?>
<li><i class="fa fa-phone fa-li"></i><a href="tel:+47 555 84 <?php echo $phone; ?>">+47 555 84 <?php echo $phone; ?></a></li>
<?php endif; ?>
<?php endif; ?>
</ul>
</div>
</p>
</div>
</div>
<?php
wp_reset_postdata();
}
?>
\ No newline at end of file
......@@ -37,51 +37,37 @@ add_shortcode("displayMasters", 'displayMastersPapercite');
<?php the_post_thumbnail(); ?>
<?php endif; ?>
</div>
<div class="team-info col-md-8">
<div class="team-info col-md-8">
<h2><?php the_field('team_position'); ?></h2>
<p><?php the_field('course_description'); ?></p>
<?php if ($office = get_field('course_room')): ?>
<i class="fa fa-home fa-li"></i>
<?php if ($mazemapPOI = get_field('course_mazemap_poi')): ?>
<a href="https://use.mazemap.com/?v=1&sharepoitype=poi&campusid=34&left=5.3311&right=5.3321&top=60.3814&bottom=60.3811&sharepoi=<?php echo $mazemapPOI; ?>">HiB, room <?php echo $office; ?></a>
<?php else: ?>
HiB, room <?php echo $office; ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($teachers = get_field('course_teachers')): ?>
<p>Taught by:
<?php
foreach ($teachers as $post):
setup_postdata($post);
?>
<a href=<?php the_permalink(); ?> title="<?php the_title(); ?>">
<?php the_title(); ?>
</a>
<?php endforeach; ?>
</p>
<?php
wp_reset_postdata();
endif;?>
<div class="team-details">
<ul class="fa-ul">
<?php if ($code = get_field("course_code")): ?>
<li><i class="fa fa-link fa-li"></i><a href="http://www.uib.no/en/course/<?php echo $code ?>" title="<?php echo $code; ?>@uib.no"><?php echo $code ?>@uib.no</a></li>
<?php endif; ?>
<?php if ($teachers = get_field('course_teachers')): ?>
<?php
foreach ($teachers as $teacher):
?>
<li><i class="fa fa-user fa-li"></i><a href="<?php echo get_permalink($teacher->ID); ?>" title="<?php echo get_the_title($teacher->ID); ?>"><?php echo get_the_title($teacher->ID); ?></a></li>
<?php
endforeach;
?>
<?php endif; ?>
</ul>
</div>
</div>
<div align="justify">
<p >
<?php the_field('course_description'); ?>