diff --git a/README.txt b/README.txt index 8fc835a..326fab2 100644 --- a/README.txt +++ b/README.txt @@ -1,40 +1,40 @@ -$Id: README.txt,v 1.7 2011/01/03 16:54:40 adelamarre Exp $ - -ABOUT THIS ACTIVITY MODULE -========================================= -Adobe Systems Inc. and Remote-Learner.net have partnered together to create the first publicly available -and officially sponsored, integration method between Moodle and Adobe Acrobat Connect Pro. This new -integration is designed to simplify the use of synchronous events within Moodle. It provides a -single-sign-on between the two systems with easy creation and management of Adobe Connect Pro -meetings. - -About Remote-Learner -Remote-Learner has been providing educational technologies services since 1982 to its business, -educational and governmental clients. Today, these services include support for best-of-breed -open source programs. Remote-Learner is an official Moodle partner, JasperSoft partner and -Alfresco partner. The company offers SaaS hosting services, IT support contracts, custom -programming, workforce development training, instructional design and strategic consulting -services for organizations planning online learning programs. - -Visit http://remote-learner.net/adobeconnectpro for information on Enterprise support. - - -INSTALL INSTRUCTIONS -========================================= -Please see the documentation on Moodle Docs http://docs.moodle.org/en/Remote_Learner_Adobe_Connect_Pro_Module. - -Create a directory called "adobeconnect" in your "mod" directory and copy all the files for this module into the "adobeconnect" -directory. Log in to your Moodle site as an administrator and click on the "notifications" link in the Adminsitration block and -ensure all tables were setup correctly. - -You will then be prompted to enter details about Adobe Connect Pro server. You may not see the 'Test Connection' button at first. In the -administrator block click on Modules -> Activities -> Adobe Connect and you should now see the 'Test Connection' button. -Be sure to test your connection. - -Once that is complete you can begin to create and administer meetings. - - -Maintainer Contact information -Company: Remote Learner -Author: Akinsaya Delamarre -Email: adelamarre@remote-learner.net \ No newline at end of file +$Id: README.txt,v 1.7 2011/01/03 16:54:40 adelamarre Exp $ + +ABOUT THIS ACTIVITY MODULE +========================================= +Adobe Systems Inc. and Remote-Learner.net have partnered together to create the first publicly available +and officially sponsored, integration method between Moodle and Adobe Acrobat Connect Pro. This new +integration is designed to simplify the use of synchronous events within Moodle. It provides a +single-sign-on between the two systems with easy creation and management of Adobe Connect Pro +meetings. + +About Remote-Learner +Remote-Learner has been providing educational technologies services since 1982 to its business, +educational and governmental clients. Today, these services include support for best-of-breed +open source programs. Remote-Learner is an official Moodle partner, JasperSoft partner and +Alfresco partner. The company offers SaaS hosting services, IT support contracts, custom +programming, workforce development training, instructional design and strategic consulting +services for organizations planning online learning programs. + +Visit https://moodle.org/plugins/view.php?plugin=mod_adobeconnect for information on Enterprise support. + + +INSTALL INSTRUCTIONS +========================================= +Please see the documentation on Moodle Docs http://docs.moodle.org/en/Remote_Learner_Adobe_Connect_Pro_Module. + +Create a directory called "adobeconnect" in your "mod" directory and copy all the files for this module into the "adobeconnect" +directory. Log in to your Moodle site as an administrator and click on the "notifications" link in the Adminsitration block and +ensure all tables were setup correctly. + +You will then be prompted to enter details about Adobe Connect Pro server. You may not see the 'Test Connection' button at first. In the +administrator block click on Modules -> Activities -> Adobe Connect and you should now see the 'Test Connection' button. +Be sure to test your connection. + +Once that is complete you can begin to create and administer meetings. + + +Maintainer Contact information +Company: Remote Learner +Author: Akinsaya Delamarre +Email: adelamarre@remote-learner.net diff --git a/backup/moodle2/backup_adobeconnect_activity_task.class.php b/backup/moodle2/backup_adobeconnect_activity_task.class.php index f1d2258..d742f58 100644 --- a/backup/moodle2/backup_adobeconnect_activity_task.class.php +++ b/backup/moodle2/backup_adobeconnect_activity_task.class.php @@ -1,66 +1,65 @@ -. - -/** - * @package mod - * @subpackage adobeconnect - * @author Akinsaya Delamarre (adelamarre@remote-learner.net) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -require_once($CFG->dirroot . '/mod/adobeconnect/backup/moodle2/backup_adobeconnect_stepslib.php'); // Because it exists (must) - - /** - * adobeconnect backup task that provides all the settings and steps to perform one - * complete backup of the activity - */ -class backup_adobeconnect_activity_task extends backup_activity_task { - /** - * Define (add) particular settings this activity can have - */ - protected function define_my_settings() { - // No particular settings for this activity - } - - /** - * Define (add) particular steps this activity can have - */ - protected function define_my_steps() { - // Choice only has one structure step - $this->add_step(new backup_adobeconnect_activity_structure_step('adobeconnect_structure', 'adobeconnect.xml')); - } - - /** - * Code the transformations to perform in the activity in - * order to get transportable (encoded) links - */ - static public function encode_content_links($content) { - global $CFG; - - $base = preg_quote($CFG->wwwroot,"/"); - - // Link to the list of adobeconnect instances - $search="/(".$base."\/mod\/adobeconnect\/index.php\?id\=)([0-9]+)/"; - $content= preg_replace($search, '$@ADOBECONNECTINDEX*$2@$', $content); - - // Link to adobeconnect view by moduleid - $search="/(".$base."\/mod\/adobeconnect\/view.php\?id\=)([0-9]+)/"; - $content= preg_replace($search, '$@ADOBECONNECTVIEWBYID*$2@$', $content); - - return $content; - } +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +require_once($CFG->dirroot . '/mod/adobeconnect/backup/moodle2/backup_adobeconnect_stepslib.php'); // Because it exists (must) + + /** + * adobeconnect backup task that provides all the settings and steps to perform one + * complete backup of the activity + */ +class backup_adobeconnect_activity_task extends backup_activity_task { + /** + * Define (add) particular settings this activity can have + */ + protected function define_my_settings() { + // No particular settings for this activity + } + + /** + * Define (add) particular steps this activity can have + */ + protected function define_my_steps() { + // Choice only has one structure step + $this->add_step(new backup_adobeconnect_activity_structure_step('adobeconnect_structure', 'adobeconnect.xml')); + } + + /** + * Code the transformations to perform in the activity in + * order to get transportable (encoded) links + */ + static public function encode_content_links($content) { + global $CFG; + + $base = preg_quote($CFG->wwwroot,"/"); + + // Link to the list of adobeconnect instances + $search="/(".$base."\/mod\/adobeconnect\/index.php\?id\=)([0-9]+)/"; + $content= preg_replace($search, '$@ADOBECONNECTINDEX*$2@$', $content); + + // Link to adobeconnect view by moduleid + $search="/(".$base."\/mod\/adobeconnect\/view.php\?id\=)([0-9]+)/"; + $content= preg_replace($search, '$@ADOBECONNECTVIEWBYID*$2@$', $content); + + return $content; + } } \ No newline at end of file diff --git a/backup/moodle2/backup_adobeconnect_settinglib.php b/backup/moodle2/backup_adobeconnect_settinglib.php index 43b8d4b..e0769cc 100644 --- a/backup/moodle2/backup_adobeconnect_settinglib.php +++ b/backup/moodle2/backup_adobeconnect_settinglib.php @@ -1,27 +1,26 @@ -. - -/** - * @package mod - * @subpackage adobeconnect - * @author Akinsaya Delamarre (adelamarre@remote-learner.net) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - - // This activity has not particular settings but the inherited from the generic - // backup_activity_task so here there isn't any class definition, like the ones +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + + // This activity has not particular settings but the inherited from the generic + // backup_activity_task so here there isn't any class definition, like the ones // existing in /backup/moodle2/backup_settingslib.php (activities section) \ No newline at end of file diff --git a/backup/moodle2/backup_adobeconnect_stepslib.php b/backup/moodle2/backup_adobeconnect_stepslib.php index ed1d595..b89006c 100644 --- a/backup/moodle2/backup_adobeconnect_stepslib.php +++ b/backup/moodle2/backup_adobeconnect_stepslib.php @@ -1,71 +1,70 @@ -. - -/** - * @package mod - * @subpackage adobeconnect - * @author Akinsaya Delamarre (adelamarre@remote-learner.net) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * Define all the backup steps that will be used by the backup_adobeconnect_activity_task - */ - -/** - * Define the complete adobeconnect structure for backup, with file and id annotations - */ -class backup_adobeconnect_activity_structure_step extends backup_activity_structure_step { - - protected function define_structure() { - - // To know if we are including userinfo - //$userinfo = $this->get_setting_value('userinfo'); - - // Define each element separated - $adobeconnect = new backup_nested_element('adobeconnect', array('id'), array( - 'name', 'intro', 'introformat', 'templatescoid', - 'meeturl', 'starttime', 'endtime', 'meetingpublic', - 'timecreated', 'timemodified')); - - $meetinggroups = new backup_nested_element('meeting_groups'); - - $meetinggroup = new backup_nested_element('meeting_group', array('id'), array( - 'meetingscoid', 'groupid')); - - // Build the tree - $adobeconnect->add_child($meetinggroups); - $meetinggroups->add_child($meetinggroup); - - // Define sources - $adobeconnect->set_source_table('adobeconnect', array('id' => backup::VAR_ACTIVITYID)); - - $meetinggroup->set_source_sql(' - SELECT * - FROM {adobeconnect_meeting_groups} - WHERE instanceid = ?', - array(backup::VAR_PARENTID)); - - $meetinggroup->annotate_ids('group', 'groupid'); - - // Define file annotations - $adobeconnect->annotate_files('mod_adobeconnect', 'intro', null); // This file area hasn't itemid - - // Return the root element (survey), wrapped into standard activity structure - return $this->prepare_activity_structure($adobeconnect); - } +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +/** + * Define all the backup steps that will be used by the backup_adobeconnect_activity_task + */ + +/** + * Define the complete adobeconnect structure for backup, with file and id annotations + */ +class backup_adobeconnect_activity_structure_step extends backup_activity_structure_step { + + protected function define_structure() { + + // To know if we are including userinfo + //$userinfo = $this->get_setting_value('userinfo'); + + // Define each element separated + $adobeconnect = new backup_nested_element('adobeconnect', array('id'), array( + 'name', 'intro', 'introformat', 'templatescoid', + 'meeturl', 'starttime', 'endtime', 'meetingpublic', + 'timecreated', 'timemodified')); + + $meetinggroups = new backup_nested_element('meeting_groups'); + + $meetinggroup = new backup_nested_element('meeting_group', array('id'), array( + 'meetingscoid', 'groupid')); + + // Build the tree + $adobeconnect->add_child($meetinggroups); + $meetinggroups->add_child($meetinggroup); + + // Define sources + $adobeconnect->set_source_table('adobeconnect', array('id' => backup::VAR_ACTIVITYID)); + + $meetinggroup->set_source_sql(' + SELECT * + FROM {adobeconnect_meeting_groups} + WHERE instanceid = ?', + array(backup::VAR_PARENTID)); + + $meetinggroup->annotate_ids('group', 'groupid'); + + // Define file annotations + $adobeconnect->annotate_files('mod_adobeconnect', 'intro', null); // This file area hasn't itemid + + // Return the root element (survey), wrapped into standard activity structure + return $this->prepare_activity_structure($adobeconnect); + } } \ No newline at end of file diff --git a/backup/moodle2/restore_adobeconnect_activity_task.class.php b/backup/moodle2/restore_adobeconnect_activity_task.class.php index cfd0f30..5e2bd38 100644 --- a/backup/moodle2/restore_adobeconnect_activity_task.class.php +++ b/backup/moodle2/restore_adobeconnect_activity_task.class.php @@ -1,114 +1,113 @@ -. - -/** - * @package mod - * @subpackage adobeconnect - * @author Akinsaya Delamarre (adelamarre@remote-learner.net) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -require_once($CFG->dirroot . '/mod/adobeconnect/backup/moodle2/restore_adobeconnect_stepslib.php'); // Because it exists (must) - -/** - * survey restore task that provides all the settings and steps to perform one - * complete restore of the activity - */ -class restore_adobeconnect_activity_task extends restore_activity_task { - - /** - * Define (add) particular settings this activity can have - */ - protected function define_my_settings() { - // No particular settings for this activity - } - - /** - * Define (add) particular steps this activity can have - */ - protected function define_my_steps() { - // adobeconnect only has one structure step - $this->add_step(new restore_adobeconnect_activity_structure_step('adobeconnect_structure', 'adobeconnect.xml')); - } - - /** - * Define the contents in the activity that must be - * processed by the link decoder - */ - static public function define_decode_contents() { - $contents = array(); - - $contents[] = new restore_decode_content('adobeconnect', array('intro'), 'adobeconnect'); - - return $contents; - } - - /** - * Define the decoding rules for links belonging - * to the activity to be executed by the link decoder - */ - static public function define_decode_rules() { - $rules = array(); - - $rules[] = new restore_decode_rule('ADOBECONNECTVIEWBYID', '/mod/adobeconnect/view.php?id=$1', 'course_module'); - $rules[] = new restore_decode_rule('ADOBECONNECTINDEX', '/mod/adobeconnect/index.php?id=$1', 'course'); - - return $rules; - - } - - /** - * Define the restore log rules that will be applied - * by the {@link restore_logs_processor} when restoring - * survey logs. It must return one array - * of {@link restore_log_rule} objects - */ - static public function define_restore_log_rules() { - $rules = array(); - - $rules[] = new restore_log_rule('adobeconnect', 'add', 'view.php?id={course_module}', '{adobeconnect}'); - $rules[] = new restore_log_rule('adobeconnect', 'update', 'view.php?id={course_module}', '{adobeconnect}'); - $rules[] = new restore_log_rule('adobeconnect', 'view', 'view.php?id={course_module}', '{adobeconnect}'); - //$rules[] = new restore_log_rule('adobeconnect', 'download', 'download.php?id={course_module}&type=[type]&group=[group]', '{adobeconnect}'); - //$rules[] = new restore_log_rule('adobeconnect', 'view report', 'report.php?id={course_module}', '{adobeconnect}'); - //$rules[] = new restore_log_rule('adobeconnect', 'submit', 'view.php?id={course_module}', '{adobeconnect}'); - //$rules[] = new restore_log_rule('adobeconnect', 'view graph', 'view.php?id={course_module}', '{adobeconnect}'); - //$rules[] = new restore_log_rule('adobeconnect', 'view form', 'view.php?id={course_module}', '{adobeconnect}'); - - return $rules; - } - - /** - * Define the restore log rules that will be applied - * by the {@link restore_logs_processor} when restoring - * course logs. It must return one array - * of {@link restore_log_rule} objects - * - * Note this rules are applied when restoring course logs - * by the restore final task, but are defined here at - * activity level. All them are rules not linked to any module instance (cmid = 0) - */ - static public function define_restore_log_rules_for_course() { - $rules = array(); - - $rules[] = new restore_log_rule('adobeconnect', 'view all', 'index.php?id={course}', null); - - return $rules; - } +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->dirroot . '/mod/adobeconnect/backup/moodle2/restore_adobeconnect_stepslib.php'); // Because it exists (must) + +/** + * survey restore task that provides all the settings and steps to perform one + * complete restore of the activity + */ +class restore_adobeconnect_activity_task extends restore_activity_task { + + /** + * Define (add) particular settings this activity can have + */ + protected function define_my_settings() { + // No particular settings for this activity + } + + /** + * Define (add) particular steps this activity can have + */ + protected function define_my_steps() { + // adobeconnect only has one structure step + $this->add_step(new restore_adobeconnect_activity_structure_step('adobeconnect_structure', 'adobeconnect.xml')); + } + + /** + * Define the contents in the activity that must be + * processed by the link decoder + */ + static public function define_decode_contents() { + $contents = array(); + + $contents[] = new restore_decode_content('adobeconnect', array('intro'), 'adobeconnect'); + + return $contents; + } + + /** + * Define the decoding rules for links belonging + * to the activity to be executed by the link decoder + */ + static public function define_decode_rules() { + $rules = array(); + + $rules[] = new restore_decode_rule('ADOBECONNECTVIEWBYID', '/mod/adobeconnect/view.php?id=$1', 'course_module'); + $rules[] = new restore_decode_rule('ADOBECONNECTINDEX', '/mod/adobeconnect/index.php?id=$1', 'course'); + + return $rules; + + } + + /** + * Define the restore log rules that will be applied + * by the {@link restore_logs_processor} when restoring + * survey logs. It must return one array + * of {@link restore_log_rule} objects + */ + static public function define_restore_log_rules() { + $rules = array(); + + $rules[] = new restore_log_rule('adobeconnect', 'add', 'view.php?id={course_module}', '{adobeconnect}'); + $rules[] = new restore_log_rule('adobeconnect', 'update', 'view.php?id={course_module}', '{adobeconnect}'); + $rules[] = new restore_log_rule('adobeconnect', 'view', 'view.php?id={course_module}', '{adobeconnect}'); + //$rules[] = new restore_log_rule('adobeconnect', 'download', 'download.php?id={course_module}&type=[type]&group=[group]', '{adobeconnect}'); + //$rules[] = new restore_log_rule('adobeconnect', 'view report', 'report.php?id={course_module}', '{adobeconnect}'); + //$rules[] = new restore_log_rule('adobeconnect', 'submit', 'view.php?id={course_module}', '{adobeconnect}'); + //$rules[] = new restore_log_rule('adobeconnect', 'view graph', 'view.php?id={course_module}', '{adobeconnect}'); + //$rules[] = new restore_log_rule('adobeconnect', 'view form', 'view.php?id={course_module}', '{adobeconnect}'); + + return $rules; + } + + /** + * Define the restore log rules that will be applied + * by the {@link restore_logs_processor} when restoring + * course logs. It must return one array + * of {@link restore_log_rule} objects + * + * Note this rules are applied when restoring course logs + * by the restore final task, but are defined here at + * activity level. All them are rules not linked to any module instance (cmid = 0) + */ + static public function define_restore_log_rules_for_course() { + $rules = array(); + + $rules[] = new restore_log_rule('adobeconnect', 'view all', 'index.php?id={course}', null); + + return $rules; + } } \ No newline at end of file diff --git a/backup/moodle2/restore_adobeconnect_stepslib.php b/backup/moodle2/restore_adobeconnect_stepslib.php index 5e44c6d..3a2df24 100644 --- a/backup/moodle2/restore_adobeconnect_stepslib.php +++ b/backup/moodle2/restore_adobeconnect_stepslib.php @@ -1,83 +1,82 @@ -. - -/** - * @package mod - * @subpackage adobeconnect - * @author Akinsaya Delamarre (adelamarre@remote-learner.net) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * Define all the restore steps that will be used by the restore_survey_activity_task - */ - -/** - * Structure step to restore one survey activity - */ -class restore_adobeconnect_activity_structure_step extends restore_activity_structure_step { - - protected function define_structure() { - - $paths = array(); - $userinfo = false; -// $userinfo = $this->get_setting_value('userinfo'); - - $paths[] = new restore_path_element('adobeconnect', '/activity/adobeconnect'); - $paths[] = new restore_path_element('adobeconnect_meeting_group', '/activity/adobeconnect/meeting_groups/meeting_group'); -// if ($userinfo) { -// $paths[] = new restore_path_element('survey_answer', '/activity/survey/answers/answer'); -// $paths[] = new restore_path_element('survey_analys', '/activity/survey/analysis/analys'); -// } - - // Return the paths wrapped into standard activity structure - return $this->prepare_activity_structure($paths); - } - - protected function process_adobeconnect($data) { - global $DB; - - $data = (object)$data; - $oldid = $data->id; - $data->course = $this->get_courseid(); - $data->timemodified = $this->apply_date_offset($data->timemodified); - $data->timecreated = $this->apply_date_offset($data->timecreated); - - // insert the adobeconnect record - $newitemid = $DB->insert_record('adobeconnect', $data); - // immediately after inserting "activity" record, call this - $this->apply_activity_instance($newitemid); - } - - protected function process_adobeconnect_meeting_group($data) { - global $DB; - - $data = (object)$data; - $data->instanceid = $this->get_new_parentid('adobeconnect'); - $data->groupid = $this->get_mappingid('group', $data->groupid); - - $newitemid = $DB->insert_record('adobeconnect_meeting_groups', $data); - - // No need to save this mapping as far as nothing depend on it - // (child paths, file areas nor links decoder) - } - - protected function after_execute() { - // Add survey related files, no need to match by itemname (just internally handled context) - $this->add_related_files('mod_adobeconnect', 'intro', null); - } +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +/** + * Define all the restore steps that will be used by the restore_survey_activity_task + */ + +/** + * Structure step to restore one survey activity + */ +class restore_adobeconnect_activity_structure_step extends restore_activity_structure_step { + + protected function define_structure() { + + $paths = array(); + $userinfo = false; +// $userinfo = $this->get_setting_value('userinfo'); + + $paths[] = new restore_path_element('adobeconnect', '/activity/adobeconnect'); + $paths[] = new restore_path_element('adobeconnect_meeting_group', '/activity/adobeconnect/meeting_groups/meeting_group'); +// if ($userinfo) { +// $paths[] = new restore_path_element('survey_answer', '/activity/survey/answers/answer'); +// $paths[] = new restore_path_element('survey_analys', '/activity/survey/analysis/analys'); +// } + + // Return the paths wrapped into standard activity structure + return $this->prepare_activity_structure($paths); + } + + protected function process_adobeconnect($data) { + global $DB; + + $data = (object)$data; + $oldid = $data->id; + $data->course = $this->get_courseid(); + $data->timemodified = $this->apply_date_offset($data->timemodified); + $data->timecreated = $this->apply_date_offset($data->timecreated); + + // insert the adobeconnect record + $newitemid = $DB->insert_record('adobeconnect', $data); + // immediately after inserting "activity" record, call this + $this->apply_activity_instance($newitemid); + } + + protected function process_adobeconnect_meeting_group($data) { + global $DB; + + $data = (object)$data; + $data->instanceid = $this->get_new_parentid('adobeconnect'); + $data->groupid = $this->get_mappingid('group', $data->groupid); + + $newitemid = $DB->insert_record('adobeconnect_meeting_groups', $data); + + // No need to save this mapping as far as nothing depend on it + // (child paths, file areas nor links decoder) + } + + protected function after_execute() { + // Add survey related files, no need to match by itemname (just internally handled context) + $this->add_related_files('mod_adobeconnect', 'intro', null); + } } \ No newline at end of file diff --git a/classes/event/adobeconnect_assign_role.php b/classes/event/adobeconnect_assign_role.php new file mode 100644 index 0000000..35de23f --- /dev/null +++ b/classes/event/adobeconnect_assign_role.php @@ -0,0 +1,58 @@ +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +namespace mod_adobeconnect\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The adobeconnect_assign_role event class. + * + * @property-read array $other { + * + * User assigns a role. + * } + */ +class adobeconnect_assign_role extends \core\event\base { + /** + * This function initializes class properties. + */ + protected function init() { + $this->data['crud'] = 'r'; + $this->data['edulevel'] = self::LEVEL_PARTICIPATING; + } + + /** + * This function is overridden from the parent class. + */ + public static function get_name() { + return get_string('event_assign_role', 'mod_adobeconnect'); + } + + /** + * This function is overridden from the parent class. + */ + public function get_description() { + return "User assigned the {$this->other['rolename']} role to a user."; + } +} \ No newline at end of file diff --git a/classes/event/adobeconnect_join_meeting.php b/classes/event/adobeconnect_join_meeting.php new file mode 100644 index 0000000..8701915 --- /dev/null +++ b/classes/event/adobeconnect_join_meeting.php @@ -0,0 +1,58 @@ +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +namespace mod_adobeconnect\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The adobeconnect_join_meeting event class. + * + * @property-read array $other { + * + * User joins meeting + * } + */ +class adobeconnect_join_meeting extends \core\event\base { + /** + * This function initializes class properties. + */ + protected function init() { + $this->data['crud'] = 'r'; + $this->data['edulevel'] = self::LEVEL_PARTICIPATING; + } + + /** + * This function is overridden from the parent class. + */ + public static function get_name() { + return get_string('event_join_meeting', 'mod_adobeconnect'); + } + + /** + * This function is overridden from the parent class. + */ + public function get_description() { + return "User joined the meeting"; + } +} \ No newline at end of file diff --git a/classes/event/adobeconnect_unassign_role.php b/classes/event/adobeconnect_unassign_role.php new file mode 100644 index 0000000..637df03 --- /dev/null +++ b/classes/event/adobeconnect_unassign_role.php @@ -0,0 +1,58 @@ +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +namespace mod_adobeconnect\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The adobeconnect_unassign_role event class. + * + * @property-read array $other { + * + * User unassigns a role. + * } + */ +class adobeconnect_unassign_role extends \core\event\base { + /** + * This function initializes class properties. + */ + protected function init() { + $this->data['crud'] = 'r'; + $this->data['edulevel'] = self::LEVEL_PARTICIPATING; + } + + /** + * This function is overridden from the parent class. + */ + public static function get_name() { + return get_string('event_unassign_role', 'mod_adobeconnect'); + } + + /** + * This function is overridden from the parent class. + */ + public function get_description() { + return "User unassigned the {$this->other['rolename']} meeting role."; + } +} \ No newline at end of file diff --git a/classes/event/adobeconnect_view.php b/classes/event/adobeconnect_view.php new file mode 100644 index 0000000..9ef540f --- /dev/null +++ b/classes/event/adobeconnect_view.php @@ -0,0 +1,58 @@ +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +namespace mod_adobeconnect\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The adobeconnect_view event class. + * + * @property-read array $other { + * + * User views the activity. + * } + */ +class adobeconnect_view extends \core\event\base { + /** + * This function initializes class properties. + */ + protected function init() { + $this->data['crud'] = 'r'; + $this->data['edulevel'] = self::LEVEL_PARTICIPATING; + } + + /** + * This function is overridden from the parent class. + */ + public static function get_name() { + return get_string('event_view', 'mod_adobeconnect'); + } + + /** + * This function is overridden from the parent class. + */ + public function get_description() { + return "Activity was viewed."; + } +} \ No newline at end of file diff --git a/classes/event/adobeconnect_view_all.php b/classes/event/adobeconnect_view_all.php new file mode 100644 index 0000000..8ae942c --- /dev/null +++ b/classes/event/adobeconnect_view_all.php @@ -0,0 +1,58 @@ +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +namespace mod_adobeconnect\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The adobeconnect_view_all event class. + * + * @property-read array $other { + * + * User views all activity instances. + * } + */ +class adobeconnect_view_all extends \core\event\base { + /** + * This function initializes class properties. + */ + protected function init() { + $this->data['crud'] = 'r'; + $this->data['edulevel'] = self::LEVEL_PARTICIPATING; + } + + /** + * This function is overridden from the parent class. + */ + public static function get_name() { + return get_string('event_view_all', 'mod_adobeconnect'); + } + + /** + * This function is overridden from the parent class. + */ + public function get_description() { + return "All activity instances were viewed."; + } +} \ No newline at end of file diff --git a/classes/event/adobeconnect_view_recording.php b/classes/event/adobeconnect_view_recording.php new file mode 100644 index 0000000..a932b4a --- /dev/null +++ b/classes/event/adobeconnect_view_recording.php @@ -0,0 +1,58 @@ +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +namespace mod_adobeconnect\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The adobeconnect_view_recording event class. + * + * @property-read array $other { + * + * User views recording + * } + */ +class adobeconnect_view_recording extends \core\event\base { + /** + * This function initializes class properties. + */ + protected function init() { + $this->data['crud'] = 'r'; + $this->data['edulevel'] = self::LEVEL_PARTICIPATING; + } + + /** + * This function is overridden from the parent class. + */ + public static function get_name() { + return get_string('event_view_recording', 'mod_adobeconnect'); + } + + /** + * This function is overridden from the parent class. + */ + public function get_description() { + return "User viewed recording."; + } +} \ No newline at end of file diff --git a/connect_class.php b/connect_class.php index a47d0c7..b3c3284 100644 --- a/connect_class.php +++ b/connect_class.php @@ -1,391 +1,399 @@ -_serverurl = $serverurl; - $this->_serverport = $serverport; - $this->_username = $username; - $this->_password = $password; - $this->_cookie = $cookie; - $this->_https = $https; - } - - /** - * Accessor methods - */ - public function set_serverport($serverport = '') { - $this->_serverport = $serverport; - } - - public function set_serverurl($serverurl = '') { - $this->_serverurl = $serverurl; - } - - public function set_username($username = '') { - $this->_username = $username; - } - - public function set_password($password = '') { - $this->_password = $password; - } - - public function set_cookie($cookie = '') { - $this->_cookie = $cookie; - } - - public function set_xmlrequest($xml = '') { - $this->_xmlrequest = $xml; - } - - public function set_connection($connection = 0) { - $this->_connection = $connection; - } - - public function set_https($https = false) { - $this->_https = $https; - } - - public function get_serverurl() { - return $this->_serverurl; - } - - public function get_username() { - return $this->_username; - } - - public function get_password() { - return $this->_password; - } - - public function get_cookie() { - return $this->_cookie; - } - - public function get_connection() { - return $this->_connection; - } - - public function get_serverport() { - return $this->_serverport; - } - - private function get_deafult_header() { - return array('Content-Type: text/xml'); - } - - public function get_https() { - return $this->_https; - } - - /** - * Adds or replaces http:// with https:// for secured connections - * @return string - server URL with the HTTPS protocol - */ - private function make_https() { - - $serverurl = $this->_serverurl; - $httpsexists = strpos($this->_serverurl, 'https://'); - $httpexists = strpos($this->_serverurl, 'http://'); - - if (false === $httpsexists and false !== $httpexists) { - $serverurl = str_replace('http://', 'https://', $this->_serverurl); - } elseif (false === $httpsexists) { - $serverurl = 'https://' . $this->_serverurl; - } - - return $serverurl; - } - - - /** - * Posts XML to the Adobe Connect server and returns the results - * @param int $return_header 1 to include the response header, 0 to not - * @param array $add_header an array of headers to add to the request - */ - public function send_request($return_header = 0, $add_header = array(), $stop = false) { - global $CFG; - - $ch = curl_init(); - - $serverurl = $this->_serverurl; - - if ($this->_https) { - - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); - - $serverurl = $this->make_https(); - } - - - if ($stop) { -// echo $this->_serverurl . '?session='. $this->_cookie; die(); -// https://example.com/api/xml?action=principal=list - curl_setopt($ch, CURLOPT_URL, $serverurl/* . '?action=login&external-auth=use'*/); - - } else { - - $querystring = (!empty($this->_cookie)) ? '?session='. $this->_cookie : ''; - curl_setopt($ch, CURLOPT_URL, $serverurl . $querystring); - - } - - - // Connect through a proxy if Moodle config says we should - if(isset($CFG->proxyhost)) { - - curl_setopt($ch, CURLOPT_PROXY, $CFG->proxyhost); - - if(isset($CFG->proxyport)) { - - curl_setopt($ch, CURLOPT_PROXYPORT, $CFG->proxyport); - } - } - - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, $this->_xmlrequest); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); - - curl_setopt($ch, CURLOPT_PORT, $this->_serverport); - - $header = $this->get_deafult_header(); - $header = array_merge($header, $add_header); - - curl_setopt($ch, CURLOPT_HTTPHEADER, $header); - - // Include header from response - curl_setopt($ch, CURLOPT_HEADER, $return_header); - - $result = curl_exec($ch); - - curl_close($ch); - - return $result; - } - - /** - * Sends the HTTP header login request and returns the response xml - * @param string username username to use for header x-user-id - */ - public function request_http_header_login($return_header = 0, $username = '', $stop = false) { - global $CFG; - - $hearder = array(); - $this->create_http_head_login_xml(); - - // The first parameter is 1 because we want to include the response header - // to extract the session cookie - if (!empty($username)) { - $hearder = array("$CFG->adobeconnect_admin_httpauth: " . $username); - } - - $this->_xmlresponse = $this->send_request($return_header, $hearder, $stop); - - $this->set_session_cookie($this->_xmlresponse); - - return $this->_xmlresponse; - } - - - public function create_request($params = array(), $sentrequest = true) { - if (empty($params)) { - return false; - } - @date_default_timezone_set("GMT"); - - $writer = new XMLWriter(); - $writer->openMemory(); - $writer->startDocument('1.0', 'UTF-8'); - - $writer->startElement('params'); - - foreach($params as $key => $data) { - $writer->startElement('param'); - $writer->writeAttribute('name', $key); - $writer->text($data); - $writer->endElement(); - } - - $writer->endElement(); - - $writer->endDocument(); - - $this->_xmlrequest = $writer->outputMemory(); - - if ($sentrequest) { - $this->_xmlresponse = $this->send_request(); - } - - } - - /** - * Call to common-info - * @param nothing - * @return nothing - */ - public function set_session_cookie($data) { - $sessionval = false; - $sessionstart = strpos($data, 'BREEZESESSION='); - - if (false !== $sessionstart) { - $sessionend = strpos($data, ';'); -// $sessionend = strpos($data, 'Expires:'); - - $sessionlength = strlen('BREEZESESSION='); - $sessionvallength = $sessionend - ($sessionstart + $sessionlength); - $sessionval = substr($data, $sessionstart+$sessionlength, $sessionvallength); - } - - $this->_cookie = $sessionval; - - return $sessionval; - } - - /** - * Parses through xml and looks for the 'status' parameter - * and return true if the 'code' attribute equals 'ok' otherwise - * false is returned - * @param string xml the xml to parse - */ - public function read_status_xml() { - $reader = new XMLReader(); - $reader->XML($this->_xmlresponse, 'UTF-8'); - $return = false; - - while ($reader->read()) { - if (0 == strcmp($reader->name, 'status')) { - if (1 == $reader->nodeType) { - if (0 == strcmp('ok', $reader->getAttribute('code'))) { - $return = true; - } - } - } - } - - $reader->close(); - - return $return; - - } - - /** - * Parses through xml and looks for the 'cookie' parameter - * @param string $xml the xml to parse through - * @return string $sessoin returns the session id - */ - public function read_cookie_xml($xml = '') { - global $CFG, $USER, $COURSE; - - if (empty($xml)) { - if (is_siteadmin($USER->id)) { - notice(get_string('adminemptyxml', 'adobeconnect'), - $CFG->wwwroot . '/admin/settings.php?section=modsettingadobeconnect'); - } else { - notice(get_string('emptyxml', 'adobeconnect'), - '', $COURSE); - } - } - - $session = false; -// $accountid = false; - $reader = new XMLReader(); - $reader->XML($xml, 'UTF-8'); - - while ($reader->read()) { - if (0 == strcmp($reader->name, 'cookie')) { - if (1 == $reader->nodeType) { - $session = $reader->readString(); - } - } - } - - $reader->close(); - - $this->_cookie = $session; - - return $session; - } - - public function response_to_object() { - $xml = new SimpleXMLElement($this->_xmlresponse); - - return $xml; - } - - public function call_success() { - global $CFG, $USER, $COURSE; - - if (empty($this->_xmlresponse)) { - if (is_siteadmin($USER->id)) { - notice(get_string('adminemptyxml', 'adobeconnect'), - $CFG->wwwroot . '/admin/settings.php?section=modsettingadobeconnect'); - } else { - notice(get_string('emptyxml', 'adobeconnect'), - '', $COURSE); - } - } - - $xml = new SimpleXMLElement($this->_xmlresponse); - - if (0 == strcmp('ok', $xml->status[0]['code'])) { - return true; - } else { - return false; - } - } - - private function create_http_head_login_xml() { - @date_default_timezone_set("GMT"); - - $writer = new XMLWriter(); - $writer->openMemory(); - $writer->startDocument('1.0', 'UTF-8'); - - $writer->startElement('params'); - - $writer->startElement('param'); - $writer->writeAttribute('name', 'action'); - $writer->text('login'); - $writer->endElement(); - - $writer->startElement('param'); - $writer->writeAttribute('name', 'external-auth'); - $writer->text('use'); - $writer->endElement(); - - $writer->endElement(); - - $writer->endDocument(); - - $this->_xmlrequest = $writer->outputMemory(); - - } -} +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +class connect_class { + var $_serverurl; + var $_serverport; + var $_username; + var $_password; + var $_cookie; + var $_xmlrequest; + var $_xmlresponse; + var $_apicall; + var $_connection; + var $_https; + + public function __construct($serverurl = '', $serverport = 80, + $username = '', $password = '', + $cookie = '', $https = false) { + + $this->_serverurl = $serverurl; + $this->_serverport = $serverport; + $this->_username = $username; + $this->_password = $password; + $this->_cookie = $cookie; + $this->_https = $https; + } + + /** + * Accessor methods + */ + public function set_serverport($serverport = '') { + $this->_serverport = $serverport; + } + + public function set_serverurl($serverurl = '') { + $this->_serverurl = $serverurl; + } + + public function set_username($username = '') { + $this->_username = $username; + } + + public function set_password($password = '') { + $this->_password = $password; + } + + public function set_cookie($cookie = '') { + $this->_cookie = $cookie; + } + + public function set_xmlrequest($xml = '') { + $this->_xmlrequest = $xml; + } + + public function set_connection($connection = 0) { + $this->_connection = $connection; + } + + public function set_https($https = false) { + $this->_https = $https; + } + + public function get_serverurl() { + return $this->_serverurl; + } + + public function get_username() { + return $this->_username; + } + + public function get_password() { + return $this->_password; + } + + public function get_cookie() { + return $this->_cookie; + } + + public function get_connection() { + return $this->_connection; + } + + public function get_serverport() { + return $this->_serverport; + } + + private function get_deafult_header() { + return array('Content-Type: text/xml'); + } + + public function get_https() { + return $this->_https; + } + + /** + * Adds or replaces http:// with https:// for secured connections + * @return string - server URL with the HTTPS protocol + */ + private function make_https() { + + $serverurl = $this->_serverurl; + $httpsexists = strpos($this->_serverurl, 'https://'); + $httpexists = strpos($this->_serverurl, 'http://'); + + if (false === $httpsexists and false !== $httpexists) { + $serverurl = str_replace('http://', 'https://', $this->_serverurl); + } elseif (false === $httpsexists) { + $serverurl = 'https://' . $this->_serverurl; + } + + return $serverurl; + } + + + /** + * Posts XML to the Adobe Connect server and returns the results + * @param int $return_header 1 to include the response header, 0 to not + * @param array $add_header an array of headers to add to the request + */ + public function send_request($return_header = 0, $add_header = array(), $stop = false) { + global $CFG; + + $ch = curl_init(); + + $serverurl = $this->_serverurl; + + if ($this->_https) { + + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); + + $serverurl = $this->make_https(); + } + + + if ($stop) { +// echo $this->_serverurl . '?session='. $this->_cookie; die(); +// https://example.com/api/xml?action=principal=list + curl_setopt($ch, CURLOPT_URL, $serverurl/* . '?action=login&external-auth=use'*/); + + } else { + + $querystring = (!empty($this->_cookie)) ? '?session='. $this->_cookie : ''; + curl_setopt($ch, CURLOPT_URL, $serverurl . $querystring); + + } + + + // Connect through a proxy if Moodle config says we should + if(isset($CFG->proxyhost)) { + + curl_setopt($ch, CURLOPT_PROXY, $CFG->proxyhost); + + if(isset($CFG->proxyport)) { + + curl_setopt($ch, CURLOPT_PROXYPORT, $CFG->proxyport); + } + } + + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $this->_xmlrequest); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); + + curl_setopt($ch, CURLOPT_PORT, $this->_serverport); + + $header = $this->get_deafult_header(); + $header = array_merge($header, $add_header); + + curl_setopt($ch, CURLOPT_HTTPHEADER, $header); + + // Include header from response + curl_setopt($ch, CURLOPT_HEADER, $return_header); + + $result = curl_exec($ch); + + curl_close($ch); + + return $result; + } + + /** + * Sends the HTTP header login request and returns the response xml + * @param string username username to use for header x-user-id + */ + public function request_http_header_login($return_header = 0, $username = '', $stop = false) { + global $CFG; + + $hearder = array(); + $this->create_http_head_login_xml(); + + // The first parameter is 1 because we want to include the response header + // to extract the session cookie + if (!empty($username)) { + $hearder = array("$CFG->adobeconnect_admin_httpauth: " . $username); + } + + $this->_xmlresponse = $this->send_request($return_header, $hearder, $stop); + + $this->set_session_cookie($this->_xmlresponse); + + return $this->_xmlresponse; + } + + + public function create_request($params = array(), $sentrequest = true) { + if (empty($params)) { + return false; + } + @date_default_timezone_set("GMT"); + + $writer = new XMLWriter(); + $writer->openMemory(); + $writer->startDocument('1.0', 'UTF-8'); + + $writer->startElement('params'); + + foreach($params as $key => $data) { + $writer->startElement('param'); + $writer->writeAttribute('name', $key); + $writer->text($data); + $writer->endElement(); + } + + $writer->endElement(); + + $writer->endDocument(); + + $this->_xmlrequest = $writer->outputMemory(); + + if ($sentrequest) { + $this->_xmlresponse = $this->send_request(); + } + + } + + /** + * Call to common-info + * @param nothing + * @return nothing + */ + public function set_session_cookie($data) { + $sessionval = false; + $sessionstart = strpos($data, 'BREEZESESSION='); + + if (false !== $sessionstart) { + $sessionend = strpos($data, ';'); +// $sessionend = strpos($data, 'Expires:'); + + $sessionlength = strlen('BREEZESESSION='); + $sessionvallength = $sessionend - ($sessionstart + $sessionlength); + $sessionval = substr($data, $sessionstart+$sessionlength, $sessionvallength); + } + + $this->_cookie = $sessionval; + + return $sessionval; + } + + /** + * Parses through xml and looks for the 'status' parameter + * and return true if the 'code' attribute equals 'ok' otherwise + * false is returned + * @param string xml the xml to parse + */ + public function read_status_xml() { + $reader = new XMLReader(); + $reader->XML($this->_xmlresponse, 'UTF-8'); + $return = false; + + while ($reader->read()) { + if (0 == strcmp($reader->name, 'status')) { + if (1 == $reader->nodeType) { + if (0 == strcmp('ok', $reader->getAttribute('code'))) { + $return = true; + } + } + } + } + + $reader->close(); + + return $return; + + } + + /** + * Parses through xml and looks for the 'cookie' parameter + * @param string $xml the xml to parse through + * @return string $sessoin returns the session id + */ + public function read_cookie_xml($xml = '') { + global $CFG, $USER, $COURSE; + + if (empty($xml)) { + if (is_siteadmin($USER->id)) { + notice(get_string('adminemptyxml', 'adobeconnect'), + $CFG->wwwroot . '/admin/settings.php?section=modsettingadobeconnect'); + } else { + notice(get_string('emptyxml', 'adobeconnect'), + '', $COURSE); + } + } + + $session = false; +// $accountid = false; + $reader = new XMLReader(); + $reader->XML($xml, 'UTF-8'); + + while ($reader->read()) { + if (0 == strcmp($reader->name, 'cookie')) { + if (1 == $reader->nodeType) { + $session = $reader->readString(); + } + } + } + + $reader->close(); + + $this->_cookie = $session; + + return $session; + } + + public function response_to_object() { + $xml = new SimpleXMLElement($this->_xmlresponse); + + return $xml; + } + + public function call_success() { + global $CFG, $USER, $COURSE; + + if (empty($this->_xmlresponse)) { + if (is_siteadmin($USER->id)) { + notice(get_string('adminemptyxml', 'adobeconnect'), + $CFG->wwwroot . '/admin/settings.php?section=modsettingadobeconnect'); + } else { + notice(get_string('emptyxml', 'adobeconnect'), + '', $COURSE); + } + } + + $xml = new SimpleXMLElement($this->_xmlresponse); + + if (0 == strcmp('ok', $xml->status[0]['code'])) { + return true; + } else { + return false; + } + } + + private function create_http_head_login_xml() { + @date_default_timezone_set("GMT"); + + $writer = new XMLWriter(); + $writer->openMemory(); + $writer->startDocument('1.0', 'UTF-8'); + + $writer->startElement('params'); + + $writer->startElement('param'); + $writer->writeAttribute('name', 'action'); + $writer->text('login'); + $writer->endElement(); + + $writer->startElement('param'); + $writer->writeAttribute('name', 'external-auth'); + $writer->text('use'); + $writer->endElement(); + + $writer->endElement(); + + $writer->endDocument(); + + $this->_xmlrequest = $writer->outputMemory(); + + } +} diff --git a/connect_class_dom.php b/connect_class_dom.php index adcdd9a..8eecc40 100644 --- a/connect_class_dom.php +++ b/connect_class_dom.php @@ -1,10 +1,24 @@ . /** - * @package mod - * @subpackage adobeconnect - * @author Akinsaya Delamarre (adelamarre@remote-learner.net) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net */ @@ -33,7 +47,7 @@ public function create_request($params = array(), $sentrequest = true) { foreach($params as $key => $data) { - $datahtmlent = htmlentities($data); + $datahtmlent = htmlentities($data, ENT_COMPAT, 'UTF-8'); $child = $dom->createElement('param', $datahtmlent); $root->appendChild($child); @@ -100,6 +114,16 @@ public function call_success() { $domnodelist = $dom->getElementsByTagName('status'); + if (!is_object($domnodelist->item(0))) { + if (is_siteadmin($USER->id)) { + notice(get_string('adminemptyxml', 'adobeconnect'), + $CFG->wwwroot . '/admin/settings.php?section=modsettingadobeconnect'); + } else { + notice(get_string('emptyxml', 'adobeconnect'), + '', $COURSE); + } + } + if ($domnodelist->item(0)->hasAttributes()) { $domnode = $domnodelist->item(0)->attributes->getNamedItem('code'); @@ -150,4 +174,4 @@ private function create_http_head_login_xml() { $this->create_request($params, false); } -} \ No newline at end of file +} diff --git a/conntest.php b/conntest.php index 13eb72d..69266da 100644 --- a/conntest.php +++ b/conntest.php @@ -1,99 +1,111 @@ -set_url($url); - - $admins = explode(',', $CFG->siteadmins); - - if (false === array_search($USER->id, $admins)) { - print_error('error1', 'adobeconnect', $CFG->wwwroot); - } - - $ac = new stdClass(); - - $param = array('name' => 'adobeconnect_admin_login'); - $ac->login = $DB->get_field('config', 'value', $param); - - $param = array('name' => 'adobeconnect_host'); - $ac->host = $DB->get_field('config', 'value', $param); - - $param = array('name' => 'adobeconnect_port'); - $ac->port = $DB->get_field('config', 'value', $param); - - $param = array('name' => 'adobeconnect_admin_password'); - $ac->pass = $DB->get_field('config', 'value', $param); - - $param = array('name' => 'adobeconnect_admin_httpauth'); - $ac->httpauth = $DB->get_field('config', 'value', $param); - - $param = array('name' => 'adobeconnect_email_login'); - $ac->emaillogin = $DB->get_field('config', 'value', $param); - - $param = array('name' => 'adobeconnect_https'); - $ac->https = $DB->get_field('config', 'value', $param); - - foreach ($ac as $propertyname => $propertyvalue) { - - // Check if the property is equal to email login or https check boxes - // These are the only values allowed to be empty - $isnotemaillogin = strcmp($propertyname, 'emaillogin'); - $isnothttps = strcmp($propertyname, 'https'); - - $checkifempty = $isnotemaillogin && $isnothttps; - - // If this property is empty - if ($checkifempty and empty($propertyvalue)) { - print_error('error2', 'adobeconnect', '', $propertyname); - die(); - } - - } - - $strtitle = get_string('connectiontesttitle', 'adobeconnect'); - - $systemcontext = get_context_instance(CONTEXT_SYSTEM); - $PAGE->set_context($systemcontext); - $PAGE->set_title($strtitle); - //$PAGE->set_heading($strtitle); - - echo $OUTPUT->header(); - echo $OUTPUT->box_start('center'); - - $param = new stdClass(); - $param->url = 'http://docs.moodle.org/en/Remote_learner_adobe_connect_pro'; - print_string('conntestintro', 'adobeconnect', $param); - - if (!empty($ac->https)) { - $https = true; - } else { - $https = false; - } - - adobe_connection_test($ac->host, $ac->port, $ac->login, - $ac->pass, $ac->httpauth, - $ac->emaillogin, $ac->https); - - echo '
A series of tests have been run in order to determine whether the Adobe Connect Pro server has been properly setup for this integration to work'. -' and to also determine whether the user credentials provided in the activity global settings has the correct permissions to perform the neccessary tasks required by the'. -' activity module. If any of the tests below have failed, this activity module will not function properly.
For further assistance and documentation in how to set up your'. -' Adobe Connect Pro server please consult the MoodleDocs help page for this activity module Help page
'; -$string['greaterstarttime'] = 'The start time cannot be greater than the end time'; -$string['invalidadobemeeturl'] = 'Invalid entry for this field. Click the help bubble for valid entries'; - -$string['adobeconnect:meetingpresenter'] = 'Meeting Presenter'; -$string['adobeconnect:meetingparticipant'] = 'Meeting Particpant'; -$string['adobeconnect:meetinghost'] = 'Meeting Host'; -$string['public'] = 'Public'; -$string['private'] = 'Private'; - -// Error codes -$string['emptyxml'] = 'Unable to connect to the Adobe Connect Pro server at this time. Please inform your Moodle administrator.'; -$string['adminemptyxml'] = 'Unable to connect to the Adobe Connect Pro server at this time. Click continue to proceed to the activity settings page and test the connection'; -$string['notsetupproperty'] = 'The activity module is not properly setup. Please contact your Moodle administrator'; -$string['adminnotsetupproperty'] = 'The activity module is not properly setup. Click continue to proceed to the activity settings page and test the connection'; -$string['notparticipant'] = 'You are not a participant for this meeting'; -$string['unableretrdetails'] = 'Unable to retrieve meeting details'; -$string['usernotenrolled'] = 'Only users enrolled and have a role in this course can join this meeting'; -$string['nopresenterrole'] = 'error: error finding adobeconnectpresenter role'; -$string['nomeeting'] = 'No meeting exists on the server'; -$string['noinstances'] = 'There are no instances of adobeconnect'; -$string['error1'] = 'You must be a site administrator to access this page'; -$string['error2'] = 'The property \'{$a}\' is empty, please input a value and save the settings'; -$string['errormeeting'] = 'Error retrieving recording'; -$string['settingblurb'] = 'Adobe Systems Inc. and Remote-Learner.net have partnered together to create the first publicly available - and officially sponsored, integration method between Moodle and Adobe Acrobat Connect Pro. This new - integration is designed to simplify the use of synchronous events within Moodle. It provides a - single-sign-on between the two systems with easy creation and management of Adobe Connect Pro - meetings.
Visit {$a->url} for information on Enterprise support
'; -$string['meeturl_help'] = 'You can customize the URL that is used to connect to the Adobe connect meeting. The Adobe Server domain will always remain the same. - However the last part of the URL can be customized. -
-For example if the Adobe Connect server domain was located at http://adobe.connect.server/ - when customizing the URL to mymeeting, the URL to connect to the meeting would be http://adobe.connect.server/mymeeting. Leave out the trailing forward slash -
-Valid URL entries consists of the name with -
Once the meeting has been saved, you will no longer be able to edit/update this field as the field will be disabled. -If updating the activity settings and if Groups Mode is set to no group then you will see part of the URL in the text field. -Otherwise the text field will remain blank as each course group will have their own meeting URL. -
'; -$string['meetingtype_help'] = 'A public meeting type is one where anyone who has the URL for the meeting can enter the room.
-A private meeting type is one where only registered users and participants can enter. The login page does not allow -guests to log in. With private meetings the meeting does not actually start until the meeting Presenter or Host joins the meeting.
- --If you are creating a private meeting it is always good practice to assign at -least 1 host or presenter who will be present in the meeting; because users with -the participant role will be unable to join the meeting unless a user with the -host or presenter roles has already joined th meeting. -
- --If the meeting has support for separate groups at least 1 user in each group, who is -to be present in the meeting, should have either the host or presenter role. -
'; -$string['meettemplates_help'] = 'A meeting room template creates meeting with a custom layout for the meeting room.
'; -$string['pluginadministration'] = 'Adobe Connect Administration'; -$string['pluginname'] = 'Adobe Connect'; -$string['modulename'] = 'Adobe Connect'; -$string['recordinghdr'] = 'Recordings'; -$string['https'] = 'HTTPS Connection'; -$string['https_desc'] = 'Connect to the Connect server via HTTPS'; -$string['invalidurl'] = 'The URL needs to start with a letter (a-z)'; -$string['longurl'] = 'That meeting URL is too long. Try shortening it'; -$string['errorrecording'] = 'Unable to find recording session'; -$string['meetinfo'] = 'More Meeting Detail'; -$string['meetinfotxt'] = 'See server meeting details'; +role role for $a->meetname ($a->groupname)'; +$string['assignroles'] = 'Assign roles'; +$string['availablelist'] = 'Available'; +$string['backtomeeting'] = 'Back to $a meeting'; +$string['cancelchanges'] = 'Cancel'; +$string['duplicatemeetingname'] = 'A duplicate meeting name was found on the server'; +$string['duplicateurl'] = 'A duplicate meeting URL was found on the server'; +$string['editingfor'] = 'Editing for: $a'; +$string['email_login'] = 'Email address login'; +$string['email_login_desc'] = 'Check this option only if your Connect Pro server login is set to use email address. Note that toggling this option on/off during regular usage of this activity module can potentially create duplicaed users on the Connect Pro server'; +$string['endtime'] = 'End time'; +$string['existingusers'] = '$a existing users'; +$string['groupswitch'] = 'Filter by group'; +$string['host'] = 'Host'; +$string['host_desc'] = 'Where REST calls get sent to'; +$string['joinmeeting'] = 'Join Meeting'; +$string['meethost_desc'] = 'Domain where the Adobe server is installed'; +$string['meetinghost'] = 'Meeting domain'; +$string['meetingend'] = 'Meeting end time'; +$string['meetinginfo'] = 'Meeting Info'; +$string['meetingintro'] = 'Meeting Summary'; +$string['meetinggroup'] = 'Meeting group'; +$string['meetingname'] = 'Meeting Name'; +$string['meetingstart'] = 'Meeting start time'; +$string['meetingtype'] = 'Meeting type'; +$string['modulename'] = 'Adobe Connect'; +$string['modulenameplural'] = 'Adobe Connect'; +$string['meettemplates'] = 'Meeting Templates'; +$string['meeturl'] = 'Meeting URL'; +$string['participantbtngrp'] = 'Participant Actions'; +$string['participantsgrp'] = 'Meeting Users'; +$string['particpantslabel'] = 'Participants'; +$string['potentialusers'] = '$a potential users'; +$string['port'] = 'Port'; +$string['port_desc'] = 'Port used to connect to Adobe Connect'; +$string['presenterbtngrp'] = 'Presenter Actions'; +$string['presenterlabel'] = 'Presenter'; +$string['recordinghdr'] = 'Meeting Recordings'; +$string['record_force'] = 'Force Meeting Recordings'; +$string['record_force_desc'] = 'Force all Adobe Connect meetings to be recorded. This is a site wide effect and the Adobe Connect server must be restarted'; +$string['removeparticipant'] = 'Remove'; +$string['removepresenter'] = 'Remove'; +$string['roletoassign'] = 'Role to assign'; +$string['samemeettime'] = 'Invalid Meeting time'; +$string['savechanges'] = 'Save'; +$string['selectparticipants'] = 'Assign roles'; +$string['starttime'] = 'Start time'; +$string['usergrouprequired'] = 'This Meeting requires users to be in a group in order to join'; +$string['testconnection'] = 'Test Connection'; +$string['connectiontesttitle'] = 'Connection test window'; +$string['conntestintro'] = 'A series of tests have been run in order to determine whether the Adobe Connect Pro server has been properly setup for this integration to work and to also determine whether the user credentials provided in the activity global settings has the correct permissions to perform the neccessary tasks required by the activity module. If any of the tests below have failed, this activity module will not function properly.
For further assistance and documentation in how to set up your Adobe Connect Pro server please consult the MoodleDocs help page for this activity module Help page
'; +$string['greaterstarttime'] = 'The start time cannot be greater than the end time'; +$string['invalidadobemeeturl'] = 'Invalid entry for this field. Click the help bubble for valid entries'; + +$string['adobeconnect:meetingpresenter'] = 'Meeting Presenter'; +$string['adobeconnect:meetingparticipant'] = 'Meeting Particpant'; +$string['adobeconnect:meetinghost'] = 'Meeting Host'; +$string['public'] = 'Public'; +$string['private'] = 'Private'; + +// Error codes +$string['emptyxml'] = 'Unable to connect to the Adobe Connect Pro server at this time. Please inform your Moodle administrator.'; +$string['adminemptyxml'] = 'Unable to connect to the Adobe Connect Pro server at this time. Click continue to proceed to the activity settings page and test the connection'; +$string['notsetupproperty'] = 'The activity module is not properly setup. Please contact your Moodle administrator'; +$string['adminnotsetupproperty'] = 'The activity module is not properly setup. Click continue to proceed to the activity settings page and test the connection'; +$string['notparticipant'] = 'You are not a participant for this meeting'; +$string['unableretrdetails'] = 'Unable to retrieve meeting details'; +$string['usernotenrolled'] = 'Only users enrolled and have a role in this course can join this meeting'; +$string['nopresenterrole'] = 'error: error finding adobeconnectpresenter role'; +$string['nomeeting'] = 'No meeting exists on the server'; +$string['noinstances'] = 'There are no instances of adobeconnect'; +$string['error1'] = 'You must be a site administrator to access this page'; +$string['error2'] = 'The property \'{$a}\' is empty, please input a value and save the settings'; +$string['errormeeting'] = 'Error retrieving recording'; +$string['settingblurb'] = 'Adobe Systems Inc. and Remote-Learner.net have partnered together to create the first publicly available + and officially sponsored, integration method between Moodle and Adobe Acrobat Connect Pro. This new + integration is designed to simplify the use of synchronous events within Moodle. It provides a + single-sign-on between the two systems with easy creation and management of Adobe Connect Pro + meetings.
Visit the Adobe Connect Moodle Plugins Directory for information on Enterprise support.
'; +$string['meeturl_help'] = 'You can customize the URL that is used to connect to the Adobe connect meeting. The Adobe Server domain will always remain the same. + However the last part of the URL can be customized. +
+For example if the Adobe Connect server domain was located at http://adobe.connect.server/ + when customizing the URL to mymeeting, the URL to connect to the meeting would be http://adobe.connect.server/mymeeting. Leave out the trailing forward slash +
+Valid URL entries consists of the name with +
Once the meeting has been saved, you will no longer be able to edit/update this field as the field will be disabled. +If updating the activity settings and if Groups Mode is set to no group then you will see part of the URL in the text field. +Otherwise the text field will remain blank as each course group will have their own meeting URL. +
'; +$string['meetingtype_help'] = 'A public meeting type is one where anyone who has the URL for the meeting can enter the room.
+A private meeting type is one where only registered users and participants can enter. The login page does not allow +guests to log in. With private meetings the meeting does not actually start until the meeting Presenter or Host joins the meeting.
+ ++If you are creating a private meeting it is always good practice to assign at +least 1 host or presenter who will be present in the meeting; because users with +the participant role will be unable to join the meeting unless a user with the +host or presenter roles has already joined th meeting. +
+ ++If the meeting has support for separate groups at least 1 user in each group, who is +to be present in the meeting, should have either the host or presenter role. +
'; +$string['meettemplates_help'] = 'A meeting room template creates meeting with a custom layout for the meeting room.
'; +$string['pluginadministration'] = 'Adobe Connect Administration'; +$string['pluginname'] = 'Adobe Connect'; +$string['modulename'] = 'Adobe Connect'; +$string['recordinghdr'] = 'Recordings'; +$string['https'] = 'HTTPS Connection'; +$string['https_desc'] = 'Connect to the Connect server via HTTPS'; +$string['invalidurl'] = 'The URL needs to start with a letter (a-z)'; +$string['longurl'] = 'That meeting URL is too long. Try shortening it'; +$string['errorrecording'] = 'Unable to find recording session'; +$string['meetinfo'] = 'More Meeting Detail'; +$string['meetinfotxt'] = 'See server meeting details'; +$string['missingexpectedgroups'] = 'There are no groups available.'; +$string['event_view'] = 'Viewed activity'; +$string['event_view_all'] = 'Viewed all instances of the activity'; +$string['event_join_meeting'] = 'User joined a meeting'; +$string['event_view_recording'] = 'User viewed a recording'; +$string['event_assign_role'] = 'User assigned a Connect Pro role'; +$string['event_unassign_role'] = 'User unassigned a Connect Pro role'; +$string['startdate'] = 'start'; +$string['enddate'] = 'end'; +$string['duration'] = 'duration'; \ No newline at end of file diff --git a/lang/en/help/adobeconnect/assignroles.html b/lang/en/help/adobeconnect/assignroles.html index c55514f..f43ab5a 100644 --- a/lang/en/help/adobeconnect/assignroles.html +++ b/lang/en/help/adobeconnect/assignroles.html @@ -1,48 +1,48 @@ --When assigning roles to a private meeting it is always good practice to assign at -least 1 host or presenter who will be present in the meeting; because users with -the participant role will be unable to join the meeting unless a user with the -host or presenter roles has already joined th meeting. -
- --If the meeting has support for separate groups at least 1 user in each group, who is -to be present in the meeting, should have either the host or presenter role. -
- --By assigning a role to a user in a context, you -are granting them the permissions contained -in that role, for the current context and all -"lower" contexts. -
- --Contexts: -
--So for example, if you grant a Student role to a -user in a Course, they will have that role for -the course, but also all Blocks and Activities inside -that course. Their actual permissions may depend on -other roles and overrides that have been defined. -
- --See also -Roles, -Contexts, -Permissions and -Overrides. -
++When assigning roles to a private meeting it is always good practice to assign at +least 1 host or presenter who will be present in the meeting; because users with +the participant role will be unable to join the meeting unless a user with the +host or presenter roles has already joined th meeting. +
+ ++If the meeting has support for separate groups at least 1 user in each group, who is +to be present in the meeting, should have either the host or presenter role. +
+ ++By assigning a role to a user in a context, you +are granting them the permissions contained +in that role, for the current context and all +"lower" contexts. +
+ ++Contexts: +
++So for example, if you grant a Student role to a +user in a Course, they will have that role for +the course, but also all Blocks and Activities inside +that course. Their actual permissions may depend on +other roles and overrides that have been defined. +
+ ++See also +Roles, +Contexts, +Permissions and +Overrides. +
diff --git a/lang/en/help/adobeconnect/index.html b/lang/en/help/adobeconnect/index.html index d2cabfd..61f3252 100644 --- a/lang/en/help/adobeconnect/index.html +++ b/lang/en/help/adobeconnect/index.html @@ -1,7 +1,7 @@ -Adobe Connect
- +Adobe Connect
+ diff --git a/lang/en/help/adobeconnect/meetingtype.html b/lang/en/help/adobeconnect/meetingtype.html index b5f7671..fd381ef 100644 --- a/lang/en/help/adobeconnect/meetingtype.html +++ b/lang/en/help/adobeconnect/meetingtype.html @@ -1,19 +1,19 @@ -
Meeting Type
A public meeting type is one where anyone who has the URL for the meeting can enter the room.
-A private meeting type is one where only registered users and participants can enter. The login page does not allow -guests to log in. With private meetings the meeting does not actually start until the meeting Presenter or Host joins the meeting.
- --If you are creating a private meeting it is always good practice to assign at -least 1 host or presenter who will be present in the meeting; because users with -the participant role will be unable to join the meeting unless a user with the -host or presenter roles has already joined th meeting. -
- --If the meeting has support for separate groups at least 1 user in each group, who is -to be present in the meeting, should have either the host or presenter role. -
- -
Meeting Type
A public meeting type is one where anyone who has the URL for the meeting can enter the room.
+A private meeting type is one where only registered users and participants can enter. The login page does not allow +guests to log in. With private meetings the meeting does not actually start until the meeting Presenter or Host joins the meeting.
+ ++If you are creating a private meeting it is always good practice to assign at +least 1 host or presenter who will be present in the meeting; because users with +the participant role will be unable to join the meeting unless a user with the +host or presenter roles has already joined th meeting. +
+ ++If the meeting has support for separate groups at least 1 user in each group, who is +to be present in the meeting, should have either the host or presenter role. +
+ +
Meeting URL
You can customize the URL that is used to connect to the Adobe connect meeting. The Adobe Server domain will always remain the same. - However the last part of the URL can be customized. -
-For example if the Adobe Connect server domain was located at http://adobe.connect.server/ - when customizing the URL to mymeeting, the URL to connect to the meeting would be http://adobe.connect.server/mymeeting. Leave out the trailing forward slash -
-Valid URL entries consists of the name with -
Once the meeting has been saved, you will no longer be able to edit/update this field as the field will be disabled. -If updating the activity settings and if Groups Mode is set to no group then you will see part of the URL in the text field. -Otherwise the text field will remain blank as each course group will have their own meeting URL. -
-
Meeting URL
You can customize the URL that is used to connect to the Adobe connect meeting. The Adobe Server domain will always remain the same. + However the last part of the URL can be customized. +
+For example if the Adobe Connect server domain was located at http://adobe.connect.server/ + when customizing the URL to mymeeting, the URL to connect to the meeting would be http://adobe.connect.server/mymeeting. Leave out the trailing forward slash +
+Valid URL entries consists of the name with +
Once the meeting has been saved, you will no longer be able to edit/update this field as the field will be disabled. +If updating the activity settings and if Groups Mode is set to no group then you will see part of the URL in the text field. +Otherwise the text field will remain blank as each course group will have their own meeting URL. +
+
 Adobe Connect
The Adobe Connect Pro activity module provides the officially sponsored integration -method between Moodle and Adobe Connect Pro. It was developed in conjunction with the Remote-Learner -development team and Adobe Inc. It is designed to simplify the use of synchronous events within Moodle. -It provides a single sign on between the two systems with easy event creation and management.
- --Please see the Adobe Connect Pro Module page for more -details on this project. -
-
 Adobe Connect
The Adobe Connect Pro activity module provides the officially sponsored integration +method between Moodle and Adobe Connect Pro. It was developed in conjunction with the Remote-Learner +development team and Adobe Inc. It is designed to simplify the use of synchronous events within Moodle. +It provides a single sign on between the two systems with easy event creation and management.
+ ++Please see the Adobe Connect Pro Module page for more +details on this project. +
+
Meeting Template
A meeting room template creates meeting with a custom layout for the meeting room.
-
Meeting Template
A meeting room template creates meeting with a custom layout for the meeting room.
+A series of tests have been run in order to determine whether the Adobe Connect Pro server has been properly setup for this integration to work and to also determine whether the user credentials provided in the activity global settings has the correct permissions to perform the neccessary tasks required by the activity module. If any of the tests below have failed, this activity module will not function properly.
For further assistance and documentation in how to set up your Adobe Connect Pro server please consult the MoodleDocs help page for this activity module Help page
'; +$string['greaterstarttime'] = 'The start time cannot be greater than the end time'; +$string['invalidadobemeeturl'] = 'Invalid entry for this field. Click the help bubble for valid entries'; + +$string['adobeconnect:meetingpresenter'] = 'Meeting Presenter'; +$string['adobeconnect:meetingparticipant'] = 'Meeting Particpant'; +$string['adobeconnect:meetinghost'] = 'Meeting Host'; +$string['public'] = 'Public'; +$string['private'] = 'Private'; + +// Error codes +$string['emptyxml'] = 'Unable to connect to the Adobe Connect Pro server at this time. Please inform your Moodle administrator.'; +$string['adminemptyxml'] = 'Unable to connect to the Adobe Connect Pro server at this time. Click continue to proceed to the activity settings page and test the connection'; +$string['notsetupproperty'] = 'The activity module is not properly setup. Please contact your Moodle administrator'; +$string['adminnotsetupproperty'] = 'The activity module is not properly setup. Click continue to proceed to the activity settings page and test the connection'; +$string['notparticipant'] = 'You are not a participant for this meeting'; +$string['unableretrdetails'] = 'Unable to retrieve meeting details'; +$string['usernotenrolled'] = 'Only users enrolled and have a role in this course can join this meeting'; +$string['nopresenterrole'] = 'error: error finding adobeconnectpresenter role'; +$string['nomeeting'] = 'No meeting exists on the server'; +$string['noinstances'] = 'There are no instances of adobeconnect'; +$string['error1'] = 'You must be a site administrator to access this page'; +$string['error2'] = 'The property \'{$a}\' is empty, please input a value and save the settings'; +$string['errormeeting'] = 'Error retrieving recording'; +$string['settingblurb'] = 'Adobe Systems Inc. and Remote-Learner.net have partnered together to create the first publicly available + and officially sponsored, integration method between Moodle and Adobe Acrobat Connect Pro. This new + integration is designed to simplify the use of synchronous events within Moodle. It provides a + single-sign-on between the two systems with easy creation and management of Adobe Connect Pro + meetings.
Visit the Adobe Connect Moodle Plugins Directory for information on Enterprise support.
'; +$string['meeturl_help'] = 'You can customize the URL that is used to connect to the Adobe connect meeting. The Adobe Server domain will always remain the same. + However the last part of the URL can be customized. +
+For example if the Adobe Connect server domain was located at http://adobe.connect.server/ + when customizing the URL to mymeeting, the URL to connect to the meeting would be http://adobe.connect.server/mymeeting. Leave out the trailing forward slash +
+Valid URL entries consists of the name with +
Once the meeting has been saved, you will no longer be able to edit/update this field as the field will be disabled. +If updating the activity settings and if Groups Mode is set to no group then you will see part of the URL in the text field. +Otherwise the text field will remain blank as each course group will have their own meeting URL. +
'; +$string['meetingtype_help'] = 'A public meeting type is one where anyone who has the URL for the meeting can enter the room.
+A private meeting type is one where only registered users and participants can enter. The login page does not allow +guests to log in. With private meetings the meeting does not actually start until the meeting Presenter or Host joins the meeting.
+ ++If you are creating a private meeting it is always good practice to assign at +least 1 host or presenter who will be present in the meeting; because users with +the participant role will be unable to join the meeting unless a user with the +host or presenter roles has already joined th meeting. +
+ ++If the meeting has support for separate groups at least 1 user in each group, who is +to be present in the meeting, should have either the host or presenter role. +
'; +$string['meettemplates_help'] = 'A meeting room template creates meeting with a custom layout for the meeting room.
'; +$string['pluginadministration'] = 'Adobe Connect Administration'; +$string['pluginname'] = 'Adobe Connect'; +$string['modulename'] = 'Adobe Connect'; +$string['recordinghdr'] = 'Recordings'; +$string['https'] = 'HTTPS Connection'; +$string['https_desc'] = 'Connect to the Connect server via HTTPS'; +$string['invalidurl'] = 'The URL needs to start with a letter (a-z)'; +$string['longurl'] = 'That meeting URL is too long. Try shortening it'; +$string['errorrecording'] = 'Unable to find recording session'; +$string['meetinfo'] = 'More Meeting Detail'; +$string['meetinfotxt'] = 'See server meeting details'; +$string['missingexpectedgroups'] = 'There are no groups available.'; +$string['event_view'] = 'Viewed activity'; +$string['event_view_all'] = 'Viewed all instances of the activity'; +$string['event_join_meeting'] = 'User joined a meeting'; +$string['event_view_recording'] = 'User viewed a recording'; +$string['event_assign_role'] = 'User assigned a Connect Pro role'; +$string['event_unassign_role'] = 'User unassigned a Connect Pro role'; +$string['startdate'] = 'شروع'; +$string['enddate'] = 'پایان'; +$string['duration'] = 'مدت زمان'; \ No newline at end of file diff --git a/lang/fa/help/adobeconnect/assignroles.html b/lang/fa/help/adobeconnect/assignroles.html new file mode 100644 index 0000000..f43ab5a --- /dev/null +++ b/lang/fa/help/adobeconnect/assignroles.html @@ -0,0 +1,48 @@ ++When assigning roles to a private meeting it is always good practice to assign at +least 1 host or presenter who will be present in the meeting; because users with +the participant role will be unable to join the meeting unless a user with the +host or presenter roles has already joined th meeting. +
+ ++If the meeting has support for separate groups at least 1 user in each group, who is +to be present in the meeting, should have either the host or presenter role. +
+ ++By assigning a role to a user in a context, you +are granting them the permissions contained +in that role, for the current context and all +"lower" contexts. +
+ ++Contexts: +
++So for example, if you grant a Student role to a +user in a Course, they will have that role for +the course, but also all Blocks and Activities inside +that course. Their actual permissions may depend on +other roles and overrides that have been defined. +
+ ++See also +Roles, +Contexts, +Permissions and +Overrides. +
diff --git a/lang/fa/help/adobeconnect/index.html b/lang/fa/help/adobeconnect/index.html new file mode 100644 index 0000000..61f3252 --- /dev/null +++ b/lang/fa/help/adobeconnect/index.html @@ -0,0 +1,7 @@ +Adobe Connect
+ diff --git a/lang/fa/help/adobeconnect/meetingtype.html b/lang/fa/help/adobeconnect/meetingtype.html new file mode 100644 index 0000000..fd381ef --- /dev/null +++ b/lang/fa/help/adobeconnect/meetingtype.html @@ -0,0 +1,19 @@ +
Meeting Type
A public meeting type is one where anyone who has the URL for the meeting can enter the room.
+A private meeting type is one where only registered users and participants can enter. The login page does not allow +guests to log in. With private meetings the meeting does not actually start until the meeting Presenter or Host joins the meeting.
+ ++If you are creating a private meeting it is always good practice to assign at +least 1 host or presenter who will be present in the meeting; because users with +the participant role will be unable to join the meeting unless a user with the +host or presenter roles has already joined th meeting. +
+ ++If the meeting has support for separate groups at least 1 user in each group, who is +to be present in the meeting, should have either the host or presenter role. +
+ +
Meeting URL
You can customize the URL that is used to connect to the Adobe connect meeting. The Adobe Server domain will always remain the same. + However the last part of the URL can be customized. +
+For example if the Adobe Connect server domain was located at http://adobe.connect.server/ + when customizing the URL to mymeeting, the URL to connect to the meeting would be http://adobe.connect.server/mymeeting. Leave out the trailing forward slash +
+Valid URL entries consists of the name with +
Once the meeting has been saved, you will no longer be able to edit/update this field as the field will be disabled. +If updating the activity settings and if Groups Mode is set to no group then you will see part of the URL in the text field. +Otherwise the text field will remain blank as each course group will have their own meeting URL. +
+
 Adobe Connect
The Adobe Connect Pro activity module provides the officially sponsored integration +method between Moodle and Adobe Connect Pro. It was developed in conjunction with the Remote-Learner +development team and Adobe Inc. It is designed to simplify the use of synchronous events within Moodle. +It provides a single sign on between the two systems with easy event creation and management.
+ ++Please see the Adobe Connect Pro Module page for more +details on this project. +
+
Meeting Template
A meeting room template creates meeting with a custom layout for the meeting room.
+Saranno condotti una serie di test al fine di verificare la corretta impostazione del modulo'. -' e per determinare se le credenziali fornite hanno diritti sufficienti sul server Adobe connect per garantire il funzionamento della attivita.'. -' Se uno dei test dovesse fallire, si rende necessario operare per risolverli, o altrimenti il modulo non funzioneràa
Per ulteriori informazioni e assistenza su come impostare il server'. -' Adobe Connect Pro, è possibile consultare le pagine presenti su Moodledocs per questo modulo Help page
'; -$string['greaterstarttime'] = 'L\'orario di inizio non puo essere maggiore di quello di fine'; -$string['invalidadobemeeturl'] = 'Il valore inserito non e corretto. Per maggiori informazioni potete selezionare il pulsante di help relativo a questo campo'; - -$string['adobeconnect:meetingpresenter'] = 'Relatore'; -$string['adobeconnect:meetingparticipant'] = 'Partecipante'; -$string['adobeconnect:meetinghost'] = 'Organizzatore'; - -// Error codes -$string['emptyxml'] = 'Impossibile connettersi al server Adobe Connect Pro. Riprovate piu tardi e, se il problema dovesse persistere, informate l\'amministratore del sistema.'; -$string['adminemptyxml'] = 'Impossibile connettersi al server Adobe Connect Pro. Selezionate il link qui sotto per verificare le impostazioni del modulo e provare la connessione'; -$string['notsetupproperty'] = 'Il modulo non è correttamente configurato. Informate l\'amministratore del sistema Moodle'; -$string['adminnotsetupproperty'] = 'Il modulo non è correttamente configurato. Selezionate il link qui sotto per verificare le impostazioni del modulo e provare la connessione'; - -// ADDED FOR COMPLETENESS BY RABSER -$string['public'] = 'Riunione Pubblica'; -$string['private'] = 'Riunione Privata'; -$string['notparticipant'] = 'L\' utente non è iscritto a partecipare a questa riunione'; // join.php 'You are not a participant for this meeting' -$string['unableretrdetails'] = 'Impossibile reperire i dettagli per questa riunione'; // join.php 'Unable to retrieve meeting details' -$string['usernotenrolled'] = 'Solo gli utenti iscritti al corso possono partecipare alle riunioni'; // join.php 'Only users enrolled and have a role in this course can join this meeting' -$string['nopresenterrole'] = 'Il ruolo Adobe Presenter non è definito nel sistema: segnalate all\' amministratore il problema.'; // view.php 'error: error finding adobeconnectpresenter role' -$string['nomeeting'] = 'La riunione richiesta non esiste sul server'; // view.php 'No meeting exists on the server' +Help page'; +$string['admin_login'] = 'Login Amministratore'; +$string['admin_login_desc'] = 'Login main admin account'; +$string['admin_password'] = 'Password Amministratore'; +$string['admin_password_desc'] = 'Password per il main admin account'; +$string['adobeconnect'] = 'Adobe Connect'; +$string['adobeconnectfieldset'] = 'Impostazioni Adobe Connect'; +$string['adobeconnecthost'] = 'Organizzatore'; +$string['adobeconnecthostdescription'] = 'Un organizzatore assegna privilegi agli utenti, inizia e termina una riunione, oltre a poter agire come Relatore'; +$string['adobeconnectintro'] = 'Introduzione'; +$string['adobeconnectname'] = 'Nome della riunione'; +$string['adobeconnectparticipant'] = 'Partecipante'; +$string['adobeconnectparticipantdescription'] = 'Partecipa ad una riunione, ma non ne modifica le impostazioni'; +$string['adobeconnectpresenter'] = 'Relatore'; +$string['adobeconnectpresenterdescription'] = 'Il relatore di una riunione utilizza contenuti, condivide lo schermo del proprio computer, invia messaggi, modera domande, crea note, condivide audio e video ed invia contenuti tramite link web'; +$string['allusers'] = 'tutti gli utenti'; +$string['assignadoberole'] = 'Assegnamento ruoli Adobe Connect'; +$string['assignadoberoles'] = 'Asssegnamento del ruolo $a->role per la riunione $a->meetname ($a->groupname)'; +$string['assignroles'] = 'Imposta ruoli'; +$string['availablelist'] = 'Disponibile'; +$string['backtomeeting'] = 'Torna alla riunione $a'; +$string['cancelchanges'] = 'Annulla'; +$string['duplicatemeetingname'] = 'Il nome di riunione è gia in uso, vi preghiamo di modificarlo'; +$string['duplicateurl'] = 'La URL della riunione è gia in uso, vi preghiamo di modificarla'; +$string['editingfor'] = 'Editing for: $a'; +$string['email_login'] = 'Login tramite Email address'; +$string['email_login_desc'] = 'Selezionate questa opzione solo se il login al server Connect Pro è stato impostato all\'uso dell\'email address. Attenzione che modificando questa opzione durante il normale utilizzo di questo modulo, si possono creare duplicati di utenti sul server Connect'; +$string['endtime'] = 'Termine'; +$string['existingusers'] = '$a existing users'; +$string['groupswitch'] = 'Filtra per gruppo'; +$string['host'] = 'Server'; +$string['host_desc'] = 'Indica il server dove indirizzare le richieste amministrative'; +$string['joinmeeting'] = 'Entra nella Riunione'; +$string['meethost_desc'] = 'Indica il server su cui si trova Adobe'; +$string['meetinghost'] = 'Server Domain'; +$string['meetingend'] = 'Termine Riunione'; +$string['meetinginfo'] = 'Informazioni sulla Riunione'; +$string['meetingintro'] = 'Sommario della Riunione'; +$string['meetinggroup'] = 'Gruppo dellaRiunione'; +$string['meetingname'] = 'Nome della Riunione'; +$string['meetingstart'] = 'Inizio Riunione'; +$string['meetingtype'] = 'Tipo di Riunione'; +$string['modulename'] = 'Adobe Connect'; +$string['modulenameplural'] = 'Adobe Connect'; +$string['meettemplates'] = 'Modelli di Riunione'; +$string['meeturl'] = 'URL della Riunione'; +$string['participantbtngrp'] = 'Azioni dei Partecipanti'; +$string['participantsgrp'] = 'Utenti della Riunione'; +$string['particpantslabel'] = 'Partecipanti'; +$string['potentialusers'] = '$a utenti selezionabili'; +$string['port'] = 'Porta'; +$string['port_desc'] = 'È la porta TCP utilizzata per connettersi al server Adobe Connect'; +$string['presenterbtngrp'] = 'Azioni del Relatore'; +$string['presenterlabel'] = 'Relatore'; +$string['recordinghdr'] = 'Registrazioni della Riunione'; +$string['record_force'] = 'Obbliga la registrazione della Riunione'; +$string['record_force_desc'] = 'Obbliga la registrazione di tutte le riunioni Adobe Connect. Questa impostazione ha un effetto globale ed il server Adobe Connect deve essere riavviato'; +$string['removeparticipant'] = 'Rimuovi'; +$string['removepresenter'] = 'Rimuovi'; +$string['roletoassign'] = 'Ruolo da assegnare'; +$string['samemeettime'] = 'Data della Riunione non corretta'; +$string['savechanges'] = 'Salva'; +$string['selectparticipants'] = 'Assegna ruoli'; +$string['starttime'] = 'Inizio'; +$string['usergrouprequired'] = 'Questa Riunione righiede che gli utenti siano inseriti in un gruppo per potersi collegare'; +$string['testconnection'] = 'Test Connessione'; +$string['connectiontesttitle'] = 'Test Connessione Adobe Connect'; +$string['conntestintro'] = 'Saranno condotti una serie di test al fine di verificare la corretta impostazione del modulo e per determinare se le credenziali fornite hanno diritti sufficienti sul server Adobe connect per garantire il funzionamento della attivita. Se uno dei test dovesse fallire, si rende necessario operare per risolverli, o altrimenti il modulo non funzioneràa
Per ulteriori informazioni e assistenza su come impostare il server Adobe Connect Pro, è possibile consultare le pagine presenti su Moodledocs per questo modulo Help page
'; +$string['greaterstarttime'] = 'L\'orario di inizio non puo essere maggiore di quello di fine'; +$string['invalidadobemeeturl'] = 'Il valore inserito non e corretto. Per maggiori informazioni potete selezionare il pulsante di help relativo a questo campo'; + +$string['adobeconnect:meetingpresenter'] = 'Relatore'; +$string['adobeconnect:meetingparticipant'] = 'Partecipante'; +$string['adobeconnect:meetinghost'] = 'Organizzatore'; + +// Error codes +$string['emptyxml'] = 'Impossibile connettersi al server Adobe Connect Pro. Riprovate piu tardi e, se il problema dovesse persistere, informate l\'amministratore del sistema.'; +$string['adminemptyxml'] = 'Impossibile connettersi al server Adobe Connect Pro. Selezionate il link qui sotto per verificare le impostazioni del modulo e provare la connessione'; +$string['notsetupproperty'] = 'Il modulo non è correttamente configurato. Informate l\'amministratore del sistema Moodle'; +$string['adminnotsetupproperty'] = 'Il modulo non è correttamente configurato. Selezionate il link qui sotto per verificare le impostazioni del modulo e provare la connessione'; + +// ADDED FOR COMPLETENESS BY RABSER +$string['public'] = 'Riunione Pubblica'; +$string['private'] = 'Riunione Privata'; +$string['notparticipant'] = 'L\' utente non è iscritto a partecipare a questa riunione'; // join.php 'You are not a participant for this meeting' +$string['unableretrdetails'] = 'Impossibile reperire i dettagli per questa riunione'; // join.php 'Unable to retrieve meeting details' +$string['usernotenrolled'] = 'Solo gli utenti iscritti al corso possono partecipare alle riunioni'; // join.php 'Only users enrolled and have a role in this course can join this meeting' +$string['nopresenterrole'] = 'Il ruolo Adobe Presenter non è definito nel sistema: segnalate all\' amministratore il problema.'; // view.php 'error: error finding adobeconnectpresenter role' +$string['nomeeting'] = 'La riunione richiesta non esiste sul server'; // view.php 'No meeting exists on the server' diff --git a/lang/it/help/adobeconnect/assignroles.html b/lang/it/help/adobeconnect/assignroles.html index c55514f..f43ab5a 100644 --- a/lang/it/help/adobeconnect/assignroles.html +++ b/lang/it/help/adobeconnect/assignroles.html @@ -1,48 +1,48 @@ --When assigning roles to a private meeting it is always good practice to assign at -least 1 host or presenter who will be present in the meeting; because users with -the participant role will be unable to join the meeting unless a user with the -host or presenter roles has already joined th meeting. -
- --If the meeting has support for separate groups at least 1 user in each group, who is -to be present in the meeting, should have either the host or presenter role. -
- --By assigning a role to a user in a context, you -are granting them the permissions contained -in that role, for the current context and all -"lower" contexts. -
- --Contexts: -
--So for example, if you grant a Student role to a -user in a Course, they will have that role for -the course, but also all Blocks and Activities inside -that course. Their actual permissions may depend on -other roles and overrides that have been defined. -
- --See also -Roles, -Contexts, -Permissions and -Overrides. -
++When assigning roles to a private meeting it is always good practice to assign at +least 1 host or presenter who will be present in the meeting; because users with +the participant role will be unable to join the meeting unless a user with the +host or presenter roles has already joined th meeting. +
+ ++If the meeting has support for separate groups at least 1 user in each group, who is +to be present in the meeting, should have either the host or presenter role. +
+ ++By assigning a role to a user in a context, you +are granting them the permissions contained +in that role, for the current context and all +"lower" contexts. +
+ ++Contexts: +
++So for example, if you grant a Student role to a +user in a Course, they will have that role for +the course, but also all Blocks and Activities inside +that course. Their actual permissions may depend on +other roles and overrides that have been defined. +
+ ++See also +Roles, +Contexts, +Permissions and +Overrides. +
diff --git a/lang/it/help/adobeconnect/index.html b/lang/it/help/adobeconnect/index.html index d2cabfd..61f3252 100644 --- a/lang/it/help/adobeconnect/index.html +++ b/lang/it/help/adobeconnect/index.html @@ -1,7 +1,7 @@ -Adobe Connect
- +Adobe Connect
+ diff --git a/lang/it/help/adobeconnect/meetingtype.html b/lang/it/help/adobeconnect/meetingtype.html index b5f7671..fd381ef 100644 --- a/lang/it/help/adobeconnect/meetingtype.html +++ b/lang/it/help/adobeconnect/meetingtype.html @@ -1,19 +1,19 @@ -
Meeting Type
A public meeting type is one where anyone who has the URL for the meeting can enter the room.
-A private meeting type is one where only registered users and participants can enter. The login page does not allow -guests to log in. With private meetings the meeting does not actually start until the meeting Presenter or Host joins the meeting.
- --If you are creating a private meeting it is always good practice to assign at -least 1 host or presenter who will be present in the meeting; because users with -the participant role will be unable to join the meeting unless a user with the -host or presenter roles has already joined th meeting. -
- --If the meeting has support for separate groups at least 1 user in each group, who is -to be present in the meeting, should have either the host or presenter role. -
- -
Meeting Type
A public meeting type is one where anyone who has the URL for the meeting can enter the room.
+A private meeting type is one where only registered users and participants can enter. The login page does not allow +guests to log in. With private meetings the meeting does not actually start until the meeting Presenter or Host joins the meeting.
+ ++If you are creating a private meeting it is always good practice to assign at +least 1 host or presenter who will be present in the meeting; because users with +the participant role will be unable to join the meeting unless a user with the +host or presenter roles has already joined th meeting. +
+ ++If the meeting has support for separate groups at least 1 user in each group, who is +to be present in the meeting, should have either the host or presenter role. +
+ +
Meeting URL
You can customize the URL that is used to connect to the Adobe connect meeting. The Adobe Server domain will always remain the same. - However the last part of the URL can be customized. -
-For example if the Adobe Connect server domain was located at http://adobe.connect.server/ - when customizing the URL to mymeeting, the URL to connect to the meeting would be http://adobe.connect.server/mymeeting. Leave out the trailing forward slash -
-Valid URL entries consists of the name with -
Once the meeting has been saved, you will no longer be able to edit/update this field as the field will be disabled. -If updating the activity settings and if Groups Mode is set to no group then you will see part of the URL in the text field. -Otherwise the text field will remain blank as each course group will have their own meeting URL. -
-
Meeting URL
You can customize the URL that is used to connect to the Adobe connect meeting. The Adobe Server domain will always remain the same. + However the last part of the URL can be customized. +
+For example if the Adobe Connect server domain was located at http://adobe.connect.server/ + when customizing the URL to mymeeting, the URL to connect to the meeting would be http://adobe.connect.server/mymeeting. Leave out the trailing forward slash +
+Valid URL entries consists of the name with +
Once the meeting has been saved, you will no longer be able to edit/update this field as the field will be disabled. +If updating the activity settings and if Groups Mode is set to no group then you will see part of the URL in the text field. +Otherwise the text field will remain blank as each course group will have their own meeting URL. +
+
 Adobe Connect
The Adobe Connect Pro activity module provides the officially sponsored integration -method between Moodle and Adobe Connect Pro. It was developed in conjunction with the Remote-Learner -development team and Adobe Inc. It is designed to simplify the use of synchronous events within Moodle. -It provides a single sign on between the two systems with easy event creation and management.
- --Please see the Adobe Connect Pro Module page for more -details on this project. -
-
 Adobe Connect
The Adobe Connect Pro activity module provides the officially sponsored integration +method between Moodle and Adobe Connect Pro. It was developed in conjunction with the Remote-Learner +development team and Adobe Inc. It is designed to simplify the use of synchronous events within Moodle. +It provides a single sign on between the two systems with easy event creation and management.
+ ++Please see the Adobe Connect Pro Module page for more +details on this project. +
+
Meeting Template
A meeting room template creates meeting with a custom layout for the meeting room.
-
Meeting Template
A meeting room template creates meeting with a custom layout for the meeting room.
+Sending common-info call:
'; - $aconnectDOM->create_request($params); - - if (!empty($aconnectDOM->_xmlresponse)) { - - // Get the session key from the XML response - $aconnectDOM->read_cookie_xml($aconnectDOM->_xmlresponse); - - $cookie = $aconnectDOM->get_cookie(); - if (empty($cookie)) { - - echo 'unable to obtain session key from common-info call
'; - echo 'xmlrequest:
'; - $doc = new DOMDocument(); - - if ($doc->loadXML($aconnectDOM->_xmlrequest)) { - echo '' . htmlspecialchars($doc->saveXML()) . '
'; - } else { - echo 'unable to display the XML request
'; - } - - echo 'xmlresponse:
'; - $doc = new DOMDocument(); - - if ($doc->loadXML($aconnectDOM->_xmlresponse)) { - echo '' . htmlspecialchars($doc->saveHTML()) . '
'; - } else { - echo 'unable to display the XML response
'; - } - - } else { - - // print success - echo 'successfully obtained the session key: ' . $aconnectDOM->get_cookie() . '
'; - - // test logging in as the administrator - $params = array( - 'action' => 'login', - 'login' => $aconnectDOM->get_username(), - 'password' => $aconnectDOM->get_password(), - ); - - $aconnectDOM->create_request($params); - - if ($aconnectDOM->call_success()) { - echo 'successfully logged in as admin user
'; - //$username - - //Test retrevial of folders - echo 'Testing retrevial of shared content, recording and meeting folders:
'; - $folderscoid = aconnect_get_folder($aconnectDOM, 'content'); - - if ($folderscoid) { - echo 'successfully obtained shared content folder scoid: '. $folderscoid . '
'; - } else { - - echo 'error obtaining shared content folder
'; - echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully obtained forced-archives (meeting recordings) folder scoid: '. $folderscoid . '
'; - } else { - - echo 'error obtaining forced-archives (meeting recordings) folder
'; - echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully obtained meetings folder scoid: '. $folderscoid . '
'; - } else { - - echo 'error obtaining meetings folder
'; - echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully created meeting testmeetingtest scoid: '. $meetingscoid . '
'; - } else { - - echo 'error creating meeting testmeetingtest folder
'; - echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully created user testusertest principal-id: '. $usrprincipal . '
'; - } else { - echo 'error creating user testusertest
'; - echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
user testusertest already exists skipping delete user test
'; - $skipdeletetest = true; - } - - //Test assigning a user a role to the meeting - if (aconnect_check_user_perm($aconnectDOM, $usrprincipal, $meetingscoid, ADOBE_PRESENTER, true)) { - echo 'successfully assigned user testusertest'. - ' presenter role in meeting testmeetingtest: '. $usrprincipal . '
'; - } else { - echo 'error assigning user testusertest presenter role in meeting testmeetingtest
'; - echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully removed presenter role for user testusertest'. - ' in meeting testmeetingtest: '. $usrprincipal . '
'; - } else { - echo 'error remove presenter role for user testusertest in meeting testmeetingtest
'; - echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully removed user testusertest principal-id: '. $usrprincipal . '
'; - } else { - echo 'error removing user testusertest
'; - echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully removed meeting testmeetingtest scoid: '. $meetingscoid . '
'; - } else { - echo 'error removing meeting testmeetingtest folder
'; - echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
logging in as '. $username . ' was not successful, check to see if the username and password are correct
'; - } - - } - - } else { - echo 'common-info API call returned an empty document. Please check your settings and try again
'; - } - - aconnect_logout($aconnectDOM); - -} - -/** - * Returns the folder sco-id - * @param object an adobe connection_class object - * @param string $folder name of the folder to get - * (ex. forced-archives = recording folder | meetings = meetings folder - * | content = shared content folder) - * @return mixed adobe connect folder sco-id || false if there was an error - * - */ -function aconnect_get_folder($aconnect, $folder = '') { - $folderscoid = false; - $params = array('action' => 'sco-shortcuts'); - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - $folderscoid = aconnect_get_folder_sco_id($aconnect->_xmlresponse, $folder); -// $params = array('action' => 'sco-contents', 'sco-id' => $folderscoid); - } - - return $folderscoid; -} - -/** - * TODO: comment function and return something meaningful - */ -function aconnect_get_folder_sco_id($xml, $folder) { - $scoid = false; - - $dom = new DomDocument(); - $dom->loadXML($xml); - - $domnodelist = $dom->getElementsByTagName('sco'); - - if (!empty($domnodelist->length)) { - - for ($i = 0; $i < $domnodelist->length; $i++) { - - $domnode = $domnodelist->item($i)->attributes->getNamedItem('type'); - - if (!is_null($domnode)) { - - if (0 == strcmp($folder, $domnode->nodeValue)) { - $domnode = $domnodelist->item($i)->attributes->getNamedItem('sco-id'); - - if (!is_null($domnode)) { - $scoid = (int) $domnode->nodeValue; - - } - } - } - } - } - - return $scoid; - -} - -/** - * Log in as the admin user. This should only be used to conduct API calls. - */ -function aconnect_login() { - global $CFG, $USER, $COURSE; - - if (!isset($CFG->adobeconnect_host) or - !isset($CFG->adobeconnect_admin_login) or - !isset($CFG->adobeconnect_admin_password)) { - if (is_siteadmin($USER->id)) { - notice(get_string('adminnotsetupproperty', 'adobeconnect'), - $CFG->wwwroot . '/admin/settings.php?section=modsettingadobeconnect'); - } else { - notice(get_string('notsetupproperty', 'adobeconnect'), - '', $COURSE); - } - } - - if (isset($CFG->adobeconnect_port) and - !empty($CFG->adobeconnect_port) and - ((80 != $CFG->adobeconnect_port) and (0 != $CFG->adobeconnect_port))) { - $port = $CFG->adobeconnect_port; - } else { - $port = 80; - } - - $https = false; - - if (isset($CFG->adobeconnect_https) and (!empty($CFG->adobeconnect_https))) { - $https = true; - } - - - $aconnect = new connect_class_dom($CFG->adobeconnect_host, - $CFG->adobeconnect_port, - $CFG->adobeconnect_admin_login, - $CFG->adobeconnect_admin_password, - '', - $https); - - $params = array( - 'action' => 'common-info' - ); - - $aconnect->create_request($params); - - $aconnect->read_cookie_xml($aconnect->_xmlresponse); - - $params = array( - 'action' => 'login', - 'login' => $aconnect->get_username(), - 'password' => $aconnect->get_password(), - ); - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - $aconnect->set_connection(1); - } else { - $aconnect->set_connection(0); - } - - return $aconnect; -} - - -/** - * Logout - * @param object $aconnect - connection object - * @return true on success else false - */ -function aconnect_logout(&$aconnect) { - if (!$aconnect->get_connection()) { - return true; - } - - $params = array('action' => 'logout'); - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - $aconnect->set_connection(0); - return true; - } else { - $aconnect->set_connection(1); - return false; - } -} - -/** - * Calls all operations needed to retrieve and return all - * templates defined in the shared templates folder and meetings - * @param object $aconnect connection object - * @return array $templates an array of templates - */ -function aconnect_get_templates_meetings($aconnect) { - $templates = array(); - $meetings = array(); - $meetfldscoid = false; - $tempfldscoid = false; - - $params = array( - 'action' => 'sco-shortcuts', - ); - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - // Get shared templates folder sco-id - $tempfldscoid = aconnect_get_shared_templates($aconnect->_xmlresponse); - } - - if (false !== $tempfldscoid) { - $params = array( - 'action' => 'sco-expanded-contents', - 'sco-id' => $tempfldscoid, - ); - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - $templates = aconnect_return_all_templates($aconnect->_xmlresponse); - } - } - -// if (false !== $meetfldscoid) { -// $params = array( -// 'action' => 'sco-expanded-contents', -// 'sco-id' => $meetfldscoid, -// 'filter-type' => 'meeting', -// ); -// -// $aconnect->create_request($params); -// -// if ($aconnect->call_success()) { -// $meetings = aconnect_return_all_meetings($aconnect->_xmlresponse); -// } -// -// } - - return $templates + $meetings; -} - -/** - * Parse XML looking for shared-meeting-templates attribute - * and returning the sco-id of the folder - * @param string $xml returned XML from a sco-shortcuts call - * @return mixed sco-id if found or false if not found or error - */ -function aconnect_get_shared_templates($xml) { - $scoid = false; - - $dom = new DomDocument(); - $dom->loadXML($xml); - - $domnodelist = $dom->getElementsByTagName('shortcuts'); - - if (!empty($domnodelist->length)) { - -// for ($i = 0; $i < $domnodelist->length; $i++) { - - $innerlist = $domnodelist->item(0)->getElementsByTagName('sco'); - - if (!empty($innerlist->length)) { - - for ($x = 0; $x < $innerlist->length; $x++) { - - if ($innerlist->item($x)->hasAttributes()) { - - $domnode = $innerlist->item($x)->attributes->getNamedItem('type'); - - if (!is_null($domnode)) { - - if (0 == strcmp('shared-meeting-templates', $domnode->nodeValue)) { - $domnode = $innerlist->item($x)->attributes->getNamedItem('sco-id'); - - if (!is_null($domnode)) { - $scoid = (int) $domnode->nodeValue; - } - } - } - } - } - } -// } - - } - - return $scoid; -} - -function aconnect_return_all_meetings($xml) { - $meetings = array(); - $xml = new SimpleXMLElement($xml); - - if (empty($xml)) { - return $meetings; - } - - foreach($xml->{'expanded-scos'}[0]->sco as $key => $sco) { - if (0 == strcmp('meeting', $sco['type'])) { - $mkey = (int) $sco['sco-id']; - $meetings[$mkey] = (string) current($sco->name) .' '. ADOBE_MEETING_POSTFIX; - } - } - - return $meetings; -} - -/** - * Parses XML for meeting templates and returns an array - * with sco-id as the key and template name as the value - * @param strimg $xml XML returned from a sco-expanded-contents call - * @return array of templates sco-id -> key, name -> value - */ -function aconnect_return_all_templates($xml) { - $templates = array(); - - $dom = new DomDocument(); - $dom->loadXML($xml); - - $domnodelist = $dom->getElementsByTagName('expanded-scos'); - - if (!empty($domnodelist->length)) { - - $innerlist = $domnodelist->item(0)->getElementsByTagName('sco'); - - if (!empty($innerlist->length)) { - - for ($i = 0; $i < $innerlist->length; $i++) { - - if ($innerlist->item($i)->hasAttributes()) { - $domnode = $innerlist->item($i)->attributes->getNamedItem('type'); - - if (!is_null($domnode) and 0 == strcmp('meeting', $domnode->nodeValue)) { - $domnode = $innerlist->item($i)->attributes->getNamedItem('sco-id'); - - if (!is_null($domnode)) { - $tkey = (int) $domnode->nodeValue; - $namelistnode = $innerlist->item($i)->getElementsByTagName('name'); - - if (!is_null($namelistnode)) { - $name = $namelistnode->item(0)->nodeValue; - $templates[$tkey] = (string) $name .' ' . ADOBE_TEMPLATE_POSTFIX; - } - } - } - } - } - } - } - - return $templates; -} - -/** - * Returns information about all recordings that belong to a specific - * meeting sco-id - * - * @param obj $aconnect a connect_class object - * @param int $folderscoid the recordings folder sco-id - * @param int $sourcescoid the meeting sco-id - * - * @return mixed array an array of object with the recording sco-id - * as the key and the recording properties as properties - */ -function aconnect_get_recordings($aconnect, $folderscoid, $sourcescoid) { - $params = array('action' => 'sco-contents', - 'sco-id' => $folderscoid, - //'filter-source-sco-id' => $sourcescoid, - 'sort-name' => 'asc', - ); - - // Check if meeting scoid and folder scoid are the same - // If hey are the same then that means that forced recordings is not - // enabled filter-source-sco-id should not be included. If the - // meeting scoid and folder scoid are not equal then forced recordings - // are enabled and we can use filter by filter-source-sco-id - // Thanks to A. gtdino - if ($sourcescoid != $folderscoid) { - $params['filter-source-sco-id'] = $sourcescoid; - } - - $aconnect->create_request($params); - - $recordings = array(); - - if ($aconnect->call_success()) { - $dom = new DomDocument(); - $dom->loadXML($aconnect->_xmlresponse); - - $domnodelist = $dom->getElementsByTagName('scos'); - - if (!empty($domnodelist->length)) { - -// for ($i = 0; $i < $domnodelist->length; $i++) { - - $innernodelist = $domnodelist->item(0)->getElementsByTagName('sco'); - - if (!empty($innernodelist->length)) { - - for ($x = 0; $x < $innernodelist->length; $x++) { - - if ($innernodelist->item($x)->hasAttributes()) { - - $domnode = $innernodelist->item($x)->attributes->getNamedItem('sco-id'); - - if (!is_null($domnode)) { - $meetingdetail = $innernodelist->item($x); - - // Check if the SCO item is a recording or uploaded document. We only want to display recordings - if (!is_null($meetingdetail->getElementsByTagName('duration')->item(0))) { - - $j = (int) $domnode->nodeValue; - $value = (!is_null($meetingdetail->getElementsByTagName('name'))) ? - $meetingdetail->getElementsByTagName('name')->item(0)->nodeValue : ''; - - $recordings[$j]->name = (string) $value; - - $value = (!is_null($meetingdetail->getElementsByTagName('url-path'))) ? - $meetingdetail->getElementsByTagName('url-path')->item(0)->nodeValue : ''; - - $recordings[$j]->url = (string) $value; - - $value = (!is_null($meetingdetail->getElementsByTagName('date-begin'))) ? - $meetingdetail->getElementsByTagName('date-begin')->item(0)->nodeValue : ''; - - $recordings[$j]->startdate = (string) $value; - - $value = (!is_null($meetingdetail->getElementsByTagName('date-end'))) ? - $meetingdetail->getElementsByTagName('date-end')->item(0)->nodeValue : ''; - - $recordings[$j]->enddate = (string) $value; - - $value = (!is_null($meetingdetail->getElementsByTagName('date-created'))) ? - $meetingdetail->getElementsByTagName('date-created')->item(0)->nodeValue : ''; - - $recordings[$j]->createdate = (string) $value; - - $value = (!is_null($meetingdetail->getElementsByTagName('date-modified'))) ? - $meetingdetail->getElementsByTagName('date-modified')->item(0)->nodeValue : ''; - - $recordings[$j]->modified = (string) $value; - - $value = (!is_null($meetingdetail->getElementsByTagName('duration'))) ? - $meetingdetail->getElementsByTagName('duration')->item(0)->nodeValue : ''; - - $recordings[$j]->duration = (string) $value; - - $recordings[$j]->sourcesco = (int) $sourcescoid; - } - - } - } - } - } -// } - - return $recordings; - } else { - return false; - } - } else { - return false; - } - -} - -/** - * Parses XML and returns the meeting sco-id - * @param string XML obtained from a sco-update call - */ -function aconnect_get_meeting_scoid($xml) { - $scoid = false; - - $dom = new DomDocument(); - $dom->loadXML($xml); - - $domnodelist = $dom->getElementsByTagName('sco'); - - if (!empty($domnodelist->length)) { - if ($domnodelist->item(0)->hasAttributes()) { - $domnode = $domnodelist->item(0)->attributes->getNamedItem('sco-id'); - - if (!is_null($domnode)) { - $scoid = (int) $domnode->nodeValue; - } - } - } - - return $scoid; -} - -/** - * Update meeting - * @param obj $aconnect connect_class object - * @param obj $meetingobj an adobeconnect module object - * @param int $meetingfdl adobe connect meeting folder sco-id - * @return bool true if call was successful else false - */ -function aconnect_update_meeting($aconnect, $meetingobj, $meetingfdl) { - $params = array('action' => 'sco-update', - 'sco-id' => $meetingobj->scoid, - 'name' => htmlentities($meetingobj->name), - 'folder-id' => $meetingfdl, -// updating meeting URL using the API corrupts the meeting for some reason -// 'url-path' => '/'.$meetingobj->meeturl, - 'date-begin' => $meetingobj->starttime, - 'date-end' => $meetingobj->endtime, - ); - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - return true; - } else { - return false; - } - -} - -/** - * Update a meeting's access permissions - * @param obj $aconnect connect_class object - * @param int $meetingscoid meeting sco-id - * @param int $perm meeting permission id - * @return bool true if call was successful else false - */ -function aconnect_update_meeting_perm($aconnect, $meetingscoid, $perm) { - $params = array('action' => 'permissions-update', - 'acl-id' => $meetingscoid, - 'principal-id' => 'public-access', - ); - - switch ($perm) { - case ADOBE_MEETPERM_PUBLIC: - $params['permission-id'] = 'view-hidden'; - break; - case ADOBE_MEETPERM_PROTECTED: - $params['permission-id'] = 'remove'; - break; - case ADOBE_MEETPERM_PRIVATE: - default: - $params['permission-id'] = 'denied'; - break; - } - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - return true; - } else { - return false; - } - - - } - -/** CONTRIB-1976, CONTRIB-1992 - * This function adds a fraction of a second to the ISO 8601 date - * @param int $time unix timestamp - * @return mixed a string (ISO 8601) containing the decimal fraction of a second - * or false if it was not able to determine where to put it - */ -function aconnect_format_date_seconds($time) { - - $newdate = false; - $date = date("c", $time); - - $pos = strrpos($date, '-'); - $length = strlen($date); - - $diff = $length - $pos; - - if ((0 < $diff) and (ADOBE_TMZ_LENGTH == $diff)) { - $firstpart = substr($date, 0, $pos); - $lastpart = substr($date, $pos); - $newdate = $firstpart . '.000' . $lastpart; - - return $newdate; - } - - $pos = strrpos($date, '+'); - $length = strlen($date); - - $diff = $length - $pos; - - if ((0 < $diff) and (ADOBE_TMZ_LENGTH == $diff)) { - $firstpart = substr($date, 0, $pos); - $lastpart = substr($date, $pos); - $newdate = $firstpart . '.000' . $lastpart; - - return $newdate; - - } - - return false; -} - -/** - * Creates a meeting - * @param obj $aconnect connect_class object - * @param obj $meetingobj an adobeconnect module object - * @param int $meetingfdl adobe connect meeting folder sco-id - * @return mixed meeting sco-id on success || false on error - */ -function aconnect_create_meeting($aconnect, $meetingobj, $meetingfdl) { - //date("Y-m-d\TH:i - - $starttime = aconnect_format_date_seconds($meetingobj->starttime); - $endtime = aconnect_format_date_seconds($meetingobj->endtime); - - if (empty($starttime) or empty($endtime)) { - $message = 'Failure (aconnect_find_timezone) in finding the +/- sign in the date timezone'. - "\n".date("c", $meetingobj->starttime)."\n".date("c", $meetingobj->endtime); - debugging($message, DEBUG_DEVELOPER); - return false; - } - - $params = array('action' => 'sco-update', - 'type' => 'meeting', - 'name' => htmlentities($meetingobj->name), - 'folder-id' => $meetingfdl, - 'date-begin' => $starttime, - 'date-end' => $endtime, - ); - - if (!empty($meetingobj->meeturl)) { - $params['url-path'] = $meetingobj->meeturl; - } - - if (!empty($meetingobj->templatescoid)) { - $params['source-sco-id'] = $meetingobj->templatescoid; - } - - $aconnect->create_request($params); - - - if ($aconnect->call_success()) { - return aconnect_get_meeting_scoid($aconnect->_xmlresponse); - } else { - return false; - } -} - -/** - * Finds a matching meeting sco-id - * @param object $aconnect a connect_class object - * @param int $meetfldscoid Meeting folder sco-id - * @param array $filter array key is the filter and array value is the value - * (ex. array('filter-name' => 'meeting101')) - * @return mixed array of objects with sco-id as key and meeting name and url as object - * properties as value || false if not found or error occured - */ -function aconnect_meeting_exists($aconnect, $meetfldscoid, $filter = array()) { - $matches = array(); - - $params = array( - 'action' => 'sco-contents', - 'sco-id' => $meetfldscoid, - 'filter-type' => 'meeting', - ); - - if (empty($filter)) { - return false; - } - - $params = array_merge($params, $filter); - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - $dom = new DomDocument(); - $dom->loadXML($aconnect->_xmlresponse); - - $domnodelist = $dom->getElementsByTagName('scos'); - - if (!empty($domnodelist->length)) { - - $innernodelist = $domnodelist->item(0)->getElementsByTagName('sco'); - - if (!empty($innernodelist->length)) { - - for ($i = 0; $i < $innernodelist->length; $i++) { - - if ($innernodelist->item($i)->hasAttributes()) { - - $domnode = $innernodelist->item($i)->attributes->getNamedItem('sco-id'); - - if (!is_null($domnode)) { - - $key = (int) $domnode->nodeValue; - - $meetingdetail = $innernodelist->item($i); - - $value = (!is_null($meetingdetail->getElementsByTagName('name'))) ? - $meetingdetail->getElementsByTagName('name')->item(0)->nodeValue : ''; - - $matches[$key]->name = (string) $value; - - $value = (!is_null($meetingdetail->getElementsByTagName('url-path'))) ? - $meetingdetail->getElementsByTagName('url-path')->item(0)->nodeValue : ''; - - $matches[$key]->url = (string) $value; - - $matches[$key]->scoid = (int) $key; - - $value = (!is_null($meetingdetail->getElementsByTagName('date-begin'))) ? - $meetingdetail->getElementsByTagName('date-begin')->item(0)->nodeValue : ''; - - $matches[$key]->starttime = (string) $value; - - $value = (!is_null($meetingdetail->getElementsByTagName('date-end'))) ? - $meetingdetail->getElementsByTagName('date-end')->item(0)->nodeValue : ''; - - $matches[$key]->endtime = (string) $value; - - } - - } - } - } - } else { - return false; - } - - } else { - return false; - } - - return $matches; -} - -/** - * Parse XML and returns the user's principal-id - * @param string $xml XML returned from call to principal-list - * @param mixed user's principal-id or false - */ -function aconnect_get_user_principal_id($xml) { - $usrprincipalid = false; - - $dom = new DomDocument(); - $dom->loadXML($xml); - - $domnodelist = $dom->getElementsByTagName('principal-list'); - - if (!empty($domnodelist->length)) { - $domnodelist = $domnodelist->item(0)->getElementsByTagName('principal'); - - if (!empty($domnodelist->length)) { - if ($domnodelist->item(0)->hasAttributes()) { - $domnode = $domnodelist->item(0)->attributes->getNamedItem('principal-id'); - - if (!is_null($domnode)) { - $usrprincipalid = (int) $domnode->nodeValue; - } - } - } - } - - return $usrprincipalid; -} - -/** - * Check to see if a user exists on the Adobe connect server - * searching by username - * @param object $aconnect a connection_class object - * @param object $userdata an object with username as a property - * @return mixed user's principal-id of match is found || false if not - * found or error occured - */ -function aconnect_user_exists($aconnect, $usrdata) { - $params = array( - 'action' => 'principal-list', - 'filter-login' => $usrdata->username, -// 'filter-type' => 'meeting', -// add more filters if this process begins to get slow - ); - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - return aconnect_get_user_principal_id($aconnect->_xmlresponse); - } else { - return false; - } - - -} - -function aconnect_delete_user($aconnect, $principalid = 0) { - - if (empty($principalid)) { - return false; - } - - $params = array( - 'action' => 'principals-delete', - 'principal-id' => $principalid, - ); - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - return true; - } else { - return false; - } - -} - -/** - * Creates a new user on the Adobe Connect server. - * Parses XML from a principal-update call and returns - * the principal-id of the new user. - * - * @param object $aconnet a connect_class object - * @param object $usrdata an object with firstname,lastname, - * username and email properties. - * @return mixed principal-id of the new user or false - */ -function aconnect_create_user($aconnect, $usrdata) { - $principal_id = false; - - $params = array( - 'action' => 'principal-update', - 'first-name' => $usrdata->firstname, - 'last-name' => $usrdata->lastname, - 'login' => $usrdata->username, - 'password' => strtoupper(md5($usrdata->username . time())), - 'extlogin' => $usrdata->username, - 'type' => 'user', - 'send-email' => 'false', - 'has-children' => 0, - 'email' => $usrdata->email, - ); - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - $dom = new DomDocument(); - $dom->loadXML($aconnect->_xmlresponse); - - $domnodelist = $dom->getElementsByTagName('principal'); - - if (!empty($domnodelist->length)) { - if ($domnodelist->item(0)->hasAttributes()) { - $domnode = $domnodelist->item(0)->attributes->getNamedItem('principal-id'); - - if (!is_null($domnode)) { - $principal_id = (int) $domnode->nodeValue; - } - } - } - } - - return $principal_id; -} - -function aconnect_assign_user_perm($aconnect, $usrprincipal, $meetingscoid, $type) { - $params = array( - 'action' => 'permissions-update', - 'acl-id' => $meetingscoid, //sco-id of meeting || principal id of user 11209, - 'permission-id' => $type, // host, mini-host, view - 'principal-id' => $usrprincipal, // principal id of user you are looking at - ); - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - return true; -// print_object($aconnect->_xmlresponse); - } else { - return false; -// print_object($aconnect->_xmlresponse); - } -} - -function aconnect_remove_user_perm($aconnect, $usrprincipal, $meetingscoid) { - $params = array( - 'action' => 'permissions-update', - 'acl-id' => $meetingscoid, //sco-id of meeting || principal id of user 11209, - 'permission-id' => ADOBE_REMOVE_ROLE, // host, mini-host, view - 'principal-id' => $usrprincipal, // principal id of user you are looking at - ); - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { -// print_object($aconnect->_xmlresponse); - } else { -// print_object($aconnect->_xmlresponse); - } - -} - - -/** - * Check if a user has a permission - * @param object $aconnect a connect_class object - * @param int $usrprincipal user principal-id - * @param int $meetingscoid meeting sco-id - * @param int $roletype can be ADOBE_PRESENTER, ADOBE_PARTICIPANT or ADOBE_REMOVE - * @param bool $assign set to true if you want to assign the user the role type - * set to false to just check the user's permission. $assign parameter is ignored - * if $roletype is ADOBE_REMOVE - * @return TODO - * - */ -function aconnect_check_user_perm($aconnect, $usrprincipal, $meetingscoid, $roletype, $assign = false) { - $perm_type = ''; - $hasperm = false; - - switch ($roletype) { - case ADOBE_PRESENTER: - $perm_type = ADOBE_MINIADMIN_ROLE; - break; - case ADOBE_PARTICIPANT: - $perm_type = ADOBE_VIEW_ROLE; - break; - case ADOBE_HOST: - $perm_type = ADOBE_HOST_ROLE; - break; - case ADOBE_REMOVE: - $perm_type = ADOBE_REMOVE_ROLE; - break; - default: - break; - } - - $params = array( - 'action' => 'permissions-info', - // 'filter-permission-id' => 'mini-host', - 'acl-id' => $meetingscoid, //sco-id of meeting || principal id of user 11209, -// 'filter-permission-id' => $perm_type, // host, mini-host, view - 'filter-principal-id' => $usrprincipal, // principal id of user you are looking at - ); - - if (ADOBE_REMOVE_ROLE != $perm_type) { - $params['filter-permission-id'] = $perm_type; - } - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - $dom = new DomDocument(); - $dom->loadXML($aconnect->_xmlresponse); - - $domnodelist = $dom->getElementsByTagName('permissions'); - - if (!empty($domnodelist->length)) { - $domnodelist = $domnodelist->item(0)->getElementsByTagName('principal'); - - if (!empty($domnodelist->length)) { - $hasperm = true; - } - } - - if (ADOBE_REMOVE_ROLE != $perm_type and $assign and !$hasperm) { - // TODO: check return values of the two functions below - // Assign permission to user - return aconnect_assign_user_perm($aconnect, $usrprincipal, $meetingscoid, $perm_type); - } elseif (ADOBE_REMOVE_ROLE == $perm_type) { - // Remove user's permission - return aconnect_remove_user_perm($aconnect, $usrprincipal, $meetingscoid); - } else { - return $hasperm; - } - } -} - -/** - * Remove a meeting - * @param obj $aconnect adobe connection object - * @param int $scoid sco-id of the meeting - * @return bool true of success false on failure - */ -function aconnect_remove_meeting($aconnect, $scoid) { - $params = array( - 'action' => 'sco-delete', - 'sco-id' => $scoid, - ); - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - return true; - } else { - return false; - } -} - -/** - * Move SCOs to the shared content folder - * @param obj $aconnect a connect_class object - * @param array sco-ids as array keys - * @return bool false if error or nothing to move true if a move occured - */ -function aconnect_move_to_shared($aconnect, $scolist) { - // Get shared folder sco-id - $shscoid = aconnect_get_folder($aconnect, 'content'); - - // Iterate through list of sco and move them all to the shared folder - if (!empty($shscoid)) { - - foreach ($scolist as $scoid => $data) { - $params = array( - 'action' => 'sco-move', - 'folder-id' => $shscoid, - 'sco-id' => $scoid, - ); - - $aconnect->create_request($params); - - } - - return true; - } else { - return false; - } -} - -/** - * Gets a list of roles that this user can assign in this context - * - * @param object $context the context. - * @param int $rolenamedisplay the type of role name to display. One of the - * ROLENAME_X constants. Default ROLENAME_ALIAS. - * @param bool $withusercounts if true, count the number of users with each role. - * @param integer|object $user A user id or object. By default (null) checks the permissions of the current user. - * @return array if $withusercounts is false, then an array $roleid => $rolename. - * if $withusercounts is true, returns a list of three arrays, - * $rolenames, $rolecounts, and $nameswithcounts. - */ -function adobeconnect_get_assignable_roles($context, $rolenamedisplay = ROLENAME_ALIAS, $withusercounts = false, $user = null) { - global $USER, $DB; - - // make sure there is a real user specified - if ($user === null) { - $userid = !empty($USER->id) ? $USER->id : 0; - } else { - $userid = !empty($user->id) ? $user->id : $user; - } - - if (!has_capability('moodle/role:assign', $context, $userid)) { - if ($withusercounts) { - return array(array(), array(), array()); - } else { - return array(); - } - } - - $parents = get_parent_contexts($context, true); - $contexts = implode(',' , $parents); - - $params = array(); - $extrafields = ''; - if ($rolenamedisplay == ROLENAME_ORIGINALANDSHORT or $rolenamedisplay == ROLENAME_SHORT) { - $extrafields .= ', r.shortname'; - } - - if ($withusercounts) { - $extrafields = ', (SELECT count(u.id) - FROM {role_assignments} cra JOIN {user} u ON cra.userid = u.id - WHERE cra.roleid = r.id AND cra.contextid = :conid AND u.deleted = 0 - ) AS usercount'; - $params['conid'] = $context->id; - } - - if (is_siteadmin($userid)) { - // show all roles allowed in this context to admins - $assignrestriction = ""; - } else { - $assignrestriction = "JOIN (SELECT DISTINCT raa.allowassign AS id - FROM {role_allow_assign} raa - JOIN {role_assignments} ra ON ra.roleid = raa.roleid - WHERE ra.userid = :userid AND ra.contextid IN ($contexts) - ) ar ON ar.id = r.id"; - $params['userid'] = $userid; - } - $params['contextlevel'] = $context->contextlevel; - $sql = "SELECT r.id, r.name $extrafields - FROM {role} r - $assignrestriction - JOIN {role_context_levels} rcl ON r.id = rcl.roleid - WHERE rcl.contextlevel = :contextlevel - ORDER BY r.sortorder ASC"; - $roles = $DB->get_records_sql($sql, $params); - - // Only include Adobe Connect roles - $param = array('shortname' => 'adobeconnectpresenter'); - $presenterid = $DB->get_field('role', 'id', $param); - - $param = array('shortname' => 'adobeconnectparticipant'); - $participantid = $DB->get_field('role', 'id', $param); - - $param = array('shortname' => 'adobeconnecthost'); - $hostid = $DB->get_field('role', 'id', $param); - - foreach ($roles as $key => $data) { - if ($key != $participantid and $key != $presenterid and $key != $hostid) { - unset($roles[$key]); - } - } - - $rolenames = array(); - foreach ($roles as $role) { - if ($rolenamedisplay == ROLENAME_SHORT) { - $rolenames[$role->id] = $role->shortname; - continue; - } - $rolenames[$role->id] = $role->name; - if ($rolenamedisplay == ROLENAME_ORIGINALANDSHORT) { - $rolenames[$role->id] .= ' (' . $role->shortname . ')'; - } - } - if ($rolenamedisplay != ROLENAME_ORIGINALANDSHORT and $rolenamedisplay != ROLENAME_SHORT) { - $rolenames = role_fix_names($rolenames, $context, $rolenamedisplay); - } - - if (!$withusercounts) { - return $rolenames; - } - - $rolecounts = array(); - $nameswithcounts = array(); - foreach ($roles as $role) { - $nameswithcounts[$role->id] = $rolenames[$role->id] . ' (' . $roles[$role->id]->usercount . ')'; - $rolecounts[$role->id] = $roles[$role->id]->usercount; - } - return array($rolenames, $rolecounts, $nameswithcounts); -} - -/** - * This function accepts a username and an email and returns the user's - * adobe connect user name, depending on the module's configuration settings - * - * @param string - moodle username - * @param string - moodle email - * - * @return string - user's adobe connect user name - */ -function set_username($username, $email) { - global $CFG; - - if (isset($CFG->adobeconnect_email_login) and !empty($CFG->adobeconnect_email_login)) { - return $email; - } else { - return $username; - } -} - -/** - * This function search through the user-meetings folder for a folder named - * after the user's login name and returns the sco-id of the user's folder - * - * @param obj - adobe connection connection object - * @param string - the name of the user's folder - * @return mixed - sco-id of the user folder (int) or false if no folder exists - * - */ -function aconnect_get_user_folder_sco_id($aconnect, $folder_name) { - - $scoid = false; - $usr_meet_scoid = aconnect_get_folder($aconnect, 'user-meetings'); - - if (empty($usr_meet_scoid)) { - return $scoid; - } - - $params = array('action' => 'sco-expanded-contents', - 'sco-id' => $usr_meet_scoid, - 'filter-name' => $folder_name); - - $aconnect->create_request($params); - - if ($aconnect->call_success()) { - - $dom = new DomDocument(); - $dom->loadXML($aconnect->_xmlresponse); - - $domnodelist = $dom->getElementsByTagName('sco'); - - if (!empty($domnodelist->length)) { - if ($domnodelist->item(0)->hasAttributes()) { - $domnode = $domnodelist->item(0)->attributes->getNamedItem('sco-id'); - - if (!is_null($domnode)) { - $scoid = (int) $domnode->nodeValue; - } - } - } - } - - return $scoid; -} - -/** - * This function returns the user's adobe connect login username based off of - * the adobe connect module's login configuration settings (Moodle username or - * Moodle email) - * - * @param int userid - * @return mixed - user's login username or false if something bad happened - */ -function get_connect_username($userid) { - global $DB; - - $username = ''; - $param = array('id' => $userid); - $record = $DB->get_record('user', $param, 'id,username,email'); - - if (!empty($userid) && !empty($record)) { - $username = set_username($record->username, $record->email); - } - - return $username; -} - -/** - * TEST FUNCTIONS - DELETE THIS AFTER COMPLETION OF TEST - */ -/* -function texpandsco ($aconnect, $scoid) { - global $USER; - - $folderscoid = false; - $params = array('action' => 'sco-expanded-contents', - 'sco-id' => $scoid, - 'filter-name' => $USER->email); - - $aconnect->create_request($params); - -// if ($aconnect->call_success()) { -// } - -} - -function tout ($data) { - $filename = '/tmp/tout.xml'; - $somecontent = $data; - - if (is_writable($filename)) { - if (!$handle = fopen($filename, 'w')) { - echo "Cannot open file ($filename)"; - return; - } - - // Write $somecontent to our opened file. - if (fwrite($handle, $somecontent) === FALSE) { - echo "Cannot write to file ($filename)"; - return; - } - - //echo "Success, wrote ($somecontent) to file ($filename)"; - - fclose($handle); - - } else { - echo "The file $filename is not writable"; - } -} */ \ No newline at end of file +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +require_once('connect_class.php'); +require_once('connect_class_dom.php'); + +define('ADOBE_VIEW_ROLE', 'view'); +define('ADOBE_HOST_ROLE', 'host'); +define('ADOBE_MINIADMIN_ROLE', 'mini-host'); +define('ADOBE_REMOVE_ROLE', 'remove'); + +define('ADOBE_PARTICIPANT', 1); +define('ADOBE_PRESENTER', 2); +define('ADOBE_REMOVE', 3); +define('ADOBE_HOST', 4); + +define('ADOBE_TEMPLATE_POSTFIX', '- Template'); +define('ADOBE_MEETING_POSTFIX', '- Meeting'); + +define('ADOBE_MEETPERM_PUBLIC', 0); //means the Acrobat Connect meeting is public, and anyone who has the URL for the meeting can enter the room. +define('ADOBE_MEETPERM_PROTECTED', 1); //means the meeting is protected, and only registered users and accepted guests can enter the room. +define('ADOBE_MEETPERM_PRIVATE', 2); // means the meeting is private, and only registered users and participants can enter the room + +define('ADOBE_TMZ_LENGTH', 6); + +function adobe_connection_test($host = '', $port = 80, $username = '', + $password = '', $httpheader = '', + $emaillogin, $https = false) { + + if (empty($host) or + empty($port) or (0 == $port) or + empty($username) or + empty($password) or + empty($httpheader)) { + + echo "One of the required parameters is blank or incorrect:Sending common-info call:
'; + $aconnectDOM->create_request($params); + + if (!empty($aconnectDOM->_xmlresponse)) { + + // Get the session key from the XML response + $aconnectDOM->read_cookie_xml($aconnectDOM->_xmlresponse); + + $cookie = $aconnectDOM->get_cookie(); + if (empty($cookie)) { + + echo 'unable to obtain session key from common-info call
'; + echo 'xmlrequest:
'; + $doc = new DOMDocument(); + + if ($doc->loadXML($aconnectDOM->_xmlrequest)) { + echo '' . htmlspecialchars($doc->saveXML()) . '
'; + } else { + echo 'unable to display the XML request
'; + } + + echo 'xmlresponse:
'; + $doc = new DOMDocument(); + + if ($doc->loadXML($aconnectDOM->_xmlresponse)) { + echo '' . htmlspecialchars($doc->saveHTML()) . '
'; + } else { + echo 'unable to display the XML response
'; + } + + } else { + + // print success + echo 'successfully obtained the session key: ' . $aconnectDOM->get_cookie() . '
'; + + // test logging in as the administrator + $params = array( + 'action' => 'login', + 'login' => $aconnectDOM->get_username(), + 'password' => $aconnectDOM->get_password(), + ); + + $aconnectDOM->create_request($params); + + if ($aconnectDOM->call_success()) { + echo 'successfully logged in as admin user
'; + //$username + + //Test retrevial of folders + echo 'Testing retrevial of shared content, recording and meeting folders:
'; + $folderscoid = aconnect_get_folder($aconnectDOM, 'content'); + + if ($folderscoid) { + echo 'successfully obtained shared content folder scoid: '. $folderscoid . '
'; + } else { + + echo 'error obtaining shared content folder
'; + echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully obtained forced-archives (meeting recordings) folder scoid: '. $folderscoid . '
'; + } else { + + echo 'error obtaining forced-archives (meeting recordings) folder
'; + echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully obtained meetings folder scoid: '. $folderscoid . '
'; + } else { + + echo 'error obtaining meetings folder
'; + echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully created meeting testmeetingtest scoid: '. $meetingscoid . '
'; + } else { + + echo 'error creating meeting testmeetingtest folder
'; + echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully created user testusertest principal-id: '. $usrprincipal . '
'; + } else { + echo 'error creating user testusertest
'; + echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
user testusertest already exists skipping delete user test
'; + $skipdeletetest = true; + } + + //Test assigning a user a role to the meeting + if (aconnect_check_user_perm($aconnectDOM, $usrprincipal, $meetingscoid, ADOBE_PRESENTER, true)) { + echo 'successfully assigned user testusertest'. + ' presenter role in meeting testmeetingtest: '. $usrprincipal . '
'; + } else { + echo 'error assigning user testusertest presenter role in meeting testmeetingtest
'; + echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully removed presenter role for user testusertest'. + ' in meeting testmeetingtest: '. $usrprincipal . '
'; + } else { + echo 'error remove presenter role for user testusertest in meeting testmeetingtest
'; + echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully removed user testusertest principal-id: '. $usrprincipal . '
'; + } else { + echo 'error removing user testusertest
'; + echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
successfully removed meeting testmeetingtest scoid: '. $meetingscoid . '
'; + } else { + echo 'error removing meeting testmeetingtest folder
'; + echo 'XML request:
'. htmlspecialchars($aconnectDOM->_xmlrequest). '
XML response:
'. htmlspecialchars($aconnectDOM->_xmlresponse). '
logging in as '. $username . ' was not successful, check to see if the username and password are correct
'; + } + + } + + } else { + echo 'common-info API call returned an empty document. Please check your settings and try again
'; + } + + aconnect_logout($aconnectDOM); + +} + +/** + * Returns the folder sco-id + * @param object an adobe connection_class object + * @param string $folder name of the folder to get + * (ex. forced-archives = recording folder | meetings = meetings folder + * | content = shared content folder) + * @return mixed adobe connect folder sco-id || false if there was an error + * + */ +function aconnect_get_folder($aconnect, $folder = '') { + $folderscoid = false; + $params = array('action' => 'sco-shortcuts'); + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + $folderscoid = aconnect_get_folder_sco_id($aconnect->_xmlresponse, $folder); +// $params = array('action' => 'sco-contents', 'sco-id' => $folderscoid); + } + + return $folderscoid; +} + +/** + * TODO: comment function and return something meaningful + */ +function aconnect_get_folder_sco_id($xml, $folder) { + $scoid = false; + + $dom = new DomDocument(); + $dom->loadXML($xml); + + $domnodelist = $dom->getElementsByTagName('sco'); + + if (!empty($domnodelist->length)) { + + for ($i = 0; $i < $domnodelist->length; $i++) { + + $domnode = $domnodelist->item($i)->attributes->getNamedItem('type'); + + if (!is_null($domnode)) { + + if (0 == strcmp($folder, $domnode->nodeValue)) { + $domnode = $domnodelist->item($i)->attributes->getNamedItem('sco-id'); + + if (!is_null($domnode)) { + $scoid = (int) $domnode->nodeValue; + + } + } + } + } + } + + return $scoid; + +} + +/** + * Log in as the admin user. This should only be used to conduct API calls. + */ +function aconnect_login() { + global $CFG, $USER, $COURSE; + + if (!isset($CFG->adobeconnect_host) or + !isset($CFG->adobeconnect_admin_login) or + !isset($CFG->adobeconnect_admin_password)) { + if (is_siteadmin($USER->id)) { + notice(get_string('adminnotsetupproperty', 'adobeconnect'), + $CFG->wwwroot . '/admin/settings.php?section=modsettingadobeconnect'); + } else { + notice(get_string('notsetupproperty', 'adobeconnect'), + '', $COURSE); + } + } + + if (isset($CFG->adobeconnect_port) and + !empty($CFG->adobeconnect_port) and + ((80 != $CFG->adobeconnect_port) and (0 != $CFG->adobeconnect_port))) { + $port = $CFG->adobeconnect_port; + } else { + $port = 80; + } + + $https = false; + + if (isset($CFG->adobeconnect_https) and (!empty($CFG->adobeconnect_https))) { + $https = true; + } + + + $aconnect = new connect_class_dom($CFG->adobeconnect_host, + $CFG->adobeconnect_port, + $CFG->adobeconnect_admin_login, + $CFG->adobeconnect_admin_password, + '', + $https); + + $params = array( + 'action' => 'common-info' + ); + + $aconnect->create_request($params); + + $aconnect->read_cookie_xml($aconnect->_xmlresponse); + + $params = array( + 'action' => 'login', + 'login' => $aconnect->get_username(), + 'password' => $aconnect->get_password(), + ); + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + $aconnect->set_connection(1); + } else { + $aconnect->set_connection(0); + } + + return $aconnect; +} + + +/** + * Logout + * @param object $aconnect - connection object + * @return true on success else false + */ +function aconnect_logout(&$aconnect) { + if (!$aconnect->get_connection()) { + return true; + } + + $params = array('action' => 'logout'); + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + $aconnect->set_connection(0); + return true; + } else { + $aconnect->set_connection(1); + return false; + } +} + +/** + * Calls all operations needed to retrieve and return all + * templates defined in the shared templates folder and meetings + * @param object $aconnect connection object + * @return array $templates an array of templates + */ +function aconnect_get_templates_meetings($aconnect) { + $templates = array(); + $meetings = array(); + $meetfldscoid = false; + $tempfldscoid = false; + + $params = array( + 'action' => 'sco-shortcuts', + ); + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + // Get shared templates folder sco-id + $tempfldscoid = aconnect_get_shared_templates($aconnect->_xmlresponse); + } + + if (false !== $tempfldscoid) { + $params = array( + 'action' => 'sco-expanded-contents', + 'sco-id' => $tempfldscoid, + ); + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + $templates = aconnect_return_all_templates($aconnect->_xmlresponse); + } + } + +// if (false !== $meetfldscoid) { +// $params = array( +// 'action' => 'sco-expanded-contents', +// 'sco-id' => $meetfldscoid, +// 'filter-type' => 'meeting', +// ); +// +// $aconnect->create_request($params); +// +// if ($aconnect->call_success()) { +// $meetings = aconnect_return_all_meetings($aconnect->_xmlresponse); +// } +// +// } + + return $templates + $meetings; +} + +/** + * Parse XML looking for shared-meeting-templates attribute + * and returning the sco-id of the folder + * @param string $xml returned XML from a sco-shortcuts call + * @return mixed sco-id if found or false if not found or error + */ +function aconnect_get_shared_templates($xml) { + $scoid = false; + + $dom = new DomDocument(); + $dom->loadXML($xml); + + $domnodelist = $dom->getElementsByTagName('shortcuts'); + + if (!empty($domnodelist->length)) { + +// for ($i = 0; $i < $domnodelist->length; $i++) { + + $innerlist = $domnodelist->item(0)->getElementsByTagName('sco'); + + if (!empty($innerlist->length)) { + + for ($x = 0; $x < $innerlist->length; $x++) { + + if ($innerlist->item($x)->hasAttributes()) { + + $domnode = $innerlist->item($x)->attributes->getNamedItem('type'); + + if (!is_null($domnode)) { + + if (0 == strcmp('shared-meeting-templates', $domnode->nodeValue)) { + $domnode = $innerlist->item($x)->attributes->getNamedItem('sco-id'); + + if (!is_null($domnode)) { + $scoid = (int) $domnode->nodeValue; + } + } + } + } + } + } +// } + + } + + return $scoid; +} + +function aconnect_return_all_meetings($xml) { + $meetings = array(); + $xml = new SimpleXMLElement($xml); + + if (empty($xml)) { + return $meetings; + } + + foreach($xml->{'expanded-scos'}[0]->sco as $key => $sco) { + if (0 == strcmp('meeting', $sco['type'])) { + $mkey = (int) $sco['sco-id']; + $meetings[$mkey] = (string) current($sco->name) .' '. ADOBE_MEETING_POSTFIX; + } + } + + return $meetings; +} + +/** + * Parses XML for meeting templates and returns an array + * with sco-id as the key and template name as the value + * @param strimg $xml XML returned from a sco-expanded-contents call + * @return array of templates sco-id -> key, name -> value + */ +function aconnect_return_all_templates($xml) { + $templates = array(); + + $dom = new DomDocument(); + $dom->loadXML($xml); + + $domnodelist = $dom->getElementsByTagName('expanded-scos'); + + if (!empty($domnodelist->length)) { + + $innerlist = $domnodelist->item(0)->getElementsByTagName('sco'); + + if (!empty($innerlist->length)) { + + for ($i = 0; $i < $innerlist->length; $i++) { + + if ($innerlist->item($i)->hasAttributes()) { + $domnode = $innerlist->item($i)->attributes->getNamedItem('type'); + + if (!is_null($domnode) and 0 == strcmp('meeting', $domnode->nodeValue)) { + $domnode = $innerlist->item($i)->attributes->getNamedItem('sco-id'); + + if (!is_null($domnode)) { + $tkey = (int) $domnode->nodeValue; + $namelistnode = $innerlist->item($i)->getElementsByTagName('name'); + + if (!is_null($namelistnode)) { + $name = $namelistnode->item(0)->nodeValue; + $templates[$tkey] = (string) $name .' ' . ADOBE_TEMPLATE_POSTFIX; + } + } + } + } + } + } + } + + return $templates; +} + +/** + * Returns information about all recordings that belong to a specific + * meeting sco-id + * + * @param obj $aconnect a connect_class object + * @param int $folderscoid the recordings folder sco-id + * @param int $sourcescoid the meeting sco-id + * + * @return mixed array an array of object with the recording sco-id + * as the key and the recording properties as properties + */ +function aconnect_get_recordings($aconnect, $folderscoid, $sourcescoid) { + $params = array('action' => 'sco-contents', + 'sco-id' => $folderscoid, + //'filter-source-sco-id' => $sourcescoid, + 'sort-name' => 'asc', + ); + + // Check if meeting scoid and folder scoid are the same + // If hey are the same then that means that forced recordings is not + // enabled filter-source-sco-id should not be included. If the + // meeting scoid and folder scoid are not equal then forced recordings + // are enabled and we can use filter by filter-source-sco-id + // Thanks to A. gtdino + if ($sourcescoid != $folderscoid) { + $params['filter-source-sco-id'] = $sourcescoid; + } + + $aconnect->create_request($params); + + $recordings = array(); + + if ($aconnect->call_success()) { + $dom = new DomDocument(); + $dom->loadXML($aconnect->_xmlresponse); + + $domnodelist = $dom->getElementsByTagName('scos'); + + if (!empty($domnodelist->length)) { + +// for ($i = 0; $i < $domnodelist->length; $i++) { + + $innernodelist = $domnodelist->item(0)->getElementsByTagName('sco'); + + if (!empty($innernodelist->length)) { + + for ($x = 0; $x < $innernodelist->length; $x++) { + + if ($innernodelist->item($x)->hasAttributes()) { + + $domnode = $innernodelist->item($x)->attributes->getNamedItem('sco-id'); + + if (!is_null($domnode)) { + $meetingdetail = $innernodelist->item($x); + $recordingvac9 = $innernodelist->item($x)->attributes->getNamedItem('duration'); + $recordingvac8 = $meetingdetail->getElementsByTagName('duration')->item(0); + + // Check if the SCO item is a recording or uploaded document. We only want to display recordings + if ((!is_null($recordingvac9) && $recordingvac9->nodeValue !== '') || !is_null($recordingvac8)) { + + $j = (int) $domnode->nodeValue; + $value = (!is_null($meetingdetail->getElementsByTagName('name'))) ? + $meetingdetail->getElementsByTagName('name')->item(0)->nodeValue : ''; + + $recordings[$j]->name = (string) $value; + + $value = (!is_null($meetingdetail->getElementsByTagName('url-path'))) ? + $meetingdetail->getElementsByTagName('url-path')->item(0)->nodeValue : ''; + + $recordings[$j]->url = (string) $value; + + $value = (!is_null($meetingdetail->getElementsByTagName('date-begin'))) ? + $meetingdetail->getElementsByTagName('date-begin')->item(0)->nodeValue : ''; + + $recordings[$j]->startdate = (string) $value; + + $value = (!is_null($meetingdetail->getElementsByTagName('date-end'))) ? + $meetingdetail->getElementsByTagName('date-end')->item(0)->nodeValue : ''; + + $recordings[$j]->enddate = (string) $value; + + $value = (!is_null($meetingdetail->getElementsByTagName('date-created'))) ? + $meetingdetail->getElementsByTagName('date-created')->item(0)->nodeValue : ''; + + $recordings[$j]->createdate = (string) $value; + + $value = (!is_null($meetingdetail->getElementsByTagName('date-modified'))) ? + $meetingdetail->getElementsByTagName('date-modified')->item(0)->nodeValue : ''; + + $recordings[$j]->modified = (string) $value; + + $value = (!is_null($recordingvac9) ? + $recordingvac9->nodeValue : $recordingvac8->nodeValue); + + $recordings[$j]->duration = (string) $value; + + $recordings[$j]->sourcesco = (int) $sourcescoid; + } + + } + } + } + } +// } + + return $recordings; + } else { + return false; + } + } else { + return false; + } + +} + +/** + * Parses XML and returns the meeting sco-id + * @param string XML obtained from a sco-update call + */ +function aconnect_get_meeting_scoid($xml) { + $scoid = false; + + $dom = new DomDocument(); + $dom->loadXML($xml); + + $domnodelist = $dom->getElementsByTagName('sco'); + + if (!empty($domnodelist->length)) { + if ($domnodelist->item(0)->hasAttributes()) { + $domnode = $domnodelist->item(0)->attributes->getNamedItem('sco-id'); + + if (!is_null($domnode)) { + $scoid = (int) $domnode->nodeValue; + } + } + } + + return $scoid; +} + +/** + * Update meeting + * @param obj $aconnect connect_class object + * @param obj $meetingobj an adobeconnect module object + * @param int $meetingfdl adobe connect meeting folder sco-id + * @return bool true if call was successful else false + */ +function aconnect_update_meeting($aconnect, $meetingobj, $meetingfdl) { + $params = array('action' => 'sco-update', + 'sco-id' => $meetingobj->scoid, + 'name' => htmlentities($meetingobj->name, ENT_COMPAT, 'UTF-8'), + 'folder-id' => $meetingfdl, +// updating meeting URL using the API corrupts the meeting for some reason +// 'url-path' => '/'.$meetingobj->meeturl, + 'date-begin' => $meetingobj->starttime, + 'date-end' => $meetingobj->endtime, + ); + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + return true; + } else { + return false; + } + +} + +/** + * Update a meeting's access permissions + * @param obj $aconnect connect_class object + * @param int $meetingscoid meeting sco-id + * @param int $perm meeting permission id + * @return bool true if call was successful else false + */ +function aconnect_update_meeting_perm($aconnect, $meetingscoid, $perm) { + $params = array('action' => 'permissions-update', + 'acl-id' => $meetingscoid, + 'principal-id' => 'public-access', + ); + + switch ($perm) { + case ADOBE_MEETPERM_PUBLIC: + $params['permission-id'] = 'view-hidden'; + break; + case ADOBE_MEETPERM_PROTECTED: + $params['permission-id'] = 'remove'; + break; + case ADOBE_MEETPERM_PRIVATE: + default: + $params['permission-id'] = 'denied'; + break; + } + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + return true; + } else { + return false; + } + + + } + +/** CONTRIB-1976, CONTRIB-1992 + * This function adds a fraction of a second to the ISO 8601 date + * @param int $time unix timestamp + * @return mixed a string (ISO 8601) containing the decimal fraction of a second + * or false if it was not able to determine where to put it + */ +function aconnect_format_date_seconds($time) { + + $newdate = false; + $date = date("c", $time); + + $pos = strrpos($date, '-'); + $length = strlen($date); + + $diff = $length - $pos; + + if ((0 < $diff) and (ADOBE_TMZ_LENGTH == $diff)) { + $firstpart = substr($date, 0, $pos); + $lastpart = substr($date, $pos); + $newdate = $firstpart . '.000' . $lastpart; + + return $newdate; + } + + $pos = strrpos($date, '+'); + $length = strlen($date); + + $diff = $length - $pos; + + if ((0 < $diff) and (ADOBE_TMZ_LENGTH == $diff)) { + $firstpart = substr($date, 0, $pos); + $lastpart = substr($date, $pos); + $newdate = $firstpart . '.000' . $lastpart; + + return $newdate; + + } + + return false; +} + +/** + * Creates a meeting + * @param obj $aconnect connect_class object + * @param obj $meetingobj an adobeconnect module object + * @param int $meetingfdl adobe connect meeting folder sco-id + * @return mixed meeting sco-id on success || false on error + */ +function aconnect_create_meeting($aconnect, $meetingobj, $meetingfdl) { + //date("Y-m-d\TH:i + + $starttime = aconnect_format_date_seconds($meetingobj->starttime); + $endtime = aconnect_format_date_seconds($meetingobj->endtime); + + if (empty($starttime) or empty($endtime)) { + $message = 'Failure (aconnect_find_timezone) in finding the +/- sign in the date timezone'. + "\n".date("c", $meetingobj->starttime)."\n".date("c", $meetingobj->endtime); + debugging($message, DEBUG_DEVELOPER); + return false; + } + + $params = array('action' => 'sco-update', + 'type' => 'meeting', + 'name' => htmlentities($meetingobj->name, ENT_COMPAT, 'UTF-8'), + 'folder-id' => $meetingfdl, + 'date-begin' => $starttime, + 'date-end' => $endtime, + ); + + if (!empty($meetingobj->meeturl)) { + $params['url-path'] = $meetingobj->meeturl; + } + + if (!empty($meetingobj->templatescoid)) { + $params['source-sco-id'] = $meetingobj->templatescoid; + } + + $aconnect->create_request($params); + + + if ($aconnect->call_success()) { + return aconnect_get_meeting_scoid($aconnect->_xmlresponse); + } else { + return false; + } +} + +/** + * Finds a matching meeting sco-id + * @param object $aconnect a connect_class object + * @param int $meetfldscoid Meeting folder sco-id + * @param array $filter array key is the filter and array value is the value + * (ex. array('filter-name' => 'meeting101')) + * @return mixed array of objects with sco-id as key and meeting name and url as object + * properties as value || false if not found or error occured + */ +function aconnect_meeting_exists($aconnect, $meetfldscoid, $filter = array()) { + $matches = array(); + + $params = array( + 'action' => 'sco-contents', + 'sco-id' => $meetfldscoid, + 'filter-type' => 'meeting', + ); + + if (empty($filter)) { + return false; + } + + $params = array_merge($params, $filter); + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + $dom = new DomDocument(); + $dom->loadXML($aconnect->_xmlresponse); + + $domnodelist = $dom->getElementsByTagName('scos'); + + if (!empty($domnodelist->length)) { + + $innernodelist = $domnodelist->item(0)->getElementsByTagName('sco'); + + if (!empty($innernodelist->length)) { + + for ($i = 0; $i < $innernodelist->length; $i++) { + + if ($innernodelist->item($i)->hasAttributes()) { + + $domnode = $innernodelist->item($i)->attributes->getNamedItem('sco-id'); + + if (!is_null($domnode)) { + + $key = (int) $domnode->nodeValue; + + $meetingdetail = $innernodelist->item($i); + + $value = (!is_null($meetingdetail->getElementsByTagName('name'))) ? + $meetingdetail->getElementsByTagName('name')->item(0)->nodeValue : ''; + + if (!isset($matches[$key])) { + $matches[$key] = new stdClass(); + } + + $matches[$key]->name = (string) $value; + + $value = (!is_null($meetingdetail->getElementsByTagName('url-path'))) ? + $meetingdetail->getElementsByTagName('url-path')->item(0)->nodeValue : ''; + + $matches[$key]->url = (string) $value; + + $matches[$key]->scoid = (int) $key; + + $value = (!is_null($meetingdetail->getElementsByTagName('date-begin'))) ? + $meetingdetail->getElementsByTagName('date-begin')->item(0)->nodeValue : ''; + + $matches[$key]->starttime = (string) $value; + + $value = (!is_null($meetingdetail->getElementsByTagName('date-end'))) ? + $meetingdetail->getElementsByTagName('date-end')->item(0)->nodeValue : ''; + + $matches[$key]->endtime = (string) $value; + + } + + } + } + } + } else { + return false; + } + + } else { + return false; + } + + return $matches; +} + +/** + * Parse XML and returns the user's principal-id + * @param string $xml XML returned from call to principal-list + * @param mixed user's principal-id or false + */ +function aconnect_get_user_principal_id($xml) { + $usrprincipalid = false; + + $dom = new DomDocument(); + $dom->loadXML($xml); + + $domnodelist = $dom->getElementsByTagName('principal-list'); + + if (!empty($domnodelist->length)) { + $domnodelist = $domnodelist->item(0)->getElementsByTagName('principal'); + + if (!empty($domnodelist->length)) { + if ($domnodelist->item(0)->hasAttributes()) { + $domnode = $domnodelist->item(0)->attributes->getNamedItem('principal-id'); + + if (!is_null($domnode)) { + $usrprincipalid = (int) $domnode->nodeValue; + } + } + } + } + + return $usrprincipalid; +} + +/** + * Check to see if a user exists on the Adobe connect server + * searching by username + * @param object $aconnect a connection_class object + * @param object $userdata an object with username as a property + * @return mixed user's principal-id of match is found || false if not + * found or error occured + */ +function aconnect_user_exists($aconnect, $usrdata) { + $params = array( + 'action' => 'principal-list', + 'filter-login' => $usrdata->username, +// 'filter-type' => 'meeting', +// add more filters if this process begins to get slow + ); + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + return aconnect_get_user_principal_id($aconnect->_xmlresponse); + } else { + return false; + } + + +} + +function aconnect_delete_user($aconnect, $principalid = 0) { + + if (empty($principalid)) { + return false; + } + + $params = array( + 'action' => 'principals-delete', + 'principal-id' => $principalid, + ); + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + return true; + } else { + return false; + } + +} + +/** + * Creates a new user on the Adobe Connect server. + * Parses XML from a principal-update call and returns + * the principal-id of the new user. + * + * @param object $aconnet a connect_class object + * @param object $usrdata an object with firstname,lastname, + * username and email properties. + * @return mixed principal-id of the new user or false + */ +function aconnect_create_user($aconnect, $usrdata) { + $principal_id = false; + + $params = array( + 'action' => 'principal-update', + 'first-name' => $usrdata->firstname, + 'last-name' => $usrdata->lastname, + 'login' => $usrdata->username, + 'password' => strtoupper(md5($usrdata->username . time())), + 'extlogin' => $usrdata->username, + 'type' => 'user', + 'send-email' => 'false', + 'has-children' => 0, + 'email' => $usrdata->email, + ); + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + $dom = new DomDocument(); + $dom->loadXML($aconnect->_xmlresponse); + + $domnodelist = $dom->getElementsByTagName('principal'); + + if (!empty($domnodelist->length)) { + if ($domnodelist->item(0)->hasAttributes()) { + $domnode = $domnodelist->item(0)->attributes->getNamedItem('principal-id'); + + if (!is_null($domnode)) { + $principal_id = (int) $domnode->nodeValue; + } + } + } + } + + return $principal_id; +} + +function aconnect_assign_user_perm($aconnect, $usrprincipal, $meetingscoid, $type) { + $params = array( + 'action' => 'permissions-update', + 'acl-id' => $meetingscoid, //sco-id of meeting || principal id of user 11209, + 'permission-id' => $type, // host, mini-host, view + 'principal-id' => $usrprincipal, // principal id of user you are looking at + ); + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + return true; +// print_object($aconnect->_xmlresponse); + } else { + return false; +// print_object($aconnect->_xmlresponse); + } +} + +function aconnect_remove_user_perm($aconnect, $usrprincipal, $meetingscoid) { + $params = array( + 'action' => 'permissions-update', + 'acl-id' => $meetingscoid, //sco-id of meeting || principal id of user 11209, + 'permission-id' => ADOBE_REMOVE_ROLE, // host, mini-host, view + 'principal-id' => $usrprincipal, // principal id of user you are looking at + ); + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { +// print_object($aconnect->_xmlresponse); + } else { +// print_object($aconnect->_xmlresponse); + } + +} + + +/** + * Check if a user has a permission + * @param object $aconnect a connect_class object + * @param int $usrprincipal user principal-id + * @param int $meetingscoid meeting sco-id + * @param int $roletype can be ADOBE_PRESENTER, ADOBE_PARTICIPANT or ADOBE_REMOVE + * @param bool $assign set to true if you want to assign the user the role type + * set to false to just check the user's permission. $assign parameter is ignored + * if $roletype is ADOBE_REMOVE + * @return TODO + * + */ +function aconnect_check_user_perm($aconnect, $usrprincipal, $meetingscoid, $roletype, $assign = false) { + $perm_type = ''; + $hasperm = false; + + switch ($roletype) { + case ADOBE_PRESENTER: + $perm_type = ADOBE_MINIADMIN_ROLE; + break; + case ADOBE_PARTICIPANT: + $perm_type = ADOBE_VIEW_ROLE; + break; + case ADOBE_HOST: + $perm_type = ADOBE_HOST_ROLE; + break; + case ADOBE_REMOVE: + $perm_type = ADOBE_REMOVE_ROLE; + break; + default: + break; + } + + $params = array( + 'action' => 'permissions-info', + // 'filter-permission-id' => 'mini-host', + 'acl-id' => $meetingscoid, //sco-id of meeting || principal id of user 11209, +// 'filter-permission-id' => $perm_type, // host, mini-host, view + 'filter-principal-id' => $usrprincipal, // principal id of user you are looking at + ); + + if (ADOBE_REMOVE_ROLE != $perm_type) { + $params['filter-permission-id'] = $perm_type; + } + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + $dom = new DomDocument(); + $dom->loadXML($aconnect->_xmlresponse); + + $domnodelist = $dom->getElementsByTagName('permissions'); + + if (!empty($domnodelist->length)) { + $domnodelist = $domnodelist->item(0)->getElementsByTagName('principal'); + + if (!empty($domnodelist->length)) { + $hasperm = true; + } + } + + if (ADOBE_REMOVE_ROLE != $perm_type and $assign and !$hasperm) { + // TODO: check return values of the two functions below + // Assign permission to user + return aconnect_assign_user_perm($aconnect, $usrprincipal, $meetingscoid, $perm_type); + } elseif (ADOBE_REMOVE_ROLE == $perm_type) { + // Remove user's permission + return aconnect_remove_user_perm($aconnect, $usrprincipal, $meetingscoid); + } else { + return $hasperm; + } + } +} + +/** + * Remove a meeting + * @param obj $aconnect adobe connection object + * @param int $scoid sco-id of the meeting + * @return bool true of success false on failure + */ +function aconnect_remove_meeting($aconnect, $scoid) { + $params = array( + 'action' => 'sco-delete', + 'sco-id' => $scoid, + ); + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + return true; + } else { + return false; + } +} + +/** + * Move SCOs to the shared content folder + * @param obj $aconnect a connect_class object + * @param array sco-ids as array keys + * @return bool false if error or nothing to move true if a move occured + */ +function aconnect_move_to_shared($aconnect, $scolist) { + // Get shared folder sco-id + $shscoid = aconnect_get_folder($aconnect, 'content'); + + // Iterate through list of sco and move them all to the shared folder + if (!empty($shscoid)) { + + foreach ($scolist as $scoid => $data) { + $params = array( + 'action' => 'sco-move', + 'folder-id' => $shscoid, + 'sco-id' => $scoid, + ); + + $aconnect->create_request($params); + + } + + return true; + } else { + return false; + } +} + +/** + * Gets a list of roles that this user can assign in this context + * + * @param object $context the context. + * @param int $rolenamedisplay the type of role name to display. One of the + * ROLENAME_X constants. Default ROLENAME_ALIAS. + * @param bool $withusercounts if true, count the number of users with each role. + * @param integer|object $user A user id or object. By default (null) checks the permissions of the current user. + * @return array if $withusercounts is false, then an array $roleid => $rolename. + * if $withusercounts is true, returns a list of three arrays, + * $rolenames, $rolecounts, and $nameswithcounts. + */ +function adobeconnect_get_assignable_roles($context, $rolenamedisplay = ROLENAME_ALIAS, $withusercounts = false, $user = null) { + global $USER, $DB; + + // make sure there is a real user specified + if ($user === null) { + $userid = !empty($USER->id) ? $USER->id : 0; + } else { + $userid = !empty($user->id) ? $user->id : $user; + } + + if (!has_capability('moodle/role:assign', $context, $userid)) { + if ($withusercounts) { + return array(array(), array(), array()); + } else { + return array(); + } + } + + $parents = $context->get_parent_context_ids(true); + $contexts = implode(',' , $parents); + + $params = array(); + $extrafields = ''; + if ($rolenamedisplay == ROLENAME_ORIGINALANDSHORT or $rolenamedisplay == ROLENAME_SHORT) { + $extrafields .= ', r.shortname'; + } + + if ($withusercounts) { + $extrafields = ', (SELECT count(u.id) + FROM {role_assignments} cra JOIN {user} u ON cra.userid = u.id + WHERE cra.roleid = r.id AND cra.contextid = :conid AND u.deleted = 0 + ) AS usercount'; + $params['conid'] = $context->id; + } + + if (is_siteadmin($userid)) { + // show all roles allowed in this context to admins + $assignrestriction = ""; + } else { + $assignrestriction = "JOIN (SELECT DISTINCT raa.allowassign AS id + FROM {role_allow_assign} raa + JOIN {role_assignments} ra ON ra.roleid = raa.roleid + WHERE ra.userid = :userid AND ra.contextid IN ($contexts) + ) ar ON ar.id = r.id"; + $params['userid'] = $userid; + } + $params['contextlevel'] = $context->contextlevel; + $sql = "SELECT r.id, r.name $extrafields + FROM {role} r + $assignrestriction + JOIN {role_context_levels} rcl ON r.id = rcl.roleid + WHERE rcl.contextlevel = :contextlevel + ORDER BY r.sortorder ASC"; + $roles = $DB->get_records_sql($sql, $params); + + // Only include Adobe Connect roles + $param = array('shortname' => 'adobeconnectpresenter'); + $presenterid = $DB->get_field('role', 'id', $param); + + $param = array('shortname' => 'adobeconnectparticipant'); + $participantid = $DB->get_field('role', 'id', $param); + + $param = array('shortname' => 'adobeconnecthost'); + $hostid = $DB->get_field('role', 'id', $param); + + foreach ($roles as $key => $data) { + if ($key != $participantid and $key != $presenterid and $key != $hostid) { + unset($roles[$key]); + } + } + + $rolenames = array(); + foreach ($roles as $role) { + if ($rolenamedisplay == ROLENAME_SHORT) { + $rolenames[$role->id] = $role->shortname; + continue; + } + $rolenames[$role->id] = $role->name; + if ($rolenamedisplay == ROLENAME_ORIGINALANDSHORT) { + $rolenames[$role->id] .= ' (' . $role->shortname . ')'; + } + } + if ($rolenamedisplay != ROLENAME_ORIGINALANDSHORT and $rolenamedisplay != ROLENAME_SHORT) { + $rolenames = role_fix_names($rolenames, $context, $rolenamedisplay); + } + + if (!$withusercounts) { + return $rolenames; + } + + $rolecounts = array(); + $nameswithcounts = array(); + foreach ($roles as $role) { + $nameswithcounts[$role->id] = $rolenames[$role->id] . ' (' . $roles[$role->id]->usercount . ')'; + $rolecounts[$role->id] = $roles[$role->id]->usercount; + } + return array($rolenames, $rolecounts, $nameswithcounts); +} + +/** + * This function accepts a username and an email and returns the user's + * adobe connect user name, depending on the module's configuration settings + * + * @param string - moodle username + * @param string - moodle email + * + * @return string - user's adobe connect user name + */ +function set_username($username, $email) { + global $CFG; + + if (isset($CFG->adobeconnect_email_login) and !empty($CFG->adobeconnect_email_login)) { + return $email; + } else { + return $username; + } +} + +/** + * This function search through the user-meetings folder for a folder named + * after the user's login name and returns the sco-id of the user's folder + * + * @param obj - adobe connection connection object + * @param string - the name of the user's folder + * @return mixed - sco-id of the user folder (int) or false if no folder exists + * + */ +function aconnect_get_user_folder_sco_id($aconnect, $folder_name) { + + $scoid = false; + $usr_meet_scoid = aconnect_get_folder($aconnect, 'user-meetings'); + + if (empty($usr_meet_scoid)) { + return $scoid; + } + + $params = array('action' => 'sco-expanded-contents', + 'sco-id' => $usr_meet_scoid, + 'filter-name' => $folder_name); + + $aconnect->create_request($params); + + if ($aconnect->call_success()) { + + $dom = new DomDocument(); + $dom->loadXML($aconnect->_xmlresponse); + + $domnodelist = $dom->getElementsByTagName('sco'); + + if (!empty($domnodelist->length)) { + if ($domnodelist->item(0)->hasAttributes()) { + $domnode = $domnodelist->item(0)->attributes->getNamedItem('sco-id'); + + if (!is_null($domnode)) { + $scoid = (int) $domnode->nodeValue; + } + } + } + } + + return $scoid; +} + +/** + * This function returns the user's adobe connect login username based off of + * the adobe connect module's login configuration settings (Moodle username or + * Moodle email) + * + * @param int userid + * @return mixed - user's login username or false if something bad happened + */ +function get_connect_username($userid) { + global $DB; + + $username = ''; + $param = array('id' => $userid); + $record = $DB->get_record('user', $param, 'id,username,email'); + + if (!empty($userid) && !empty($record)) { + $username = set_username($record->username, $record->email); + } + + return $username; +} + +/** + * TEST FUNCTIONS - DELETE THIS AFTER COMPLETION OF TEST + */ +/* +function texpandsco ($aconnect, $scoid) { + global $USER; + + $folderscoid = false; + $params = array('action' => 'sco-expanded-contents', + 'sco-id' => $scoid, + 'filter-name' => $USER->email); + + $aconnect->create_request($params); + +// if ($aconnect->call_success()) { +// } + +} + +function tout ($data) { + $filename = '/tmp/tout.xml'; + $somecontent = $data; + + if (is_writable($filename)) { + if (!$handle = fopen($filename, 'w')) { + echo "Cannot open file ($filename)"; + return; + } + + // Write $somecontent to our opened file. + if (fwrite($handle, $somecontent) === FALSE) { + echo "Cannot write to file ($filename)"; + return; + } + + //echo "Success, wrote ($somecontent) to file ($filename)"; + + fclose($handle); + + } else { + echo "The file $filename is not writable"; + } +} */ diff --git a/mod_form.php b/mod_form.php index 3917586..f6206bd 100644 --- a/mod_form.php +++ b/mod_form.php @@ -1,265 +1,288 @@ -dirroot.'/course/moodleform_mod.php'); -require_once($CFG->dirroot.'/mod/adobeconnect/locallib.php'); - -class mod_adobeconnect_mod_form extends moodleform_mod { - - function definition() { - - global $COURSE, $CFG; - $mform =& $this->_form; - -//------------------------------------------------------------------------------- - /// Adding the "general" fieldset, where all the common settings are showed - $mform->addElement('header', 'general', get_string('general', 'form')); - - /// Adding the standard "name" field - $mform->addElement('text', 'name', get_string('adobeconnectname', 'adobeconnect'), array('size'=>'64')); - if (!empty($CFG->formatstringstriptags)) { - $mform->setType('name', PARAM_TEXT); - } else { - $mform->setType('name', PARAM_CLEANHTML); - } - $mform->addRule('name', null, 'required', null, 'client'); - $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); - - /// Adding the required "intro" field to hold the description of the instance - $this->add_intro_editor(false, get_string('adobeconnectintro', 'adobeconnect')); - -// $mform->addElement('htmleditor', 'intro', get_string('adobeconnectintro', 'adobeconnect')); -// $mform->setType('intro', PARAM_RAW); -// $mform->addRule('intro', get_string('required'), 'required', null, 'client'); -// $mform->setHelpButton('intro', array('writing', 'richtext'), false, 'editorhelpbutton'); - - /// Adding "introformat" field -// $mform->addElement('format', 'introformat', get_string('format')); - -//------------------------------------------------------------------------------- - /// Adding the rest of adobeconnect settings, spreeading all them into this fieldset - /// or adding more fieldsets ('header' elements) if needed for better logic - - $mform->addElement('header', 'adobeconnectfieldset', get_string('adobeconnectfieldset', 'adobeconnect')); - - // Meeting URL - $attributes=array('size'=>'20'); - $mform->addElement('text', 'meeturl', get_string('meeturl', 'adobeconnect'), $attributes); - $mform->setType('meeturl', PARAM_PATH); - $mform->addHelpButton('meeturl', 'meeturl', 'adobeconnect'); -// $mform->addHelpButton('meeturl', array('meeturl', get_string('meeturl', 'adobeconnect'), 'adobeconnect')); - $mform->disabledIf('meeturl', 'tempenable', 'eq', 0); - - // Public or private meeting - $meetingpublic = array(1 => get_string('public', 'adobeconnect'), 0 => get_string('private', 'adobeconnect')); - $mform->addElement('select', 'meetingpublic', get_string('meetingtype', 'adobeconnect'), $meetingpublic); - $mform->addHelpButton('meetingpublic', 'meetingtype', 'adobeconnect'); -// $mform->addHelpButton('meetingpublic', array('meetingtype', get_string('meetingtype', 'adobeconnect'), 'adobeconnect')); - - // Meeting Template - $templates = array(); - $templates = $this->get_templates(); - ksort($templates); - $mform->addElement('select', 'templatescoid', get_string('meettemplates', 'adobeconnect'), $templates); - $mform->addHelpButton('templatescoid', 'meettemplates', 'adobeconnect'); -// $mform->addHelpButton('templatescoid', array('templatescoid', get_string('meettemplates', 'adobeconnect'), 'adobeconnect')); - $mform->disabledIf('templatescoid', 'tempenable', 'eq', 0); - - - $mform->addElement('hidden', 'tempenable'); - $mform->setType('type', PARAM_INT); - - $mform->addElement('hidden', 'userid'); - $mform->setType('type', PARAM_INT); - - // Start and end date selectors - $time = time(); - $starttime = usertime($time); - $mform->addElement('date_time_selector', 'starttime', get_string('starttime', 'adobeconnect')); - $mform->addElement('date_time_selector', 'endtime', get_string('endtime', 'adobeconnect')); - $mform->setDefault('endtime', strtotime('+2 hours')); - - -//------------------------------------------------------------------------------- - // add standard elements, common to all modules - $this->standard_coursemodule_elements(array('groups' => true)); - - // Disabled the group mode if the meeting has already been created - $mform->disabledIf('groupmode', 'tempenable', 'eq', 0); -//------------------------------------------------------------------------------- - // add standard buttons, common to all modules - $this->add_action_buttons(); - - } - - function data_preprocessing(&$default_values) { - global $CFG, $DB; - - if (array_key_exists('update', $default_values)) { - - $params = array('instanceid' => $default_values['id']); - $sql = "SELECT id FROM {adobeconnect_meeting_groups} WHERE ". - "instanceid = :instanceid"; - - if ($DB->record_exists_sql($sql, $params)) { - $default_values['tempenable'] = 0; - } - } - } - - function validation($data, $files) { - global $CFG, $DB, $USER; - - $errors = parent::validation($data, $files); - - $username = set_username($USER->username, $USER->email); - $usr_fldscoid = ''; - $aconnect = aconnect_login(); - - // 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 - $meetfldscoid = aconnect_get_folder($aconnect, 'meetings'); - $filter = array('filter-like-name' => $data['name']); - $namematches = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter); - - /// Search the user's adobe connect folder - $usrfldscoid = aconnect_get_user_folder_sco_id($aconnect, $username); - - if (!empty($usrfldscoid)) { - $namematches = $namematches + aconnect_meeting_exists($aconnect, $usrfldscoid, $filter); - } - - if (empty($namematches)) { - $namematches = array(); - } - - // Now search for existing meeting room URLs - $url = $data['meeturl']; - $url = $data['meeturl'] = adobeconnect_clean_meet_url($data['meeturl']); - - // Check to see if there are any trailing slashes or additional parts to the url - // ex. mymeeting/mysecondmeeting/ Only the 'mymeeting' part is valid - if ((0 != substr_count($url, '/')) and (false !== strpos($url, '/', 1))) { - $errors['meeturl'] = get_string('invalidadobemeeturl', 'adobeconnect'); - } - - $filter = array('filter-like-url-path' => $url); - $urlmatches = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter); - - /// Search the user's adobe connect folder - if (!empty($usrfldscoid)) { - $urlmatches = $urlmatches + aconnect_meeting_exists($aconnect, $usrfldscoid, $filter); - } - - if (empty($urlmatches)) { - $urlmatches = array(); - } else { - - // format url for comparison - if ((false === strpos($url, '/')) or (0 != strpos($url, '/'))) { - $url = '/' . $url; - } - - } - - // Check URL for correct length and format - if (strlen($data['meeturl']) > 60) { - $errors['meeturl'] = get_string('longurl', 'adobeconnect'); - } elseif (empty($data['meeturl'])) { - // Do nothing - } elseif (!preg_match('/^[a-z][a-z\-]*/i', $data['meeturl'])) { - $errors['meeturl'] = get_string('invalidurl', 'adobeconnect'); - } - - // Adding activity - if (empty($data['update'])) { - - if ($data['starttime'] == $data['endtime']) { - $errors['starttime'] = get_string('samemeettime', 'adobeconnect'); - $errors['endtime'] = get_string('samemeettime', 'adobeconnect'); - } elseif ($data['endtime'] < $data['starttime']) { - $errors['starttime'] = get_string('greaterstarttime', 'adobeconnect'); - } - - // Check for local activities with the same name - $params = array('name' => $data['name']); - if ($DB->record_exists('adobeconnect', $params)) { - $errors['name'] = get_string('duplicatemeetingname', 'adobeconnect'); - return $errors; - } - - // Check Adobe connect server for duplicated names - foreach($namematches as $matchkey => $match) { - if (0 == substr_compare($match->name, $data['name'] . '_', 0, strlen($data['name'] . '_'), false)) { - $errors['name'] = get_string('duplicatemeetingname', 'adobeconnect'); - } - } - - foreach($urlmatches as $matchkey => $match) { - $matchurl = rtrim($match->url, '/'); - if (0 == substr_compare($matchurl, $url . '_', 0, strlen($url . '_'), false)) { - $errors['meeturl'] = get_string('duplicateurl', 'adobeconnect'); - } - } - - } else { - // Updating activity - // Look for existing meeting names, excluding this activity's group meeting(s) - $params = array('instanceid' => $data['instance']); - $sql = "SELECT meetingscoid, groupid FROM {adobeconnect_meeting_groups} ". - " WHERE instanceid = :instanceid"; - - $grpmeetings = $DB->get_records_sql($sql, $params); - - if (empty($grpmeetings)) { - $grpmeetings = array(); - } - - foreach($namematches as $matchkey => $match) { - if (!array_key_exists($match->scoid, $grpmeetings)) { - if (0 == substr_compare($match->name, $data['name'] . '_', 0, strlen($data['name'] . '_'), false)) { - $errors['name'] = get_string('duplicatemeetingname', 'adobeconnect'); - } - } - } - - foreach($urlmatches as $matchkey => $match) { - if (!array_key_exists($match->scoid, $grpmeetings)) { - if (0 == substr_compare($match->url, $url . '_', 0, strlen($url . '_'), false)) { - $errors['meeturl'] = get_string('duplicateurl', 'adobeconnect'); - } - } - } - - // Validate start and end times - if ($data['starttime'] == $data['endtime']) { - $errors['starttime'] = get_string('samemeettime', 'adobeconnect'); - $errors['endtime'] = get_string('samemeettime', 'adobeconnect'); - } elseif ($data['endtime'] < $data['starttime']) { - $errors['starttime'] = get_string('greaterstarttime', 'adobeconnect'); - } - } - - aconnect_logout($aconnect); - - return $errors; - } - - function get_templates() { - $aconnect = aconnect_login(); - - $templates_meetings = aconnect_get_templates_meetings($aconnect); - aconnect_logout($aconnect); - return $templates_meetings; - } - -} +. + +/** + * @package mod_adobeconnect + * @author Akinsaya Delamarre (adelamarre@remote-learner.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright (C) 2015 Remote Learner.net Inc http://www.remote-learner.net + */ + +if (!defined('MOODLE_INTERNAL')) { + die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page +} + +require_once($CFG->dirroot.'/course/moodleform_mod.php'); +require_once($CFG->dirroot.'/mod/adobeconnect/locallib.php'); + +class mod_adobeconnect_mod_form extends moodleform_mod { + + function definition() { + + global $COURSE, $CFG; + $mform =& $this->_form; + +//------------------------------------------------------------------------------- + /// Adding the "general" fieldset, where all the common settings are showed + $mform->addElement('header', 'general', get_string('general', 'form')); + + /// Adding the standard "name" field + $mform->addElement('text', 'name', get_string('adobeconnectname', 'adobeconnect'), array('size'=>'64')); + if (!empty($CFG->formatstringstriptags)) { + $mform->setType('name', PARAM_TEXT); + } else { + $mform->setType('name', PARAM_CLEANHTML); + } + $mform->addRule('name', null, 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); + + /// Adding the required "intro" field to hold the description of the instance + $this->standard_intro_elements(get_string('adobeconnectintro', 'adobeconnect')); + +// $mform->addElement('htmleditor', 'intro', get_string('adobeconnectintro', 'adobeconnect')); +// $mform->setType('intro', PARAM_RAW); +// $mform->addRule('intro', get_string('required'), 'required', null, 'client'); +// $mform->setHelpButton('intro', array('writing', 'richtext'), false, 'editorhelpbutton'); + + /// Adding "introformat" field +// $mform->addElement('format', 'introformat', get_string('format')); + +//------------------------------------------------------------------------------- + /// Adding the rest of adobeconnect settings, spreeading all them into this fieldset + /// or adding more fieldsets ('header' elements) if needed for better logic + + $mform->addElement('header', 'adobeconnectfieldset', get_string('adobeconnectfieldset', 'adobeconnect')); + + // Meeting URL + $attributes=array('size'=>'20'); + $mform->addElement('text', 'meeturl', get_string('meeturl', 'adobeconnect'), $attributes); + $mform->setType('meeturl', PARAM_PATH); + $mform->addHelpButton('meeturl', 'meeturl', 'adobeconnect'); +// $mform->addHelpButton('meeturl', array('meeturl', get_string('meeturl', 'adobeconnect'), 'adobeconnect')); + $mform->disabledIf('meeturl', 'tempenable', 'eq', 0); + + // Public or private meeting + $meetingpublic = array(1 => get_string('public', 'adobeconnect'), 0 => get_string('private', 'adobeconnect')); + $mform->addElement('select', 'meetingpublic', get_string('meetingtype', 'adobeconnect'), $meetingpublic); + $mform->addHelpButton('meetingpublic', 'meetingtype', 'adobeconnect'); +// $mform->addHelpButton('meetingpublic', array('meetingtype', get_string('meetingtype', 'adobeconnect'), 'adobeconnect')); + + // Meeting Template + $templates = array(); + $templates = $this->get_templates(); + ksort($templates); + $mform->addElement('select', 'templatescoid', get_string('meettemplates', 'adobeconnect'), $templates); + $mform->addHelpButton('templatescoid', 'meettemplates', 'adobeconnect'); +// $mform->addHelpButton('templatescoid', array('templatescoid', get_string('meettemplates', 'adobeconnect'), 'adobeconnect')); + $mform->disabledIf('templatescoid', 'tempenable', 'eq', 0); + + + $mform->addElement('hidden', 'tempenable'); + $mform->setType('tempenable', PARAM_INT); + + $mform->addElement('hidden', 'userid'); + $mform->setType('userid', PARAM_INT); + + // Start and end date selectors + $time = time(); + $starttime = usertime($time); + $mform->addElement('date_time_selector', 'starttime', get_string('starttime', 'adobeconnect')); + $mform->addElement('date_time_selector', 'endtime', get_string('endtime', 'adobeconnect')); + $mform->setDefault('endtime', strtotime('+2 hours')); + + +//------------------------------------------------------------------------------- + // add standard elements, common to all modules + $this->standard_coursemodule_elements(array('groups' => true)); + + // Disabled the group mode if the meeting has already been created + $mform->disabledIf('groupmode', 'tempenable', 'eq', 0); +//------------------------------------------------------------------------------- + // add standard buttons, common to all modules + $this->add_action_buttons(); + + } + + function data_preprocessing(&$default_values) { + global $CFG, $DB; + + if (array_key_exists('update', $default_values)) { + + $params = array('instanceid' => $default_values['id']); + $sql = "SELECT id FROM {adobeconnect_meeting_groups} WHERE ". + "instanceid = :instanceid"; + + if ($DB->record_exists_sql($sql, $params)) { + $default_values['tempenable'] = 0; + } + } + } + + function validation($data, $files) { + global $CFG, $DB, $USER, $COURSE; + + $errors = parent::validation($data, $files); + + $username = set_username($USER->username, $USER->email); + $usr_fldscoid = ''; + $aconnect = aconnect_login(); + + // 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 + $meetfldscoid = aconnect_get_folder($aconnect, 'meetings'); + $filter = array('filter-like-name' => $data['name']); + $namematches = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter); + + /// Search the user's adobe connect folder + $usrfldscoid = aconnect_get_user_folder_sco_id($aconnect, $username); + + if (!empty($usrfldscoid)) { + $namematches = $namematches + aconnect_meeting_exists($aconnect, $usrfldscoid, $filter); + } + + if (empty($namematches)) { + $namematches = array(); + } + + // Now search for existing meeting room URLs + $url = $data['meeturl']; + $url = $data['meeturl'] = adobeconnect_clean_meet_url($data['meeturl']); + + // Check to see if there are any trailing slashes or additional parts to the url + // ex. mymeeting/mysecondmeeting/ Only the 'mymeeting' part is valid + if ((0 != substr_count($url, '/')) and (false !== strpos($url, '/', 1))) { + $errors['meeturl'] = get_string('invalidadobemeeturl', 'adobeconnect'); + } + + $filter = array('filter-like-url-path' => $url); + $urlmatches = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter); + + /// Search the user's adobe connect folder + if (!empty($usrfldscoid)) { + $urlmatches = $urlmatches + aconnect_meeting_exists($aconnect, $usrfldscoid, $filter); + } + + if (empty($urlmatches)) { + $urlmatches = array(); + } else { + + // format url for comparison + if ((false === strpos($url, '/')) or (0 != strpos($url, '/'))) { + $url = '/' . $url; + } + + } + + // Check URL for correct length and format + if (strlen($data['meeturl']) > 60) { + $errors['meeturl'] = get_string('longurl', 'adobeconnect'); + } elseif (empty($data['meeturl'])) { + // Do nothing + } elseif (!preg_match('/^[a-z][a-z\-]*/i', $data['meeturl'])) { + $errors['meeturl'] = get_string('invalidurl', 'adobeconnect'); + } + + // Check for available groups if groupmode is selected + if ($data['groupmode'] > 0) { + $crsgroups = groups_get_all_groups($COURSE->id); + if (empty($crsgroups)) { + $errors['groupmode'] = get_string('missingexpectedgroups', 'adobeconnect'); + } + } + + // Adding activity + if (empty($data['update'])) { + + if ($data['starttime'] == $data['endtime']) { + $errors['starttime'] = get_string('samemeettime', 'adobeconnect'); + $errors['endtime'] = get_string('samemeettime', 'adobeconnect'); + } elseif ($data['endtime'] < $data['starttime']) { + $errors['starttime'] = get_string('greaterstarttime', 'adobeconnect'); + } + + // Check for local activities with the same name + $params = array('name' => $data['name']); + if ($DB->record_exists('adobeconnect', $params)) { + $errors['name'] = get_string('duplicatemeetingname', 'adobeconnect'); + return $errors; + } + + // Check Adobe connect server for duplicated names + foreach($namematches as $matchkey => $match) { + if (0 == substr_compare($match->name, $data['name'] . '_', 0, strlen($data['name'] . '_'), false)) { + $errors['name'] = get_string('duplicatemeetingname', 'adobeconnect'); + } + } + + foreach($urlmatches as $matchkey => $match) { + $matchurl = rtrim($match->url, '/'); + if (0 == substr_compare($matchurl, $url . '_', 0, strlen($url . '_'), false)) { + $errors['meeturl'] = get_string('duplicateurl', 'adobeconnect'); + } + } + + } else { + // Updating activity + // Look for existing meeting names, excluding this activity's group meeting(s) + $params = array('instanceid' => $data['instance']); + $sql = "SELECT meetingscoid, groupid FROM {adobeconnect_meeting_groups} ". + " WHERE instanceid = :instanceid"; + + $grpmeetings = $DB->get_records_sql($sql, $params); + + if (empty($grpmeetings)) { + $grpmeetings = array(); + } + + foreach($namematches as $matchkey => $match) { + if (!array_key_exists($match->scoid, $grpmeetings)) { + if (0 == substr_compare($match->name, $data['name'] . '_', 0, strlen($data['name'] . '_'), false)) { + $errors['name'] = get_string('duplicatemeetingname', 'adobeconnect'); + } + } + } + + foreach($urlmatches as $matchkey => $match) { + if (!array_key_exists($match->scoid, $grpmeetings)) { + if (0 == substr_compare($match->url, $url . '_', 0, strlen($url . '_'), false)) { + $errors['meeturl'] = get_string('duplicateurl', 'adobeconnect'); + } + } + } + + // Validate start and end times + if ($data['starttime'] == $data['endtime']) { + $errors['starttime'] = get_string('samemeettime', 'adobeconnect'); + $errors['endtime'] = get_string('samemeettime', 'adobeconnect'); + } elseif ($data['endtime'] < $data['starttime']) { + $errors['starttime'] = get_string('greaterstarttime', 'adobeconnect'); + } + } + + aconnect_logout($aconnect); + + return $errors; + } + + function get_templates() { + $aconnect = aconnect_login(); + + $templates_meetings = aconnect_get_templates_meetings($aconnect); + aconnect_logout($aconnect); + return $templates_meetings; + } + +} diff --git a/module.js b/module.js index d9f4994..ece33e5 100644 --- a/module.js +++ b/module.js @@ -1,12 +1,12 @@ -/** - * Calls a PHP script to test the connection parameters - * to the Adobe Connect server - * @param object obj This is a form element - */ -M.mod_adobeconnect = {}; - -M.mod_adobeconnect.init = function(Y, args) { -} - -M.mod_adobeconnect.testconnection = function (Y, args) { -} +/** + * Calls a PHP script to test the connection parameters + * to the Adobe Connect server + * @param object obj This is a form element + */ +M.mod_adobeconnect = {}; + +M.mod_adobeconnect.init = function(Y, args) { +} + +M.mod_adobeconnect.testconnection = function (Y, args) { +} diff --git a/participants.php b/participants.php index efb8626..6ec6085 100644 --- a/participants.php +++ b/participants.php @@ -1,312 +1,337 @@ -. - -/** - * @package mod - * @subpackage adobeconnect - * @author Akinsaya Delamarre (adelamarre@remote-learner.net) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -require_once(dirname(__FILE__) . '/../../config.php'); -require_once($CFG->dirroot . '/' . $CFG->admin . '/roles/lib.php'); -require_once('locallib.php'); - -define("MAX_USERS_TO_LIST_PER_ROLE", 10); - -$contextid = required_param('contextid',PARAM_INT); -$roleid = optional_param('roleid', 0, PARAM_INT); - -list($context, $course, $cm) = get_context_info_array($contextid); - -$url = new moodle_url('/mod/adobeconnect/participants.php', array('contextid' => $contextid)); - -if ($course) { - $isfrontpage = ($course->id == SITEID); -} else { - $isfrontpage = false; - if ($context->contextlevel == CONTEXT_USER) { - $course = $DB->get_record('course', array('id'=>optional_param('courseid', SITEID, PARAM_INT)), '*', MUST_EXIST); - $user = $DB->get_record('user', array('id'=>$context->instanceid), '*', MUST_EXIST); - $url->param('courseid', $course->id); - $url->param('userid', $user->id); - } else { - $course = $SITE; - } -} - - -// security -require_login($course, false, $cm); -require_capability('moodle/role:assign', $context); -$PAGE->set_url($url); -$PAGE->set_context($context); - -$contextname = print_context_name($context); -$courseid = $course->id; - -// These are needed early because of tabs.php -list($assignableroles, $assigncounts, $nameswithcounts) = - adobeconnect_get_assignable_roles($context, ROLENAME_BOTH, true); - -$overridableroles = get_overridable_roles($context, ROLENAME_BOTH); - -// Make sure this user can assign this role -if ($roleid && !isset($assignableroles[$roleid])) { - $a = new stdClass; - $a->roleid = $roleid; - $a->context = $contextname; - print_error('cannotassignrolehere', '', get_context_url($context), $a); -} - -// Work out an appropriate page title. -if ($roleid) { - $a = new stdClass; - $a->role = $assignableroles[$roleid]; - $a->context = $contextname; - $title = get_string('assignrolenameincontext', 'role', $a); -} else { - if ($isfrontpage) { - $title = get_string('frontpageroles', 'admin'); - } else { - $title = get_string('assignrolesin', 'role', $contextname); - } -} - -// Process any incoming role assignments before printing the header. -if ($roleid) { - - // Create the user selector objects. - $options = array('context' => $context, 'roleid' => $roleid); - - $potentialuserselector = roles_get_potential_user_selector($context, 'addselect', $options); - $currentuserselector = new existing_role_holders('removeselect', $options); - - // Process incoming role assignments - $errors = array(); - if (optional_param('add', false, PARAM_BOOL) && confirm_sesskey()) { - $userstoassign = $potentialuserselector->get_selected_users(); - if (!empty($userstoassign)) { - - foreach ($userstoassign as $adduser) { - $allow = true; - - if ($allow) { - role_assign($roleid, $adduser->id, $context->id); - } - } - - $potentialuserselector->invalidate_selected_users(); - $currentuserselector->invalidate_selected_users(); - - $rolename = $assignableroles[$roleid]; - add_to_log($course->id, 'role', 'assign', 'mod/adobeconnect/participant.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id); - // Counts have changed, so reload. - list($assignableroles, $assigncounts, $nameswithcounts) = get_assignable_roles($context, ROLENAME_BOTH, true); - } - } - - // Process incoming role unassignments - if (optional_param('remove', false, PARAM_BOOL) && confirm_sesskey()) { - $userstounassign = $currentuserselector->get_selected_users(); - if (!empty($userstounassign)) { - - foreach ($userstounassign as $removeuser) { - //unassign only roles that are added manually, no messing with other components!!! - role_unassign($roleid, $removeuser->id, $context->id, ''); - } - - $potentialuserselector->invalidate_selected_users(); - $currentuserselector->invalidate_selected_users(); - - $rolename = $assignableroles[$roleid]; - add_to_log($course->id, 'role', 'unassign', 'mod/adobeconnect/participant.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id); - // Counts have changed, so reload. - list($assignableroles, $assigncounts, $nameswithcounts) = get_assignable_roles($context, ROLENAME_BOTH, true); - } - } -} - -$PAGE->set_pagelayout('admin'); -$PAGE->set_title($title); - -switch ($context->contextlevel) { - case CONTEXT_SYSTEM: - admin_externalpage_setup('assignroles', '', array('contextid' => $contextid, 'roleid' => $roleid)); - break; - case CONTEXT_USER: - $fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context)); - $PAGE->set_heading($fullname); - $showroles = 1; - break; - case CONTEXT_COURSECAT: - $PAGE->set_heading("$SITE->fullname: ".get_string("categories")); - break; - case CONTEXT_COURSE: - if ($isfrontpage) { - admin_externalpage_setup('frontpageroles', '', array('contextid' => $contextid, 'roleid' => $roleid)); - } else { - $PAGE->set_heading($course->fullname); - } - break; - case CONTEXT_MODULE: - $PAGE->set_heading(print_context_name($context, false)); - $PAGE->set_cacheable(false); - break; - case CONTEXT_BLOCK: - $PAGE->set_heading($PAGE->course->fullname); - break; -} - -echo $OUTPUT->header(); - -// Print heading. -echo $OUTPUT->heading_with_help($title, 'assignroles', 'role'); - -if ($roleid) { - // Show UI for assigning a particular role to users. - // Print a warning if we are assigning system roles. - if ($context->contextlevel == CONTEXT_SYSTEM) { - echo $OUTPUT->box(get_string('globalroleswarning', 'role')); - } - - // Print the form. -$assignurl = new moodle_url($PAGE->url, array('roleid'=>$roleid)); -?> - - -requires->js_init_call('M.core_role.init_add_assign_page'); - - if (!empty($errors)) { - $msg = '';
- foreach ($errors as $e) {
- $msg .= $e.'
';
- }
- $msg .= '
';
+ foreach ($errors as $e) {
+ $msg .= $e.'
';
+ }
+ $msg .= '