Merge branch 'MDL-74081-master' of https://github.com/call-learning/moodle

This commit is contained in:
Jun Pataleta
2022-09-08 09:05:05 +08:00
44 changed files with 212 additions and 201 deletions
@@ -35,8 +35,7 @@ require_once($CFG->dirroot.'/mod/bigbluebuttonbn/backup/moodle2/backup_bigbluebu
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class backup_bigbluebuttonbn_activity_task extends backup_activity_task
{
class backup_bigbluebuttonbn_activity_task extends backup_activity_task {
/**
* Define (add) particular settings this activity can have.
*
@@ -24,8 +24,6 @@
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com)
*/
defined('MOODLE_INTERNAL') || die();
/**
* Define all the backup steps that will be used by the backup_bigbluebuttonbn_activity_task.
*
@@ -35,8 +35,7 @@ require_once($CFG->dirroot.'/mod/bigbluebuttonbn/backup/moodle2/restore_bigblueb
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class restore_bigbluebuttonbn_activity_task extends restore_activity_task
{
class restore_bigbluebuttonbn_activity_task extends restore_activity_task {
/**
* Define (add) particular settings this activity can have.
*
@@ -24,8 +24,6 @@
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com)
*/
defined('MOODLE_INTERNAL') || die();
/**
* Define all the restore steps that will be used by the restore_url_activity_task.
*
@@ -107,7 +105,7 @@ class restore_bigbluebuttonbn_activity_structure_step extends restore_activity_s
/**
* Actions to be executed after the restore is completed
*
* @return array
* @return void
*/
protected function after_execute() {
// Add bigbluebuttonbn related files, no need to match by itemname (just internally handled context).
@@ -26,13 +26,14 @@ namespace mod_bigbluebuttonbn\event;
class activity_management_viewed extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_PARTICIPATING) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' viewed the bigbluebuttonbn activity management page for ".
"the course module id '##contextinstanceid'.";
$this->description = "The user with id '##userid' viewed the bigbluebuttonbn activity management page for " .
"the course module id '##contextinstanceid'.";
}
/**
+39 -35
View File
@@ -16,6 +16,9 @@
namespace mod_bigbluebuttonbn\event;
use coding_exception;
use moodle_url;
/**
* The mod_bigbluebuttonbn abstract base event class. Most mod_bigbluebuttonbn events can extend this class.
*
@@ -25,6 +28,13 @@ namespace mod_bigbluebuttonbn\event;
*/
abstract class base extends \core\event\base {
/**
* Object Id Mapping.
*
* @var array
*/
protected static $objectidmapping = ['db' => 'bigbluebuttonbn', 'restore' => 'bigbluebuttonbn'];
/** @var $bigbluebuttonbn */
protected $bigbluebuttonbn;
@@ -35,13 +45,6 @@ abstract class base extends \core\event\base {
*/
protected $description;
/**
* Object Id Mapping.
*
* @var array
*/
protected static $objectidmapping = ['db' => 'bigbluebuttonbn', 'restore' => 'bigbluebuttonbn'];
/**
* Legacy log data.
*
@@ -49,17 +52,6 @@ abstract class base extends \core\event\base {
*/
protected $legacylogdata;
/**
* Init method.
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_PARTICIPATING) {
$this->data['crud'] = $crud;
$this->data['edulevel'] = $edulevel;
$this->data['objecttable'] = 'bigbluebuttonbn';
}
/**
* Returns description of what happened.
*
@@ -83,10 +75,35 @@ abstract class base extends \core\event\base {
/**
* Returns relevant URL.
*
* @return \moodle_url
* @return moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/bigbluebuttonbn/view.php', ['id' => $this->contextinstanceid]);
return new moodle_url('/mod/bigbluebuttonbn/view.php', ['id' => $this->contextinstanceid]);
}
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_PARTICIPATING) {
$this->data['crud'] = $crud;
$this->data['edulevel'] = $edulevel;
$this->data['objecttable'] = 'bigbluebuttonbn';
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
if (isset($this->legacylogdata)) {
return $this->legacylogdata;
}
return null;
}
/**
@@ -105,29 +122,16 @@ abstract class base extends \core\event\base {
$this->legacylogdata = [$this->courseid, 'bigbluebuttonbn', $action, $fullurl, $info, $this->contextinstanceid];
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
if (isset($this->legacylogdata)) {
return $this->legacylogdata;
}
return null;
}
/**
* Custom validation.
*
* @throws \coding_exception
* @throws coding_exception
*/
protected function validate_data() {
parent::validate_data();
if ($this->contextlevel != CONTEXT_MODULE) {
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
throw new coding_exception('Context level must be CONTEXT_MODULE.');
}
}
}
@@ -23,12 +23,10 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_module_viewed extends \core\event\course_module_viewed
{
class course_module_viewed extends \core\event\course_module_viewed {
/**
* Init method.
* @param string $crud
* @param int $edulevel
*
*/
protected function init() {
$this->data['crud'] = 'r';
@@ -27,6 +27,7 @@ class events {
/**
* Event name matcher.
*
* @var $events
*/
public static $events = [
@@ -23,17 +23,17 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class live_session_event extends base
{
class live_session_event extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_OTHER) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' triggered action ##other in a ".
"bigbluebutton meeting for the bigbluebuttonbn activity with id ".
$this->description = "The user with id '##userid' triggered action ##other in a " .
"bigbluebutton meeting for the bigbluebuttonbn activity with id " .
"'##objectid' for the course id '##courseid'.";
}
@@ -23,16 +23,16 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class meeting_created extends base
{
class meeting_created extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_OTHER) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' created a bigbluebutton meeting for ".
$this->description = "The user with id '##userid' created a bigbluebutton meeting for " .
"the bigbluebuttonbn activity with id '##objectid' for the course id '##courseid'.";
}
@@ -23,17 +23,17 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class meeting_ended extends base
{
class meeting_ended extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_OTHER) {
parent::init($crud, $edulevel);
$this->description = "A bigbluebutton meeting for the bigbluebuttonbn activity with id ".
"'##objectid' for the course id '##courseid' has been forcibly ".
$this->description = "A bigbluebutton meeting for the bigbluebuttonbn activity with id " .
"'##objectid' for the course id '##courseid' has been forcibly " .
"ended by the user with id '##userid'.";
}
@@ -54,4 +54,5 @@ class meeting_ended extends base
public static function get_objectid_mapping() {
return ['db' => 'bigbluebuttonbn', 'restore' => 'bigbluebuttonbn'];
}
}
@@ -23,17 +23,17 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class meeting_joined extends base
{
class meeting_joined extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_PARTICIPATING) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' has joined a bigbluebutton meeting for ".
"the bigbluebuttonbn activity with id '##objectid' for the course id ".
$this->description = "The user with id '##userid' has joined a bigbluebutton meeting for " .
"the bigbluebuttonbn activity with id '##objectid' for the course id " .
"'##courseid'.";
}
@@ -23,17 +23,17 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class meeting_left extends base
{
class meeting_left extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_PARTICIPATING) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' has left a bigbluebutton meeting for ".
"the bigbluebuttonbn activity with id '##objectid' for the course id ".
$this->description = "The user with id '##userid' has left a bigbluebutton meeting for " .
"the bigbluebuttonbn activity with id '##objectid' for the course id " .
"'##courseid'.";
}
@@ -23,16 +23,16 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class recording_deleted extends base
{
class recording_deleted extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_OTHER) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' has deleted a recording with id ".
$this->description = "The user with id '##userid' has deleted a recording with id " .
"'##other' from the course id '##courseid'.";
}
@@ -23,16 +23,16 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class recording_edited extends base
{
class recording_edited extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_OTHER) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' has edited a recording with id ".
$this->description = "The user with id '##userid' has edited a recording with id " .
"'##other' in the course id '##courseid'.";
}
@@ -23,16 +23,16 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class recording_imported extends base
{
class recording_imported extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_OTHER) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' has imported a recording with id ".
$this->description = "The user with id '##userid' has imported a recording with id " .
"'##other' in the course id '##courseid'.";
}
@@ -22,16 +22,16 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class recording_protected extends base
{
class recording_protected extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_OTHER) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' has protected a recording with id ".
$this->description = "The user with id '##userid' has protected a recording with id " .
"'##other' in the course id '##courseid'.";
}
@@ -23,16 +23,16 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class recording_published extends base
{
class recording_published extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_OTHER) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' has published a recording with id ".
$this->description = "The user with id '##userid' has published a recording with id " .
"'##other' in the course id '##courseid'.";
}
@@ -23,16 +23,16 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class recording_unprotected extends base
{
class recording_unprotected extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_OTHER) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' has unprotected a recording with id ".
$this->description = "The user with id '##userid' has unprotected a recording with id " .
"'##other' in the course id '##courseid'.";
}
@@ -23,16 +23,16 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class recording_unpublished extends base
{
class recording_unpublished extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_OTHER) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' has unpublished a recording with id ".
$this->description = "The user with id '##userid' has unpublished a recording with id " .
"'##other' in the course id '##courseid'.";
}
@@ -23,16 +23,16 @@ namespace mod_bigbluebuttonbn\event;
* @copyright 2010 onwards, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class recording_viewed extends base
{
class recording_viewed extends base {
/**
* Init method.
*
* @param string $crud
* @param int $edulevel
*/
protected function init($crud = 'r', $edulevel = self::LEVEL_OTHER) {
parent::init($crud, $edulevel);
$this->description = "The user with id '##userid' has viewed a recording with id ".
$this->description = "The user with id '##userid' has viewed a recording with id " .
"'##other' from the course id '##courseid'.";
}
@@ -36,7 +36,7 @@ class recording_action {
* @param recording $recording
* @param instance $targetinstance
*/
public static function import(recording $recording, instance $targetinstance) {
public static function import(recording $recording, instance $targetinstance): void {
$recording->create_imported_recording($targetinstance);
}
@@ -45,7 +45,7 @@ class recording_action {
*
* @param recording $recording
*/
public static function delete(recording $recording) {
public static function delete(recording $recording): void {
// As the recordingid was not identified as imported recording link, execute delete on a real recording.
// Step 1, delete imported links associated to the recording.
$recordingstodelete = recording::get_records(['recordingid' => $recording->get('recordingid'),
@@ -61,7 +61,7 @@ class recording_action {
*
* @param recording $recording
*/
public static function edit(recording $recording) {
public static function edit(recording $recording): void {
$recording->update();
}
@@ -70,7 +70,7 @@ class recording_action {
*
* @param recording $recording
*/
public static function unprotect(recording $recording) {
public static function unprotect(recording $recording): void {
if (!(boolean) config::get('recording_protect_editable')) {
// Recording protect action through UI is disabled, there is no need to do anything else.
throw new \moodle_exception('cannotperformaction', 'mod_bigblubuebuttobn', '', 'unprotect');
@@ -88,7 +88,7 @@ class recording_action {
*
* @param recording $recording
*/
public static function protect(recording $recording) {
public static function protect(recording $recording): void {
if (!(boolean) config::get('recording_protect_editable')) {
// Recording protect action through UI is disabled, there is no need to do anything else.
throw new \moodle_exception('cannotperformaction', 'mod_bigblubuebuttobn', '', 'protect');
@@ -106,7 +106,7 @@ class recording_action {
*
* @param recording $recording
*/
public static function unpublish(recording $recording) {
public static function unpublish(recording $recording): void {
if ($recording->get('imported')) {
/* Since the recording link is the one fetched from the BBB server, imported recordings can not be
* unpublished. There is no need to do anything else.
@@ -122,7 +122,7 @@ class recording_action {
*
* @param recording $recording
*/
public static function publish(recording $recording) {
public static function publish(recording $recording): void {
if ($recording->get('imported')) {
/* Since the recording link is the one fetched from the BBB server, imported recordings can not be
* unpublished. There is no need to do anything else.
+63 -63
View File
@@ -43,7 +43,7 @@ class config {
*
* @return string
*/
protected static function get_moodle_version_major() {
protected static function get_moodle_version_major(): string {
global $CFG;
$versionarray = explode('.', $CFG->version);
return $versionarray[0];
@@ -54,7 +54,7 @@ class config {
*
* @return array
*/
protected static function defaultvalues() {
protected static function defaultvalues(): array {
return [
'server_url' => self::DEFAULT_SERVER_URL,
'shared_secret' => self::DEFAULT_SHARED_SECRET,
@@ -119,9 +119,9 @@ class config {
* Returns default value for an specific setting.
*
* @param string $setting
* @return string
* @return string|null
*/
public static function defaultvalue($setting) {
public static function defaultvalue(string $setting): ?string {
$defaultvalues = self::defaultvalues();
if (!array_key_exists($setting, $defaultvalues)) {
return null;
@@ -135,13 +135,13 @@ class config {
* @param string $setting
* @return string
*/
public static function get($setting) {
public static function get(string $setting): string {
global $CFG;
if (isset($CFG->bigbluebuttonbn[$setting])) {
return (string)$CFG->bigbluebuttonbn[$setting];
return (string) $CFG->bigbluebuttonbn[$setting];
}
if (isset($CFG->{'bigbluebuttonbn_'.$setting})) {
return (string)$CFG->{'bigbluebuttonbn_'.$setting};
if (isset($CFG->{'bigbluebuttonbn_' . $setting})) {
return (string) $CFG->{'bigbluebuttonbn_' . $setting};
}
return self::defaultvalue($setting);
}
@@ -151,8 +151,8 @@ class config {
*
* @return bool
*/
public static function recordings_enabled() {
return (boolean)self::get('recordings_enabled');
public static function recordings_enabled(): bool {
return (boolean) self::get('recordings_enabled');
}
/**
@@ -160,8 +160,8 @@ class config {
*
* @return bool
*/
public static function importrecordings_enabled() {
return (boolean)self::get('importrecordings_enabled');
public static function importrecordings_enabled(): bool {
return (boolean) self::get('importrecordings_enabled');
}
/**
@@ -169,56 +169,56 @@ class config {
*
* @return array
*/
public static function get_options() {
public static function get_options(): array {
return [
'version_major' => self::get_moodle_version_major(),
'voicebridge_editable' => self::get('voicebridge_editable'),
'importrecordings_enabled' => self::get('importrecordings_enabled'),
'importrecordings_from_deleted_enabled' => self::get('importrecordings_from_deleted_enabled'),
'waitformoderator_default' => self::get('waitformoderator_default'),
'waitformoderator_editable' => self::get('waitformoderator_editable'),
'userlimit_default' => self::get('userlimit_default'),
'userlimit_editable' => self::get('userlimit_editable'),
'preuploadpresentation_editable' => self::get('preuploadpresentation_editable'),
'recordings_enabled' => self::get('recordings_enabled'),
'meetingevents_enabled' => self::get('meetingevents_enabled'),
'recordings_deleted_default' => self::get('recordings_deleted_default'),
'recordings_deleted_editable' => self::get('recordings_deleted_editable'),
'recordings_imported_default' => self::get('recordings_imported_default'),
'recordings_imported_editable' => self::get('recordings_imported_editable'),
'recordings_preview_default' => self::get('recordings_preview_default'),
'recordings_preview_editable' => self::get('recordings_preview_editable'),
'recording_default' => self::get('recording_default'),
'recording_editable' => self::get('recording_editable'),
'recording_refresh_period' => self::get('recording_refresh_period'),
'recording_all_from_start_default' => self::get('recording_all_from_start_default'),
'recording_all_from_start_editable' => self::get('recording_all_from_start_editable'),
'recording_hide_button_default' => self::get('recording_hide_button_default'),
'recording_hide_button_editable' => self::get('recording_hide_button_editable'),
'recording_protect_editable' => self::get('recording_protect_editable'),
'general_warning_message' => self::get('general_warning_message'),
'general_warning_box_type' => self::get('general_warning_box_type'),
'general_warning_button_text' => self::get('general_warning_button_text'),
'general_warning_button_href' => self::get('general_warning_button_href'),
'general_warning_button_class' => self::get('general_warning_button_class'),
'muteonstart_editable' => self::get('muteonstart_editable'),
'muteonstart_default' => self::get('muteonstart_default'),
'disablecam_editable' => self::get('disablecam_editable'),
'disablecam_default' => self::get('disablecam_default'),
'disablemic_editable' => self::get('disablemic_editable'),
'disablemic_default' => self::get('disablemic_default'),
'disableprivatechat_editable' => self::get('disableprivatechat_editable'),
'disableprivatechat_default' => self::get('disableprivatechat_default'),
'disablepublicchat_editable' => self::get('disablepublicchat_editable'),
'disablepublicchat_default' => self::get('disablepublicchat_default'),
'disablenote_editable' => self::get('disablenote_editable'),
'disablenote_default' => self::get('disablenote_default'),
'hideuserlist_editable' => self::get('hideuserlist_editable'),
'hideuserlist_default' => self::get('hideuserlist_default'),
'lockonjoin_editable' => self::get('lockonjoin_editable'),
'lockonjoin_default' => self::get('lockonjoin_default'),
'welcome_default' => self::get('welcome_default'),
'welcome_editable' => self::get('welcome_editable'),
'version_major' => self::get_moodle_version_major(),
'voicebridge_editable' => self::get('voicebridge_editable'),
'importrecordings_enabled' => self::get('importrecordings_enabled'),
'importrecordings_from_deleted_enabled' => self::get('importrecordings_from_deleted_enabled'),
'waitformoderator_default' => self::get('waitformoderator_default'),
'waitformoderator_editable' => self::get('waitformoderator_editable'),
'userlimit_default' => self::get('userlimit_default'),
'userlimit_editable' => self::get('userlimit_editable'),
'preuploadpresentation_editable' => self::get('preuploadpresentation_editable'),
'recordings_enabled' => self::get('recordings_enabled'),
'meetingevents_enabled' => self::get('meetingevents_enabled'),
'recordings_deleted_default' => self::get('recordings_deleted_default'),
'recordings_deleted_editable' => self::get('recordings_deleted_editable'),
'recordings_imported_default' => self::get('recordings_imported_default'),
'recordings_imported_editable' => self::get('recordings_imported_editable'),
'recordings_preview_default' => self::get('recordings_preview_default'),
'recordings_preview_editable' => self::get('recordings_preview_editable'),
'recording_default' => self::get('recording_default'),
'recording_editable' => self::get('recording_editable'),
'recording_refresh_period' => self::get('recording_refresh_period'),
'recording_all_from_start_default' => self::get('recording_all_from_start_default'),
'recording_all_from_start_editable' => self::get('recording_all_from_start_editable'),
'recording_hide_button_default' => self::get('recording_hide_button_default'),
'recording_hide_button_editable' => self::get('recording_hide_button_editable'),
'recording_protect_editable' => self::get('recording_protect_editable'),
'general_warning_message' => self::get('general_warning_message'),
'general_warning_box_type' => self::get('general_warning_box_type'),
'general_warning_button_text' => self::get('general_warning_button_text'),
'general_warning_button_href' => self::get('general_warning_button_href'),
'general_warning_button_class' => self::get('general_warning_button_class'),
'muteonstart_editable' => self::get('muteonstart_editable'),
'muteonstart_default' => self::get('muteonstart_default'),
'disablecam_editable' => self::get('disablecam_editable'),
'disablecam_default' => self::get('disablecam_default'),
'disablemic_editable' => self::get('disablemic_editable'),
'disablemic_default' => self::get('disablemic_default'),
'disableprivatechat_editable' => self::get('disableprivatechat_editable'),
'disableprivatechat_default' => self::get('disableprivatechat_default'),
'disablepublicchat_editable' => self::get('disablepublicchat_editable'),
'disablepublicchat_default' => self::get('disablepublicchat_default'),
'disablenote_editable' => self::get('disablenote_editable'),
'disablenote_default' => self::get('disablenote_default'),
'hideuserlist_editable' => self::get('hideuserlist_editable'),
'hideuserlist_default' => self::get('hideuserlist_default'),
'lockonjoin_editable' => self::get('lockonjoin_editable'),
'lockonjoin_default' => self::get('lockonjoin_default'),
'welcome_default' => self::get('welcome_default'),
'welcome_editable' => self::get('welcome_editable'),
];
}
@@ -226,11 +226,11 @@ class config {
* Helper function returns an array with enabled features for an specific profile type.
*
* @param array $typeprofiles
* @param string $type
* @param string|null $type
*
* @return array
*/
public static function get_enabled_features($typeprofiles, $type = null) {
public static function get_enabled_features(array $typeprofiles, ?string $type = null): array {
$enabledfeatures = [];
$features = $typeprofiles[instance::TYPE_ALL]['features'];
if (!is_null($type) && key_exists($type, $typeprofiles)) {
@@ -253,7 +253,7 @@ class roles {
* Returns an array to populate a list of participants used in mod_form.php with default values.
*
* @param context $context
* @param int $ownerid
* @param int|null $ownerid
*
* @return array
*/
+1 -1
View File
@@ -77,7 +77,7 @@ class meeting {
/**
* Get currently stored meeting info
*
* @return mixed|stdClass
* @return stdClass
*/
public function get_meeting_info() {
if (!$this->meetinginfo) {
@@ -16,9 +16,6 @@
namespace mod_bigbluebuttonbn\output;
use mod_bigbluebuttonbn\instance;
use mod_bigbluebuttonbn\local\bigbluebutton\recordings\recording_data;
use mod_bigbluebuttonbn\local\config;
use mod_bigbluebuttonbn\recording;
use pix_icon;
use renderable;
@@ -44,6 +41,7 @@ class recording_row_actionbar implements renderable, templatable {
* @var $tools
*/
protected $tools;
/**
* @var array TOOLS_DEFINITION a list of definition for the the specific tools
*/
@@ -153,7 +151,7 @@ class recording_row_actionbar implements renderable, templatable {
);
$iconortext = $output->render($icon);
$actionlink = new \action_link(new \moodle_url('#'), $iconortext, null, $linkattributes);
$context->tools [] = $actionlink->export_for_template($output);
$context->tools[] = $actionlink->export_for_template($output);
}
}
@@ -49,7 +49,7 @@ class recording_row_playback implements renderable, templatable {
* recording_row_playback constructor.
*
* @param recording $rec
* @param instance $instance
* @param instance|null $instance $instance
*/
public function __construct(recording $rec, ?instance $instance) {
$this->instance = $instance ?? null;
@@ -162,7 +162,6 @@ class upgrade_recordings_task extends adhoc_task {
* @param string $meetingid
* @param bool $isimported
* @return array
* @throws \dml_exception
*/
protected function get_sql_query_for_logs(string $meetingid, bool $isimported): array {
global $DB;
@@ -187,7 +186,6 @@ class upgrade_recordings_task extends adhoc_task {
*
* @param bool $importedrecordings
* @return void
* @throws \coding_exception
* @throws \dml_exception
*/
public static function schedule_upgrade_per_meeting($importedrecordings = false) {
-2
View File
@@ -28,8 +28,6 @@ use mod_bigbluebuttonbn\plugin;
use mod_bigbluebuttonbn\local\config;
use mod_bigbluebuttonbn\task\upgrade_recordings_task;
defined('MOODLE_INTERNAL') || die();
/**
* Performs data migrations and updates on upgrade.
*
+1 -1
View File
@@ -33,4 +33,4 @@
.bbb_index_form {
display: inline-block;
}
}
@@ -40,6 +40,8 @@ require_once($CFG->libdir . "/phpunit/classes/restore_date_testcase.php");
* @copyright 2018 - present, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Laurent David ([email protected])
* @covers \backup_bigbluebuttonbn_activity_task
* @covers \restore_bigbluebuttonbn_activity_task
*/
class backup_restore_test extends restore_date_testcase {
use testcase_helper_trait;
@@ -1,8 +1,6 @@
@mod @mod_bigbluebuttonbn @javascript
Feature: I can edit a bigbluebutton instance
In order to edit a room activity with recordings
As a user
I need to add three room activities to an existent course
As a user I can edit a BigbluebuttonBN instance
Background: Make sure that a course is created
Given a BigBlueButton mock server is configured
+2 -2
View File
@@ -33,7 +33,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
* @category test
* @copyright 2021 Andrew Lyons <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @coversDefaultClass \mod_bigbluebuttonbn\external\can_join
* @covers \mod_bigbluebuttonbn\external\can_join
*/
class can_join_test extends \externallib_advanced_testcase {
use testcase_helper_trait;
@@ -48,7 +48,7 @@ class can_join_test extends \externallib_advanced_testcase {
/**
* Helper
*
* @param ... $params
* @param mixed ...$params
* @return mixed
*/
protected function can_join(...$params) {
@@ -34,7 +34,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
* @copyright 2021 - present, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Laurent David ([email protected])
* @coversDefaultClass \mod_bigbluebuttonbn\external\completion_validate
* @covers \mod_bigbluebuttonbn\external\completion_validate
*/
class completion_validate_test extends \externallib_advanced_testcase {
use testcase_helper_trait;
@@ -50,7 +50,7 @@ class completion_validate_test extends \externallib_advanced_testcase {
/**
* Helper
*
* @param ... $params
* @param mixed ...$params
* @return mixed
*/
protected function completion_validate(...$params) {
+2 -2
View File
@@ -35,7 +35,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
* @package mod_bigbluebuttonbn
* @copyright 2021 Andrew Lyons <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @coversDefaultClass \mod_bigbluebuttonbn\external\end_meeting
* @covers \mod_bigbluebuttonbn\external\end_meeting
*/
class end_meeting_test extends \externallib_advanced_testcase {
use testcase_helper_trait;
@@ -50,7 +50,7 @@ class end_meeting_test extends \externallib_advanced_testcase {
/**
* Helper
*
* @param ... $params
* @param mixed ...$params
* @return array|bool|mixed
*/
protected function end_meeting(...$params) {
@@ -34,7 +34,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
* @copyright 2021 - present, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Laurent David ([email protected])
* @coversDefaultClass \mod_bigbluebuttonbn\external\get_bigbluebuttonbns_by_courses
* @covers \mod_bigbluebuttonbn\external\get_bigbluebuttonbns_by_courses
*/
class get_bigbluebuttons_by_courses_test extends \externallib_advanced_testcase {
use testcase_helper_trait;
@@ -50,7 +50,7 @@ class get_bigbluebuttons_by_courses_test extends \externallib_advanced_testcase
/**
* Helper
*
* @param ... $params
* @param mixed ...$params
* @return mixed
*/
protected function get_bigbluebuttons_by_courses(...$params) {
+2 -2
View File
@@ -35,7 +35,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
* @copyright 2021 - present, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Laurent David ([email protected])
* @coversDefaultClass \mod_bigbluebuttonbn\external\get_join_url
* @covers \mod_bigbluebuttonbn\external\get_join_url
*/
class get_join_url_test extends \externallib_advanced_testcase {
use testcase_helper_trait;
@@ -51,7 +51,7 @@ class get_join_url_test extends \externallib_advanced_testcase {
/**
* Helper
*
* @param ... $params
* @param mixed ...$params
* @return mixed
*/
protected function get_join_url(...$params) {
+11 -4
View File
@@ -34,7 +34,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
* @copyright 2021 - present, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Laurent David ([email protected])
* @coversDefaultClass \mod_bigbluebuttonbn\external\get_recordings
* @covers \mod_bigbluebuttonbn\external\get_recordings
*/
class get_recordings_test extends \externallib_advanced_testcase {
use testcase_helper_trait;
@@ -50,7 +50,7 @@ class get_recordings_test extends \externallib_advanced_testcase {
/**
* Helper
*
* @param ... $params
* @param mixed ...$params
* @return array|bool|mixed
*/
protected function get_recordings(...$params) {
@@ -123,7 +123,7 @@ class get_recordings_test extends \externallib_advanced_testcase {
$this->assertArrayHasKey('status', $getrecordings);
$this->assertEquals(true, $getrecordings['status']);
$this->assertNotEmpty($getrecordings['tabledata']);
$this->assertEquals($getrecordings['tabledata']['data'], '[]');
$this->assertEquals('[]', $getrecordings['tabledata']['data']);
}
/**
@@ -368,7 +368,14 @@ class get_recordings_test extends \externallib_advanced_testcase {
/**
* Check if recording are visible/invisible depending on the group.
*
* @covers \mod_bigbluebuttonbn\external\get_recordings::execute
* @param string $type
* @param array $groups
* @param array $users
* @param array $recordingsdata
* @param array $test
* @param int $coursemode
*
* @covers \mod_bigbluebuttonbn\external\get_recordings::execute
* @dataProvider recording_group_test_data
*/
public function test_get_recordings_groups($type, $groups, $users, $recordingsdata, $test, $coursemode) {
@@ -35,7 +35,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
* @copyright 2021 - present, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Laurent David ([email protected])
* @coversDefaultClass \mod_bigbluebuttonbn\external\view_bigbluebuttonbn
* @covers \mod_bigbluebuttonbn\external\view_bigbluebuttonbn
*/
class view_bigbluebuttonbn_test extends \externallib_advanced_testcase {
use testcase_helper_trait;
@@ -51,7 +51,7 @@ class view_bigbluebuttonbn_test extends \externallib_advanced_testcase {
/**
* Helper
*
* @param ... $params
* @param mixed ...$params
* @return mixed
*/
protected function view_bigbluebuttonbn(...$params) {
@@ -24,8 +24,6 @@
* @author Laurent David ([email protected])
*/
defined('MOODLE_INTERNAL') || die();
/**
* Behat data generator for behat_mod_bigbluebuttonbn_generator.
*
+7 -1
View File
@@ -101,6 +101,7 @@ class instance_test extends advanced_testcase {
/**
* If the instance was not found, and exception should be thrown.
* @covers ::get_from_instanceid
*/
public function test_get_from_instance_not_found(): void {
$this->assertNull(instance::get_from_instanceid(100));
@@ -194,7 +195,7 @@ class instance_test extends advanced_testcase {
$course = $this->getDataGenerator()->create_course();
$records = [];
for ($i = 0; $i < 5; $i++) {
$records[] = $this->getDataGenerator()->create_module('bigbluebuttonbn', [
$this->getDataGenerator()->create_module('bigbluebuttonbn', [
'course' => $course->id,
]);
}
@@ -303,6 +304,7 @@ class instance_test extends advanced_testcase {
* @param null|int $openingtime
* @param null|int $closingtime
* @param bool $expected
* @covers ::is_currently_open
*/
public function test_is_currently_open(?int $openingtime, ?int $closingtime, bool $expected): void {
$stub = $this->getMockBuilder(instance::class)
@@ -337,6 +339,7 @@ class instance_test extends advanced_testcase {
* @param bool $ismoderator
* @param bool $haswaitingroom
* @param bool $expected
* @covers ::user_must_wait_to_join
*/
public function test_user_must_wait_to_join(bool $isadmin, bool $ismoderator, bool $haswaitingroom, bool $expected): void {
$stub = $this->getMockBuilder(instance::class)
@@ -378,6 +381,7 @@ class instance_test extends advanced_testcase {
* @param bool $isadmin
* @param bool $ismoderator
* @param bool $expected
* @covers ::does_current_user_count_towards_user_limit
*/
public function test_does_current_user_count_towards_user_limit(
bool $isadmin,
@@ -418,6 +422,7 @@ class instance_test extends advanced_testcase {
* @param bool $isadmin
* @param bool $ismoderator
* @param bool $expectedmodpassword
* @covers ::get_current_user_password
*/
public function test_get_current_user_password(bool $isadmin, bool $ismoderator, bool $expectedmodpassword): void {
$stub = $this->getMockBuilder(instance::class)
@@ -462,6 +467,7 @@ class instance_test extends advanced_testcase {
* @param bool $isrecorded
* @param bool $showbuttons
* @param bool $expected
* @covers ::allow_recording_start_stop
*/
public function test_allow_recording_start_stop(
bool $isrecorded,
+2 -2
View File
@@ -301,11 +301,11 @@ class lib_test extends \advanced_testcase {
continue;
}
if (!empty($filter) and $cm->modname != $filter) {
if (!empty($filter) && $cm->modname != $filter) {
continue;
}
if (!empty($filtermodid) and $cmid != $filtermodid) {
if (!empty($filtermodid) && $cmid != $filtermodid) {
continue;
}
@@ -93,7 +93,8 @@ class files_test extends \advanced_testcase {
$instance = instance::get_from_instanceid($bbactivity->id);
$cm = $instance->get_cm();
$cmrecord = $cm->get_course_module_record();
$mediafilename = files::get_plugin_filename($this->get_course(), $cmrecord, $instance->get_context(), ['presentation.pptx']);
$mediafilename =
files::get_plugin_filename($this->get_course(), $cmrecord, $instance->get_context(), ['presentation.pptx']);
$this->assertEquals('presentation.pptx', $mediafilename);
}
@@ -199,7 +200,7 @@ class files_test extends \advanced_testcase {
/**
* Create a user and an activity
*
* @param null $presentationfilename
* @param string|null $presentationpath
* @param bool $closed
* @return array
*/
@@ -13,7 +13,11 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace mod_bigbluebuttonbn;
use advanced_testcase;
use context_course;
use context_module;
use mod_bigbluebuttonbn\instance;
use mod_bigbluebuttonbn\test\testcase_helper_trait;
@@ -29,6 +33,8 @@ require_once($CFG->dirroot . '/search/tests/fixtures/testable_core_search.php');
* @copyright 2021 - present, Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Laurent David ([email protected])
* @covers \mod_bigbluebuttonbn\search\tags
* @covers \mod_bigbluebuttonbn\search\activity
*/
class search_test extends advanced_testcase {
use testcase_helper_trait;