From 00ed51db1bfede17bdceb19964ff3aa8b80e7652 Mon Sep 17 00:00:00 2001 From: DFNVC <git@vc.dfn.de> Date: Mon, 28 Jun 2021 15:45:31 +0200 Subject: [PATCH] =?UTF-8?q?Anpassungen=20f=C3=BCr=20Moodle=20Version=203.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect_class.php | 6 +++--- connect_class_dom.php | 2 +- conntest.php | 4 ++-- join.php | 22 ++++++++++++-------- joinrecording.php | 15 ++++++++------ lib.php | 14 +++++++++---- locallib.php | 48 +++++++++++++++++++++++++------------------ mod_form.php | 2 +- settings.php | 2 +- view.php | 30 +++++++++++++++------------ 10 files changed, 85 insertions(+), 60 deletions(-) diff --git a/connect_class.php b/connect_class.php index 9290c22..c9e901a 100644 --- a/connect_class.php +++ b/connect_class.php @@ -104,7 +104,7 @@ class connect_class { return $this->_https; } - // DFNVC + // DFNconf public function get_header() { return $this->_header; } @@ -186,7 +186,7 @@ class connect_class { $header = $this->get_default_header(); $header = array_merge($header, $add_header); - // DFNVC + // DFNconf // $header = array("Hugo: test"); $this->_header = $header; @@ -206,7 +206,7 @@ class connect_class { * Sends the HTTP header login request and returns the response xml * @param string username username to use for header x-user-id */ - /* DFNVC */ + /* DFNconf */ /* public function request_http_header_login($return_header = 0, $username = '', $stop = false) { global $CFG; diff --git a/connect_class_dom.php b/connect_class_dom.php index b9d31c4..54bc06e 100644 --- a/connect_class_dom.php +++ b/connect_class_dom.php @@ -33,7 +33,7 @@ class connect_class_dom extends connect_class { foreach($params as $key => $data) { - // DFNVC + // DFNconf // htmlentities() durch htmlspecialchars() ersetzt, // damit auch Nutzer agelegt werden können, deren Namen // Umlaute enthalten. diff --git a/conntest.php b/conntest.php index 7d09451..84c47ed 100644 --- a/conntest.php +++ b/conntest.php @@ -40,7 +40,7 @@ $param = array('name' => 'adobeconnect_admin_password'); $ac->pass = $DB->get_field('config', 'value', $param); - /* DFNVC */ + /* DFNconf */ /* $param = array('name' => 'adobeconnect_admin_httpauth'); $ac->httpauth = $DB->get_field('config', 'value', $param); */ @@ -87,7 +87,7 @@ } else { $https = false; } - /* DFNVC + /* DFNconf adobe_connection_test($ac->host, $ac->port, $ac->login, $ac->pass, $ac->httpauth, $ac->emaillogin, $ac->https); diff --git a/join.php b/join.php index d164759..0750964 100644 --- a/join.php +++ b/join.php @@ -75,7 +75,8 @@ if (0 != $cm->groupmode/*$adobeconnect->meetingpublic*/) { } } -$context = get_context_instance(CONTEXT_COURSE, $cm->course); +//$context = get_context_instance(CONTEXT_COURSE, $cm->course); +$context = context_course::instance($cm->course); // Make sure the user has a role in the course $crsroles = get_roles_used_in_context($context); @@ -105,7 +106,7 @@ if ($usrcanjoin and confirm_sesskey($sesskey)) { // Check if the meeting still exists on the Adobe server // - // DFNVC + // DFNconf // // $meetfldscoid = aconnect_get_folder($aconnect, 'meetings'); $meetfldscoid = aconnect_get_meeting_folder($aconnect); @@ -118,7 +119,7 @@ if ($usrcanjoin and confirm_sesskey($sesskey)) { $meeting = current($meeting); } - // DFNVC + // DFNconf //if (!($usrprincipal = aconnect_user_exists($aconnect, $usrobj))) { if (!($usrprincipal = lms_user_exists($aconnect, $usrobj))) { if (!($usrprincipal = aconnect_create_user($aconnect, $usrobj))) { @@ -129,7 +130,9 @@ if ($usrcanjoin and confirm_sesskey($sesskey)) { } } - $context = get_context_instance(CONTEXT_MODULE, $id); + //$context = get_context_instance(CONTEXT_MODULE, $id); + + $context = context_course::instance($cm->course); // Check the user's capabilities and assign them the Adobe Role if (!empty($meetingscoid) and !empty($usrprincipal) and !empty($meeting)) { @@ -201,7 +204,7 @@ if ($usrcanjoin and confirm_sesskey($sesskey)) { $protocol = 'https://'; $https = true; } - // DFNVC + // DFNconf // $aconnect = new connect_class_dom($CFG->adobeconnect_host, $CFG->adobeconnect_port, // '', '', '', $https); //$aconnect = aconnect_login(); @@ -220,10 +223,11 @@ if ($usrcanjoin and confirm_sesskey($sesskey)) { $port = ':' . $CFG->adobeconnect_port; } - add_to_log($course->id, 'adobeconnect', 'join meeting', - "join.php?id=$cm->id&groupid=$groupid&sesskey=$sesskey", - "Joined $adobeconnect->name meeting", $cm->id); - aconnect_logout($aconnect); + // add_to_log($course->id, 'adobeconnect', 'join meeting', + // "join.php?id=$cm->id&groupid=$groupid&sesskey=$sesskey", + // "Joined $adobeconnect->name meeting", $cm->id); + + aconnect_logout($aconnect); redirect($protocol . $CFG->adobeconnect_meethost . $port . $meeting->url diff --git a/joinrecording.php b/joinrecording.php index fcfec77..aef2973 100644 --- a/joinrecording.php +++ b/joinrecording.php @@ -16,7 +16,7 @@ require_once(dirname(__FILE__).'/connect_class_dom.php'); $id = required_param('id', PARAM_INT); $groupid = required_param('groupid', PARAM_INT); -// DFNVC +// DFNconf $recordingscoid = required_param('recording', PARAM_INT); $convert = optional_param('convert', null, PARAM_INT); $edit = optional_param('edit', null, PARAM_INT); @@ -78,7 +78,7 @@ $sql = "SELECT meetingscoid FROM {adobeconnect_meeting_groups} amg WHERE ". $meetscoid = $DB->get_record_sql($sql, $params); // -// DFNVC +// DFNconf // In order to access recordings, users have to be affiliated to the meetings // participant list even if they have not attended the meeting before. // @@ -110,7 +110,10 @@ if (!($usrprincipal = lms_user_exists($aconnect, $usrobj))) { } } -$context = get_context_instance(CONTEXT_MODULE, $id); +//$context = get_context_instance(CONTEXT_MODULE, $id); +// TODO +//$context = context_course::instance($id); +$context = context_course::instance($cm->course); if (!empty($meetscoid) and !empty($usrprincipal) and !empty($meeting)) { if (has_capability('mod/adobeconnect:meetinghost', $context, $usrobj->id, false)) { @@ -156,7 +159,7 @@ if (!empty($meetscoid) and !empty($usrprincipal) and !empty($meeting)) { } // -// DFNVC END +// DFNconf END // @@ -195,8 +198,8 @@ if (empty($recordingurlpath) and confirm_sesskey()) { } aconnect_logout($aconnect); -add_to_log($course->id, 'adobeconnect', 'view', - "view.php?id=$cm->id", "View recording {$adobeconnect->name} details", $cm->id); +//add_to_log($course->id, 'adobeconnect', 'view', +// "view.php?id=$cm->id", "View recording {$adobeconnect->name} details", $cm->id); // Include the port number only if it is a port other than 80 $port = ''; diff --git a/lib.php b/lib.php index 280b268..60accba 100644 --- a/lib.php +++ b/lib.php @@ -80,7 +80,10 @@ function adobeconnect_add_instance($adobeconnect) { $meeting = new stdClass(); // Assign the current user with the Adobe Presenter role - $context = get_context_instance(CONTEXT_COURSE, $adobeconnect->course); + //$context = get_context_instance(CONTEXT_COURSE, $adobeconnect->course); + // TODO + $context = context_course::instance($adobeconnect->course); + if (!has_capability('mod/adobeconnect:meetinghost', $context, $USER->id, false)) { @@ -101,7 +104,7 @@ function adobeconnect_add_instance($adobeconnect) { } $aconnect = aconnect_login(); - // DFNVC + // DFNconf // // $meetfldscoid = aconnect_get_folder($aconnect, 'meetings'); $meetfldscoid = aconnect_get_meeting_folder($aconnect); @@ -250,6 +253,7 @@ function adobeconnect_add_instance($adobeconnect) { * @return boolean Success/Fail */ function adobeconnect_update_instance($adobeconnect) { + global $DB; $adobeconnect->timemodified = time(); @@ -257,7 +261,7 @@ function adobeconnect_update_instance($adobeconnect) { $aconnect = aconnect_login(); - // DFNVC + // DFNconf // // $meetfldscoid = aconnect_get_folder($aconnect, 'meetings'); $meetfldscoid = aconnect_get_meeting_folder($aconnect); @@ -413,9 +417,11 @@ function adobeconnect_update_instance($adobeconnect) { * @param int $id Id of the module instance * @return boolean Success/Failure */ + function adobeconnect_delete_instance($id) { + global $DB; - + $param = array('id' => $id); if (! $adobeconnect = $DB->get_record('adobeconnect', $param)) { return false; diff --git a/locallib.php b/locallib.php index 7f124df..bb2f66f 100644 --- a/locallib.php +++ b/locallib.php @@ -29,7 +29,7 @@ define('ADOBE_MEETPERM_PRIVATE', 2); // means the meeting is private, and only r define('ADOBE_TMZ_LENGTH', 6); -/* DFNVC +/* DFNconf function adobe_connection_test($host = '', $port = 80, $username = '', $password = '', $httpheader = '', $emaillogin, $https = false) { @@ -43,7 +43,7 @@ function adobe_connection_test($host = '', $port = 80, $username = '', empty($port) or (0 == $port) or empty($username) or empty($password)) - /* DFNVC + /* DFNconf or empty($httpheader)) { */ { @@ -116,7 +116,7 @@ function adobe_connection_test($host = '', $port = 80, $username = '', if ($aconnectDOM->call_success()) { echo '<p style="color:#006633">successfully logged in as '. $username . '</p>'; - // DFNVC + // DFNconf // Test header login // /* echo '<p><b>Testing header login:</b><p>'; */ @@ -143,7 +143,7 @@ function adobe_connection_test($host = '', $port = 80, $username = '', } - // DFNVC + // DFNconf // Testing retrieval of meeting folder sco-id // echo '<p><b>Testing retrevial of meetings folder:</b></p>'; @@ -155,7 +155,7 @@ function adobe_connection_test($host = '', $port = 80, $username = '', echo '<p style="color:#680000">XML request:<br />'. htmlspecialchars($aconnectDOM->_xmlrequest). '</p>'; echo '<p style="color:#680000">XML response:<br />'. htmlspecialchars($aconnectDOM->_xmlresponse). '</p>'; } - // DFNVC + // DFNconf // Testing retrieval of shared template folder // TODO echo '<p><b>Testing retrevial of shared meeting templates:</b></p>'; @@ -173,7 +173,7 @@ function adobe_connection_test($host = '', $port = 80, $username = '', echo '<p style="color:#680000">XML response:<br />'. htmlspecialchars($aconnectDOM->_xmlresponse). '</p>'; } - // DFNVC + // DFNconf // Test creating a meeting // echo '<p><b>Test creating a meeting:</b></p>'; @@ -195,7 +195,7 @@ function adobe_connection_test($host = '', $port = 80, $username = '', echo '<p style="color:#680000">XML response:<br />'. htmlspecialchars($aconnectDOM->_xmlresponse). '</p>'; } - // DFNVC + // DFNconf // Test making meeting public // echo '<p><b>Test making meeting public:</b></p>'; @@ -210,7 +210,7 @@ function adobe_connection_test($host = '', $port = 80, $username = '', // // Test creating a user - // DFNVC + // DFNconf // echo '<p><b>Test creating a user:</b></p>'; $user = new stdClass(); @@ -390,7 +390,7 @@ function aconnect_get_folder_sco_id($xml, $folder) { } // -// DFNVC +// DFNconf // Get user's meetings folder sco-id // function aconnect_get_user_folder($aconnect, $meetingsscoid, $folder = '') { @@ -411,7 +411,7 @@ function aconnect_get_user_folder($aconnect, $meetingsscoid, $folder = '') { } // -// DFNVC +// DFNconf // function aconnect_get_meeting_folder($aconnect) { global $DB; @@ -424,7 +424,7 @@ function aconnect_get_meeting_folder($aconnect) { } // -// DFNVC +// DFNconf // function aconnect_get_content_folder($aconnect) { global $DB; @@ -436,7 +436,7 @@ function aconnect_get_content_folder($aconnect) { return $folderscoid; } // -// DFNVC +// DFNconf // function aconnect_urlpath_exists($aconnect, $urlpath) { $folderscoid = false; @@ -707,7 +707,7 @@ function aconnect_return_all_templates($xml) { return $templates; } -// DFNVC +// DFNconf // Get Recording url-path // function aconnect_get_recording_urlpath($aconnect, $meetingscoid, $recordingscoid) { @@ -745,7 +745,7 @@ function aconnect_get_recordings($aconnect, $folderscoid, $sourcescoid) { 'sco-id' => $folderscoid, //'filter-source-sco-id' => $sourcescoid, // - // DFNVC Quickfix - 29.08.2013 + // DFNconf Quickfix - 29.08.2013 // Nur Aufnahemen anzeigen 'filter-icon' => 'archive', // @@ -791,7 +791,7 @@ function aconnect_get_recordings($aconnect, $folderscoid, $sourcescoid) { // Check if the SCO item is a recording or uploaded document. We only want to display recordings // - // DFNVC - 24.5.2012 + // DFNconf - 24.5.2012 // //In AC9, the recording length info is stored as an attributed of 'sco' $recordingvac9 = $innernodelist->item($x)->attributes->getNamedItem('duration'); @@ -804,6 +804,9 @@ function aconnect_get_recordings($aconnect, $folderscoid, $sourcescoid) { $value = (!is_null($meetingdetail->getElementsByTagName('name'))) ? $meetingdetail->getElementsByTagName('name')->item(0)->nodeValue : ''; + // DFNconf + $recordings[$j] = new stdClass(); + $recordings[$j]->name = (string) $value; $value = (!is_null($meetingdetail->getElementsByTagName('url-path'))) ? @@ -994,7 +997,7 @@ function aconnect_format_date_seconds($time) { function aconnect_create_meeting($aconnect, $meetingobj, $meetingfdl) { //date("Y-m-d\TH:i - // DFNVC + // DFNconf // Meeting soll Kurssprache übernehmen // global $COURSE; @@ -1053,6 +1056,7 @@ function aconnect_create_meeting($aconnect, $meetingobj, $meetingfdl) { * properties as value || false if not found or error occured */ function aconnect_meeting_exists($aconnect, $meetfldscoid, $filter = array()) { + $matches = array(); $params = array( @@ -1069,6 +1073,7 @@ function aconnect_meeting_exists($aconnect, $meetfldscoid, $filter = array()) { $aconnect->create_request($params); if ($aconnect->call_success()) { + $dom = new DomDocument(); $dom->loadXML($aconnect->_xmlresponse); @@ -1095,11 +1100,14 @@ function aconnect_meeting_exists($aconnect, $meetfldscoid, $filter = array()) { $value = (!is_null($meetingdetail->getElementsByTagName('name'))) ? $meetingdetail->getElementsByTagName('name')->item(0)->nodeValue : ''; + // DFNconf + $matches[$key] = new stdClass(); + $matches[$key]->name = (string) $value; $value = (!is_null($meetingdetail->getElementsByTagName('url-path'))) ? - $meetingdetail->getElementsByTagName('url-path')->item(0)->nodeValue : ''; - + $meetingdetail->getElementsByTagName('url-path')->item(0)->nodeValue : ''; + $matches[$key]->url = (string) $value; $matches[$key]->scoid = (int) $key; @@ -1187,7 +1195,7 @@ function aconnect_user_exists($aconnect, $usrdata) { } -// DFNVC +// DFNconf function lms_user_exists($aconnect, $usrdata) { $params = array( 'action' => 'lms-user-exists', @@ -1204,7 +1212,7 @@ function lms_user_exists($aconnect, $usrdata) { } // -// DFNVC +// DFNconf // function aconnect_delete_user($aconnect, $principalid = 0) { diff --git a/mod_form.php b/mod_form.php index 1d24e5d..d2356a4 100644 --- a/mod_form.php +++ b/mod_form.php @@ -123,7 +123,7 @@ class mod_adobeconnect_mod_form extends moodleform_mod { // Search for a Meeting with the same starting name. It will cause a duplicate // meeting name (and error) when the user begins to add participants to the meeting // - // DFNVC + // DFNconf // $meetfldscoid = aconnect_get_meeting_folder($aconnect); // diff --git a/settings.php b/settings.php index bf6ddc7..e2e42a8 100644 --- a/settings.php +++ b/settings.php @@ -38,7 +38,7 @@ $PAGE->requires->js_init_call('M.mod_adobeconnect.init'); $settings->add(new admin_setting_configpasswordunmask('adobeconnect_admin_password', get_string('admin_password', 'adobeconnect'), get_string('admin_password_desc', 'adobeconnect'), '')); - /* DFNVC + /* DFNconf $settings->add(new admin_setting_configtext('adobeconnect_admin_httpauth', get_string('admin_httpauth', 'adobeconnect'), get_string('admin_httpauth_desc', 'adobeconnect'), 'my-user-id', PARAM_TEXT)); */ diff --git a/view.php b/view.php index c5f9d4d..e41ccb6 100644 --- a/view.php +++ b/view.php @@ -21,6 +21,8 @@ $groupid = optional_param('group', 0, PARAM_INT); global $CFG, $USER, $DB, $PAGE, $OUTPUT; + + if ($id) { if (! $cm = get_coursemodule_from_id('adobeconnect', $id)) { error('Course Module ID was incorrect'); @@ -58,6 +60,8 @@ if ($id) { require_login($course, true, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); +// TODO +//$context = context_course::instance($cm->id); // Check for submitted data if (($formdata = data_submitted($CFG->wwwroot . '/mod/adobeconnect/view.php')) && confirm_sesskey()) { @@ -171,7 +175,7 @@ if (!empty($meetscoids)) { // Get the shared content folder sco-id // Create a list of recordings moved to the shared content folder // - // DFNVC + // DFNconf // // $meetfldscoid = aconnect_get_folder($aconnect, 'content'); $meetfldscoid = aconnect_get_content_folder($aconnect); @@ -223,7 +227,7 @@ if (!empty($meetscoids)) { // Check if the user exists and if not create the new user - // DFNVC + // DFNconf //if (!($usrprincipal = aconnect_user_exists($aconnect, $usrobj))) { if (!($usrprincipal = lms_user_exists($aconnect, $usrobj))) { if (!($usrprincipal = aconnect_create_user($aconnect, $usrobj))) { @@ -270,7 +274,7 @@ if (isset($CFG->adobeconnect_https) and (!empty($CFG->adobeconnect_https))) { $https = true; } -// DFNVC +// DFNconf //$aconnect = new connect_class_dom($CFG->adobeconnect_host, $CFG->adobeconnect_port, // '', '', '', $https); $aconnect = aconnect_login(); @@ -283,14 +287,14 @@ if ($cm->groupmode) { // Not sure if this is needed anymore... groups_print_course_menu($course, "view.php?id=$id"); } -// DFNVC +// DFNconf $aconnect = aconnect_login(); // Get the Meeting details $cond = array('instanceid' => $adobeconnect->id, 'groupid' => $groupid); $scoid = $DB->get_field('adobeconnect_meeting_groups', 'meetingscoid', $cond); -// DFNVC +// DFNconf // // $meetfldscoid = aconnect_get_folder($aconnect, 'meetings'); $meetfldscoid = aconnect_get_meeting_folder($aconnect); @@ -317,7 +321,7 @@ $renderer = $PAGE->get_renderer('mod_adobeconnect'); $meetingdetail = new stdClass(); $meetingdetail->name = $meeting->name; -// DFNVC +// DFNconf // Meetingname ausgeben //echo '<div class="block block_adminblock"><div class="header"><div class="title">'; @@ -333,7 +337,7 @@ echo '</div>'; // Determine if the Meeting URL is to appear // -// DFNVC - Meeting-URL immer anzeigen +// DFNconf - Meeting-URL immer anzeigen // if (has_capability('mod/adobeconnect:meetingpresenter', $context) or has_capability('mod/adobeconnect:meetinghost', $context) or true ) { @@ -341,7 +345,7 @@ if (has_capability('mod/adobeconnect:meetingpresenter', $context) or // Include the port number only if it is a port other than 80 $port = ''; - // DFNVC - Port 443 nicht in der Meeting-URL anzeigen + // DFNconf - Port 443 nicht in der Meeting-URL anzeigen if (!empty($CFG->adobeconnect_port) and (80 != $CFG->adobeconnect_port) and (443 !=$CFG->adobeconnect_port)) { $port = ':' . $CFG->adobeconnect_port; } @@ -359,7 +363,7 @@ if (has_capability('mod/adobeconnect:meetingpresenter', $context) or $url = $protocol.$CFG->adobeconnect_meethost.$port.'/admin/meeting/sco/info?principal-id='. $usrprincipal.'&sco-id='.$scoid.'&session='.$adobesession; - // DFNVC + // DFNconf // $usrprincipal.'&sco-id='.$scoid.'&session='.$adobesession; @@ -393,7 +397,7 @@ $meetingdetail->endtime = $time; $meetingdetail->intro = $adobeconnect->intro; $meetingdetail->introformat = $adobeconnect->introformat; -// DFNVC +// DFNconf // if ($adobeconnect->intro) { echo $OUTPUT->box_start('generalbox', 'meetingsummary'); @@ -406,7 +410,7 @@ if ($adobeconnect->intro) { echo '<p>'; //echo $OUTPUT->box_start('generalbox', 'meetingsummary'); -// DFNVC +// DFNconf //echo $html = $OUTPUT->heading('Adobe Connect Meeting', 3, 'helptitle', 'uniqueid'); @@ -441,8 +445,8 @@ if ($showrecordings and !empty($recordings)) { echo $OUTPUT->box_end(); } -add_to_log($course->id, 'adobeconnect', 'view', - "view.php?id=$cm->id", "View {$adobeconnect->name} details", $cm->id); +//add_to_log($course->id, 'adobeconnect', 'view', "view.php?id=$cm->id", "View {$adobeconnect->name} details", $cm->id); +//add_to_log($course->id, 'adobeconnect', 'view', "view.php?id=$cm->id", "View {$adobeconnect->name} details", $cm->id); /// Finish the page echo $OUTPUT->footer(); -- GitLab