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
Merge pull request #134 from jmr06005/master
UC People Update
  • Loading branch information
jmr06005 committed Dec 17, 2015
2 parents f9ba36d + 69e139d commit 9edce68
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 115 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
48 changes: 48 additions & 0 deletions inc/person-info.php
@@ -0,0 +1,48 @@
<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 '<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>
46 changes: 5 additions & 41 deletions inc/person-no-about.php
Expand Up @@ -21,46 +21,10 @@
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>': '' );
}
?>
<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 '<tr><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('office_hours');
displayField('courses');
?>
</table>
<?php include('person-info.php'); ?>
</div>
46 changes: 5 additions & 41 deletions inc/person-with-about.php
Expand Up @@ -14,6 +14,10 @@
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'); ?>
Expand All @@ -25,46 +29,6 @@
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 '<tr><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('office_hours');
displayField('courses');
?>
</table>
<?php include('person-info.php'); ?>
</div>
</div>
66 changes: 33 additions & 33 deletions single-person.php
@@ -1,33 +1,33 @@
<?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">
<?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(); ?>

0 comments on commit 9edce68

Please sign in to comment.