From 028d4d2b07c50f2854d3cfc06f05855fa358ead3 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 19 Jan 2021 14:59:13 +0100 Subject: [locationinfo] Add generic ical backend Closes #3824 --- .../inc/coursebackend/coursebackend_ical.inc.php | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 modules-available/locationinfo/inc/coursebackend/coursebackend_ical.inc.php (limited to 'modules-available/locationinfo/inc/coursebackend/coursebackend_ical.inc.php') diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_ical.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_ical.inc.php new file mode 100644 index 00000000..98dca1cb --- /dev/null +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_ical.inc.php @@ -0,0 +1,61 @@ +addError("No url is given", true); + return false; + } + + $this->init($data['baseUrl'], $data['verifyCert'], $data['verifyHostname'], $data['authMethod'], + $data['user'], $data['pass']); + $this->testId = $data['testId']; + + return true; + } + + public function getCredentialDefinitions() + { + return [ + new BackendProperty('baseUrl', 'string'), + new BackendProperty('verifyCert', 'bool', true), + new BackendProperty('verifyHostname', 'bool', true), + new BackendProperty('testId', 'string'), + new BackendProperty('authMethod', ['NONE', 'BASIC', 'DIGEST', 'GSSNEGOTIATE', 'NTLM'], 'NONE'), + new BackendProperty('user', 'string'), + new BackendProperty('pass', 'string'), + ]; + } + + public function checkConnection() + { + if (!$this->isOK()) + return false; + if (empty($this->testId)) + return true; + return ($this->downloadIcal($this->testId) !== null); + } + + public function getCacheTime() + { + return 30 * 60; + } + + public function getRefreshTime() + { + return 60 * 60; + } + + + public function getDisplayName() + { + return "iCal"; + } + +} -- cgit v1.2.3-55-g7522