diff --git a/locallib.php b/locallib.php
index 4f51df1..40509b0 100644
--- a/locallib.php
+++ b/locallib.php
@@ -299,48 +299,47 @@ function echolink_ess_get_rest_section($essSection) {
function echolink_ess_get_rest_section_presentations($essSection) {
+ // Retrieve ESS Section Presentation XML
+ $sectionPresentationXML = callRestService(ESS_URL, ESS_CONSUMER_KEY, ESS_CONSUMER_SECRET, "sections/$essSection/presentations", "", "GET", array());
+
+ if($sectionPresentationXML != null || $sectionPresentationXML != '') {
+ $sectionPresentationJSON = convertXMLtoJSON($sectionPresentationXML, true, true);
+
+ if($sectionPresentationJSON['total-results'] == 0) {
+ return "
• No Echo360 Presentations are currently available.
";
+ } else if($sectionPresentationJSON['total-results'] == 1) {
+ if($sectionPresentationJSON['presentation']['status'] == "presentation-status-available") {
+ $id = $sectionPresentationJSON['presentation']['id'];
+ $time = date("Y-m-d H:i", strtotime($sectionPresentationJSON['presentation']['start-time']));
+ $title = $sectionPresentationJSON['presentation']['title'];
+
+ return "" .
+ "
";
+ } else {
+ return "
• No Echo360 Presentations are currently available.
";
+ }
+ } else {
+ $presentationData = array();
+ foreach($sectionPresentationJSON['presentation'] as $presentation) {
+ if($presentation['status'] == "presentation-status-available") {
+ $presentationData[$presentation['id']] = date("Y-m-d H:i", strtotime($presentation['start-time'])) . " ||--|| " . $presentation['title'];
+ }
+ }
+ arsort($presentationData);
- // Retrieve ESS Section Presentation XML
- $sectionPresentationXML = callRestService(ESS_URL, ESS_CONSUMER_KEY, ESS_CONSUMER_SECRET, "sections/$essSection/presentations", "", "GET", array());
-
- if($sectionPresentationXML != null || $sectionPresentationXML != '') {
- $sectionPresentationJSON = convertXMLtoJSON($sectionPresentationXML, true, true);
-
- if($sectionPresentationJSON['total-results'] == 0) {
- return "
• No Echo360 Presentations are currently available.
";
- } else if($sectionPresentationJSON['total-results'] == 1) {
- if($sectionPresentationJSON['presentation']['status'] == "presentation-status-available") {
- $id = $sectionPresentationJSON['presentation']['id'];
- $time = date("Y-m-d H:i", strtotime($sectionPresentationJSON['presentation']['start-time']));
- $title = $sectionPresentationJSON['presentation']['title'];
-
- return "
" .
- "
";
- } else {
- return "
• No Echo360 Presentations are currently available.
";
- }
- } else {
- $presentationData = array();
- foreach($sectionPresentationJSON['presentation'] as $presentation) {
- if($presentation['status'] == "presentation-status-available") {
- $presentationData[$presentation['id']] = date("Y-m-d H:i", strtotime($presentation['start-time'])) . " ||--|| " . $presentation['title'];
- }
- }
- asort($presentationData);
-
- $presentationHTML = "
";
- foreach($presentationData as $id => $title) {
- $_title = explode(" ||--|| ", $title);
- $presentationHTML .= "
";
+ $presentationHTML = "
";
+ foreach($presentationData as $id => $title) {
+ $_title = explode(" ||--|| ", $title);
+ $presentationHTML .= "
";
- return $presentationHTML;
- }
- } else {
- // Do nothing - error message would have already been displayed
+ return $presentationHTML;
}
+ } else {
+ // Do nothing - error message would have already been displayed
+ }
}// end of echolink_ess_get_rest_section_presentations function