From 9281cdb24e3892f3126538e10a4c435f7a885068 Mon Sep 17 00:00:00 2001 From: Dirk Riestere Date: Sun, 5 Mar 2017 18:34:10 +0100 Subject: Checkconnection prüft jetzt ob eine url existiert, array exeption sollten jetzt gefangen werden und die credentials werden gleich getestet --- .../coursebackend/coursebackend_davinci.inc.php | 2 +- .../coursebackend/coursebackend_hisinone.inc.php | 72 ++++++++++++---------- 2 files changed, 40 insertions(+), 34 deletions(-) (limited to 'modules-available/locationinfo/inc') diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php index f00b9193..6c6db23c 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php @@ -113,7 +113,7 @@ class Coursebackend_Davinci extends CourseBackend } } catch (Exception $e) { $this->error = true; - $this->errormsg = $e->getMessage(); + $this->errormsg = "url returns a wrong xml"; } return $schedules; diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php index cd479b9a..fdd3421e 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php @@ -297,7 +297,7 @@ class CourseBackend_HisInOne extends CourseBackend $timetable = json_encode($timetable); } catch (Exception $e) { $this->error = true; - $this->errormsg = $e->getMessage(); + $this->errormsg = "url returns a wrong xml"; } return $timetable; } @@ -333,41 +333,24 @@ class CourseBackend_HisInOne extends CourseBackend } $ttables = []; $currentWeek = $this->getCurrentWeekDates(); - foreach ($param as $room) { - $timetable = array(); - //Here I go over the soapresponse - foreach ($events as $event) { - $title = $event['hisunit']['hisplanelements']['hisplanelement'][0]['hisdefaulttext']; - foreach ($event as $subject) { - $units = $subject['hisplanelements']['hisplanelement']; - foreach ($units as $unit) { - $pdates = $unit['hisplannedDates']['hisplannedDate']; - //there seems to be a bug that gives more than one individualDates in plannedDate - //this construction catches it - if (array_key_exists('hisindividualDates', $pdates)) { - $dates = $pdates['hisindividualDates']['hisindividualDate']; - foreach ($dates as $date) { - $roomID = $date['hisroomId']; - $datum = $date['hisexecutiondate']; - if (intval($roomID) == $room && in_array($datum, $currentWeek)) { - $startTime = $date['hisstarttime']; - $endTime = $date['hisendtime']; - $json = array( - 'title' => $title, - 'start' => $datum . " " . $startTime, - 'end' => $datum . " " . $endTime - ); - array_push($timetable, $json); - } - } - } else { - foreach ($pdates as $dates2) { - $dates = $dates2['hisindividualDates']['hisindividualDate']; + try { + foreach ($param as $room) { + $timetable = array(); + //Here I go over the soapresponse + foreach ($events as $event) { + $title = $event['hisunit']['hisplanelements']['hisplanelement'][0]['hisdefaulttext']; + foreach ($event as $subject) { + $units = $subject['hisplanelements']['hisplanelement']; + foreach ($units as $unit) { + $pdates = $unit['hisplannedDates']['hisplannedDate']; + //there seems to be a bug that gives more than one individualDates in plannedDate + //this construction catches it + if (array_key_exists('hisindividualDates', $pdates)) { + $dates = $pdates['hisindividualDates']['hisindividualDate']; foreach ($dates as $date) { $roomID = $date['hisroomId']; $datum = $date['hisexecutiondate']; if (intval($roomID) == $room && in_array($datum, $currentWeek)) { - $startTime = $date['hisstarttime']; $endTime = $date['hisendtime']; $json = array( @@ -378,12 +361,35 @@ class CourseBackend_HisInOne extends CourseBackend array_push($timetable, $json); } } + } else { + foreach ($pdates as $dates2) { + $dates = $dates2['hisindividualDates']['hisindividualDate']; + foreach ($dates as $date) { + $roomID = $date['hisroomId']; + $datum = $date['hisexecutiondate']; + if (intval($roomID) == $room && in_array($datum, $currentWeek)) { + + $startTime = $date['hisstarttime']; + $endTime = $date['hisendtime']; + $json = array( + 'title' => $title, + 'start' => $datum . " " . $startTime, + 'end' => $datum . " " . $endTime + ); + array_push($timetable, $json); + } + } + } } } } } + $ttables[$room] = json_encode($timetable); } - $ttables[$room] = json_encode($timetable); + } + catch (Exception $e){ + $this->error = true; + $this->errormsg = "url returns a wrong xml"; } return $ttables; } -- cgit v1.2.3-55-g7522