diff options
author | Jannik Schönartz | 2017-03-01 15:39:01 +0100 |
---|---|---|
committer | Jannik Schönartz | 2017-03-01 15:39:01 +0100 |
commit | 6e2f73259c80a31325cd9ce5e22ba990daa2b9bb (patch) | |
tree | 524fa447f584b399015136a6d481f859744c8a4e /modules-available/locationinfo | |
parent | Bugfixes (diff) | |
download | slx-admin-6e2f73259c80a31325cd9ce5e22ba990daa2b9bb.tar.gz slx-admin-6e2f73259c80a31325cd9ce5e22ba990daa2b9bb.tar.xz slx-admin-6e2f73259c80a31325cd9ce5e22ba990daa2b9bb.zip |
API: Fixed Calendar function.
Diffstat (limited to 'modules-available/locationinfo')
3 files changed, 13 insertions, 6 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php index e04e7e65..1b4f9d59 100644 --- a/modules-available/locationinfo/api.inc.php +++ b/modules-available/locationinfo/api.inc.php @@ -90,8 +90,16 @@ function getCalendar($idList) { foreach ($serverList as $server) { $serverInstance = CourseBackend::getInstance($server['type']); $serverInstance->setCredentials(json_encode($server['credentials']), $server['serverurl'], $server['serverid']); - $calendarFromBackend = json_decode($serverInstance->fetchSchedule($server['idList']), true); - $resultarray = array_merge($resultarray, $calendarFromBackend); + $calendarFromBackend = $serverInstance->fetchSchedule($server['idList']); + + $formattedArray = array(); + foreach ($calendarFromBackend as $key => $value) { + $y['id'] = $key; + $y['calendar'] = $value; + $formattedArray[] = $y; + } + + $resultarray = array_merge($resultarray, $formattedArray); } echo json_encode($resultarray, true); diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php index 64cf29fd..7d05b037 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php @@ -39,11 +39,11 @@ class Coursebackend_Dummy extends CourseBackend { $calarray = array(); $calarray[] = $calendar; $x['calendar'] = $calarray; - $a[] = $x; + $a[$id] = $calarray; } - return json_encode($a, true); + return $a; } } diff --git a/modules-available/locationinfo/templates/location-info.html b/modules-available/locationinfo/templates/location-info.html index 98a61571..c7db6c66 100644 --- a/modules-available/locationinfo/templates/location-info.html +++ b/modules-available/locationinfo/templates/location-info.html @@ -37,7 +37,7 @@ </td> <td align="center" id="credentials-{{id}}" onclick="event.cancelBubble = true;"> - <button class="btn btn-sm btn-primary" type="button" title="credentials" onclick="loadCredentialModal({{id}},'{{name}}');" id="credentials">{{lang_credentials}}</button> + <button class="btn btn-sm btn-primary" id="credentials-btn-{{id}}" type="button" title="credentials" onclick="loadCredentialModal({{id}},'{{name}}');" id="credentials">{{lang_credentials}}</button> </td> <td align="center" id="btncell-{{id}}"> <button class="btn btn-sm btn-primary table-edit" title="{{lang_edit}}" onclick="editButtonClick({{id}});" id="edit">✎</button> @@ -56,7 +56,6 @@ </table> <br> <button class="btn btn-success btn-sm" id="addServerButton" onclick="addNewServerRow()"><span class="glyphicon glyphicon-plus-sign"> {{lang_addServer}}</span></button> - <!--<a class="btn btn-danger btn-sm" onclick=>{{lang_deleteAll}}</a>--> <br><br><br> </div> |