| @@ 47-122 (lines=76) @@ | ||
| 44 | * @throws \coding_exception |
|
| 45 | * @throws \dml_exception |
|
| 46 | */ |
|
| 47 | public static function bigbluebuttonbn_view_bbbsession_set($context, &$session) { |
|
| 48 | ||
| 49 | global $CFG, $USER; |
|
| 50 | ||
| 51 | $session['username'] = fullname($USER); |
|
| 52 | $session['userID'] = $USER->id; |
|
| 53 | $session['administrator'] = is_siteadmin($session['userID']); |
|
| 54 | $participantlist = bigbluebuttonbn_get_participant_list($session['bigbluebuttonbn'], $context); |
|
| 55 | $session['moderator'] = bigbluebuttonbn_is_moderator($context, $participantlist); |
|
| 56 | $session['managerecordings'] = ($session['administrator'] |
|
| 57 | || has_capability('mod/bigbluebuttonbn:managerecordings', $context)); |
|
| 58 | $session['importrecordings'] = ($session['managerecordings']); |
|
| 59 | $session['modPW'] = $session['bigbluebuttonbn']->moderatorpass; |
|
| 60 | $session['viewerPW'] = $session['bigbluebuttonbn']->viewerpass; |
|
| 61 | $session['meetingid'] = $session['bigbluebuttonbn']->meetingid.'-'.$session['course']->id.'-'. |
|
| 62 | $session['bigbluebuttonbn']->id; |
|
| 63 | $session['meetingname'] = $session['bigbluebuttonbn']->name; |
|
| 64 | $session['meetingdescription'] = $session['bigbluebuttonbn']->intro; |
|
| 65 | $session['userlimit'] = intval((int)\mod_bigbluebuttonbn\locallib\config::get('userlimit_default')); |
|
| 66 | if ((boolean)\mod_bigbluebuttonbn\locallib\config::get('userlimit_editable')) { |
|
| 67 | $session['userlimit'] = intval($session['bigbluebuttonbn']->userlimit); |
|
| 68 | } |
|
| 69 | $session['voicebridge'] = $session['bigbluebuttonbn']->voicebridge; |
|
| 70 | if ($session['bigbluebuttonbn']->voicebridge > 0) { |
|
| 71 | $session['voicebridge'] = 70000 + $session['bigbluebuttonbn']->voicebridge; |
|
| 72 | } |
|
| 73 | $session['wait'] = $session['bigbluebuttonbn']->wait; |
|
| 74 | $session['record'] = $session['bigbluebuttonbn']->record; |
|
| 75 | ||
| 76 | $session['recordallfromstart'] = $CFG->bigbluebuttonbn_recording_all_from_start_default; |
|
| 77 | if ($CFG->bigbluebuttonbn_recording_all_from_start_editable) { |
|
| 78 | $session['recordallfromstart'] = $session['bigbluebuttonbn']->recordallfromstart; |
|
| 79 | } |
|
| 80 | ||
| 81 | $session['recordhidebutton'] = $CFG->bigbluebuttonbn_recording_hide_button_default; |
|
| 82 | if ($CFG->bigbluebuttonbn_recording_hide_button_editable) { |
|
| 83 | $session['recordhidebutton'] = $session['bigbluebuttonbn']->recordhidebutton; |
|
| 84 | } |
|
| 85 | ||
| 86 | $session['welcome'] = $session['bigbluebuttonbn']->welcome; |
|
| 87 | if (!isset($session['welcome']) || $session['welcome'] == '') { |
|
| 88 | $session['welcome'] = get_string('mod_form_field_welcome_default', 'bigbluebuttonbn'); |
|
| 89 | } |
|
| 90 | if ($session['bigbluebuttonbn']->record) { |
|
| 91 | // Check if is enable record all from start. |
|
| 92 | if ($session['recordallfromstart']) { |
|
| 93 | $session['welcome'] .= '<br><br>'.get_string('bbbrecordallfromstartwarning', |
|
| 94 | 'bigbluebuttonbn'); |
|
| 95 | } else { |
|
| 96 | $session['welcome'] .= '<br><br>'.get_string('bbbrecordwarning', 'bigbluebuttonbn'); |
|
| 97 | } |
|
| 98 | } |
|
| 99 | $session['openingtime'] = $session['bigbluebuttonbn']->openingtime; |
|
| 100 | $session['closingtime'] = $session['bigbluebuttonbn']->closingtime; |
|
| 101 | $session['muteonstart'] = $session['bigbluebuttonbn']->muteonstart; |
|
| 102 | $session['context'] = $context; |
|
| 103 | $session['origin'] = 'Moodle'; |
|
| 104 | $session['originVersion'] = $CFG->release; |
|
| 105 | $parsedurl = parse_url($CFG->wwwroot); |
|
| 106 | $session['originServerName'] = $parsedurl['host']; |
|
| 107 | $session['originServerUrl'] = $CFG->wwwroot; |
|
| 108 | $session['originServerCommonName'] = ''; |
|
| 109 | $session['originTag'] = 'moodle-mod_bigbluebuttonbn ('.get_config('mod_bigbluebuttonbn', 'version').')'; |
|
| 110 | $session['bnserver'] = bigbluebuttonbn_is_bn_server(); |
|
| 111 | $session['clienttype'] = \mod_bigbluebuttonbn\locallib\config::get('clienttype_default'); |
|
| 112 | ||
| 113 | if (\mod_bigbluebuttonbn\locallib\config::get('clienttype_editable')) { |
|
| 114 | $session['clienttype'] = $session['bigbluebuttonbn']->clienttype; |
|
| 115 | } |
|
| 116 | ||
| 117 | if (!\mod_bigbluebuttonbn\locallib\config::clienttype_enabled()) { |
|
| 118 | $session['clienttype'] = BIGBLUEBUTTON_CLIENTTYPE_FLASH; |
|
| 119 | } |
|
| 120 | ||
| 121 | return($session); |
|
| 122 | } |
|
| 123 | ||
| 124 | /** |
|
| 125 | * Build url for join to session. |
|
| @@ 2974-3052 (lines=79) @@ | ||
| 2971 | * @param array $bbbsession |
|
| 2972 | * @return void |
|
| 2973 | */ |
|
| 2974 | function bigbluebuttonbn_view_bbbsession_set($context, &$bbbsession) { |
|
| 2975 | global $CFG, $USER; |
|
| 2976 | // User data. |
|
| 2977 | $bbbsession['username'] = fullname($USER); |
|
| 2978 | $bbbsession['userID'] = $USER->id; |
|
| 2979 | // User roles. |
|
| 2980 | $bbbsession['administrator'] = is_siteadmin($bbbsession['userID']); |
|
| 2981 | $participantlist = bigbluebuttonbn_get_participant_list($bbbsession['bigbluebuttonbn'], $context); |
|
| 2982 | $bbbsession['moderator'] = bigbluebuttonbn_is_moderator($context, $participantlist); |
|
| 2983 | $bbbsession['managerecordings'] = ($bbbsession['administrator'] |
|
| 2984 | || has_capability('mod/bigbluebuttonbn:managerecordings', $context)); |
|
| 2985 | $bbbsession['importrecordings'] = ($bbbsession['managerecordings']); |
|
| 2986 | // Server data. |
|
| 2987 | $bbbsession['modPW'] = $bbbsession['bigbluebuttonbn']->moderatorpass; |
|
| 2988 | $bbbsession['viewerPW'] = $bbbsession['bigbluebuttonbn']->viewerpass; |
|
| 2989 | // Database info related to the activity. |
|
| 2990 | $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'. |
|
| 2991 | $bbbsession['bigbluebuttonbn']->id; |
|
| 2992 | $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name; |
|
| 2993 | $bbbsession['meetingdescription'] = $bbbsession['bigbluebuttonbn']->intro; |
|
| 2994 | // Extra data for setting up the Meeting. |
|
| 2995 | $bbbsession['userlimit'] = intval((int)\mod_bigbluebuttonbn\locallib\config::get('userlimit_default')); |
|
| 2996 | if ((boolean)\mod_bigbluebuttonbn\locallib\config::get('userlimit_editable')) { |
|
| 2997 | $bbbsession['userlimit'] = intval($bbbsession['bigbluebuttonbn']->userlimit); |
|
| 2998 | } |
|
| 2999 | $bbbsession['voicebridge'] = $bbbsession['bigbluebuttonbn']->voicebridge; |
|
| 3000 | if ($bbbsession['bigbluebuttonbn']->voicebridge > 0) { |
|
| 3001 | $bbbsession['voicebridge'] = 70000 + $bbbsession['bigbluebuttonbn']->voicebridge; |
|
| 3002 | } |
|
| 3003 | $bbbsession['wait'] = $bbbsession['bigbluebuttonbn']->wait; |
|
| 3004 | $bbbsession['record'] = $bbbsession['bigbluebuttonbn']->record; |
|
| 3005 | $bbbsession['recordallfromstart'] = $CFG->bigbluebuttonbn_recording_all_from_start_default; |
|
| 3006 | if ($CFG->bigbluebuttonbn_recording_all_from_start_editable) { |
|
| 3007 | $bbbsession['recordallfromstart'] = $bbbsession['bigbluebuttonbn']->recordallfromstart; |
|
| 3008 | } |
|
| 3009 | ||
| 3010 | $bbbsession['recordhidebutton'] = $CFG->bigbluebuttonbn_recording_hide_button_default; |
|
| 3011 | if ($CFG->bigbluebuttonbn_recording_hide_button_editable) { |
|
| 3012 | $bbbsession['recordhidebutton'] = $bbbsession['bigbluebuttonbn']->recordhidebutton; |
|
| 3013 | } |
|
| 3014 | ||
| 3015 | $bbbsession['welcome'] = $bbbsession['bigbluebuttonbn']->welcome; |
|
| 3016 | if (!isset($bbbsession['welcome']) || $bbbsession['welcome'] == '') { |
|
| 3017 | $bbbsession['welcome'] = get_string('mod_form_field_welcome_default', 'bigbluebuttonbn'); |
|
| 3018 | } |
|
| 3019 | if ($bbbsession['bigbluebuttonbn']->record) { |
|
| 3020 | // Check if is enable record all from start. |
|
| 3021 | if ($bbbsession['recordallfromstart']) { |
|
| 3022 | $bbbsession['welcome'] .= '<br><br>'.get_string('bbbrecordallfromstartwarning', |
|
| 3023 | 'bigbluebuttonbn'); |
|
| 3024 | } else { |
|
| 3025 | $bbbsession['welcome'] .= '<br><br>'.get_string('bbbrecordwarning', 'bigbluebuttonbn'); |
|
| 3026 | } |
|
| 3027 | } |
|
| 3028 | $bbbsession['openingtime'] = $bbbsession['bigbluebuttonbn']->openingtime; |
|
| 3029 | $bbbsession['closingtime'] = $bbbsession['bigbluebuttonbn']->closingtime; |
|
| 3030 | $bbbsession['muteonstart'] = $bbbsession['bigbluebuttonbn']->muteonstart; |
|
| 3031 | // Additional info related to the course. |
|
| 3032 | $bbbsession['context'] = $context; |
|
| 3033 | // Metadata (origin). |
|
| 3034 | $bbbsession['origin'] = 'Moodle'; |
|
| 3035 | $bbbsession['originVersion'] = $CFG->release; |
|
| 3036 | $parsedurl = parse_url($CFG->wwwroot); |
|
| 3037 | $bbbsession['originServerName'] = $parsedurl['host']; |
|
| 3038 | $bbbsession['originServerUrl'] = $CFG->wwwroot; |
|
| 3039 | $bbbsession['originServerCommonName'] = ''; |
|
| 3040 | $bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn ('.get_config('mod_bigbluebuttonbn', 'version').')'; |
|
| 3041 | $bbbsession['bnserver'] = bigbluebuttonbn_is_bn_server(); |
|
| 3042 | // Setting for clienttype, assign flash if not enabled, or default if not editable. |
|
| 3043 | $bbbsession['clienttype'] = \mod_bigbluebuttonbn\locallib\config::get('clienttype_default'); |
|
| 3044 | if (\mod_bigbluebuttonbn\locallib\config::get('clienttype_editable')) { |
|
| 3045 | $bbbsession['clienttype'] = $bbbsession['bigbluebuttonbn']->clienttype; |
|
| 3046 | } |
|
| 3047 | if (!\mod_bigbluebuttonbn\locallib\config::clienttype_enabled()) { |
|
| 3048 | $bbbsession['clienttype'] = BIGBLUEBUTTON_CLIENTTYPE_FLASH; |
|
| 3049 | } |
|
| 3050 | } |
|
| 3051 | ||
| 3052 | /** |
|
| 3053 | * Return the status of an activity [open|not_started|ended]. |
|
| 3054 | * |
|
| 3055 | * @param array $bbbsession |
|