Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
060ae01590
Go to file
 
 
Cannot retrieve contributors at this time
672 lines (654 sloc) 29 KB
<?php
/*
Template Name: Programs New
*/
?>
<?php
$api = 'http://app.studyabroad.uconn.edu/piapi/index.cfm?callName=getProgramSearchElements&ResponseEncoding=JSON&callBack=false';
$response = wp_remote_get( $api );
if( is_array($response) && isset($response['body']) && strlen($response['body']) > 0 ) {
$terradata = json_decode($response['body']);
}
else{
$terradata = false;
}
if(false!==$terradata){
$languageofinstruction = array();
$languageofferedin = array();
$priorlanguage = array();
$typeofprogram = array();
$nonuconn = array();
$academicarea = array();
$gpa = array();
$scholarships = array();
$sponsorship = array();
$programtype = array();
$term = array();
$city = array();
$country = array();
$region = array();
$sort = array();
$order = array();
$partner = array();
$exclude = array();
$classstatus = array();
foreach($terradata->ELEMENT as $element){
if($element->DISPLAY_NAME == 'Language of instruction'){
$languageofinstruction['meta'] = array('id' => $element->FORM_NAME, 'type' => $element->PARAM_TYPE);
$languageofinstruction['vals'] = array();
foreach($element->OPTIONS->OPTION as $option){
$languageofinstruction['vals'][$option->VALUE] = $option->NAME;
}
asort($languageofinstruction['vals']);
}
elseif($element->DISPLAY_NAME == 'Language courses offered in'){
$languageofferedin['meta'] = array('id' => $element->FORM_NAME, 'type' => $element->PARAM_TYPE);
$languageofferedin['vals'] = array();
foreach($element->OPTIONS->OPTION as $option){
$languageofferedin['vals'][$option->VALUE] = $option->NAME;
}
asort($languageofferedin['vals']);
}
elseif($element->DISPLAY_NAME == 'Prior language study required'){
$priorlanguage['meta'] = array('id' => $element->FORM_NAME, 'type' => $element->PARAM_TYPE);
$priorlanguage['vals'] = array();
foreach($element->OPTIONS->OPTION as $option){
$priorlanguage['vals'][$option->VALUE] = $option->NAME;
}
asort($priorlanguage['vals']);
}
elseif($element->DISPLAY_NAME == 'Type of program'){
$typeofprogram['meta'] = array('id' => $element->FORM_NAME, 'type' => $element->PARAM_TYPE);
$typeofprogram['vals'] = array();
foreach($element->OPTIONS->OPTION as $option){
$typeofprogram['vals'][$option->VALUE] = $option->NAME;
}
asort($typeofprogram['vals']);
}
elseif($element->DISPLAY_NAME == 'Class status'){
$classstatus['meta'] = array('id' => $element->FORM_NAME, 'type' => $element->PARAM_TYPE);
$classstatus['vals'] = array();
foreach($element->OPTIONS->OPTION as $option){
$classstatus['vals'][$option->VALUE] = $option->NAME;
}
asort($classstatus['vals']);
}
elseif($element->DISPLAY_NAME == 'Open to non-UConn students'){
$nonuconn['meta'] = array('id' => $element->FORM_NAME, 'type' => $element->PARAM_TYPE);
$nonuconn['vals'] = array();
foreach($element->OPTIONS->OPTION as $option){
$nonuconn['vals'][$option->VALUE] = $option->NAME;
}
asort($nonuconn['vals']);
}
elseif($element->DISPLAY_NAME == 'Academic area'){
$academicarea['meta'] = array('id' => $element->FORM_NAME, 'type' => $element->PARAM_TYPE);
$academicarea['vals'] = array();
foreach($element->OPTIONS->OPTION as $option){
$academicarea['vals'][$option->VALUE] = $option->NAME;
}
asort($academicarea['vals']);
}
elseif($element->DISPLAY_NAME == 'Required GPA'){
$gpa['meta'] = array('id' => $element->FORM_NAME, 'type' => $element->PARAM_TYPE);
$gpa['vals'] = array();
foreach($element->OPTIONS->OPTION as $option){
$gpa['vals'][] = $option->NAME;
}
asort($gpa['vals']);
}
elseif($element->DISPLAY_NAME == 'Program Type'){
foreach($element->OPTIONS->OPTION as $option){
$programtype[$option->VALUE] = $option->NAME;
}
asort($programtype);
}
elseif($element->DISPLAY_NAME == 'Partner Institution(s):'){
$partner['meta'] = array('id' => $element->FORM_NAME, 'type' => $element->PARAM_TYPE);
$partner['vals'] = array();
foreach($element->OPTIONS->OPTION as $option){
$partner['vals'][$option->VALUE] = $option->NAME;
}
asort($partner['vals']);
}
elseif($element->DISPLAY_NAME == 'Program Sponsorship'){
$sponsorship['meta'] = array('id' => $element->FORM_NAME, 'type' => $element->PARAM_TYPE);
$sponsorship['vals'] = array();
foreach($element->OPTIONS->OPTION as $option){
$sponsorship['vals'][$option->VALUE] = $option->NAME;
}
asort($sponsorship['vals']);
}
elseif($element->DISPLAY_NAME == 'Financial Aid & Scholarships'){
$scholarships['meta'] = array('id' => $element->FORM_NAME, 'type' => $element->PARAM_TYPE);
$scholarships['vals'] = array();
foreach($element->OPTIONS->OPTION as $option){
$scholarships['vals'][$option->VALUE] = $option->NAME;
}
asort($scholarships['vals']);
}
elseif($element->DISPLAY_NAME == 'Term'){
foreach($element->OPTIONS->OPTION as $option){
$term[$option->VALUE] = $option->NAME;
}
asort($term);
}
elseif($element->DISPLAY_NAME == 'City'){
foreach($element->OPTIONS->OPTION as $option){
$city[$option->VALUE] = $option->NAME;
}
asort($city);
}
elseif($element->DISPLAY_NAME == 'Country'){
foreach($element->OPTIONS->OPTION as $option){
$country[$option->VALUE] = $option->NAME;
}
asort($country);
}
elseif($element->DISPLAY_NAME == 'Region'){
foreach($element->OPTIONS->OPTION as $option){
$region[$option->VALUE] = $option->NAME;
}
asort($region);
}
elseif($element->DISPLAY_NAME == 'Sort Results By'){
foreach($element->OPTIONS->OPTION as $option){
$sort[$option->VALUE] = $option->NAME;
}
asort($sort);
}
elseif($element->DISPLAY_NAME == 'Order Results'){
foreach($element->OPTIONS->OPTION as $option){
$order[$option->VALUE] = $option->NAME;
}
asort($order);
}
elseif($element->DISPLAY_NAME == 'Programs to Exclude'){
foreach($element->OPTIONS->OPTION as $option){
$exclude[$option->VALUE] = $option->NAME;
}
asort($exclude);
}
}
}
$api = 'http://app.studyabroad.uconn.edu/piapi/index.cfm?callName=getProgramSearchResults&ResponseEncoding=JSON&callBack=false';
$apiargs = '';
$apiparams = array();
$search_results = false;
if(isset($_GET['Country']) && strlen($_GET['Country']) > 0){
$apiargs .= '&Country='.urlencode($_GET['Country']);
}
if(isset($_GET['Region']) && strlen($_GET['Region']) > 0){
$apiargs .= '&Region='.urlencode($_GET['Region']);
}
if(isset($_GET['City']) && strlen($_GET['City']) > 0){
$apiargs .= '&City='.urlencode($_GET['City']);
}
if(isset($_GET['Term']) && strlen($_GET['Term']) > 0){
$apiargs .= '&Term='.urlencode($_GET['Term']);
}
if(isset($_GET['languageofinstruction']) && strlen($_GET['languageofinstruction']) > 0){
$apiparams[] = $languageofinstruction['meta']['id'].'='.urlencode($_GET['languageofinstruction']).'|'.$languageofinstruction['meta']['id'].'_t='.$languageofinstruction['meta']['type'];
}
if(isset($_GET['languageofferedin']) && strlen($_GET['languageofferedin']) > 0){
$apiparams[] = $languageofferedin['meta']['id'].'='.urlencode($_GET['languageofferedin']).'|'.$languageofferedin['meta']['id'].'_t='.$languageofferedin['meta']['type'];
}
if(isset($_GET['priorlanguage']) && strlen($_GET['priorlanguage']) > 0){
$apiparams[] = $priorlanguage['meta']['id'].'='.urlencode($_GET['priorlanguage']).'|'.$priorlanguage['meta']['id'].'_t='.$priorlanguage['meta']['type'];
}
if(isset($_GET['typeofprogram']) && strlen($_GET['typeofprogram']) > 0){
$apiparams[] = $typeofprogram['meta']['id'].'='.urlencode($_GET['typeofprogram']).'|'.$typeofprogram['meta']['id'].'_t='.$typeofprogram['meta']['type'];
}
if(isset($_GET['classstatus']) && strlen($_GET['classstatus']) > 0){
$apiparams[] = $classstatus['meta']['id'].'='.urlencode($_GET['classstatus']).'|'.$classstatus['meta']['id'].'_t='.$classstatus['meta']['type'];
}
if(isset($_GET['nonuconn']) && strlen($_GET['nonuconn']) > 0){
$apiparams[] = $nonuconn['meta']['id'].'='.urlencode($_GET['nonuconn']).'|'.$nonuconn['meta']['id'].'_t='.$nonuconn['meta']['type'];
}
if(isset($_GET['academicarea']) && strlen($_GET['academicarea']) > 0){
$apiparams[] = $academicarea['meta']['id'].'='.urlencode($_GET['academicarea']).'|'.$academicarea['meta']['id'].'_t='.$academicarea['meta']['type'];
}
if(isset($_GET['gpa']) && strlen($_GET['gpa']) > 0){
$apiparams[] = $gpa['meta']['id'].'='.urlencode($_GET['gpa']).'|'.$gpa['meta']['id'].'_t='.$gpa['meta']['type'];
}
if(isset($_GET['programtype']) && strlen($_GET['programtype']) > 0){
$apiargs .= '&ProgramType='.urlencode($_GET['programtype']);
}
if(isset($_GET['partner']) && strlen($_GET['partner']) > 0){
$apiparams[] = $partner['meta']['id'].'='.urlencode($_GET['partner']).'|'.$partner['meta']['id'].'_t='.$partner['meta']['type'];
}
if(isset($_GET['sponsorship']) && strlen($_GET['sponsorship']) > 0){
$apiparams[] = $sponsorship['meta']['id'].'='.urlencode($_GET['sponsorship']).'|'.$sponsorship['meta']['id'].'_t='.$sponsorship['meta']['type'];
}
if(isset($_GET['scholarships']) && strlen($_GET['scholarships']) > 0){
$apiparams[] = $scholarships['meta']['id'].'='.urlencode($_GET['scholarships']).'|'.$scholarships['meta']['id'].'_t='.$scholarships['meta']['type'];
}
//if(strlen($apiargs) > 0){
if(count($apiparams) > 0){
$apiargs .= '&params='.implode('|', $apiparams);
}
//echo '<a href="'.$api.$apiargs.'">here</a>';
$response = wp_remote_get( $api.$apiargs, array('timeout' => 10) );
if( is_array($response) && isset($response['body']) && strlen($response['body']) > 0 ) {
$search_results = json_decode($response['body']);
}
//print_r($response);
//}
?>
<?php get_header(); ?>
<div class="holdit">
<!-- =========== Selection Menu ============ -->
<?php
$programTabIDs = array(
'uconn-faculty-led|exchange-partner' => 'UConn Programs',
//'exchange-partner' => 'Exchange',
//'ct-bw-exchange' => 'CT - BW Exchange',
'3rd-party-direct-enroll' => 'Non-UConn Programs',
//'non-uconn' => 'Open to Non-UConn Students',
'all' => 'All Programs'
);
if(!isset($_GET['category']) || strlen($_GET['category']) == 0 || !isset($programTabIDs[$_GET['category']])) $_GET['category'] = 'uconn-faculty-led|exchange-partner';
?>
<section id="program-container" class="program-content clearfix">
<!-- Student Prospective Menu --->
<div class="row-fluid">
<div class="col-sm-12 filterbuttons">
<!-- Filter Buttons --->
<div class="btn-group">
<?php
foreach( $programTabIDs as $id => $title ){
echo '<a type="button" class="btn btn-default';
if(isset($_GET['category']) && strstr($id, $_GET['category'])){
echo ' active';
}
echo '" href="?category='.$id.'">'.$title.'</a>';
}
?>
<ul class="btn-group tab-list-swap">
<li class="btn active"> <a href="#tab1" data-toggle="tab">Grid</a> </li>
<li class="btn"> <a href="#tab2" data-toggle="tab">List</a> </li>
</ul>
</div>
<hr />
<form method="get" action="?">
<div class="sorting-row">
<?php
/*switch($currentPageID){
case $programID:
$cat = 'study-program';
break;
case $exchangeID:
$cat = 'exchange-partner';
break;
case $uconnInID:
$cat = 'uconn-faculty-led';
break;
case $thirdPartyID:
$cat = 5;
break;
case $nonUconn:
$cat = 513;
break;
}*/
//include(dirname( __FILE__ ) . '/sorting-list.php'); //Moved the dropdowns to sorting-list.php
?>
<input type="hidden" name="category" value="<?php if(isset($_GET['category']) && strlen($_GET['category']) > 0){ echo $_GET['category']; } ?>" />
<ul class="category-sorting-list clearfix">
<li><label>Country <select name="Country"><option value="">All Countries</option><?php
foreach($country as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['Country']) && $_GET['Country'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Region <select name="Region"><option value="">All Regions</option><?php
foreach($region as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['Region']) && $_GET['Region'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>City <select name="City"><option value="">All Cities</option><?php
foreach($city as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['City']) && $_GET['City'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Term <select name="Term"><option value="">All Terms</option><?php
foreach($term as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['Term']) && $_GET['Term'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Keywords <input type="text" name="search" value="<?php if(isset($_GET['search'])) echo $_GET['search']; ?>"/></label></li>
<li class="search"><input type="submit" value="Search" /></li>
</ul>
</div>
<div class="advanced-sorting-row">
<div class="advanced-trigger">
<a class="advanced-but" role="button" data-toggle="collapse" href="#collapseAdvanced" aria-expanded="false" aria-controls="collapseAdvanced">
Advanced Search
</a>
</div>
<div class="collapse<?php if(count($apiparams) > 0 || (isset($_GET['programtype']) && strlen($_GET['programtype']) > 0)) echo ' in';?>" id="collapseAdvanced">
<div class="well">
<ul class="category-sorting-list clearfix">
<li><label>Language of Instruction <select name="languageofinstruction"><option value="">All Languages</option><?php
foreach($languageofinstruction['vals'] as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['languageofinstruction']) && $_GET['languageofinstruction'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Language courses offered in <select name="languageofferedin"><option value="">All Languages</option><?php
foreach($languageofferedin['vals'] as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['languageofferedin']) && $_GET['languageofferedin'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Prior language study required <select name="priorlanguage"><option value="">All Languages</option><?php
foreach($priorlanguage['vals'] as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['priorlanguage']) && $_GET['priorlanguage'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Type of program <select name="typeofprogram"><option value="">All Types</option><?php
foreach($typeofprogram['vals'] as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['typeofprogram']) && $_GET['typeofprogram'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Class status <select name="classstatus"><option value="">All Statuses</option><?php
foreach($classstatus['vals'] as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['classstatus']) && $_GET['classstatus'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Open to non-UConn students <select name="nonuconn"><option value="">All</option><?php
foreach($nonuconn['vals'] as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['nonuconn']) && $_GET['nonuconn'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Academic area <select name="academicarea"><option value="">All Areas</option><?php
foreach($academicarea['vals'] as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['academicarea']) && $_GET['academicarea'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Required GPA <select name="gpa"><option value="">All GPAs</option><?php
foreach($gpa['vals'] as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$value.'"'.((isset($_GET['gpa']) && $_GET['gpa'] == $value)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Program Type <select name="programtype"><option value="">All Types</option><?php
foreach($programtype as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['programtype']) && $_GET['programtype'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<?php /*<li><label>Partner Institution(s) <select name="partner"><option value="">All Institutions</option><?php
foreach($partner['vals'] as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['partner']) && $_GET['partner'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Program Sponsorship <select name="sponsorship"><option value="">All</option><?php
foreach($sponsorship['vals'] as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['sponsorship']) && $_GET['sponsorship'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>
<li><label>Financial Aid & Scholarships <select name="scholarships"><option value="">All</option><?php
foreach($scholarships['vals'] as $key=>$value){
if($value == 'Any') continue;
echo '<option value="'.$key.'"'.((isset($_GET['scholarships']) && $_GET['scholarships'] == $key)?' selected':'').'>'.$value.'</option>';
}
?></select></label></li>*/ ?>
<li class="search"><input type="submit" value="Search" /></li>
</ul>
</div>
</div>
</div>
</form>
</div>
</div>
</section>
<div class="col-sm-12">
<hr class="small-hr">
</div>
<!-- =========== Programs Content Columns ============ -->
<?php
$currentTerm = 'study-program';
?>
<?php
/*$currentTerm comes from the page template it was included from:
page-programs, page-pexchange, page-puconnin, page-party, page-ptemporary
*/
?>
<?php
$posts = array();
$programs = array();
if(($search_results && $search_results->RECORDCOUNT > 0)){
$args = array(
'post_type' => 'program',
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page' => -1
//'posts_per_page' => $num, incorrect way to get shows
);
if(isset($_GET['category']) && strlen($_GET['category']) > 0 && $_GET['category'] != 'all'){
$args['tax_query'] = array();
$category = explode('|', $_GET['category']);
foreach($category as $cat){
$args['tax_query'][] = array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => $cat
);
}
if(count($args['tax_query']) > 1) $args['tax_query']['relation'] = 'OR';
}
if(isset($_GET['search']) && strlen($_GET['search']) > 0){
$args['s'] = $_GET['search'];
}
$args['meta_query'] = array('relation' => 'OR');
if($search_results->RECORDCOUNT == 1){
$programs[$search_results->PROGRAM->PROGRAM_ID] = $search_results->PROGRAM;
if(strlen($apiargs) > 0){
$args['meta_query'][] = array(
'key' => 'apply-link',
'value' => 'http://app.studyabroad.uconn.edu/index.cfm?FuseAction=Programs.ViewProgram&Program_ID='.$search_results->PROGRAM->PROGRAM_ID,
'compare' => 'LIKE'
);
}
}
else{
foreach($search_results->PROGRAM as $program){
$programs[$program->PROGRAM_ID] = $program;
if(strlen($apiargs) > 0){
$args['meta_query'][] = array(
'key' => 'apply-link',
'value' => 'http://app.studyabroad.uconn.edu/index.cfm?FuseAction=Programs.ViewProgram&Program_ID='.$program->PROGRAM_ID,
'compare' => 'LIKE'
);
}
}
}
//print_r($args);
$posts = get_posts($args);
}
//print_r($programs)
?>
<section class="container">
<div class="tab-content">
<!-- Grid Start -->
<div class="tab-pane active" id="tab1">
<div class="program-container">
<ul class="program-grid">
<?php
if(!empty($posts)):
$groups = array();
foreach($programTabIDs as $key => $val){
$groups[$key] = array();
}
foreach($posts as $post){
foreach($programTabIDs as $key => $val){
foreach(get_the_category($post->ID) as $category){
if(strstr($key,$category->slug)){
$groups[$key][] = $post;
}
}
}
}
//print_r($groups);
//exit;
function display($posts = array()){
foreach($posts as $post){
?>
<?php
$tags = get_the_tags($post->ID);
$search = array(" ", "/");
$replace = array("", "-");?>
<li class="program-box<?php
if($tags){
$add_all_countries_tag = false;
$add_all_regions_tag = false;
$add_all_cities_tag = false;
$add_all_terms_tag = false;
foreach($tags as $tag) {
if(!$add_all_countries_tag && in_array($tag->name,$countries)) {
$add_all_countries_tag = true;
$tempTag = new stdClass();
$tempTag->name = 'allcountries';
array_push($tags, $tempTag);
}
if(!$add_all_regions_tag && in_array($tag->name,$regions)) {
$add_all_regions_tag = true;
$tempTag = new stdClass();
$tempTag->name = 'allregions';
array_push($tags, $tempTag);
}
if(!$add_all_cities_tag && in_array($tag->name,$cities)) {
$add_all_cities_tag = true;
$tempTag = new stdClass();
$tempTag->name = 'allcities';
array_push($tags, $tempTag);
}
if(!$add_all_terms_tag && in_array($tag->name,$terms)) {
$add_all_terms_tag = true;
$tempTag = new stdClass();
$tempTag->name = 'allterms';
array_push($tags, $tempTag);
}
}
foreach($tags as $tag){
echo ' '.strtolower(str_replace($search, $replace, $tag->name));
}
}
?>"> <a href="<?php echo get_the_permalink($post->ID); ?>">
<?php echo get_the_post_thumbnail($post->ID,'large');?>
<span class="program-name">
<?php echo get_the_title($post->ID); ?>
</span> </a> </li>
<?php }
} // end function display
if($_GET['category'] == 'all'){
foreach($groups as $key=>$group){
if($key == 'all') continue;
echo '<h2 class="sorting-header">'.$programTabIDs[$key].'</h2>';
display($group);
}
}
else{
echo '<h2 class="sorting-header">'.$programTabIDs[$_GET['category']].'</h2>';
display($posts);
}
?>
<?php else: ?>
<p>
<?php _e('Sorry, no exchange programs are listed.'); ?>
</p>
<?php endif; ?>
</ul>
</div>
</div>
<!-- Grid End -->
<!-- List Start -->
<div class="tab-pane" id="tab2">
<?php if(!empty($posts)):
function displayList($posts = array()){
global $programs;
?>
<ol class="program-list-view" >
<li class="program-list <?php if($tags){ foreach($tags as $tag){echo ' '.strtolower(str_replace($search, $replace, $tag->name));} } ?>">
<ul id="badge-list" class="program-headers">
<li class="list-img">
</li>
<li class="list-title">
Program
</li>
<li class="list-city">
City
</li>
<li class="list-country">
Country
</li>
<li class="list-region">
Region
</li>
</ul>
</li>
<?php
foreach($posts as $post){ ?>
<?php $tags = get_the_tags($post->ID);
$search = array(" ", "/");
$replace = array("", "-");
$terraid = get_post_meta( $post->ID, 'apply-link', true );
$terraid = explode('Program_ID=',$terraid);
$terraid = explode('&',$terraid[1]);
$terraid = $terraid[0];?>
<li class="program-list <?php if($tags){ foreach($tags as $tag){echo ' '.strtolower(str_replace($search, $replace, $tag->name));} } ?>">
<ul id="badge-list">
<a href="<?php echo get_the_permalink($post->ID) ?>">
<li class="list-img">
<?php echo get_the_post_thumbnail($post->ID, 'thumbnail');?>
</li>
<li class="list-title">
<?php echo get_the_title($post->ID); ?>
</li>
<li class="list-city">
<?php echo $programs[$terraid]->PROGRAM_CITY;//$key="program-city"; echo get_post_meta($post->ID, $key, true); ?>
</li>
<li class="list-country">
<?php echo $programs[$terraid]->PROGRAM_COUNTRY;//$key="program-country"; echo get_post_meta($post->ID, $key, true); ?>
</li>
<li class="list-region">
<?php echo $programs[$terraid]->PROGRAM_REGION;//$key="program-region"; echo get_post_meta($post->ID, $key, true); ?>
</li>
</a>
</ul>
</li>
<?php }
echo '</ol>';
} // end function displayList
if($_GET['category'] == 'all'){
foreach($groups as $key=>$group){
if($key == 'all') continue;
echo '<h2 class="sorting-header">'.$programTabIDs[$key].'</h2>';
displayList($group);
}
}
else{
echo '<h2 class="sorting-header">'.$programTabIDs[$_GET['category']].'</h2>';
displayList($posts);
}?>
<?php else: ?>
<p>
<?php _e('Sorry, no exchange programs are listed.'); ?>
</p>
<?php endif; ?>
</div>
<!-- List End -->
</div>
</section>
</div>
<?php get_footer(); ?>
You can’t perform that action at this time.