Skip to content

Commit

Permalink
Merge branch 'master' into patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
xJuvi authored Jan 14, 2024
2 parents afc8dca + 03122d3 commit 786527c
Show file tree
Hide file tree
Showing 17 changed files with 558 additions and 304 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
Expand All @@ -58,6 +60,7 @@ Tested with ILIAS
- 6.0
- 6.1, 6.2, 6.3
- 7.x
- 8.x



27 changes: 27 additions & 0 deletions classes/class.ilBBB.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

use BigBlueButton\Util\UrlBuilder;
use BigBlueButton\BigBlueButton;

/**
* Class ilBBB
*/
class ilBBB extends 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
if(ilProxySettings::_getInstance()->isActive())
{
$proxyHost = ilProxySettings::_getInstance()->getHost();
$proxyPort = ilProxySettings::_getInstance()->getPort();
$this->curlopts = [
CURLOPT_PROXY => $proxyHost . ":" . $proxyPort
];
}
}
}
52 changes: 36 additions & 16 deletions classes/class.ilBigBlueButtonConfigGUI.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
<?php

include_once("./Services/Component/classes/class.ilPluginConfigGUI.php");



/**
* BigBlueButton configuration class
*
* @version $Id$
*
*@ilCtrl_isCalledBy srag\DevTools\DevToolsCtrl: ilBigBlueButtonConfigGUI
*@ilCtrl_IsCalledBy ilBigBlueButtonConfigGUI: ilObjComponentSettingsGUI
*/
class ilBigBlueButtonConfigGUI extends ilPluginConfigGUI
{

const PLUGIN_CLASS_NAME = ilBigBlueButtonPlugin::class;

private $pl_object;
/**
* @var ilGlobalTemplateInterface|mixed
*/
public ilGlobalTemplateInterface $tpl;

/**
* Handles all commmands, default is "configure"
*/
function performCommand($cmd)
{

public function __construct()
{
global $tpl;
$this->tpl = $tpl;
}

function performCommand($cmd): void
{

switch ($cmd)
{
Expand Down Expand Up @@ -54,7 +63,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"];
Expand All @@ -69,14 +90,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();

//
Expand All @@ -96,7 +117,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
Expand Down Expand Up @@ -180,7 +201,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
Expand All @@ -205,8 +226,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();
Expand All @@ -224,8 +244,8 @@ 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);
//include_once("./Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/classes/class.ilBigBlueButtonProtocol.php");
$bbb_helper=new ilBBB($salt,$url);
try{
$apiVersion = $bbb_helper->getApiVersion();
return $apiVersion->success();
Expand Down
11 changes: 4 additions & 7 deletions classes/class.ilBigBlueButtonExporter.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

//include_once("./Services/Component/classes/class.ilPluginConfigGUI.php");

/**
* BigBlueButton exporter class
*
Expand All @@ -10,18 +8,17 @@
*/
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);
return ''; // Currently no export possible
}

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(
Expand Down
3 changes: 1 addition & 2 deletions classes/class.ilBigBlueButtonImporter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

//include_once("./Services/Component/classes/class.ilPluginConfigGUI.php");

/**
* BigBlueButton importer class
Expand All @@ -10,7 +9,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.
}
Expand Down
13 changes: 6 additions & 7 deletions classes/class.ilBigBlueButtonPlugin.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

include_once("./Services/Repository/classes/class.ilRepositoryObjectPlugin.php");
require_once __DIR__ . "/../vendor/autoload.php";

/**
* Bigbluebutton repository object plugin
Expand All @@ -9,20 +8,20 @@
*/
class ilBigBlueButtonPlugin extends ilRepositoryObjectPlugin
{
public function getPluginName()
public function getPluginName(): string
{
return "BigBlueButton";
}

protected function uninstallCustom()
protected function uninstallCustom(): void
{
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');*/
return true;
$ilDB->dropTable('rep_robj_xbbb_conf');

}
}
51 changes: 17 additions & 34 deletions classes/class.ilBigBlueButtonProtocol.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<?php

require_once './Customizing/global/plugins/Services/Repository/RepositoryObject/BigBlueButton/vendor/autoload.php';

use BigBlueButton\Parameters\CreateMeetingParameters;
use BigBlueButton\Parameters\JoinMeetingParameters;
use BigBlueButton\Parameters\GetRecordingsParameters;
use BigBlueButton\Parameters\DeleteRecordingsParameters;
use BigBlueButton\Parameters\EndMeetingParameters;
use BigBlueButton\Parameters\GetMeetingInfoParameters;
use BigBlueButton\Parameters\IsMeetingRunningParameters;
use BigBlueButton\Util\UrlBuilder;

/**
* BigBlueButton comunication helper class
Expand All @@ -32,7 +29,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()
Expand All @@ -42,7 +39,7 @@ public function getAvatar()
public function setAvatar($avatar)
{
$this->avatar = $avatar;
}
}

public function getVideoDownloadStreamUrl(string $url)
{
Expand Down Expand Up @@ -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);
Expand All @@ -101,7 +97,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())){
Expand Down Expand Up @@ -147,8 +143,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;
}


}


Expand All @@ -169,7 +172,7 @@ public function getRecordings()
$meetingID=$this->object->getBBBId();
$recordParameters = new GetRecordingsParameters();
$recordParameters->setMeetingID($meetingID);
return $this->bbb->getRecordings($recordParameters);
return $this->bbb->getRecordings($recordParameters);
}


Expand Down Expand Up @@ -221,11 +224,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;
Expand All @@ -238,11 +241,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;
Expand All @@ -257,23 +260,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
];
}
}
}
Loading

0 comments on commit 786527c

Please sign in to comment.