From b8f4c1aabcb3f2f5493b60215c18eba894b11585 Mon Sep 17 00:00:00 2001 From: Jephte Abijuru <57417057+jeph864@users.noreply.github.com> Date: Wed, 26 Apr 2023 16:04:50 +0200 Subject: [PATCH 01/13] session management: fix bugs (#47) * enable proxy access * temporary fix for server errors * fix insert statement & enable deleting db tables --- classes/class.ilBigBlueButtonConfigGUI.php | 2 +- classes/class.ilBigBlueButtonPlugin.php | 4 ++-- classes/class.ilBigBlueButtonProtocol.php | 11 +++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/classes/class.ilBigBlueButtonConfigGUI.php b/classes/class.ilBigBlueButtonConfigGUI.php index 231fef4..bbe7fd3 100755 --- a/classes/class.ilBigBlueButtonConfigGUI.php +++ b/classes/class.ilBigBlueButtonConfigGUI.php @@ -180,7 +180,7 @@ public function save() $num = $ilDB->numRows($result); if ($num == 0) { $ilDB->manipulate("INSERT INTO rep_robj_xbbb_conf ". - "(id, svrpublicurl, svrsalt, choose_recording) VALUES (". + "(id, svrpublicurl, svrsalt, choose_recording, guestglobalchoose, sess_enable_max_concurrent, enable_userlimit, sess_max_concurrent, sess_msg_concurrent ) VALUES (". $ilDB->quote(1, "integer").",". // id $ilDB->quote($setPublicURL, "text").",". //public url $ilDB->quote($setSalt, "text").",". //salt diff --git a/classes/class.ilBigBlueButtonPlugin.php b/classes/class.ilBigBlueButtonPlugin.php index 29a84ae..47a1251 100755 --- a/classes/class.ilBigBlueButtonPlugin.php +++ b/classes/class.ilBigBlueButtonPlugin.php @@ -18,11 +18,11 @@ protected function uninstallCustom() { global $ilDB; // removes plugin tables if they exist - /* if($ilDB->tableExists('rep_robj_xbbb_data')) + if($ilDB->tableExists('rep_robj_xbbb_data')) $ilDB->dropTable('rep_robj_xbbb_data'); if($ilDB->tableExists('rep_robj_xbbb_conf')) - $ilDB->dropTable('rep_robj_xbbb_conf');*/ + $ilDB->dropTable('rep_robj_xbbb_conf'); return true; } } diff --git a/classes/class.ilBigBlueButtonProtocol.php b/classes/class.ilBigBlueButtonProtocol.php index 07d6c56..42b9785 100755 --- a/classes/class.ilBigBlueButtonProtocol.php +++ b/classes/class.ilBigBlueButtonProtocol.php @@ -146,8 +146,15 @@ public function isMeetingRecorded($object) $meetingID=$object->getBBBId(); $mPW=$object->getModeratorPwd(); ; - $meetingInfo = $this->bbb->getMeetingInfo(new GetMeetingInfoParameters($meetingID, $mPW)); - return $meetingInfo->success(); + $meetingInfo= null; + try{ + $meetingInfo = $this->bbb->getMeetingInfo(new GetMeetingInfoParameters($meetingID, $mPW)); + return $meetingInfo->success(); + }catch(Exception $e){ + return $meetingInfo; + } + + } From 84ea280b06c8380df6451c1c35645a158db73eba Mon Sep 17 00:00:00 2001 From: Jephte Abijuru <57417057+jeph864@users.noreply.github.com> Date: Thu, 17 Aug 2023 08:38:21 +0200 Subject: [PATCH 02/13] ILIAS 8 Support * Support ILIAS 8 - Beta * fix php8.0 errors in guest.php --- README.md | 7 +- classes/class.ilBigBlueButtonConfigGUI.php | 47 ++- classes/class.ilBigBlueButtonExporter.php | 6 +- classes/class.ilBigBlueButtonImporter.php | 2 +- classes/class.ilBigBlueButtonPlugin.php | 7 +- classes/class.ilObjBigBlueButton.php | 313 ++++++++++++++++-- classes/class.ilObjBigBlueButtonAccess.php | 3 +- classes/class.ilObjBigBlueButtonGUI.php | 50 +-- classes/class.ilObjBigBlueButtonListGUI.php | 12 +- guest.php | 37 ++- plugin.php | 4 +- templates/client.js | 96 ++++++ templates/tpl.BigBlueButtonClient.html | 28 -- .../tpl.BigBlueButtonModeratorClient.html | 80 ----- 14 files changed, 475 insertions(+), 217 deletions(-) create mode 100644 templates/client.js diff --git a/README.md b/README.md index 9ee3f17..9095d19 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ It is assumed you already have a ILIAS Intallation [up and running](https://docu # Installation -### ILIAS 5.4, 6.x, 7.x +### ILIAS 5.4, 6.x, 7.x, 8.x On your ILIAS Server: @@ -49,7 +49,9 @@ On your ILIAS Server: - finally you can create "Bigbluebutton" Virtual Classrooms as regular repository object **Note:** If the server is not reachable, during configuration a message will be displayed. After correcting the error, make sure to press the save button twice. - +# Notes +- In ILIAS 8 you had to build plugin artifacts before you can be able to install the plugin. You can follow the guidelines in the ILIAS 8 setup documentation. +- It is recommended to refresh languages if you use the guest feature. # Compatibility Tested with ILIAS @@ -58,6 +60,7 @@ Tested with ILIAS - 6.0 - 6.1, 6.2, 6.3 - 7.x +- 8.x diff --git a/classes/class.ilBigBlueButtonConfigGUI.php b/classes/class.ilBigBlueButtonConfigGUI.php index bbe7fd3..2311fad 100755 --- a/classes/class.ilBigBlueButtonConfigGUI.php +++ b/classes/class.ilBigBlueButtonConfigGUI.php @@ -1,6 +1,6 @@ tpl = $tpl; + } + + function performCommand($cmd): void + { switch ($cmd) { @@ -54,7 +66,19 @@ public function initConfigurationForm() { global $lng, $ilCtrl, $ilDB; - $values = array(); + $values = array( + 'svrpublicurl' => '', + 'svrsalt' => '', + 'choose_recording' => 0, + 'guest_global_choose' => 0, + 'sess_enable_max_concurrent' => 0, + 'enable_userlimit' => 0, + 'sess_max_concurrent' => 0, + 'sess_msg_concurrent' => '' + + + + ); $result = $ilDB->query("SELECT * FROM rep_robj_xbbb_conf"); while ($record = $ilDB->fetchAssoc($result)) { $values["svrpublicurl"] = $record["svrpublicurl"]; @@ -69,14 +93,14 @@ public function initConfigurationForm() $pl = $this->getPluginObject(); - if ($values["svrpublicurl"] != '' && $values["svrsalt"] != '') { + if (count($values) > 0 && $values["svrpublicurl"] != '' && $values["svrsalt"] != '') { $server_reachable=$this->isServerReachable($values["svrpublicurl"], $values["svrsalt"]); if (!$server_reachable) { - ilUtil::sendFailure($pl->txt("sever_not_reachable"), true); + $this->tpl->setOnScreenMessage(ilGlobalTemplateInterface::MESSAGE_TYPE_FAILURE, "sever_not_reachable", true ); } } - include_once("Services/Form/classes/class.ilPropertyFormGUI.php"); + //include_once("Services/Form/classes/class.ilPropertyFormGUI.php"); $form = new ilPropertyFormGUI(); // @@ -96,7 +120,7 @@ public function initConfigurationForm() $pi->setMaxLength(256); $pi->setSize(40); $pi->setRetype(false); - $pi->setValue($values["svrsalt"]); + if ($values["svrsalt"]) $pi->setValue($values["svrsalt"]); $form->addItem($pi); //recording configuration @@ -205,8 +229,7 @@ public function save() " WHERE id = ".$ilDB->quote(1, "integer") ); } - - ilUtil::sendSuccess($pl->txt("saving_invoked"), true); + $this->tpl->setOnScreenMessage(ilGlobalTemplateInterface::MESSAGE_TYPE_SUCCESS, $pl->txt("saving_invoked"), true); $ilCtrl->redirect($this, "configure"); } else { $form->setValuesByPost(); @@ -224,7 +247,7 @@ private function checkUrl(string $url) private function isServerReachable(string $url, string $salt) { - include_once("./Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/classes/class.ilBigBlueButtonProtocol.php"); + //include_once("./Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/classes/class.ilBigBlueButtonProtocol.php"); $bbb_helper=new BBB($salt,$url); try{ $apiVersion = $bbb_helper->getApiVersion(); diff --git a/classes/class.ilBigBlueButtonExporter.php b/classes/class.ilBigBlueButtonExporter.php index bb7381b..77010f6 100755 --- a/classes/class.ilBigBlueButtonExporter.php +++ b/classes/class.ilBigBlueButtonExporter.php @@ -10,18 +10,18 @@ */ class ilBigBlueButtonExporter extends ilXmlExporter { - public function getXmlRepresentation($a_entity, $a_schema_version, $a_id) + public function getXmlRepresentation($a_entity, $a_schema_version, $a_id): string { //include_once './Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php'; $bbb = new ilObjBigBlueButton($a_id); } - public function init() + public function init(): void { // TODO: Implement init() method. } - public function getValidSchemaVersions($a_entity) + public function getValidSchemaVersions($a_entity): array { return array( "5.2.0" => array( diff --git a/classes/class.ilBigBlueButtonImporter.php b/classes/class.ilBigBlueButtonImporter.php index 36062b5..f803226 100755 --- a/classes/class.ilBigBlueButtonImporter.php +++ b/classes/class.ilBigBlueButtonImporter.php @@ -10,7 +10,7 @@ */ class ilBigBlueButtonImporter extends ilXmlImporter { - public function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) + public function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping): void { // TODO: Implement importXmlRepresentation() method. } diff --git a/classes/class.ilBigBlueButtonPlugin.php b/classes/class.ilBigBlueButtonPlugin.php index 47a1251..f84083b 100755 --- a/classes/class.ilBigBlueButtonPlugin.php +++ b/classes/class.ilBigBlueButtonPlugin.php @@ -1,6 +1,5 @@ tableExists('rep_robj_xbbb_conf')) $ilDB->dropTable('rep_robj_xbbb_conf'); - return true; + } } diff --git a/classes/class.ilObjBigBlueButton.php b/classes/class.ilObjBigBlueButton.php index 038ba8d..c962b47 100755 --- a/classes/class.ilObjBigBlueButton.php +++ b/classes/class.ilObjBigBlueButton.php @@ -21,8 +21,6 @@ +-----------------------------------------------------------------------------+ */ -include_once("./Services/Repository/classes/class.ilObjectPlugin.php"); - /** * Application class for BigBlueButton repository object. @@ -32,22 +30,76 @@ */ class ilObjBigBlueButton extends ilObjectPlugin { + /** + * @var + */ private $objSession; - private $duration; + /** + * @var + */ + private int $duration = 0; + /** + * @var + */ private $accessCode; - private $dialNumber; - private $guestChooseEnabled; - private $guestGlobalEnabled; - private $maxParticipants; + /** + * @var + */ + private string $dialNumber = ''; + /** + * @var + */ + private bool $guestChooseEnabled = false; + /** + * @var + */ + private bool $guestGlobalEnabled = false; + /** + * @var int + */ + private int $maxParticipants = 0; - private $accessToken; - private $refreshToken; + /** + * @var string + */ + private string $accessToken = ''; + /** + * @var + */ + private $refreshToken = ''; + /** + * @var bool + */ private $publish = true; + /** + * @var bool + */ private $allow_download = false; + /** + * @var bool + */ private $enable_userlimit = false; + /** + * @var bool + */ private $enable_max_concurrent = false; + /** + * @var int + */ private $max_concurrent_sessions = 0; + /** + * @var + */ private $max_concurrent_sessions_msg; + private bool $online = false; + private string $svrPublicUrl = ''; + private string $svrSalt = ''; + private string $attendeePwd = ''; + private string $moderatorPwd = ''; + private string $welcomeText = ''; + private string $sequence = ''; + private string $presentationUrl = ''; + /** * Constructor * @@ -62,7 +114,7 @@ public function __construct($a_ref_id = 0) /** * Get type. */ - final public function initType() + final public function initType(): void { $this->setType("xbbb"); } @@ -70,7 +122,7 @@ final public function initType() /** * Create object */ - public function doCreate() + public function doCreate(bool $clone_mode = false): void { global $ilDB; @@ -116,7 +168,7 @@ public function doCreate() /** * Read data from db */ - public function doRead() + public function doRead(): void { global $ilDB; @@ -156,7 +208,7 @@ public function doRead() /** * Update data */ - public function doUpdate() + public function doUpdate(): void { global $ilDB; @@ -181,7 +233,7 @@ public function doUpdate() /** * Delete data from db */ - public function doDelete() + public function doDelete(): void { global $ilDB; @@ -194,7 +246,7 @@ public function doDelete() /** * Do Cloning */ - public function doClone($a_target_id, $a_copy_id, $new_obj) + public function doClone($a_target_id, $a_copy_id, $new_obj): void { $new_obj->setOnline($this->getOnline()); $new_obj->setSvrPublicURL($this->getSvrPublicURL()); @@ -221,7 +273,7 @@ public function doClone($a_target_id, $a_copy_id, $new_obj) /** * Set online * - * @param boolean online + * @param boolean $a_val online */ public function setOnline($a_val) { @@ -238,70 +290,129 @@ public function getOnline() return $this->online; } + /** + * @param $a_val + * @return void + */ public function setSvrPublicURL($a_val) { $this->svrPublicUrl = $a_val; } + + /** + * @return mixed + */ public function getSvrPublicURL() { return $this->svrPublicUrl; } + /** + * @param $a_val + * @return void + */ public function setSvrSalt($a_val) { $this->svrSalt = $a_val; } + + /** + * @return mixed + */ public function getSvrSalt() { return $this->svrSalt; } + /** + * @param $a_val + * @return void + */ public function setAttendeePwd($a_val) { $this->attendeePwd = $a_val; } + + /** + * @return mixed + */ public function getAttendeePwd() { return $this->attendeePwd; } + /** + * @param $a_val + * @return void + */ public function setModeratorPwd($a_val) { $this->moderatorPwd = $a_val; } + + /** + * @return mixed + */ public function getModeratorPwd() { return $this->moderatorPwd; } + /** + * @param $a_val + * @return void + */ public function setWelcomeText($a_val) { $this->welcomeText = $a_val; } + + /** + * @return mixed + */ public function getWelcomeText() { return $this->welcomeText; } + /** + * @param $a_val + * @return void + */ public function setMaxParticipants($a_val) { $this->maxParticipants = $a_val; } + + /** + * @return mixed + */ public function getMaxParticipants() { return $this->maxParticipants; } + /** + * @param $a_val + * @return void + */ public function setSequence($a_val) { $this->sequence = $a_val; } - public function getSequence() + + /** + * @return int + */ + public function getSequence(): int { return $this->sequence; } - public function incSequence() + /** + * @return int + */ + public function incSequence(): int { //No synchronization... who cares at this stage of the development... $this->sequence=$this->sequence+1; @@ -309,143 +420,277 @@ public function incSequence() return $this->sequence; } - public function getBBBId() + /** + * @return string + */ + public function getBBBId(): string { return "ilias-bbb_".CLIENT_ID."_".$this->getId()."_".$this->getSequence(); } - public function isWelcomeTextSet() + /** + * @return bool + */ + public function isWelcomeTextSet(): bool { if ($this->welcomeText!=='') { return true; } return false; } - public function setMeetingDuration( $duration) + + /** + * @param $duration + * @return void + */ + public function setMeetingDuration($duration) { $this->duration = $duration; } + + /** + * @return mixed + */ public function getMeetingDuration() { return $this->duration; } - public function getPresentationUrl() + /** + * @return string + */ + public function getPresentationUrl(): string { return $this->presentationUrl; } + + /** + * @param string $presentationUrl + * @return void + */ public function setPresentationUrl(string $presentationUrl) { $this->presentationUrl = $presentationUrl; } + + /** + * @return mixed + */ public function getAccessCode() { return $this->accessCode; } - public function setAccessCode( $code){ + + /** + * @param $code + * @return void + */ + public function setAccessCode($code){ $this->accessCode= $code; } + /** + * @return mixed + */ public function getAccessToken() { return $this->accessToken; } + + /** + * @param string $accessToken + * @return void + */ public function setAccessToken(string $accessToken) { $this->accessToken = $accessToken; } + /** + * @return mixed + */ public function getRefreshToken(){ return $this->refreshToken; } + /** + * @param string $refreshToken + * @return void + */ public function setRefreshToken(string $refreshToken) { $this->refreshToken = $refreshToken; } - public function setDialNumber(string $dialNumber) + + /** + * @param string $dialNumber + * @return void + */ + public function setDialNumber(string $dialNumber) { $this->dialNumber = $dialNumber; } + + /** + * @return mixed + */ public function getDialNumber() { return $this->dialNumber; } + /** + * @return void + */ public function generateCode() { $this->accessCode = mt_rand(10000, 99999); } + + /** + * @return mixed + */ public function isGuestLinkAllowed() { return $this->guestChooseEnabled; } - public function setGuestLinkAllowed( bool $allowed) + + /** + * @param bool $allowed + * @return void + */ + public function setGuestLinkAllowed(bool $allowed) { $this->guestChooseEnabled = $allowed; } + + /** + * @return mixed + */ public function isGuestGlabalAllowed() { return $this->guestGlobalEnabled; } + + /** + * @param bool $enabled + * @return void + */ public function setGuestGlobalEnabled(bool $enabled) { $this->guestGlobalEnabled = $enabled; } + + /** + * @return mixed + */ public function isGuestLink() { return $this->is_guest_link; } - public function getPublish() + + /** + * @return bool + */ + public function getPublish(): bool { return $this->publish ? $this->publish : true; } + + /** + * @param $publish + * @return void + */ public function setPublish($publish) { $this->publish = $publish; } - public function isDownloadAllowed() + /** + * @return bool + */ + public function isDownloadAllowed(): bool { return $this->allow_download; } + + /** + * @param $allow_download + * @return void + */ public function setDownloadAllowed($allow_download) { $this->allow_download = $allow_download; } - public function isMaxConcurrentSessionEnabled() + + /** + * @return bool + */ + public function isMaxConcurrentSessionEnabled(): bool { return $this->enable_max_concurrent; } - public function enableMaxConcurrentSession($enabled = false) + + /** + * @param bool $enabled + * @return void + */ + public function enableMaxConcurrentSession(bool $enabled = false) { $this->enable_max_concurrent = $enabled; } - public function getMaxConcurrentSessions() + + /** + * @return int + */ + public function getMaxConcurrentSessions(): int { return $this->max_concurrent_sessions; } - public function setMaxConcurrentSessions($max_concurrent_sess = 0) + + /** + * @param int $max_concurrent_sess + * @return void + */ + public function setMaxConcurrentSessions(int $max_concurrent_sess = 0) { $this->max_concurrent_sessions = $max_concurrent_sess; } - public function isUserLimitEnabled() + + /** + * @return bool + */ + public function isUserLimitEnabled(): bool { return $this->enable_userlimit; } - public function enableUserLimit( $enabled = false) + + /** + * @param bool $enabled + * @return void + */ + public function enableUserLimit(bool $enabled = false) { $this->enable_userlimit = $enabled; } - public function setMaxConcurrentSessionsMsg($message = "") + + /** + * @param string $message + * @return void + */ + public function setMaxConcurrentSessionsMsg(string $message = "") { $this->max_concurrent_sessions_msg = $message; } + + /** + * @return mixed + */ public function getMaxConcurrentSessionsMsg() { return $this->max_concurrent_sessions_msg; diff --git a/classes/class.ilObjBigBlueButtonAccess.php b/classes/class.ilObjBigBlueButtonAccess.php index a97ab8b..cac6cb2 100755 --- a/classes/class.ilObjBigBlueButtonAccess.php +++ b/classes/class.ilObjBigBlueButtonAccess.php @@ -21,7 +21,6 @@ +-----------------------------------------------------------------------------+ */ -include_once("./Services/Repository/classes/class.ilObjectPluginAccess.php"); /** * Access/Condition checking for BigBlueButton object @@ -45,7 +44,7 @@ class ilObjBigBlueButtonAccess extends ilObjectPluginAccess * * @return boolean true, if everything is ok */ - public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "") + public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = ""): bool { global $ilUser, $ilAccess; diff --git a/classes/class.ilObjBigBlueButtonGUI.php b/classes/class.ilObjBigBlueButtonGUI.php index 585081f..2ddb96c 100755 --- a/classes/class.ilObjBigBlueButtonGUI.php +++ b/classes/class.ilObjBigBlueButtonGUI.php @@ -22,7 +22,6 @@ */ -include_once("./Services/Repository/classes/class.ilObjectPluginGUI.php"); /** @@ -46,24 +45,20 @@ */ class ilObjBigBlueButtonGUI extends ilObjectPluginGUI { + public bool $has_meeting_recordings = false; + /** * Initialisation */ - protected function afterConstructor() + protected function afterConstructor(): void { - // anything needed after object has been constructed - // - example: append my_id GET parameter to each request - // $ilCtrl->saveParameter($this, array("my_id")); - - //$this->deactivateCreationForm(ilObject2GUI::CFORM_IMPORT); - //$this->deactivateCreationForm(ilObject2GUI::CFORM_CLONE); $this->tpl->addCss("./Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/templates/bbb.css"); } /** * Get type. */ - final public function getType() + final public function getType(): string { return "xbbb"; } @@ -71,7 +66,7 @@ final public function getType() /** * Handles all commmands of this class, centralizes permission checks */ - function performCommand($cmd) + function performCommand($cmd): void { $this->setTitleAndDescription(); @@ -105,7 +100,7 @@ function performCommand($cmd) /** * After object has been created -> jump to this command */ - public function getAfterCreationCmd() + public function getAfterCreationCmd(): string { return "editProperties"; } @@ -113,7 +108,7 @@ public function getAfterCreationCmd() /** * Get standard command */ - public function getStandardCmd() + public function getStandardCmd(): string { return "showContent"; } @@ -125,7 +120,7 @@ public function getStandardCmd() /** * Set tabs */ - public function setTabs() + public function setTabs(): void { global $ilTabs, $ilCtrl, $ilAccess; @@ -271,7 +266,7 @@ public function updateProperties() $this->object->setDownloadAllowed(($this->form->getInput("allow_download"))); $this->object->update(); - ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); + $this->tpl->setOnScreenMessage(ilGlobalTemplateInterface::MESSAGE_TYPE_SUCCESS, $lng->txt("msg_obj_modified"), true); $ilCtrl->redirect($this, "editProperties"); } @@ -297,7 +292,6 @@ public function showContent() while ($record = $ilDB->fetchAssoc($result)) { $svrPublicURL = $record["svrpublicurl"]; - $svrPublicPort = $record["svrpublicport"]; $values["choose_recording"] = $record["choose_recording"]; } @@ -309,12 +303,13 @@ public function showContent() $isModerator=true; } - include_once("./Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/classes/class.ilBigBlueButtonProtocol.php"); $BBBHelper=new ilBigBlueButtonProtocol($this->object); $available_sessions = $BBBHelper->getMaximumSessionsAvailable(); //$BBBHelper->getMeetings(); + $client_js = new ilTemplate("./Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/templates/client.js", true, true); + if ($isModerator) { $my_tpl = new ilTemplate("./Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/templates/tpl.BigBlueButtonModeratorClient.html", true, true); @@ -350,7 +345,11 @@ public function showContent() $my_tpl->setVariable("CHOOSE_RECORDING_VISIBLE", "hidden"); } - $my_tpl->setVariable("hasMeetingRecordings", $this->has_meeting_recordings && boolval($values["choose_recording"]) ? "true" : "false"); + $client_js->setVariable("hasMeetingRecordings", $this->has_meeting_recordings && boolval($values["choose_recording"]) ? "true" : "false"); + $client_js->setCurrentBlock('moderator'); + $client_js->setVariable("DUMMY_VAL", 1); + $client_js->parseCurrentBlock(); + $bbbURL=$BBBHelper->joinURLModerator($this->object); } else { @@ -361,20 +360,22 @@ public function showContent() $bbbURL=$BBBHelper->joinURL($this->object); } - $my_tpl->setVariable('isMaxNumberOfSessionsExceeded', 'false'); + $client_js->setVariable('isMaxNumberOfSessionsExceeded', 'false'); if($this->object->isMaxConcurrentSessionEnabled()){ if($available_sessions['max_sessions'] || ( key_exists($this->object->getBBBId(), $available_sessions['meetings']) && $available_sessions['meetings'][$this->object->getBBBId()]['userlimit'])){ - $my_tpl->setVariable('isMaxNumberOfSessionsExceeded', 'true'); + $client_js->setVariable('isMaxNumberOfSessionsExceeded', 'true'); $my_tpl->setVariable('maxNumberofSessionsExceededText', $this->object->getMaxConcurrentSessionsMsg()); } } $my_tpl->setVariable("clickToOpenClass", $this->txt("click_to_open_class")); $isMeetingRunning=$BBBHelper->isMeetingRunning($this->object); - $my_tpl->setVariable("isMeetingRunning", $isMeetingRunning ? "true" : "false"); + $client_js->setVariable("isMeetingRunning", $isMeetingRunning ? "true" : "false"); $isMeetingRecorded = $BBBHelper->isMeetingRecorded($this->object); - $my_tpl->setVariable("isMeetingRecorded", $isMeetingRecorded ? "true" : "false"); + $client_js->setVariable("isMeetingRecorded", $isMeetingRecorded ? "true" : "false"); $my_tpl->setVariable("bbbURL", $bbbURL); + $tpl->addOnLoadCode($client_js->get()); + $tpl->setContent($my_tpl->get()); } @@ -464,7 +465,6 @@ public function endClass() //$ilTabs->clearTargets(); $ilTabs->activateTab("content"); - include_once("./Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/classes/class.ilBigBlueButtonProtocol.php"); $BBBHelper=new ilBigBlueButtonProtocol($this->object); $BBBHelper->endMeeting($this->object); @@ -483,7 +483,7 @@ public function startClass() //$ilTabs->clearTargets(); $ilTabs->activateTab("content"); - include_once("./Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/classes/class.ilBigBlueButtonProtocol.php"); + $BBBHelper=new ilBigBlueButtonProtocol($this->object); $BBBHelper->createMeeting($this->object, isset($_POST["recordmeeting"])); @@ -506,7 +506,7 @@ public function deleteRecording() //$ilTabs->clearTargets(); $ilTabs->activateTab("content"); - include_once("./Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/classes/class.ilBigBlueButtonProtocol.php"); + $recordID = filter_input(INPUT_GET, "recordID"); $BBBHelper=new ilBigBlueButtonProtocol($this->object); @@ -524,7 +524,7 @@ public function publish() { global $ilCtrl; - include_once("./Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/classes/class.ilBigBlueButtonProtocol.php"); + $BBBHelper= new ilBigBlueButtonProtocol($this->object); $recordID = filter_input(INPUT_GET, "recordID"); $publish = boolval(filter_input(INPUT_GET, "publish")); diff --git a/classes/class.ilObjBigBlueButtonListGUI.php b/classes/class.ilObjBigBlueButtonListGUI.php index bb019fd..9df8d21 100755 --- a/classes/class.ilObjBigBlueButtonListGUI.php +++ b/classes/class.ilObjBigBlueButtonListGUI.php @@ -21,8 +21,6 @@ +-----------------------------------------------------------------------------+ */ -include_once "./Services/Repository/classes/class.ilObjectPluginListGUI.php"; - /** * ListGUI implementation for BigBlueButton object plugin. This one * handles the presentation in container items (categories, courses, ...) @@ -38,7 +36,7 @@ class ilObjBigBlueButtonListGUI extends ilObjectPluginListGUI /** * Init type */ - public function initType() + public function initType(): void { $this->setType("xbbb"); } @@ -46,7 +44,7 @@ public function initType() /** * Get name of gui class handling the commands */ - public function getGuiClass() + public function getGuiClass(): string { return "ilObjBigBlueButtonGUI"; } @@ -54,7 +52,7 @@ public function getGuiClass() /** * Get commands */ - public function initCommands() + public function initCommands(): array { return array( array( @@ -77,13 +75,13 @@ public function initCommands() * "property" (string) => property name * "value" (string) => property value */ - public function getProperties() + public function getProperties(): array { global $lng, $ilUser; $props = array(); - $this->plugin->includeClass("class.ilObjBigBlueButtonAccess.php"); + //$this->plugin->includeClass("class.ilObjBigBlueButtonAccess.php"); if (!ilObjBigBlueButtonAccess::checkOnline($this->obj_id)) { $props[] = array("alert" => true, "property" => $this->txt("status"), "value" => $this->txt("offline")); diff --git a/guest.php b/guest.php index fb6fad4..24a35c6 100644 --- a/guest.php +++ b/guest.php @@ -1,7 +1,7 @@ +function deleteRecord (link){ + + $('#recordID').val(link); + $('#deleteRecordingInput').click(); + +} +var dummyVar={DUMMY_VAL}; +$('#endClassForm').hide(); +$('#startClassForm').hide(); +$('#deleteRecording').hide(); +$('#maxNumberofSessionsExceeded').hide(); + +if(isMeetingRunning){ + if(isMaxNumberOfSessionsExceeded){ + $('#maxNumberofSessionsExceeded').show(); + } + $('#openClassLink').show(); + $('#endClassDiv').show(); + $('#startClassDiv').hide(); + $('#recordmeeting_visible').hide(); + $('#recordmeeting_label').hide(); + +}else{ + $('#openClassLink').hide(); + $('#endClassDiv').hide(); + $('#startClassDiv').show(); + console.log($('#endClassDiv')) +} + + +if(hasMeetingRecordings){ + $('#recordings').show(); +} +else{ + $('#recordings').hide(); +} + + +if(isMeetingRecorded){ + $('#isMeetingRecorded').show(); +}else{ + $('#isMeetingRecorded').hide(); +} + +$('#startClassLink').click(function() { + $('#recordmeeting').prop("checked",$('#recordmeeting_visible').prop("checked")); + //alert($('#recordmeeting_visible').prop("checked")); + $('#startClassFormInput').click(); + + ////$('#openClassLink').click(); +}); + +$('#endClassLink').click(function() { + $('#endClassFormInput').click(); + //$('#openClassLink').click(); +}); +$('#copyUserInviteUrl', document).on('click', function(e) { + + let copyText = $('#userInviteUrl', document).get(0); + copyText.select(); + copyText.setSelectionRange(0, 99999); /*For mobile devices*/ + document.execCommand("copy"); +}); + +$('#copyGuestLinkPw', document).on('click', function(e) { + + let copyPw = $('#guestLinkPw', document).get(0); + copyPw.select(); + copyPw.setSelectionRange(0, 99999); /*For mobile devices*/ + document.execCommand("copy"); +}); + + \ No newline at end of file diff --git a/templates/tpl.BigBlueButtonClient.html b/templates/tpl.BigBlueButtonClient.html index ecb0017..6fcc5fe 100755 --- a/templates/tpl.BigBlueButtonClient.html +++ b/templates/tpl.BigBlueButtonClient.html @@ -2,34 +2,6 @@ - diff --git a/templates/tpl.BigBlueButtonModeratorClient.html b/templates/tpl.BigBlueButtonModeratorClient.html index 47f0eb1..4493239 100755 --- a/templates/tpl.BigBlueButtonModeratorClient.html +++ b/templates/tpl.BigBlueButtonModeratorClient.html @@ -1,86 +1,6 @@ {VAL_1} - From fc32a8bde941ed8f32e385985dde57bf08f371a0 Mon Sep 17 00:00:00 2001 From: Jephte Abijuru <57417057+jeph864@users.noreply.github.com> Date: Thu, 17 Aug 2023 09:06:01 +0200 Subject: [PATCH 03/13] Remove the php8- ILIAS5.4 support --- plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.php b/plugin.php index 49d97e6..31b85fb 100755 --- a/plugin.php +++ b/plugin.php @@ -8,7 +8,7 @@ // ilias min and max version; must always reflect the versions that should // run with the plugin -$ilias_min_version = "5.4"; +$ilias_min_version = "8.0"; $ilias_max_version = "8.99"; // optional, but useful: Add one or more responsible persons and a contact email From ce21e270004f1458e9b83496f4ed2156be39e6ed Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Thu, 24 Aug 2023 14:29:57 +0200 Subject: [PATCH 04/13] [FIX] setMaxConcurrentSessionsMsg expects string --- classes/class.ilObjBigBlueButton.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/class.ilObjBigBlueButton.php b/classes/class.ilObjBigBlueButton.php index c962b47..00126c3 100755 --- a/classes/class.ilObjBigBlueButton.php +++ b/classes/class.ilObjBigBlueButton.php @@ -161,7 +161,7 @@ public function doCreate(bool $clone_mode = false): void $this->enableUserLimit((bool) $record['enable_userlimit']); $this->enableMaxConcurrentSession((bool) $record['sess_enable_max_concurrent']); $this->setMaxConcurrentSessions((int) $record['sess_max_concurrent']); - $this->setMaxConcurrentSessionsMsg($record['sess_msg_concurrent']); + $this->setMaxConcurrentSessionsMsg($record['sess_msg_concurrent'] ?? ''); } } @@ -201,7 +201,7 @@ public function doRead(): void $this->enableUserLimit((bool) $record['enable_userlimit']); $this->enableMaxConcurrentSession((bool) $record['sess_enable_max_concurrent']); $this->setMaxConcurrentSessions((int) $record['sess_max_concurrent']); - $this->setMaxConcurrentSessionsMsg($record['sess_msg_concurrent']); + $this->setMaxConcurrentSessionsMsg($record['sess_msg_concurrent'] ?? ''); } } From b82eb2a264d7cb986d29ca56a58a02ff4a9787bb Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Thu, 24 Aug 2023 14:31:19 +0200 Subject: [PATCH 05/13] [FIX] null coalescing operator --- classes/class.ilObjBigBlueButton.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/class.ilObjBigBlueButton.php b/classes/class.ilObjBigBlueButton.php index 00126c3..df78c5a 100755 --- a/classes/class.ilObjBigBlueButton.php +++ b/classes/class.ilObjBigBlueButton.php @@ -183,12 +183,12 @@ public function doRead(): void $this->setWelcomeText($rec["welcometext"]); $this->setMaxParticipants($rec["maxparticipants"]); $this->setSequence($rec["sequence"]); - $this->setDialNumber($rec["dialnumber"] !==null ? $rec["dialnumber"]: ''); + $this->setDialNumber($rec["dialnumber"] ?? ''); $this->setAccessCode($rec["accesscode"]); $this->setMeetingDuration($rec["duration"]); $this->setGuestLinkAllowed((bool)$rec["guestchoose"]); $this->setDownloadAllowed((bool)$rec["allow_download"]); - $this->setPresentationUrl($rec["presentationurl"]!==null? $rec["presentationurl"]: ''); + $this->setPresentationUrl($rec["presentationurl"] ?? ''); $this->setPublish((bool)$rec["publish"]); } From fd5e30ec21f03e90e6cc73a544f2e7142a3432fe Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Thu, 24 Aug 2023 14:32:04 +0200 Subject: [PATCH 06/13] [FIX] Inconsistent return point --- classes/class.ilBigBlueButtonExporter.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/classes/class.ilBigBlueButtonExporter.php b/classes/class.ilBigBlueButtonExporter.php index 77010f6..a5de888 100755 --- a/classes/class.ilBigBlueButtonExporter.php +++ b/classes/class.ilBigBlueButtonExporter.php @@ -12,8 +12,7 @@ class ilBigBlueButtonExporter extends ilXmlExporter { public function getXmlRepresentation($a_entity, $a_schema_version, $a_id): string { - //include_once './Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php'; - $bbb = new ilObjBigBlueButton($a_id); + return ''; // Currently no export possible } public function init(): void From 3950b765e683ba78297ab9df542a007915c342ca Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Thu, 24 Aug 2023 14:34:14 +0200 Subject: [PATCH 07/13] [FIX] wrong method visibility --- classes/class.ilObjBigBlueButton.php | 10 +++++----- classes/class.ilObjBigBlueButtonGUI.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/classes/class.ilObjBigBlueButton.php b/classes/class.ilObjBigBlueButton.php index df78c5a..09facda 100755 --- a/classes/class.ilObjBigBlueButton.php +++ b/classes/class.ilObjBigBlueButton.php @@ -114,7 +114,7 @@ public function __construct($a_ref_id = 0) /** * Get type. */ - final public function initType(): void + final protected function initType(): void { $this->setType("xbbb"); } @@ -122,7 +122,7 @@ final public function initType(): void /** * Create object */ - public function doCreate(bool $clone_mode = false): void + protected function doCreate(bool $clone_mode = false): void { global $ilDB; @@ -168,7 +168,7 @@ public function doCreate(bool $clone_mode = false): void /** * Read data from db */ - public function doRead(): void + protected function doRead(): void { global $ilDB; @@ -208,7 +208,7 @@ public function doRead(): void /** * Update data */ - public function doUpdate(): void + protected function doUpdate(): void { global $ilDB; @@ -233,7 +233,7 @@ public function doUpdate(): void /** * Delete data from db */ - public function doDelete(): void + protected function doDelete(): void { global $ilDB; diff --git a/classes/class.ilObjBigBlueButtonGUI.php b/classes/class.ilObjBigBlueButtonGUI.php index 2ddb96c..5ac5810 100755 --- a/classes/class.ilObjBigBlueButtonGUI.php +++ b/classes/class.ilObjBigBlueButtonGUI.php @@ -120,7 +120,7 @@ public function getStandardCmd(): string /** * Set tabs */ - public function setTabs(): void + protected function setTabs(): void { global $ilTabs, $ilCtrl, $ilAccess; From 1462058831f5334a67860f8a998caf2c5a187b57 Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Thu, 24 Aug 2023 14:38:29 +0200 Subject: [PATCH 08/13] [FIX] removed second class from file --- classes/class.ilBBB.php | 25 ++++++++++++++++++++++ classes/class.ilBigBlueButtonConfigGUI.php | 2 +- classes/class.ilBigBlueButtonProtocol.php | 22 +------------------ guest.php | 12 +++++------ 4 files changed, 33 insertions(+), 28 deletions(-) create mode 100644 classes/class.ilBBB.php diff --git a/classes/class.ilBBB.php b/classes/class.ilBBB.php new file mode 100644 index 0000000..2a39d8c --- /dev/null +++ b/classes/class.ilBBB.php @@ -0,0 +1,25 @@ +securitySecret = $securitySecret; + $this->bbbServerBaseUrl = $baseUrl; + $this->urlBuilder = new UrlBuilder($this->securitySecret, $this->bbbServerBaseUrl); + //Add Proxy + require_once('Services/Http/classes/class.ilProxySettings.php'); + if(ilProxySettings::_getInstance()->isActive()) + { + $proxyHost = ilProxySettings::_getInstance()->getHost(); + $proxyPort = ilProxySettings::_getInstance()->getPort(); + $this->curlopts = [ + CURLOPT_PROXY => $proxyHost . ":" . $proxyPort + ]; + } + } +} diff --git a/classes/class.ilBigBlueButtonConfigGUI.php b/classes/class.ilBigBlueButtonConfigGUI.php index 2311fad..c3a69a7 100755 --- a/classes/class.ilBigBlueButtonConfigGUI.php +++ b/classes/class.ilBigBlueButtonConfigGUI.php @@ -248,7 +248,7 @@ private function checkUrl(string $url) private function isServerReachable(string $url, string $salt) { //include_once("./Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/classes/class.ilBigBlueButtonProtocol.php"); - $bbb_helper=new BBB($salt,$url); + $bbb_helper=new ilBBB($salt,$url); try{ $apiVersion = $bbb_helper->getApiVersion(); return $apiVersion->success(); diff --git a/classes/class.ilBigBlueButtonProtocol.php b/classes/class.ilBigBlueButtonProtocol.php index 42b9785..c357267 100755 --- a/classes/class.ilBigBlueButtonProtocol.php +++ b/classes/class.ilBigBlueButtonProtocol.php @@ -32,7 +32,7 @@ class ilBigBlueButtonProtocol public function __construct($object) { $this->object = $object; - $this->bbb = new BBB($this->object->getSvrSalt(), $this->object->getSvrPublicURL()); + $this->bbb = new ilBBB($this->object->getSvrSalt(), $this->object->getSvrPublicURL()); $this->meetings = $this->bbb->getMeetings(); } public function getAvatar() @@ -263,23 +263,3 @@ public function getMaximumSessionsAvailable($meeting_id = null) } } -class BBB extends \BigBlueButton\BigBlueButton -{ - public function __construct($securitySecret=null, $baseUrl=null) - { - parent::__construct(); - $this->securitySecret = $securitySecret; - $this->bbbServerBaseUrl = $baseUrl; - $this->urlBuilder = new UrlBuilder($this->securitySecret, $this->bbbServerBaseUrl); - //Add Proxy - require_once('Services/Http/classes/class.ilProxySettings.php'); - if(ilProxySettings::_getInstance()->isActive()) - { - $proxyHost = ilProxySettings::_getInstance()->getHost(); - $proxyPort = ilProxySettings::_getInstance()->getPort(); - $this->curlopts = [ - CURLOPT_PROXY => $proxyHost . ":" . $proxyPort - ]; - } - } -} diff --git a/guest.php b/guest.php index 24a35c6..9809e35 100644 --- a/guest.php +++ b/guest.php @@ -47,7 +47,7 @@ protected static function getIniHost(): string public static function initIlias($client_id=null, $client_token=null): void { - + if(empty($client_id)) { throw new \Exception("There has been an error. Try it again."); @@ -136,7 +136,7 @@ class GuestLink /** @var ilUtil $ilUtil */ private $ilUtil; - + private $bbb; /** @var int $refId */ @@ -285,7 +285,7 @@ private function setHtmlDocument() if (strpos($http_base,'/m/')) { $http_base = strstr($http_base,'/m/',true).'/Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton'; } - + $this->htmlTpl = new ilTemplate( dirname(__FILE__) . '/' . 'templates/tpl.guest.html', true, true); $this->htmlTpl->setVariable('USER_LANG', $this->isoLangCode[$this->userLang]); $this->htmlTpl->setVariable('HTTP_BASE', $http_base); @@ -435,7 +435,7 @@ private function checkPostRequest() $this->errState['displayname'] = isset($_POST['display_name']); } } - + return $score >= 0; } @@ -468,7 +468,7 @@ private function __construct() ilInitialisationGuest::initIlias($this->client); global $DIC; /** @var Container $DIC */ $this->dic = $DIC; - + try { $this->pluginObject = ilObjectFactory::getInstanceByRefId($this->refId); } catch (ilDatabaseException $e) { @@ -492,7 +492,7 @@ private function __construct() $this->errState['userLimit'] = true; } }else if( !$this->errState['displayname'] ) { - $this->bbb = new BBB($this->pluginConfig->getSvrSalt(), $this->pluginConfig->getSvrPublicUrl()); + $this->bbb = new ilBBB($this->pluginConfig->getSvrSalt(), $this->pluginConfig->getSvrPublicUrl()); $this->attendeePwd = $this->pluginObject->getAttendeePwd(); $this->setMeetingId(); if( $this->getUrlJoinMeeting() ) { From 677484b877d24ff66dde7f1f579192e95ed2fe19 Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Thu, 24 Aug 2023 14:41:15 +0200 Subject: [PATCH 09/13] [FIX] removed unused and defined undefined property --- classes/class.ilObjBigBlueButton.php | 7 ------- classes/class.ilObjBigBlueButtonGUI.php | 1 + 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/classes/class.ilObjBigBlueButton.php b/classes/class.ilObjBigBlueButton.php index 09facda..0f90e47 100755 --- a/classes/class.ilObjBigBlueButton.php +++ b/classes/class.ilObjBigBlueButton.php @@ -584,13 +584,6 @@ public function setGuestGlobalEnabled(bool $enabled) $this->guestGlobalEnabled = $enabled; } - /** - * @return mixed - */ - public function isGuestLink() - { - return $this->is_guest_link; - } /** * @return bool diff --git a/classes/class.ilObjBigBlueButtonGUI.php b/classes/class.ilObjBigBlueButtonGUI.php index 5ac5810..9196bf1 100755 --- a/classes/class.ilObjBigBlueButtonGUI.php +++ b/classes/class.ilObjBigBlueButtonGUI.php @@ -45,6 +45,7 @@ */ class ilObjBigBlueButtonGUI extends ilObjectPluginGUI { + private ?ilPropertyFormGUI $form = null; public bool $has_meeting_recordings = false; /** From faafa1dca5ab502872f401894a4c1cc461826d6e Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Thu, 24 Aug 2023 14:41:55 +0200 Subject: [PATCH 10/13] [FIX] null-pointer --- classes/class.ilObjBigBlueButtonGUI.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/class.ilObjBigBlueButtonGUI.php b/classes/class.ilObjBigBlueButtonGUI.php index 9196bf1..73e9cf1 100755 --- a/classes/class.ilObjBigBlueButtonGUI.php +++ b/classes/class.ilObjBigBlueButtonGUI.php @@ -430,7 +430,10 @@ private function buildRecordingUI() if ($isPublished){ if ($this->object->isDownloadAllowed()){ - $actions[] = $DIC->ui()->factory()->button()->shy($this->txt("DownloadText"), $BBBHelper->getVideoDownloadStreamUrl($format->url)); + $actions[] = $DIC->ui()->factory()->button()->shy( + $this->txt("DownloadText"), + $BBBHelper->getVideoDownloadStreamUrl($format->url ?? '') + ); } // $actions[] = $DIC->ui()->factory()->button()->shy($this->txt("unpublish_link"), $this->editLink($recording->recordID, 0)); // $actions[] = $DIC->ui()->factory()->button()->shy($this->txt("publish_link"), $this->editLink($recording->recordID, 1)); From 5f672d0d370a0feb5eb86509204a3bdd612ba3ff Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Thu, 24 Aug 2023 14:42:40 +0200 Subject: [PATCH 11/13] [FIX] removed undefined variable --- classes/class.ilObjBigBlueButtonGUI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/class.ilObjBigBlueButtonGUI.php b/classes/class.ilObjBigBlueButtonGUI.php index 73e9cf1..a8e03ca 100755 --- a/classes/class.ilObjBigBlueButtonGUI.php +++ b/classes/class.ilObjBigBlueButtonGUI.php @@ -534,7 +534,7 @@ public function publish() $publish = boolval(filter_input(INPUT_GET, "publish")); $BBBHelper->publishRecordings($this->object,$recordID, $publish ); - $this->object=$bbb_obj; + $ilCtrl->redirect($this, "showContent"); } From be274bffd22a386c515b6825afe0e63ab41d8f02 Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Thu, 24 Aug 2023 14:48:11 +0200 Subject: [PATCH 12/13] [FIX] implemented proper autoloading --- classes/class.ilBBB.php | 6 ++++-- classes/class.ilBigBlueButtonConfigGUI.php | 3 --- classes/class.ilBigBlueButtonExporter.php | 2 -- classes/class.ilBigBlueButtonImporter.php | 1 - classes/class.ilBigBlueButtonPlugin.php | 2 +- classes/class.ilBigBlueButtonProtocol.php | 22 +++++++++------------ classes/class.ilObjBigBlueButtonListGUI.php | 1 - composer.json | 7 ++++++- 8 files changed, 20 insertions(+), 24 deletions(-) diff --git a/classes/class.ilBBB.php b/classes/class.ilBBB.php index 2a39d8c..a9a18d2 100644 --- a/classes/class.ilBBB.php +++ b/classes/class.ilBBB.php @@ -1,9 +1,12 @@ bbbServerBaseUrl = $baseUrl; $this->urlBuilder = new UrlBuilder($this->securitySecret, $this->bbbServerBaseUrl); //Add Proxy - require_once('Services/Http/classes/class.ilProxySettings.php'); if(ilProxySettings::_getInstance()->isActive()) { $proxyHost = ilProxySettings::_getInstance()->getHost(); diff --git a/classes/class.ilBigBlueButtonConfigGUI.php b/classes/class.ilBigBlueButtonConfigGUI.php index c3a69a7..eca3eee 100755 --- a/classes/class.ilBigBlueButtonConfigGUI.php +++ b/classes/class.ilBigBlueButtonConfigGUI.php @@ -1,8 +1,5 @@ avatar = $avatar; - } + } public function getVideoDownloadStreamUrl(string $url) { @@ -81,7 +78,6 @@ public function createMeeting($object, $record = false) }*/ - include_once('./Services/Link/classes/class.ilLink.php'); $logoutURL = ilLink::_getLink($object->getRefId()); $this->createMeetingParam = new CreateMeetingParameters($meetingID, $meetingTitle); @@ -100,7 +96,7 @@ public function createMeeting($object, $record = false) if ($object->getMaxParticipants()>0){ $this->createMeetingParam->setMaxParticipants($object->getMaxParticipants()); } - if( (bool)(strlen($pdf = $this->object->getPresentationUrl())) && $this->isPDFValid($pdf)) { + if( (bool)(strlen($pdf = $this->object->getPresentationUrl())) && $this->isPDFValid($pdf)) { $this->createMeetingParam->addPresentation($pdf); } if(trim($object->getDialNumber())){ @@ -153,8 +149,8 @@ public function isMeetingRecorded($object) }catch(Exception $e){ return $meetingInfo; } - - + + } @@ -175,7 +171,7 @@ public function getRecordings() $meetingID=$this->object->getBBBId(); $recordParameters = new GetRecordingsParameters(); $recordParameters->setMeetingID($meetingID); - return $this->bbb->getRecordings($recordParameters); + return $this->bbb->getRecordings($recordParameters); } @@ -227,11 +223,11 @@ public function getAPI() return $apiVersion->success(); } private function isPDFValid(string $pdf){ - + return filter_var($pdf, FILTER_VALIDATE_URL) ? true : false; } - + public function getMaximumSessionsAvailable($meeting_id = null) { $participants_count = 0; @@ -244,11 +240,11 @@ public function getMaximumSessionsAvailable($meeting_id = null) $participants_count = $participants_count + $meeting->getParticipantCount(); $userlimit_exceeded =( $this->object->getMaxParticipants() > 0 && ($meeting->getMaxUsers() - $meeting->getParticipantCount() -1 <= 0)); $available[$meeting->getMeetingId()] = [ - + 'participants' => $meeting->getParticipantCount(), 'max_users' => $meeting->getMaxUsers(), 'userlimit' => $userlimit_exceeded - + ]; if($meeting_id && $meeting->getMeetingId() == $meeting_id && $userlimit_exceeded){ $sessions_available['current_meeting_userlimit'] = true; diff --git a/classes/class.ilObjBigBlueButtonListGUI.php b/classes/class.ilObjBigBlueButtonListGUI.php index 9df8d21..252f8db 100755 --- a/classes/class.ilObjBigBlueButtonListGUI.php +++ b/classes/class.ilObjBigBlueButtonListGUI.php @@ -81,7 +81,6 @@ public function getProperties(): array $props = array(); - //$this->plugin->includeClass("class.ilObjBigBlueButtonAccess.php"); if (!ilObjBigBlueButtonAccess::checkOnline($this->obj_id)) { $props[] = array("alert" => true, "property" => $this->txt("status"), "value" => $this->txt("offline")); diff --git a/composer.json b/composer.json index 56464a7..741f7f8 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,10 @@ { "require": { "bigbluebutton/bigbluebutton-api-php": "dev-master" + }, + "autoload": { + "classmap": [ + "classes" + ] } -} \ No newline at end of file +} From ef3f7593a4f6c3f9d13a6d031dc6c78d2948431c Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Mon, 11 Sep 2023 10:48:15 +0200 Subject: [PATCH 13/13] [FIX] type casting for incomplete or older objects --- classes/class.ilObjBigBlueButton.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/classes/class.ilObjBigBlueButton.php b/classes/class.ilObjBigBlueButton.php index 0f90e47..d87758a 100755 --- a/classes/class.ilObjBigBlueButton.php +++ b/classes/class.ilObjBigBlueButton.php @@ -177,19 +177,19 @@ protected function doRead(): void " WHERE id = ".$ilDB->quote($this->getId(), "integer") ); while ($rec = $ilDB->fetchAssoc($set)) { - $this->setOnline($rec["is_online"]); - $this->setAttendeePwd($rec["attendeepwd"]); - $this->setModeratorPwd($rec["moderatorpwd"]); - $this->setWelcomeText($rec["welcometext"]); - $this->setMaxParticipants($rec["maxparticipants"]); - $this->setSequence($rec["sequence"]); - $this->setDialNumber($rec["dialnumber"] ?? ''); - $this->setAccessCode($rec["accesscode"]); - $this->setMeetingDuration($rec["duration"]); - $this->setGuestLinkAllowed((bool)$rec["guestchoose"]); - $this->setDownloadAllowed((bool)$rec["allow_download"]); - $this->setPresentationUrl($rec["presentationurl"] ?? ''); - $this->setPublish((bool)$rec["publish"]); + $this->setOnline((bool) ($rec["is_online"] ?? false)); + $this->setAttendeePwd((string) ($rec["attendeepwd"] ?? '')); + $this->setModeratorPwd((string) ($rec["moderatorpwd"] ?? '')); + $this->setWelcomeText((string) $rec["welcometext"]); + $this->setMaxParticipants((int) ($rec["maxparticipants"] ?? 0)); + $this->setSequence((string) ($rec["sequence"] ?? '')); + $this->setDialNumber((string) ($rec["dialnumber"] ?? '')); + $this->setAccessCode((string) ($rec["accesscode"] ?? '')); + $this->setMeetingDuration((int) ($rec["duration"] ?? 0)); + $this->setGuestLinkAllowed((bool) $rec["guestchoose"]); + $this->setDownloadAllowed((bool) $rec["allow_download"]); + $this->setPresentationUrl((string) ($rec["presentationurl"] ?? '')); + $this->setPublish((bool) ($rec["publish"] ?? false)); } $result = $ilDB->query("SELECT * FROM rep_robj_xbbb_conf");