Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some basic codestyling things #383

Merged
merged 8 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion addtranscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@

/**
* Add new transcription to the event
*
* @package block_opencast
* @copyright 2022 Farbod Zamani Boroujeni, ELAN e.V.
* @author Farbod Zamani Boroujeni <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');

use block_opencast\local\addtranscription_form;
use block_opencast\local\apibridge;
use block_opencast\local\attachment_helper;
use core\output\notification;
use tool_opencast\local\settings_api;

require_once('../../config.php');

global $PAGE, $OUTPUT, $CFG, $SITE;

require_once($CFG->dirroot . '/repository/lib.php');
Expand Down
2 changes: 1 addition & 1 deletion addvideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
* @copyright 2017 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');

use block_opencast\local\addvideo_form;
use block_opencast\local\apibridge;
use block_opencast\local\file_deletionmanager;
use block_opencast\local\upload_helper;
use core\output\notification;
use tool_opencast\local\settings_api;
require_once('../../config.php');

global $PAGE, $OUTPUT, $CFG, $USER, $SITE, $DB;

Expand Down
12 changes: 8 additions & 4 deletions backup/moodle2/backup_opencast_block_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,17 @@ protected function define_my_settings() {
$stringobj = new \stdClass();
$stringobj->title = $videotobackup->title;
$stringobj->identifier = '***' . substr($videotobackup->identifier, -6);
$videolist[] = "- " . get_string('importvideos_wizard_event_cb_title', 'block_opencast', $stringobj);
$videolist[] = "- " . get_string('importvideos_wizard_event_cb_title',
'block_opencast', $stringobj);
}
// The label does not support any html, so we need to use the text for line breaks.
$seriessetting->get_ui()->set_text(join('<br>', $videolist));
}
$seriessetting->get_ui()->set_label($seriessettinglabel);

$this->add_setting($seriessetting);
$this->get_setting($includesettingname)->add_dependency($seriessetting, setting_dependency::DISABLED_NOT_CHECKED);
$this->get_setting($includesettingname)->add_dependency($seriessetting,
setting_dependency::DISABLED_NOT_CHECKED);

if ($importmode !== 'acl') {
foreach ($videostobackup as $bkvideo) {
Expand All @@ -158,7 +160,8 @@ protected function define_my_settings() {
get_string('importvideos_wizard_event_cb_title', 'block_opencast', $stringobj)
);
$this->add_setting($episodesetting);
$this->get_setting($seriessettingname)->add_dependency($episodesetting, setting_dependency::DISABLED_NOT_CHECKED);
$this->get_setting($seriessettingname)->add_dependency($episodesetting,
setting_dependency::DISABLED_NOT_CHECKED);
}
}
}
Expand Down Expand Up @@ -202,7 +205,8 @@ protected function define_my_steps() {
foreach ($result->videos as $video) {
// Checking the episode inclusion.
$episodesettingname = 'opencast_videos_' . $ocinstance->id . '_episode_' . $video->identifier . '_included';
if ($importmode === 'acl' || $this->setting_exists($episodesettingname) && $this->get_setting_value($episodesettingname)) {
if ($importmode === 'acl' || $this->setting_exists($episodesettingname) &&
$this->get_setting_value($episodesettingname)) {
// We store the episode of series in backupstructuredata.
$backupstructuredata[$series->series][] = $video->identifier;
}
Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/settings/block_backup_setting.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function __construct($name, $vtype, $value = null, $level = self::COURSE_
'monologo',
get_string('pluginname', 'block_opencast'),
'block_opencast',
array('class' => 'iconlarge icon-post ml-1')
['class' => 'iconlarge icon-post ml-1']
)
);

Expand Down
2 changes: 1 addition & 1 deletion batchupload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
* @author Farbod Zamani Boroujeni <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');

use block_opencast\local\batchupload_form;
use block_opencast\local\apibridge;
use block_opencast\local\file_deletionmanager;
use block_opencast\local\upload_helper;
use core\output\notification;
use tool_opencast\local\settings_api;
require_once('../../config.php');

global $PAGE, $OUTPUT, $CFG, $USER, $SITE, $DB;

Expand Down
4 changes: 2 additions & 2 deletions classes/local/activitymodulemanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ public static function fix_imported_series_modules_in_new_course(
'ocinstanceid' => $ocinstanceid,
'type' => opencasttype::SERIES,
'course' => $courseid,
'opencastid' => $sourceseriesid
'opencastid' => $sourceseriesid,
]);

// IF anything has been found.
Expand Down Expand Up @@ -692,7 +692,7 @@ public static function fix_imported_episode_modules_in_new_course(
'ocinstanceid' => $ocinstanceid,
'course' => $targetcourseid,
'type' => opencasttype::EPISODE,
'opencastid' => $sourceeventid
'opencastid' => $sourceeventid,
]);

if (count($episodemodules) > 0) {
Expand Down
3 changes: 2 additions & 1 deletion classes/local/apibridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ public function get_block_videos($courseid, $withmetadata = false) {
'withacl' => true,
'withmetadata' => $withmetadata === true,
'withpublications' => true,
'includeInternalPublication' => false, // Somehow causes error in Opencast 15 if withpublications is used without it.
'includeInternalPublication' => false,
// Somehow causes error in Opencast 15 if withpublications is used without it.
'sort' => [
'start_date' => 'DESC',
],
Expand Down
4 changes: 2 additions & 2 deletions classes/local/notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ public static function notify_missing_events($courseid, $missingevents) {
* Notify administrator upon an exception error.
*
* @param string $identifier
* @param Exception $e
* @param Exception|null $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');

Expand Down
6 changes: 3 additions & 3 deletions classes/output/importvideos/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ class renderer extends core_backup_renderer {
* with the goal to adapt the widget to our needs.
*
* @param moodle_url $nextstageurl
* @param importvideos_coursesearch $courses
* @param importvideos_coursesearch|null $courses
*
* @return string
*/
public function importvideos_coursesearch(moodle_url $nextstageurl,
importvideos_coursesearch $courses = null) {
public function importvideos_coursesearch(moodle_url $nextstageurl,
?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'));
Expand Down
9 changes: 6 additions & 3 deletions classes/setting_default_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public static function init_regirstered_defaults($ocinstanceid = 1) {
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,"batchable":0},' .
'{"name":"subjects","datatype":"autocomplete","required":0,"readonly":0,"param_json":null,"defaultable":0,' .
'"batchable":0},' .
'{"name":"description","datatype":"textarea","required":0,"readonly":0,"param_json":' .
'"{\"rows\":\"3\",\"cols\":\"19\"}","defaultable":0,"batchable":0},' .
'{"name":"language","datatype":"select","required":0,"readonly":0,"param_json":"{\"\":\"No option selected\",' .
Expand All @@ -74,8 +75,10 @@ public static function get_default_metadata() {
'\"ALLRIGHTS\":\"All Rights Reserved\",\"CC0\":\"CC0\",\"CC-BY-ND\":\"CC BY-ND\",\"CC-BY-NC-ND\":\"CC BY-NC-ND\",' .
'\"CC-BY-NC-SA\":\"CC BY-NC-SA\",\"CC-BY-SA\":\"CC BY-SA\",\"CC-BY-NC\":\"CC BY-NC\",\"CC-BY\":\"CC BY\"}",' .
'"defaultable":0,"batchable":0},' .
'{"name":"creator","datatype":"autocomplete","required":0,"readonly":0,"param_json":null,"defaultable":0,"batchable":0},' .
'{"name":"contributor","datatype":"autocomplete","required":0,"readonly":0,"param_json":null,"defaultable":0,"batchable":0}]';
'{"name":"creator","datatype":"autocomplete","required":0,"readonly":0,"param_json":null,"defaultable":0,' .
'"batchable":0},' .
'{"name":"contributor","datatype":"autocomplete","required":0,"readonly":0,"param_json":null,"defaultable":0,' .
'"batchable":0}]';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion deleteaclgroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
* @copyright 2017 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');

use block_opencast\local\apibridge;
use block_opencast\local\upload_helper;
use tool_opencast\local\settings_api;
require_once('../../config.php');

global $PAGE, $OUTPUT, $CFG;

Expand Down
2 changes: 1 addition & 1 deletion deleteevent.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
* @copyright 2017 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');

use block_opencast\local\apibridge;
use block_opencast\local\upload_helper;
use tool_opencast\local\settings_api;
require_once('../../config.php');

global $PAGE, $OUTPUT, $CFG, $SITE;

Expand Down
2 changes: 1 addition & 1 deletion deletetranscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
* @author Farbod Zamani Boroujeni <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');

use block_opencast\local\attachment_helper;
use block_opencast\local\apibridge;
use core\output\notification;
use tool_opencast\local\settings_api;
require_once('../../config.php');

global $PAGE, $OUTPUT, $CFG, $SITE;

Expand Down
6 changes: 3 additions & 3 deletions directaccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
* @copyright 2022 Farbod Zamani Boroujeni <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');
require_once($CFG->dirroot . '/mod/lti/locallib.php');
require_once($CFG->dirroot . '/lib/oauthlib.php');

use block_opencast\local\apibridge;
use block_opencast\local\lti_helper;
use core\output\notification;
use tool_opencast\local\settings_api;
require_once('../../config.php');
require_once($CFG->dirroot . '/mod/lti/locallib.php');
require_once($CFG->dirroot . '/lib/oauthlib.php');

global $PAGE, $OUTPUT, $CFG;

Expand Down
6 changes: 3 additions & 3 deletions downloadtranscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
* @copyright 2022 Farbod Zamani Boroujeni <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');
require_once($CFG->dirroot . '/mod/lti/locallib.php');
require_once($CFG->dirroot . '/lib/oauthlib.php');

use block_opencast\local\apibridge;
use block_opencast\local\lti_helper;
use core\output\notification;
use tool_opencast\local\settings_api;
require_once('../../config.php');
require_once($CFG->dirroot . '/mod/lti/locallib.php');
require_once($CFG->dirroot . '/lib/oauthlib.php');

global $PAGE, $OUTPUT, $CFG;

Expand Down
2 changes: 1 addition & 1 deletion downloadvideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
* @copyright 2021 Tamara Gunkel, University of Münster
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');

use block_opencast\local\apibridge;
use core\output\notification;
use tool_opencast\local\settings_api;
require_once('../../config.php');

global $PAGE, $OUTPUT, $CFG;

Expand Down
6 changes: 3 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
* @copyright 2017 Andreas Wagner, SYNERGY LEARNING
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');
require_once($CFG->dirroot . '/lib/tablelib.php');

use block_opencast\local\activitymodulemanager;
use block_opencast\local\apibridge;
Expand All @@ -33,6 +31,8 @@
use block_opencast\opencast_connection_exception;
use core\notification;
use tool_opencast\local\settings_api;
require_once('../../config.php');
require_once($CFG->dirroot . '/lib/tablelib.php');

global $PAGE, $OUTPUT, $CFG, $DB, $USER, $SITE;

Expand Down Expand Up @@ -457,7 +457,7 @@
$video->processing_state !== "STOPPED") {
$row[] = "-";
} else {
// TODO query alcs already at the beginning to avoid second rest call.
// Should Do Query alcs already at the beginning to avoid second rest call.
$visible = $apibridge->is_event_visible($video->identifier, $courseid);
$row[] = $renderer->render_change_visibility_icon($ocinstanceid, $courseid, $video->identifier, $visible);
}
Expand Down
Loading
Loading