Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
UC People Update
  • Loading branch information
jmr06005 committed Dec 17, 2015
1 parent f9ba36d commit c607e65
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 33 deletions.
16 changes: 16 additions & 0 deletions inc/people-grid.php
Expand Up @@ -54,6 +54,14 @@ if ( $the_query->have_posts() ) { ?>
}
echo '</p>';
};
if (in_array('department', $information_to_display)) {
echo '<p class="person-department">';
$departmentPieces = explode(";", get_field('department'));
foreach( $departmentPieces as $d ){
echo ( !empty($d) ? "<strong>{$d}</strong><br>": "" );
}
echo '</p>';
};
if (in_array('about', $information_to_display)) {
echo '<div class="person-about">';
the_field('about');
Expand Down Expand Up @@ -98,6 +106,11 @@ if ( $the_query->have_posts() ) { ?>
the_field('office_location');
echo '</p>';
};
if (in_array('campus', $information_to_display)) {
echo '<p class="person-campus">';
the_field('campus');
echo '</p>';
};
if (in_array('office_hours', $information_to_display)) {
echo '<p class="person-office_hours">';
the_field('office_hours');
Expand All @@ -107,6 +120,9 @@ if ( $the_query->have_posts() ) { ?>
echo '<p class="person-courses">';
the_field('courses');
echo '</p>';
};
if (in_array('url', $information_to_display)) {
echo '<p class="person-url"><a href="'.get_field('url').'">'.get_field('url').'</a></p>';
}; ?>
</div><!-- /person -->
</div> <!-- /col -->
Expand Down
14 changes: 14 additions & 0 deletions inc/people-table.php
Expand Up @@ -90,6 +90,14 @@ if ( $the_query->have_posts() ) {
}
echo '</td>';
}
if (in_array('department', $information_to_display)) {
echo '<td class="person-department">';
$departmentPieces = explode(";", get_field('department'));
foreach( $departmentPieces as $d ){
echo ( !empty($d) ? "<strong>{$d}</strong><br>": "" );
}
echo '</td>';
}
createTextCell('about', 'about');
if (in_array('file', $information_to_display)) {
echo '<td class="person-file">';
Expand All @@ -112,8 +120,14 @@ if ( $the_query->have_posts() ) {
echo '</td>';
}
createTextCell('office_location', 'office_location');
createTextCell('campus', 'campus');
createTextCell('office_hours', 'office_hours');
createTextCell('courses', 'courses');
if (in_array('url', $information_to_display)) {
echo '<td class="person-url">';
echo '<a href="'.get_field('url').'">'.get_field('url').'</a>';
echo '</td>';
};



Expand Down
169 changes: 136 additions & 33 deletions single-person.php
@@ -1,33 +1,136 @@
<?php
/**
* Used for displaying the 'person' post type.
*/

get_header(); ?>
<?php include('inc/sidebar-check.php')?>
<div id="page-page">
<?php if (have_posts()) : while ( have_posts() ) : the_post(); ?>
<?php include('inc/submenu-check.php') ?>
<div class="row">
<div class="col-sm-<?php echo (is_active_sidebar( $sidebar )?9:12); ?>">
<div id="primary" class="content-area subpage">
<main id="main" class="site-main" role="main">
<div class="row">
<?php
$about = get_field('about');
if (strlen($about) > 0){
include('inc/person-with-about.php');
} else {
include('inc/person-no-about.php');
}
?>
</div>
</main>
</div>
</div>
<?php include('inc/sidebar-if-active.php')?>
</div>
<?php include('inc/submenu-closing-tags.php')?>
<?php endwhile; endif; // end of the loop. ?>
</div>
<?php get_footer(); ?>
<?php
/**
* Used for displaying the 'person' post type.
*/

get_header(); ?>
<?php include('inc/sidebar-check.php')?>
<div id="page-page">
<?php if (have_posts()) : while ( have_posts() ) : the_post(); ?>
<?php include('inc/submenu-check.php') ?>
<div class="row">
<div class="col-sm-<?php echo (is_active_sidebar( $sidebar )?9:12); ?>">
<div id="primary" class="content-area subpage">
<main id="main" class="site-main" role="main">
<div class="row">
<div class="col-sm-8">
<h1>
<?php
the_field('first_name');
echo ' ';
if (get_field('middle_name')){
the_field('middle_name');
echo ' ';
};
the_field('field_last_name');
?></h1>

<?php
$titlePieces = explode(";", get_field('title'));
foreach( $titlePieces as $t ){
echo ( !empty($t) ? '<p class="text-muted">'.$t.'</p>': '' );
}
$departmentPieces = explode(";", get_field('department'));
foreach( $departmentPieces as $d ){
echo ( !empty($d) ? '<p class="text-muted">'.$d.'</p>': '' );
}
?>
<hr/>
<?php the_field('about'); ?>
</div>
<div class="col-sm-4">
<?php if(get_the_post_thumbnail()){
echo '<div class="person-thumbnail">';
the_post_thumbnail();
echo '</div>';
};?>
<div>
<table class="table">
<legend class="sr-only">Contact Information</legend>
<?php
/*
function displayField($field){
if (get_field($field)){
$field_key = 'field_'.$field;
$field_obj = get_field_object($field_key);
$field_value = $field_obj['value'];
$field_label = $field_obj['label'];
echo '<h5>'.$field_label.'</h5>';
echo '<p class="person-'.$field.'">';
if ($field == 'email'){
echo '<a href="mailto:'.$field_value.'">';
the_field($field);
echo '</a>';
} else if ($field == 'file'){
$file = get_field($field);
$url= $file['url'];
echo '<a class="btn btn-default" href="'.$url.'"><span class="glyphicon glyphicon-save-file"></span> ';
echo $file['title'];
echo '</a>';
} else {
the_field($field);
}
echo '</p><hr/>';
}
}
*/
function displayField($field){
if (get_field($field)){

$field_key = 'field_'.$field;
$field_obj = get_field_object($field_key);
$field_value = $field_obj['value'];
$field_label = $field_obj['label'];
echo '<tr>';
if ($field == 'file'){
echo '<th>'.get_field('filelabel').'</th>';
} else {
echo '<th>'.$field_label.'</th>';
}
echo '<td class="person-'.$field.'">';
if ($field == 'email'){
echo '<a href="mailto:'.$field_value.'">';
the_field($field);
echo '</a>';
} else if ($field == 'file'){
$file = get_field($field);
$url= $file['url'];
echo '<a href="'.$url.'"><span class="glyphicon glyphicon-save-file"></span> ';
echo $file['title'];
echo '</a>';
} else if ($field == 'mailing_address'){
echo str_replace(';','<br>',get_field('mailing_address'));
} else {
the_field($field);
}
echo '</td></tr>';
}
}
displayField('email');
displayField('phone');
displayField('phone_(alternate)');
displayField('fax');
displayField('file');
displayField('mailing_address');
displayField('office_location');
displayField('campus');
displayField('office_hours');
displayField('courses');
displayField('url');
?>
</table>
</div>
</div>
</div>


</main>
</div>
</div>
<?php include('inc/sidebar-if-active.php')?>
</div>
<?php include('inc/submenu-closing-tags.php')?>
<?php endwhile; endif; // end of the loop. ?>
</div>
<?php get_footer(); ?>

0 comments on commit c607e65

Please sign in to comment.