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

Commit

Permalink
integrating uc-people views
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmbacon committed Aug 7, 2015
1 parent 1e72832 commit d1717ac
Show file tree
Hide file tree
Showing 3 changed files with 399 additions and 0 deletions.
122 changes: 122 additions & 0 deletions inc/people-grid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?php
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) { ?>
<div class="row">
<?php
$person_count=1;
while ( $the_query->have_posts() ) {
$the_query->the_post();


?>







<div class="col-sm-3 personcount-<?php echo $person_count ?>" id="person-<?php echo get_the_id(); ?>">
<div class="person">
<?php

echo '<a href="'. get_the_permalink().'" class="person-permalink">';

if (in_array('photo', $information_to_display)) {
echo '<span class="person-image">';
the_post_thumbnail('large');
echo '</span>';
};

if (in_array('first', $information_to_display) || in_array('middle', $information_to_display) || in_array('last', $information_to_display)){
echo '<h4 class="person-name">';
if (in_array('first', $information_to_display)) {
the_field('first_name');
echo ' ';
};
if (in_array('middle', $information_to_display)) {
the_field('middle_name');
echo ' ';
};
if (in_array('last', $information_to_display)) {
the_field('last_name');
};
echo '</h4>';
};

echo '</a>';

if (in_array('title', $information_to_display)) {
echo '<p class="person-title"><strong>';
the_field('title');
echo '</strong></p>';
};
if (in_array('about', $information_to_display)) {
echo '<div class="person-about">';
the_field('about');
echo '</div>';
};
if (in_array('link', $information_to_display)) {
echo '<p class="person-file">';
$file = get_field('file');
//var_dump($thing);
echo '<a href="'.$file[url].'">'.$file[title].'</a>';
echo '</p>';
};
if (in_array('email', $information_to_display)) {
echo '<p class="person-email">';
echo '<a href="mailto:'.get_field('email').'">'.get_field('email').'</a>';
echo '</p>';
};
if (in_array('phone', $information_to_display)) {
echo '<p class="person-phone">';
the_field('phone');
echo '</p>';
};
if (in_array('phonealt', $information_to_display)) {
echo '<p class="person-phone_(alternate)">';
the_field('phone_(alternate)');
echo '</p>';
};
if (in_array('fax', $information_to_display)) {
echo '<p class="person-fax">';
the_field('fax');
echo '</p>';
};
if (in_array('mail', $information_to_display)) {
echo '<p class="person-mailing_address">';
the_field('mailing_address');
echo '</p>';
};
if (in_array('office_location ', $information_to_display)) {
echo '<p class="person-office_location">';
the_field('office_location');
echo '</p>';
};
if (in_array('office_hours', $information_to_display)) {
echo '<p class="person-office_hours">';
the_field('office_hours');
echo '</p>';
};
if (in_array('courses', $information_to_display)) {
echo '<p class="person-courses">';
the_field('courses');
echo '</p>';
}; ?>
</div><!-- /person -->
</div> <!-- /col -->

<?php
// check to see if we need to close this row...
if ($person_count % 4 == 0){
// if this is the 4th, 8th, 16th, etc person...
echo '</div><!-- /row --><div class="row">';
}
$person_count++;
} //end of posts?>
</div><!-- last row -->
<?php
} else {
// no posts found
}; ?>

121 changes: 121 additions & 0 deletions inc/people-table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?php
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {

// how many columns? Based on what they chose to display.

$num_cols = count($information_to_display);
var_dump($num_cols);

?>
<table class="table table-striped">
<legend class="sr-only">List of People</legend>
<thead>
<tr>
<?php
$nameCell = false;
foreach($information_to_display as $value){
if ($value == 'first' || $value == 'middle' || $value == 'last'){
if ($nameCell == false){
echo '<th>Name</th>';
$nameCell = true;
};
} else {
echo '<th>'.$value.'</th>';
}
}
?>
</tr>
</thead>
<tbody>
<?php
var_dump($information_to_display);
echo '<hr>';

function createTextCell($setting, $field){
global $information_to_display;
if (in_array($setting, $information_to_display)) {
echo '<td class="person-title">';
the_field($field);
echo '</td>';
}
};

while ( $the_query->have_posts() ) {
$the_query->the_post();

/*
create a row.
For each possible field.
Check to see if it's within the $information_to_display array.
If it is, create a <td>
IF any values are found to match, dump those out.
After all possible fields, close the row.
*/




echo '<tr>';

if (in_array('photo', $information_to_display)) {
echo '<td class="person-image"><a href="'.get_the_permalink().'">';
the_post_thumbnail(array('65', '65'));
echo '</a></td>';
}
if (in_array('first', $information_to_display) || in_array('middle', $information_to_display) || in_array('last', $information_to_display)){
echo '<td class="person-name"><a href="'.get_the_permalink().'">';
if (in_array('first', $information_to_display)) {
the_field('first_name');
echo ' ';
};
if (in_array('middle', $information_to_display)) {
the_field('middle_name');
echo ' ';
};
if (in_array('last', $information_to_display)) {
the_field('last_name');
};
echo '</a></td>';
}
createTextCell('title', 'title');
createTextCell('about', 'about');
if (in_array('link', $information_to_display)) {
echo '<td class="person-file">';
$file = get_field('file');
echo '<a href="'.$file[url].'">'.$file[title].'</a>';
echo '</td>';
};
if (in_array('email', $information_to_display)) {
echo '<td class="person-email">';
echo '<a href="mailto:'.get_field('email').'">'.get_field('email').'</a>';
echo '</td>';
};
createTextCell('phone', 'phone');
createTextCell('phonealt', 'phone_(alternate)');
createTextCell('fax', 'fax');
createTextCell('mail', 'mailing_address');
createTextCell('office_location', 'office_location');
createTextCell('office_hours', 'office_hours');
createTextCell('courses', 'courses');



echo '</tr>';



} //end of posts?>
</tbody>
</table>

<?php
} else {
// no posts found
}; ?>
Loading

0 comments on commit d1717ac

Please sign in to comment.