diff --git a/addlti.php b/addlti.php
index ff33b685..23f0df6a 100644
--- a/addlti.php
+++ b/addlti.php
@@ -39,13 +39,13 @@
$seriesid = required_param('seriesid', PARAM_ALPHANUMEXT);
// Set base URL.
-$baseurl = new moodle_url('/blocks/opencast/addlti.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$baseurl = new moodle_url('/blocks/opencast/addlti.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$PAGE->set_url($baseurl);
// Remember URLs for redirecting.
$redirecturloverview = new moodle_url('/blocks/opencast/index.php',
- array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
-$redirecturlcourse = new moodle_url('/course/view.php', array('id' => $courseid));
+ ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
+$redirecturlcourse = new moodle_url('/course/view.php', ['id' => $courseid]);
$redirecturlcancel = $redirecturloverview;
// Require login and course membership.
@@ -77,7 +77,7 @@
// Use Add LTI form.
$addltiform = new addlti_form(null,
- array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid, 'seriesid' => $seriesid));
+ ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid, 'seriesid' => $seriesid]);
// Get API bridge instance.
$apibridge = apibridge::get_instance($ocinstanceid);
diff --git a/backup/moodle2/backup_opencast_block_task.class.php b/backup/moodle2/backup_opencast_block_task.class.php
index 28a4ccfc..21bd5199 100644
--- a/backup/moodle2/backup_opencast_block_task.class.php
+++ b/backup/moodle2/backup_opencast_block_task.class.php
@@ -42,14 +42,13 @@
* @author Andreas Wagner
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class backup_opencast_block_task extends backup_block_task
-{
+class backup_opencast_block_task extends backup_block_task {
+
/**
* Add a setting to backup process, when course videos are available.
*/
- protected function define_my_settings()
- {
+ protected function define_my_settings() {
$ocinstances = settings_api::get_ocinstances();
foreach ($ocinstances as $ocinstance) {
// Check whether this feature is enabled and working at all.
@@ -89,8 +88,7 @@ protected function define_my_settings()
/**
* Add the structure step, when course videos are available.
*/
- protected function define_my_steps()
- {
+ protected function define_my_steps() {
$ocinstances = settings_api::get_ocinstances();
foreach ($ocinstances as $ocinstance) {
if (!$this->setting_exists('opencast_videos_include_' . $ocinstance->id)) {
@@ -108,8 +106,7 @@ protected function define_my_steps()
* No file areas are controlled by this block.
* @return array
*/
- public function get_fileareas()
- {
+ public function get_fileareas() {
return [];
}
@@ -117,8 +114,7 @@ public function get_fileareas()
* We don't need to encode attrs in configdata.
* @return array
*/
- public function get_configdata_encoded_attributes()
- {
+ public function get_configdata_encoded_attributes() {
return [];
}
@@ -127,8 +123,7 @@ public function get_configdata_encoded_attributes()
* @param string $content
* @return string
*/
- public static function encode_content_links($content)
- {
+ public static function encode_content_links($content) {
return $content;
}
diff --git a/backup/moodle2/backup_opencast_stepslib.php b/backup/moodle2/backup_opencast_stepslib.php
index 6b2d1973..ea900c58 100644
--- a/backup/moodle2/backup_opencast_stepslib.php
+++ b/backup/moodle2/backup_opencast_stepslib.php
@@ -38,8 +38,7 @@
* @copyright 2018 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class backup_opencast_block_structure_step extends backup_block_structure_step
-{
+class backup_opencast_block_structure_step extends backup_block_structure_step {
/**
* Defines the structure of the backup file.
@@ -48,8 +47,7 @@ class backup_opencast_block_structure_step extends backup_block_structure_step
* @throws base_step_exception
* @throws dml_exception
*/
- protected function define_structure()
- {
+ protected function define_structure() {
$ocinstanceid = intval(ltrim($this->get_name(), "opencast_structure_"));
// Root.
diff --git a/backup/moodle2/restore_opencast_block_task.class.php b/backup/moodle2/restore_opencast_block_task.class.php
index 5d13d78c..8f6050f3 100644
--- a/backup/moodle2/restore_opencast_block_task.class.php
+++ b/backup/moodle2/restore_opencast_block_task.class.php
@@ -35,8 +35,8 @@
/**
* Define settings of the restore tasks for the opencast block.
*/
-class restore_opencast_block_task extends restore_block_task
-{
+class restore_opencast_block_task extends restore_block_task {
+
/**
* Check, if it is possible to restore events into given target course.
@@ -47,8 +47,7 @@ class restore_opencast_block_task extends restore_block_task
* @param int $ocinstanceid Opencast instance id.
* @return boolean
*/
- private function can_restore_events($ocinstanceid)
- {
+ private function can_restore_events($ocinstanceid) {
$apibridge = apibridge::get_instance($ocinstanceid);
$courseid = $this->get_courseid();
@@ -69,8 +68,7 @@ private function can_restore_events($ocinstanceid)
* 1. course videos are available in backupfile AND
* 2. target course has not yet an assigned series.
*/
- protected function define_my_settings()
- {
+ protected function define_my_settings() {
$ocinstances = settings_api::get_ocinstances();
if (empty($ocinstances)) {
throw new dml_exception('dmlreadexception', null,
@@ -97,8 +95,7 @@ protected function define_my_settings()
/**
* Add a restore step, when required.
*/
- protected function define_my_steps()
- {
+ protected function define_my_steps() {
$ocinstances = settings_api::get_ocinstances();
if (empty($ocinstances)) {
throw new dml_exception('dmlreadexception', null,
@@ -126,8 +123,7 @@ protected function define_my_steps()
* No file areas are controlled by this block.
* @return array
*/
- public function get_fileareas()
- {
+ public function get_fileareas() {
return [];
}
@@ -135,17 +131,15 @@ public function get_fileareas()
* We don't need to encode attrs in configdata.
* @return array
*/
- public function get_configdata_encoded_attributes()
- {
- return array(); // We need to encode some attrs in configdata.
+ public function get_configdata_encoded_attributes() {
+ return []; // We need to encode some attrs in configdata.
}
/**
* Define the decoding rules for links belonging
* to the activity to be executed by the link decoder.
*/
- public static function define_decode_rules()
- {
+ public static function define_decode_rules() {
return [];
}
@@ -153,8 +147,7 @@ public static function define_decode_rules()
* Define the contents in the activity that must be
* processed by the link decoder
*/
- public static function define_decode_contents()
- {
+ public static function define_decode_contents() {
return [];
}
diff --git a/backup/moodle2/restore_opencast_stepslib.php b/backup/moodle2/restore_opencast_stepslib.php
index 51023d0e..1101bab9 100644
--- a/backup/moodle2/restore_opencast_stepslib.php
+++ b/backup/moodle2/restore_opencast_stepslib.php
@@ -36,8 +36,8 @@
* @copyright 2018 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class restore_opencast_block_structure_step extends restore_structure_step
-{
+class restore_opencast_block_structure_step extends restore_structure_step {
+
/** @var array Ids of the videos included in the backup. */
private $backupeventids = [];
@@ -57,8 +57,7 @@ class restore_opencast_block_structure_step extends restore_structure_step
*
* @return array of @restore_path_element elements
*/
- protected function define_structure()
- {
+ protected function define_structure() {
global $USER;
$ocinstanceid = intval(ltrim($this->get_name(), "opencast_structure_"));
$this->ocinstanceid = $ocinstanceid;
@@ -66,7 +65,7 @@ protected function define_structure()
// Check, target series.
$courseid = $this->get_courseid();
- $paths = array();
+ $paths = [];
// Get apibridge instance.
$apibridge = apibridge::get_instance($ocinstanceid);
@@ -105,8 +104,7 @@ protected function define_structure()
* @param array $data the event identifier
* @return void
*/
- public function process_event($data)
- {
+ public function process_event($data) {
$data = (object)$data;
// Collect eventids for notification.
@@ -136,8 +134,7 @@ public function process_event($data)
* @throws dml_exception
* @throws moodle_exception
*/
- public function process_series($data)
- {
+ public function process_series($data) {
global $USER;
$data = (object)$data;
@@ -168,8 +165,7 @@ public function process_series($data)
* @param array $data The import data needed for ACL change mode.
* @return void
*/
- public function process_import($data)
- {
+ public function process_import($data) {
$data = (object)$data;
@@ -183,8 +179,7 @@ public function process_import($data)
*
* @return void
*/
- public function after_restore()
- {
+ public function after_restore() {
$courseid = $this->get_courseid();
diff --git a/backup/moodle2/settings/block_backup_setting.class.php b/backup/moodle2/settings/block_backup_setting.class.php
index 60793185..d351142a 100644
--- a/backup/moodle2/settings/block_backup_setting.class.php
+++ b/backup/moodle2/settings/block_backup_setting.class.php
@@ -29,8 +29,8 @@
* @copyright 2018 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class backup_block_opencast_setting extends backup_setting
-{
+class backup_block_opencast_setting extends backup_setting {
+
/**
* Create an instance of this class. Note that this is used to control level and layout of this setting.
@@ -41,8 +41,7 @@ class backup_block_opencast_setting extends backup_setting
* @param bool $visibility Is the setting visible in the UI
* @param int $status Status of the setting with regards to the locking
*/
- public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED)
- {
+ public function __construct($name, $vtype, $value = null, $visibility = self::VISIBLE, $status = self::NOT_LOCKED) {
$this->level = self::COURSE_LEVEL;
diff --git a/backup/moodle2/settings/block_restore_setting.class.php b/backup/moodle2/settings/block_restore_setting.class.php
index 01804e92..0e88f61e 100644
--- a/backup/moodle2/settings/block_restore_setting.class.php
+++ b/backup/moodle2/settings/block_restore_setting.class.php
@@ -34,6 +34,6 @@
* @copyright 2018 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class restore_block_opencast_setting extends backup_block_opencast_setting
-{
+class restore_block_opencast_setting extends backup_block_opencast_setting {
+
}
diff --git a/classes/admin_setting_configeditabletable.php b/classes/admin_setting_configeditabletable.php
index f6a6372b..6d11c758 100644
--- a/classes/admin_setting_configeditabletable.php
+++ b/classes/admin_setting_configeditabletable.php
@@ -33,8 +33,8 @@
* @copyright 2021 Tamara Gunkel, University of Münster
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class admin_setting_configeditabletable extends admin_setting
-{
+class admin_setting_configeditabletable extends admin_setting {
+
/** @var string Id of the div tag */
private $divid;
/** @var string Text for add button */
@@ -46,8 +46,7 @@ class admin_setting_configeditabletable extends admin_setting
* @param string $divid Id of the div tag
* @param string $buttontext Text of "Add row" button
*/
- public function __construct($name, $divid, $buttontext)
- {
+ public function __construct($name, $divid, $buttontext) {
$this->nosave = true;
$this->divid = $divid;
$this->buttontext = $buttontext;
@@ -59,8 +58,7 @@ public function __construct($name, $divid, $buttontext)
*
* @return bool Always returns true
*/
- public function get_setting()
- {
+ public function get_setting() {
return true;
}
@@ -69,8 +67,7 @@ public function get_setting()
*
* @return bool Always returns true
*/
- public function get_defaultsetting()
- {
+ public function get_defaultsetting() {
return true;
}
@@ -80,8 +77,7 @@ public function get_defaultsetting()
* @param mixed $data Gets converted to str for comparison against yes value
* @return string Always returns an empty string
*/
- public function write_setting($data)
- {
+ public function write_setting($data) {
// Do not write any setting.
return '';
}
@@ -93,8 +89,7 @@ public function write_setting($data)
* @param string $query
* @return string Returns an HTML string
*/
- public function output_html($data, $query = '')
- {
+ public function output_html($data, $query = '') {
return '
';
diff --git a/classes/admin_setting_configtextvalidate.php b/classes/admin_setting_configtextvalidate.php
index 73022468..9abb830f 100644
--- a/classes/admin_setting_configtextvalidate.php
+++ b/classes/admin_setting_configtextvalidate.php
@@ -33,8 +33,8 @@
* @copyright 2022 Tamara Gunkel, University of Münster
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class admin_setting_configtextvalidate extends admin_setting_configtext
-{
+class admin_setting_configtextvalidate extends admin_setting_configtext {
+
/** @var callable|null Validation function */
protected $validatefunction = null;
@@ -46,8 +46,7 @@ class admin_setting_configtextvalidate extends admin_setting_configtext
*
* @param callable|null $validatefunction Validate function or null to clear
*/
- public function set_validate_function(?callable $validatefunction = null)
- {
+ public function set_validate_function(?callable $validatefunction = null) {
$this->validatefunction = $validatefunction;
}
@@ -56,8 +55,7 @@ public function set_validate_function(?callable $validatefunction = null)
* @param string $data New setting data
* @return mixed true if ok string if error found
*/
- public function validate($data)
- {
+ public function validate($data) {
$valid = parent::validate($data);
if ($valid === true) {
// Parent validation was successful.
diff --git a/classes/admin_setting_hiddenhelpbtn.php b/classes/admin_setting_hiddenhelpbtn.php
index 3b331486..41d3e645 100644
--- a/classes/admin_setting_hiddenhelpbtn.php
+++ b/classes/admin_setting_hiddenhelpbtn.php
@@ -33,8 +33,8 @@
* @copyright 2021 Tamara Gunkel, University of Münster
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class admin_setting_hiddenhelpbtn extends admin_setting
-{
+class admin_setting_hiddenhelpbtn extends admin_setting {
+
/** @var string Id of the div tag */
private $divid;
@@ -51,8 +51,7 @@ class admin_setting_hiddenhelpbtn extends admin_setting
* @param string $iconname Icon that is displayed as help button
* @param string $component Component
*/
- public function __construct($name, $divid, $iconname, $component)
- {
+ public function __construct($name, $divid, $iconname, $component) {
$this->nosave = true;
$this->divid = $divid;
$this->iconname = $iconname;
@@ -65,8 +64,7 @@ public function __construct($name, $divid, $iconname, $component)
*
* @return bool Always returns true
*/
- public function get_setting()
- {
+ public function get_setting() {
return true;
}
@@ -75,8 +73,7 @@ public function get_setting()
*
* @return bool Always returns true
*/
- public function get_defaultsetting()
- {
+ public function get_defaultsetting() {
return true;
}
@@ -86,8 +83,7 @@ public function get_defaultsetting()
* @param mixed $data Gets converted to str for comparison against yes value
* @return string Always returns an empty string
*/
- public function write_setting($data)
- {
+ public function write_setting($data) {
// Do not write any setting.
return '';
}
@@ -99,8 +95,7 @@ public function write_setting($data)
* @param string $query
* @return string Returns an HTML string
*/
- public function output_html($data, $query = '')
- {
+ public function output_html($data, $query = '') {
global $OUTPUT;
return '
' .
$OUTPUT->help_icon($this->iconname, $this->component) .
diff --git a/classes/enrolled_user_selector.php b/classes/enrolled_user_selector.php
index e183ab52..3f5f5f36 100644
--- a/classes/enrolled_user_selector.php
+++ b/classes/enrolled_user_selector.php
@@ -33,8 +33,8 @@
* @copyright 2022 Tamara Gunkel, WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class block_opencast_enrolled_user_selector extends user_selector_base
-{
+class block_opencast_enrolled_user_selector extends user_selector_base {
+
/** @var bool|context|context_system|mixed|null Moodle context, usually course */
protected $context;
@@ -43,8 +43,7 @@ class block_opencast_enrolled_user_selector extends user_selector_base
* @param string $name control name
* @param array $options should have two elements with keys groupid and courseid.
*/
- public function __construct($name, $options)
- {
+ public function __construct($name, $options) {
if (isset($options['context'])) {
$this->context = $options['context'];
} else {
@@ -57,8 +56,7 @@ public function __construct($name, $options)
* Get options supported by the selector.
* @return array
*/
- protected function get_options()
- {
+ protected function get_options() {
$options = parent::get_options();
$options['contextid'] = $this->context->id;
return $options;
@@ -71,8 +69,7 @@ protected function get_options()
* @throws coding_exception
* @throws dml_exception
*/
- public function find_users($search)
- {
+ public function find_users($search) {
global $DB;
list($enrolsql, $eparams) = get_enrolled_sql($this->context);
diff --git a/classes/event/upload_failed.php b/classes/event/upload_failed.php
index cbf63483..67e4e522 100644
--- a/classes/event/upload_failed.php
+++ b/classes/event/upload_failed.php
@@ -34,16 +34,15 @@
* @copyright 2017 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class upload_failed extends base
-{
+class upload_failed extends base {
+
/**
* Init method.
*
* @return void
*/
- protected function init()
- {
+ protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_opencast_uploadjob';
@@ -54,8 +53,7 @@ protected function init()
*
* @return string
*/
- public static function get_name()
- {
+ public static function get_name() {
return get_string('eventuploadfailed', 'block_opencast');
}
@@ -64,8 +62,7 @@ public static function get_name()
*
* @return string
*/
- public function get_description()
- {
+ public function get_description() {
return "The upload of {$this->data['other']['filename']} (Course: {$this->data['courseid']}) " .
"to opencast instance {$this->data['ocinstanceid']} failed {$this->data['other']['countfailed']} times, " .
"Reason: {$this->data['other']['errormessage']}";
@@ -76,8 +73,7 @@ public function get_description()
*
* @return moodle_url
*/
- public function get_url()
- {
+ public function get_url() {
return new moodle_url('/blocks/opencast/index.php',
['courseid' => $this->data['courseid'], 'ocinstanceid' => $this->data['ocinstanceid']]);
}
diff --git a/classes/event/upload_succeeded.php b/classes/event/upload_succeeded.php
index af1d99f9..613f1e2f 100644
--- a/classes/event/upload_succeeded.php
+++ b/classes/event/upload_succeeded.php
@@ -34,16 +34,15 @@
* @copyright 2017 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class upload_succeeded extends base
-{
+class upload_succeeded extends base {
+
/**
* Init method.
*
* @return void
*/
- protected function init()
- {
+ protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_opencast_uploadjob';
@@ -54,8 +53,7 @@ protected function init()
*
* @return string
*/
- public static function get_name()
- {
+ public static function get_name() {
return get_string('eventuploadsucceeded', 'block_opencast');
}
@@ -64,8 +62,7 @@ public static function get_name()
*
* @return string
*/
- public function get_description()
- {
+ public function get_description() {
return "the upload of {$this->data['other']['filename']} (Course: {$this->data['courseid']}) " .
"to opencast instance {$this->data['other']['ocinstanceid']} was successful.";
}
@@ -75,8 +72,7 @@ public function get_description()
*
* @return moodle_url
*/
- public function get_url()
- {
+ public function get_url() {
return new moodle_url('/blocks/opencast/index.php',
['courseid' => $this->data['courseid'], 'ocinstanceid' => $this->data['other']['ocinstanceid']]);
}
diff --git a/classes/external.php b/classes/external.php
index c36898af..1f45a7e5 100644
--- a/classes/external.php
+++ b/classes/external.php
@@ -38,16 +38,15 @@
* @copyright 2021 Tamara Gunkel
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class block_opencast_external extends external_api
-{
+class block_opencast_external extends external_api {
+
/**
* Returns description of method parameters
*
* @return external_function_parameters
*/
- public static function submit_series_form_parameters()
- {
+ public static function submit_series_form_parameters() {
return new external_function_parameters([
'contextid' => new external_value(PARAM_INT, 'The context id for the course'),
'ocinstanceid' => new external_value(PARAM_INT, 'The Opencast instance id'),
@@ -61,8 +60,7 @@ public static function submit_series_form_parameters()
*
* @return external_function_parameters
*/
- public static function get_series_titles_parameters()
- {
+ public static function get_series_titles_parameters() {
return new external_function_parameters([
'contextid' => new external_value(PARAM_INT, 'The context id for the course'),
'ocinstanceid' => new external_value(PARAM_INT, 'The Opencast instance id'),
@@ -75,8 +73,7 @@ public static function get_series_titles_parameters()
*
* @return external_function_parameters
*/
- public static function import_series_parameters()
- {
+ public static function import_series_parameters() {
return new external_function_parameters([
'contextid' => new external_value(PARAM_INT, 'The context id for the course'),
'ocinstanceid' => new external_value(PARAM_INT, 'The Opencast instance id'),
@@ -89,8 +86,7 @@ public static function import_series_parameters()
*
* @return external_function_parameters
*/
- public static function unlink_series_parameters()
- {
+ public static function unlink_series_parameters() {
return new external_function_parameters([
'contextid' => new external_value(PARAM_INT, 'The context id for the course'),
'ocinstanceid' => new external_value(PARAM_INT, 'The Opencast instance id'),
@@ -103,8 +99,7 @@ public static function unlink_series_parameters()
*
* @return external_function_parameters
*/
- public static function set_default_series_parameters()
- {
+ public static function set_default_series_parameters() {
return new external_function_parameters([
'contextid' => new external_value(PARAM_INT, 'The context id for the course'),
'ocinstanceid' => new external_value(PARAM_INT, 'The Opencast instance id'),
@@ -117,8 +112,7 @@ public static function set_default_series_parameters()
*
* @return external_function_parameters
*/
- public static function get_liveupdate_info_parameters()
- {
+ public static function get_liveupdate_info_parameters() {
return new external_function_parameters([
'contextid' => new external_value(PARAM_INT, 'The context id for the course'),
'ocinstanceid' => new external_value(PARAM_INT, 'The Opencast instance id'),
@@ -137,8 +131,7 @@ public static function get_liveupdate_info_parameters()
*
* @return string new series id
*/
- public static function submit_series_form($contextid, int $ocinstanceid, string $seriesid, string $jsonformdata)
- {
+ public static function submit_series_form($contextid, int $ocinstanceid, string $seriesid, string $jsonformdata) {
global $USER, $DB;
$params = self::validate_parameters(self::submit_series_form_parameters(), [
@@ -169,7 +162,7 @@ public static function submit_series_form($contextid, int $ocinstanceid, string
$metadatacatalog = !empty($metadatacatalog) ? $metadatacatalog : [];
$createseriesform = new series_form(null, ['courseid' => $course->id,
'ocinstanceid' => $params['ocinstanceid'],
- 'metadata_catalog' => $metadatacatalog,], 'post', '', null, true, $data);
+ 'metadata_catalog' => $metadatacatalog, ], 'post', '', null, true, $data);
$validateddata = $createseriesform->get_data();
if ($validateddata) {
@@ -215,8 +208,7 @@ public static function submit_series_form($contextid, int $ocinstanceid, string
*
* @return string Series titles
*/
- public static function get_series_titles(int $contextid, int $ocinstanceid, string $series)
- {
+ public static function get_series_titles(int $contextid, int $ocinstanceid, string $series) {
$params = self::validate_parameters(self::get_series_titles_parameters(), [
'contextid' => $contextid,
'ocinstanceid' => $ocinstanceid,
@@ -249,8 +241,7 @@ public static function get_series_titles(int $contextid, int $ocinstanceid, stri
*
* @return bool True if successful
*/
- public static function import_series(int $contextid, int $ocinstanceid, string $series)
- {
+ public static function import_series(int $contextid, int $ocinstanceid, string $series) {
global $USER, $DB;
$params = self::validate_parameters(self::import_series_parameters(), [
'contextid' => $contextid,
@@ -295,8 +286,7 @@ public static function import_series(int $contextid, int $ocinstanceid, string $
*
* @return bool True if successful
*/
- public static function unlink_series(int $contextid, int $ocinstanceid, string $series)
- {
+ public static function unlink_series(int $contextid, int $ocinstanceid, string $series) {
$params = self::validate_parameters(self::unlink_series_parameters(), [
'contextid' => $contextid,
'ocinstanceid' => $ocinstanceid,
@@ -310,7 +300,7 @@ public static function unlink_series(int $contextid, int $ocinstanceid, string $
list($unused, $course, $cm) = get_context_info_array($context->id);
$mapping = seriesmapping::get_record(['ocinstanceid' => $params['ocinstanceid'], 'courseid' => $course->id,
- 'series' => $params['seriesid'],], true);
+ 'series' => $params['seriesid'], ], true);
if ($mapping) {
if (!$mapping->delete()) {
@@ -338,8 +328,7 @@ public static function unlink_series(int $contextid, int $ocinstanceid, string $
*
* @return bool True if successful
*/
- public static function set_default_series(int $contextid, int $ocinstanceid, string $series)
- {
+ public static function set_default_series(int $contextid, int $ocinstanceid, string $series) {
$params = self::validate_parameters(self::set_default_series_parameters(), [
'contextid' => $contextid,
'ocinstanceid' => $ocinstanceid,
@@ -353,7 +342,7 @@ public static function set_default_series(int $contextid, int $ocinstanceid, str
list($unused, $course, $cm) = get_context_info_array($context->id);
$olddefaultseries = seriesmapping::get_record(['ocinstanceid' => $params['ocinstanceid'],
- 'courseid' => $course->id, 'isdefault' => true,]);
+ 'courseid' => $course->id, 'isdefault' => true, ]);
// Series is already set as default.
if ($olddefaultseries->get('series') == $params['seriesid']) {
@@ -362,7 +351,7 @@ public static function set_default_series(int $contextid, int $ocinstanceid, str
// Set new series as default.
$mapping = seriesmapping::get_record(['ocinstanceid' => $params['ocinstanceid'],
- 'courseid' => $course->id, 'series' => $params['seriesid'],], true);
+ 'courseid' => $course->id, 'series' => $params['seriesid'], ], true);
if ($mapping) {
$mapping->set('isdefault', true);
@@ -392,8 +381,7 @@ public static function set_default_series(int $contextid, int $ocinstanceid, str
*
* @return string Latest update state info
*/
- public static function get_liveupdate_info(int $contextid, int $ocinstanceid, string $type, string $identifier)
- {
+ public static function get_liveupdate_info(int $contextid, int $ocinstanceid, string $type, string $identifier) {
$params = self::validate_parameters(self::get_liveupdate_info_parameters(), [
'contextid' => $contextid,
'ocinstanceid' => $ocinstanceid,
@@ -430,8 +418,7 @@ public static function get_liveupdate_info(int $contextid, int $ocinstanceid, st
*
* @return external_description
*/
- public static function submit_series_form_returns()
- {
+ public static function submit_series_form_returns() {
return new external_value(PARAM_RAW, 'Json series data');
}
@@ -440,8 +427,7 @@ public static function submit_series_form_returns()
*
* @return external_description
*/
- public static function get_series_titles_returns()
- {
+ public static function get_series_titles_returns() {
return new external_value(PARAM_RAW, 'json array for the series');
}
@@ -450,8 +436,7 @@ public static function get_series_titles_returns()
*
* @return external_description
*/
- public static function import_series_returns()
- {
+ public static function import_series_returns() {
return new external_value(PARAM_RAW, 'Json series data');
}
@@ -460,8 +445,7 @@ public static function import_series_returns()
*
* @return external_description
*/
- public static function unlink_series_returns()
- {
+ public static function unlink_series_returns() {
return new external_value(PARAM_BOOL, 'True if successful');
}
@@ -470,8 +454,7 @@ public static function unlink_series_returns()
*
* @return external_description
*/
- public static function set_default_series_returns()
- {
+ public static function set_default_series_returns() {
return new external_value(PARAM_BOOL, 'True if successful');
}
@@ -480,8 +463,7 @@ public static function set_default_series_returns()
*
* @return external_description
*/
- public static function get_liveupdate_info_returns()
- {
+ public static function get_liveupdate_info_returns() {
return new external_value(PARAM_RAW, 'Json live update info');
}
}
diff --git a/classes/groupaccess.php b/classes/groupaccess.php
index 05158d50..3419dcf5 100644
--- a/classes/groupaccess.php
+++ b/classes/groupaccess.php
@@ -33,8 +33,8 @@
* @copyright 2018 Tobias Reischmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class groupaccess extends persistent
-{
+class groupaccess extends persistent {
+
/** Table name for the persistent. */
const TABLE = 'block_opencast_groupaccess';
@@ -44,8 +44,7 @@ class groupaccess extends persistent
*
* @return array
*/
- protected static function define_properties()
- {
+ protected static function define_properties() {
return [
'id' => [
'type' => PARAM_INT,
diff --git a/classes/local/activitymodulemanager.php b/classes/local/activitymodulemanager.php
index 6e5b68f1..a51798f5 100644
--- a/classes/local/activitymodulemanager.php
+++ b/classes/local/activitymodulemanager.php
@@ -38,8 +38,8 @@
* @copyright 2021 Justus Dieckmann WWU, 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class activitymodulemanager
-{
+class activitymodulemanager {
+
/**
* Helperfunction to get the status of the Opencast series feature.
@@ -48,8 +48,7 @@ class activitymodulemanager
* @param int $ocinstanceid Opencast instance id
* @return boolean
*/
- public static function is_enabled_and_working_for_series($ocinstanceid): bool
- {
+ public static function is_enabled_and_working_for_series($ocinstanceid): bool {
return get_config('block_opencast', 'addactivityenabled_' . $ocinstanceid) != false &&
core_plugin_manager::instance()->get_plugin_info('mod_opencast') != null;
}
@@ -61,8 +60,7 @@ public static function is_enabled_and_working_for_series($ocinstanceid): bool
* @param int $ocinstanceid Opencast instance id
* @return boolean
*/
- public static function is_enabled_and_working_for_episodes($ocinstanceid)
- {
+ public static function is_enabled_and_working_for_episodes($ocinstanceid) {
return get_config('block_opencast', 'addactivityepisodeenabled_' . $ocinstanceid) != false &&
core_plugin_manager::instance()->get_plugin_info('mod_opencast') != null;
}
@@ -83,8 +81,7 @@ public static function is_enabled_and_working_for_episodes($ocinstanceid)
* @return boolean
*/
public static function create_module_for_series($courseid, $ocinstanceid, $title, $seriesid, $sectionid = 0, $introtext = '',
- $introformat = FORMAT_HTML, $availability = null, $allowdownload = false)
- {
+ $introformat = FORMAT_HTML, $availability = null, $allowdownload = false) {
global $CFG, $DB;
// Require mod library.
@@ -139,8 +136,7 @@ public static function create_module_for_series($courseid, $ocinstanceid, $title
*/
public static function create_module_for_episode($courseid, $ocinstanceid, $title, $episodeuuid, $sectionid = 0,
$introtext = '', $introformat = FORMAT_HTML, $availability = null,
- $allowdownload = false)
- {
+ $allowdownload = false) {
global $CFG, $DB;
// Require mod library.
@@ -197,8 +193,7 @@ public static function create_module_for_episode($courseid, $ocinstanceid, $titl
*/
public static function build_activity_modinfo($pluginid, $course, $ocinstanceid, $title, $sectionid, $opencastid, $type,
$introtext = '', $introformat = FORMAT_HTML, $availability = null,
- $allowdownload = false)
- {
+ $allowdownload = false) {
global $DB;
// Create standard class object.
@@ -250,18 +245,17 @@ public static function build_activity_modinfo($pluginid, $course, $ocinstanceid,
*
* @return int|boolean
*/
- public static function get_module_for_series($ocinstanceid, $courseid, $seriesid)
- {
+ public static function get_module_for_series($ocinstanceid, $courseid, $seriesid) {
global $DB;
// Get the Opencast Activity series module id.
if (get_config('mod_opencast', 'version') >= 2021091200) {
$instance = $DB->get_field('opencast', 'id', ['course' => $courseid,
- 'type' => opencasttype::SERIES, 'opencastid' => $seriesid, 'ocinstanceid' => $ocinstanceid,], IGNORE_MULTIPLE);
+ 'type' => opencasttype::SERIES, 'opencastid' => $seriesid, 'ocinstanceid' => $ocinstanceid, ], IGNORE_MULTIPLE);
} else {
// Ensure backwards compatibility since ocinstanceid does not exist before.
$instance = $DB->get_field('opencast', 'id', ['course' => $courseid,
- 'type' => opencasttype::SERIES, 'opencastid' => $seriesid,], IGNORE_MULTIPLE);
+ 'type' => opencasttype::SERIES, 'opencastid' => $seriesid, ], IGNORE_MULTIPLE);
}
// If there is a Opencast Activity series module found.
@@ -292,17 +286,16 @@ public static function get_module_for_series($ocinstanceid, $courseid, $seriesid
*
* @return int|boolean
*/
- public static function get_module_for_episode($courseid, $episodeuuid, $ocinstanceid)
- {
+ public static function get_module_for_episode($courseid, $episodeuuid, $ocinstanceid) {
global $DB;
// Get the Opencast Activity series module id.
if (get_config('mod_opencast', 'version') >= 2021091200) {
$instance = $DB->get_field('opencast', 'id', ['course' => $courseid,
- 'opencastid' => $episodeuuid, 'type' => opencasttype::EPISODE, 'ocinstanceid' => $ocinstanceid,], IGNORE_MULTIPLE);
+ 'opencastid' => $episodeuuid, 'type' => opencasttype::EPISODE, 'ocinstanceid' => $ocinstanceid, ], IGNORE_MULTIPLE);
} else {
$instance = $DB->get_field('opencast', 'id', ['course' => $courseid,
- 'opencastid' => $episodeuuid, 'type' => opencasttype::EPISODE,], IGNORE_MULTIPLE);
+ 'opencastid' => $episodeuuid, 'type' => opencasttype::EPISODE, ], IGNORE_MULTIPLE);
}
// If there is a Opencast Activity series module found.
@@ -331,8 +324,7 @@ public static function get_module_for_episode($courseid, $episodeuuid, $ocinstan
* @param int $ocinstanceid Opencast instance id
* @return string
*/
- public static function get_default_title_for_series($ocinstanceid)
- {
+ public static function get_default_title_for_series($ocinstanceid) {
// Get the default title from the admin settings.
$defaulttitle = get_config('block_opencast', 'addactivitydefaulttitle_' . $ocinstanceid);
@@ -354,8 +346,7 @@ public static function get_default_title_for_series($ocinstanceid)
*
* @return string
*/
- public static function get_default_title_for_episode($ocinstanceid, $episodeuuid)
- {
+ public static function get_default_title_for_episode($ocinstanceid, $episodeuuid) {
// Get an APIbridge instance.
$apibridge = apibridge::get_instance($ocinstanceid);
@@ -390,8 +381,7 @@ public static function get_default_title_for_episode($ocinstanceid, $episodeuuid
*
* @return string
*/
- public static function get_default_intro_for_episode($ocinstanceid, $episodeuuid)
- {
+ public static function get_default_intro_for_episode($ocinstanceid, $episodeuuid) {
// Get an APIbridge instance.
$apibridge = apibridge::get_instance($ocinstanceid);
@@ -430,8 +420,7 @@ public static function get_default_intro_for_episode($ocinstanceid, $episodeuuid
*
* @return array
*/
- public static function get_course_sections($courseid)
- {
+ public static function get_course_sections($courseid) {
// Get course format.
$courseformat = course_get_format($courseid);
@@ -464,8 +453,7 @@ public static function get_course_sections($courseid)
*
* @return array of course module IDs. The course module ID is used as array key, the references series ID as array value.
*/
- public static function get_modules_for_series_linking_to_other_course($ocinstanceid, $courseid, $referencedcourseid)
- {
+ public static function get_modules_for_series_linking_to_other_course($ocinstanceid, $courseid, $referencedcourseid) {
global $DB;
// Get an APIbridge instance.
@@ -478,7 +466,7 @@ public static function get_modules_for_series_linking_to_other_course($ocinstanc
$seriesmodules = $DB->get_records('opencast', ['ocinstanceid' => $ocinstanceid,
'type' => opencasttype::SERIES,
'course' => $courseid,
- 'opencastid' => $series->series,]);
+ 'opencastid' => $series->series, ]);
// If there are any existing series modules in this course.
if (count($seriesmodules) > 0) {
@@ -510,8 +498,7 @@ public static function get_modules_for_series_linking_to_other_course($ocinstanc
* @return array
*/
public static function get_modules_for_episodes_linking_to_other_course($ocinstanceid, $modulecourseid, $referencedcourseid,
- $onlytheseepisodes = null)
- {
+ $onlytheseepisodes = null) {
// Get an APIbridge instance.
$apibridge = apibridge::get_instance($ocinstanceid);
@@ -554,14 +541,13 @@ public static function get_modules_for_episodes_linking_to_other_course($ocinsta
*
* @return array
*/
- public static function get_modules_for_episode_linking_to_other_course($ocinstanceid, $courseid, $referencedepisodeid)
- {
+ public static function get_modules_for_episode_linking_to_other_course($ocinstanceid, $courseid, $referencedepisodeid) {
global $DB;
$episodemodules = $DB->get_records('opencast', ['ocinstanceid' => $ocinstanceid,
'course' => $courseid,
'type' => opencasttype::EPISODE,
- 'opencastid' => $referencedepisodeid,]);
+ 'opencastid' => $referencedepisodeid, ]);
// Initialize modules to be returned as empty array.
$modules = [];
@@ -592,8 +578,7 @@ public static function get_modules_for_episode_linking_to_other_course($ocinstan
*
* @return bool
*/
- public static function cleanup_episode_modules($courseid, $episodemodules, $episodeid)
- {
+ public static function cleanup_episode_modules($courseid, $episodemodules, $episodeid) {
global $CFG, $DB;
// If there aren't any modules to be cleaned up given, return.
@@ -621,8 +606,7 @@ public static function cleanup_episode_modules($courseid, $episodemodules, $epis
*
* @return bool
*/
- public static function cleanup_series_modules($ocinstanceid, $modulecourseid, $referencedseries)
- {
+ public static function cleanup_series_modules($ocinstanceid, $modulecourseid, $referencedseries) {
global $DB;
// Get old series id.
@@ -634,7 +618,7 @@ public static function cleanup_series_modules($ocinstanceid, $modulecourseid, $r
$success = true;
foreach ($referencedseries as $series) {
$success = $success && $DB->set_field('opencast', 'opencastid', $courseseries, ['ocinstanceid' => $ocinstanceid,
- 'type' => opencasttype::SERIES, 'opencastid' => $series, 'course' => $modulecourseid,]);
+ 'type' => opencasttype::SERIES, 'opencastid' => $series, 'course' => $modulecourseid, ]);
}
return $success;
diff --git a/classes/local/addactivity_form.php b/classes/local/addactivity_form.php
index 46bcb2cf..40461661 100644
--- a/classes/local/addactivity_form.php
+++ b/classes/local/addactivity_form.php
@@ -38,14 +38,13 @@
* @copyright 2020 Alexander Bias, Ulm University , 2021 Justus Dieckmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class addactivity_form extends moodleform
-{
+class addactivity_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $CFG;
$mform = $this->_form;
@@ -117,8 +116,7 @@ public function definition()
*
* @return void
*/
- public function add_action_buttons($cancel = true, $submitlabel = null)
- {
+ public function add_action_buttons($cancel = true, $submitlabel = null) {
$mform = $this->_form;
// Elements in a row need a group.
diff --git a/classes/local/addactivityepisode_form.php b/classes/local/addactivityepisode_form.php
index 3233069c..e9f6c84a 100644
--- a/classes/local/addactivityepisode_form.php
+++ b/classes/local/addactivityepisode_form.php
@@ -38,13 +38,12 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class addactivityepisode_form extends moodleform
-{
+class addactivityepisode_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $CFG;
$mform = $this->_form;
@@ -80,7 +79,7 @@ public function definition()
$mform->setDefault('intro',
['text' =>
activitymodulemanager::get_default_intro_for_episode($ocinstanceid, $this->_customdata['episodeuuid']),
- 'format' => FORMAT_HTML,]);
+ 'format' => FORMAT_HTML, ]);
}
if (get_config('block_opencast', 'addactivityepisodesection_' . $ocinstanceid) == true) {
@@ -123,8 +122,7 @@ public function definition()
*
* @return void
*/
- public function add_action_buttons($cancel = true, $submitlabel = null)
- {
+ public function add_action_buttons($cancel = true, $submitlabel = null) {
$mform = $this->_form;
// Elements in a row need a group.
diff --git a/classes/local/addlti_form.php b/classes/local/addlti_form.php
index e2d09d52..a024f7e6 100644
--- a/classes/local/addlti_form.php
+++ b/classes/local/addlti_form.php
@@ -38,13 +38,12 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class addlti_form extends moodleform
-{
+class addlti_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $CFG;
$mform = $this->_form;
@@ -106,8 +105,7 @@ public function definition()
*
* @return void
*/
- public function add_action_buttons($cancel = true, $submitlabel = null)
- {
+ public function add_action_buttons($cancel = true, $submitlabel = null) {
$mform = $this->_form;
// Elements in a row need a group.
diff --git a/classes/local/addltiepisode_form.php b/classes/local/addltiepisode_form.php
index e5ade570..68b8b7f5 100644
--- a/classes/local/addltiepisode_form.php
+++ b/classes/local/addltiepisode_form.php
@@ -38,13 +38,12 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class addltiepisode_form extends moodleform
-{
+class addltiepisode_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $CFG;
$mform = $this->_form;
@@ -69,7 +68,7 @@ public function definition()
$mform->setDefault('intro',
['text' =>
ltimodulemanager::get_default_intro_for_episode($ocinstanceid, $this->_customdata['episodeuuid']),
- 'format' => FORMAT_HTML,]);
+ 'format' => FORMAT_HTML, ]);
}
if (get_config('block_opencast', 'addltiepisodesection_' . $ocinstanceid) == true) {
@@ -112,8 +111,7 @@ public function definition()
*
* @return void
*/
- public function add_action_buttons($cancel = true, $submitlabel = null)
- {
+ public function add_action_buttons($cancel = true, $submitlabel = null) {
$mform = $this->_form;
// Elements in a row need a group.
diff --git a/classes/local/addtranscription_form.php b/classes/local/addtranscription_form.php
index 3eabcbca..015c1ca8 100644
--- a/classes/local/addtranscription_form.php
+++ b/classes/local/addtranscription_form.php
@@ -42,13 +42,12 @@
* @author Farbod Zamani Boroujeni
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class addtranscription_form extends moodleform
-{
+class addtranscription_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $PAGE;
// Get the renderer to use its methods.
$this->renderer = $PAGE->get_renderer('block_opencast');
diff --git a/classes/local/addvideo_form.php b/classes/local/addvideo_form.php
index 0fa208b1..aeaf85c3 100644
--- a/classes/local/addvideo_form.php
+++ b/classes/local/addvideo_form.php
@@ -49,13 +49,12 @@
* @author Andreas Wagner
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class addvideo_form extends moodleform
-{
+class addvideo_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $CFG, $DB, $PAGE;
// Get the renderer to use its methods.
$renderer = $PAGE->get_renderer('block_opencast');
@@ -460,8 +459,7 @@ public function definition()
* @param array $files
* @return array the errors that were found
*/
- public function validation($data, $files)
- {
+ public function validation($data, $files) {
$errors = parent::validation($data, $files);
$chunkuploadinstalled = class_exists('\local_chunkupload\chunkupload_form_element');
if (!$chunkuploadinstalled || !get_config('block_opencast', 'enablechunkupload_' . $this->_customdata['ocinstanceid']) ||
@@ -542,8 +540,7 @@ public function validation($data, $files)
* @return string
* @throws coding_exception
*/
- protected function try_get_string($identifier, $component = '', $a = null)
- {
+ protected function try_get_string($identifier, $component = '', $a = null) {
if (!get_string_manager()->string_exists($identifier, $component)) {
return ucfirst($identifier);
} else {
diff --git a/classes/local/apibridge.php b/classes/local/apibridge.php
index 5e7bea0b..f20a89c1 100644
--- a/classes/local/apibridge.php
+++ b/classes/local/apibridge.php
@@ -60,8 +60,8 @@
* @author Andreas Wagner
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class apibridge
-{
+class apibridge {
+
/** @var int Opencast instance id */
private $ocinstanceid;
@@ -78,8 +78,7 @@ class apibridge
* apibridge constructor.
* @param int $ocinstanceid Opencast instance id.
*/
- private function __construct($ocinstanceid)
- {
+ private function __construct($ocinstanceid) {
$this->ocinstanceid = $ocinstanceid;
$this->api = api::get_instance($this->ocinstanceid);
}
@@ -91,8 +90,7 @@ private function __construct($ocinstanceid)
* @param boolean $forcenewinstance true, when a new instance should be created.
* @return apibridge
*/
- public static function get_instance($ocinstanceid = null, $forcenewinstance = false)
- {
+ public static function get_instance($ocinstanceid = null, $forcenewinstance = false) {
static $apibridges = [];
if (!$ocinstanceid) {
@@ -124,8 +122,7 @@ public static function get_instance($ocinstanceid = null, $forcenewinstance = fa
*
* @return boolean
*/
- public function check_api_configuration()
- {
+ public function check_api_configuration() {
// Try to get an instance of the Opencast API from tool_opencast.
try {
$api = $this->get_instance($this->ocinstanceid);
@@ -147,8 +144,7 @@ public function check_api_configuration()
* @throws moodle_exception
* @throws opencast_connection_exception
*/
- private function get_ingest_api()
- {
+ private function get_ingest_api() {
$this->api = api::get_instance($this->ocinstanceid, [], [], true);
if (!property_exists($this->api->opencastapi, 'ingest')) {
throw new opencast_connection_exception('ingest_endpoint_notfound', 'block_opencast');
@@ -164,8 +160,7 @@ private function get_ingest_api()
* @throws moodle_exception
* @throws opencast_connection_exception
*/
- public function ingest_create_media_package()
- {
+ public function ingest_create_media_package() {
$ingestapi = $this->get_ingest_api();
$response = $ingestapi->createMediaPackage();
$code = $response['code'];
@@ -189,8 +184,7 @@ public function ingest_create_media_package()
* @throws moodle_exception
* @throws opencast_connection_exception
*/
- public function ingest_add_catalog($mediapackage, $flavor, $file)
- {
+ public function ingest_add_catalog($mediapackage, $flavor, $file) {
$ingestapi = $this->get_ingest_api();
$response = $ingestapi->addCatalog($mediapackage, $flavor, $file);
$code = $response['code'];
@@ -215,8 +209,7 @@ public function ingest_add_catalog($mediapackage, $flavor, $file)
* @throws moodle_exception
* @throws opencast_connection_exception
*/
- public function ingest_add_track($mediapackage, $flavor, $file)
- {
+ public function ingest_add_track($mediapackage, $flavor, $file) {
$ingestapi = $this->get_ingest_api();
$response = $ingestapi->addTrack($mediapackage, $flavor, $this->get_upload_filestream($file));
$code = $response['code'];
@@ -241,8 +234,7 @@ public function ingest_add_track($mediapackage, $flavor, $file)
* @throws moodle_exception
* @throws opencast_connection_exception
*/
- public function ingest_add_attachment($mediapackage, $flavor, $file)
- {
+ public function ingest_add_attachment($mediapackage, $flavor, $file) {
$ingestapi = $this->get_ingest_api();
$response = $ingestapi->addAttachment($mediapackage, $flavor, $file);
$code = $response['code'];
@@ -266,8 +258,7 @@ public function ingest_add_attachment($mediapackage, $flavor, $file)
* @throws moodle_exception
* @throws opencast_connection_exception
*/
- public function ingest($mediapackage, $uploadworkflow = '')
- {
+ public function ingest($mediapackage, $uploadworkflow = '') {
$ingestapi = $this->get_ingest_api();
if (empty($uploadworkflow)) {
@@ -302,8 +293,7 @@ public function ingest($mediapackage, $uploadworkflow = '')
* @param string $filedata the filedata to convert.
* @return resource|false the file pointer resource.
*/
- public function get_upload_xml_file($filename, $filedata)
- {
+ public function get_upload_xml_file($filename, $filedata) {
$filedata = (string)$filedata;
$tempdir = make_temp_directory('xmlfiletoupload');
$tempfilepath = tempnam($tempdir, 'tempup_') . $filename;
@@ -324,8 +314,7 @@ public function get_upload_xml_file($filename, $filedata)
* @param bool $withmetadata
* @return stdClass
*/
- public function get_block_videos($courseid, $withmetadata = false)
- {
+ public function get_block_videos($courseid, $withmetadata = false) {
if (defined('BEHAT_SITE_RUNNING')) {
$withmetadata = true;
}
@@ -412,8 +401,7 @@ public function get_block_videos($courseid, $withmetadata = false)
* @param string $sortcolumns
* @return array
*/
- public function get_course_videos($courseid, $sortcolumns = null)
- {
+ public function get_course_videos($courseid, $sortcolumns = null) {
$result = new stdClass();
$result->videos = [];
$result->error = 0;
@@ -435,8 +423,7 @@ public function get_course_videos($courseid, $sortcolumns = null)
* @param bool $withmetadata
* @return stdClass
*/
- public function get_series_videos($series, $sortcolumns = null, $withmetadata = false)
- {
+ public function get_series_videos($series, $sortcolumns = null, $withmetadata = false) {
if (defined('BEHAT_SITE_RUNNING')) {
$withmetadata = true;
}
@@ -497,8 +484,7 @@ public function get_series_videos($series, $sortcolumns = null, $withmetadata =
* - In cutting
* @param stdClass $video The video object, which should be checked.
*/
- private function extend_video_status(&$video)
- {
+ private function extend_video_status(&$video) {
if ($video->status === "EVENTS.EVENTS.STATUS.PROCESSED" && $video->has_previews == true
&& count($video->publication_status) == 1 && $video->publication_status[0] == "internal") {
$video->processing_state = "NEEDSCUTTING";
@@ -518,8 +504,7 @@ private function extend_video_status(&$video)
* Checks if a video can be downloaded and saves this state.
* @param stdClass $video Video to be updated
*/
- private function set_download_state(&$video)
- {
+ private function set_download_state(&$video) {
if (in_array(get_config('block_opencast', 'download_channel_' . $this->ocinstanceid), $video->publication_status)) {
$video->is_downloadable = true;
} else {
@@ -531,8 +516,7 @@ private function set_download_state(&$video)
* Checks if a video can be accessed directly and saves this state.
* @param stdClass $video Video to be updated
*/
- private function set_access_state(&$video)
- {
+ private function set_access_state(&$video) {
if (in_array(get_config('block_opencast', 'direct_access_channel_' . $this->ocinstanceid), $video->publication_status)) {
$video->is_accessible = true;
} else {
@@ -549,8 +533,7 @@ private function set_access_state(&$video)
* @return stdClass Video
*/
public function get_opencast_video($identifier, bool $withpublications = false, bool $withacl = false,
- bool $includingmedia = false)
- {
+ bool $includingmedia = false) {
$result = new stdClass();
$result->video = false;
$result->error = 0;
@@ -601,8 +584,7 @@ public function get_opencast_video($identifier, bool $withpublications = false,
* @param int $userid
* @return object group object of NULL, if group does not exist.
*/
- protected function get_acl_group($courseid, $userid)
- {
+ protected function get_acl_group($courseid, $userid) {
$groupname = $this->replace_placeholders(get_config('block_opencast',
'group_name_' . $this->ocinstanceid), $courseid, null, $userid)[0];
$groupidentifier = $this->get_course_acl_group_identifier($groupname);
@@ -618,8 +600,7 @@ protected function get_acl_group($courseid, $userid)
* @param String $groupname
* @return mixed
*/
- private function get_course_acl_group_identifier($groupname)
- {
+ private function get_course_acl_group_identifier($groupname) {
$groupidentifier = mb_strtolower($groupname, 'UTF-8');
return preg_replace('/[^a-zA-Z0-9_]/', '_', $groupidentifier);
@@ -631,8 +612,7 @@ private function get_course_acl_group_identifier($groupname)
* @param int $courseid
* @param int $userid
*/
- protected function create_acl_group($courseid, $userid)
- {
+ protected function create_acl_group($courseid, $userid) {
$name = $this->replace_placeholders(get_config('block_opencast',
'group_name_' . $this->ocinstanceid), $courseid, null, $userid)[0];
$description = 'ACL for users in Course with id ' . $courseid . ' from site "Moodle"';
@@ -658,8 +638,7 @@ protected function create_acl_group($courseid, $userid)
* @return object group object.
* @throws opencast_state_exception
*/
- public function ensure_acl_group_exists($courseid, $userid)
- {
+ public function ensure_acl_group_exists($courseid, $userid) {
$group = $this->get_acl_group($courseid, $userid);
@@ -683,8 +662,7 @@ public function ensure_acl_group_exists($courseid, $userid)
* If $groups is empty the access is not restricted.
* @return bool
*/
- public function store_group_access($eventid, $groups)
- {
+ public function store_group_access($eventid, $groups) {
try {
$groupaccess = groupaccess::get_record(['opencasteventid' => $eventid, 'ocinstanceid' => $this->ocinstanceid]);
if ($groupaccess) {
@@ -715,11 +693,10 @@ public function store_group_access($eventid, $groups)
* @param int $userid
* @return string id of the series
*/
- public function get_stored_seriesid($courseid, $createifempty = false, $userid = null)
- {
+ public function get_stored_seriesid($courseid, $createifempty = false, $userid = null) {
// Get series mapping.
$mapping = seriesmapping::get_record(['ocinstanceid' => $this->ocinstanceid,
- 'courseid' => $courseid, 'isdefault' => '1',]);
+ 'courseid' => $courseid, 'isdefault' => '1', ]);
// Get existing series from the series, set it to null if there isn't an existing mapping or series in the mapping.
if (!$mapping || !($seriesid = $mapping->get('series'))) {
@@ -754,8 +731,7 @@ public function get_stored_seriesid($courseid, $createifempty = false, $userid =
* @param bool $withacl If true, ACLs are included
* @return null|stdClass series if it exists in the opencast system.
*/
- public function get_series_by_identifier($seriesid, bool $withacl = false)
- {
+ public function get_series_by_identifier($seriesid, bool $withacl = false) {
if (empty($seriesid)) {
return null;
}
@@ -777,8 +753,7 @@ public function get_series_by_identifier($seriesid, bool $withacl = false)
* @param string[] $allseries
* @return null|string id of the series id if it exists in the opencast system.
*/
- public function get_multiple_series_by_identifier($allseries)
- {
+ public function get_multiple_series_by_identifier($allseries) {
$params = [];
$filter = [];
foreach ($allseries as $series) {
@@ -811,8 +786,7 @@ public function get_multiple_series_by_identifier($allseries)
* @param int $courseid
* @return null|string id of the series id if it exists in the opencast system.
*/
- public function get_default_course_series($courseid)
- {
+ public function get_default_course_series($courseid) {
if ($seriesid = $this->get_stored_seriesid($courseid)) {
$response = $this->api->opencastapi->seriesApi->get($seriesid);
if ($response['code'] != 200) {
@@ -830,8 +804,7 @@ public function get_default_course_series($courseid)
* @return array
* @throws dml_exception
*/
- public function get_course_series($courseid)
- {
+ public function get_course_series($courseid) {
global $DB;
// We do an intense look-up into the series records, to avoid redundancy.
$allcourseseries = $DB->get_records('tool_opencast_series',
@@ -879,8 +852,7 @@ public function get_course_series($courseid)
* @throws coding_exception
* @throws dml_exception
*/
- public static function replace_placeholders($name, $courseid, $groups = null, $userid = null)
- {
+ public static function replace_placeholders($name, $courseid, $groups = null, $userid = null) {
global $SITE;
// Skip course related placeholders if courseid is site id.
@@ -948,8 +920,7 @@ public static function replace_placeholders($name, $courseid, $groups = null, $u
* @param int $courseid Course id
* @return string Role name with substituted placeholders.
*/
- private function get_pattern_for_group_placeholder($name, $courseid)
- {
+ private function get_pattern_for_group_placeholder($name, $courseid) {
$coursename = get_course($courseid)->fullname;
$title = str_replace('[COURSENAME]', $coursename, $name);
$title = str_replace('[COURSEID]', $courseid, $title);
@@ -962,8 +933,7 @@ private function get_pattern_for_group_placeholder($name, $courseid)
* @param int $userid
* @return string default series title.
*/
- public function get_default_seriestitle($courseid, $userid)
- {
+ public function get_default_seriestitle($courseid, $userid) {
$title = get_config('block_opencast', 'series_name_' . $this->ocinstanceid);
return self::replace_placeholders($title, $courseid, null, $userid)[0];
}
@@ -979,10 +949,9 @@ public function get_default_seriestitle($courseid, $userid)
* @throws dml_exception
* @throws moodle_exception
*/
- public function create_course_series($courseid, $metadatafields = null, $userid = null)
- {
+ public function create_course_series($courseid, $metadatafields = null, $userid = null) {
$mapping = seriesmapping::get_record(['ocinstanceid' => $this->ocinstanceid,
- 'courseid' => $courseid, 'isdefault' => '1',]);
+ 'courseid' => $courseid, 'isdefault' => '1', ]);
$isdefault = $mapping ? false : true;
@@ -1004,7 +973,7 @@ public function create_course_series($courseid, $metadatafields = null, $userid
foreach ($roles as $role) {
foreach ($role->actions as $action) {
$acl[] = (object)['allow' => true, 'action' => $action,
- 'role' => $this->replace_placeholders($role->rolename, $courseid, null, $userid)[0],];
+ 'role' => $this->replace_placeholders($role->rolename, $courseid, null, $userid)[0], ];
}
}
@@ -1043,8 +1012,7 @@ public function create_course_series($courseid, $metadatafields = null, $userid
* @return string series object.
* @throws opencast_state_exception
*/
- public function ensure_course_series_exists($courseid, $userid)
- {
+ public function ensure_course_series_exists($courseid, $userid) {
$series = $this->get_default_course_series($courseid);
@@ -1068,10 +1036,9 @@ public function ensure_course_series_exists($courseid, $userid)
* @param string $seriesid Series ID
* @param int $userid
*/
- public function update_course_series($courseid, $seriesid, $userid)
- {
+ public function update_course_series($courseid, $seriesid, $userid) {
$mapping = seriesmapping::get_record(['ocinstanceid' => $this->ocinstanceid,
- 'courseid' => $courseid, 'isdefault' => '1',]);
+ 'courseid' => $courseid, 'isdefault' => '1', ]);
if (!$mapping) {
$mapping = new seriesmapping();
@@ -1103,7 +1070,7 @@ public function update_course_series($courseid, $seriesid, $userid)
foreach ($role->actions as $action) {
$acl[] = (object)['allow' => true,
'role' => self::replace_placeholders($role->rolename, $courseid, null, $userid)[0],
- 'action' => $action,];
+ 'action' => $action, ];
}
} else {
@@ -1116,7 +1083,7 @@ public function update_course_series($courseid, $seriesid, $userid)
$acl[] = (object)['allow' => true,
'role' => self::replace_placeholders($role->rolename, $courseid)[0],
- 'action' => $action,];
+ 'action' => $action, ];
}
}
}
@@ -1138,10 +1105,9 @@ public function update_course_series($courseid, $seriesid, $userid)
*
* @param int $courseid Course ID
*/
- public function unset_course_series($courseid)
- {
+ public function unset_course_series($courseid) {
$mapping = seriesmapping::get_record(['ocinstanceid' => $this->ocinstanceid,
- 'courseid' => $courseid, 'isdefault' => '1',]);
+ 'courseid' => $courseid, 'isdefault' => '1', ]);
if ($mapping) {
$mapping->delete();
@@ -1155,8 +1121,7 @@ public function unset_course_series($courseid)
* @throws dml_exception
* @throws moodle_exception if there is no connection to the server.
*/
- public function ensure_series_is_valid($seriesid)
- {
+ public function ensure_series_is_valid($seriesid) {
$response = $this->api->opencastapi->seriesApi->get($seriesid);
$code = $response['code'];
@@ -1178,8 +1143,7 @@ public function ensure_series_is_valid($seriesid)
*
* @return mixed false or existing event.
*/
- public function get_already_existing_event($opencastids)
- {
+ public function get_already_existing_event($opencastids) {
foreach ($opencastids as $opencastid) {
$response = $this->api->opencastapi->eventsApi->get($opencastid);
$event = $response['body'];
@@ -1197,8 +1161,7 @@ public function get_already_existing_event($opencastids)
* @param object $job Event to be created
* @return object series object of NULL, if group does not exist.
*/
- public function create_event($job)
- {
+ public function create_event($job) {
global $DB;
$event = new event();
@@ -1309,8 +1272,7 @@ public function create_event($job)
* @param string $type the type of the file to get filestream for.
* @return resource|false the file pointer resource.
*/
- public function get_upload_filestream($file, $type = 'video')
- {
+ public function get_upload_filestream($file, $type = 'video') {
$tempdirname = "oc{$type}toupload";
$tempdir = make_temp_directory($tempdirname);
$tempfilepath = tempnam($tempdir, 'block_opencast_' . $type . '_upload') . '_' . $file->get_filename();
@@ -1340,8 +1302,7 @@ public function get_upload_filestream($file, $type = 'video')
* @return array of acl roles.
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
- public function getroles($permanent = null)
- {
+ public function getroles($permanent = null) {
$roles = json_decode(get_config('block_opencast', 'roles_' . $this->ocinstanceid));
if (empty($roles)) {
return [];
@@ -1365,8 +1326,7 @@ public function getroles($permanent = null)
* @param array $opencastids Opencas id
* @return object (Created) event
*/
- public function ensure_event_exists($job, $opencastids)
- {
+ public function ensure_event_exists($job, $opencastids) {
if ($opencastids) {
if ($event = $this->get_already_existing_event($opencastids)) {
@@ -1399,8 +1359,7 @@ public function ensure_event_exists($job, $opencastids)
*
* @return boolean true if succeeded
*/
- public function ensure_acl_group_assigned($eventidentifier, $courseid, $userid)
- {
+ public function ensure_acl_group_assigned($eventidentifier, $courseid, $userid) {
$response = $this->api->opencastapi->eventsApi->getAcl($eventidentifier);
$jsonacl = $response['body'];
@@ -1439,8 +1398,7 @@ public function ensure_acl_group_assigned($eventidentifier, $courseid, $userid)
* @param int $courseid Course id
* @return bool If acl group can be deleted
*/
- public function can_delete_acl_group_assignment($video, $courseid)
- {
+ public function can_delete_acl_group_assignment($video, $courseid) {
$config = get_config('block_opencast', 'allowunassign_' . $this->ocinstanceid);
if (!$config) {
@@ -1464,8 +1422,7 @@ public function can_delete_acl_group_assignment($video, $courseid)
*
* @return boolean true if succeeded
*/
- public function delete_acl_group_assigned($eventidentifier, $courseid)
- {
+ public function delete_acl_group_assigned($eventidentifier, $courseid) {
$event = new event();
$grouprole = api::get_course_acl_role($courseid);
@@ -1501,13 +1458,12 @@ public function delete_acl_group_assigned($eventidentifier, $courseid)
* @param array|null $groups Groups
* @return string identifier of the notification string to be presented to the user.
*/
- public function change_visibility($eventidentifier, $courseid, $visibility, $groups = null)
- {
+ public function change_visibility($eventidentifier, $courseid, $visibility, $groups = null) {
$oldgroups = groupaccess::get_record(['opencasteventid' => $eventidentifier, 'ocinstanceid' => $this->ocinstanceid]);
$oldgroupsarray = $oldgroups ? explode(',', $oldgroups->get('moodlegroups')) : [];
$allowedvisibilitystates = [block_opencast_renderer::VISIBLE,
- block_opencast_renderer::HIDDEN, block_opencast_renderer::GROUP,];
+ block_opencast_renderer::HIDDEN, block_opencast_renderer::GROUP, ];
if (!in_array($visibility, $allowedvisibilitystates)) {
throw new coding_exception('Invalid visibility state.');
}
@@ -1591,8 +1547,7 @@ public function change_visibility($eventidentifier, $courseid, $visibility, $gro
* @param string $seriesidentifier
* @return boolean
*/
- public function assign_series($eventidentifier, $seriesidentifier)
- {
+ public function assign_series($eventidentifier, $seriesidentifier) {
$metadata = json_encode([['id' => 'isPartOf', 'value' => $seriesidentifier]]);
$response = $this->api->opencastapi->eventsApi->updateMetadata($eventidentifier, 'dublincore/episode', $metadata);
return ($response['code'] == 204);
@@ -1608,8 +1563,7 @@ public function assign_series($eventidentifier, $seriesidentifier)
* @throws dml_exception
* @throws coding_exception In case of an invalid visibility status. Only [0,1,2] are allowed.
*/
- private function get_non_permanent_acl_rules_for_status($courseid, $visibility, $groups = null)
- {
+ private function get_non_permanent_acl_rules_for_status($courseid, $visibility, $groups = null) {
return $this->get_acl_rules_for_status($courseid, $visibility, false, $groups);
}
@@ -1623,8 +1577,7 @@ private function get_non_permanent_acl_rules_for_status($courseid, $visibility,
* @throws dml_exception
* @throws coding_exception In case of an invalid visibility status. Only [0,1,2] are allowed.
*/
- private function get_permanent_acl_rules_for_status($courseid, $visibility, $groups = null)
- {
+ private function get_permanent_acl_rules_for_status($courseid, $visibility, $groups = null) {
return $this->get_acl_rules_for_status($courseid, $visibility, true, $groups);
}
@@ -1639,8 +1592,7 @@ private function get_permanent_acl_rules_for_status($courseid, $visibility, $gro
* @throws dml_exception
* @throws coding_exception In case of an invalid visibility status. Only [0,1,2] are allowed.
*/
- private function get_acl_rules_for_status($courseid, $visibility, $permanent, $groups = null)
- {
+ private function get_acl_rules_for_status($courseid, $visibility, $permanent, $groups = null) {
$roles = $this->getroles($permanent ? 1 : 0);
$result = [];
@@ -1691,8 +1643,7 @@ private function get_acl_rules_for_status($courseid, $visibility, $permanent, $g
* @param int $courseid Course id
* @return int state of the visibility (0 hidden, 1 mixed visibility, 2 visible)
*/
- public function is_event_visible($eventidentifier, $courseid)
- {
+ public function is_event_visible($eventidentifier, $courseid) {
$response = $this->api->opencastapi->eventsApi->getAcl($eventidentifier);
$jsonacl = $response['body'];
$event = new event();
@@ -1763,8 +1714,7 @@ public function is_event_visible($eventidentifier, $courseid)
* @throws dml_exception
* @throws moodle_exception
*/
- private function update_metadata($eventid)
- {
+ private function update_metadata($eventid) {
$video = $this->get_opencast_video($eventid);
if ($video->error === 0) {
@@ -1793,8 +1743,7 @@ private function update_metadata($eventid)
* @throws dml_exception
* @throws moodle_exception
*/
- public function start_workflow($eventid, $workflow, $params = [], $returnworkflowid = false)
- {
+ public function start_workflow($eventid, $workflow, $params = [], $returnworkflowid = false) {
if (!$workflow) {
return false;
}
@@ -1829,8 +1778,7 @@ public function start_workflow($eventid, $workflow, $params = [], $returnworkflo
* @param string $name id of workflow
* @return boolean True if workflow exists
*/
- public function check_if_workflow_exists($name)
- {
+ public function check_if_workflow_exists($name) {
$workflows = $this->get_existing_workflows();
return array_key_exists($name, $workflows);
@@ -1846,8 +1794,7 @@ public function check_if_workflow_exists($name)
* the workflows details are also included.
* @throws moodle_exception
*/
- public function get_existing_workflows($tags = [], $onlynames = true, $withconfigurations = false)
- {
+ public function get_existing_workflows($tags = [], $onlynames = true, $withconfigurations = false) {
$workflows = [];
// Make sure that the tags are trimmed.
@@ -1902,8 +1849,7 @@ public function get_existing_workflows($tags = [], $onlynames = true, $withconfi
* @param string $id Workflow definition id
* @return false|mixed Workflow definition or false if not successful
*/
- public function get_workflow_definition($id)
- {
+ public function get_workflow_definition($id) {
$withoperations = false;
$withconfigurationpanel = true;
$response = $this->api->opencastapi->workflowsApi->getDefinition(
@@ -1927,8 +1873,7 @@ public function get_workflow_definition($id)
* @return array Returns array of OC workflows.
* If the list of workflows can't be retrieved from Opencast, an array with a nice error message is returned.
*/
- public function get_available_workflows_for_menu($stringtags = '', $withnoworkflow = false)
- {
+ public function get_available_workflows_for_menu($stringtags = '', $withnoworkflow = false) {
// Get the workflow list.
$tags = [];
if (!empty($stringtags)) {
@@ -1952,8 +1897,7 @@ public function get_available_workflows_for_menu($stringtags = '', $withnoworkfl
* @param int $courseid Course id
* @return bool True, if event assignment can be deleted
*/
- public function can_delete_event_assignment($video, $courseid)
- {
+ public function can_delete_event_assignment($video, $courseid) {
if (isset($video->processing_state) &&
($video->processing_state !== 'RUNNING' && $video->processing_state !== 'PAUSED')) {
@@ -1972,8 +1916,7 @@ public function can_delete_event_assignment($video, $courseid)
* @param string $eventidentifier
* @return boolean return true when video deletion is triggerd correctly.
*/
- public function trigger_delete_event($eventidentifier)
- {
+ public function trigger_delete_event($eventidentifier) {
global $DB;
$workflow = get_config("block_opencast", "deleteworkflow_" . $this->ocinstanceid);
@@ -2000,8 +1943,7 @@ public function trigger_delete_event($eventidentifier)
* @param string $eventidentifier
* @return boolean return true when video is deleted.
*/
- public function delete_event($eventidentifier)
- {
+ public function delete_event($eventidentifier) {
$response = $this->api->opencastapi->eventsApi->delete($eventidentifier);
if ($response['code'] >= 400) {
return false;
@@ -2018,8 +1960,7 @@ public function delete_event($eventidentifier)
*
* @return array list of videos for backup.
*/
- public function get_course_videos_for_backup($courseid, $processingstates = ['SUCCEEDED'])
- {
+ public function get_course_videos_for_backup($courseid, $processingstates = ['SUCCEEDED']) {
if (!$result = $this->get_course_videos($courseid)) {
return [];
@@ -2048,8 +1989,7 @@ public function get_course_videos_for_backup($courseid, $processingstates = ['SU
*
* @return array list of videos for backup.
*/
- public function get_course_series_and_videos_for_backup($courseid, $processingstates = ['SUCCEEDED'])
- {
+ public function get_course_series_and_videos_for_backup($courseid, $processingstates = ['SUCCEEDED']) {
$seriesforbackup = [];
foreach ($this->get_course_series($courseid) as $series) {
$result = $this->get_series_videos($series->series);
@@ -2076,8 +2016,7 @@ public function get_course_series_and_videos_for_backup($courseid, $processingst
* @param string $level
* @return boolean
*/
- public function supports_api_level($level)
- {
+ public function supports_api_level($level) {
try {
return $this->api->supports_api_level($level);
} catch (moodle_exception $e) {
@@ -2092,8 +2031,7 @@ public function supports_api_level($level)
* a testable class. It also resets the current apibridge instance.
* @param bool $testing true, if get_instance should return a testable.
*/
- public static function set_testing($testing)
- {
+ public static function set_testing($testing) {
self::$testing = $testing;
self::get_instance(1);
}
@@ -2107,8 +2045,7 @@ public static function set_testing($testing)
* @param bool $capabilitycheck
* @return bool the capability of updating!
*/
- public function can_update_event_metadata($video, $courseid, $capabilitycheck = true)
- {
+ public function can_update_event_metadata($video, $courseid, $capabilitycheck = true) {
if (isset($video->processing_state) &&
($video->processing_state == "SUCCEEDED" || $video->processing_state == "FAILED" ||
$video->processing_state == "PLANNED" || $video->processing_state == "STOPPED")) {
@@ -2129,8 +2066,7 @@ public function can_update_event_metadata($video, $courseid, $capabilitycheck =
* @param int $courseid Course id
* @return bool the capability of updating!
*/
- public function can_edit_event_in_editor($video, $courseid)
- {
+ public function can_edit_event_in_editor($video, $courseid) {
// We check if the basic editor integration configs are set, the video processing state is succeeded
// (to avoid process failure) and there is internal publication status (to avoid error 400 in editor).
@@ -2151,8 +2087,7 @@ public function can_edit_event_in_editor($video, $courseid)
* @param string $type metadata type
* @return bool|int|mixed Event metadata
*/
- public function get_event_metadata($eventidentifier, $type = '')
- {
+ public function get_event_metadata($eventidentifier, $type = '') {
$response = $this->api->opencastapi->eventsApi->getMetadata($eventidentifier, $type);
if ($response['code'] != 200) {
return $response['code'];
@@ -2165,8 +2100,7 @@ public function get_event_metadata($eventidentifier, $type = '')
* @param string $seriesid Series id
* @return bool|int|mixed Event metadata
*/
- public function get_series_metadata($seriesid)
- {
+ public function get_series_metadata($seriesid) {
$type = 'dublincore/series';
$response = $this->api->opencastapi->seriesApi->getMetadata($seriesid, $type);
if ($response['code'] != 200) {
@@ -2183,8 +2117,7 @@ public function get_series_metadata($seriesid)
* @throws dml_exception
* @throws moodle_exception
*/
- public function update_event_metadata($eventidentifier, $metadata)
- {
+ public function update_event_metadata($eventidentifier, $metadata) {
$metadata = json_encode($metadata);
$type = 'dublincore/episode';
@@ -2207,8 +2140,7 @@ public function update_event_metadata($eventidentifier, $metadata)
* @throws dml_exception
* @throws moodle_exception
*/
- public function set_owner($courseid, $eventidentifier, $userid, $isseries)
- {
+ public function set_owner($courseid, $eventidentifier, $userid, $isseries) {
$response = null;
if ($isseries) {
$response = $this->api->opencastapi->seriesApi->getAcl($eventidentifier);
@@ -2291,8 +2223,7 @@ public function set_owner($courseid, $eventidentifier, $userid, $isseries)
* @param int $courseid
* @return bool
*/
- public function is_owner($acls, $userid, $courseid)
- {
+ public function is_owner($acls, $userid, $courseid) {
$roletosearch = self::get_owner_role_for_user($userid, $courseid);
$acls = array_column($acls, 'role');
@@ -2304,8 +2235,7 @@ public function is_owner($acls, $userid, $courseid)
* @param string[] $acls ACLs
* @return bool
*/
- public function has_owner($acls)
- {
+ public function has_owner($acls) {
$ownerrole = get_config('block_opencast', 'aclownerrole_' . $this->ocinstanceid);
$ownerroleregex = false;
foreach (self::$userplaceholders as $userplaceholder) {
@@ -2339,8 +2269,7 @@ public function has_owner($acls)
* @throws coding_exception
* @throws dml_exception
*/
- private function get_owner_role_for_user($userid, $courseid)
- {
+ private function get_owner_role_for_user($userid, $courseid) {
if (empty(get_config('block_opencast', 'aclownerrole_' . $this->ocinstanceid))) {
return null;
}
@@ -2362,8 +2291,7 @@ private function get_owner_role_for_user($userid, $courseid)
* @throws dml_exception
* @throws moodle_exception
*/
- public function get_series_owned_by($userid)
- {
+ public function get_series_owned_by($userid) {
global $SITE;
// Course id should not be used in owner role, so we can use the site id.
$ownerrole = self::get_owner_role_for_user($userid, $SITE->id);
@@ -2391,8 +2319,7 @@ public function get_series_owned_by($userid)
* @throws dml_exception
* @throws moodle_exception
*/
- public function get_videos_owned_by($userid)
- {
+ public function get_videos_owned_by($userid) {
global $SITE;
// Course id should not be used in owner role, so we can use the site id.
$ownerrole = self::get_owner_role_for_user($userid, $SITE->id);
@@ -2442,8 +2369,7 @@ public function get_videos_owned_by($userid)
* @throws dml_exception
* @throws moodle_exception
*/
- public function update_series_metadata($seriesid, $metadata)
- {
+ public function update_series_metadata($seriesid, $metadata) {
$response = $this->api->opencastapi->seriesApi->updateMetadata($seriesid, $metadata);
if ($response['code'] == 200) {
return true;
@@ -2464,8 +2390,7 @@ public function update_series_metadata($seriesid, $metadata)
* if the found episode ID isn't a valid episode ID at all,
* if the workflow has ended but there still isn't an episode ID.
*/
- public function get_duplicated_episodeid($workflowid)
- {
+ public function get_duplicated_episodeid($workflowid) {
// If we don't have a number, return.
if (!is_number($workflowid)) {
@@ -2523,8 +2448,7 @@ public function get_duplicated_episodeid($workflowid)
*
* @return stdClass $result
*/
- public function import_series_to_course_with_acl_change($courseid, $seriesid, $userid)
- {
+ public function import_series_to_course_with_acl_change($courseid, $seriesid, $userid) {
// Define result object to return.
$result = new stdClass();
// Assume there is no error at all.
@@ -2588,8 +2512,7 @@ public function import_series_to_course_with_acl_change($courseid, $seriesid, $u
*
* @return bool
*/
- private function imported_series_acl_change($courseid, $seriesid, $userid)
- {
+ private function imported_series_acl_change($courseid, $seriesid, $userid) {
// Reading acl from opencast server.
$response = $this->api->opencastapi->seriesApi->getAcl($seriesid);
$defaultacl = $response['body'];
@@ -2609,7 +2532,7 @@ private function imported_series_acl_change($courseid, $seriesid, $userid)
// Define role object.
$roleobject = (object)['allow' => true,
'role' => self::replace_placeholders($role->rolename, $courseid, null, $userid)[0],
- 'action' => $action,];
+ 'action' => $action, ];
// Check if the role object already exists in the acl list.
$existingacl = array_filter($acl, function ($v, $k) use ($roleobject) {
@@ -2648,8 +2571,7 @@ private function imported_series_acl_change($courseid, $seriesid, $userid)
* @param int $courseid Course ID.
* @return int $courseid id of the course being imported to.
*/
- private function imported_events_acl_change($identifier, $courseid)
- {
+ private function imported_events_acl_change($identifier, $courseid) {
// Use try to catch unwanted errors.
try {
// Make it visible to the course does the ACL change accordingly.
@@ -2668,11 +2590,10 @@ private function imported_events_acl_change($identifier, $courseid)
* @param int $courseid Course id.
* @param string $seriesid series id.
*/
- private function map_imported_series_to_course($courseid, $seriesid)
- {
+ private function map_imported_series_to_course($courseid, $seriesid) {
// Get the current record.
$mapping = seriesmapping::get_record(['courseid' => $courseid,
- 'series' => $seriesid, 'ocinstanceid' => $this->ocinstanceid,], true);
+ 'series' => $seriesid, 'ocinstanceid' => $this->ocinstanceid, ], true);
// If the mapping record does not exists, we create one.
if (!$mapping) {
@@ -2683,7 +2604,7 @@ private function map_imported_series_to_course($courseid, $seriesid)
// Try to check if there is any default series for this course.
$defaultcourseseries = seriesmapping::get_record(['ocinstanceid' => $this->ocinstanceid,
- 'courseid' => $courseid, 'isdefault' => 1,], true);
+ 'courseid' => $courseid, 'isdefault' => 1, ], true);
// In case there is no default series for this course, this series will be the default.
$isdefault = $defaultcourseseries ? 0 : 1;
@@ -2706,8 +2627,7 @@ private function map_imported_series_to_course($courseid, $seriesid)
* @throws dml_exception
* @throws moodle_exception
*/
- public function unlink_series_from_course($courseid, $seriesid)
- {
+ public function unlink_series_from_course($courseid, $seriesid) {
// Step 1: Remove all related course ACLs from series event one by one.
$videos = $this->get_series_videos($seriesid);
if ($videos->error != 0) {
@@ -2743,8 +2663,7 @@ public function unlink_series_from_course($courseid, $seriesid)
* @param int $courseid
* @return bool
*/
- private function remove_course_acls_from_event($eventidentifier, $courseid)
- {
+ private function remove_course_acls_from_event($eventidentifier, $courseid) {
// Preparing groups.
$groups = groupaccess::get_record(
[
@@ -2813,8 +2732,7 @@ private function remove_course_acls_from_event($eventidentifier, $courseid)
* @param int $courseid
* @return bool
*/
- private function remove_course_acls_from_series($seriesid, $courseid)
- {
+ private function remove_course_acls_from_series($seriesid, $courseid) {
// Preparing all course related acls to remove.
$aclstoremove = [];
// Go through all roles.
@@ -2867,8 +2785,7 @@ private function remove_course_acls_from_series($seriesid, $courseid)
*
* @throws dml_exception
*/
- public function get_lti_consumerkey()
- {
+ public function get_lti_consumerkey() {
return settings_api::get_lticonsumerkey($this->ocinstanceid);
}
@@ -2880,8 +2797,7 @@ public function get_lti_consumerkey()
*
* @throws dml_exception
*/
- public function get_lti_consumersecret()
- {
+ public function get_lti_consumersecret() {
return settings_api::get_lticonsumersecret($this->ocinstanceid);
}
@@ -2895,8 +2811,7 @@ public function get_lti_consumersecret()
* @throws moodle_exception
* @throws opencast_connection_exception
*/
- public function get_event_media_package($eventid)
- {
+ public function get_event_media_package($eventid) {
$response = $this->api->opencastrestclient->performGet("/api/episode/{$eventid}");
$code = $response['code'];
if ($code === 0) {
@@ -2914,8 +2829,7 @@ public function get_event_media_package($eventid)
* @param int $courseid Course id
* @return bool the capability of editing transcription!
*/
- public function can_edit_event_transcription($video, $courseid)
- {
+ public function can_edit_event_transcription($video, $courseid) {
// To edit transcriptions, we need that the video processing to be in succeeded state to avoid any conflict in workflows.
// We would also need to make sure that workflow for transcription is configured.
if (!empty(get_config('block_opencast', 'transcriptionworkflow_' . $this->ocinstanceid)) &&
@@ -2934,8 +2848,7 @@ public function can_edit_event_transcription($video, $courseid)
* @param int $courseid target course id
* @return bool whether the acl (visibility) is applied
*/
- public function set_duplicated_event_visibility($duplicatedeventid, $sourceeventid, $courseid)
- {
+ public function set_duplicated_event_visibility($duplicatedeventid, $sourceeventid, $courseid) {
// Getting the duplicated video object.
$duplicatedvideo = $this->get_opencast_video($duplicatedeventid);
if ($duplicatedvideo->error || !$this->can_update_event_metadata($duplicatedvideo->video, $courseid, false)) {
@@ -2950,7 +2863,7 @@ public function set_duplicated_event_visibility($duplicatedeventid, $sourceevent
$sourceseries = $sourcevideo->video->is_part_of;
// Get series mapping.
$mapping = seriesmapping::get_record(['ocinstanceid' => $this->ocinstanceid,
- 'series' => $sourceseries, 'isdefault' => '1',]);
+ 'series' => $sourceseries, 'isdefault' => '1', ]);
// Extracting source course id to get the inital visibiltiy of the source event.
if (!$mapping || !($sourcecourseid = $mapping->get('courseid'))) {
return process_duplicated_event_visibility_change::TASK_FAILED;
@@ -2994,8 +2907,7 @@ public function set_duplicated_event_visibility($duplicatedeventid, $sourceevent
*
* @return string semantic version number of the opencast server.
*/
- public function get_opencast_version()
- {
+ public function get_opencast_version() {
$response = $this->api->opencastapi->sysinfo->getVersion();
$code = $response['code'];
$versionobject = $response['body'];
@@ -3019,8 +2931,7 @@ public function get_opencast_version()
* @return boolean true, if the track is added.
* @throws opencast_connection_exception
*/
- public function event_add_track($identifier, $flavor, $file, $overwrite = true)
- {
+ public function event_add_track($identifier, $flavor, $file, $overwrite = true) {
$response = $this->api->opencastapi->eventsApi->addTrack($identifier, $flavor, $file, $overwrite);
$code = $response['code'];
if ($code === 0) {
@@ -3038,8 +2949,7 @@ public function event_add_track($identifier, $flavor, $file, $overwrite = true)
* @param bool $capabilitycheck
* @return bool whether to provide the download button
*/
- public function can_show_download_button($video, $courseid, $capabilitycheck = true)
- {
+ public function can_show_download_button($video, $courseid, $capabilitycheck = true) {
// Only when the video processing is SUCCEEDED, to avoid any misunderstanding.
if ($video->is_downloadable && isset($video->processing_state) && $video->processing_state == "SUCCEEDED") {
if ($capabilitycheck) {
@@ -3059,8 +2969,7 @@ public function can_show_download_button($video, $courseid, $capabilitycheck = t
* @param bool $capabilitycheck
* @return bool whether to provide the download button
*/
- public function can_show_directaccess_link($video, $courseid, $capabilitycheck = true)
- {
+ public function can_show_directaccess_link($video, $courseid, $capabilitycheck = true) {
// Only when the video processing is SUCCEEDED, to avoid any misunderstanding.
if ($video->is_accessible && isset($video->processing_state) && $video->processing_state == "SUCCEEDED") {
if ($capabilitycheck) {
@@ -3080,8 +2989,7 @@ public function can_show_directaccess_link($video, $courseid, $capabilitycheck =
* @param string $seriesid Series identifier
* @return ?string the generated studio url path or null if something went wrong.
*/
- public function generate_studio_url_path($courseid, $seriesid)
- {
+ public function generate_studio_url_path($courseid, $seriesid) {
global $SITE;
// Return null if the requirements are missing.
if (empty($courseid) || empty($seriesid)) {
diff --git a/classes/local/attachment_helper.php b/classes/local/attachment_helper.php
index 8a91dc53..14c31ab8 100644
--- a/classes/local/attachment_helper.php
+++ b/classes/local/attachment_helper.php
@@ -38,8 +38,8 @@
* @author Farbod Zamani Boroujeni
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class attachment_helper
-{
+class attachment_helper {
+
/** @var string File area id where attachments files are uploaded */
const OC_FILEAREA_ATTACHMENT = 'attachmenttoupload';
@@ -65,8 +65,7 @@ class attachment_helper
* @param string $type the attachment type.
* @param array $attachemntfiles the array list of files to upload.
*/
- public static function save_attachment_upload_job($uploadjobid, $type, $attachemntfiles)
- {
+ public static function save_attachment_upload_job($uploadjobid, $type, $attachemntfiles) {
global $DB;
// Create object.
$attachments = new stdClass();
@@ -81,8 +80,7 @@ public static function save_attachment_upload_job($uploadjobid, $type, $attachem
/**
* Process all attachment upload jobs.
*/
- public function cron()
- {
+ public function cron() {
global $DB;
// Get the attachment upload jobs.
@@ -131,8 +129,7 @@ public function cron()
* @param object $job represents the attachment job.
* @throws moodle_exception
*/
- protected function process_upload_attachment_job($job)
- {
+ protected function process_upload_attachment_job($job) {
global $DB;
// Prepare all the required variables to perform attachment upload.
@@ -174,8 +171,7 @@ protected function process_upload_attachment_job($job)
* @param object $uploadjob represents the upload job.
* @param object $video represents the video object.
*/
- protected function upload_job_transcriptions($attachmentjob, $uploadjob, $video)
- {
+ protected function upload_job_transcriptions($attachmentjob, $uploadjob, $video) {
$ocinstanceid = $uploadjob->ocinstanceid;
$courseid = $uploadjob->courseid;
if (!empty(get_config('block_opencast', 'transcriptionworkflow_' . $ocinstanceid))) {
@@ -217,11 +213,10 @@ protected function upload_job_transcriptions($attachmentjob, $uploadjob, $video)
* @param object $job attachment job object
* @param int $status attachment status.
*/
- private static function change_job_status($job, $status)
- {
+ private static function change_job_status($job, $status) {
global $DB;
- $allowedjobstatus = array(self::STATUS_PENDING, self::STATUS_DONE,
- self::STATUS_FAILED);
+ $allowedjobstatus = [self::STATUS_PENDING, self::STATUS_DONE,
+ self::STATUS_FAILED, ];
if (!in_array($status, $allowedjobstatus)) {
throw new coding_exception('Invalid job status code.');
@@ -237,8 +232,7 @@ private static function change_job_status($job, $status)
*
* @param object $job attachment job object
*/
- protected function cleanup_attachment_job($job)
- {
+ protected function cleanup_attachment_job($job) {
global $DB;
$attachemntfiles = json_decode($job->files);
$fs = get_file_storage();
@@ -277,8 +271,7 @@ protected function cleanup_attachment_job($job)
* @param string $flavor the attachment flavor.
* @return string $mediapackagestr newly processed mediapackage xml as string
*/
- private static function perform_add_attachment($ocinstanceid, $identifier, $mediapackagestr, $file, $flavor)
- {
+ private static function perform_add_attachment($ocinstanceid, $identifier, $mediapackagestr, $file, $flavor) {
// Remove existing attachments or media with the same flavor.
$mediapackagestr = self::remove_existing_flavor_from_mediapackage($ocinstanceid, $mediapackagestr, 'type', $flavor);
$apibridge = apibridge::get_instance($ocinstanceid);
@@ -306,8 +299,7 @@ private static function perform_add_attachment($ocinstanceid, $identifier, $medi
*
* @return string mediapackage
*/
- private static function remove_existing_flavor_from_mediapackage($ocinstanceid, $mediapackagestr, $attributetype, $value)
- {
+ private static function remove_existing_flavor_from_mediapackage($ocinstanceid, $mediapackagestr, $attributetype, $value) {
$mediapackage = simplexml_load_string($mediapackagestr);
// We loop through the attackments, to get rid of any duplicates.
self::remove_attachment_from_xml($mediapackage, $attributetype, $value);
@@ -331,8 +323,7 @@ private static function remove_existing_flavor_from_mediapackage($ocinstanceid,
* @param string $attributetype the type of attribute to check against.
* @param string $value the value of attribute to match with.
*/
- private static function remove_attachment_from_xml(&$mediapackage, $attributetype, $value)
- {
+ private static function remove_attachment_from_xml(&$mediapackage, $attributetype, $value) {
$i = 0;
$toremove = [];
foreach ($mediapackage->attachments->attachment as $item) {
@@ -354,8 +345,7 @@ private static function remove_attachment_from_xml(&$mediapackage, $attributetyp
* @param string $attributetype the type of attribute to check against.
* @param string $value the value of attribute to match with.
*/
- private static function remove_media_from_xml(&$mediapackage, $attributetype, $value)
- {
+ private static function remove_media_from_xml(&$mediapackage, $attributetype, $value) {
$i = 0;
$toremove = [];
foreach ($mediapackage->media->track as $item) {
@@ -379,8 +369,7 @@ private static function remove_media_from_xml(&$mediapackage, $attributetype, $v
*
* @return boolean the result of starting workflow.
*/
- private static function perform_finalize_upload_attachment($ocinstanceid, $mediapackagestr)
- {
+ private static function perform_finalize_upload_attachment($ocinstanceid, $mediapackagestr) {
try {
$apibridge = apibridge::get_instance($ocinstanceid);
// Get the transcription upload workflow.
@@ -406,8 +395,7 @@ private static function perform_finalize_upload_attachment($ocinstanceid, $media
*
* @return boolean the result of deletion.
*/
- public static function delete_transcription($ocinstanceid, $eventidentifier, $transcriptionidentifier)
- {
+ public static function delete_transcription($ocinstanceid, $eventidentifier, $transcriptionidentifier) {
$success = false;
$apibridge = apibridge::get_instance($ocinstanceid);
$mediapackagestr = $apibridge->get_event_media_package($eventidentifier);
@@ -435,8 +423,7 @@ public static function delete_transcription($ocinstanceid, $eventidentifier, $tr
*
* @return boolean the result of starting workflow after upload
*/
- public static function upload_single_transcription($file, $flavorservice, $ocinstanceid, $eventidentifier)
- {
+ public static function upload_single_transcription($file, $flavorservice, $ocinstanceid, $eventidentifier) {
$apibridge = apibridge::get_instance($ocinstanceid);
$mediapackagestr = $apibridge->get_event_media_package($eventidentifier);
$flavor = self::TRANSCRIPTION_FLAVOR_TYPE . "+{$flavorservice}";
@@ -452,8 +439,7 @@ public static function upload_single_transcription($file, $flavorservice, $ocins
*
* @param int $fileitemid transcription file item id
*/
- public static function remove_single_transcription_file($fileitemid)
- {
+ public static function remove_single_transcription_file($fileitemid) {
global $DB;
// Delete the file and everything related to it.
$files = $DB->get_recordset('files', [
diff --git a/classes/local/autocomplete_suggestion_helper.php b/classes/local/autocomplete_suggestion_helper.php
index bab00c02..c65b33d1 100644
--- a/classes/local/autocomplete_suggestion_helper.php
+++ b/classes/local/autocomplete_suggestion_helper.php
@@ -34,16 +34,15 @@
* @author Farbod Zamani Boroujeni
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class autocomplete_suggestion_helper
-{
+class autocomplete_suggestion_helper {
+
/**
* Get all available suggestions for contributor and creator (Presenter) metadata field.
* @param int $ocinstanceid Opencast instance id.
* @return array
*/
- public static function get_suggestions_for_creator_and_contributor($ocinstanceid)
- {
+ public static function get_suggestions_for_creator_and_contributor($ocinstanceid) {
// We gather all suggestions array lists from different methods and return it as one array.
// We use array_unique to make sure that there is no duplication.
// We use array_filter to make sure there is no empty elements.
@@ -66,8 +65,7 @@ public static function get_suggestions_for_creator_and_contributor($ocinstanceid
*
* @return array
*/
- private static function get_suggestions_from_course_teachers()
- {
+ private static function get_suggestions_from_course_teachers() {
global $COURSE;
// Getting the course context.
@@ -102,8 +100,7 @@ private static function get_suggestions_from_course_teachers()
*
* @return array
*/
- private static function get_suggestions_from_existing_uploadjobs()
- {
+ private static function get_suggestions_from_existing_uploadjobs() {
global $COURSE, $DB;
// Initialize the array list to return.
@@ -182,8 +179,7 @@ private static function get_suggestions_from_existing_uploadjobs()
* @param int $ocinstanceid Opencast instance id.
* @return array
*/
- private static function get_suggestions_from_opencast_course_videos($ocinstanceid)
- {
+ private static function get_suggestions_from_opencast_course_videos($ocinstanceid) {
global $COURSE;
// Initialize the array list to return.
diff --git a/classes/local/changeowner_form.php b/classes/local/changeowner_form.php
index abfbd9d9..fe276178 100644
--- a/classes/local/changeowner_form.php
+++ b/classes/local/changeowner_form.php
@@ -37,14 +37,13 @@
* @copyright 2022 Tamara Gunkel, University of Münster
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class changeowner_form extends moodleform
-{
+class changeowner_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $PAGE;
// Define mform.
diff --git a/classes/local/event.php b/classes/local/event.php
index 6ea5519c..1d18f176 100644
--- a/classes/local/event.php
+++ b/classes/local/event.php
@@ -37,8 +37,8 @@
* @copyright 2017 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class event
-{
+class event {
+
/** @var array Access control list. */
private array $acl = [];
@@ -55,8 +55,7 @@ class event
* @param int $id
* @param string $value
*/
- public function add_meta_data($id, $value)
- {
+ public function add_meta_data($id, $value) {
$this->metadatafields[] = ['id' => $id, 'value' => $value];
}
@@ -65,8 +64,7 @@ public function add_meta_data($id, $value)
*
* @return string json encoded metadata.
*/
- public function get_meta_data()
- {
+ public function get_meta_data() {
$metadata = [];
$metadata['label'] = "Opencast Series Dublincore";
@@ -81,8 +79,7 @@ public function get_meta_data()
*
* @param int $fileid
*/
- public function set_presentation($fileid)
- {
+ public function set_presentation($fileid) {
$fs = get_file_storage();
$this->presentation = $fs->get_file_by_id($fileid);
}
@@ -93,8 +90,7 @@ public function set_presentation($fileid)
* @param string $chunkuploadid
* @throws moodle_exception
*/
- public function set_chunkupload_presenter($chunkuploadid)
- {
+ public function set_chunkupload_presenter($chunkuploadid) {
if (!class_exists('\local_chunkupload\chunkupload_form_element')) {
throw new moodle_exception("local_chunkupload is not installed. This should never happen.");
}
@@ -107,8 +103,7 @@ public function set_chunkupload_presenter($chunkuploadid)
* @param string $chunkuploadid
* @throws moodle_exception
*/
- public function set_chunkupload_presentation($chunkuploadid)
- {
+ public function set_chunkupload_presentation($chunkuploadid) {
if (!class_exists('\local_chunkupload\chunkupload_form_element')) {
throw new moodle_exception("local_chunkupload is not installed. This should never happen.");
}
@@ -120,8 +115,7 @@ public function set_chunkupload_presentation($chunkuploadid)
*
* @return object|null
*/
- public function get_presentation()
- {
+ public function get_presentation() {
return $this->presentation;
}
@@ -130,8 +124,7 @@ public function get_presentation()
*
* @param int $fileid
*/
- public function set_presenter($fileid)
- {
+ public function set_presenter($fileid) {
$fs = get_file_storage();
$this->presenter = $fs->get_file_by_id($fileid);
}
@@ -141,8 +134,7 @@ public function set_presenter($fileid)
*
* @return object|null
*/
- public function get_presenter()
- {
+ public function get_presenter() {
return $this->presenter;
}
// End adding presenter option.
@@ -153,8 +145,7 @@ public function get_presenter()
* @param string|array $jsonacl acl arry or string as received from opencast.
* @throws moodle_exception
*/
- public function set_json_acl($jsonacl)
- {
+ public function set_json_acl($jsonacl) {
$jsonacl = is_string($jsonacl) ? json_decode($jsonacl) : $jsonacl;
$this->acl = $jsonacl;
@@ -171,8 +162,7 @@ public function set_json_acl($jsonacl)
* @param string $action
* @param string $role
*/
- public function add_acl($allow, $action, $role)
- {
+ public function add_acl($allow, $action, $role) {
$this->remove_acl($action, $role);
$this->acl[] = (object)['allow' => $allow, 'role' => $role, 'action' => $action];
@@ -184,8 +174,7 @@ public function add_acl($allow, $action, $role)
* @param string $action Action
* @param string $role Role name
*/
- public function has_acl($allow, $action, $role)
- {
+ public function has_acl($allow, $action, $role) {
$role = (object)['allow' => $allow, 'role' => $role, 'action' => $action];
return in_array($role, $this->acl);
}
@@ -195,8 +184,7 @@ public function has_acl($allow, $action, $role)
* @param string $action Action
* @param string $role Role name
*/
- public function remove_acl($action, $role)
- {
+ public function remove_acl($action, $role) {
foreach ($this->acl as $key => $acl) {
if (($acl->action == $action) && ($acl->role == $role)) {
@@ -211,8 +199,7 @@ public function remove_acl($action, $role)
*
* @return string
*/
- public function get_next_series_courseid()
- {
+ public function get_next_series_courseid() {
if (!$this->acl) {
return false;
@@ -234,8 +221,7 @@ public function get_next_series_courseid()
* Get the acl rules as array.
* @return array
*/
- public function get_acl()
- {
+ public function get_acl() {
return $this->acl;
}
@@ -244,8 +230,7 @@ public function get_acl()
*
* @return string.
*/
- public function get_json_acl()
- {
+ public function get_json_acl() {
return json_encode(array_values($this->acl));
}
@@ -255,8 +240,7 @@ public function get_json_acl()
* @param int $ocinstanceid Opencast instance id.
* @return string
*/
- public function get_processing($ocinstanceid)
- {
+ public function get_processing($ocinstanceid) {
$uploadworkflow = get_config('block_opencast', 'uploadworkflow_' . $ocinstanceid);
if (empty($uploadworkflow)) {
@@ -284,8 +268,7 @@ public function get_processing($ocinstanceid)
* @param int $ocinstanceid Opencast instance id.
* @return array form params.
*/
- public function get_form_params($ocinstanceid)
- {
+ public function get_form_params($ocinstanceid) {
$params = [];
$params['acl'] = $this->get_json_acl();
@@ -314,8 +297,7 @@ public function get_form_params($ocinstanceid)
* @return mixed false if task could not be created, id of inserted task otherwise.
*/
public static function create_duplication_task($ocinstanceid, $courseid, $seriesid,
- $eventid, $modulecleanup = false, $episodemodules = null)
- {
+ $eventid, $modulecleanup = false, $episodemodules = null) {
$task = new process_duplicate_event();
diff --git a/classes/local/eventstatus_notification_helper.php b/classes/local/eventstatus_notification_helper.php
index 928bca37..7002e93b 100644
--- a/classes/local/eventstatus_notification_helper.php
+++ b/classes/local/eventstatus_notification_helper.php
@@ -35,8 +35,8 @@
* @author Farbod Zamani Boroujeni
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class eventstatus_notification_helper
-{
+class eventstatus_notification_helper {
+
/**
* Save the event status notification job onto the db table to be processed later with cronjobs.
@@ -46,8 +46,7 @@ class eventstatus_notification_helper
* @param int $courseid Course id
* @param int $uploaderuserid userid of the uploader
*/
- public static function save_notification_jobs($ocinstanceid, $eventidentifier, $courseid, $uploaderuserid)
- {
+ public static function save_notification_jobs($ocinstanceid, $eventidentifier, $courseid, $uploaderuserid) {
global $DB;
// Initialize the notification job.
@@ -66,8 +65,7 @@ public static function save_notification_jobs($ocinstanceid, $eventidentifier, $
/**
* Process all transfers to opencast server.
*/
- public function cron()
- {
+ public function cron() {
global $DB;
// Get all waiting notification jobs.
@@ -97,8 +95,7 @@ public function cron()
* @return void
* @throws moodle_exception
*/
- protected function process_notification_job($job)
- {
+ protected function process_notification_job($job) {
global $DB;
$ocinstanceid = $job->ocinstanceid;
$apibridge = apibridge::get_instance($ocinstanceid);
@@ -164,8 +161,7 @@ protected function process_notification_job($job)
* @param object $video the video object retrieved from Opencast.
*
*/
- private function notify_users($job, $video)
- {
+ private function notify_users($job, $video) {
global $DB;
// Initialize the user list as an empty array.
$usertolist = [];
@@ -212,8 +208,7 @@ private function notify_users($job, $video)
* @param object $metadata represents the metadate object for the upload job.
*
*/
- public static function notify_users_upload_queue($job, $metadata)
- {
+ public static function notify_users_upload_queue($job, $metadata) {
global $DB;
// Initialize the user list as an empty array.
$usertolist = [];
@@ -270,8 +265,7 @@ public static function notify_users_upload_queue($job, $metadata)
* @param string $status status string code.
* @return string status message text.
*/
- private function get_status_message($status)
- {
+ private function get_status_message($status) {
switch ($status) {
case 'FAILED' :
return get_string('ocstatefailed', 'block_opencast');
diff --git a/classes/local/file_deletionmanager.php b/classes/local/file_deletionmanager.php
index 8f4663c1..2cd3027b 100644
--- a/classes/local/file_deletionmanager.php
+++ b/classes/local/file_deletionmanager.php
@@ -33,8 +33,8 @@
* @copyright 2018 Andreas Wagner, Synergy Learning
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class file_deletionmanager extends \file_system_filedir
-{
+class file_deletionmanager extends \file_system_filedir {
+
/**
* Delete all the users draft file entries that belongs to a videofile within
@@ -47,8 +47,7 @@ class file_deletionmanager extends \file_system_filedir
* @param int $coursecontextid
* @param int $itemid
*/
- public static function delete_draft_files_by_source($contenthash, $coursecontextid, $itemid = 0)
- {
+ public static function delete_draft_files_by_source($contenthash, $coursecontextid, $itemid = 0) {
global $DB;
$params = [
@@ -91,8 +90,7 @@ public static function delete_draft_files_by_source($contenthash, $coursecontext
* @param int $coursecontextid
* @param int $itemid
*/
- public static function delete_dot_files_by_source($coursecontextid, $itemid)
- {
+ public static function delete_dot_files_by_source($coursecontextid, $itemid) {
global $DB;
$params = [
@@ -130,8 +128,7 @@ public static function delete_dot_files_by_source($coursecontextid, $itemid)
* @param int $coursecontextid
* @param int $itemid
*/
- public static function track_draftitemid($coursecontextid, $itemid)
- {
+ public static function track_draftitemid($coursecontextid, $itemid) {
global $DB;
// Do some cleanup.
@@ -164,8 +161,7 @@ public static function track_draftitemid($coursecontextid, $itemid)
* It must be noted, that draft entries should have been removed within
* 4 days by filestorage cron, so we can do so some save cleanup here.
*/
- public static function cleanup_old_draftitemids()
- {
+ public static function cleanup_old_draftitemids() {
global $DB;
$old = time() - 5 * DAYSECS;
@@ -184,8 +180,7 @@ public static function cleanup_old_draftitemids()
*
* @param stored_file $storedfile
*/
- public static function fulldelete_file($storedfile)
- {
+ public static function fulldelete_file($storedfile) {
$filedir = new file_system_filedir();
// Delete .dot entry, see https://tracker.moodle.org/browse/MDL-65857.
diff --git a/classes/local/file_system_filedir.php b/classes/local/file_system_filedir.php
index 6cbc2d6b..0504bfbf 100644
--- a/classes/local/file_system_filedir.php
+++ b/classes/local/file_system_filedir.php
@@ -35,8 +35,8 @@
* @copyright 2018 Andreas Wagner, Synergy Learning
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class file_system_filedir extends \file_system_filedir
-{
+class file_system_filedir extends \file_system_filedir {
+
/**
* Unlink one file in the trashdir by contenthash
@@ -44,8 +44,7 @@ class file_system_filedir extends \file_system_filedir
* @param string $contenthash
* @return boolean true if succeeded
*/
- public function delete_file_from_trashdir($contenthash)
- {
+ public function delete_file_from_trashdir($contenthash) {
if (!$this->file_exists_in_trashdir($contenthash)) {
return false;
@@ -61,8 +60,7 @@ public function delete_file_from_trashdir($contenthash)
* @param string $contenthash
* @return boolean true, if the file exists in trashdir.
*/
- public function file_exists_in_trashdir($contenthash)
- {
+ public function file_exists_in_trashdir($contenthash) {
$filepath = $this->get_trash_fullpath_from_hash($contenthash);
return file_exists($filepath);
}
diff --git a/classes/local/flexible_table.php b/classes/local/flexible_table.php
index e4185b3b..06ab3603 100644
--- a/classes/local/flexible_table.php
+++ b/classes/local/flexible_table.php
@@ -37,14 +37,13 @@
* @copyright 2018 Andreas Wagner, Synergy Learning
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class flexible_table extends \flexible_table
-{
+class flexible_table extends \flexible_table {
+
/**
* Overridden method to change content and format of display notification.
*/
- public function print_nothing_to_display()
- {
+ public function print_nothing_to_display() {
// Render button to allow user to reset table preferences.
echo $this->render_reset_button();
diff --git a/classes/local/importvideos_coursesearch.php b/classes/local/importvideos_coursesearch.php
index 2dbf80f8..c447aa18 100644
--- a/classes/local/importvideos_coursesearch.php
+++ b/classes/local/importvideos_coursesearch.php
@@ -39,14 +39,13 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class importvideos_coursesearch extends import_course_search
-{
+class importvideos_coursesearch extends import_course_search {
+
/**
* Sets up the access restrictions for the courses to be displayed in the search.
*/
- protected function setup_restrictions()
- {
+ protected function setup_restrictions() {
$this->require_capability('block/opencast:manualimportsource');
}
}
diff --git a/classes/local/importvideos_select_series_form.php b/classes/local/importvideos_select_series_form.php
index 8c8f291f..0e98bc3f 100644
--- a/classes/local/importvideos_select_series_form.php
+++ b/classes/local/importvideos_select_series_form.php
@@ -37,14 +37,13 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class importvideos_select_series_form extends moodleform
-{
+class importvideos_select_series_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $PAGE;
// Define mform.
diff --git a/classes/local/importvideos_step1_form.php b/classes/local/importvideos_step1_form.php
index c4cefcf5..8365c496 100644
--- a/classes/local/importvideos_step1_form.php
+++ b/classes/local/importvideos_step1_form.php
@@ -37,14 +37,13 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class importvideos_step1_form extends moodleform
-{
+class importvideos_step1_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $PAGE;
// Define mform.
diff --git a/classes/local/importvideos_step2_form.php b/classes/local/importvideos_step2_form.php
index e8a86dbc..dd364796 100644
--- a/classes/local/importvideos_step2_form.php
+++ b/classes/local/importvideos_step2_form.php
@@ -37,14 +37,13 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class importvideos_step2_form extends moodleform
-{
+class importvideos_step2_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $PAGE;
// Define mform.
@@ -92,7 +91,7 @@ public function definition()
$mform->addElement('html', '
' . $info['title'] . '
');
foreach ($info['videos'] as $videoid => $label) {
$mform->addElement('advcheckbox', 'coursevideos[' . $videoid . ']', $label, null,
- array('group' => 'coursevideocheckboxes'));
+ ['group' => 'coursevideocheckboxes']);
}
}
$this->add_checkbox_controller('coursevideocheckboxes', null, null, 1);
@@ -107,8 +106,7 @@ public function definition()
* @param array $files Form files
* @return array Validation results
*/
- public function validation($data, $files)
- {
+ public function validation($data, $files) {
// Ask parent class for errors first.
$errors = parent::validation($data, $files);
diff --git a/classes/local/importvideos_step3_form.php b/classes/local/importvideos_step3_form.php
index 5afffcf5..9c4653b5 100644
--- a/classes/local/importvideos_step3_form.php
+++ b/classes/local/importvideos_step3_form.php
@@ -40,14 +40,13 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class importvideos_step3_form extends moodleform
-{
+class importvideos_step3_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $PAGE;
// Define mform.
diff --git a/classes/local/importvideos_step3_form_acl.php b/classes/local/importvideos_step3_form_acl.php
index 44cf5461..4a708435 100644
--- a/classes/local/importvideos_step3_form_acl.php
+++ b/classes/local/importvideos_step3_form_acl.php
@@ -37,14 +37,13 @@
* @copyright 2021 Farbod Zamani Boroujeni, ELAN e.V.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class importvideos_step3_form_acl extends moodleform
-{
+class importvideos_step3_form_acl extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $PAGE;
// Define mform.
diff --git a/classes/local/importvideos_step4_form.php b/classes/local/importvideos_step4_form.php
index d7cc1d37..71ddafc0 100644
--- a/classes/local/importvideos_step4_form.php
+++ b/classes/local/importvideos_step4_form.php
@@ -37,14 +37,13 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class importvideos_step4_form extends moodleform
-{
+class importvideos_step4_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $PAGE;
// Define mform.
diff --git a/classes/local/importvideosmanager.php b/classes/local/importvideosmanager.php
index 751ac023..13131b80 100644
--- a/classes/local/importvideosmanager.php
+++ b/classes/local/importvideosmanager.php
@@ -37,8 +37,8 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class importvideosmanager
-{
+class importvideosmanager {
+
/**
* Helperfunction to get the status of the manual import videos feature.
@@ -47,8 +47,7 @@ class importvideosmanager
* @param int $ocinstanceid Opencast instance id.
* @return boolean
*/
- public static function is_enabled_and_working_for_manualimport($ocinstanceid)
- {
+ public static function is_enabled_and_working_for_manualimport($ocinstanceid) {
// Get the status of the whole import featureset.
$config = get_config('block_opencast', 'importvideosenabled_' . $ocinstanceid);
@@ -120,8 +119,7 @@ public static function is_enabled_and_working_for_manualimport($ocinstanceid)
* @param int $ocinstanceid Opencast instance id.
* @return boolean
*/
- public static function is_enabled_and_working_for_coreimport($ocinstanceid)
- {
+ public static function is_enabled_and_working_for_coreimport($ocinstanceid) {
// Get the status of the whole import featureset.
$config = get_config('block_opencast', 'importvideosenabled_' . $ocinstanceid);
@@ -191,8 +189,7 @@ public static function is_enabled_and_working_for_coreimport($ocinstanceid)
* @param int $ocinstanceid Opencast instance id.
* @return boolean
*/
- public static function handle_series_modules_is_enabled_and_working($ocinstanceid)
- {
+ public static function handle_series_modules_is_enabled_and_working($ocinstanceid) {
// Get the status of the feature.
$config = get_config('block_opencast', 'importvideoshandleseriesenabled_' . $ocinstanceid);
@@ -223,8 +220,7 @@ public static function handle_series_modules_is_enabled_and_working($ocinstancei
* @param int $ocinstanceid Opencast instance id.
* @return boolean
*/
- public static function handle_episode_modules_is_enabled_and_working($ocinstanceid)
- {
+ public static function handle_episode_modules_is_enabled_and_working($ocinstanceid) {
// Get the status of the feature.
$config = get_config('block_opencast', 'importvideoshandleepisodeenabled_' . $ocinstanceid);
@@ -258,8 +254,7 @@ public static function handle_episode_modules_is_enabled_and_working($ocinstance
*
* @return array
*/
- public static function get_import_source_course_series_and_videos_menu($ocinstanceid, $sourcecourseid)
- {
+ public static function get_import_source_course_series_and_videos_menu($ocinstanceid, $sourcecourseid) {
global $PAGE;
// Get renderer.
@@ -312,8 +307,7 @@ public static function get_import_source_course_series_and_videos_menu($ocinstan
*
* @return array
*/
- public static function get_import_source_course_videos_summary($ocinstanceid, $sourcecourseid, $selectedcoursevideos)
- {
+ public static function get_import_source_course_videos_summary($ocinstanceid, $sourcecourseid, $selectedcoursevideos) {
global $PAGE;
// Get renderer.
@@ -369,8 +363,7 @@ public static function get_import_source_course_videos_summary($ocinstanceid, $s
* @return array
* @throws dml_exception
*/
- public static function get_import_source_course_series($ocinstanceid, $sourcecourseid)
- {
+ public static function get_import_source_course_series($ocinstanceid, $sourcecourseid) {
// Get an APIbridge instance.
$apibridge = apibridge::get_instance($ocinstanceid);
$series = $apibridge->get_course_series($sourcecourseid);
@@ -396,8 +389,7 @@ public static function get_import_source_course_series($ocinstanceid, $sourcecou
* @return stdClass
*/
public static function duplicate_videos($ocinstanceid, $sourcecourseid, $targetcourseid,
- $coursevideos, $modulecleanup = false)
- {
+ $coursevideos, $modulecleanup = false) {
global $USER;
$result = new stdClass();
@@ -502,8 +494,7 @@ public static function duplicate_videos($ocinstanceid, $sourcecourseid, $targetc
*
* @return string
*/
- public static function get_import_acl_source_series_videos_summary($ocinstanceid, $seriesid)
- {
+ public static function get_import_acl_source_series_videos_summary($ocinstanceid, $seriesid) {
global $PAGE;
// Get renderers.
@@ -554,8 +545,7 @@ public static function get_import_acl_source_series_videos_summary($ocinstanceid
*
* @return object
*/
- public static function change_acl($ocinstanceid, $sourcecourseid, $sourcecourseseries, $targetcourseid)
- {
+ public static function change_acl($ocinstanceid, $sourcecourseid, $sourcecourseseries, $targetcourseid) {
global $USER, $PAGE;
// Initialize the result as empty object to handle it later on.
diff --git a/classes/local/ingest_uploader.php b/classes/local/ingest_uploader.php
index b10b5409..e5685d96 100644
--- a/classes/local/ingest_uploader.php
+++ b/classes/local/ingest_uploader.php
@@ -44,8 +44,8 @@
* @copyright 2021 Tamara Gunkel WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class ingest_uploader
-{
+class ingest_uploader {
+
/** @var int Media package is created */
const STATUS_INGEST_CREATING_MEDIA_PACKAGE = 221;
@@ -71,8 +71,7 @@ class ingest_uploader
* @throws dml_exception
* @throws moodle_exception
*/
- public static function create_event($job)
- {
+ public static function create_event($job) {
global $DB;
$apibridge = apibridge::get_instance($job->ocinstanceid);
@@ -246,8 +245,7 @@ public static function create_event($job)
* @return false|string
* @throws Exception
*/
- protected static function create_episode_xml($job)
- {
+ protected static function create_episode_xml($job) {
$dom = new DOMDocument('1.0', 'utf-8');
@@ -307,8 +305,7 @@ protected static function create_episode_xml($job)
* @throws coding_exception
* @throws dml_exception
*/
- protected static function create_acl_xml($roles, $job)
- {
+ protected static function create_acl_xml($roles, $job) {
$mediapackageid = 'mediapackage-1';
if (!empty($job->mediapackage)) {
$mediapackagexml = new SimpleXMLElement($job->mediapackage);
@@ -396,8 +393,7 @@ protected static function create_acl_xml($roles, $job)
* @throws dml_exception
*/
public static function update_status_with_mediapackage(&$job, $status, $setmodified = true, $setstarted = false,
- $setsucceeded = false, $mediapackage = null)
- {
+ $setsucceeded = false, $mediapackage = null) {
global $DB;
$time = time();
if ($setstarted) {
@@ -423,8 +419,7 @@ public static function update_status_with_mediapackage(&$job, $status, $setmodif
* @param int $statuscode Status code
* @return lang_string|string Name of status code or empty if not found.
*/
- public static function get_status_string($statuscode)
- {
+ public static function get_status_string($statuscode) {
switch ($statuscode) {
case self::STATUS_INGEST_CREATING_MEDIA_PACKAGE :
return get_string('ingeststatecreatingmedispackage', 'block_opencast');
diff --git a/classes/local/liveupdate_helper.php b/classes/local/liveupdate_helper.php
index b2a057b1..dbb0e813 100644
--- a/classes/local/liveupdate_helper.php
+++ b/classes/local/liveupdate_helper.php
@@ -33,8 +33,8 @@
* @author Farbod Zamani Boroujeni
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class liveupdate_helper
-{
+class liveupdate_helper {
+
/**
* Returns the processing state live update hidden input flag.
*
@@ -42,8 +42,7 @@ class liveupdate_helper
* @param string $eventtitle video title
* @return string a hidden input as processing state item
*/
- public static function get_liveupdate_processing_hidden_input($identifier, $eventtitle)
- {
+ public static function get_liveupdate_processing_hidden_input($identifier, $eventtitle) {
$attributes = ['type' => 'hidden', 'name' => 'liveupdate_processing_item', 'value' => $identifier];
if (!empty($eventtitle)) {
$attributes['data-title'] = $eventtitle;
@@ -58,8 +57,7 @@ public static function get_liveupdate_processing_hidden_input($identifier, $even
* @param string $jobtitle job title
* @return string a hidden input for uploading job item
*/
- public static function get_liveupdate_uploading_hidden_input($jobid, $jobtitle)
- {
+ public static function get_liveupdate_uploading_hidden_input($jobid, $jobtitle) {
$attributes = ['type' => 'hidden', 'name' => 'liveupdate_uploading_item', 'value' => $jobid];
if (!empty($jobtitle)) {
$attributes['data-title'] = $jobtitle;
@@ -75,8 +73,7 @@ public static function get_liveupdate_uploading_hidden_input($jobid, $jobtitle)
* @param string $identifier event identifier
* @return array|string $info the live update info or empty string if error happens.
*/
- public static function get_processing_state_info($ocinstanceid, $identifier)
- {
+ public static function get_processing_state_info($ocinstanceid, $identifier) {
global $PAGE;
/** @var block_opencast_renderer $renderer */
$renderer = $PAGE->get_renderer('block_opencast');
@@ -110,8 +107,7 @@ public static function get_processing_state_info($ocinstanceid, $identifier)
* @param int $uploadjobid the id of upload job
* @return array|string $info the live update info or empty string if error happens.
*/
- public static function get_uploading_info($uploadjobid)
- {
+ public static function get_uploading_info($uploadjobid) {
global $DB, $PAGE;
// Get single upload job record to extract its current info.
diff --git a/classes/local/lti_helper.php b/classes/local/lti_helper.php
index 5a2efcb7..7d20adde 100644
--- a/classes/local/lti_helper.php
+++ b/classes/local/lti_helper.php
@@ -31,8 +31,8 @@
* @copyright 2022 Tamara Gunkel WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class lti_helper
-{
+class lti_helper {
+
/**
* Create necessary lti parameters.
@@ -43,15 +43,14 @@ class lti_helper
*
* @return array lti parameters
*/
- public static function create_lti_parameters($consumerkey, $consumersecret, $endpoint, $customtool)
- {
+ public static function create_lti_parameters($consumerkey, $consumersecret, $endpoint, $customtool) {
global $CFG, $COURSE, $USER;
- $helper = new oauth_helper(array('oauth_consumer_key' => $consumerkey,
- 'oauth_consumer_secret' => $consumersecret));
+ $helper = new oauth_helper(['oauth_consumer_key' => $consumerkey,
+ 'oauth_consumer_secret' => $consumersecret, ]);
// Set all necessary parameters.
- $params = array();
+ $params = [];
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = $helper->get_nonce();
$params['oauth_timestamp'] = $helper->get_timestamp();
diff --git a/classes/local/ltimodulemanager.php b/classes/local/ltimodulemanager.php
index ad7841b2..4676d7e8 100644
--- a/classes/local/ltimodulemanager.php
+++ b/classes/local/ltimodulemanager.php
@@ -41,8 +41,8 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class ltimodulemanager
-{
+class ltimodulemanager {
+
/**
* Helperfunction to get the list of available preconfigured LTI tools.
@@ -51,8 +51,7 @@ class ltimodulemanager
*
* @return array
*/
- public static function get_preconfigured_tools()
- {
+ public static function get_preconfigured_tools() {
global $CFG;
// Require LTI library.
@@ -81,8 +80,7 @@ public static function get_preconfigured_tools()
* @param int $ocinstanceid Opencast instance id.
* @return int|boolean
*/
- public static function get_preconfigured_tool_for_series($ocinstanceid)
- {
+ public static function get_preconfigured_tool_for_series($ocinstanceid) {
// Get the preconfigured LTI tool to be used.
$toolid = get_config('block_opencast', 'addltipreconfiguredtool_' . $ocinstanceid);
@@ -109,8 +107,7 @@ public static function get_preconfigured_tool_for_series($ocinstanceid)
* @param int $ocinstanceid Opencast instance id.
* @return int|boolean
*/
- public static function get_preconfigured_tool_for_episode($ocinstanceid)
- {
+ public static function get_preconfigured_tool_for_episode($ocinstanceid) {
// Get the preconfigured LTI tool to be used.
$toolid = get_config('block_opencast', 'addltiepisodepreconfiguredtool_' . $ocinstanceid);
@@ -137,8 +134,7 @@ public static function get_preconfigured_tool_for_episode($ocinstanceid)
* @param int $ocinstanceid Opencast instance id.
* @return boolean
*/
- public static function is_enabled_and_working_for_series($ocinstanceid)
- {
+ public static function is_enabled_and_working_for_series($ocinstanceid) {
// Get the status of the feature.
$config = get_config('block_opencast', 'addltienabled_' . $ocinstanceid);
@@ -158,8 +154,7 @@ public static function is_enabled_and_working_for_series($ocinstanceid)
* @param int $ocinstanceid Opencast instance id.
* @return boolean
*/
- public static function is_working_for_series($ocinstanceid)
- {
+ public static function is_working_for_series($ocinstanceid) {
// Get the preconfigured tool.
$tool = self::get_preconfigured_tool_for_series($ocinstanceid);
@@ -192,8 +187,7 @@ public static function is_working_for_series($ocinstanceid)
* @param int $ocinstanceid Opencast instance id.
* @return boolean
*/
- public static function is_enabled_and_working_for_episodes($ocinstanceid)
- {
+ public static function is_enabled_and_working_for_episodes($ocinstanceid) {
// Remember the status for subsequent calls.
static $enabledandworking = null;
@@ -230,8 +224,7 @@ public static function is_enabled_and_working_for_episodes($ocinstanceid)
* @param int $ocinstanceid Opencast instance id.
* @return boolean
*/
- public static function is_working_for_episodes($ocinstanceid)
- {
+ public static function is_working_for_episodes($ocinstanceid) {
// Remember the status for subsequent calls.
static $working = null;
@@ -288,8 +281,7 @@ public static function is_working_for_episodes($ocinstanceid)
* @return boolean
*/
public static function create_module_for_series($ocinstanceid, $courseid, $title, $seriesid, $sectionid = 0, $introtext = '',
- $introformat = FORMAT_HTML, $availability = null)
- {
+ $introformat = FORMAT_HTML, $availability = null) {
global $CFG, $DB;
// Require mod library.
@@ -358,8 +350,7 @@ public static function create_module_for_series($ocinstanceid, $courseid, $title
*/
public static function create_module_for_episode($ocinstanceid, $courseid, $title, $episodeuuid, $sectionid = 0,
$introtext = '', $introformat = FORMAT_HTML,
- $availability = null)
- {
+ $availability = null) {
global $CFG, $DB;
// Require mod library.
@@ -428,8 +419,7 @@ public static function create_module_for_episode($ocinstanceid, $courseid, $titl
* @return object
*/
public static function build_lti_modinfo($pluginid, $course, $title, $sectionid, $toolid, $instructorcustomparameters,
- $introtext = '', $introformat = FORMAT_HTML, $availability = null)
- {
+ $introtext = '', $introformat = FORMAT_HTML, $availability = null) {
global $DB;
// Create standard class object.
@@ -482,13 +472,12 @@ public static function build_lti_modinfo($pluginid, $course, $title, $sectionid,
*
* @return int|boolean
*/
- public static function get_module_for_series($ocinstanceid, $courseid, $series)
- {
+ public static function get_module_for_series($ocinstanceid, $courseid, $series) {
global $DB;
// Get the LTI series module id.
$moduleid = $DB->get_field('block_opencast_ltimodule', 'cmid', ['ocinstanceid' => $ocinstanceid,
- 'courseid' => $courseid, 'seriesid' => $series,]);
+ 'courseid' => $courseid, 'seriesid' => $series, ]);
// If there is a LTI series module found.
if ($moduleid) {
@@ -524,8 +513,7 @@ public static function get_module_for_series($ocinstanceid, $courseid, $series)
*
* @return array of course module IDs. The course module ID is used as array key, the references series ID as array value.
*/
- public static function get_modules_for_series_linking_to_other_course($ocinstanceid, $modulecourseid, $referencedcourseid)
- {
+ public static function get_modules_for_series_linking_to_other_course($ocinstanceid, $modulecourseid, $referencedcourseid) {
global $DB;
// Get an APIbridge instance.
@@ -552,7 +540,7 @@ public static function get_modules_for_series_linking_to_other_course($ocinstanc
' ORDER BY cm.added ASC';
$params = ['toolid' => $toolid,
'course' => $modulecourseid,
- 'referencedseriesid' => '%' . $series->series . '%',];
+ 'referencedseriesid' => '%' . $series->series . '%', ];
$seriesmodules = $DB->get_fieldset_sql($sql, $params);
// If there are any existing series modules in this course.
@@ -580,8 +568,7 @@ public static function get_modules_for_series_linking_to_other_course($ocinstanc
*
* @return bool
*/
- public static function cleanup_series_modules($ocinstanceid, $modulecourseid, $referencedcourseid, $duplicatedseries)
- {
+ public static function cleanup_series_modules($ocinstanceid, $modulecourseid, $referencedcourseid, $duplicatedseries) {
global $CFG, $DB;
// Require grade library. For an unknown reason, this is needed when updating the module.
@@ -679,13 +666,12 @@ public static function cleanup_series_modules($ocinstanceid, $modulecourseid, $r
*
* @return array
*/
- public static function get_modules_for_episodes($ocinstanceid, $courseid)
- {
+ public static function get_modules_for_episodes($ocinstanceid, $courseid) {
global $DB;
// Get the LTI episode module ids.
$modules = $DB->get_records_menu('block_opencast_ltiepisode', ['ocinstanceid' => $ocinstanceid,
- 'courseid' => $courseid,], '', 'episodeuuid, cmid');
+ 'courseid' => $courseid, ], '', 'episodeuuid, cmid');
// Return the LTI module ids.
return $modules;
@@ -701,8 +687,7 @@ public static function get_modules_for_episodes($ocinstanceid, $courseid)
*
* @return int|boolean
*/
- public static function pick_module_for_episode($ocinstanceid, $modules, $courseid, $episodeuuid)
- {
+ public static function pick_module_for_episode($ocinstanceid, $modules, $courseid, $episodeuuid) {
global $DB;
// If there isn't an episode for the given episode.
@@ -746,8 +731,7 @@ public static function pick_module_for_episode($ocinstanceid, $modules, $coursei
*
* @return int|boolean
*/
- public static function get_module_for_episode($ocinstanceid, $courseid, $episodeuuid)
- {
+ public static function get_module_for_episode($ocinstanceid, $courseid, $episodeuuid) {
// Get the existing modules of the course.
$modules = self::get_modules_for_episodes($ocinstanceid, $courseid);
@@ -773,8 +757,7 @@ public static function get_module_for_episode($ocinstanceid, $courseid, $episode
* @return array
*/
public static function get_modules_for_episodes_linking_to_other_course($ocinstanceid, $modulecourseid, $referencedcourseid,
- $onlytheseepisodes = null)
- {
+ $onlytheseepisodes = null) {
// Get an APIbridge instance.
$apibridge = apibridge::get_instance($ocinstanceid);
@@ -819,8 +802,7 @@ public static function get_modules_for_episodes_linking_to_other_course($ocinsta
*
* @return array
*/
- public static function get_modules_for_episode_linking_to_other_course($ocinstanceid, $modulecourseid, $referencedepisodeid)
- {
+ public static function get_modules_for_episode_linking_to_other_course($ocinstanceid, $modulecourseid, $referencedepisodeid) {
global $DB;
// Get the id of the preconfigured tool.
@@ -838,7 +820,7 @@ public static function get_modules_for_episode_linking_to_other_course($ocinstan
'AND ' . $DB->sql_like('l.instructorcustomparameters', ':referencedepisodeid');
$params = ['toolid' => $toolid,
'course' => $modulecourseid,
- 'referencedepisodeid' => '%' . $referencedepisodeid . '%',];
+ 'referencedepisodeid' => '%' . $referencedepisodeid . '%', ];
$episodemodules = $DB->get_fieldset_sql($sql, $params);
// If there are any existing episode modules in this course.
@@ -867,8 +849,7 @@ public static function get_modules_for_episode_linking_to_other_course($ocinstan
*
* @return bool
*/
- public static function cleanup_episode_modules($ocinstanceid, $modulecourseid, $episodemodules, $episodeid)
- {
+ public static function cleanup_episode_modules($ocinstanceid, $modulecourseid, $episodemodules, $episodeid) {
global $CFG, $DB;
// Require course module library.
@@ -945,8 +926,7 @@ public static function cleanup_episode_modules($ocinstanceid, $modulecourseid, $
* @param int $ocinstanceid Opencast instance id.
* @return string
*/
- public static function get_default_title_for_series($ocinstanceid)
- {
+ public static function get_default_title_for_series($ocinstanceid) {
// Get the default title from the admin settings.
$defaulttitle = get_config('block_opencast', 'addltidefaulttitle_' . $ocinstanceid);
@@ -968,8 +948,7 @@ public static function get_default_title_for_series($ocinstanceid)
*
* @return string
*/
- public static function get_default_title_for_episode($ocinstanceid, $episodeuuid)
- {
+ public static function get_default_title_for_episode($ocinstanceid, $episodeuuid) {
// Get an APIbridge instance.
$apibridge = apibridge::get_instance($ocinstanceid);
@@ -1004,8 +983,7 @@ public static function get_default_title_for_episode($ocinstanceid, $episodeuuid
*
* @return string
*/
- public static function get_default_intro_for_episode($ocinstanceid, $episodeuuid)
- {
+ public static function get_default_intro_for_episode($ocinstanceid, $episodeuuid) {
// Get an APIbridge instance.
$apibridge = apibridge::get_instance($ocinstanceid);
@@ -1044,8 +1022,7 @@ public static function get_default_intro_for_episode($ocinstanceid, $episodeuuid
*
* @return array
*/
- public static function get_course_sections($courseid)
- {
+ public static function get_course_sections($courseid) {
// Get course format.
$courseformat = course_get_format($courseid);
@@ -1079,8 +1056,7 @@ public static function get_course_sections($courseid)
*
* @return bool
*/
- public static function is_valid_episode_id($episodeid)
- {
+ public static function is_valid_episode_id($episodeid) {
$uuidv4pattern = '/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i';
if (strlen($episodeid) != 36 || preg_match($uuidv4pattern, $episodeid) !== 1) {
return false;
@@ -1096,8 +1072,7 @@ public static function is_valid_episode_id($episodeid)
*
* @return int The number of updated lti modules.
*/
- public static function update_existing_lti_modules()
- {
+ public static function update_existing_lti_modules() {
global $DB, $CFG;
// We need mod and grade libraries to get module information.
@@ -1217,8 +1192,7 @@ public static function update_existing_lti_modules()
*
* @return int The number of unrecorded lti modules.
*/
- public static function record_manually_added_lti_modules()
- {
+ public static function record_manually_added_lti_modules() {
global $DB;
// Get all available opencast instances to get all the configured tool ids.
$ocinstances = settings_api::get_ocinstances();
@@ -1361,8 +1335,7 @@ public static function record_manually_added_lti_modules()
*
* @return int number of deleted modules.
*/
- public static function cleanup_lti_module_entries()
- {
+ public static function cleanup_lti_module_entries() {
global $DB;
$deletedrecordsnum = 0;
@@ -1459,8 +1432,7 @@ public static function cleanup_lti_module_entries()
* @param int $courseid course id
* @return boolean
*/
- private static function check_course($courseid)
- {
+ private static function check_course($courseid) {
global $DB;
if (empty($courseid)) {
return false;
@@ -1476,8 +1448,7 @@ private static function check_course($courseid)
* @param int $ocinstanceid opencast instance id
* @return boolean
*/
- private static function check_opencast_config($ocinstanceid)
- {
+ private static function check_opencast_config($ocinstanceid) {
if (empty($ocinstanceid)) {
return false;
}
@@ -1506,8 +1477,7 @@ private static function check_opencast_config($ocinstanceid)
* @param int $courseid course id
* @return boolean
*/
- private static function check_module($cmid, $courseid)
- {
+ private static function check_module($cmid, $courseid) {
if (empty($cmid) || empty($courseid)) {
return false;
}
@@ -1525,8 +1495,7 @@ private static function check_module($cmid, $courseid)
* @param int $ocinstanceid opencast instance id
* @return boolean
*/
- private static function check_opencast_episode($identifier, $ocinstanceid)
- {
+ private static function check_opencast_episode($identifier, $ocinstanceid) {
if (empty($identifier) || empty($ocinstanceid)) {
return false;
}
@@ -1542,8 +1511,7 @@ private static function check_opencast_episode($identifier, $ocinstanceid)
* @param int $ocinstanceid opencast instance id
* @return boolean
*/
- private static function check_opencast_series($identifier, $ocinstanceid)
- {
+ private static function check_opencast_series($identifier, $ocinstanceid) {
if (empty($identifier) || empty($ocinstanceid)) {
return false;
}
diff --git a/classes/local/managedefaults_form.php b/classes/local/managedefaults_form.php
index 4dfeabd3..4623edc1 100644
--- a/classes/local/managedefaults_form.php
+++ b/classes/local/managedefaults_form.php
@@ -43,13 +43,12 @@
* @author Farbod Zamani Boroujeni
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class managedefaults_form extends moodleform
-{
+class managedefaults_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $CFG, $PAGE;
// Get the renderer to use its methods.
$this->renderer = $PAGE->get_renderer('block_opencast');
@@ -111,8 +110,7 @@ public function definition()
* @return string
* @throws coding_exception
*/
- protected function try_get_string($identifier, $component = '', $a = null)
- {
+ protected function try_get_string($identifier, $component = '', $a = null) {
if (!get_string_manager()->string_exists($identifier, $component)) {
return ucfirst($identifier);
} else {
@@ -126,8 +124,7 @@ protected function try_get_string($identifier, $component = '', $a = null)
* @param string $belongsto decides which default sets the element belongs to.
* @param string $default the default value that user has already set.
*/
- protected function generate_element($field, $belongsto, $default = null)
- {
+ protected function generate_element($field, $belongsto, $default = null) {
$mform = $this->_form;
$param = [];
$attributes = [];
diff --git a/classes/local/notifications.php b/classes/local/notifications.php
index 82f7b5f7..fdb5a6f2 100644
--- a/classes/local/notifications.php
+++ b/classes/local/notifications.php
@@ -35,8 +35,8 @@
* @copyright 2018 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class notifications
-{
+class notifications {
+
/**
* Helperfunction to send all following messages .
@@ -47,8 +47,7 @@ class notifications
* @param string $body Body
* @param string $format Format
*/
- private static function send_message($messagetype, $touser, $subject, $body, $format = FORMAT_PLAIN)
- {
+ private static function send_message($messagetype, $touser, $subject, $body, $format = FORMAT_PLAIN) {
$message = new message();
$message->courseid = SITEID;
@@ -72,8 +71,7 @@ private static function send_message($messagetype, $touser, $subject, $body, $fo
* @param int $courseid
* @param array $backupeventids
*/
- public static function notify_failed_course_series($courseid, $backupeventids)
- {
+ public static function notify_failed_course_series($courseid, $backupeventids) {
global $DB, $PAGE;
$a = (object)[
@@ -103,8 +101,7 @@ public static function notify_failed_course_series($courseid, $backupeventids)
* @param int $courseid Course id
* @param array $missingevents Missing events
*/
- public static function notify_missing_events($courseid, $missingevents)
- {
+ public static function notify_missing_events($courseid, $missingevents) {
global $DB, $PAGE;
$a = (object)[
@@ -133,8 +130,7 @@ public static function notify_missing_events($courseid, $missingevents)
* @param string $identifier
* @param Exception $e
*/
- public static function notify_error($identifier, Exception $e = null)
- {
+ public static function notify_error($identifier, Exception $e = null) {
$subject = get_string('erroremailsubj', 'block_opencast');
@@ -156,8 +152,7 @@ public static function notify_error($identifier, Exception $e = null)
* Notify user that email to support was successfully sent.
* @param string $message Message that was sent to the support
*/
- public static function notify_problem_reported($message)
- {
+ public static function notify_problem_reported($message) {
global $USER;
self::send_message('reportproblem_confirmation', $USER,
@@ -170,8 +165,7 @@ public static function notify_problem_reported($message)
*
* @param int $courseid
*/
- public static function notify_failed_importmode($courseid)
- {
+ public static function notify_failed_importmode($courseid) {
global $DB, $PAGE;
$a = (object)[
@@ -195,8 +189,7 @@ public static function notify_failed_importmode($courseid)
*
* @param int $courseid
*/
- public static function notify_missing_sourcecourseid($courseid)
- {
+ public static function notify_missing_sourcecourseid($courseid) {
global $DB, $PAGE;
$a = (object)[
@@ -220,8 +213,7 @@ public static function notify_missing_sourcecourseid($courseid)
*
* @param int $courseid
*/
- public static function notify_missing_seriesid($courseid)
- {
+ public static function notify_missing_seriesid($courseid) {
global $DB, $PAGE;
$a = (object)[
@@ -247,8 +239,7 @@ public static function notify_missing_seriesid($courseid)
* @param int $sourcecourseid
* @param string $seriesid
*/
- public static function notify_failed_series_acl_change($courseid, $sourcecourseid, $seriesid)
- {
+ public static function notify_failed_series_acl_change($courseid, $sourcecourseid, $seriesid) {
global $DB, $PAGE;
$a = (object)[
@@ -281,8 +272,7 @@ public static function notify_failed_series_acl_change($courseid, $sourcecoursei
* @param int $sourcecourseid
* @param array $failed falied events.
*/
- public static function notify_failed_events_acl_change($courseid, $sourcecourseid, $failed)
- {
+ public static function notify_failed_events_acl_change($courseid, $sourcecourseid, $failed) {
global $DB, $PAGE;
$a = (object)[
@@ -318,8 +308,7 @@ public static function notify_failed_events_acl_change($courseid, $sourcecoursei
* @param int $sourcecourseid
* @param string $seriesid
*/
- public static function notify_failed_series_mapping($courseid, $sourcecourseid, $seriesid)
- {
+ public static function notify_failed_series_mapping($courseid, $sourcecourseid, $seriesid) {
global $DB, $PAGE;
$a = (object)[
@@ -352,8 +341,7 @@ public static function notify_failed_series_mapping($courseid, $sourcecourseid,
* @param string $message the message containing the status of the event.
* @param object $video the video object to get title and identifier.
*/
- public static function notify_event_status($courseid, $touser, $message, $video)
- {
+ public static function notify_event_status($courseid, $touser, $message, $video) {
global $DB;
$a = (object)[
@@ -381,8 +369,7 @@ public static function notify_event_status($courseid, $touser, $message, $video)
* @param int $waitingnum the number of jobs in the queue ahead
* @param string $videotitle the title of the video
*/
- public static function notify_upload_queue_status($courseid, $touser, $waitingnum, $videotitle)
- {
+ public static function notify_upload_queue_status($courseid, $touser, $waitingnum, $videotitle) {
global $DB;
$a = (object)[
@@ -410,8 +397,7 @@ public static function notify_upload_queue_status($courseid, $touser, $waitingnu
* @param string $exceptionmessage extra exception message to pass along the normal message.
*/
public static function notify_cleanup_imported_modules_force_deletion($courseid, $workflowid, $notificationtype,
- $exceptionmessage = '')
- {
+ $exceptionmessage = '') {
global $DB;
$a = (object)[
diff --git a/classes/local/scheduledvisibility_form.php b/classes/local/scheduledvisibility_form.php
index c34ad164..26263be1 100644
--- a/classes/local/scheduledvisibility_form.php
+++ b/classes/local/scheduledvisibility_form.php
@@ -42,14 +42,13 @@
* @author Farbod Zamani Boroujeni
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class scheduledvisibility_form extends moodleform
-{
+class scheduledvisibility_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $PAGE;
$mform = $this->_form;
@@ -171,8 +170,7 @@ public function definition()
* @param array $files
* @return array the errors that were found
*/
- public function validation($data, $files)
- {
+ public function validation($data, $files) {
$errors = parent::validation($data, $files);
// Deducting 2 minutes from the time, to let teachers finish the form.
$customminutes = [
diff --git a/classes/local/series_form.php b/classes/local/series_form.php
index c3f8ac4d..b2789abe 100644
--- a/classes/local/series_form.php
+++ b/classes/local/series_form.php
@@ -44,14 +44,13 @@
* @author Tamara Gunkel
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class series_form extends moodleform
-{
+class series_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $USER, $PAGE;
// Get the renderer to use its methods.
$renderer = $PAGE->get_renderer('block_opencast');
@@ -192,8 +191,7 @@ public function definition()
* @return string
* @throws coding_exception
*/
- protected function try_get_string($identifier, $component = '', $a = null)
- {
+ protected function try_get_string($identifier, $component = '', $a = null) {
if (!get_string_manager()->string_exists($identifier, $component)) {
return ucfirst($identifier);
} else {
@@ -206,8 +204,7 @@ protected function try_get_string($identifier, $component = '', $a = null)
* @param string $fieldname the name of the catalog field which is defined as id in metadata set
* @return string|array $value An array or string derived from metadata
*/
- protected function extract_value($fieldname)
- {
+ protected function extract_value($fieldname) {
if (array_key_exists('metadata', $this->_customdata)) {
$metadata = $this->_customdata['metadata'];
diff --git a/classes/local/updatemetadata_form.php b/classes/local/updatemetadata_form.php
index 73ca4907..608bedfb 100644
--- a/classes/local/updatemetadata_form.php
+++ b/classes/local/updatemetadata_form.php
@@ -45,14 +45,13 @@
* @author Farbod Zamani
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class updatemetadata_form extends moodleform
-{
+class updatemetadata_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $PAGE;
$mform = $this->_form;
@@ -169,8 +168,7 @@ public function definition()
* @return string
* @throws coding_exception
*/
- protected function try_get_string($identifier, $component = '', $a = null)
- {
+ protected function try_get_string($identifier, $component = '', $a = null) {
if (!get_string_manager()->string_exists($identifier, $component)) {
return ucfirst($identifier);
} else {
@@ -183,8 +181,7 @@ protected function try_get_string($identifier, $component = '', $a = null)
* @param string $fieldname the name of the catalog field which is defined as id in metadata set
* @return string|array $value An array or string derived from metadata
*/
- protected function extract_value($fieldname)
- {
+ protected function extract_value($fieldname) {
$metadata = $this->_customdata['metadata'];
foreach ($metadata as $data) {
diff --git a/classes/local/upload_helper.php b/classes/local/upload_helper.php
index 64557be9..fab9f4f0 100644
--- a/classes/local/upload_helper.php
+++ b/classes/local/upload_helper.php
@@ -48,8 +48,8 @@
* @author Andreas Wagner
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class upload_helper
-{
+class upload_helper {
+
/** @var string File area id where videos are uploaded */
const OC_FILEAREA = 'videotoupload';
@@ -77,8 +77,7 @@ class upload_helper
* @param int $statuscode Status code
* @return lang_string|string Name of status code or empty if not found.
*/
- public static function get_status_string($statuscode)
- {
+ public static function get_status_string($statuscode) {
switch ($statuscode) {
case self::STATUS_READY_TO_UPLOAD :
@@ -105,8 +104,7 @@ public static function get_status_string($statuscode)
* @param int $courseid Course id
* @return array
*/
- public static function get_upload_jobs($ocinstanceid, $courseid)
- {
+ public static function get_upload_jobs($ocinstanceid, $courseid) {
global $DB, $CFG;
if ($CFG->branch >= 311) {
@@ -156,8 +154,7 @@ public static function get_upload_jobs($ocinstanceid, $courseid)
* @param object $options Options
* @param object $visibility Visibility object
*/
- public static function save_upload_jobs($ocinstanceid, $courseid, $options, $visibility = null)
- {
+ public static function save_upload_jobs($ocinstanceid, $courseid, $options, $visibility = null) {
global $DB, $USER;
// Find the current files for the jobs.
@@ -297,8 +294,7 @@ public static function save_upload_jobs($ocinstanceid, $courseid, $options, $vis
* @return bool
* @throws dml_exception
*/
- public static function delete_video_draft($jobtodelete)
- {
+ public static function delete_video_draft($jobtodelete) {
global $DB;
// Check again shortly before deletion if the status is still STATUS_READY_TO_UPLOAD.
if ($DB->record_exists('block_opencast_uploadjob',
@@ -332,8 +328,7 @@ public static function delete_video_draft($jobtodelete)
* @param object $job
* @param string $eventidentifier
*/
- protected function upload_succeeded($job, $eventidentifier)
- {
+ protected function upload_succeeded($job, $eventidentifier) {
global $DB;
$apibridge = apibridge::get_instance($job->ocinstanceid);
@@ -418,8 +413,7 @@ protected function upload_succeeded($job, $eventidentifier)
* @param object $job Job that failed
* @param string $errormessage Error message
*/
- protected function upload_failed($job, $errormessage)
- {
+ protected function upload_failed($job, $errormessage) {
global $DB;
// Update the job to enqueue again.
@@ -469,8 +463,7 @@ protected function upload_failed($job, $errormessage)
* @param bool $setstarted if true, the value timestarted of the job is set to the current time.
* @param bool $setsucceeded if true, the value timesucceeded of the job is set to the current time.
*/
- protected function update_status(&$job, $status, $setmodified = true, $setstarted = false, $setsucceeded = false)
- {
+ protected function update_status(&$job, $status, $setmodified = true, $setstarted = false, $setsucceeded = false) {
global $DB;
$time = time();
if ($setstarted) {
@@ -497,8 +490,7 @@ protected function update_status(&$job, $status, $setmodified = true, $setstarte
* @return false | object either false -> rerun later or object -> upload successful.
* @throws moodle_exception
*/
- protected function process_upload_job($job)
- {
+ protected function process_upload_job($job) {
global $DB, $SITE;
$stepsuccessful = false;
$apibridge = apibridge::get_instance($job->ocinstanceid);
@@ -688,8 +680,7 @@ protected function process_upload_job($job)
/**
* Process all transfers to opencast server.
*/
- public function cron()
- {
+ public function cron() {
global $DB;
$ocinstances = settings_api::get_ocinstances();
@@ -742,8 +733,7 @@ public function cron()
* @param int $courseid
* @return object
*/
- public static function get_opencast_upload_context($courseid)
- {
+ public static function get_opencast_upload_context($courseid) {
global $DB;
$sql = "SELECT bi.* FROM {block_instances} bi " .
@@ -771,8 +761,7 @@ public static function get_opencast_upload_context($courseid)
* @param int $ocinstanceid Opencast instance id.
* @return array $metadatacatalog the metadata catalog array of stdClasses
*/
- public static function get_opencast_metadata_catalog($ocinstanceid)
- {
+ public static function get_opencast_metadata_catalog($ocinstanceid) {
$metadatacatalog = json_decode(get_config('block_opencast', 'metadata_' . $ocinstanceid));
return !empty($metadatacatalog) ? $metadatacatalog : [];
}
@@ -782,8 +771,7 @@ public static function get_opencast_metadata_catalog($ocinstanceid)
* @param stdClass $job
* @param object $apibridge
*/
- public static function ensure_series_metadata($job, $apibridge)
- {
+ public static function ensure_series_metadata($job, $apibridge) {
$metadata = json_decode($job->metadata);
$mtseries = array_search('isPartOf', array_column($metadata, 'id'));
$series = null;
diff --git a/classes/local/visibility_form.php b/classes/local/visibility_form.php
index a6f9a054..afaa6b26 100644
--- a/classes/local/visibility_form.php
+++ b/classes/local/visibility_form.php
@@ -43,14 +43,13 @@
* @author Tamara Gunkel
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class visibility_form extends moodleform
-{
+class visibility_form extends moodleform {
+
/**
* Form definition.
*/
- public function definition()
- {
+ public function definition() {
global $PAGE;
$mform = $this->_form;
@@ -196,8 +195,7 @@ public function definition()
* @param array $files
* @return array the errors that were found
*/
- public function validation($data, $files)
- {
+ public function validation($data, $files) {
$errors = parent::validation($data, $files);
if ($data['visibility'] == block_opencast_renderer::GROUP && empty($data['groups'])) {
$errors['visibility'] = get_string('emptyvisibilitygroups', 'block_opencast');
diff --git a/classes/local/visibility_helper.php b/classes/local/visibility_helper.php
index 66575215..5dd903de 100644
--- a/classes/local/visibility_helper.php
+++ b/classes/local/visibility_helper.php
@@ -37,8 +37,8 @@
* @author Farbod Zamani Boroujeni
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class visibility_helper
-{
+class visibility_helper {
+
/** @var int visibility change failed */
const STATUS_FAILED = 0;
@@ -54,8 +54,7 @@ class visibility_helper
/**
* Process all scheduled change visibility jobs.
*/
- public function cron()
- {
+ public function cron() {
global $DB;
// Get the scheduled change visibility jobs with the pending status.
@@ -107,8 +106,7 @@ public function cron()
* @return boolean
* @throws moodle_exception
*/
- protected function process_scheduled_change_visibility_job($job)
- {
+ protected function process_scheduled_change_visibility_job($job) {
$status = self::STATUS_FAILED;
// Extract all the required parameters to perform the change_visibility function.
@@ -125,7 +123,7 @@ protected function process_scheduled_change_visibility_job($job)
$apibridge = apibridge::get_instance($ocinstanceid);
$allowedvisibilitystates = [block_opencast_renderer::VISIBLE,
- block_opencast_renderer::HIDDEN, block_opencast_renderer::GROUP,];
+ block_opencast_renderer::HIDDEN, block_opencast_renderer::GROUP, ];
if (!in_array($visibility, $allowedvisibilitystates)) {
mtrace('job ' . $job->id . ':(ERROR) Has invalid visibility state.');
@@ -193,8 +191,7 @@ protected function process_scheduled_change_visibility_job($job)
*
* @return boolean the status creating the job.
*/
- public static function save_visibility_job($visibility)
- {
+ public static function save_visibility_job($visibility) {
global $DB;
// Set the pending status.
$visibility->status = self::STATUS_PENDING;
@@ -212,8 +209,7 @@ public static function save_visibility_job($visibility)
*
* @return boolean the status updating the job.
*/
- public static function update_visibility_job($visibility)
- {
+ public static function update_visibility_job($visibility) {
global $DB;
// Set the pending status.
$visibility->status = self::STATUS_PENDING;
@@ -231,8 +227,7 @@ public static function update_visibility_job($visibility)
*
* @return boolean the status deleting the job.
*/
- public static function delete_visibility_job($visibility)
- {
+ public static function delete_visibility_job($visibility) {
global $DB;
// Delete the visibility record.
return $DB->delete_records('block_opencast_visibility', ['id' => $visibility->id]);
@@ -245,8 +240,7 @@ public static function delete_visibility_job($visibility)
*
* @return boolean whether the visibility is validated.
*/
- private static function validate_job($visibility)
- {
+ private static function validate_job($visibility) {
$isvalid = true;
// Make sure that, either uploadjobid exists or the other required params are set.
@@ -277,11 +271,10 @@ private static function validate_job($visibility)
* @param object $job Visibility job object
* @param int $status Visibility status.
*/
- public static function change_job_status($job, $status)
- {
+ public static function change_job_status($job, $status) {
global $DB;
$allowedjobstatus = [self::STATUS_PENDING, self::STATUS_DONE,
- self::STATUS_FAILED,];
+ self::STATUS_FAILED, ];
if (!in_array($status, $allowedjobstatus)) {
throw new coding_exception('Invalid job status code.');
@@ -299,8 +292,7 @@ public static function change_job_status($job, $status)
* @return stdClass $initialvisibility initial visibility object.
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
- public static function get_initial_visibility($uploadjob)
- {
+ public static function get_initial_visibility($uploadjob) {
global $DB;
// Get the visibility record.
$visibilityrecord = $DB->get_record('block_opencast_visibility', ['uploadjobid' => $uploadjob->id]);
@@ -322,7 +314,7 @@ public static function get_initial_visibility($uploadjob)
// Checking the visibility value against the allowed visibility states.
$allowedvisibilitystates = [block_opencast_renderer::VISIBLE,
- block_opencast_renderer::HIDDEN, block_opencast_renderer::GROUP,];
+ block_opencast_renderer::HIDDEN, block_opencast_renderer::GROUP, ];
if (!in_array($visibility, $allowedvisibilitystates)) {
throw new coding_exception('Invalid visibility state.');
@@ -347,8 +339,7 @@ public static function get_initial_visibility($uploadjob)
* @return array $acls initial acls.
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
- private static function get_acl_roles($uploadjob, $visibility, $groups)
- {
+ private static function get_acl_roles($uploadjob, $visibility, $groups) {
// Retrieve required values from upload job object.
$courseid = $uploadjob->courseid;
$ocinstanceid = $uploadjob->ocinstanceid;
@@ -409,8 +400,7 @@ private static function get_acl_roles($uploadjob, $visibility, $groups)
* @param object $job represents the visibility job.
* @throws moodle_exception
*/
- protected function cleanup_visibility_job($job)
- {
+ protected function cleanup_visibility_job($job) {
global $DB;
// We will change back the status if the job got a date in future.
if (!empty($job->scheduledvisibilitytime) && intval($job->scheduledvisibilitytime) >= time()) {
@@ -433,8 +423,7 @@ protected function cleanup_visibility_job($job)
* @param object $job Visibility job object
* @return array the parameters for performing scheduled visibility changes
*/
- private function extract_job_params($job)
- {
+ private function extract_job_params($job) {
global $DB;
$ocinstanceid = null;
$courseid = null;
@@ -471,8 +460,7 @@ private function extract_job_params($job)
* @param array $customminutes Custome minutes to be added or deducted on demand.
* @return int
*/
- public static function get_waiting_time($ocinstanceid, $customminutes = [])
- {
+ public static function get_waiting_time($ocinstanceid, $customminutes = []) {
$configwaitingtime = get_config('block_opencast', 'aclcontrolwaitingtime_' . $ocinstanceid);
if (empty($configwaitingtime)) {
$configwaitingtime = self::DEFAULT_WAITING_TIME;
@@ -503,8 +491,7 @@ public static function get_waiting_time($ocinstanceid, $customminutes = [])
*
* @return ?object The current scheduled visibility info, or null if not found.
*/
- public static function get_event_scheduled_visibility($ocinstanceid, $courseid, $opencasteventid)
- {
+ public static function get_event_scheduled_visibility($ocinstanceid, $courseid, $opencasteventid) {
global $DB;
// Now that we have two different options in visibility table, we need to prepare a comprehensive sql.
// Assuming that the visibility was requested by changevisibility form, not the addvideo (not uploadjob).
@@ -548,8 +535,7 @@ public static function get_event_scheduled_visibility($ocinstanceid, $courseid,
*
* @return ?object The current scheduled visibility job info, or null if not found.
*/
- public static function get_uploadjob_scheduled_visibility($uploadjobid, $onlyscheduled = true)
- {
+ public static function get_uploadjob_scheduled_visibility($uploadjobid, $onlyscheduled = true) {
global $DB;
$sql = "SELECT * FROM {block_opencast_visibility}" .
" WHERE uploadjobid = :uploadjobid";
diff --git a/classes/opencast_connection_exception.php b/classes/opencast_connection_exception.php
index ef3061cb..b4481570 100644
--- a/classes/opencast_connection_exception.php
+++ b/classes/opencast_connection_exception.php
@@ -33,7 +33,7 @@
* @copyright 2021 Tamara Gunkel, University of Münster
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class opencast_connection_exception extends moodle_exception
-{
+class opencast_connection_exception extends moodle_exception {
+
}
diff --git a/classes/opencast_state_exception.php b/classes/opencast_state_exception.php
index 8332e5a0..d2e97774 100644
--- a/classes/opencast_state_exception.php
+++ b/classes/opencast_state_exception.php
@@ -32,7 +32,7 @@
* @copyright 2017 Tobias Reischmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class opencast_state_exception extends moodle_exception
-{
+class opencast_state_exception extends moodle_exception {
+
}
diff --git a/classes/output/importvideos/renderer.php b/classes/output/importvideos/renderer.php
index 3f921c94..645aa491 100644
--- a/classes/output/importvideos/renderer.php
+++ b/classes/output/importvideos/renderer.php
@@ -43,8 +43,8 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class renderer extends core_backup_renderer
-{
+class renderer extends core_backup_renderer {
+
/**
* Renderer to display the import course selector.
* This function is a modified version of import_course_selector from core_backup_renderer
@@ -56,8 +56,7 @@ class renderer extends core_backup_renderer
* @return string
*/
public function importvideos_coursesearch(moodle_url $nextstageurl,
- importvideos_coursesearch $courses = null)
- {
+ importvideos_coursesearch $courses = null) {
$html = html_writer::start_tag('div', ['class' => 'import-course-selector']);
$html .= $this->wizard_intro_notification(
get_string('importvideos_wizardstep1intro', 'block_opencast'));
@@ -70,7 +69,7 @@ public function importvideos_coursesearch(moodle_url $nextstageur
$html .= $this->backup_detail_pair('', $this->render_import_course_search($courses));
$attrs = ['type' => 'submit',
'value' => get_string('importvideos_wizardstepbuttontitlecontinue', 'block_opencast'),
- 'class' => 'btn btn-primary',];
+ 'class' => 'btn btn-primary', ];
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', $attrs));
$html .= html_writer::end_tag('div');
$html .= html_writer::end_tag('form');
@@ -85,8 +84,7 @@ public function importvideos_coursesearch(moodle_url $nextstageur
*
* @return string
*/
- public function course_menu_entry($course)
- {
+ public function course_menu_entry($course) {
// Add the course fullname.
$entrystring = $course->fullname;
@@ -109,8 +107,7 @@ public function course_menu_entry($course)
*
* @return string
*/
- public function course_video_menu_entry($video)
- {
+ public function course_video_menu_entry($video) {
// Add the video title.
$entrystring = $video->title;
@@ -145,8 +142,7 @@ public function course_video_menu_entry($video)
*
* @return string
*/
- public function progress_bar($currentstep = 1, $maxsteps = 4, $hasstep3 = true)
- {
+ public function progress_bar($currentstep = 1, $maxsteps = 4, $hasstep3 = true) {
// If we don't have step 3, we have to respect that.
if ($hasstep3 == false) {
// The whole progress bar has one step less.
@@ -164,7 +160,7 @@ public function progress_bar($currentstep = 1, $maxsteps = 4, $hasstep3 = true)
'style' => 'width: ' . (floor(($currentstep / $maxsteps) * 100)) . '%',
'aria-valuenow' => $currentstep,
'aria-valuemin' => '0',
- 'aria-valuemax' => $maxsteps,]);
+ 'aria-valuemax' => $maxsteps, ]);
$progressbar .= html_writer::start_span('text-left pl-2');
$progressbar .= get_string('importvideos_progressbarstep', 'block_opencast',
['current' => $currentstep, 'last' => $maxsteps]);
@@ -183,8 +179,7 @@ public function progress_bar($currentstep = 1, $maxsteps = 4, $hasstep3 = true)
*
* @return string
*/
- public function wizard_intro_notification($intromessage)
- {
+ public function wizard_intro_notification($intromessage) {
// Compose notification.
$notification = html_writer::start_div('alert alert-info');
$notification .= $intromessage;
@@ -201,8 +196,7 @@ public function wizard_intro_notification($intromessage)
*
* @return string
*/
- public function wizard_error_notification($errormessage)
- {
+ public function wizard_error_notification($errormessage) {
// Compose notification.
$notification = html_writer::start_div('alert alert-danger');
$notification .= $errormessage;
@@ -219,8 +213,7 @@ public function wizard_error_notification($errormessage)
*
* @return string
*/
- public function series_menu_entry($series)
- {
+ public function series_menu_entry($series) {
// Add the series title.
$entrystring = $series->title;
@@ -239,8 +232,7 @@ public function series_menu_entry($series)
* @param array $arrayvideoentrystrings to use as list elements
* @return string
*/
- public function course_videos_list_entry($arrayvideoentrystrings)
- {
+ public function course_videos_list_entry($arrayvideoentrystrings) {
// Add the video list.
$entrystring = '';
@@ -263,8 +255,7 @@ public function course_videos_list_entry($arrayvideoentrystrings)
*
* @return string
*/
- public function wizard_warning_notification($warningmessage)
- {
+ public function wizard_warning_notification($warningmessage) {
// Compose notification.
$notification = html_writer::start_div('alert alert-warning');
$notification .= $warningmessage;
diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php
index bea752bb..158053fc 100644
--- a/classes/privacy/provider.php
+++ b/classes/privacy/provider.php
@@ -40,16 +40,15 @@
* @copyright 2018 Tamara Gunkel
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class provider implements \core_privacy\local\metadata\provider, \core_privacy\local\request\plugin\provider
-{
+class provider implements \core_privacy\local\metadata\provider, \core_privacy\local\request\plugin\provider {
+
/**
* Return the fields which contain personal data.
* @param collection $collection a reference to the collection to use to store the metadata.
* @return collection the updated collection of metadata items.
*/
- public static function get_metadata(collection $collection): collection
- {
+ public static function get_metadata(collection $collection): collection {
$collection->add_database_table('block_opencast_uploadjob', [
'presentation_fileid' => 'privacy:metadata:block_opencast_uploadjob:presentation_fileid',
'presenter_fileid' => 'privacy:metadata:block_opencast_uploadjob:presenter_fileid',
@@ -75,8 +74,7 @@ public static function get_metadata(collection $collection): collection
*
* @return contextlist $contextlist The list of contexts used in this plugin.
*/
- public static function get_contexts_for_userid(int $userid): contextlist
- {
+ public static function get_contexts_for_userid(int $userid): contextlist {
$contextlist = new contextlist();
// Since we can have only one block instance per course, we can use the course context.
@@ -102,8 +100,7 @@ public static function get_contexts_for_userid(int $userid): contextlist
*
* @param approved_contextlist $contextlist The approved contexts to export information for.
*/
- public static function export_user_data(approved_contextlist $contextlist)
- {
+ public static function export_user_data(approved_contextlist $contextlist) {
global $DB, $PAGE;
// If the user has block_opencast data, multiple course contexts can be returned.
@@ -167,8 +164,7 @@ public static function export_user_data(approved_contextlist $contextlist)
*
* @param context $context The specific context to delete data for.
*/
- public static function delete_data_for_all_users_in_context(context $context)
- {
+ public static function delete_data_for_all_users_in_context(context $context) {
global $DB;
if ($context->contextlevel != CONTEXT_COURSE) {
@@ -189,8 +185,7 @@ public static function delete_data_for_all_users_in_context(context $context)
*
* @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
*/
- public static function delete_data_for_user(approved_contextlist $contextlist)
- {
+ public static function delete_data_for_user(approved_contextlist $contextlist) {
global $DB;
// If the user has block_opencast data, multiple course contexts can be returned.
@@ -224,8 +219,7 @@ public static function delete_data_for_user(approved_contextlist $contextlist)
*
* @param userlist $userlist The userlist containing the list of users who have data in this context/plugin combination.
*/
- public static function get_users_in_context(userlist $userlist)
- {
+ public static function get_users_in_context(userlist $userlist) {
$context = $userlist->get_context();
if (!is_a($context, context_course::class)) {
@@ -251,8 +245,7 @@ public static function get_users_in_context(userlist $userlist)
*
* @param approved_userlist $userlist The approved context and user information to delete information for.
*/
- public static function delete_data_for_users(approved_userlist $userlist)
- {
+ public static function delete_data_for_users(approved_userlist $userlist) {
global $DB;
$context = $userlist->get_context();
diff --git a/classes/setting_default_manager.php b/classes/setting_default_manager.php
index fac8a2e5..448cfa18 100644
--- a/classes/setting_default_manager.php
+++ b/classes/setting_default_manager.php
@@ -33,8 +33,8 @@
* @author Farbod Zamani Boroujeni
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class setting_default_manager
-{
+class setting_default_manager {
+
/**
* Initializes the set default settings provided in this class.
@@ -42,8 +42,7 @@ class setting_default_manager
*
* @param int $ocinstanceid ocinstance id
*/
- public static function init_regirstered_defaults($ocinstanceid = 1)
- {
+ public static function init_regirstered_defaults($ocinstanceid = 1) {
$classmethods = get_class_methods('\block_opencast\setting_default_manager');
foreach ($classmethods as $methodname) {
if (strpos($methodname, 'set_default') !== false) {
@@ -57,8 +56,7 @@ public static function init_regirstered_defaults($ocinstanceid = 1)
*
* @return string json default setting string
*/
- public static function get_default_metadata()
- {
+ public static function get_default_metadata() {
return '[' .
'{"name":"title","datatype":"text","required":1,"readonly":0,"param_json":"{\"style\":\"min-width: 27ch;\"}"},' .
'{"name":"subjects","datatype":"autocomplete","required":0,"readonly":0,"param_json":null,"defaultable":0},' .
@@ -85,8 +83,7 @@ public static function get_default_metadata()
*
* @param int $ocinstanceid ocinstance id
*/
- public static function set_default_metadata($ocinstanceid = 1)
- {
+ public static function set_default_metadata($ocinstanceid = 1) {
$configname = 'metadata_' . $ocinstanceid;
$currentmetadata = get_config('block_opencast', $configname);
if (empty($currentmetadata)) {
@@ -99,8 +96,7 @@ public static function set_default_metadata($ocinstanceid = 1)
*
* @return string json default setting string
*/
- public static function get_default_metadataseries()
- {
+ public static function get_default_metadataseries() {
return '[' .
'{"name":"title","datatype":"text","required":1,"readonly":0,"param_json":"{\"style\":\"min-width: 27ch;\"}"},' .
'{"name":"subjects","datatype":"autocomplete","required":0,"readonly":0,"param_json":null,"defaultable":0},' .
@@ -127,8 +123,7 @@ public static function get_default_metadataseries()
*
* @param int $ocinstanceid ocinstance id
*/
- public static function set_default_metadataseries($ocinstanceid = 1)
- {
+ public static function set_default_metadataseries($ocinstanceid = 1) {
$configname = 'metadataseries_' . $ocinstanceid;
$currentmetadata = get_config('block_opencast', $configname);
if (empty($currentmetadata)) {
@@ -141,8 +136,7 @@ public static function set_default_metadataseries($ocinstanceid = 1)
*
* @return string json default setting string
*/
- public static function get_default_transcriptionflavors()
- {
+ public static function get_default_transcriptionflavors() {
return '[{"key":"de","value":"Amberscript German"},' .
'{"key":"en","value":"Amberscript English"},{"key":"deu","value":"Vosk German"},' .
'{"key":"eng","value":"Vosk English"}]';
@@ -153,8 +147,7 @@ public static function get_default_transcriptionflavors()
*
* @param int $ocinstanceid ocinstance id
*/
- public static function set_default_transcriptionflavors($ocinstanceid = 1)
- {
+ public static function set_default_transcriptionflavors($ocinstanceid = 1) {
$configname = 'transcriptionflavors_' . $ocinstanceid;
$currentmetadata = get_config('block_opencast', $configname);
if (empty($currentmetadata)) {
@@ -167,8 +160,7 @@ public static function set_default_transcriptionflavors($ocinstanceid = 1)
*
* @return string json default setting string
*/
- public static function get_default_roles()
- {
+ public static function get_default_roles() {
return '[{"rolename":"ROLE_ADMIN","actions":"write,read","permanent":1},' .
'{"rolename":"ROLE_GROUP_MH_DEFAULT_ORG_EXTERNAL_APPLICATIONS","actions":"write,read","permanent":1},' .
'{"rolename":"[COURSEID]_Instructor","actions":"write,read","permanent":1},' .
@@ -180,8 +172,7 @@ public static function get_default_roles()
*
* @param int $ocinstanceid ocinstance id
*/
- public static function set_default_roles($ocinstanceid = 1)
- {
+ public static function set_default_roles($ocinstanceid = 1) {
$configname = 'roles_' . $ocinstanceid;
$currentmetadata = get_config('block_opencast', $configname);
if (empty($currentmetadata)) {
@@ -194,8 +185,7 @@ public static function set_default_roles($ocinstanceid = 1)
*
* @return int max series number
*/
- public static function get_default_maxseries()
- {
+ public static function get_default_maxseries() {
return 3;
}
@@ -204,8 +194,7 @@ public static function get_default_maxseries()
*
* @param int $ocinstanceid ocinstance id
*/
- public static function set_default_maxseries($ocinstanceid = 1)
- {
+ public static function set_default_maxseries($ocinstanceid = 1) {
$configname = 'maxseries_' . $ocinstanceid;
$currentmetadata = get_config('block_opencast', $configname);
if (empty($currentmetadata)) {
@@ -218,8 +207,7 @@ public static function set_default_maxseries($ocinstanceid = 1)
*
* @return int limit videos number
*/
- public static function get_default_limitvideos()
- {
+ public static function get_default_limitvideos() {
return 5;
}
@@ -228,8 +216,7 @@ public static function get_default_limitvideos()
*
* @param int $ocinstanceid ocinstance id
*/
- public static function set_default_limitvideos($ocinstanceid = 1)
- {
+ public static function set_default_limitvideos($ocinstanceid = 1) {
$configname = 'limitvideos_' . $ocinstanceid;
$currentmetadata = get_config('block_opencast', $configname);
if (empty($currentmetadata)) {
diff --git a/classes/setting_helper.php b/classes/setting_helper.php
index c115a298..5dd370d1 100644
--- a/classes/setting_helper.php
+++ b/classes/setting_helper.php
@@ -38,8 +38,8 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class setting_helper
-{
+class setting_helper {
+
/**
* Validate if the selected workflow does indeed exist.
@@ -48,8 +48,7 @@ class setting_helper
* @return false|lang_string|string
* @throws coding_exception
*/
- public static function validate_workflow_setting($data)
- {
+ public static function validate_workflow_setting($data) {
if ($data == null) {
return false;
}
@@ -79,8 +78,7 @@ public static function validate_workflow_setting($data)
* @param string $workflowtags comma separated list of tags
* @return array|opencast_connection_exception|Exception|empty_configuration_exception|null
*/
- public static function load_workflow_choices($ocinstanceid, $workflowtags)
- {
+ public static function load_workflow_choices($ocinstanceid, $workflowtags) {
// Don't load anything during initial installation.
// This is important as the Opencast API is not set up during initial installation.
if (during_initial_install()) {
@@ -95,7 +93,7 @@ public static function load_workflow_choices($ocinstanceid, $workflowtags)
return $apibridge->get_available_workflows_for_menu($workflowtags, true);
// Something went wrong and the list of workflows could not be retrieved.
- } catch (opencast_connection_exception|empty_configuration_exception $e) {
+ } catch (opencast_connection_exception | empty_configuration_exception $e) {
return $e;
}
}
@@ -109,8 +107,7 @@ public static function load_workflow_choices($ocinstanceid, $workflowtags)
* @throws coding_exception
* @throws dml_exception
*/
- public static function validate_aclownerrole_setting($data)
- {
+ public static function validate_aclownerrole_setting($data) {
// Hack to get the opencast instance id.
$category = optional_param('category', null, PARAM_RAW);
if ($category) {
diff --git a/classes/task/cleanup_imported_episodes_cron.php b/classes/task/cleanup_imported_episodes_cron.php
index 54370ca9..07d8b0a0 100644
--- a/classes/task/cleanup_imported_episodes_cron.php
+++ b/classes/task/cleanup_imported_episodes_cron.php
@@ -40,15 +40,14 @@
* @copyright 2020 Alexander Bias, Ulm University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class cleanup_imported_episodes_cron extends scheduled_task
-{
+class cleanup_imported_episodes_cron extends scheduled_task {
+
/**
* Get a descriptive name for this task (shown to admins).
* @return string
*/
- public function get_name()
- {
+ public function get_name() {
return get_string('processepisodecleanup', 'block_opencast');
}
@@ -58,8 +57,7 @@ public function get_name()
*
* @throws dml_exception
*/
- public function execute()
- {
+ public function execute() {
global $DB;
$ocinstances = settings_api::get_ocinstances();
@@ -164,7 +162,7 @@ public function execute()
if ($episodeid === '') {
// Postpone the cleanup job.
$params = ['increment' => 1, 'time' => time(), 'ocworkflowid' => $workflow->ocworkflowid,
- 'ocinstanceid' => $ocinstance->id,];
+ 'ocinstanceid' => $ocinstance->id, ];
$DB->execute('UPDATE {block_opencast_ltiepisode_cu} ' .
'SET queuecount = queuecount + :increment, timemodified = :time ' .
'WHERE ocworkflowid = :ocworkflowid AND ocinstanceid = :ocinstanceid',
diff --git a/classes/task/cleanup_lti_module_cron.php b/classes/task/cleanup_lti_module_cron.php
index d9c62278..405ae8a7 100644
--- a/classes/task/cleanup_lti_module_cron.php
+++ b/classes/task/cleanup_lti_module_cron.php
@@ -39,23 +39,21 @@
* @author Farbod Zamani Boroujeni
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class cleanup_lti_module_cron extends scheduled_task
-{
+class cleanup_lti_module_cron extends scheduled_task {
+
/**
* Get the task name.
* @return string description.
*/
- public function get_name()
- {
+ public function get_name() {
return get_string('processltimodulecleanup', 'block_opencast');
}
/**
* Execute the task.
*/
- public function execute()
- {
+ public function execute() {
try {
// 1. Update the existing records of LTI Modules.
mtrace('Step 1: Updating existing LTI modules...');
diff --git a/classes/task/process_attachment_cron.php b/classes/task/process_attachment_cron.php
index c603556d..b688f642 100644
--- a/classes/task/process_attachment_cron.php
+++ b/classes/task/process_attachment_cron.php
@@ -34,16 +34,15 @@
* Task for processing event's attachment upload jobs.
* @package block_opencast
*/
-class process_attachment_cron extends scheduled_task
-{
+class process_attachment_cron extends scheduled_task {
+
/**
* Get the name of the task.
* @return lang_string|string
* @throws coding_exception
*/
- public function get_name()
- {
+ public function get_name() {
return get_string('processattachment', 'block_opencast');
}
@@ -51,8 +50,7 @@ public function get_name()
* Executes the task.
* @throws dml_exception
*/
- public function execute()
- {
+ public function execute() {
$attachmenthelper = new attachment_helper();
$attachmenthelper->cron();
}
diff --git a/classes/task/process_delete_cron.php b/classes/task/process_delete_cron.php
index d8c9af2c..1f086ae2 100644
--- a/classes/task/process_delete_cron.php
+++ b/classes/task/process_delete_cron.php
@@ -36,16 +36,15 @@
* @copyright 2018 Tobias Reischmann, WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class process_delete_cron extends scheduled_task
-{
+class process_delete_cron extends scheduled_task {
+
/**
* Get the name of the task.
* @return lang_string|string
* @throws coding_exception
*/
- public function get_name()
- {
+ public function get_name() {
return get_string('processdelete', 'block_opencast');
}
@@ -53,8 +52,7 @@ public function get_name()
* Executes the task.
* @throws dml_exception
*/
- public function execute()
- {
+ public function execute() {
global $DB;
// Get all delete jobs.
diff --git a/classes/task/process_delete_notification_cron.php b/classes/task/process_delete_notification_cron.php
index 4e713727..41bdfcec 100644
--- a/classes/task/process_delete_notification_cron.php
+++ b/classes/task/process_delete_notification_cron.php
@@ -40,16 +40,15 @@
*
* @package block_opencast
*/
-class process_delete_notification_cron extends scheduled_task
-{
+class process_delete_notification_cron extends scheduled_task {
+
/**
* Get the name of the task.
* @return lang_string|string
* @throws coding_exception
*/
- public function get_name()
- {
+ public function get_name() {
return get_string('processdeletenotification', 'block_opencast');
}
@@ -57,8 +56,7 @@ public function get_name()
* Executes the task.
* @throws dml_exception
*/
- public function execute()
- {
+ public function execute() {
global $DB;
$ocinstances = settings_api::get_ocinstances();
diff --git a/classes/task/process_duplicate_event.php b/classes/task/process_duplicate_event.php
index dd6f2a6c..9db730a9 100644
--- a/classes/task/process_duplicate_event.php
+++ b/classes/task/process_duplicate_event.php
@@ -41,8 +41,8 @@
* @copyright 2018 Andreas Wagner, Synergy Learning
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class process_duplicate_event extends adhoc_task
-{
+class process_duplicate_event extends adhoc_task {
+
/** @var int max number of retries for one task */
const MAX_COUNT_RETRIES = 10;
@@ -50,8 +50,7 @@ class process_duplicate_event extends adhoc_task
/**
* Create a copy event task.
*/
- public function __construct()
- {
+ public function __construct() {
$this->set_component('block_opencast');
}
@@ -60,8 +59,7 @@ public function __construct()
*
* @see \core\task\task_base::execute()
*/
- public function execute()
- {
+ public function execute() {
global $DB;
$data = $this->get_custom_data();
diff --git a/classes/task/process_duplicated_event_visibility_change.php b/classes/task/process_duplicated_event_visibility_change.php
index 2dd383ce..66d7dd22 100644
--- a/classes/task/process_duplicated_event_visibility_change.php
+++ b/classes/task/process_duplicated_event_visibility_change.php
@@ -39,8 +39,8 @@
* @author Farbod Zamani Boroujeni
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class process_duplicated_event_visibility_change extends adhoc_task
-{
+class process_duplicated_event_visibility_change extends adhoc_task {
+
/** @var int max number of failed retries for one task */
const MAX_COUNT_FAILS = 10;
@@ -58,8 +58,7 @@ class process_duplicated_event_visibility_change extends adhoc_task
/**
* Create a copy event task.
*/
- public function __construct()
- {
+ public function __construct() {
$this->set_component('block_opencast');
}
@@ -68,8 +67,7 @@ public function __construct()
*
* @see \core\task\task_base::execute()
*/
- public function execute()
- {
+ public function execute() {
global $DB;
$data = $this->get_custom_data();
diff --git a/classes/task/process_notification_cron.php b/classes/task/process_notification_cron.php
index 50f3fe3d..5b531ab3 100644
--- a/classes/task/process_notification_cron.php
+++ b/classes/task/process_notification_cron.php
@@ -34,16 +34,15 @@
* Task for processing the event status notification jobs.
* @package block_opencast
*/
-class process_notification_cron extends scheduled_task
-{
+class process_notification_cron extends scheduled_task {
+
/**
* Get the name of the task.
* @return lang_string|string
* @throws coding_exception
*/
- public function get_name()
- {
+ public function get_name() {
return get_string('processnotification', 'block_opencast');
}
@@ -51,8 +50,7 @@ public function get_name()
* Executes the task.
* @throws dml_exception
*/
- public function execute()
- {
+ public function execute() {
$notificationhelper = new eventstatus_notification_helper();
$notificationhelper->cron();
}
diff --git a/classes/task/process_upload_cron.php b/classes/task/process_upload_cron.php
index 815b0ba3..e1e8dec4 100644
--- a/classes/task/process_upload_cron.php
+++ b/classes/task/process_upload_cron.php
@@ -33,16 +33,15 @@
* Task for processing the upload jobs.
* @package block_opencast
*/
-class process_upload_cron extends scheduled_task
-{
+class process_upload_cron extends scheduled_task {
+
/**
* Get the name of the task.
* @return lang_string|string
* @throws coding_exception
*/
- public function get_name()
- {
+ public function get_name() {
return get_string('processupload', 'block_opencast');
}
@@ -50,8 +49,7 @@ public function get_name()
* Executes the task.
* @throws dml_exception
*/
- public function execute()
- {
+ public function execute() {
$ulpoadhelper = new upload_helper();
$ulpoadhelper->cron();
}
diff --git a/classes/task/process_visibility_cron.php b/classes/task/process_visibility_cron.php
index ab339954..c4542b5a 100644
--- a/classes/task/process_visibility_cron.php
+++ b/classes/task/process_visibility_cron.php
@@ -34,16 +34,15 @@
* Task for processing the scheduled visibility change jobs.
* @package block_opencast
*/
-class process_visibility_cron extends scheduled_task
-{
+class process_visibility_cron extends scheduled_task {
+
/**
* Get the name of the task.
* @return lang_string|string
* @throws coding_exception
*/
- public function get_name()
- {
+ public function get_name() {
return get_string('processvisibility', 'block_opencast');
}
@@ -51,8 +50,7 @@ public function get_name()
* Executes the task.
* @throws dml_exception
*/
- public function execute()
- {
+ public function execute() {
$visibilityhelper = new visibility_helper();
$visibilityhelper->cron();
}
diff --git a/db/upgrade.php b/db/upgrade.php
index b9f8065a..d256be93 100644
--- a/db/upgrade.php
+++ b/db/upgrade.php
@@ -29,8 +29,7 @@
* @param int $oldversion
* @return bool
*/
-function xmldb_block_opencast_upgrade($oldversion)
-{
+function xmldb_block_opencast_upgrade($oldversion) {
global $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2017110708) {
@@ -581,7 +580,7 @@ function xmldb_block_opencast_upgrade($oldversion)
'addltiintro', 'addltisection', 'addltiavailability', 'addltiepisodeenabled',
'addltiepisodepreconfiguredtool', 'addltiepisodeintro', 'addltiepisodesection', 'addltiepisodeavailability',
'importvideosenabled', 'duplicateworkflow', 'importvideoscoreenabled', 'importvideosmanualenabled',
- 'importvideoshandleseriesenabled', 'importvideoshandleepisodeenabled',];
+ 'importvideoshandleseriesenabled', 'importvideoshandleepisodeenabled', ];
$fieldsjoined = "('" . implode("','", $settingsfields) . "')";
@@ -598,7 +597,7 @@ function xmldb_block_opencast_upgrade($oldversion)
"AND name in " . $fieldsjoined);
$dbtables = ['block_opencast_uploadjob', 'block_opencast_deletejob', 'block_opencast_groupaccess',
- 'block_opencast_ltimodule', 'block_opencast_ltiepisode', 'block_opencast_ltiepisode_cu',];
+ 'block_opencast_ltimodule', 'block_opencast_ltiepisode', 'block_opencast_ltiepisode_cu', ];
foreach ($dbtables as $dbtable) {
// Add new opencast instance field.
diff --git a/deleteaclgroup.php b/deleteaclgroup.php
index c4a2a9bf..29f45eb7 100644
--- a/deleteaclgroup.php
+++ b/deleteaclgroup.php
@@ -35,7 +35,7 @@
$ocinstanceid = optional_param('ocinstanceid', settings_api::get_default_ocinstance()->id, PARAM_INT);
$baseurl = new moodle_url('/blocks/opencast/deleteaclgroup.php',
- array('identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+ ['identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$PAGE->set_url($baseurl);
require_login($courseid, false);
@@ -44,7 +44,7 @@
$PAGE->set_title(get_string('pluginname', 'block_opencast'));
$PAGE->set_heading(get_string('pluginname', 'block_opencast'));
-$redirecturl = new moodle_url('/blocks/opencast/index.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$redirecturl = new moodle_url('/blocks/opencast/index.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$PAGE->navbar->add(get_string('pluginname', 'block_opencast'), $redirecturl);
$PAGE->navbar->add(get_string('deleteaclgroup', 'block_opencast'), $baseurl);
diff --git a/deleteevent.php b/deleteevent.php
index 1a4b094e..4847a56e 100644
--- a/deleteevent.php
+++ b/deleteevent.php
@@ -37,8 +37,8 @@
$series = optional_param('series', null, PARAM_ALPHANUMEXT);
$baseurl = new moodle_url('/blocks/opencast/deleteevent.php',
- array('identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid,
- 'redirectpage' => $redirectpage, 'series' => $series));
+ ['identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid,
+ 'redirectpage' => $redirectpage, 'series' => $series, ]);
$PAGE->set_url($baseurl);
require_login($courseid, false);
@@ -48,12 +48,12 @@
$PAGE->set_heading(get_string('pluginname', 'block_opencast'));
if ($redirectpage == 'overviewvideos') {
- $redirecturl = new moodle_url('/blocks/opencast/overview_videos.php', array('ocinstanceid' => $ocinstanceid,
- 'series' => $series));
+ $redirecturl = new moodle_url('/blocks/opencast/overview_videos.php', ['ocinstanceid' => $ocinstanceid,
+ 'series' => $series, ]);
} else if ($redirectpage == 'overview') {
- $redirecturl = new moodle_url('/blocks/opencast/overview.php', array('ocinstanceid' => $ocinstanceid));
+ $redirecturl = new moodle_url('/blocks/opencast/overview.php', ['ocinstanceid' => $ocinstanceid]);
} else {
- $redirecturl = new moodle_url('/blocks/opencast/index.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+ $redirecturl = new moodle_url('/blocks/opencast/index.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
}
$PAGE->navbar->add(get_string('pluginname', 'block_opencast'), $redirecturl);
diff --git a/directaccess.php b/directaccess.php
index cf6cc0eb..8ce53492 100644
--- a/directaccess.php
+++ b/directaccess.php
@@ -39,11 +39,11 @@
$ocinstanceid = optional_param('ocinstanceid', settings_api::get_default_ocinstance()->id, PARAM_INT);
$baseurl = new moodle_url('/blocks/opencast/directaccess.php',
- array('courseid' => $courseid, 'video_identifier' => $videoid,
- 'mediaid' => $mediaid, 'ocinstanceid' => $ocinstanceid));
+ ['courseid' => $courseid, 'video_identifier' => $videoid,
+ 'mediaid' => $mediaid, 'ocinstanceid' => $ocinstanceid, ]);
$PAGE->set_url($baseurl);
-$redirecturl = new moodle_url('/blocks/opencast/index.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$redirecturl = new moodle_url('/blocks/opencast/index.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
require_login($courseid, false);
@@ -59,7 +59,7 @@
require_capability('block/opencast:directaccessvideolink', $coursecontext);
} catch (required_capability_exception $e) {
// We gently redirect to the course main view page in case of capability exception, to handle the behat more sufficiently.
- $redirecttocourse = new moodle_url('/course/view.php', array('id' => $courseid));
+ $redirecttocourse = new moodle_url('/course/view.php', ['id' => $courseid]);
redirect($redirecttocourse,
get_string('nopermissions', 'error', get_string('opencast:directaccessvideolink', 'block_opencast')),
null,
diff --git a/downloadtranscription.php b/downloadtranscription.php
index de0f1b38..0959930b 100644
--- a/downloadtranscription.php
+++ b/downloadtranscription.php
@@ -39,14 +39,14 @@
$domain = optional_param('domain', '', PARAM_ALPHA);
$ocinstanceid = optional_param('ocinstanceid', settings_api::get_default_ocinstance()->id, PARAM_INT);
-$indexurl = new moodle_url('/blocks/opencast/index.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$indexurl = new moodle_url('/blocks/opencast/index.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$baseurl = new moodle_url('/blocks/opencast/downloadtranscription.php',
- array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid,
- 'video_identifier' => $identifier, 'attachment_type' => $type));
+ ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid,
+ 'video_identifier' => $identifier, 'attachment_type' => $type, ]);
$PAGE->set_url($baseurl);
$redirecturl = new moodle_url('/blocks/opencast/managetranscriptions.php',
- array('video_identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+ ['video_identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
require_login($courseid, false);
diff --git a/downloadvideo.php b/downloadvideo.php
index 39e210d2..39daf213 100644
--- a/downloadvideo.php
+++ b/downloadvideo.php
@@ -36,10 +36,10 @@
$ocinstanceid = optional_param('ocinstanceid', settings_api::get_default_ocinstance()->id, PARAM_INT);
$baseurl = new moodle_url('/blocks/opencast/downloadvideo.php',
- array('courseid' => $courseid, 'video_identifier' => $videoid, 'ocinstanceid' => $ocinstanceid));
+ ['courseid' => $courseid, 'video_identifier' => $videoid, 'ocinstanceid' => $ocinstanceid]);
$PAGE->set_url($baseurl);
-$redirecturl = new moodle_url('/blocks/opencast/index.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$redirecturl = new moodle_url('/blocks/opencast/index.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
require_login($courseid, false);
diff --git a/engageredirect.php b/engageredirect.php
index f62244bf..34a22529 100644
--- a/engageredirect.php
+++ b/engageredirect.php
@@ -37,9 +37,9 @@
$ocinstanceid = optional_param('ocinstanceid', settings_api::get_default_ocinstance()->id, PARAM_INT);
// Preparing the urls for the page.
-$redirecturl = new moodle_url('/blocks/opencast/index.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$redirecturl = new moodle_url('/blocks/opencast/index.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$baseurl = new moodle_url('/blocks/opencast/engageredirect.php',
- array('identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+ ['identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$PAGE->set_url($baseurl);
// Check if the user is logged in.
diff --git a/manageseries.php b/manageseries.php
index 6f1f5198..6f9f6175 100644
--- a/manageseries.php
+++ b/manageseries.php
@@ -38,10 +38,10 @@
// Passing optional param createseries to perform click on Create new series button.
$createseries = optional_param('createseries', 0, PARAM_INT);
-$baseurl = new moodle_url('/blocks/opencast/manageseries.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$baseurl = new moodle_url('/blocks/opencast/manageseries.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$PAGE->set_url($baseurl);
-$series = $DB->get_records('tool_opencast_series', array('ocinstanceid' => $ocinstanceid, 'courseid' => $courseid));
+$series = $DB->get_records('tool_opencast_series', ['ocinstanceid' => $ocinstanceid, 'courseid' => $courseid]);
// Transform isdefault to int.
array_walk($series, function ($item) {
$item->isdefault = intval($item->isdefault);
@@ -54,7 +54,7 @@
$PAGE->requires->css('/blocks/opencast/css/tabulator.min.css');
$PAGE->requires->css('/blocks/opencast/css/tabulator_bootstrap4.min.css');
-$redirecturl = new moodle_url('/blocks/opencast/index.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$redirecturl = new moodle_url('/blocks/opencast/index.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
require_login($courseid, false);
diff --git a/managetranscriptions.php b/managetranscriptions.php
index 66d52acb..2fed1f78 100644
--- a/managetranscriptions.php
+++ b/managetranscriptions.php
@@ -35,9 +35,9 @@
$courseid = required_param('courseid', PARAM_INT);
$ocinstanceid = optional_param('ocinstanceid', settings_api::get_default_ocinstance()->id, PARAM_INT);
-$redirecturl = new moodle_url('/blocks/opencast/index.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$redirecturl = new moodle_url('/blocks/opencast/index.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$baseurl = new moodle_url('/blocks/opencast/managetranscriptions.php',
- array('video_identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+ ['video_identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$PAGE->set_url($baseurl);
require_login($courseid, false);
@@ -62,7 +62,7 @@
// Create new url.
$addnewurl = new moodle_url('/blocks/opencast/addtranscription.php',
- array('video_identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+ ['video_identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
// Check if delete option is allowed.
$candelete = false;
diff --git a/recordvideo.php b/recordvideo.php
index 9a72c602..04da73d4 100644
--- a/recordvideo.php
+++ b/recordvideo.php
@@ -36,7 +36,7 @@
$courseid = required_param('courseid', PARAM_INT);
$ocinstanceid = optional_param('ocinstanceid', settings_api::get_default_ocinstance()->id, PARAM_INT);
-$baseurl = new moodle_url('/blocks/opencast/recordvideo.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$baseurl = new moodle_url('/blocks/opencast/recordvideo.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$PAGE->set_url($baseurl);
require_login($courseid, false);
diff --git a/renderer.php b/renderer.php
index b45b1444..fb663770 100644
--- a/renderer.php
+++ b/renderer.php
@@ -1189,8 +1189,8 @@ public function render_lti_form($endpoint, $params) {
// Construct html form for the launch parameters.
foreach ($params as $key => $value) {
- $key = htmlspecialchars($key);
- $value = htmlspecialchars($value);
+ $key = htmlspecialchars($key, ENT_COMPAT);
+ $value = htmlspecialchars($value, ENT_COMPAT);
$content .= "id, PARAM_INT);
-$redirecturl = new moodle_url('/blocks/opencast/index.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$redirecturl = new moodle_url('/blocks/opencast/index.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
require_login($courseid, false);
@@ -73,7 +73,7 @@
$mailinfo->username = $USER->username;
$mailinfo->useremail = $USER->email;
$mailinfo->courselink = (new moodle_url('/blocks/opencast/index.php',
- array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid)))->out();
+ ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]))->out();
$mailinfo->course = $COURSE->fullname;
$mailinfo->series = $result->video->series;
$mailinfo->seriesid = $result->video->is_part_of;
diff --git a/startworkflow.php b/startworkflow.php
index 0c04861f..40f9e589 100644
--- a/startworkflow.php
+++ b/startworkflow.php
@@ -35,7 +35,7 @@
$configparams = required_param('configparams', PARAM_RAW);
$ocinstanceid = optional_param('ocinstanceid', settings_api::get_default_ocinstance()->id, PARAM_INT);
-$redirecturl = new moodle_url('/blocks/opencast/index.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$redirecturl = new moodle_url('/blocks/opencast/index.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
require_login($courseid, false);
@@ -57,7 +57,7 @@
$apiworkflow = $apibridge->get_workflow_definition($workflow);
// Apply multiple tags.
-$workflowtags = array();
+$workflowtags = [];
$workflowtagsconfig = get_config('block_opencast', 'workflow_tags_' . $ocinstanceid);
if (!empty($workflowtagsconfig)) {
$workflowtags = explode(',', $workflowtagsconfig);
@@ -70,7 +70,7 @@
notification::NOTIFY_ERROR);
}
-$result = $apibridge->start_workflow($videoid, $workflow, array('configuration' => $configparams));
+$result = $apibridge->start_workflow($videoid, $workflow, ['configuration' => $configparams]);
if ($result) {
// Redirect with success message.
diff --git a/tests/backup_test.php b/tests/backup_test.php
index 3b469b39..f211f892 100644
--- a/tests/backup_test.php
+++ b/tests/backup_test.php
@@ -61,20 +61,18 @@
* @copyright 2018 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class backup_test extends advanced_testcase
-{
+class backup_test extends advanced_testcase {
+
/** @var string for the testcase, must NOT be a real server! */
private $apiurl = 'http://server.opencast.testcase';
- public function setUp(): void
- {
+ public function setUp(): void {
parent::setUp();
apibridge::set_testing(true);
}
- public function tearDown(): void
- {
+ public function tearDown(): void {
parent::tearDown();
apibridge::set_testing(false);
}
@@ -84,8 +82,7 @@ public function tearDown(): void
* @param int $courseid
* @return string
*/
- private function get_backup_filepath($courseid)
- {
+ private function get_backup_filepath($courseid) {
global $CFG;
return $CFG->tempdir . '/backup/core_course_testcase_' . $courseid;
}
@@ -96,8 +93,7 @@ private function get_backup_filepath($courseid)
* @param int $blockid
* @return string
*/
- private function get_backup_filename($courseid, $blockid)
- {
+ private function get_backup_filename($courseid, $blockid) {
$backupfilepath = $this->get_backup_filepath($courseid);
return $backupfilepath . '/course/blocks/opencast_' . $blockid . '/opencast.xml';
@@ -111,8 +107,7 @@ private function get_backup_filename($courseid, $blockid)
* @param int $userid The user doing the backup.
* @return string filepath of backup
*/
- protected function backup_course($courseid, $includevideos = false, $userid = 2)
- {
+ protected function backup_course($courseid, $includevideos = false, $userid = 2) {
$bc = new backup_controller(backup::TYPE_1COURSE, $courseid, backup::FORMAT_MOODLE,
backup::INTERACTIVE_NO, backup::MODE_AUTOMATED, $userid);
@@ -143,8 +138,7 @@ protected function backup_course($courseid, $includevideos = false, $userid = 2)
* @param int $userid The ID of the user performing the restore.
* @return stdClass The updated course object.
*/
- protected function restore_course($backupid, $courseid, $includevideos, $userid)
- {
+ protected function restore_course($backupid, $courseid, $includevideos, $userid) {
global $DB;
$target = backup::TARGET_CURRENT_ADDING;
@@ -165,7 +159,7 @@ protected function restore_course($backupid, $courseid, $includevideos, $userid)
}
$rc->execute_plan();
- $course = $DB->get_record('course', array('id' => $rc->get_courseid()));
+ $course = $DB->get_record('course', ['id' => $rc->get_courseid()]);
$rc->destroy();
unset($rc);
@@ -176,8 +170,7 @@ protected function restore_course($backupid, $courseid, $includevideos, $userid)
* Execute an adhoc task like via cron function.
* @param stdClass $taskrecord
*/
- private function execute_adhoc_task($taskrecord)
- {
+ private function execute_adhoc_task($taskrecord) {
global $CFG;
$task = new process_duplicate_event();
@@ -209,14 +202,13 @@ private function execute_adhoc_task($taskrecord)
* @throws coding_exception
* @throws dml_exception
*/
- private function check_task_fail_with_error($expectederrortextkey, $expectedfailedcount)
- {
+ private function check_task_fail_with_error($expectederrortextkey, $expectedfailedcount) {
global $DB;
$taskrecords = $DB->get_records('task_adhoc', ['classname' => '\\block_opencast\\task\\process_duplicate_event']);
$taskrecord = array_shift($taskrecords);
$a = json_decode($taskrecord->customdata);
- $course = $DB->get_record('course', array('id' => $a->courseid));
+ $course = $DB->get_record('course', ['id' => $a->courseid]);
$a->coursefullname = $course->fullname;
$a->taskid = $taskrecord->id;
$a->duplicateworkflow = block_opencast_apibridge_testable::DUPLICATE_WORKFLOW;
@@ -239,8 +231,7 @@ private function check_task_fail_with_error($expectederrortextkey, $expectedfail
*
* @covers \restore_controller \backup_controller
*/
- public function test_adhoctask_execution()
- {
+ public function test_adhoctask_execution() {
global $USER, $DB;
$this->resetAfterTest();
@@ -301,7 +292,7 @@ public function test_adhoctask_execution()
set_config('duplicateworkflow_1', $apibridge::DUPLICATE_WORKFLOW, 'block_opencast');
// But delete the course series in Moodle.
- $mapping = seriesmapping::get_record(array('courseid' => $newcourse->id, 'isdefault' => '1'));
+ $mapping = seriesmapping::get_record(['courseid' => $newcourse->id, 'isdefault' => '1']);
$mapping->delete();
// The series is now missing, so the task should fail.
@@ -383,8 +374,7 @@ public function test_adhoctask_execution()
/**
* Test restore of event identifiers.
*/
- public function notest_restore()
- {
+ public function notest_restore() {
global $USER, $DB;
$this->resetAfterTest();
@@ -466,8 +456,7 @@ public function notest_restore()
/**
* Test backup of event identifiers.
*/
- public function notest_backup()
- {
+ public function notest_backup() {
global $USER;
$this->resetAfterTest();
diff --git a/tests/behat/behat_block_opencast.php b/tests/behat/behat_block_opencast.php
index 23a9941d..450eb5b1 100644
--- a/tests/behat/behat_block_opencast.php
+++ b/tests/behat/behat_block_opencast.php
@@ -40,8 +40,8 @@
* @copyright 2021 Tamara Gunkel, University of Münster
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class behat_block_opencast extends behat_base
-{
+class behat_block_opencast extends behat_base {
+
/**
* @var $directaccesslink string direct access link to be saved temporarily, and then be used when needed. (i.e. in the step
@@ -53,8 +53,7 @@ class behat_block_opencast extends behat_base
* Setup test opencast API.
* @Given /^I setup the opencast test api$/
*/
- public function i_setup_the_opencast_test_api()
- {
+ public function i_setup_the_opencast_test_api() {
set_config('api_testable_responses', '[]', 'tool_opencast');
$this->load_apitestable_json_responses();
}
@@ -63,8 +62,7 @@ public function i_setup_the_opencast_test_api()
* Upload a testvideo.
* @Given /^I upload a testvideo$/
*/
- public function i_upload_a_testvideo()
- {
+ public function i_upload_a_testvideo() {
$courses = core_course_category::search_courses(['search' => 'Course 1']);
$mapping = new seriesmapping();
@@ -79,8 +77,7 @@ public function i_upload_a_testvideo()
* Create a second series.
* @Given /^I create a second series$/
*/
- public function i_create_a_second_series()
- {
+ public function i_create_a_second_series() {
$courses = core_course_category::search_courses(['search' => 'Course 1']);
$mapping = new seriesmapping();
@@ -95,8 +92,7 @@ public function i_create_a_second_series()
* Setup default settings for the block
* @Given /^I setup the default settigns for opencast plugins$/
*/
- public function i_setup_the_default_settings_for_opencast_plugins()
- {
+ public function i_setup_the_default_settings_for_opencast_plugins() {
setting_default_manager::init_regirstered_defaults(1);
}
@@ -105,8 +101,7 @@ public function i_setup_the_default_settings_for_opencast_plugins()
* stops the execution until you hit enter in the console
* @Then /^breakpoint/
*/
- public function breakpoint()
- {
+ public function breakpoint() {
fwrite(STDOUT, "\033[s \033[93m[Breakpoint] Press \033[1;93m[RETURN]\033[0;93m to continue...\033[0m");
while (fgets(STDIN, 1024) == '') {
continue;
@@ -118,8 +113,7 @@ public function breakpoint()
/**
* Loads the json responses taken from fixtures dir into apitestable config.
*/
- protected function load_apitestable_json_responses()
- {
+ protected function load_apitestable_json_responses() {
$apicallsdir = __DIR__ . "/../fixtures/api_calls";
$excludes = ['.', '..'];
foreach (scandir($apicallsdir) as $method) {
@@ -145,8 +139,7 @@ protected function load_apitestable_json_responses()
* Opens the video's direct access link
* @Given /^I go to direct access link$/
*/
- public function i_go_to_direct_access_link()
- {
+ public function i_go_to_direct_access_link() {
// Get the direct access link.
if (empty($this->directaccesslink)) {
$csselement = '#opencast-videos-table-ID-blender-foundation_r0 .c3 .access-action-menu a.access-link-copytoclipboard';
@@ -165,8 +158,7 @@ public function i_go_to_direct_access_link()
* Checks if there is no video in processing stage (mainly used for republish-metadata workflow).
* @Given /^I wait until no video is being processed$/
*/
- public function i_wait_until_no_video_is_being_processed()
- {
+ public function i_wait_until_no_video_is_being_processed() {
$courses = core_course_category::search_courses(['search' => 'Course 1']);
$mappedseries = seriesmapping::get_records(['ocinstanceid' => 1, 'courseid' => reset($courses)->id]);
@@ -189,8 +181,7 @@ public function i_wait_until_no_video_is_being_processed()
* Makes sure that opencast video is available in opencast
* @Given /^I should watch the video in opencast$/
*/
- public function i_should_watch_the_video_in_opencast()
- {
+ public function i_should_watch_the_video_in_opencast() {
$xpath = "//video";
$this->execute('behat_general::should_exist', [$xpath, 'xpath_element']);
}
@@ -203,8 +194,7 @@ public function i_should_watch_the_video_in_opencast()
* @param string $ltitoolname
* @param string $customparameter
*/
- public function the_lti_tool_should_have_the_custom_parameter($ltitoolname, $customparameter)
- {
+ public function the_lti_tool_should_have_the_custom_parameter($ltitoolname, $customparameter) {
global $DB;
$ltitool = $DB->get_record('lti', ['name' => $ltitoolname]);
@@ -223,8 +213,7 @@ public function the_lti_tool_should_have_the_custom_parameter($ltitoolname, $cus
* @param string $course
* @param string $customparameter
*/
- public function the_lti_tool_in_the_course_should_have_the_custom_parameter($ltitoolname, $course, $customparameter)
- {
+ public function the_lti_tool_in_the_course_should_have_the_custom_parameter($ltitoolname, $course, $customparameter) {
global $DB;
$cid = $this->get_course_id($course);
diff --git a/tests/delete_file_test.php b/tests/delete_file_test.php
index b790692c..a948dc11 100644
--- a/tests/delete_file_test.php
+++ b/tests/delete_file_test.php
@@ -39,16 +39,15 @@
* @copyright 2017 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class delete_file_test extends advanced_testcase
-{
+class delete_file_test extends advanced_testcase {
+
/**
* Test how trash deletion works.
*
* @covers \block_opencast\local\file_deletionmanager
*/
- public function test_delete_files()
- {
+ public function test_delete_files() {
global $DB;
// Set up.
diff --git a/tests/generator/lib.php b/tests/generator/lib.php
index 4157bd79..725e6ab2 100644
--- a/tests/generator/lib.php
+++ b/tests/generator/lib.php
@@ -26,8 +26,8 @@
/**
* Generator for test data.
*/
-class block_opencast_generator extends testing_block_generator
-{
+class block_opencast_generator extends testing_block_generator {
+
/**
* Creates a file.
@@ -37,8 +37,7 @@ class block_opencast_generator extends testing_block_generator
* @throws moodle_exception
* @throws stored_file_creation_exception
*/
- public function create_file($record = null)
- {
+ public function create_file($record = null) {
global $USER;
if (!isset($record['courseid'])) {
diff --git a/tests/helper/apibridge_testable.php b/tests/helper/apibridge_testable.php
index 69651c73..29fd5191 100644
--- a/tests/helper/apibridge_testable.php
+++ b/tests/helper/apibridge_testable.php
@@ -27,8 +27,8 @@
/**
* Test apibridge.
*/
-class block_opencast_apibridge_testable extends apibridge
-{
+class block_opencast_apibridge_testable extends apibridge {
+
/** @var array register for possible function results. */
private $register = [];
@@ -40,8 +40,7 @@ class block_opencast_apibridge_testable extends apibridge
* For basic testcases connection parameters are not necessary.
* block_opencast_apibridge_testable constructor.
*/
- public function __construct()
- {
+ public function __construct() {
}
@@ -50,8 +49,7 @@ public function __construct()
* @return array
* @throws dml_exception
*/
- public function getroles_testable()
- {
+ public function getroles_testable() {
return parent::getroles(1);
}
@@ -63,8 +61,7 @@ public function getroles_testable()
* @param mixed $value
*
*/
- public function set_testdata($methodname, $key, $value)
- {
+ public function set_testdata($methodname, $key, $value) {
global $CFG;
if (!isset($this->register[$methodname])) {
@@ -85,8 +82,7 @@ public function set_testdata($methodname, $key, $value)
*
* @return mixed the data or 'file' when using a file in /fixtures.
*/
- private function get_testdata($methodname, $key = null)
- {
+ private function get_testdata($methodname, $key = null) {
if (!isset($this->register[$methodname])) {
return null;
@@ -109,8 +105,7 @@ private function get_testdata($methodname, $key = null)
* @param string $methodname
* @param mixed $key
*/
- public function unset_testdata($methodname, $key)
- {
+ public function unset_testdata($methodname, $key) {
if (!isset($this->register[$methodname])) {
return;
@@ -131,8 +126,7 @@ public function unset_testdata($methodname, $key)
*
* @return object with error code and videos.
*/
- public function get_course_videos($courseid, $sortcolumns = null)
- {
+ public function get_course_videos($courseid, $sortcolumns = null) {
$result = new stdClass();
$result->videos = [];
@@ -155,8 +149,7 @@ public function get_course_videos($courseid, $sortcolumns = null)
* @return stdClass Video
*/
public function get_opencast_video($identifier, bool $withpublications = false, bool $withacl = false,
- bool $includingmedia = false)
- {
+ bool $includingmedia = false) {
$result = new stdClass();
$result->video = false;
$result->error = 0;
@@ -176,8 +169,7 @@ public function get_opencast_video($identifier, bool $withpublications = false,
* @param bool $withmetadata
* @return stdClass
*/
- public function get_series_videos($series, $sortcolumns = null, $withmetadata = false)
- {
+ public function get_series_videos($series, $sortcolumns = null, $withmetadata = false) {
$result = new stdClass();
$result->error = 0;
@@ -210,8 +202,7 @@ public function get_series_videos($series, $sortcolumns = null, $withmetadata =
* @param bool $withmetadata
* @return stdClass
*/
- public function get_block_videos($courseid, $withmetadata = false)
- {
+ public function get_block_videos($courseid, $withmetadata = false) {
// Used for behat test.
$result = new stdClass();
$result->count = 0;
@@ -251,8 +242,7 @@ public function get_block_videos($courseid, $withmetadata = false)
* @return boolean
* @throws moodle_exception
*/
- public function create_course_series($courseid, $seriestitle = null, $userid = null)
- {
+ public function create_course_series($courseid, $seriestitle = null, $userid = null) {
$mapping = seriesmapping::get_record(['courseid' => $courseid, 'isdefault' => '1']);
if ($mapping && $seriesid = $mapping->get('series')) {
@@ -284,8 +274,7 @@ public function create_course_series($courseid, $seriestitle = null, $userid = n
* @param string $level
* @return boolean
*/
- public function supports_api_level($level)
- {
+ public function supports_api_level($level) {
$value = $this->get_testdata('supports_api_level', 'level');
return ($value == $level);
}
@@ -296,8 +285,7 @@ public function supports_api_level($level)
* @param array $eventids
* @return boolean
*/
- public function get_already_existing_event($eventids)
- {
+ public function get_already_existing_event($eventids) {
$registeredevents = $this->get_testdata('get_course_videos');
@@ -317,8 +305,7 @@ public function get_already_existing_event($eventids)
* @param int $courseid
* @return object|null
*/
- public function get_default_course_series($courseid)
- {
+ public function get_default_course_series($courseid) {
$result = null;
if ($value = $this->get_testdata('get_default_course_series', $courseid)) {
@@ -333,8 +320,7 @@ public function get_default_course_series($courseid)
* @param string $name
* @return bool|mixed|null
*/
- public function check_if_workflow_exists($name)
- {
+ public function check_if_workflow_exists($name) {
return $this->get_testdata('check_if_workflow_exists', $name);
}
@@ -346,8 +332,7 @@ public function check_if_workflow_exists($name)
* @param false $returnworkflowid
* @return bool|int|mixed|null
*/
- public function start_workflow($eventid, $duplicateworkflow, $params = [], $returnworkflowid = false)
- {
+ public function start_workflow($eventid, $duplicateworkflow, $params = [], $returnworkflowid = false) {
return $this->get_testdata('start_workflow', $duplicateworkflow);
}
diff --git a/tests/privacy_test.php b/tests/privacy_test.php
index 192c18c5..fa8dd239 100644
--- a/tests/privacy_test.php
+++ b/tests/privacy_test.php
@@ -43,14 +43,13 @@
* @copyright 2018 Tamara Gunkel
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class privacy_test extends provider_testcase
-{
+class privacy_test extends provider_testcase {
+
/**
* Overriding setUp() function to always reset after tests.
*/
- public function setUp(): void
- {
+ public function setUp(): void {
$this->resetAfterTest(true);
}
@@ -59,8 +58,7 @@ public function setUp(): void
*
* @covers \block_opencast\privacy\provider
*/
- public function test_get_metadata()
- {
+ public function test_get_metadata() {
$collection = new collection('block_opencast');
$newcollection = provider::get_metadata($collection);
$itemcollection = $newcollection->get_collection();
@@ -94,8 +92,7 @@ public function test_get_metadata()
*
* @covers \block_opencast\privacy\provider::get_contexts_for_userid
*/
- public function test_get_contexts_for_userid()
- {
+ public function test_get_contexts_for_userid() {
global $DB;
// Test setup.
@@ -168,8 +165,7 @@ public function test_get_contexts_for_userid()
*
* @covers \block_opencast\privacy\provider::export_user_data
*/
- public function test_export_user_data()
- {
+ public function test_export_user_data() {
global $DB;
// Test setup.
@@ -227,8 +223,7 @@ public function test_export_user_data()
*
* @covers \block_opencast\privacy\provider::delete_data_for_all_users_in_context
*/
- public function test_delete_data_for_all_users_in_context()
- {
+ public function test_delete_data_for_all_users_in_context() {
global $DB;
// Test setup.
@@ -275,8 +270,7 @@ public function test_delete_data_for_all_users_in_context()
*
* @covers \block_opencast\privacy\provider::delete_data_for_user
*/
- public function test_delete_data_for_user()
- {
+ public function test_delete_data_for_user() {
global $DB;
// Test setup.
@@ -366,8 +360,7 @@ public function test_delete_data_for_user()
*
* @covers \block_opencast\privacy\provider::get_users_in_context
*/
- public function test_get_users_in_context()
- {
+ public function test_get_users_in_context() {
global $DB;
// Test setup.
@@ -472,8 +465,7 @@ public function test_get_users_in_context()
*
* @covers \block_opencast\privacy\provider::delete_data_for_users
*/
- public function test_delete_data_for_users()
- {
+ public function test_delete_data_for_users() {
global $DB;
// Test setup.
diff --git a/tests/upload_test.php b/tests/upload_test.php
index 9dd782c5..10b8352d 100644
--- a/tests/upload_test.php
+++ b/tests/upload_test.php
@@ -44,8 +44,8 @@
* @copyright 2017 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class upload_test extends advanced_testcase
-{
+class upload_test extends advanced_testcase {
+
/** @var string Test api url. */
private $apiurl = 'http://127.0.0.1:8080';
@@ -61,8 +61,7 @@ class upload_test extends advanced_testcase
/**
* Test, whether the plugin is properly installed.
*/
- public function notest_plugin_installed()
- {
+ public function notest_plugin_installed() {
$config = get_config('block_opencast');
$this->assertNotEmpty($config);
@@ -75,8 +74,7 @@ public function notest_plugin_installed()
* @throws coding_exception
* @throws dml_exception
*/
- public function test_upload()
- {
+ public function test_upload() {
global $CFG, $DB;
$this->resetAfterTest();
@@ -161,8 +159,7 @@ public function test_upload()
*
* @return bool true if the video is avialable, false otherwise.
*/
- private function notest_check_uploaded_video($courseid, $apibridge)
- {
+ private function notest_check_uploaded_video($courseid, $apibridge) {
$uploadhelper = new upload_helper();
// Prevent mtrace output, which would be considered risky.
ob_start();
diff --git a/version.php b/version.php
index ecf00840..8a4ef56d 100644
--- a/version.php
+++ b/version.php
@@ -28,6 +28,6 @@
$plugin->version = 2023051200;
$plugin->requires = 2020061500; // Requires Moodle 3.9+.
$plugin->maturity = MATURITY_ALPHA;
-$plugin->dependencies = array(
- 'tool_opencast' => 2023051200
-);
+$plugin->dependencies = [
+ 'tool_opencast' => 2023051200,
+];
diff --git a/videoeditor.php b/videoeditor.php
index b8e456ee..8dbb59f9 100644
--- a/videoeditor.php
+++ b/videoeditor.php
@@ -38,9 +38,9 @@
$courseid = required_param('courseid', PARAM_INT);
$ocinstanceid = optional_param('ocinstanceid', settings_api::get_default_ocinstance()->id, PARAM_INT);
-$redirecturl = new moodle_url('/blocks/opencast/index.php', array('courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+$redirecturl = new moodle_url('/blocks/opencast/index.php', ['courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$baseurl = new moodle_url('/blocks/opencast/videoeditor.php',
- array('video_identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid));
+ ['video_identifier' => $identifier, 'courseid' => $courseid, 'ocinstanceid' => $ocinstanceid]);
$PAGE->set_url($baseurl);
require_login($courseid, false);