コード例 #1
0
function bigbluebuttonbn_get_participant_list($bigbluebuttonbn = null, $context = null)
{
    global $USER;
    $participant_list_array = array();
    if ($bigbluebuttonbn != null) {
        $participant_list = json_decode(htmlspecialchars_decode($bigbluebuttonbn->participants));
        if (is_array($participant_list)) {
            foreach ($participant_list as $participant) {
                array_push($participant_list_array, array("selectiontype" => $participant->selectiontype, "selectionid" => $participant->selectionid, "role" => $participant->role));
            }
        }
    } else {
        array_push($participant_list_array, array("selectiontype" => "all", "selectionid" => "all", "role" => BIGBLUEBUTTONBN_ROLE_VIEWER));
        $users = bigbluebuttonbn_get_users($context);
        foreach ($users as $user) {
            if ($user['id'] == $USER->id) {
                array_push($participant_list_array, array("selectiontype" => "user", "selectionid" => $USER->id, "role" => BIGBLUEBUTTONBN_ROLE_MODERATOR));
                break;
            }
        }
        /*
        array_push($participant_list_array,
                array(
                    "selectiontype" => "role",
                    "selectionid" => "editingteacher",
                    "role" => BIGBLUEBUTTONBN_ROLE_MODERATOR
                )
        );
        */
    }
    return $participant_list_array;
}
コード例 #2
0
 function definition()
 {
     global $CFG, $DB, $PAGE, $USER;
     $course_id = optional_param('course', 0, PARAM_INT);
     // course_module ID, or
     $course_module_id = optional_param('update', 0, PARAM_INT);
     // course_module ID, or
     if ($course_id) {
         $course = $DB->get_record('course', array('id' => $course_id), '*', MUST_EXIST);
         $bigbluebuttonbn = null;
     } else {
         if ($course_module_id) {
             $cm = get_coursemodule_from_id('bigbluebuttonbn', $course_module_id, 0, false, MUST_EXIST);
             $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
             $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $cm->instance), '*', MUST_EXIST);
         }
     }
     if ($CFG->version < '2013111800') {
         //This is valid before v2.6
         $context = get_context_instance(CONTEXT_COURSE, $course->id);
     } else {
         //This is valid after v2.6
         $context = context_course::instance($course->id);
     }
     //error_log('context: ' . print_r($context, true));
     //BigBlueButton server data
     $url = trim(trim($CFG->BigBlueButtonBNServerURL), '/') . '/';
     $salt = trim($CFG->BigBlueButtonBNSecuritySalt);
     //Validates if the BigBlueButton server is running
     $serverVersion = bigbluebuttonbn_getServerVersion($url);
     if (!isset($serverVersion)) {
         print_error('general_error_unable_connect', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
     }
     $mform =& $this->_form;
     $current_activity =& $this->current;
     //-------------------------------------------------------------------------------
     // First block starts here
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('mod_form_block_general', 'bigbluebuttonbn'));
     $mform->addElement('text', 'name', get_string('mod_form_field_name', 'bigbluebuttonbn'), 'maxlength="64" size="32"');
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->setType('name', PARAM_TEXT);
     $mform->addElement('textarea', 'welcome', get_string('mod_form_field_welcome', 'bigbluebuttonbn'), 'wrap="virtual" rows="5" cols="60"');
     $mform->addHelpButton('welcome', 'mod_form_field_welcome', 'bigbluebuttonbn');
     //$mform->addElement('text', 'voicebridge', get_string('mod_form_field_voicebridge','bigbluebuttonbn'), 'maxlength="5" size="10"' );
     //$mform->setDefault( 'voicebridge', 0 );
     //$mform->addHelpButton('voicebridge', 'mod_form_field_voicebridge', 'bigbluebuttonbn');
     $mform->addElement('checkbox', 'newwindow', get_string('mod_form_field_newwindow', 'bigbluebuttonbn'));
     $mform->setDefault('newwindow', 0);
     $mform->addElement('checkbox', 'wait', get_string('mod_form_field_wait', 'bigbluebuttonbn'));
     $mform->setDefault('wait', 1);
     $mform->addElement('text', 'userlimit', get_string('mod_form_field_userlimit', 'bigbluebuttonbn'), 'maxlength="3" size="5"');
     $mform->addHelpButton('userlimit', 'mod_form_field_userlimit', 'bigbluebuttonbn');
     $mform->setDefault('userlimit', 0);
     $mform->setType('userlimit', PARAM_TEXT);
     //-------------------------------------------------------------------------------
     // First block ends here
     //-------------------------------------------------------------------------------
     //-------------------------------------------------------------------------------
     // Second block starts here
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('mod_form_block_participants', 'bigbluebuttonbn'));
     //$mform->addElement( 'checkbox', 'allmoderators', get_string('mod_form_field_allmoderators', 'bigbluebuttonbn') );
     //$mform->setDefault( 'allmoderators', 0 );
     // Data required for "Add participant" and initial "Participant list" setup
     $roles = bigbluebuttonbn_get_roles();
     $users = bigbluebuttonbn_get_users($context);
     $participant_list = bigbluebuttonbn_get_participant_list($bigbluebuttonbn != null ? $bigbluebuttonbn : null, $context);
     $mform->addElement('hidden', 'participants', json_encode($participant_list));
     $mform->setType('participants', PARAM_TEXT);
     $html_participant_selection = '' . '<div id="fitem_bigbluebuttonbn_participant_selection" class="fitem fitem_fselect">' . "\n" . '  <div class="fitemtitle">' . "\n" . '    <label for="bigbluebuttonbn_participant_selectiontype">' . get_string('mod_form_field_participant_add', 'bigbluebuttonbn') . ' </label>' . "\n" . '  </div>' . "\n" . '  <div class="felement fselect">' . "\n" . '    <select id="bigbluebuttonbn_participant_selection_type" onchange="bigbluebuttonbn_participant_selection_set(); return 0;">' . "\n" . '      <option value="all" selected="selected">' . get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn') . '</option>' . "\n" . '      <option value="role">' . get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn') . '</option>' . "\n" . '      <option value="user">' . get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn') . '</option>' . "\n" . '    </select>' . "\n" . '    &nbsp;&nbsp;' . "\n" . '    <select id="bigbluebuttonbn_participant_selection" disabled="disabled">' . "\n" . '      <option value="all" selected="selected">---------------</option>' . "\n" . '    </select>' . "\n" . '    &nbsp;&nbsp;' . "\n" . '    <input value="' . get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn') . '" type="button" id="id_addselectionid" onclick="bigbluebuttonbn_participant_add(); return 0;" />' . "\n" . '  </div>' . "\n" . '</div>' . "\n" . '<div id="fitem_bigbluebuttonbn_participant_list" class="fitem">' . "\n" . '  <div class="fitemtitle">' . "\n" . '    <label for="bigbluebuttonbn_participant_list">' . get_string('mod_form_field_participant_list', 'bigbluebuttonbn') . ' </label>' . "\n" . '  </div>' . "\n" . '  <div class="felement fselect">' . "\n" . '    <table id="participant_list_table">' . "\n";
     // Add participant list
     foreach ($participant_list as $participant) {
         $participant_selectionid = '';
         $participant_selectiontype = $participant['selectiontype'];
         if ($participant_selectiontype == 'all') {
             $participant_selectiontype = '<b><i>' . get_string('mod_form_field_participant_list_type_' . $participant_selectiontype, 'bigbluebuttonbn') . '</i></b>';
         } else {
             if ($participant_selectiontype == 'role') {
                 $participant_selectionid = bigbluebuttonbn_get_role_name($participant['selectionid']);
             } else {
                 foreach ($users as $user) {
                     if ($user["id"] == $participant['selectionid']) {
                         $participant_selectionid = $user["name"];
                         break;
                     }
                 }
             }
             $participant_selectiontype = '<b><i>' . get_string('mod_form_field_participant_list_type_' . $participant_selectiontype, 'bigbluebuttonbn') . ':</i></b>&nbsp;';
         }
         $participant_role = get_string('mod_form_field_participant_bbb_role_' . $participant['role'], 'bigbluebuttonbn');
         $html_participant_selection .= '' . '      <tr id="participant_list_tr_' . $participant['selectiontype'] . '-' . $participant['selectionid'] . '">' . "\n" . '        <td width="20px"><a onclick="bigbluebuttonbn_participant_remove(\'' . $participant['selectiontype'] . '\', \'' . $participant['selectionid'] . '\'); return 0;" title="' . get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn') . '">x</a></td>' . "\n" . '        <td width="125px">' . $participant_selectiontype . '</td>' . "\n" . '        <td>' . $participant_selectionid . '</td>' . "\n" . '        <td><i>&nbsp;' . get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn') . '&nbsp;</i>' . "\n" . '          <select id="participant_list_role_' . $participant['selectiontype'] . '-' . $participant['selectionid'] . '" onchange="bigbluebuttonbn_participant_list_role_update(\'' . $participant['selectiontype'] . '\', \'' . $participant['selectionid'] . '\'); return 0;">' . "\n" . '            <option value="' . BIGBLUEBUTTONBN_ROLE_VIEWER . '" ' . ($participant['role'] == BIGBLUEBUTTONBN_ROLE_VIEWER ? 'selected="selected" ' : '') . '>' . get_string('mod_form_field_participant_bbb_role_' . BIGBLUEBUTTONBN_ROLE_VIEWER, 'bigbluebuttonbn') . '</option>' . "\n" . '            <option value="' . BIGBLUEBUTTONBN_ROLE_MODERATOR . '" ' . ($participant['role'] == BIGBLUEBUTTONBN_ROLE_MODERATOR ? 'selected="selected" ' : '') . '>' . get_string('mod_form_field_participant_bbb_role_' . BIGBLUEBUTTONBN_ROLE_MODERATOR, 'bigbluebuttonbn') . '</option><select>' . "\n" . '        </td>' . "\n" . '      </tr>' . "\n";
     }
     $html_participant_selection .= '' . '    </table>' . "\n" . '  </div>' . "\n" . '</div>' . "\n" . '<script type="text/javascript" src="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/mod_form.js">' . "\n" . '</script>' . "\n";
     $mform->addElement('html', $html_participant_selection);
     // Add data
     $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_selection = {"all": [], "role": ' . json_encode($roles) . ', "user": '******'}; </script>');
     $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_list = ' . json_encode($participant_list) . '; </script>');
     $bigbluebuttonbn_strings = array("as" => get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn'), "viewer" => get_string('mod_form_field_participant_bbb_role_viewer', 'bigbluebuttonbn'), "moderator" => get_string('mod_form_field_participant_bbb_role_moderator', 'bigbluebuttonbn'), "remove" => get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn'));
     $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_strings = ' . json_encode($bigbluebuttonbn_strings) . '; </script>');
     //-------------------------------------------------------------------------------
     // Second block ends here
     //-------------------------------------------------------------------------------
     //-------------------------------------------------------------------------------
     // Third block starts here
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('mod_form_block_schedule', 'bigbluebuttonbn'));
     $mform->addElement('date_time_selector', 'timeavailable', get_string('mod_form_field_availabledate', 'bigbluebuttonbn'), array('optional' => true));
     $mform->setDefault('timeavailable', 0);
     $mform->addElement('date_time_selector', 'timedue', get_string('mod_form_field_duedate', 'bigbluebuttonbn'), array('optional' => true));
     $mform->setDefault('timedue', 0);
     //-------------------------------------------------------------------------------
     // Third block ends here
     //-------------------------------------------------------------------------------
     //-------------------------------------------------------------------------------
     // Fourth block starts here
     //-------------------------------------------------------------------------------
     if (floatval($serverVersion) >= 0.8) {
         $mform->addElement('header', 'general', get_string('mod_form_block_record', 'bigbluebuttonbn'));
         $mform->addElement('checkbox', 'record', get_string('mod_form_field_record', 'bigbluebuttonbn'));
         $mform->setDefault('record', 0);
         $mform->addElement('text', 'description', get_string('mod_form_field_description', 'bigbluebuttonbn'), 'maxlength="100" size="32"');
         $mform->addHelpButton('description', 'mod_form_field_description', 'bigbluebuttonbn');
         $mform->setType('description', PARAM_TEXT);
         //$mform->addElement('duration', 'timeduration', get_string('mod_form_field_duration', 'bigbluebuttonbn')); //Set zero for unlimited
         //$mform->setDefault('timeduration', 14400);
         //$mform->addHelpButton('timeduration', 'mod_form_field_duration', 'bigbluebuttonbn');
     }
     //-------------------------------------------------------------------------------
     // Fourth block ends here
     //-------------------------------------------------------------------------------
     //-------------------------------------------------------------------------------
     // add standard elements, common to all modules
     $this->standard_coursemodule_elements();
     //$this->standard_hidden_coursemodule_elements();
     //-------------------------------------------------------------------------------
     // add standard buttons, common to all modules
     $this->add_action_buttons();
 }
コード例 #3
0
function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message = "")
{
    global $CFG, $DB;
    $context = bigbluebuttonbn_get_context_course($bigbluebuttonbn->course);
    $course = $DB->get_record('course', array('id' => $bigbluebuttonbn->course), '*', MUST_EXIST);
    //Complete message
    $msg = new stdClass();
    $msg->user_name = fullname($sender);
    $msg->user_email = $sender->email;
    $msg->course_name = $course->fullname;
    $message .= get_string('email_footer', 'bigbluebuttonbn', $msg);
    $users = bigbluebuttonbn_get_users($context);
    foreach ($users as $user) {
        if ($user->id != $sender->id) {
            $messageid = message_post_message($sender, $user, $message, FORMAT_HTML);
            if (!empty($messageid)) {
                error_log("Msg to " . $msg->user_name . " was sent.");
            } else {
                error_log("Msg to " . $msg->user_name . " was NOT sent.");
            }
        }
    }
}
コード例 #4
0
function bigbluebuttonbn_get_participant_list($bigbluebuttonbn = null, $context = null)
{
    global $CFG, $USER;
    $participant_list_array = array();
    if ($bigbluebuttonbn != null) {
        $participant_list = json_decode($bigbluebuttonbn->participants);
        if (is_array($participant_list)) {
            foreach ($participant_list as $participant) {
                array_push($participant_list_array, array("selectiontype" => $participant->selectiontype, "selectionid" => $participant->selectionid, "role" => $participant->role));
            }
        }
    } else {
        array_push($participant_list_array, array("selectiontype" => "all", "selectionid" => "all", "role" => BIGBLUEBUTTONBN_ROLE_VIEWER));
        $moderator_defaults = bigbluebuttonbn_get_cfg_moderator_default();
        if (!isset($moderator_defaults)) {
            $moderator_defaults = array('owner');
        } else {
            $moderator_defaults = explode(',', $moderator_defaults);
        }
        foreach ($moderator_defaults as $moderator_default) {
            if ($moderator_default == 'owner') {
                $users = bigbluebuttonbn_get_users($context);
                foreach ($users as $user) {
                    if ($user->id == $USER->id) {
                        array_push($participant_list_array, array("selectiontype" => "user", "selectionid" => $USER->id, "role" => BIGBLUEBUTTONBN_ROLE_MODERATOR));
                        break;
                    }
                }
            } else {
                array_push($participant_list_array, array("selectiontype" => "role", "selectionid" => $moderator_default, "role" => BIGBLUEBUTTONBN_ROLE_MODERATOR));
            }
        }
    }
    return $participant_list_array;
}
コード例 #5
0
 function definition()
 {
     global $CFG, $DB, $USER, $BIGBLUEBUTTONBN_CFG;
     $course_id = optional_param('course', 0, PARAM_INT);
     // course ID, or
     $course_module_id = optional_param('update', 0, PARAM_INT);
     // course_module ID, or
     $bigbluebuttonbn = null;
     if ($course_id) {
         $course = $DB->get_record('course', array('id' => $course_id), '*', MUST_EXIST);
     } else {
         if ($course_module_id) {
             $cm = get_coursemodule_from_id('bigbluebuttonbn', $course_module_id, 0, false, MUST_EXIST);
             $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
             $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $cm->instance), '*', MUST_EXIST);
         }
     }
     $context = bigbluebuttonbn_get_context_course($course->id);
     //BigBlueButton server data
     $endpoint = bigbluebuttonbn_get_cfg_server_url();
     //UI configuration options
     $voicebridge_editable = bigbluebuttonbn_get_cfg_voicebridge_editable();
     $recording_default = bigbluebuttonbn_get_cfg_recording_default();
     $recording_editable = bigbluebuttonbn_get_cfg_recording_editable();
     $recording_tagging_default = bigbluebuttonbn_get_cfg_recording_tagging_default();
     $recording_tagging_editable = bigbluebuttonbn_get_cfg_recording_tagging_editable();
     $waitformoderator_default = bigbluebuttonbn_get_cfg_waitformoderator_default();
     $waitformoderator_editable = bigbluebuttonbn_get_cfg_waitformoderator_editable();
     $userlimit_default = bigbluebuttonbn_get_cfg_userlimit_default();
     $userlimit_editable = bigbluebuttonbn_get_cfg_userlimit_editable();
     $preuploadpresentation_enabled = bigbluebuttonbn_get_cfg_preuploadpresentation_enabled();
     $sendnotifications_enabled = bigbluebuttonbn_get_cfg_sendnotifications_enabled();
     //Validates if the BigBlueButton server is running
     $serverVersion = bigbluebuttonbn_getServerVersion($endpoint);
     if (!isset($serverVersion)) {
         print_error('general_error_unable_connect', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
     }
     $mform =& $this->_form;
     $current_activity =& $this->current;
     //-------------------------------------------------------------------------------
     // First block starts here
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('mod_form_block_general', 'bigbluebuttonbn'));
     $mform->addElement('text', 'name', get_string('mod_form_field_name', 'bigbluebuttonbn'), 'maxlength="64" size="32"');
     $mform->setType('name', PARAM_TEXT);
     $mform->addRule('name', null, 'required', null, 'client');
     $version_major = bigbluebuttonbn_get_moodle_version_major();
     if ($version_major < '2015051100') {
         //This is valid before v2.9
         $this->add_intro_editor(false, get_string('mod_form_field_intro', 'bigbluebuttonbn'));
     } else {
         //This is valid after v2.9
         $this->standard_intro_elements(get_string('mod_form_field_intro', 'bigbluebuttonbn'));
     }
     $mform->setAdvanced('introeditor');
     $mform->setAdvanced('showdescription');
     $mform->addElement('textarea', 'welcome', get_string('mod_form_field_welcome', 'bigbluebuttonbn'), 'wrap="virtual" rows="5" cols="60"');
     $mform->addHelpButton('welcome', 'mod_form_field_welcome', 'bigbluebuttonbn');
     $mform->setType('welcome', PARAM_TEXT);
     $mform->setAdvanced('welcome');
     if ($voicebridge_editable) {
         $mform->addElement('text', 'voicebridge', get_string('mod_form_field_voicebridge', 'bigbluebuttonbn'), array('maxlength' => 4, 'size' => 6));
         $mform->addRule('voicebridge', get_string('mod_form_field_voicebridge_format_error', 'bigbluebuttonbn'), 'numeric', '####', 'server');
         $mform->setDefault('voicebridge', 0);
         $mform->addHelpButton('voicebridge', 'mod_form_field_voicebridge', 'bigbluebuttonbn');
         $mform->setAdvanced('voicebridge');
     }
     $mform->setType('voicebridge', PARAM_INT);
     if ($waitformoderator_editable) {
         $mform->addElement('checkbox', 'wait', get_string('mod_form_field_wait', 'bigbluebuttonbn'));
         $mform->addHelpButton('wait', 'mod_form_field_wait', 'bigbluebuttonbn');
         $mform->setDefault('wait', $waitformoderator_default);
         $mform->setAdvanced('wait');
     } else {
         $mform->addElement('hidden', 'wait', $waitformoderator_default);
     }
     $mform->setType('wait', PARAM_INT);
     if ($userlimit_editable) {
         $mform->addElement('text', 'userlimit', get_string('mod_form_field_userlimit', 'bigbluebuttonbn'), 'maxlength="3" size="5"');
         $mform->addHelpButton('userlimit', 'mod_form_field_userlimit', 'bigbluebuttonbn');
         $mform->setDefault('userlimit', $userlimit_default);
     } else {
         $mform->addElement('hidden', 'userlimit', $userlimit_default);
     }
     $mform->setType('userlimit', PARAM_TEXT);
     if (floatval($serverVersion) >= 0.8) {
         if ($recording_editable) {
             $mform->addElement('checkbox', 'record', get_string('mod_form_field_record', 'bigbluebuttonbn'));
             $mform->setDefault('record', $recording_default);
             $mform->setAdvanced('record');
         } else {
             $mform->addElement('hidden', 'record', $recording_default);
         }
         $mform->setType('record', PARAM_INT);
         if ($recording_tagging_editable) {
             $mform->addElement('checkbox', 'tagging', get_string('mod_form_field_recordingtagging', 'bigbluebuttonbn'));
             $mform->setDefault('tagging', $recording_tagging_default);
             $mform->setAdvanced('tagging');
         } else {
             $mform->addElement('hidden', 'tagging', $recording_tagging_default);
         }
         $mform->setType('tagging', PARAM_INT);
     }
     if ($sendnotifications_enabled) {
         $mform->addElement('checkbox', 'notification', get_string('mod_form_field_notification', 'bigbluebuttonbn'));
         if ($this->current->instance) {
             $mform->addHelpButton('notification', 'mod_form_field_notification', 'bigbluebuttonbn');
         } else {
             $mform->addHelpButton('notification', 'mod_form_field_notification', 'bigbluebuttonbn');
         }
         $mform->setDefault('notification', 0);
     }
     $mform->setType('notification', PARAM_INT);
     //-------------------------------------------------------------------------------
     // First block ends here
     //-------------------------------------------------------------------------------
     //-------------------------------------------------------------------------------
     // Second block starts here
     //-------------------------------------------------------------------------------
     if ($preuploadpresentation_enabled) {
         $mform->addElement('header', 'preupload', get_string('mod_form_block_presentation', 'bigbluebuttonbn'));
         $mform->setExpanded('preupload');
         $filemanager_options = array();
         $filemanager_options['accepted_types'] = '*';
         $filemanager_options['maxbytes'] = 0;
         $filemanager_options['subdirs'] = 0;
         $filemanager_options['maxfiles'] = 1;
         $filemanager_options['mainfile'] = true;
         $mform->addElement('filemanager', 'presentation', get_string('selectfiles'), null, $filemanager_options);
     }
     //-------------------------------------------------------------------------------
     // Second block ends here
     //-------------------------------------------------------------------------------
     //-------------------------------------------------------------------------------
     // Third block starts here
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'permission', get_string('mod_form_block_participants', 'bigbluebuttonbn'));
     // Data required for "Add participant" and initial "Participant list" setup
     $roles = bigbluebuttonbn_get_roles();
     $users = bigbluebuttonbn_get_users($context);
     $participant_list = bigbluebuttonbn_get_participant_list($bigbluebuttonbn, $context);
     $mform->addElement('hidden', 'participants', json_encode($participant_list));
     $mform->setType('participants', PARAM_TEXT);
     $html_participant_selection = '' . '<div id="fitem_bigbluebuttonbn_participant_selection" class="fitem fitem_fselect">' . "\n" . '  <div class="fitemtitle">' . "\n" . '    <label for="bigbluebuttonbn_participant_selectiontype">' . get_string('mod_form_field_participant_add', 'bigbluebuttonbn') . ' </label>' . "\n" . '  </div>' . "\n" . '  <div class="felement fselect">' . "\n" . '    <select id="bigbluebuttonbn_participant_selection_type" onchange="bigbluebuttonbn_participant_selection_set(); return 0;">' . "\n" . '      <option value="all" selected="selected">' . get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn') . '</option>' . "\n" . '      <option value="role">' . get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn') . '</option>' . "\n" . '      <option value="user">' . get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn') . '</option>' . "\n" . '    </select>' . "\n" . '    &nbsp;&nbsp;' . "\n" . '    <select id="bigbluebuttonbn_participant_selection" disabled="disabled">' . "\n" . '      <option value="all" selected="selected">---------------</option>' . "\n" . '    </select>' . "\n" . '    &nbsp;&nbsp;' . "\n" . '    <input value="' . get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn') . '" type="button" id="id_addselectionid" onclick="bigbluebuttonbn_participant_add(); return 0;" />' . "\n" . '  </div>' . "\n" . '</div>' . "\n" . '<div id="fitem_bigbluebuttonbn_participant_list" class="fitem">' . "\n" . '  <div class="fitemtitle">' . "\n" . '    <label for="bigbluebuttonbn_participant_list">' . get_string('mod_form_field_participant_list', 'bigbluebuttonbn') . ' </label>' . "\n" . '  </div>' . "\n" . '  <div class="felement fselect">' . "\n" . '    <table id="participant_list_table">' . "\n";
     // Add participant list
     foreach ($participant_list as $participant) {
         $participant_selectionid = '';
         $participant_selectiontype = $participant['selectiontype'];
         if ($participant_selectiontype == 'all') {
             $participant_selectiontype = '<b><i>' . get_string('mod_form_field_participant_list_type_' . $participant_selectiontype, 'bigbluebuttonbn') . '</i></b>';
         } else {
             if ($participant_selectiontype == 'role') {
                 $participant_selectionid = bigbluebuttonbn_get_role_name($participant['selectionid']);
             } else {
                 foreach ($users as $user) {
                     if ($user->id == $participant['selectionid']) {
                         $participant_selectionid = $user->firstname . ' ' . $user->lastname;
                         break;
                     }
                 }
             }
             $participant_selectiontype = '<b><i>' . get_string('mod_form_field_participant_list_type_' . $participant_selectiontype, 'bigbluebuttonbn') . ':</i></b>&nbsp;';
         }
         $html_participant_selection .= '' . '      <tr id="participant_list_tr_' . $participant['selectiontype'] . '-' . $participant['selectionid'] . '">' . "\n" . '        <td width="20px"><a onclick="bigbluebuttonbn_participant_remove(\'' . $participant['selectiontype'] . '\', \'' . $participant['selectionid'] . '\'); return 0;" title="' . get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn') . '">x</a></td>' . "\n" . '        <td width="125px">' . $participant_selectiontype . '</td>' . "\n" . '        <td>' . $participant_selectionid . '</td>' . "\n" . '        <td><i>&nbsp;' . get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn') . '&nbsp;</i>' . "\n" . '          <select id="participant_list_role_' . $participant['selectiontype'] . '-' . $participant['selectionid'] . '" onchange="bigbluebuttonbn_participant_list_role_update(\'' . $participant['selectiontype'] . '\', \'' . $participant['selectionid'] . '\'); return 0;">' . "\n" . '            <option value="' . BIGBLUEBUTTONBN_ROLE_VIEWER . '" ' . ($participant['role'] == BIGBLUEBUTTONBN_ROLE_VIEWER ? 'selected="selected" ' : '') . '>' . get_string('mod_form_field_participant_bbb_role_' . BIGBLUEBUTTONBN_ROLE_VIEWER, 'bigbluebuttonbn') . '</option>' . "\n" . '            <option value="' . BIGBLUEBUTTONBN_ROLE_MODERATOR . '" ' . ($participant['role'] == BIGBLUEBUTTONBN_ROLE_MODERATOR ? 'selected="selected" ' : '') . '>' . get_string('mod_form_field_participant_bbb_role_' . BIGBLUEBUTTONBN_ROLE_MODERATOR, 'bigbluebuttonbn') . '</option><select>' . "\n" . '        </td>' . "\n" . '      </tr>' . "\n";
     }
     $html_participant_selection .= '' . '    </table>' . "\n" . '  </div>' . "\n" . '</div>' . "\n" . '<script type="text/javascript" src="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/mod_form.js">' . "\n" . '</script>' . "\n";
     $mform->addElement('html', $html_participant_selection);
     // Add data
     $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_selection = {"all": [], "role": ' . json_encode($roles) . ', "user": '******'}; </script>');
     $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_list = ' . json_encode($participant_list) . '; </script>');
     $bigbluebuttonbn_strings = array("as" => get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn'), "viewer" => get_string('mod_form_field_participant_bbb_role_viewer', 'bigbluebuttonbn'), "moderator" => get_string('mod_form_field_participant_bbb_role_moderator', 'bigbluebuttonbn'), "remove" => get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn'));
     $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_strings = ' . json_encode($bigbluebuttonbn_strings) . '; </script>');
     //-------------------------------------------------------------------------------
     // Third block ends here
     //-------------------------------------------------------------------------------
     //-------------------------------------------------------------------------------
     // Fourth block starts here
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'schedule', get_string('mod_form_block_schedule', 'bigbluebuttonbn'));
     if (isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0) {
         $mform->setExpanded('schedule');
     }
     $mform->addElement('date_time_selector', 'openingtime', get_string('mod_form_field_openingtime', 'bigbluebuttonbn'), array('optional' => true));
     $mform->setDefault('openingtime', 0);
     $mform->addElement('date_time_selector', 'closingtime', get_string('mod_form_field_closingtime', 'bigbluebuttonbn'), array('optional' => true));
     $mform->setDefault('closingtime', 0);
     //-------------------------------------------------------------------------------
     // Fourth block ends here
     //-------------------------------------------------------------------------------
     //-------------------------------------------------------------------------------
     // add standard elements, common to all modules
     $this->standard_coursemodule_elements();
     //-------------------------------------------------------------------------------
     // add standard buttons, common to all modules
     $this->add_action_buttons();
 }