From 515d2e39258aac7c4458cc695735ff728a9b3aad Mon Sep 17 00:00:00 2001 From: Roy Date: Mon, 17 Apr 2017 12:10:42 -0400 Subject: [PATCH] Initial commit of UC Abroad --- abroad.js | 17 + template-class.php | 221 +++++++++ templates/archive-programs.php | 615 +++++++++++++++++++++++++ templates/page-programs.php | 215 +++++++++ templates/programs-content-columns.php | 145 ++++++ templates/programs-selection-menu.php | 52 +++ templates/single-program.php | 263 +++++++++++ templates/sorting-list.php | 94 ++++ uc-abroad.php | 246 ++++++++++ 9 files changed, 1868 insertions(+) create mode 100644 abroad.js create mode 100644 template-class.php create mode 100644 templates/archive-programs.php create mode 100644 templates/page-programs.php create mode 100644 templates/programs-content-columns.php create mode 100644 templates/programs-selection-menu.php create mode 100644 templates/single-program.php create mode 100644 templates/sorting-list.php create mode 100644 uc-abroad.php diff --git a/abroad.js b/abroad.js new file mode 100644 index 0000000..6ad9711 --- /dev/null +++ b/abroad.js @@ -0,0 +1,17 @@ +jQuery(document).ready(function($){ + $( window ).load(function() { + /*$('.clearsubmit').click(function(){ + window.location = window.location.href.split('?')[0]; + });*/ + var centerText = function(){ + $('.text-overlay').each(function(){ + $(this).find('.widget_sp_image-description').css('top',Math.floor(($(this).find('img').height()-$(this).find('.widget_sp_image-description').height())/2).toString()+'px'); + }); + $('.single-program').find('#content > .container').first().removeClass('container'); + } + centerText(); + $(window).on('resize', function(){ + centerText(); + }); + }); +}); \ No newline at end of file diff --git a/template-class.php b/template-class.php new file mode 100644 index 0000000..d24828b --- /dev/null +++ b/template-class.php @@ -0,0 +1,221 @@ +templates = array(); + $this->plugin_locale = 'pte'; + + // Grab the translations for the plugin + add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); + + // Add a filter to the page attributes metabox to inject our template into the page template cache. + add_filter('page_attributes_dropdown_pages_args', array( $this, 'register_project_templates' ) ); + + // Add a filter to the save post in order to inject out template into the page cache + add_filter('wp_insert_post_data', array( $this, 'register_project_templates' ) ); + + // Add a filter to the template include in order to determine if the page has our template assigned and return it's path + add_filter('template_include', array( $this, 'view_project_template') ); + + // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively. + register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); + + // Add your templates to this array. + $this->templates = array( + 'page-programs.php' => __( 'Programs New', $this->plugin_slug ), + //'page-sample2.php' => __( 'Sample2', $this->plugin_slug ), + //'page-sample3.php' => __( 'Sample3', $this->plugin_slug ), + ); + + // adding support for theme templates to be merged and shown in dropdown + $templates = wp_get_theme()->get_page_templates(); + $templates = array_merge( $templates, $this->templates ); + + } // end constructor + + /** + * Load the plugin text domain for translation. + * + * @since 1.0.0 + */ + public function load_plugin_textdomain() { + + $domain = $this->plugin_slug; + $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); + + load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' ); + load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/languages/' ); + + } // end load_plugin_textdomain + + /** + * Adds our template to the pages cache in order to trick WordPress + * into thinking the template file exists where it doens't really exist. + * + * @param array $atts The attributes for the page attributes dropdown + * @return array $atts The attributes for the page attributes dropdown + * @verison 1.0.0 + * @since 1.0.0 + */ + public function register_project_templates( $atts ) { + + // Create the key used for the themes cache + $cache_key = 'page_templates-' . md5( get_theme_root() . '/' . get_stylesheet() ); + + // Retrieve the cache list. If it doesn't exist, or it's empty prepare an array + $templates = wp_cache_get( $cache_key, 'themes' ); + if ( empty( $templates ) ) { + $templates = array(); + } // end if + + // Since we've updated the cache, we need to delete the old cache + wp_cache_delete( $cache_key , 'themes'); + + // Now add our template to the list of templates by merging our templates + // with the existing templates array from the cache. + $templates = array_merge( $templates, $this->templates ); + + // Add the modified cache to allow WordPress to pick it up for listing + // available templates + wp_cache_add( $cache_key, $templates, 'themes', 1800 ); + + return $atts; + + } // end register_project_templates + + /** + * Checks if the template is assigned to the page + * + * @version 1.0.0 + * @since 1.0.0 + */ + public function view_project_template( $template ) { + + global $post; + + // If no posts found, return to + // avoid "Trying to get property of non-object" error + if ( !isset( $post ) ) return $template; + + if ( ! isset( $this->templates[ get_post_meta( $post->ID, '_wp_page_template', true ) ] ) ) { + return $template; + } // end if + + $file = plugin_dir_path( __FILE__ ) . 'templates/' . get_post_meta( $post->ID, '_wp_page_template', true ); + + // Just to be safe, we check if the file exist first + if( file_exists( $file ) ) { + return $file; + } // end if + + return $template; + + } // end view_project_template + + /*--------------------------------------------* + * deactivate the plugin + *---------------------------------------------*/ + static function deactivate( $network_wide ) { + foreach($this as $value) { + page-template-example::delete_template( $value ); + } + + } // end deactivate + + /*--------------------------------------------* + * Delete Templates from Theme + *---------------------------------------------*/ + public function delete_template( $filename ){ + $theme_path = get_template_directory(); + $template_path = $theme_path . '/' . $filename; + if( file_exists( $template_path ) ) { + unlink( $template_path ); + } + + // we should probably delete the old cache + wp_cache_delete( $cache_key , 'themes'); + } + + /** + * Retrieves and returns the slug of this plugin. This function should be called on an instance + * of the plugin outside of this class. + * + * @return string The plugin's slug used in the locale. + * @version 1.0.0 + * @since 1.0.0 + */ + public function get_locale() { + return $this->plugin_slug; + } // end get_locale + +} // end class diff --git a/templates/archive-programs.php b/templates/archive-programs.php new file mode 100644 index 0000000..81550b6 --- /dev/null +++ b/templates/archive-programs.php @@ -0,0 +1,615 @@ + + 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']; +} +//print_r($apiparams); +//if(strlen($apiargs) > 0){ + if(count($apiparams) > 0){ + $apiargs .= '¶ms='.implode('|', $apiparams); + } + //echo 'here'; + $response = wp_remote_get( $api.$apiargs ); + if( is_array($response) && isset($response['body']) && strlen($response['body']) > 0 ) { + $search_results = json_decode($response['body']); + + } + //print_r($search_results); +//} +?> + + +
+ + 'UConn Faculty-Led', + 'exchange-partner' => 'Exchange', + //'ct-bw-exchange' => 'CT - BW Exchange', + '3rd-party-direct-enroll' => '3rd Party/Direct Enroll', + 'non-uconn' => 'Open to Non-UConn Students', + '' => 'All Programs' +); +?> + +
+ + +
+
+ +
+ + $title ){ + echo ''.$title.''; + } + ?> + + +
+ +
+
+
+ + +
    +
  • +
  • +
  • +
  • +
  • + +
+ +
+ +
+ + +
+
+
    +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • + +
  • +
  • */ ?> + +
+
+
+ +
+
+
+ +
+ +
+
+
+
+ + + + + +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){ + $args['tax_query'] = array( + array( + 'taxonomy' => 'category', + 'field' => 'slug', + 'terms' => $_GET['category'] + )); + } + 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) +?> +
+ +
+
+ diff --git a/templates/page-programs.php b/templates/page-programs.php new file mode 100644 index 0000000..331d7f7 --- /dev/null +++ b/templates/page-programs.php @@ -0,0 +1,215 @@ + + + +
+ +ID => 'UConn Faculty-Led', + get_page_by_title('Exchange Programs')->ID => 'Exchange', + get_page_by_title('CT - BW Exchange')->ID => 'CT - BW Exchange', + get_page_by_title('3rd Party / Direct Enroll')->ID => '3rd Party/Direct Enroll', + get_page_by_title('Open to Non-UConn Students')->ID => 'Open to Non-UConn Students', + get_page_by_title('PROGRAMS')->ID => 'All Programs' +); +?> + +
+ + +
+
+ +
+ + + !!!!!!!!!!!!!!!!!!!
+
+ +
+
+ + + +
+ + + +
+
+ +
+
+
    + 'program', + 'orderby' => 'title', + 'order' => 'ASC', + 'tax_query' => array( + array( + 'taxonomy' => 'category', + 'field' => 'slug', + 'terms' => $currentTerm + )), + 'posts_per_page' => -1 + //'posts_per_page' => $num, incorrect way to get shows + ); + + $posts = get_posts($args); + ?> + + +
  • + + + +
  • + + +

    + +

    + +
+
+
+ + +
+
    + 'program', + 'orderby' => 'title', + 'order' => 'ASC', + 'tax_query' => array( + array( + 'taxonomy' => 'category', + 'field' => 'slug', + 'terms' => $currentTerm + )), + 'posts_per_page' => -1 + //'posts_per_page' => $num, incorrect way to get shows + ); + + $posts = get_posts($args); + //var_dump($posts); + ?> + + +
  1. + +
  2. + + +

    + +

    + +
+
+ +
+
+ + diff --git a/templates/programs-content-columns.php b/templates/programs-content-columns.php new file mode 100644 index 0000000..832d7a1 --- /dev/null +++ b/templates/programs-content-columns.php @@ -0,0 +1,145 @@ + +
+
+ +
+
+
    + 'program', + 'orderby' => 'title', + 'order' => 'ASC', + 'tax_query' => array( + array( + 'taxonomy' => 'category', + 'field' => 'slug', + 'terms' => $currentTerm + )), + 'posts_per_page' => -1 + //'posts_per_page' => $num, incorrect way to get shows + ); + + $posts = get_posts($args); + ?> + + +
  • + + + +
  • + + +

    + +

    + +
+
+
+ + +
+
    + 'program', + 'orderby' => 'title', + 'order' => 'ASC', + 'tax_query' => array( + array( + 'taxonomy' => 'category', + 'field' => 'slug', + 'terms' => $currentTerm + )), + 'posts_per_page' => -1 + //'posts_per_page' => $num, incorrect way to get shows + ); + + $posts = get_posts($args); + //var_dump($posts); + ?> + + +
  1. + +
  2. + + +

    + +

    + +
+
+ +
+
\ No newline at end of file diff --git a/templates/programs-selection-menu.php b/templates/programs-selection-menu.php new file mode 100644 index 0000000..81a9dbd --- /dev/null +++ b/templates/programs-selection-menu.php @@ -0,0 +1,52 @@ +ID => 'UConn Faculty-Led', + get_page_by_title('Exchange Programs')->ID => 'Exchange', + get_page_by_title('CT - BW Exchange')->ID => 'CT - BW Exchange', + get_page_by_title('3rd Party / Direct Enroll')->ID => '3rd Party/Direct Enroll', + get_page_by_title('Open to Non-UConn Students')->ID => 'Open to Non-UConn Students', + get_page_by_title('PROGRAMS')->ID => 'All Programs' +); +?> + +
+ + +
+
+ +
+ + +
+
+ +
+ +
diff --git a/templates/single-program.php b/templates/single-program.php new file mode 100644 index 0000000..93beaac --- /dev/null +++ b/templates/single-program.php @@ -0,0 +1,263 @@ + 0){ + $response = wp_remote_get( $api ); + //print_r($response['response']); + if( is_array($response) && isset($response['body']) && strlen($response['body']) > 0 ) { + $terradata = json_decode($response['body']); + } + else{ + $terradata = false; + } +} +else{ + $terradata = false; +} +//print_r($terradata); +get_header(); ?> + + +
+ +
+ +
+
+
+
+
+ + + + + +
> +
+

+ +

+
+ + +
+ + +
+
+ +
+
+ +
+
+ +
+
+ + Budget Sheets: DETAILS->BUDGETSHEETS->BUDGET->BUDGET_TERM)) $budgetsheets[] = ''.$terradata->DETAILS->BUDGETSHEETS->BUDGET->BUDGET_TITLE.''; + else{ + foreach($terradata->DETAILS->BUDGETSHEETS->BUDGET as $budgetsheet){ + $budgetsheets[] = ''.$budgetsheet->BUDGET_TITLE.''; + } + } + echo implode(', ', $budgetsheets); + ?> +
+
+ The Details

+
    +
  • Location: DETAILS->LOCATIONS->LOCATION->PROGRAM_CITY.', '.$terradata->DETAILS->LOCATIONS->LOCATION->PROGRAM_COUNTRY; ?>
  • +
  • Terms: DETAILS->TERMS->TERM->PROGRAM_TERM)) $terms[] = $terradata->DETAILS->TERMS->TERM->PROGRAM_TERM; + else{ + foreach($terradata->DETAILS->TERMS->TERM as $term){ + $terms[] = $term->PROGRAM_TERM; + } + } + echo implode(', ', $terms); + ?>
  • +
  • Homepage: DETAILS->PROGRAM_HOME_PAGE) && strlen($terradata->DETAILS->PROGRAM_HOME_PAGE) > 0) echo 'Click to visit'; ?>
  • +
+

Dates / Deadlines:

+
+ + + + + + + + + + + + + DETAILS->DATES->DATE->APP_TERM)) { + ?> + + + + + + + + + DETAILS->DATES->DATE as $date){ + ?> + + + + + + + + + + +
TermYearApp DeadlineDecision DateStart DateEnd Date
DETAILS->DATES->DATE->APP_TERM; ?>DETAILS->DATES->DATE->APP_YEAR; ?>DETAILS->DATES->DATE->OVERRIDE)); ?>DETAILS->DATES->DATE->OVERRIDE2)); ?>DETAILS->DATES->DATE->TERM_START) > 0?date('m/d/Y',strtotime($terradata->DETAILS->DATES->DATE->TERM_START)):'TBD'; ?>DETAILS->DATES->DATE->TERM_END) > 0?date('m/d/Y',strtotime($terradata->DETAILS->DATES->DATE->TERM_END)):'TBD'; ?>
APP_TERM; ?>APP_YEAR; ?>OVERRIDE)); ?>OVERRIDE2)); ?>TERM_START) > 0?date('m/d/Y',strtotime($date->TERM_START)):'TBD'; ?>TERM_END) > 0?date('m/d/Y',strtotime($date->TERM_END)):'TBD'; ?>
+
+ DETAILS->PARAMETERS->PARAMETER as $parameters){ + if($parameters->PROGRAM_PARAM_TEXT == 'Class status'){ + $classstatuses[] = $parameters->PARAM_VALUE; + } + elseif($parameters->PROGRAM_PARAM_TEXT == 'Academic area'){ + $academicareas[] = $parameters->PARAM_VALUE; + } + elseif($parameters->PROGRAM_PARAM_TEXT == 'Language of instruction'){ + $language = $parameters->PARAM_VALUE; + } + elseif($parameters->PROGRAM_PARAM_TEXT == 'Prior language study required'){ + $priorlanguage = $parameters->PARAM_VALUE; + } + elseif($parameters->PROGRAM_PARAM_TEXT == 'Open to non-UConn students'){ + $nonuconn = $parameters->PARAM_VALUE; + } + elseif($parameters->PROGRAM_PARAM_TEXT == 'Required GPA'){ + $requiredgpa = $parameters->PARAM_VALUE; + } + } + ?> +

Fact Sheet:

+
+ + + + + + + + + + + + + + + + + + + + + +
Class status:Academic area:
Language of instruction:Prior language study required:
Open to non-UConn students:Required GPA:
+
+
+
+
+ + +
+ + + +
+ + + + + + + + + + + +
+ + + + + + +
+
+ + +
+
+ \ No newline at end of file diff --git a/templates/sorting-list.php b/templates/sorting-list.php new file mode 100644 index 0000000..f481416 --- /dev/null +++ b/templates/sorting-list.php @@ -0,0 +1,94 @@ + + + + \ No newline at end of file diff --git a/uc-abroad.php b/uc-abroad.php new file mode 100644 index 0000000..ec2dd26 --- /dev/null +++ b/uc-abroad.php @@ -0,0 +1,246 @@ + _x( 'Programs', 'Post Type General Name', 'text_domain' ), + 'singular_name' => _x( 'Program', 'Post Type Singular Name', 'text_domain' ), + 'menu_name' => __( 'Programs', 'text_domain' ), + 'parent_item_colon' => __( 'Parent Program:', 'text_domain' ), + 'all_items' => __( 'All Programs', 'text_domain' ), + 'view_item' => __( 'View Program', 'text_domain' ), + 'add_new_item' => __( 'Add New Program', 'text_domain' ), + 'add_new' => __( 'New Program', 'text_domain' ), + 'edit_item' => __( 'Edit Program', 'text_domain' ), + 'update_item' => __( 'Update Program', 'text_domain' ), + 'search_items' => __( 'Search Program', 'text_domain' ), + 'not_found' => __( 'No programs found', 'text_domain' ), + 'not_found_in_trash' => __( 'No programs found in Trash', 'text_domain' ), + ); + $args = array( + 'label' => __( 'program', 'text_domain' ), + 'description' => __( 'Program Post Type', 'text_domain' ), + 'labels' => $labels, + 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'custom-fields', 'page-attributes', 'post-formats', 'categories' ), + 'hierarchical' => false, + 'public' => true, + 'show_ui' => true, + 'show_in_menu' => true, + 'show_in_nav_menus' => true, + 'show_in_admin_bar' => true, + 'menu_position' => 5, + 'menu_icon' => '', + 'can_export' => true, + 'has_archive' => true, + 'exclude_from_search' => false, + 'publicly_queryable' => true, + 'query_var' => 'program', + 'capability_type' => 'page', + 'taxonomies' => array('category', 'post_tag'), + 'rewrite' => true + ); + register_post_type( 'program', $args ); + flush_rewrite_rules(); + + } // create_post_type +} // Class + +// +// Create a new instance of UC Abroad +// + +$uc_abroad = new UC_Abroad(); + +//=============================================================================== +// Contract Archive filter - show a list of contracts on this page +//=============================================================================== +/* +function get_custom_post_type_template( $archive_template ) { + + if ( is_post_type_archive( 'uc_contract' ) ) { + $archive_template = dirname( __FILE__ ) . '/templates/archive.php'; + } + return $archive_template; +} +add_filter( 'archive_template', 'get_custom_post_type_template' ); + +//=============================================================================== +// Single contract filter - Not currently used. +//=============================================================================== +*/ +function program_page_template( $template ) { + if ( is_singular( $slug = 'program' ) ) { + //$new_template = locate_template( array( 'single.php' ) ); + $new_template = dirname( __FILE__ ) . '/templates/single-program.php'; + if ( $new_template != '' ) { + return $new_template ; + } + } + return $template; +} +add_filter( 'template_include', 'program_page_template', $priority = 99 ); +function program_archive_page_template( $archive_template ) { + if ( is_post_type_archive( 'program' ) ) { + $archive_template = dirname( __FILE__ ) . '/templates/archive-programs.php'; + } + return $archive_template; +} +add_filter( 'archive_template', 'program_archive_page_template' ); + + +function abroad_scripts() { + wp_enqueue_script( 'abroad-js', plugin_dir_url( __FILE__ ) . '/abroad.js', array( 'jquery' )); + +} + +add_action( 'wp_enqueue_scripts', 'abroad_scripts' ); +//=============================================================================== + + +if( function_exists('acf_add_local_field_group') ): + +acf_add_local_field_group(array ( + 'key' => 'group_57b2138783bf4', + 'title' => 'Additional Content', + 'fields' => array ( + array ( + 'key' => 'field_57b2141a96872', + 'label' => 'Apply Link', + 'name' => 'apply-link', + 'type' => 'text', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => 0, + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => '', + 'placeholder' => '', + 'prepend' => '', + 'append' => '', + 'maxlength' => '', + 'readonly' => 0, + 'disabled' => 0, + ), + array ( + 'key' => 'field_57b2147c32970', + 'label' => 'Academics', + 'name' => 'academics', + 'type' => 'wysiwyg', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => 0, + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => '', + 'tabs' => 'all', + 'toolbar' => 'full', + 'media_upload' => 1, + ), + array ( + 'key' => 'field_57b2148232971', + 'label' => 'Experience', + 'name' => 'experience', + 'type' => 'wysiwyg', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => 0, + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => '', + 'tabs' => 'all', + 'toolbar' => 'full', + 'media_upload' => 1, + ), + array ( + 'key' => 'field_57b2148e32972', + 'label' => 'Finances', + 'name' => 'finances', + 'type' => 'wysiwyg', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => 0, + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => '', + 'tabs' => 'all', + 'toolbar' => 'full', + 'media_upload' => 1, + ), + ), + 'location' => array ( + array ( + array ( + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'program', + ), + ), + ), + 'menu_order' => 0, + 'position' => 'normal', + 'style' => 'default', + 'label_placement' => 'top', + 'instruction_placement' => 'label', + 'hide_on_screen' => '', + 'active' => 1, + 'description' => '', +)); + +endif; +?> \ No newline at end of file