Created
September 9, 2019 18:25
-
-
Save ksascomm/0f71d844107d6099df20d2d5666d1819 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: SIS Courses (Graduate) | |
*/ | |
get_header(); ?> | |
<?php get_template_part( 'template-parts/featured-image' ); ?> | |
<?php | |
// Load Zebra Curl | |
//require_once TEMPLATEPATH . '/library/Zebra_cURL.php'; | |
// the callback function to be executed for each and every | |
// request, as soon as a request finishes | |
// the callback function receives as argument an object with 4 properties | |
// (info, header, body and response) | |
function mycallback($result) { | |
// everything went well at cURL level | |
if ($result->response[1] == CURLE_OK) { | |
// if server responded with code 200 (meaning that everything went well) | |
// see http://httpstatus.es/ for a list of possible response codes | |
if ($result->info['http_code'] == 200) { | |
// see all the returned data | |
print_r('<pre>'); | |
print_r($result); | |
// show the server's response code | |
} else die('Server responded with code ' . $result->info['http_code']); | |
// something went wrong | |
// ($result still contains all data that could be gathered) | |
} else die('cURL responded with: ' . $result->response[0]); | |
} | |
// include the Zebra_cURL library | |
require TEMPLATEPATH . '/library/Zebra_cURL.php'; | |
// instantiate the Zebra_cURL object | |
$curl = new Zebra_cURL(); | |
// cache results in the "cache" folder and for 3600 seconds (one hour) | |
//$curl->cache('cache', 3600); | |
// let's fetch the RSS feeds of some popular websites | |
// execute the "mycallback" function for each request, as soon as it finishes | |
$curl->get(array( | |
'https://sis.jhu.edu/api/classes/AS27060501/Fall%202019?key=DZkN4QOJGaDKVg6Du1911u45d4TJNp6I', | |
), 'mycallback') | |
?> | |
<div class="main-container" id="page"> | |
<div class="main-grid"> | |
<main class="main-content"> | |
<?php | |
while ( have_posts() ) : the_post(); ?> | |
<?php get_template_part( 'template-parts/content', 'page' ); ?> | |
<?php endwhile; ?> | |
<ul class="tabs" data-tabs id="courses-tabs"> | |
<li class="tabs-title is-active"><a href="#Fall">Fall 2019</a></li> | |
</ul> | |
<div class="tabs-content course-listings" data-tabs-content="courses-tabs"> | |
<div class="tabs-panel is-active" id="Fall"> | |
<p class="show-for-sr" id="tblDescFall">Column one has the course number and section. Other columns show the course title, days offered, instructor's name, room number, if the course is cross-referenced with another program, and a option to view additional course information in a pop-up window.</p> | |
<table aria-describedby="tblDescFall" class="course-table"> | |
<thead> | |
<tr> | |
<th>Course # (Section)</th> | |
<th>Title</th> | |
<th class="show-for-medium">Day/Times</th> | |
<th class="show-for-large">Instructor</th> | |
<th class="show-for-large">Room</th> | |
<th>Info</th> | |
</tr> | |
</thead> | |
<tbody> | |
<?php //$course_curl->get($courses_call_fall, 'parse_courses'); ?> | |
</tbody> | |
</table> | |
</div> | |
</div> | |
</main> | |
<?php get_sidebar(); ?> | |
</div> | |
</div> | |
<?php | |
get_footer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment