addError("No url is given", true); return false; } $this->init($this->mangleProperty('baseUrl', $data['baseUrl']), $data['verifyCert'], $data['verifyHostname']); return true; } public function getCredentialDefinitions() { return [ new BackendProperty('baseUrl', 'string'), new BackendProperty('verifyCert', 'bool', true), new BackendProperty('verifyHostname', 'bool', true) ]; } public function mangleProperty($prop, $value) { if ($prop === 'baseUrl') { // Update form SOAP to iCal url if (preg_match(',^(http.*?)/qisserver,', $value, $out)) { $value = $out[1] . '/qisserver/pages/cm/exa/timetable/roomScheduleCalendarExport.faces?roomId=%ID%'; } elseif (preg_match(',(.*[/=])\d*$', $value, $out)) { $value = $out[1] . '%ID%'; } elseif (substr_count($value, '/') <= 3) { if (substr($value, -1) !== '/') { $value .= '/'; } $value .= 'qisserver/pages/cm/exa/timetable/roomScheduleCalendarExport.faces?roomId=%ID%'; } } return $value; } public function checkConnection() { if (!$this->isOK()) return false; // Unfortunately HisInOne returns an internal server error if you pass an invalid roomId. // So we just try a bunch and see if anything works. Even if this fails, using // the backend should work, given the URL is actually correct. foreach ([60, 100, 5, 10, 50, 110, 200, 210, 250, 300, 333, 500, 1000, 2000] as $roomId) { if ($this->downloadIcal($roomId) !== null) return true; } return false; } public function getCacheTime() { return 30 * 60; } public function getRefreshTime() { return 60 * 60; } public function getDisplayName() { return "HisInOne"; } }