| @@ -137,7 +137,7 @@ | ||
| 137 | 137 | * Sign a string with a given key and algorithm. | 
| 138 | 138 | * | 
| 139 | 139 | * @param string $msg The message to sign | 
| 140 | - * @param string|resource $key The secret key | |
| 140 | + * @param string $key The secret key | |
| 141 | 141 | * @param string $alg The signing algorithm. Supported algorithms | 
| 142 | 142 | * are 'HS256', 'HS384', 'HS512' and 'RS256' | 
| 143 | 143 | * | 
| @@ -66,7 +66,6 @@ discard block | ||
| 66 | 66 | * will create a new instance and return the id number | 
| 67 | 67 | * of the new instance. | 
| 68 | 68 | * | 
| 69 | - * @param object $bigbluebuttonbn An object from the form in mod_form.php | |
| 70 | 69 | * @return int The id of the newly inserted bigbluebuttonbn record | 
| 71 | 70 | */ | 
| 72 | 71 |  function bigbluebuttonbn_add_instance($data, $mform) { | 
| @@ -93,7 +92,6 @@ discard block | ||
| 93 | 92 | * (defined by the form in mod_form.php) this function | 
| 94 | 93 | * will update an existing instance with new data. | 
| 95 | 94 | * | 
| 96 | - * @param object $bigbluebuttonbn An object from the form in mod_form.php | |
| 97 | 95 | * @return boolean Success/Fail | 
| 98 | 96 | */ | 
| 99 | 97 |  function bigbluebuttonbn_update_instance($data, $mform) { | 
| @@ -162,7 +160,7 @@ discard block | ||
| 162 | 160 | * $return->time = the time they did it | 
| 163 | 161 | * $return->info = a short text description | 
| 164 | 162 | * | 
| 165 | - * @return null | |
| 163 | + * @return boolean | |
| 166 | 164 | */ | 
| 167 | 165 |  function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) { | 
| 168 | 166 | return true; | 
| @@ -230,7 +228,7 @@ discard block | ||
| 230 | 228 | * See other modules as example. | 
| 231 | 229 | * | 
| 232 | 230 | * @param int $bigbluebuttonbnid ID of an instance of this module | 
| 233 | - * @return mixed boolean/array of students | |
| 231 | + * @return boolean boolean/array of students | |
| 234 | 232 | */ | 
| 235 | 233 |  function bigbluebuttonbn_get_participants($bigbluebuttonbnid) { | 
| 236 | 234 | return false; | 
| @@ -238,7 +236,7 @@ discard block | ||
| 238 | 236 | |
| 239 | 237 | /** | 
| 240 | 238 | * Returns all other caps used in module | 
| 241 | - * @return array | |
| 239 | + * @return string[] | |
| 242 | 240 | */ | 
| 243 | 241 |  function bigbluebuttonbn_get_extra_capabilities() { | 
| 244 | 242 |      return array('moodle/site:accessallgroups'); | 
| @@ -255,7 +253,7 @@ discard block | ||
| 255 | 253 | * as reference. | 
| 256 | 254 | * | 
| 257 | 255 | * @param int $bigbluebuttonbnid ID of an instance of this module | 
| 258 | - * @return mixed | |
| 256 | + * @return boolean | |
| 259 | 257 | */ | 
| 260 | 258 |  function bigbluebuttonbn_scale_used($bigbluebuttonbnid, $scaleid) { | 
| 261 | 259 | $return = false; | 
| @@ -288,7 +286,7 @@ discard block | ||
| 288 | 286 | |
| 289 | 287 | /** | 
| 290 | 288 | * List of view style log actions | 
| 291 | - * @return array | |
| 289 | + * @return string[] | |
| 292 | 290 | */ | 
| 293 | 291 |  function bigbluebuttonbn_get_view_actions() { | 
| 294 | 292 |      return array('view', 'view all'); | 
| @@ -296,7 +294,7 @@ discard block | ||
| 296 | 294 | |
| 297 | 295 | /** | 
| 298 | 296 | * List of update style log actions | 
| 299 | - * @return array | |
| 297 | + * @return string[] | |
| 300 | 298 | */ | 
| 301 | 299 |  function bigbluebuttonbn_get_post_actions() { | 
| 302 | 300 |      return array('update', 'add', 'create', 'join', 'end', 'left', 'publish', 'unpublish', 'delete'); | 
| @@ -310,7 +308,7 @@ discard block | ||
| 310 | 308 | * | 
| 311 | 309 | * @global object | 
| 312 | 310 | * @param object $coursemodule | 
| 313 | - * @return object|null | |
| 311 | + * @return null|cached_cm_info | |
| 314 | 312 | */ | 
| 315 | 313 |  function bigbluebuttonbn_get_coursemodule_info($coursemodule) { | 
| 316 | 314 | global $CFG, $DB; | 
| @@ -502,7 +500,7 @@ discard block | ||
| 502 | 500 | * @param array $args extra arguments | 
| 503 | 501 | * @param bool $forcedownload whether or not force download | 
| 504 | 502 | * @param array $options additional options affecting the file serving | 
| 505 | - * @return bool false if file not found, does not return if found - justsend the file | |
| 503 | + * @return false|null false if file not found, does not return if found - justsend the file | |
| 506 | 504 | */ | 
| 507 | 505 |  function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) { | 
| 508 | 506 | global $CFG, $DB; | 
| @@ -241,7 +241,6 @@ discard block | ||
| 241 | 241 | |
| 242 | 242 | /** | 
| 243 | 243 |   * Prints single activity item prepared by {@see recordingsbn_get_recent_mod_activity()} | 
| 244 | - | |
| 245 | 244 | * @return void | 
| 246 | 245 | */ | 
| 247 | 246 |  function bigbluebuttonbn_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames) { | 
| @@ -359,9 +358,9 @@ discard block | ||
| 359 | 358 | $now = time(); | 
| 360 | 359 |          if ( $bigbluebuttonbn->openingtime and (!$bigbluebuttonbn->closingtime or $bigbluebuttonbn->closingtime > $now)) { // A bigbluebuttonbn is scheduled. | 
| 361 | 360 | $str = '<div class="bigbluebuttonbn overview"><div class="name">'. | 
| 362 | -                 get_string('modulename', 'bigbluebuttonbn').': <a '.($bigbluebuttonbn->visible ? '' : ' class="dimmed"'). | |
| 363 | - ' href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.'">'. | |
| 364 | - $bigbluebuttonbn->name.'</a></div>'; | |
| 361 | +                    get_string('modulename', 'bigbluebuttonbn').': <a '.($bigbluebuttonbn->visible ? '' : ' class="dimmed"'). | |
| 362 | + ' href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.'">'. | |
| 363 | + $bigbluebuttonbn->name.'</a></div>'; | |
| 365 | 364 |              if ( $bigbluebuttonbn->openingtime > $now ) { | 
| 366 | 365 |                  $str .= '<div class="info">'.get_string('starts_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).'</div>'; | 
| 367 | 366 |              } else { | 
| @@ -13,23 +13,23 @@ discard block | ||
| 13 | 13 | |
| 14 | 14 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 15 | 15 | |
| 16 | -require_once($CFG->dirroot.'/calendar/lib.php'); | |
| 17 | -require_once($CFG->dirroot.'/message/lib.php'); | |
| 18 | -require_once($CFG->dirroot.'/mod/lti/OAuth.php'); | |
| 19 | -require_once($CFG->libdir.'/accesslib.php'); | |
| 20 | -require_once($CFG->libdir.'/completionlib.php'); | |
| 21 | -require_once($CFG->libdir.'/datalib.php'); | |
| 22 | -require_once($CFG->libdir.'/coursecatlib.php'); | |
| 23 | -require_once($CFG->libdir.'/enrollib.php'); | |
| 24 | -require_once($CFG->libdir.'/filelib.php'); | |
| 25 | -require_once($CFG->libdir.'/formslib.php'); | |
| 26 | - | |
| 27 | -require_once(dirname(__FILE__).'/JWT.php'); | |
| 28 | - | |
| 29 | -if( file_exists(dirname(__FILE__).'/config.php') ) { | |
| 30 | - require_once(dirname(__FILE__).'/config.php'); | |
| 31 | -    if( isset($BIGBLUEBUTTONBN_CFG) ) { | |
| 32 | - $CFG = (object) array_merge((array)$CFG, (array)$BIGBLUEBUTTONBN_CFG); | |
| 16 | +require_once($CFG->dirroot . '/calendar/lib.php'); | |
| 17 | +require_once($CFG->dirroot . '/message/lib.php'); | |
| 18 | +require_once($CFG->dirroot . '/mod/lti/OAuth.php'); | |
| 19 | +require_once($CFG->libdir . '/accesslib.php'); | |
| 20 | +require_once($CFG->libdir . '/completionlib.php'); | |
| 21 | +require_once($CFG->libdir . '/datalib.php'); | |
| 22 | +require_once($CFG->libdir . '/coursecatlib.php'); | |
| 23 | +require_once($CFG->libdir . '/enrollib.php'); | |
| 24 | +require_once($CFG->libdir . '/filelib.php'); | |
| 25 | +require_once($CFG->libdir . '/formslib.php'); | |
| 26 | + | |
| 27 | +require_once(dirname(__FILE__) . '/JWT.php'); | |
| 28 | + | |
| 29 | +if (file_exists(dirname(__FILE__) . '/config.php')) { | |
| 30 | + require_once(dirname(__FILE__) . '/config.php'); | |
| 31 | +    if (isset($BIGBLUEBUTTONBN_CFG)) { | |
| 32 | + $CFG = (object)array_merge((array)$CFG, (array)$BIGBLUEBUTTONBN_CFG); | |
| 33 | 33 | } | 
| 34 | 34 |  } else { | 
| 35 | 35 | $BIGBLUEBUTTONBN_CFG = new stdClass(); | 
| @@ -53,7 +53,7 @@ discard block | ||
| 53 | 53 | const BIGBLUEBUTTONBN_LOG_EVENT_DELETE = "Delete"; | 
| 54 | 54 | |
| 55 | 55 |  function bigbluebuttonbn_supports($feature) { | 
| 56 | -    switch($feature) { | |
| 56 | +    switch ($feature) { | |
| 57 | 57 | case FEATURE_IDNUMBER: return true; | 
| 58 | 58 | case FEATURE_GROUPS: return true; | 
| 59 | 59 | case FEATURE_GROUPINGS: return true; | 
| @@ -82,7 +82,7 @@ discard block | ||
| 82 | 82 |  function bigbluebuttonbn_add_instance($data, $mform) { | 
| 83 | 83 | global $DB, $CFG; | 
| 84 | 84 | |
| 85 | - $draftitemid = isset($data->presentation)? $data->presentation: null; | |
| 85 | + $draftitemid = isset($data->presentation) ? $data->presentation : null; | |
| 86 | 86 | $context = bigbluebuttonbn_get_context_module($data->coursemodule); | 
| 87 | 87 | |
| 88 | 88 | bigbluebuttonbn_process_pre_save($data); | 
| @@ -110,7 +110,7 @@ discard block | ||
| 110 | 110 | global $DB, $CFG; | 
| 111 | 111 | |
| 112 | 112 | $data->id = $data->instance; | 
| 113 | - $draftitemid = isset($data->presentation)? $data->presentation: null; | |
| 113 | + $draftitemid = isset($data->presentation) ? $data->presentation : null; | |
| 114 | 114 | $context = bigbluebuttonbn_get_context_module($data->coursemodule); | 
| 115 | 115 | |
| 116 | 116 | bigbluebuttonbn_process_pre_save($data); | 
| @@ -136,7 +136,7 @@ discard block | ||
| 136 | 136 |  function bigbluebuttonbn_delete_instance($id) { | 
| 137 | 137 | global $CFG, $DB, $USER; | 
| 138 | 138 | |
| 139 | -    if (! $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $id))) { | |
| 139 | +    if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $id))) { | |
| 140 | 140 | return false; | 
| 141 | 141 | } | 
| 142 | 142 | |
| @@ -154,11 +154,11 @@ discard block | ||
| 154 | 154 | //if( bigbluebuttonbn_isMeetingRunning($meetingID, $url, $shared_secret) ) | 
| 155 | 155 | // $getArray = bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $url, $shared_secret ); | 
| 156 | 156 | |
| 157 | -    if (! $DB->delete_records('bigbluebuttonbn', array('id' => $bigbluebuttonbn->id))) { | |
| 157 | +    if (!$DB->delete_records('bigbluebuttonbn', array('id' => $bigbluebuttonbn->id))) { | |
| 158 | 158 | $result = false; | 
| 159 | 159 | } | 
| 160 | 160 | |
| 161 | -    if (! $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) { | |
| 161 | +    if (!$DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) { | |
| 162 | 162 | $result = false; | 
| 163 | 163 | } | 
| 164 | 164 | |
| @@ -173,17 +173,17 @@ discard block | ||
| 173 | 173 | |
| 174 | 174 |      $logs = $DB->get_records('bigbluebuttonbn_logs', array('bigbluebuttonbnid' => $bigbluebuttonbn->id, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_CREATE)); | 
| 175 | 175 | $has_recordings = 'false'; | 
| 176 | -    if (! empty($logs) ) { | |
| 177 | -        foreach ( $logs as $l ) { | |
| 176 | +    if (!empty($logs)) { | |
| 177 | +        foreach ($logs as $l) { | |
| 178 | 178 | $meta = json_decode($l->meta); | 
| 179 | -            if ( $meta->record ) { | |
| 179 | +            if ($meta->record) { | |
| 180 | 180 | $has_recordings = 'true'; | 
| 181 | 181 | } | 
| 182 | 182 | } | 
| 183 | 183 | } | 
| 184 | 184 |      $log->meta = "{\"has_recordings\":{$has_recordings}}"; | 
| 185 | 185 | |
| 186 | -    if (! $returnid = $DB->insert_record('bigbluebuttonbn_logs', $log)) { | |
| 186 | +    if (!$returnid = $DB->insert_record('bigbluebuttonbn_logs', $log)) { | |
| 187 | 187 | $result = false; | 
| 188 | 188 | } | 
| 189 | 189 | |
| @@ -221,7 +221,7 @@ discard block | ||
| 221 | 221 | * @return boolean | 
| 222 | 222 | */ | 
| 223 | 223 |  function bigbluebuttonbn_print_recent_activity($course, $isteacher, $timestart) { | 
| 224 | - return false; // True if anything was printed, otherwise false | |
| 224 | + return false; // True if anything was printed, otherwise false | |
| 225 | 225 | } | 
| 226 | 226 | |
| 227 | 227 | /** | 
| @@ -236,7 +236,7 @@ discard block | ||
| 236 | 236 | * @param int $groupid defaults to 0 | 
| 237 | 237 | * @return void adds items into $activities and increases $index | 
| 238 | 238 | */ | 
| 239 | -function bigbluebuttonbn_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) { | |
| 239 | +function bigbluebuttonbn_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid = 0, $groupid = 0) { | |
| 240 | 240 | } | 
| 241 | 241 | |
| 242 | 242 | /** | 
| @@ -254,7 +254,7 @@ discard block | ||
| 254 | 254 | * | 
| 255 | 255 | * @return boolean | 
| 256 | 256 | **/ | 
| 257 | -function bigbluebuttonbn_cron () { | |
| 257 | +function bigbluebuttonbn_cron() { | |
| 258 | 258 | return true; | 
| 259 | 259 | } | 
| 260 | 260 | |
| @@ -357,17 +357,17 @@ discard block | ||
| 357 | 357 | |
| 358 | 358 |      foreach ($bigbluebuttonbns as $bigbluebuttonbn) { | 
| 359 | 359 | $now = time(); | 
| 360 | -        if ( $bigbluebuttonbn->openingtime and (!$bigbluebuttonbn->closingtime or $bigbluebuttonbn->closingtime > $now)) { // A bigbluebuttonbn is scheduled. | |
| 361 | - $str = '<div class="bigbluebuttonbn overview"><div class="name">'. | |
| 362 | -                 get_string('modulename', 'bigbluebuttonbn').': <a '.($bigbluebuttonbn->visible ? '' : ' class="dimmed"'). | |
| 363 | - ' href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.'">'. | |
| 364 | - $bigbluebuttonbn->name.'</a></div>'; | |
| 365 | -            if ( $bigbluebuttonbn->openingtime > $now ) { | |
| 366 | -                $str .= '<div class="info">'.get_string('starts_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).'</div>'; | |
| 360 | +        if ($bigbluebuttonbn->openingtime and (!$bigbluebuttonbn->closingtime or $bigbluebuttonbn->closingtime > $now)) { // A bigbluebuttonbn is scheduled. | |
| 361 | + $str = '<div class="bigbluebuttonbn overview"><div class="name">' . | |
| 362 | +                 get_string('modulename', 'bigbluebuttonbn') . ': <a ' . ($bigbluebuttonbn->visible ? '' : ' class="dimmed"') . | |
| 363 | + ' href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule . '">' . | |
| 364 | + $bigbluebuttonbn->name . '</a></div>'; | |
| 365 | +            if ($bigbluebuttonbn->openingtime > $now) { | |
| 366 | +                $str .= '<div class="info">' . get_string('starts_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) . '</div>'; | |
| 367 | 367 |              } else { | 
| 368 | -                $str .= '<div class="info">'.get_string('started_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).'</div>'; | |
| 368 | +                $str .= '<div class="info">' . get_string('started_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) . '</div>'; | |
| 369 | 369 | } | 
| 370 | -            $str .= '<div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime).'</div></div>'; | |
| 370 | +            $str .= '<div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime) . '</div></div>'; | |
| 371 | 371 | |
| 372 | 372 |              if (empty($htmlarray[$bigbluebuttonbn->course]['bigbluebuttonbn'])) { | 
| 373 | 373 | $htmlarray[$bigbluebuttonbn->course]['bigbluebuttonbn'] = $str; | 
| @@ -392,7 +392,7 @@ discard block | ||
| 392 | 392 |  function bigbluebuttonbn_get_coursemodule_info($coursemodule) { | 
| 393 | 393 | global $CFG, $DB; | 
| 394 | 394 | |
| 395 | -    if ( !$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat')) { | |
| 395 | +    if (!$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id'=>$coursemodule->instance), 'id, name, intro, introformat')) { | |
| 396 | 396 | return NULL; | 
| 397 | 397 | } | 
| 398 | 398 | |
| @@ -418,10 +418,10 @@ discard block | ||
| 418 | 418 |  function bigbluebuttonbn_process_pre_save(&$bigbluebuttonbn) { | 
| 419 | 419 | global $DB, $CFG; | 
| 420 | 420 | |
| 421 | -    if ( !isset($bigbluebuttonbn->timecreated) || !$bigbluebuttonbn->timecreated ) { | |
| 421 | +    if (!isset($bigbluebuttonbn->timecreated) || !$bigbluebuttonbn->timecreated) { | |
| 422 | 422 | $bigbluebuttonbn->timecreated = time(); | 
| 423 | 423 | //Assign password only if it is a new activity | 
| 424 | -        if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) { | |
| 424 | +        if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) { | |
| 425 | 425 | $bigbluebuttonbn->moderatorpass = bigbluebuttonbn_random_password(12); | 
| 426 | 426 | $bigbluebuttonbn->viewerpass = bigbluebuttonbn_random_password(12); | 
| 427 | 427 | } | 
| @@ -430,11 +430,11 @@ discard block | ||
| 430 | 430 | $bigbluebuttonbn->timemodified = time(); | 
| 431 | 431 | } | 
| 432 | 432 | |
| 433 | - if (! isset($bigbluebuttonbn->wait)) | |
| 433 | + if (!isset($bigbluebuttonbn->wait)) | |
| 434 | 434 | $bigbluebuttonbn->wait = 0; | 
| 435 | - if (! isset($bigbluebuttonbn->record)) | |
| 435 | + if (!isset($bigbluebuttonbn->record)) | |
| 436 | 436 | $bigbluebuttonbn->record = 0; | 
| 437 | - if (! isset($bigbluebuttonbn->tagging)) | |
| 437 | + if (!isset($bigbluebuttonbn->tagging)) | |
| 438 | 438 | $bigbluebuttonbn->tagging = 0; | 
| 439 | 439 | |
| 440 | 440 | $bigbluebuttonbn->participants = htmlspecialchars_decode($bigbluebuttonbn->participants); | 
| @@ -453,8 +453,8 @@ discard block | ||
| 453 | 453 | |
| 454 | 454 | // Now that an id was assigned, generate and set the meetingid property based on | 
| 455 | 455 | // [Moodle Instance + Activity ID + BBB Secret] (but only for new activities) | 
| 456 | -    if( isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add) ) { | |
| 457 | - $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot.$bigbluebuttonbn->id.bigbluebuttonbn_get_cfg_shared_secret()); | |
| 456 | +    if (isset($bigbluebuttonbn->add) && !empty($bigbluebuttonbn->add)) { | |
| 457 | + $bigbluebuttonbn_meetingid = sha1($CFG->wwwroot . $bigbluebuttonbn->id . bigbluebuttonbn_get_cfg_shared_secret()); | |
| 458 | 458 |          $DB->set_field('bigbluebuttonbn', 'meetingid', $bigbluebuttonbn_meetingid, array('id' => $bigbluebuttonbn->id)); | 
| 459 | 459 |          $action = get_string('mod_form_field_notification_msg_created', 'bigbluebuttonbn'); | 
| 460 | 460 |      } else { | 
| @@ -463,7 +463,7 @@ discard block | ||
| 463 | 463 |      $at = get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn'); | 
| 464 | 464 | |
| 465 | 465 | // Add evento to the calendar when if openingtime is set | 
| 466 | -    if ( isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime ){ | |
| 466 | +    if (isset($bigbluebuttonbn->openingtime) && $bigbluebuttonbn->openingtime) { | |
| 467 | 467 | $event = new stdClass(); | 
| 468 | 468 | $event->name = $bigbluebuttonbn->name; | 
| 469 | 469 | $event->courseid = $bigbluebuttonbn->course; | 
| @@ -473,13 +473,13 @@ discard block | ||
| 473 | 473 | $event->instance = $bigbluebuttonbn->id; | 
| 474 | 474 | $event->timestart = $bigbluebuttonbn->openingtime; | 
| 475 | 475 | |
| 476 | -        if ( $bigbluebuttonbn->closingtime ){ | |
| 476 | +        if ($bigbluebuttonbn->closingtime) { | |
| 477 | 477 | $event->durationtime = $bigbluebuttonbn->closingtime - $bigbluebuttonbn->openingtime; | 
| 478 | 478 |          } else { | 
| 479 | 479 | $event->durationtime = 0; | 
| 480 | 480 | } | 
| 481 | 481 | |
| 482 | -        if ( $event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id)) ) { | |
| 482 | +        if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id))) { | |
| 483 | 483 | $calendarevent = calendar_event::load($event->id); | 
| 484 | 484 | $calendarevent->update($event); | 
| 485 | 485 |          } else { | 
| @@ -490,7 +490,7 @@ discard block | ||
| 490 | 490 |          $DB->delete_records('event', array('modulename'=>'bigbluebuttonbn', 'instance'=>$bigbluebuttonbn->id)); | 
| 491 | 491 | } | 
| 492 | 492 | |
| 493 | -    if( isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification ) { | |
| 493 | +    if (isset($bigbluebuttonbn->notification) && $bigbluebuttonbn->notification) { | |
| 494 | 494 | // Prepare message | 
| 495 | 495 | $msg = new stdClass(); | 
| 496 | 496 | |
| @@ -498,35 +498,35 @@ discard block | ||
| 498 | 498 | $msg->action = $action; | 
| 499 | 499 | $msg->activity_type = ""; | 
| 500 | 500 | $msg->activity_title = $bigbluebuttonbn->name; | 
| 501 | -        $message_text = '<p>'.$msg->activity_type.' "'.$msg->activity_title.'" '.get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn').' '.$msg->action.'.</p>'; | |
| 501 | +        $message_text = '<p>' . $msg->activity_type . ' "' . $msg->activity_title . '" ' . get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn') . ' ' . $msg->action . '.</p>'; | |
| 502 | 502 | |
| 503 | 503 | /// Add the meeting details to the message_body | 
| 504 | 504 | $msg->action = ucfirst($action); | 
| 505 | 505 | $msg->activity_description = ""; | 
| 506 | - if( !empty($bigbluebuttonbn->intro) ) | |
| 506 | + if (!empty($bigbluebuttonbn->intro)) | |
| 507 | 507 | $msg->activity_description = trim($bigbluebuttonbn->intro); | 
| 508 | 508 | $msg->activity_openingtime = ""; | 
| 509 | 509 |          if ($bigbluebuttonbn->openingtime) { | 
| 510 | - $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->openingtime); | |
| 510 | + $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime) . ' ' . $at . ' ' . calendar_time_representation($bigbluebuttonbn->openingtime); | |
| 511 | 511 | } | 
| 512 | 512 | $msg->activity_closingtime = ""; | 
| 513 | -        if ($bigbluebuttonbn->closingtime ) { | |
| 514 | - $msg->activity_closingtime = calendar_day_representation($bigbluebuttonbn->closingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->closingtime); | |
| 513 | +        if ($bigbluebuttonbn->closingtime) { | |
| 514 | + $msg->activity_closingtime = calendar_day_representation($bigbluebuttonbn->closingtime) . ' ' . $at . ' ' . calendar_time_representation($bigbluebuttonbn->closingtime); | |
| 515 | 515 | } | 
| 516 | 516 | $msg->activity_owner = fullname($USER); | 
| 517 | 517 | |
| 518 | -        $message_text .= '<p><b>'.$msg->activity_title.'</b> '.get_string('email_body_notification_meeting_details', 'bigbluebuttonbn').':'; | |
| 518 | +        $message_text .= '<p><b>' . $msg->activity_title . '</b> ' . get_string('email_body_notification_meeting_details', 'bigbluebuttonbn') . ':'; | |
| 519 | 519 | $message_text .= '<table border="0" style="margin: 5px 0 0 20px"><tbody>'; | 
| 520 | -        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_title', 'bigbluebuttonbn').': </td><td>'; | |
| 521 | - $message_text .= $msg->activity_title.'</td></tr>'; | |
| 522 | -        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_description', 'bigbluebuttonbn').': </td><td>'; | |
| 523 | - $message_text .= $msg->activity_description.'</td></tr>'; | |
| 524 | -        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn').': </td><td>'; | |
| 525 | - $message_text .= $msg->activity_openingtime.'</td></tr>'; | |
| 526 | -        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn').': </td><td>'; | |
| 527 | - $message_text .= $msg->activity_closingtime.'</td></tr>'; | |
| 528 | -        $message_text .= '<tr><td style="font-weight:bold;color:#555;">'.$msg->action.' '.get_string('email_body_notification_meeting_by', 'bigbluebuttonbn').': </td><td>'; | |
| 529 | - $message_text .= $msg->activity_owner.'</td></tr></tbody></table></p>'; | |
| 520 | +        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_title', 'bigbluebuttonbn') . ': </td><td>'; | |
| 521 | + $message_text .= $msg->activity_title . '</td></tr>'; | |
| 522 | +        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_description', 'bigbluebuttonbn') . ': </td><td>'; | |
| 523 | + $message_text .= $msg->activity_description . '</td></tr>'; | |
| 524 | +        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn') . ': </td><td>'; | |
| 525 | + $message_text .= $msg->activity_openingtime . '</td></tr>'; | |
| 526 | +        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn') . ': </td><td>'; | |
| 527 | + $message_text .= $msg->activity_closingtime . '</td></tr>'; | |
| 528 | +        $message_text .= '<tr><td style="font-weight:bold;color:#555;">' . $msg->action . ' ' . get_string('email_body_notification_meeting_by', 'bigbluebuttonbn') . ': </td><td>'; | |
| 529 | + $message_text .= $msg->activity_owner . '</td></tr></tbody></table></p>'; | |
| 530 | 530 | |
| 531 | 531 | // Send notification to all users enrolled | 
| 532 | 532 | bigbluebuttonbn_send_notification($USER, $bigbluebuttonbn, $message_text); | 
| @@ -577,7 +577,7 @@ discard block | ||
| 577 | 577 | * @param array $options additional options affecting the file serving | 
| 578 | 578 | * @return bool false if file not found, does not return if found - justsend the file | 
| 579 | 579 | */ | 
| 580 | -function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) { | |
| 580 | +function bigbluebuttonbn_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) { | |
| 581 | 581 | global $CFG, $DB; | 
| 582 | 582 | |
| 583 | 583 |      if ($context->contextlevel != CONTEXT_MODULE) { | 
| @@ -593,21 +593,21 @@ discard block | ||
| 593 | 593 | return false; | 
| 594 | 594 | } | 
| 595 | 595 | |
| 596 | -    if( sizeof($args) > 1 ) { | |
| 596 | +    if (sizeof($args) > 1) { | |
| 597 | 597 | $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'presentation_cache'); | 
| 598 | 598 | $presentation_nonce_key = sha1($bigbluebuttonbn->id); | 
| 599 | 599 | $presentation_nonce = $cache->get($presentation_nonce_key); | 
| 600 | 600 | $presentation_nonce_value = $presentation_nonce['value']; | 
| 601 | 601 | $presentation_nonce_counter = $presentation_nonce['counter']; | 
| 602 | 602 | |
| 603 | -        if( $args["0"] != $presentation_nonce_value ) { | |
| 603 | +        if ($args["0"] != $presentation_nonce_value) { | |
| 604 | 604 | return false; | 
| 605 | 605 | } | 
| 606 | 606 | |
| 607 | 607 | //The nonce value is actually used twice because BigBlueButton reads the file two times | 
| 608 | 608 | $presentation_nonce_counter += 1; | 
| 609 | -        if( $presentation_nonce_counter < 2 ) { | |
| 610 | - $cache->set($presentation_nonce_key, array( "value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter )); | |
| 609 | +        if ($presentation_nonce_counter < 2) { | |
| 610 | +            $cache->set($presentation_nonce_key, array("value" => $presentation_nonce_value, "counter" => $presentation_nonce_counter)); | |
| 611 | 611 |          } else { | 
| 612 | 612 | $cache->delete($presentation_nonce_key); | 
| 613 | 613 | } | 
| @@ -625,7 +625,7 @@ discard block | ||
| 625 | 625 | } | 
| 626 | 626 | |
| 627 | 627 |      if ($filearea === 'presentation') { | 
| 628 | - $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename; | |
| 628 | + $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename; | |
| 629 | 629 |      } else { | 
| 630 | 630 | return false; | 
| 631 | 631 | } | 
| @@ -659,16 +659,16 @@ discard block | ||
| 659 | 659 | * @package mod_bigbluebuttonbn | 
| 660 | 660 | * @return array a list of available roles | 
| 661 | 661 | */ | 
| 662 | -function bigbluebuttonbn_get_moodle_roles($rolename='all') { | |
| 663 | -    if( $rolename != 'all') { | |
| 662 | +function bigbluebuttonbn_get_moodle_roles($rolename = 'all') { | |
| 663 | +    if ($rolename != 'all') { | |
| 664 | 664 | $roles = array(bigbluebuttonbn_get_role($rolename)); | 
| 665 | 665 |      } else { | 
| 666 | - $roles = (array) role_get_names(); | |
| 666 | + $roles = (array)role_get_names(); | |
| 667 | 667 | } | 
| 668 | 668 | return $roles; | 
| 669 | 669 | } | 
| 670 | 670 | |
| 671 | -function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message="") { | |
| 671 | +function bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message = "") { | |
| 672 | 672 | global $CFG, $DB; | 
| 673 | 673 | |
| 674 | 674 | $context = bigbluebuttonbn_get_context_course($bigbluebuttonbn->course); | 
| @@ -679,12 +679,12 @@ discard block | ||
| 679 | 679 | $msg->user_name = fullname($sender); | 
| 680 | 680 | $msg->user_email = $sender->email; | 
| 681 | 681 | $msg->course_name = "$course->fullname"; | 
| 682 | -    $message .= '<p><hr/><br/>'.get_string('email_footer_sent_by', 'bigbluebuttonbn').' '.$msg->user_name.'('.$msg->user_email.') '; | |
| 683 | -    $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn').' '.$msg->course_name.'.</p>'; | |
| 682 | +    $message .= '<p><hr/><br/>' . get_string('email_footer_sent_by', 'bigbluebuttonbn') . ' ' . $msg->user_name . '(' . $msg->user_email . ') '; | |
| 683 | +    $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn') . ' ' . $msg->course_name . '.</p>'; | |
| 684 | 684 | |
| 685 | - $users = get_enrolled_users($context,'',0,'u.*',null,0,0,true); | |
| 686 | -    foreach( $users as $user ) { | |
| 687 | -        if( $user->id != $sender->id ){ | |
| 685 | + $users = get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true); | |
| 686 | +    foreach ($users as $user) { | |
| 687 | +        if ($user->id != $sender->id) { | |
| 688 | 688 | $messageid = message_post_message($sender, $user, $message, FORMAT_HTML); | 
| 689 | 689 | } | 
| 690 | 690 | } | 
| @@ -694,7 +694,7 @@ discard block | ||
| 694 | 694 | global $CFG; | 
| 695 | 695 | |
| 696 | 696 | $version_major = bigbluebuttonbn_get_moodle_version_major(); | 
| 697 | -    if ( $version_major < '2013111800' ) { | |
| 697 | +    if ($version_major < '2013111800') { | |
| 698 | 698 | //This is valid before v2.6 | 
| 699 | 699 | $context = get_context_instance(CONTEXT_MODULE, $id); | 
| 700 | 700 |      } else { | 
| @@ -709,7 +709,7 @@ discard block | ||
| 709 | 709 | global $CFG; | 
| 710 | 710 | |
| 711 | 711 | $version_major = bigbluebuttonbn_get_moodle_version_major(); | 
| 712 | -    if ( $version_major < '2013111800' ) { | |
| 712 | +    if ($version_major < '2013111800') { | |
| 713 | 713 | //This is valid before v2.6 | 
| 714 | 714 | $context = get_context_instance(CONTEXT_COURSE, $id); | 
| 715 | 715 |      } else { | 
| @@ -722,10 +722,10 @@ discard block | ||
| 722 | 722 | |
| 723 | 723 |  function bigbluebuttonbn_get_cfg_server_url() { | 
| 724 | 724 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 725 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url)? trim(trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url),'/').'/': (isset($CFG->bigbluebuttonbn_server_url)? trim(trim($CFG->bigbluebuttonbn_server_url),'/').'/': 'http://test-install.blindsidenetworks.com/bigbluebutton/')); | |
| 725 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) ? trim(trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url), '/') . '/' : (isset($CFG->bigbluebuttonbn_server_url) ? trim(trim($CFG->bigbluebuttonbn_server_url), '/') . '/' : 'http://test-install.blindsidenetworks.com/bigbluebutton/')); | |
| 726 | 726 | } | 
| 727 | 727 | |
| 728 | 728 |  function bigbluebuttonbn_get_cfg_shared_secret() { | 
| 729 | 729 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 730 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret): (isset($CFG->bigbluebuttonbn_shared_secret)? trim($CFG->bigbluebuttonbn_shared_secret): '8cd8ef52e8e101574e400365b55e11a6')); | |
| 730 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ? trim($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) : (isset($CFG->bigbluebuttonbn_shared_secret) ? trim($CFG->bigbluebuttonbn_shared_secret) : '8cd8ef52e8e101574e400365b55e11a6')); | |
| 731 | 731 | } | 
| @@ -430,12 +430,15 @@ discard block | ||
| 430 | 430 | $bigbluebuttonbn->timemodified = time(); | 
| 431 | 431 | } | 
| 432 | 432 | |
| 433 | - if (! isset($bigbluebuttonbn->wait)) | |
| 434 | - $bigbluebuttonbn->wait = 0; | |
| 435 | - if (! isset($bigbluebuttonbn->record)) | |
| 436 | - $bigbluebuttonbn->record = 0; | |
| 437 | - if (! isset($bigbluebuttonbn->tagging)) | |
| 438 | - $bigbluebuttonbn->tagging = 0; | |
| 433 | +    if (! isset($bigbluebuttonbn->wait)) { | |
| 434 | + $bigbluebuttonbn->wait = 0; | |
| 435 | + } | |
| 436 | +    if (! isset($bigbluebuttonbn->record)) { | |
| 437 | + $bigbluebuttonbn->record = 0; | |
| 438 | + } | |
| 439 | +    if (! isset($bigbluebuttonbn->tagging)) { | |
| 440 | + $bigbluebuttonbn->tagging = 0; | |
| 441 | + } | |
| 439 | 442 | |
| 440 | 443 | $bigbluebuttonbn->participants = htmlspecialchars_decode($bigbluebuttonbn->participants); | 
| 441 | 444 | } | 
| @@ -503,8 +506,9 @@ discard block | ||
| 503 | 506 | /// Add the meeting details to the message_body | 
| 504 | 507 | $msg->action = ucfirst($action); | 
| 505 | 508 | $msg->activity_description = ""; | 
| 506 | - if( !empty($bigbluebuttonbn->intro) ) | |
| 507 | - $msg->activity_description = trim($bigbluebuttonbn->intro); | |
| 509 | +        if( !empty($bigbluebuttonbn->intro) ) { | |
| 510 | + $msg->activity_description = trim($bigbluebuttonbn->intro); | |
| 511 | + } | |
| 508 | 512 | $msg->activity_openingtime = ""; | 
| 509 | 513 |          if ($bigbluebuttonbn->openingtime) { | 
| 510 | 514 | $msg->activity_openingtime = calendar_day_representation($bigbluebuttonbn->openingtime).' '.$at.' '.calendar_time_representation($bigbluebuttonbn->openingtime); | 
| @@ -190,27 +190,27 @@ | ||
| 190 | 190 | |
| 191 | 191 | //// Configuration for "scheduled duration" feature | 
| 192 | 192 |      if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled) ) { | 
| 193 | -      $settings->add( new admin_setting_heading('config_scheduled', | |
| 194 | -              get_string('config_scheduled', 'bigbluebuttonbn'), | |
| 195 | -              get_string('config_scheduled_description', 'bigbluebuttonbn'))); | |
| 193 | +        $settings->add( new admin_setting_heading('config_scheduled', | |
| 194 | +                get_string('config_scheduled', 'bigbluebuttonbn'), | |
| 195 | +                get_string('config_scheduled_description', 'bigbluebuttonbn'))); | |
| 196 | 196 | |
| 197 | - // calculated duration for 'scheduled session' feature | |
| 198 | -      $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_scheduled_duration_enabled', | |
| 199 | -              get_string('config_scheduled_duration_enabled', 'bigbluebuttonbn'), | |
| 200 | -              get_string('config_scheduled_duration_enabled_description', 'bigbluebuttonbn'), | |
| 201 | - 1)); | |
| 197 | + // calculated duration for 'scheduled session' feature | |
| 198 | +        $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_scheduled_duration_enabled', | |
| 199 | +                get_string('config_scheduled_duration_enabled', 'bigbluebuttonbn'), | |
| 200 | +                get_string('config_scheduled_duration_enabled_description', 'bigbluebuttonbn'), | |
| 201 | + 1)); | |
| 202 | 202 | |
| 203 | - // compensatory time for 'scheduled session' feature | |
| 204 | -      $settings->add(new admin_setting_configtext('bigbluebuttonbn_scheduled_duration_compensation', | |
| 205 | -              get_string('config_scheduled_duration_compensation', 'bigbluebuttonbn'), | |
| 206 | -              get_string('config_scheduled_duration_compensation_description', 'bigbluebuttonbn'), | |
| 207 | - 10, PARAM_INT)); | |
| 203 | + // compensatory time for 'scheduled session' feature | |
| 204 | +        $settings->add(new admin_setting_configtext('bigbluebuttonbn_scheduled_duration_compensation', | |
| 205 | +                get_string('config_scheduled_duration_compensation', 'bigbluebuttonbn'), | |
| 206 | +                get_string('config_scheduled_duration_compensation_description', 'bigbluebuttonbn'), | |
| 207 | + 10, PARAM_INT)); | |
| 208 | 208 | |
| 209 | - // pre-opening time for 'scheduled session' feature | |
| 210 | -      $settings->add(new admin_setting_configtext('bigbluebuttonbn_scheduled_pre_opening', | |
| 211 | -              get_string('config_scheduled_pre_opening', 'bigbluebuttonbn'), | |
| 212 | -              get_string('config_scheduled_pre_opening_description', 'bigbluebuttonbn'), | |
| 213 | - 10, PARAM_INT)); | |
| 209 | + // pre-opening time for 'scheduled session' feature | |
| 210 | +        $settings->add(new admin_setting_configtext('bigbluebuttonbn_scheduled_pre_opening', | |
| 211 | +                get_string('config_scheduled_pre_opening', 'bigbluebuttonbn'), | |
| 212 | +                get_string('config_scheduled_pre_opening_description', 'bigbluebuttonbn'), | |
| 213 | + 10, PARAM_INT)); | |
| 214 | 214 | } | 
| 215 | 215 | |
| 216 | 216 | //// Configuration for defining the default role/user that will be moderator on new activities | 
| @@ -13,52 +13,52 @@ discard block | ||
| 13 | 13 | |
| 14 | 14 | global $BIGBLUEBUTTONBN_CFG; | 
| 15 | 15 | |
| 16 | -require_once(dirname(__FILE__).'/locallib.php'); | |
| 16 | +require_once(dirname(__FILE__) . '/locallib.php'); | |
| 17 | 17 | |
| 18 | 18 |  if ($ADMIN->fulltree) { | 
| 19 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) || | |
| 20 | -        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ) { | |
| 21 | -        $settings->add( new admin_setting_heading('bigbluebuttonbn_config_general', | |
| 19 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) || | |
| 20 | +        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)) { | |
| 21 | +        $settings->add(new admin_setting_heading('bigbluebuttonbn_config_general', | |
| 22 | 22 |                  get_string('config_general', 'bigbluebuttonbn'), | 
| 23 | 23 |                  get_string('config_general_description', 'bigbluebuttonbn'))); | 
| 24 | 24 | |
| 25 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) ) { | |
| 26 | - $settings->add( new admin_setting_configtext( 'bigbluebuttonbn_server_url', | |
| 27 | - get_string( 'config_server_url', 'bigbluebuttonbn' ), | |
| 28 | - get_string( 'config_server_url_description', 'bigbluebuttonbn' ), | |
| 25 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url)) { | |
| 26 | +            $settings->add(new admin_setting_configtext('bigbluebuttonbn_server_url', | |
| 27 | +                    get_string('config_server_url', 'bigbluebuttonbn'), | |
| 28 | +                    get_string('config_server_url_description', 'bigbluebuttonbn'), | |
| 29 | 29 | BIGBLUEBUTTONBN_DEFAULT_SERVER_URL)); | 
| 30 | 30 | } | 
| 31 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ) { | |
| 32 | - $settings->add( new admin_setting_configtext( 'bigbluebuttonbn_shared_secret', | |
| 33 | - get_string( 'config_shared_secret', 'bigbluebuttonbn' ), | |
| 34 | - get_string( 'config_shared_secret_description', 'bigbluebuttonbn' ), | |
| 31 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)) { | |
| 32 | +            $settings->add(new admin_setting_configtext('bigbluebuttonbn_shared_secret', | |
| 33 | +                    get_string('config_shared_secret', 'bigbluebuttonbn'), | |
| 34 | +                    get_string('config_shared_secret_description', 'bigbluebuttonbn'), | |
| 35 | 35 | BIGBLUEBUTTONBN_DEFAULT_SHARED_SECRET)); | 
| 36 | 36 | } | 
| 37 | 37 | } | 
| 38 | 38 | |
| 39 | 39 | //// Configuration for 'recording' feature | 
| 40 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) || | |
| 40 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) || | |
| 41 | 41 | !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable) || | 
| 42 | -        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled) ) { | |
| 43 | -        $settings->add( new admin_setting_heading('bigbluebuttonbn_recording', | |
| 42 | +        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled)) { | |
| 43 | +        $settings->add(new admin_setting_heading('bigbluebuttonbn_recording', | |
| 44 | 44 |                  get_string('config_feature_recording', 'bigbluebuttonbn'), | 
| 45 | 45 |                  get_string('config_feature_recording_description', 'bigbluebuttonbn'))); | 
| 46 | 46 | |
| 47 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) ) { | |
| 47 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default)) { | |
| 48 | 48 | // default value for 'recording' feature | 
| 49 | 49 |              $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recording_default', | 
| 50 | 50 |                      get_string('config_feature_recording_default', 'bigbluebuttonbn'), | 
| 51 | 51 |                      get_string('config_feature_recording_default_description', 'bigbluebuttonbn'), | 
| 52 | 52 | 1)); | 
| 53 | 53 | } | 
| 54 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable) ) { | |
| 54 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable)) { | |
| 55 | 55 | // UI for 'recording' feature | 
| 56 | 56 |              $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recording_editable', | 
| 57 | 57 |                      get_string('config_feature_recording_editable', 'bigbluebuttonbn'), | 
| 58 | 58 |                      get_string('config_feature_recording_editable_description', 'bigbluebuttonbn'), | 
| 59 | 59 | 1)); | 
| 60 | 60 | } | 
| 61 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled) ) { | |
| 61 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled)) { | |
| 62 | 62 | // Front panel for 'recording' managment feature | 
| 63 | 63 |              $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recording_icons_enabled', | 
| 64 | 64 |                      get_string('config_feature_recording_icons_enabled', 'bigbluebuttonbn'), | 
| @@ -68,13 +68,13 @@ discard block | ||
| 68 | 68 | } | 
| 69 | 69 | |
| 70 | 70 | //// Configuration for 'recording tagging' feature | 
| 71 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) || | |
| 72 | -        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable) ) { | |
| 73 | -        $settings->add( new admin_setting_heading('bigbluebuttonbn_recordingtagging', | |
| 71 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) || | |
| 72 | +        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable)) { | |
| 73 | +        $settings->add(new admin_setting_heading('bigbluebuttonbn_recordingtagging', | |
| 74 | 74 |                  get_string('config_feature_recordingtagging', 'bigbluebuttonbn'), | 
| 75 | 75 |                  get_string('config_feature_recordingtagging_description', 'bigbluebuttonbn'))); | 
| 76 | 76 | |
| 77 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) ) { | |
| 77 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default)) { | |
| 78 | 78 | // default value for 'recording tagging' feature | 
| 79 | 79 |              $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recordingtagging_default', | 
| 80 | 80 |                      get_string('config_feature_recordingtagging_default', 'bigbluebuttonbn'), | 
| @@ -82,7 +82,7 @@ discard block | ||
| 82 | 82 | 0)); | 
| 83 | 83 | } | 
| 84 | 84 | // UI for 'recording tagging' feature | 
| 85 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable) ) { | |
| 85 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable)) { | |
| 86 | 86 |              $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_recordingtagging_editable', | 
| 87 | 87 |                      get_string('config_feature_recordingtagging_editable', 'bigbluebuttonbn'), | 
| 88 | 88 |                      get_string('config_feature_recordingtagging_editable_description', 'bigbluebuttonbn'), | 
| @@ -91,20 +91,20 @@ discard block | ||
| 91 | 91 | } | 
| 92 | 92 | |
| 93 | 93 | //// Configuration for 'import recordings' feature | 
| 94 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) || | |
| 95 | -        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled) ) { | |
| 96 | -        $settings->add( new admin_setting_heading('bigbluebuttonbn_importrecordings', | |
| 94 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) || | |
| 95 | +        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled)) { | |
| 96 | +        $settings->add(new admin_setting_heading('bigbluebuttonbn_importrecordings', | |
| 97 | 97 |                  get_string('config_feature_importrecordings', 'bigbluebuttonbn'), | 
| 98 | 98 |                  get_string('config_feature_importrecordings_description', 'bigbluebuttonbn'))); | 
| 99 | 99 | |
| 100 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) ) { | |
| 100 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled)) { | |
| 101 | 101 | // default value for 'import recordings' feature | 
| 102 | 102 |              $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_importrecordings_enabled', | 
| 103 | 103 |                      get_string('config_feature_importrecordings_enabled', 'bigbluebuttonbn'), | 
| 104 | 104 |                      get_string('config_feature_importrecordings_enabled_description', 'bigbluebuttonbn'), | 
| 105 | 105 | 0)); | 
| 106 | 106 | } | 
| 107 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled) ) { | |
| 107 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled)) { | |
| 108 | 108 | // consider deleted activities for 'import recordings' feature | 
| 109 | 109 |              $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_importrecordings_from_deleted_activities_enabled', | 
| 110 | 110 |                      get_string('config_feature_importrecordings_from_deleted_activities_enabled', 'bigbluebuttonbn'), | 
| @@ -114,36 +114,36 @@ discard block | ||
| 114 | 114 | } | 
| 115 | 115 | |
| 116 | 116 | //// Configuration for wait for moderator feature | 
| 117 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) || | |
| 117 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) || | |
| 118 | 118 | !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable) || | 
| 119 | 119 | !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval) || | 
| 120 | -        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl) ) { | |
| 121 | -        $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_waitformoderator', | |
| 120 | +        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl)) { | |
| 121 | +        $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_waitformoderator', | |
| 122 | 122 |                  get_string('config_feature_waitformoderator', 'bigbluebuttonbn'), | 
| 123 | 123 |                  get_string('config_feature_waitformoderator_description', 'bigbluebuttonbn'))); | 
| 124 | 124 | |
| 125 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) ) { | |
| 125 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default)) { | |
| 126 | 126 | //default value for 'wait for moderator' feature | 
| 127 | 127 |              $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_waitformoderator_default', | 
| 128 | 128 |                      get_string('config_feature_waitformoderator_default', 'bigbluebuttonbn'), | 
| 129 | 129 |                      get_string('config_feature_waitformoderator_default_description', 'bigbluebuttonbn'), | 
| 130 | 130 | 0)); | 
| 131 | 131 | } | 
| 132 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable) ) { | |
| 132 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable)) { | |
| 133 | 133 | // UI for 'wait for moderator' feature | 
| 134 | 134 |              $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_waitformoderator_editable', | 
| 135 | 135 |                      get_string('config_feature_waitformoderator_editable', 'bigbluebuttonbn'), | 
| 136 | 136 |                      get_string('config_feature_waitformoderator_editable_description', 'bigbluebuttonbn'), | 
| 137 | 137 | 1)); | 
| 138 | 138 | } | 
| 139 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval) ) { | |
| 139 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval)) { | |
| 140 | 140 | //ping interval value for 'wait for moderator' feature | 
| 141 | 141 |              $settings->add(new admin_setting_configtext('bigbluebuttonbn_waitformoderator_ping_interval', | 
| 142 | 142 |                      get_string('config_feature_waitformoderator_ping_interval', 'bigbluebuttonbn'), | 
| 143 | 143 |                      get_string('config_feature_waitformoderator_ping_interval_description', 'bigbluebuttonbn'), | 
| 144 | 144 | 10, PARAM_INT)); | 
| 145 | 145 | } | 
| 146 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl) ) { | |
| 146 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl)) { | |
| 147 | 147 | //cache TTL value for 'wait for moderator' feature | 
| 148 | 148 |              $settings->add(new admin_setting_configtext('bigbluebuttonbn_waitformoderator_cache_ttl', | 
| 149 | 149 |                      get_string('config_feature_waitformoderator_cache_ttl', 'bigbluebuttonbn'), | 
| @@ -153,8 +153,8 @@ discard block | ||
| 153 | 153 | } | 
| 154 | 154 | |
| 155 | 155 | //// Configuration for "static voice bridge" feature | 
| 156 | -    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable) ) { | |
| 157 | -        $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_voicebridge', | |
| 156 | +    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable)) { | |
| 157 | +        $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_voicebridge', | |
| 158 | 158 |                  get_string('config_feature_voicebridge', 'bigbluebuttonbn'), | 
| 159 | 159 |                  get_string('config_feature_voicebridge_description', 'bigbluebuttonbn'))); | 
| 160 | 160 | |
| @@ -166,10 +166,10 @@ discard block | ||
| 166 | 166 | } | 
| 167 | 167 | |
| 168 | 168 | //// Configuration for "preupload presentation" feature | 
| 169 | -    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled) ) { | |
| 169 | +    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled)) { | |
| 170 | 170 | // This feature only works if curl is installed | 
| 171 | 171 |          if (extension_loaded('curl')) { | 
| 172 | -            $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_preuploadpresentation', | |
| 172 | +            $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_preuploadpresentation', | |
| 173 | 173 |                  get_string('config_feature_preuploadpresentation', 'bigbluebuttonbn'), | 
| 174 | 174 |                  get_string('config_feature_preuploadpresentation_description', 'bigbluebuttonbn') | 
| 175 | 175 | )); | 
| @@ -180,29 +180,29 @@ discard block | ||
| 180 | 180 |                  get_string('config_feature_preuploadpresentation_enabled_description', 'bigbluebuttonbn'), | 
| 181 | 181 | 0)); | 
| 182 | 182 |          } else { | 
| 183 | -            $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_preuploadpresentation', | |
| 183 | +            $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_preuploadpresentation', | |
| 184 | 184 |                  get_string('config_feature_preuploadpresentation', 'bigbluebuttonbn'), | 
| 185 | -                get_string('config_feature_preuploadpresentation_description', 'bigbluebuttonbn').'<br><br>'. | |
| 186 | -                '<div class="form-defaultinfo">'.get_string('config_warning_curl_not_installed', 'bigbluebuttonbn').'</div><br>' | |
| 185 | +                get_string('config_feature_preuploadpresentation_description', 'bigbluebuttonbn') . '<br><br>' . | |
| 186 | +                '<div class="form-defaultinfo">' . get_string('config_warning_curl_not_installed', 'bigbluebuttonbn') . '</div><br>' | |
| 187 | 187 | )); | 
| 188 | 188 | } | 
| 189 | 189 | } | 
| 190 | 190 | |
| 191 | 191 | //// Configuration for "user limit" feature | 
| 192 | - if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) || | |
| 193 | -        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable) ) { | |
| 194 | -        $settings->add( new admin_setting_heading('config_userlimit', | |
| 192 | + if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) || | |
| 193 | +        !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable)) { | |
| 194 | +        $settings->add(new admin_setting_heading('config_userlimit', | |
| 195 | 195 |                  get_string('config_feature_userlimit', 'bigbluebuttonbn'), | 
| 196 | 196 |                  get_string('config_feature_userlimit_description', 'bigbluebuttonbn'))); | 
| 197 | 197 | |
| 198 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) ) { | |
| 198 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default)) { | |
| 199 | 199 | //default value for 'user limit' feature | 
| 200 | 200 |              $settings->add(new admin_setting_configtext('bigbluebuttonbn_userlimit_default', | 
| 201 | 201 |                      get_string('config_feature_userlimit_default', 'bigbluebuttonbn'), | 
| 202 | 202 |                      get_string('config_feature_userlimit_default_description', 'bigbluebuttonbn'), | 
| 203 | 203 | 0, PARAM_INT)); | 
| 204 | 204 | } | 
| 205 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable) ) { | |
| 205 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable)) { | |
| 206 | 206 | // UI for 'user limit' feature | 
| 207 | 207 |              $settings->add(new admin_setting_configcheckbox('bigbluebuttonbn_userlimit_editable', | 
| 208 | 208 |                      get_string('config_feature_userlimit_editable', 'bigbluebuttonbn'), | 
| @@ -212,8 +212,8 @@ discard block | ||
| 212 | 212 | } | 
| 213 | 213 | |
| 214 | 214 | //// Configuration for "scheduled duration" feature | 
| 215 | -    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled) ) { | |
| 216 | -      $settings->add( new admin_setting_heading('config_scheduled', | |
| 215 | +    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled)) { | |
| 216 | +      $settings->add(new admin_setting_heading('config_scheduled', | |
| 217 | 217 |                get_string('config_scheduled', 'bigbluebuttonbn'), | 
| 218 | 218 |                get_string('config_scheduled_description', 'bigbluebuttonbn'))); | 
| 219 | 219 | |
| @@ -237,8 +237,8 @@ discard block | ||
| 237 | 237 | } | 
| 238 | 238 | |
| 239 | 239 | //// Configuration for defining the default role/user that will be moderator on new activities | 
| 240 | -    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default) ) { | |
| 241 | -        $settings->add( new admin_setting_heading('bigbluebuttonbn_permission', | |
| 240 | +    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default)) { | |
| 241 | +        $settings->add(new admin_setting_heading('bigbluebuttonbn_permission', | |
| 242 | 242 |                  get_string('config_permission', 'bigbluebuttonbn'), | 
| 243 | 243 |                  get_string('config_permission_description', 'bigbluebuttonbn'))); | 
| 244 | 244 | |
| @@ -252,8 +252,8 @@ discard block | ||
| 252 | 252 | } | 
| 253 | 253 | |
| 254 | 254 | //// Configuration for "send notifications" feature | 
| 255 | -    if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled) ) { | |
| 256 | -        $settings->add( new admin_setting_heading('bigbluebuttonbn_feature_sendnotifications', | |
| 255 | +    if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled)) { | |
| 256 | +        $settings->add(new admin_setting_heading('bigbluebuttonbn_feature_sendnotifications', | |
| 257 | 257 |                  get_string('config_feature_sendnotifications', 'bigbluebuttonbn'), | 
| 258 | 258 |                  get_string('config_feature_sendnotifications_description', 'bigbluebuttonbn'))); | 
| 259 | 259 | |
| @@ -265,10 +265,10 @@ discard block | ||
| 265 | 265 | } | 
| 266 | 266 | |
| 267 | 267 | //// Configuration for extended BN capabilities | 
| 268 | -    if( bigbluebuttonbn_server_offers_bn_capabilities() ) { | |
| 268 | +    if (bigbluebuttonbn_server_offers_bn_capabilities()) { | |
| 269 | 269 | //// Configuration for 'notify users when recording ready' feature | 
| 270 | -        if( !isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled) ) { | |
| 271 | -            $settings->add( new admin_setting_heading('bigbluebuttonbn_extended_capabilities', | |
| 270 | +        if (!isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled)) { | |
| 271 | +            $settings->add(new admin_setting_heading('bigbluebuttonbn_extended_capabilities', | |
| 272 | 272 |                      get_string('config_extended_capabilities', 'bigbluebuttonbn'), | 
| 273 | 273 |                      get_string('config_extended_capabilities_description', 'bigbluebuttonbn'))); | 
| 274 | 274 | |
| @@ -269,8 +269,9 @@ | ||
| 269 | 269 | // Fourth block starts here | 
| 270 | 270 | //------------------------------------------------------------------------------- | 
| 271 | 271 |          $mform->addElement('header', 'schedule', get_string('mod_form_block_schedule', 'bigbluebuttonbn')); | 
| 272 | - if( isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0 ) | |
| 273 | -            $mform->setExpanded('schedule'); | |
| 272 | +        if( isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0 ) { | |
| 273 | +                    $mform->setExpanded('schedule'); | |
| 274 | + } | |
| 274 | 275 | |
| 275 | 276 |          $mform->addElement('date_time_selector', 'openingtime', get_string('mod_form_field_openingtime', 'bigbluebuttonbn'), array('optional' => true)); | 
| 276 | 277 |          $mform->setDefault('openingtime', 0); | 
| @@ -265,33 +265,33 @@ discard block | ||
| 265 | 265 |      private function mform_participant_renderer_old_format($mform, $context, $participantselection, $participantlist) { | 
| 266 | 266 | global $CFG; | 
| 267 | 267 | $htmlparticipantselection = ''. | 
| 268 | - '<div class="fitem fitem_fselect">'."\n". | |
| 269 | - ' <div class="fitemtitle">'."\n". | |
| 270 | -             '    <label for="bigbluebuttonbn_participant_selectiontype">'.get_string('mod_form_field_participant_add', 'bigbluebuttonbn').' </label>'."\n". | |
| 271 | - ' </div>'."\n". | |
| 272 | - ' <div class="felement fselect">'."\n". | |
| 273 | - ' <select id="bigbluebuttonbn_participant_selection_type" onchange="bigbluebuttonbn_participant_selection_set(); return 0;" class="select custom-select">'."\n". | |
| 274 | -             '      <option value="all" selected="selected">'.get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn').'</option>'."\n". | |
| 275 | -             '      <option value="role">'.get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn').'</option>'."\n". | |
| 276 | -             '      <option value="user">'.get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn').'</option>'."\n". | |
| 277 | - ' </select>'."\n". | |
| 278 | - '   '."\n". | |
| 279 | - ' <select id="bigbluebuttonbn_participant_selection" disabled="disabled" class="select custom-select">'."\n". | |
| 280 | - ' <option value="all" selected="selected">---------------</option>'."\n". | |
| 281 | - ' </select>'."\n". | |
| 282 | - '   '."\n". | |
| 283 | -             '    <input value="'.get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn').'" class="btn btn-secondary" type="button" id="id_addselectionid" onclick="bigbluebuttonbn_participant_add(); return 0;" />'."\n". | |
| 284 | - ' </div>'."\n". | |
| 285 | - '</div>'."\n"; | |
| 268 | + '<div class="fitem fitem_fselect">'."\n". | |
| 269 | + ' <div class="fitemtitle">'."\n". | |
| 270 | +                '    <label for="bigbluebuttonbn_participant_selectiontype">'.get_string('mod_form_field_participant_add', 'bigbluebuttonbn').' </label>'."\n". | |
| 271 | + ' </div>'."\n". | |
| 272 | + ' <div class="felement fselect">'."\n". | |
| 273 | + ' <select id="bigbluebuttonbn_participant_selection_type" onchange="bigbluebuttonbn_participant_selection_set(); return 0;" class="select custom-select">'."\n". | |
| 274 | +                '      <option value="all" selected="selected">'.get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn').'</option>'."\n". | |
| 275 | +                '      <option value="role">'.get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn').'</option>'."\n". | |
| 276 | +                '      <option value="user">'.get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn').'</option>'."\n". | |
| 277 | + ' </select>'."\n". | |
| 278 | + '   '."\n". | |
| 279 | + ' <select id="bigbluebuttonbn_participant_selection" disabled="disabled" class="select custom-select">'."\n". | |
| 280 | + ' <option value="all" selected="selected">---------------</option>'."\n". | |
| 281 | + ' </select>'."\n". | |
| 282 | + '   '."\n". | |
| 283 | +                '    <input value="'.get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn').'" class="btn btn-secondary" type="button" id="id_addselectionid" onclick="bigbluebuttonbn_participant_add(); return 0;" />'."\n". | |
| 284 | + ' </div>'."\n". | |
| 285 | + '</div>'."\n"; | |
| 286 | 286 | |
| 287 | 287 | |
| 288 | 288 | $htmlparticipantselection .= ''. | 
| 289 | - '<div class="fitem">'."\n". | |
| 290 | - ' <div class="fitemtitle">'."\n". | |
| 291 | -             '    <label for="bigbluebuttonbn_participant_list">'.get_string('mod_form_field_participant_list', 'bigbluebuttonbn').' </label>'."\n". | |
| 292 | - ' </div>'."\n". | |
| 293 | - ' <div class="felement fselect">'."\n". | |
| 294 | - ' <table id="participant_list_table">'."\n"; | |
| 289 | + '<div class="fitem">'."\n". | |
| 290 | + ' <div class="fitemtitle">'."\n". | |
| 291 | +                '    <label for="bigbluebuttonbn_participant_list">'.get_string('mod_form_field_participant_list', 'bigbluebuttonbn').' </label>'."\n". | |
| 292 | + ' </div>'."\n". | |
| 293 | + ' <div class="felement fselect">'."\n". | |
| 294 | + ' <table id="participant_list_table">'."\n"; | |
| 295 | 295 | |
| 296 | 296 | |
| 297 | 297 | // Add participant list | 
| @@ -328,11 +328,11 @@ discard block | ||
| 328 | 328 | } | 
| 329 | 329 | |
| 330 | 330 | $htmlparticipantselection .= ''. | 
| 331 | - ' </table>'."\n". | |
| 332 | - ' </div>'."\n". | |
| 333 | - '</div>'."\n". | |
| 334 | - '<script type="text/javascript" src="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/mod_form.js">'."\n". | |
| 335 | - '</script>'."\n"; | |
| 331 | + ' </table>'."\n". | |
| 332 | + ' </div>'."\n". | |
| 333 | + '</div>'."\n". | |
| 334 | + '<script type="text/javascript" src="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/mod_form.js">'."\n". | |
| 335 | + '</script>'."\n"; | |
| 336 | 336 | |
| 337 | 337 |          $mform->addElement('html', $htmlparticipantselection); | 
| 338 | 338 | |
| @@ -344,9 +344,9 @@ discard block | ||
| 344 | 344 |          $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_selection = {"all": [], "role": '.json_encode($roles).', "user": '.bigbluebuttonbn_get_users_json($users).'}; </script>'); | 
| 345 | 345 |          $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_list = '.json_encode($participantlist).'; </script>'); | 
| 346 | 346 |          $bigbluebuttonbn_strings = Array( "as" => get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn'), | 
| 347 | -                                          "viewer" => get_string('mod_form_field_participant_bbb_role_viewer', 'bigbluebuttonbn'), | |
| 348 | -                                          "moderator" => get_string('mod_form_field_participant_bbb_role_moderator', 'bigbluebuttonbn'), | |
| 349 | -                                          "remove" => get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn'), | |
| 347 | +                                            "viewer" => get_string('mod_form_field_participant_bbb_role_viewer', 'bigbluebuttonbn'), | |
| 348 | +                                            "moderator" => get_string('mod_form_field_participant_bbb_role_moderator', 'bigbluebuttonbn'), | |
| 349 | +                                            "remove" => get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn'), | |
| 350 | 350 | ); | 
| 351 | 351 |          $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_strings = '.json_encode($bigbluebuttonbn_strings).'; </script>'); | 
| 352 | 352 | |
| @@ -358,7 +358,7 @@ discard block | ||
| 358 | 358 | html_writer::select($participantselection['type_options'], 'bigbluebuttonbn_participant_selection_type', | 
| 359 | 359 | $participantselection['type_selected'], array(), | 
| 360 | 360 |                  array('id' => 'bigbluebuttonbn_participant_selection_type', | 
| 361 | - 'onchange' => 'M.mod_bigbluebuttonbn.modform.participant_selection_set(); return 0;')).'  '. | |
| 361 | + 'onchange' => 'M.mod_bigbluebuttonbn.modform.participant_selection_set(); return 0;')).'  '. | |
| 362 | 362 | html_writer::select($participantselection['options'], 'bigbluebuttonbn_participant_selection', | 
| 363 | 363 | $participantselection['selected'], array(), | 
| 364 | 364 |                  array('id' => 'bigbluebuttonbn_participant_selection', 'disabled' => 'disabled')).'  '. | 
| @@ -11,8 +11,8 @@ discard block | ||
| 11 | 11 | |
| 12 | 12 |  defined('MOODLE_INTERNAL') || die(); | 
| 13 | 13 | |
| 14 | -require_once(dirname(__FILE__).'/locallib.php'); | |
| 15 | -require_once($CFG->dirroot.'/course/moodleform_mod.php'); | |
| 14 | +require_once(dirname(__FILE__) . '/locallib.php'); | |
| 15 | +require_once($CFG->dirroot . '/course/moodleform_mod.php'); | |
| 16 | 16 | |
| 17 | 17 |  class mod_bigbluebuttonbn_mod_form extends moodleform_mod { | 
| 18 | 18 | |
| @@ -50,24 +50,24 @@ discard block | ||
| 50 | 50 | |
| 51 | 51 | //Validates if the BigBlueButton server is running | 
| 52 | 52 | $serverVersion = bigbluebuttonbn_getServerVersion($endpoint); | 
| 53 | -        if ( !isset($serverVersion) ) { | |
| 54 | - print_error( 'general_error_unable_connect', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' ); | |
| 53 | +        if (!isset($serverVersion)) { | |
| 54 | +            print_error('general_error_unable_connect', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); | |
| 55 | 55 | } | 
| 56 | 56 | |
| 57 | - $mform =& $this->_form; | |
| 58 | - $current_activity =& $this->current; | |
| 57 | + $mform = & $this->_form; | |
| 58 | + $current_activity = & $this->current; | |
| 59 | 59 | |
| 60 | 60 | //------------------------------------------------------------------------------- | 
| 61 | 61 | // First block starts here | 
| 62 | 62 | //------------------------------------------------------------------------------- | 
| 63 | 63 |          $mform->addElement('header', 'general', get_string('mod_form_block_general', 'bigbluebuttonbn')); | 
| 64 | 64 | |
| 65 | -        $mform->addElement('text', 'name', get_string('mod_form_field_name','bigbluebuttonbn'), 'maxlength="64" size="32"'); | |
| 65 | +        $mform->addElement('text', 'name', get_string('mod_form_field_name', 'bigbluebuttonbn'), 'maxlength="64" size="32"'); | |
| 66 | 66 |          $mform->setType('name', PARAM_TEXT); | 
| 67 | 67 |          $mform->addRule('name', null, 'required', null, 'client'); | 
| 68 | 68 | |
| 69 | 69 | $version_major = bigbluebuttonbn_get_moodle_version_major(); | 
| 70 | -        if ( $version_major < '2015051100' ) { | |
| 70 | +        if ($version_major < '2015051100') { | |
| 71 | 71 | //This is valid before v2.9 | 
| 72 | 72 |              $this->add_intro_editor(false, get_string('mod_form_field_intro', 'bigbluebuttonbn')); | 
| 73 | 73 |          } else { | 
| @@ -77,60 +77,60 @@ discard block | ||
| 77 | 77 |          $mform->setAdvanced('introeditor'); | 
| 78 | 78 |          $mform->setAdvanced('showdescription'); | 
| 79 | 79 | |
| 80 | -        $mform->addElement('textarea', 'welcome', get_string('mod_form_field_welcome','bigbluebuttonbn'), 'wrap="virtual" rows="5" cols="60"'); | |
| 80 | +        $mform->addElement('textarea', 'welcome', get_string('mod_form_field_welcome', 'bigbluebuttonbn'), 'wrap="virtual" rows="5" cols="60"'); | |
| 81 | 81 |          $mform->addHelpButton('welcome', 'mod_form_field_welcome', 'bigbluebuttonbn'); | 
| 82 | 82 |          $mform->setType('welcome', PARAM_TEXT); | 
| 83 | 83 |          $mform->setAdvanced('welcome'); | 
| 84 | 84 | |
| 85 | -        if ( $voicebridge_editable ) { | |
| 86 | -            $mform->addElement('text', 'voicebridge', get_string('mod_form_field_voicebridge','bigbluebuttonbn'), array('maxlength'=>4, 'size'=>6)); | |
| 85 | +        if ($voicebridge_editable) { | |
| 86 | +            $mform->addElement('text', 'voicebridge', get_string('mod_form_field_voicebridge', 'bigbluebuttonbn'), array('maxlength'=>4, 'size'=>6)); | |
| 87 | 87 |              $mform->addRule('voicebridge', get_string('mod_form_field_voicebridge_format_error', 'bigbluebuttonbn'), 'numeric', '####', 'server'); | 
| 88 | - $mform->setDefault( 'voicebridge', 0 ); | |
| 88 | +            $mform->setDefault('voicebridge', 0); | |
| 89 | 89 |              $mform->addHelpButton('voicebridge', 'mod_form_field_voicebridge', 'bigbluebuttonbn'); | 
| 90 | 90 |              $mform->setAdvanced('voicebridge'); | 
| 91 | 91 | } | 
| 92 | 92 |          $mform->setType('voicebridge', PARAM_INT); | 
| 93 | 93 | |
| 94 | -        if ( $waitformoderator_editable ) { | |
| 94 | +        if ($waitformoderator_editable) { | |
| 95 | 95 |              $mform->addElement('checkbox', 'wait', get_string('mod_form_field_wait', 'bigbluebuttonbn')); | 
| 96 | 96 |              $mform->addHelpButton('wait', 'mod_form_field_wait', 'bigbluebuttonbn'); | 
| 97 | - $mform->setDefault( 'wait', $waitformoderator_default ); | |
| 97 | +            $mform->setDefault('wait', $waitformoderator_default); | |
| 98 | 98 |              $mform->setAdvanced('wait'); | 
| 99 | 99 |          } else { | 
| 100 | -            $mform->addElement('hidden', 'wait', $waitformoderator_default ); | |
| 100 | +            $mform->addElement('hidden', 'wait', $waitformoderator_default); | |
| 101 | 101 | } | 
| 102 | 102 |          $mform->setType('wait', PARAM_INT); | 
| 103 | 103 | |
| 104 | -        if ( $userlimit_editable ) { | |
| 105 | -            $mform->addElement('text', 'userlimit', get_string('mod_form_field_userlimit','bigbluebuttonbn'), 'maxlength="3" size="5"' ); | |
| 104 | +        if ($userlimit_editable) { | |
| 105 | +            $mform->addElement('text', 'userlimit', get_string('mod_form_field_userlimit', 'bigbluebuttonbn'), 'maxlength="3" size="5"'); | |
| 106 | 106 |              $mform->addHelpButton('userlimit', 'mod_form_field_userlimit', 'bigbluebuttonbn'); | 
| 107 | - $mform->setDefault( 'userlimit', $userlimit_default ); | |
| 107 | +            $mform->setDefault('userlimit', $userlimit_default); | |
| 108 | 108 |          } else { | 
| 109 | -            $mform->addElement('hidden', 'userlimit', $userlimit_default ); | |
| 109 | +            $mform->addElement('hidden', 'userlimit', $userlimit_default); | |
| 110 | 110 | } | 
| 111 | 111 |          $mform->setType('userlimit', PARAM_TEXT); | 
| 112 | 112 | |
| 113 | -        if ( floatval($serverVersion) >= 0.8 ) { | |
| 114 | -            if ( $recording_editable ) { | |
| 113 | +        if (floatval($serverVersion) >= 0.8) { | |
| 114 | +            if ($recording_editable) { | |
| 115 | 115 |                  $mform->addElement('checkbox', 'record', get_string('mod_form_field_record', 'bigbluebuttonbn')); | 
| 116 | - $mform->setDefault( 'record', $recording_default ); | |
| 116 | +                $mform->setDefault('record', $recording_default); | |
| 117 | 117 |                  $mform->setAdvanced('record'); | 
| 118 | 118 |              } else { | 
| 119 | 119 |                  $mform->addElement('hidden', 'record', $recording_default); | 
| 120 | 120 | } | 
| 121 | 121 |              $mform->setType('record', PARAM_INT); | 
| 122 | 122 | |
| 123 | -            if ( $recording_tagging_editable ) { | |
| 123 | +            if ($recording_tagging_editable) { | |
| 124 | 124 |                  $mform->addElement('checkbox', 'tagging', get_string('mod_form_field_recordingtagging', 'bigbluebuttonbn')); | 
| 125 | 125 |                  $mform->setDefault('tagging', $recording_tagging_default); | 
| 126 | 126 |                  $mform->setAdvanced('tagging'); | 
| 127 | 127 |              } else { | 
| 128 | -                $mform->addElement('hidden', 'tagging', $recording_tagging_default ); | |
| 128 | +                $mform->addElement('hidden', 'tagging', $recording_tagging_default); | |
| 129 | 129 | } | 
| 130 | 130 |              $mform->setType('tagging', PARAM_INT); | 
| 131 | 131 | } | 
| 132 | 132 | |
| 133 | -        if ( $sendnotifications_enabled ) { | |
| 133 | +        if ($sendnotifications_enabled) { | |
| 134 | 134 |              $mform->addElement('checkbox', 'notification', get_string('mod_form_field_notification', 'bigbluebuttonbn')); | 
| 135 | 135 |              if ($this->current->instance) { | 
| 136 | 136 |                  $mform->addHelpButton('notification', 'mod_form_field_notification', 'bigbluebuttonbn'); | 
| @@ -148,7 +148,7 @@ discard block | ||
| 148 | 148 | //------------------------------------------------------------------------------- | 
| 149 | 149 | // Second block starts here | 
| 150 | 150 | //------------------------------------------------------------------------------- | 
| 151 | -        if ( $preuploadpresentation_enabled ) { | |
| 151 | +        if ($preuploadpresentation_enabled) { | |
| 152 | 152 |              $mform->addElement('header', 'preupload', get_string('mod_form_block_presentation', 'bigbluebuttonbn')); | 
| 153 | 153 |              $mform->setExpanded('preupload'); | 
| 154 | 154 | |
| @@ -187,7 +187,7 @@ discard block | ||
| 187 | 187 | // Fourth block starts here | 
| 188 | 188 | //------------------------------------------------------------------------------- | 
| 189 | 189 |          $mform->addElement('header', 'schedule', get_string('mod_form_block_schedule', 'bigbluebuttonbn')); | 
| 190 | - if( isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0 ) | |
| 190 | + if (isset($current_activity->openingtime) && $current_activity->openingtime != 0 || isset($current_activity->closingtime) && $current_activity->closingtime != 0) | |
| 191 | 191 |              $mform->setExpanded('schedule'); | 
| 192 | 192 | |
| 193 | 193 |          $mform->addElement('date_time_selector', 'openingtime', get_string('mod_form_field_openingtime', 'bigbluebuttonbn'), array('optional' => true)); | 
| @@ -227,7 +227,7 @@ discard block | ||
| 227 | 227 |                  $draftitemid = file_get_submitted_draft_itemid('presentation'); | 
| 228 | 228 |                  file_prepare_draft_area($draftitemid, $this->context->id, 'mod_bigbluebuttonbn', 'presentation', 0, array('subdirs'=>0, 'maxbytes' => 0, 'maxfiles' => 1, 'mainfile' => true)); | 
| 229 | 229 | $default_values['presentation'] = $draftitemid; | 
| 230 | -            } catch (Exception $e){ | |
| 230 | +            } catch (Exception $e) { | |
| 231 | 231 | return NULL; | 
| 232 | 232 | } | 
| 233 | 233 | } | 
| @@ -236,14 +236,14 @@ discard block | ||
| 236 | 236 |      function validation($data, $files) { | 
| 237 | 237 | $errors = parent::validation($data, $files); | 
| 238 | 238 | |
| 239 | -        if ( isset($data['openingtime']) && isset($data['closingtime']) ) { | |
| 240 | -            if ( $data['openingtime'] != 0 && $data['closingtime'] != 0 && $data['closingtime'] < $data['openingtime']) { | |
| 239 | +        if (isset($data['openingtime']) && isset($data['closingtime'])) { | |
| 240 | +            if ($data['openingtime'] != 0 && $data['closingtime'] != 0 && $data['closingtime'] < $data['openingtime']) { | |
| 241 | 241 |                  $errors['closingtime'] = get_string('bbbduetimeoverstartingtime', 'bigbluebuttonbn'); | 
| 242 | 242 | } | 
| 243 | 243 | } | 
| 244 | 244 | |
| 245 | -        if ( isset($data['voicebridge']) ) { | |
| 246 | -            if ( !bigbluebuttonbn_voicebridge_unique($data['voicebridge'], $data['instance'])) { | |
| 245 | +        if (isset($data['voicebridge'])) { | |
| 246 | +            if (!bigbluebuttonbn_voicebridge_unique($data['voicebridge'], $data['instance'])) { | |
| 247 | 247 |                  $errors['voicebridge'] = get_string('mod_form_field_voicebridge_notunique_error', 'bigbluebuttonbn'); | 
| 248 | 248 | } | 
| 249 | 249 | } | 
| @@ -264,75 +264,75 @@ discard block | ||
| 264 | 264 | |
| 265 | 265 |      private function mform_participant_renderer_old_format($mform, $context, $participantselection, $participantlist) { | 
| 266 | 266 | global $CFG; | 
| 267 | - $htmlparticipantselection = ''. | |
| 268 | - '<div class="fitem fitem_fselect">'."\n". | |
| 269 | - ' <div class="fitemtitle">'."\n". | |
| 270 | -             '    <label for="bigbluebuttonbn_participant_selectiontype">'.get_string('mod_form_field_participant_add', 'bigbluebuttonbn').' </label>'."\n". | |
| 271 | - ' </div>'."\n". | |
| 272 | - ' <div class="felement fselect">'."\n". | |
| 273 | - ' <select id="bigbluebuttonbn_participant_selection_type" onchange="bigbluebuttonbn_participant_selection_set(); return 0;" class="select custom-select">'."\n". | |
| 274 | -             '      <option value="all" selected="selected">'.get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn').'</option>'."\n". | |
| 275 | -             '      <option value="role">'.get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn').'</option>'."\n". | |
| 276 | -             '      <option value="user">'.get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn').'</option>'."\n". | |
| 277 | - ' </select>'."\n". | |
| 278 | - '   '."\n". | |
| 279 | - ' <select id="bigbluebuttonbn_participant_selection" disabled="disabled" class="select custom-select">'."\n". | |
| 280 | - ' <option value="all" selected="selected">---------------</option>'."\n". | |
| 281 | - ' </select>'."\n". | |
| 282 | - '   '."\n". | |
| 283 | -             '    <input value="'.get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn').'" class="btn btn-secondary" type="button" id="id_addselectionid" onclick="bigbluebuttonbn_participant_add(); return 0;" />'."\n". | |
| 284 | - ' </div>'."\n". | |
| 285 | - '</div>'."\n"; | |
| 286 | - | |
| 287 | - | |
| 288 | - $htmlparticipantselection .= ''. | |
| 289 | - '<div class="fitem">'."\n". | |
| 290 | - ' <div class="fitemtitle">'."\n". | |
| 291 | -             '    <label for="bigbluebuttonbn_participant_list">'.get_string('mod_form_field_participant_list', 'bigbluebuttonbn').' </label>'."\n". | |
| 292 | - ' </div>'."\n". | |
| 293 | - ' <div class="felement fselect">'."\n". | |
| 294 | - ' <table id="participant_list_table">'."\n"; | |
| 267 | + $htmlparticipantselection = '' . | |
| 268 | + '<div class="fitem fitem_fselect">' . "\n" . | |
| 269 | + ' <div class="fitemtitle">' . "\n" . | |
| 270 | +             '    <label for="bigbluebuttonbn_participant_selectiontype">' . get_string('mod_form_field_participant_add', 'bigbluebuttonbn') . ' </label>' . "\n" . | |
| 271 | + ' </div>' . "\n" . | |
| 272 | + ' <div class="felement fselect">' . "\n" . | |
| 273 | + ' <select id="bigbluebuttonbn_participant_selection_type" onchange="bigbluebuttonbn_participant_selection_set(); return 0;" class="select custom-select">' . "\n" . | |
| 274 | +             '      <option value="all" selected="selected">' . get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn') . '</option>' . "\n" . | |
| 275 | +             '      <option value="role">' . get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn') . '</option>' . "\n" . | |
| 276 | +             '      <option value="user">' . get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn') . '</option>' . "\n" . | |
| 277 | + ' </select>' . "\n" . | |
| 278 | + '   ' . "\n" . | |
| 279 | + ' <select id="bigbluebuttonbn_participant_selection" disabled="disabled" class="select custom-select">' . "\n" . | |
| 280 | + ' <option value="all" selected="selected">---------------</option>' . "\n" . | |
| 281 | + ' </select>' . "\n" . | |
| 282 | + '   ' . "\n" . | |
| 283 | +             '    <input value="' . get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn') . '" class="btn btn-secondary" type="button" id="id_addselectionid" onclick="bigbluebuttonbn_participant_add(); return 0;" />' . "\n" . | |
| 284 | + ' </div>' . "\n" . | |
| 285 | + '</div>' . "\n"; | |
| 286 | + | |
| 287 | + | |
| 288 | + $htmlparticipantselection .= '' . | |
| 289 | + '<div class="fitem">' . "\n" . | |
| 290 | + ' <div class="fitemtitle">' . "\n" . | |
| 291 | +             '    <label for="bigbluebuttonbn_participant_list">' . get_string('mod_form_field_participant_list', 'bigbluebuttonbn') . ' </label>' . "\n" . | |
| 292 | + ' </div>' . "\n" . | |
| 293 | + ' <div class="felement fselect">' . "\n" . | |
| 294 | + ' <table id="participant_list_table">' . "\n"; | |
| 295 | 295 | |
| 296 | 296 | |
| 297 | 297 | // Add participant list | 
| 298 | -        foreach($participantlist as $participant){ | |
| 298 | +        foreach ($participantlist as $participant) { | |
| 299 | 299 | $participantselectionid = ''; | 
| 300 | 300 | $participantselectiontype = $participant['selectiontype']; | 
| 301 | -            if( $participantselectiontype == 'all') { | |
| 302 | -                $participantselectiontype = '<b><i>'.get_string('mod_form_field_participant_list_type_'.$participantselectiontype, 'bigbluebuttonbn').'</i></b>'; | |
| 301 | +            if ($participantselectiontype == 'all') { | |
| 302 | +                $participantselectiontype = '<b><i>' . get_string('mod_form_field_participant_list_type_' . $participantselectiontype, 'bigbluebuttonbn') . '</i></b>'; | |
| 303 | 303 |              } else { | 
| 304 | -                if ( $participantselectiontype == 'role') { | |
| 304 | +                if ($participantselectiontype == 'role') { | |
| 305 | 305 | $participantselectionid = bigbluebuttonbn_get_role_name($participant['selectionid']); | 
| 306 | 306 |                  } else { | 
| 307 | -                    foreach($users as $user){ | |
| 308 | -                        if( $user->id == $participant['selectionid']) { | |
| 309 | - $participantselectionid = $user->firstname.' '.$user->lastname; | |
| 307 | +                    foreach ($users as $user) { | |
| 308 | +                        if ($user->id == $participant['selectionid']) { | |
| 309 | + $participantselectionid = $user->firstname . ' ' . $user->lastname; | |
| 310 | 310 | break; | 
| 311 | 311 | } | 
| 312 | 312 | } | 
| 313 | 313 | } | 
| 314 | -                $participantselectiontype = '<b><i>'.get_string('mod_form_field_participant_list_type_'.$participantselectiontype, 'bigbluebuttonbn').':</i></b> '; | |
| 314 | +                $participantselectiontype = '<b><i>' . get_string('mod_form_field_participant_list_type_' . $participantselectiontype, 'bigbluebuttonbn') . ':</i></b> '; | |
| 315 | 315 | } | 
| 316 | 316 | |
| 317 | - $htmlparticipantselection .= ''. | |
| 318 | - ' <tr id="participant_list_tr_'.$participant['selectiontype'].'-'.$participant['selectionid'].'">'."\n". | |
| 319 | -                '        <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').'" class="btn btn-link">x</a></td>'."\n". | |
| 320 | - ' <td width="125px">'.$participantselectiontype.'</td>'."\n". | |
| 321 | - ' <td>'.$participantselectionid.'</td>'."\n". | |
| 322 | -                '        <td><i> '.get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn').' </i>'."\n". | |
| 323 | - ' <select id="participant_list_role_'.$participant['selectiontype'].'-'.$participant['selectionid'].'" onchange="bigbluebuttonbn_participant_list_role_update(\''.$participant['selectiontype'].'\', \''.$participant['selectionid'].'\'); return 0;" class="select custom-select">'."\n". | |
| 324 | -                '            <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". | |
| 325 | -                '            <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". | |
| 326 | - ' </td>'."\n". | |
| 327 | - ' </tr>'."\n"; | |
| 317 | + $htmlparticipantselection .= '' . | |
| 318 | + ' <tr id="participant_list_tr_' . $participant['selectiontype'] . '-' . $participant['selectionid'] . '">' . "\n" . | |
| 319 | +                '        <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') . '" class="btn btn-link">x</a></td>' . "\n" . | |
| 320 | + ' <td width="125px">' . $participantselectiontype . '</td>' . "\n" . | |
| 321 | + ' <td>' . $participantselectionid . '</td>' . "\n" . | |
| 322 | +                '        <td><i> ' . get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn') . ' </i>' . "\n" . | |
| 323 | + ' <select id="participant_list_role_' . $participant['selectiontype'] . '-' . $participant['selectionid'] . '" onchange="bigbluebuttonbn_participant_list_role_update(\'' . $participant['selectiontype'] . '\', \'' . $participant['selectionid'] . '\'); return 0;" class="select custom-select">' . "\n" . | |
| 324 | +                '            <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" . | |
| 325 | +                '            <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" . | |
| 326 | + ' </td>' . "\n" . | |
| 327 | + ' </tr>' . "\n"; | |
| 328 | 328 | } | 
| 329 | 329 | |
| 330 | - $htmlparticipantselection .= ''. | |
| 331 | - ' </table>'."\n". | |
| 332 | - ' </div>'."\n". | |
| 333 | - '</div>'."\n". | |
| 334 | - '<script type="text/javascript" src="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/mod_form.js">'."\n". | |
| 335 | - '</script>'."\n"; | |
| 330 | + $htmlparticipantselection .= '' . | |
| 331 | + ' </table>' . "\n" . | |
| 332 | + ' </div>' . "\n" . | |
| 333 | + '</div>' . "\n" . | |
| 334 | + '<script type="text/javascript" src="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/mod_form.js">' . "\n" . | |
| 335 | + '</script>' . "\n"; | |
| 336 | 336 | |
| 337 | 337 |          $mform->addElement('html', $htmlparticipantselection); | 
| 338 | 338 | |
| @@ -341,14 +341,14 @@ discard block | ||
| 341 | 341 | $users = bigbluebuttonbn_get_users($context); | 
| 342 | 342 | |
| 343 | 343 | // Add data | 
| 344 | -        $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_selection = {"all": [], "role": '.json_encode($roles).', "user": '.bigbluebuttonbn_get_users_json($users).'}; </script>'); | |
| 345 | -        $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_list = '.json_encode($participantlist).'; </script>'); | |
| 346 | -        $bigbluebuttonbn_strings = Array( "as" => get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn'), | |
| 344 | +        $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_selection = {"all": [], "role": ' . json_encode($roles) . ', "user": ' . bigbluebuttonbn_get_users_json($users) . '}; </script>'); | |
| 345 | +        $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_participant_list = ' . json_encode($participantlist) . '; </script>'); | |
| 346 | +        $bigbluebuttonbn_strings = Array("as" => get_string('mod_form_field_participant_list_text_as', 'bigbluebuttonbn'), | |
| 347 | 347 |                                            "viewer" => get_string('mod_form_field_participant_bbb_role_viewer', 'bigbluebuttonbn'), | 
| 348 | 348 |                                            "moderator" => get_string('mod_form_field_participant_bbb_role_moderator', 'bigbluebuttonbn'), | 
| 349 | 349 |                                            "remove" => get_string('mod_form_field_participant_list_action_remove', 'bigbluebuttonbn'), | 
| 350 | 350 | ); | 
| 351 | -        $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_strings = '.json_encode($bigbluebuttonbn_strings).'; </script>'); | |
| 351 | +        $mform->addElement('html', '<script type="text/javascript">var bigbluebuttonbn_strings = ' . json_encode($bigbluebuttonbn_strings) . '; </script>'); | |
| 352 | 352 | |
| 353 | 353 | } | 
| 354 | 354 | |
| @@ -358,10 +358,10 @@ discard block | ||
| 358 | 358 | html_writer::select($participantselection['type_options'], 'bigbluebuttonbn_participant_selection_type', | 
| 359 | 359 | $participantselection['type_selected'], array(), | 
| 360 | 360 |                  array('id' => 'bigbluebuttonbn_participant_selection_type', | 
| 361 | - 'onchange' => 'M.mod_bigbluebuttonbn.modform.participant_selection_set(); return 0;')).'  '. | |
| 361 | + 'onchange' => 'M.mod_bigbluebuttonbn.modform.participant_selection_set(); return 0;')) . '  ' . | |
| 362 | 362 | html_writer::select($participantselection['options'], 'bigbluebuttonbn_participant_selection', | 
| 363 | 363 | $participantselection['selected'], array(), | 
| 364 | -                array('id' => 'bigbluebuttonbn_participant_selection', 'disabled' => 'disabled')).'  '. | |
| 364 | +                array('id' => 'bigbluebuttonbn_participant_selection', 'disabled' => 'disabled')) . '  ' . | |
| 365 | 365 |              html_writer::tag('input', '', array('id' => 'id_addselectionid', 'type' => 'button', 'class' => 'btn btn-secondary', | 
| 366 | 366 |                  'value' => get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn'), | 
| 367 | 367 | 'onclick' => 'M.mod_bigbluebuttonbn.modform.participant_add(); return 0;' | 
| @@ -381,7 +381,7 @@ discard block | ||
| 381 | 381 | // Render elements for participant list. | 
| 382 | 382 |          $htmllist = html_writer::tag('div', | 
| 383 | 383 |              html_writer::label(get_string('mod_form_field_participant_list', 'bigbluebuttonbn'), | 
| 384 | - 'bigbluebuttonbn_participant_list'). | |
| 384 | + 'bigbluebuttonbn_participant_list') . | |
| 385 | 385 | html_writer::table($table) | 
| 386 | 386 | ); | 
| 387 | 387 | |
| @@ -36,11 +36,11 @@ | ||
| 36 | 36 | |
| 37 | 37 | // Define each element separated | 
| 38 | 38 |          $bigbluebuttonbn = new backup_nested_element('bigbluebuttonbn', array('id'), array( | 
| 39 | - 'course', 'name', 'intro', 'introformat', 'meetingid', | |
| 40 | - 'moderatorpass', 'viewerpass', 'wait', 'record', 'tagging', | |
| 41 | - 'welcome', 'voicebridge', 'openingtime', 'closingtime', | |
| 42 | - 'timecreated', 'timemodified', 'presentation', 'participants', | |
| 43 | - 'userlimit')); | |
| 39 | + 'course', 'name', 'intro', 'introformat', 'meetingid', | |
| 40 | + 'moderatorpass', 'viewerpass', 'wait', 'record', 'tagging', | |
| 41 | + 'welcome', 'voicebridge', 'openingtime', 'closingtime', | |
| 42 | + 'timecreated', 'timemodified', 'presentation', 'participants', | |
| 43 | + 'userlimit')); | |
| 44 | 44 | |
| 45 | 45 |          $logs = new backup_nested_element('logs'); | 
| 46 | 46 | |
| @@ -320,8 +320,7 @@ discard block | ||
| 320 | 320 | |
| 321 | 321 |      if( $xml ) { //If the xml packet returned failure it displays the message to the user | 
| 322 | 322 |          return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); | 
| 323 | - } | |
| 324 | -    else { //If the server is unreachable, then prompts the user of the necessary action | |
| 323 | +    } else { //If the server is unreachable, then prompts the user of the necessary action | |
| 325 | 324 | return null; | 
| 326 | 325 | } | 
| 327 | 326 | } | 
| @@ -355,7 +354,9 @@ discard block | ||
| 355 | 354 | } | 
| 356 | 355 | |
| 357 | 356 |  function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) { | 
| 358 | -    if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url); | |
| 357 | +    if ( bigbluebuttonbn_debugdisplay() ) { | |
| 358 | +        error_log("Request to: ".$url); | |
| 359 | + } | |
| 359 | 360 | |
| 360 | 361 |      if (extension_loaded('curl')) { | 
| 361 | 362 | $c = new curl(); | 
| @@ -942,7 +943,9 @@ discard block | ||
| 942 | 943 | $error = $org_msg; | 
| 943 | 944 | |
| 944 | 945 |      if( !empty($new_msg) ) { | 
| 945 | - if( !empty($error) ) $error .= ' '; | |
| 946 | +        if( !empty($error) ) { | |
| 947 | + $error .= ' '; | |
| 948 | + } | |
| 946 | 949 | $error .= $new_msg; | 
| 947 | 950 | } | 
| 948 | 951 | |
| @@ -194,6 +194,9 @@ discard block | ||
| 194 | 194 | return $xml; | 
| 195 | 195 | } | 
| 196 | 196 | |
| 197 | +/** | |
| 198 | + * @param string $meetingID | |
| 199 | + */ | |
| 197 | 200 |  function bigbluebuttonbn_getMeetingInfoArray( $meetingID, $modPW, $URL, $SALT ) { | 
| 198 | 201 | $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) ); | 
| 199 | 202 | |
| @@ -211,6 +214,9 @@ discard block | ||
| 211 | 214 | } | 
| 212 | 215 | } | 
| 213 | 216 | |
| 217 | +/** | |
| 218 | + * @param string $meetingIDs | |
| 219 | + */ | |
| 214 | 220 |  function bigbluebuttonbn_getRecordingsArray( $meetingIDs, $URL, $SALT ) { | 
| 215 | 221 | $recordings = array(); | 
| 216 | 222 | |
| @@ -292,6 +298,10 @@ discard block | ||
| 292 | 298 | } | 
| 293 | 299 | } | 
| 294 | 300 | |
| 301 | +/** | |
| 302 | + * @param string $URL | |
| 303 | + * @param string $SALT | |
| 304 | + */ | |
| 295 | 305 |  function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) { | 
| 296 | 306 |      $ids = 	explode(",", $recordIDs); | 
| 297 | 307 |      foreach( $ids as $id){ | 
| @@ -303,6 +313,11 @@ discard block | ||
| 303 | 313 | return true; | 
| 304 | 314 | } | 
| 305 | 315 | |
| 316 | +/** | |
| 317 | + * @param string $set | |
| 318 | + * @param string $URL | |
| 319 | + * @param string $SALT | |
| 320 | + */ | |
| 306 | 321 |  function bigbluebuttonbn_doPublishRecordings( $recordIDs, $set, $URL, $SALT ) { | 
| 307 | 322 |      $ids = 	explode(",", $recordIDs); | 
| 308 | 323 |      foreach( $ids as $id){ | 
| @@ -314,6 +329,10 @@ discard block | ||
| 314 | 329 | return true; | 
| 315 | 330 | } | 
| 316 | 331 | |
| 332 | +/** | |
| 333 | + * @param string $URL | |
| 334 | + * @param string $SALT | |
| 335 | + */ | |
| 317 | 336 |  function bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $URL, $SALT ) { | 
| 318 | 337 | $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) ); | 
| 319 | 338 | |
| @@ -335,6 +354,9 @@ discard block | ||
| 335 | 354 | } | 
| 336 | 355 | |
| 337 | 356 | |
| 357 | +/** | |
| 358 | + * @param string $URL | |
| 359 | + */ | |
| 338 | 360 |  function bigbluebuttonbn_getServerVersion( $URL ){ | 
| 339 | 361 | $xml = bigbluebuttonbn_wrap_xml_load_file( $URL."api" ); | 
| 340 | 362 |      if ( $xml && $xml->returncode == 'SUCCESS' ) { | 
| @@ -353,6 +375,9 @@ discard block | ||
| 353 | 375 | } | 
| 354 | 376 | } | 
| 355 | 377 | |
| 378 | +/** | |
| 379 | + * @param string $url | |
| 380 | + */ | |
| 356 | 381 |  function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) { | 
| 357 | 382 |      if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url); | 
| 358 | 383 | |
| @@ -849,6 +874,9 @@ discard block | ||
| 849 | 874 | $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'meetings_cache'); | 
| 850 | 875 | } | 
| 851 | 876 | |
| 877 | +/** | |
| 878 | + * @param boolean $is_moderator | |
| 879 | + */ | |
| 852 | 880 |  function bigbluebuttonbn_bbb_broker_participant_joined($meetingid, $is_moderator) { | 
| 853 | 881 | $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'meetings_cache'); | 
| 854 | 882 | $result = $cache->get($meetingid); | 
| @@ -1446,6 +1474,9 @@ discard block | ||
| 1446 | 1474 | return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingstatus_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingstatus_enabled: (isset($CFG->bigbluebuttonbn_recordingstatus_enabled)? $CFG->bigbluebuttonbn_recordingstatus_enabled: false)); | 
| 1447 | 1475 | } | 
| 1448 | 1476 | |
| 1477 | +/** | |
| 1478 | + * @return string | |
| 1479 | + */ | |
| 1449 | 1480 |  function bigbluebuttonbn_get_cfg_moderator_default() { | 
| 1450 | 1481 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1451 | 1482 | return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default: (isset($CFG->bigbluebuttonbn_moderator_default)? $CFG->bigbluebuttonbn_moderator_default: '0')); | 
| @@ -53,9 +53,9 @@ discard block | ||
| 53 | 53 |      $returnid = $DB->insert_record('bigbluebuttonbn_logs', $log); | 
| 54 | 54 | } | 
| 55 | 55 | |
| 56 | - //////////////////////////// | |
| 56 | + //////////////////////////// | |
| 57 | 57 | // BigBlueButton API Calls // | 
| 58 | - //////////////////////////// | |
| 58 | + //////////////////////////// | |
| 59 | 59 |  function bigbluebuttonbn_getJoinURL( $meetingID, $userName, $PW, $SALT, $URL, $logoutURL ) { | 
| 60 | 60 | $url_join = $URL."api/join?"; | 
| 61 | 61 | $params = 'meetingID='.urlencode($meetingID).'&fullName='.urlencode($userName).'&password='.urlencode($PW).'&logoutURL='.urlencode($logoutURL); | 
| @@ -493,7 +493,7 @@ discard block | ||
| 493 | 493 |          $roles[$key] = array('id' => $value->id, 'name' => $value->localname); | 
| 494 | 494 | } | 
| 495 | 495 | return $roles; | 
| 496 | - } | |
| 496 | + } | |
| 497 | 497 | |
| 498 | 498 |  function bigbluebuttonbn_get_role($id) { | 
| 499 | 499 | $roles = (array) role_get_names(); | 
| @@ -512,16 +512,16 @@ discard block | ||
| 512 | 512 | 'all' => array( | 
| 513 | 513 |              'name' => get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn'), | 
| 514 | 514 | 'children' => [] | 
| 515 | - ) | |
| 516 | - ); | |
| 515 | + ) | |
| 516 | + ); | |
| 517 | 517 | $data['role'] = array( | 
| 518 | 518 |          'name' => get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn'), | 
| 519 | 519 | 'children' => bigbluebuttonbn_get_roles_select($context) | 
| 520 | - ); | |
| 520 | + ); | |
| 521 | 521 | $data['user'] = array( | 
| 522 | 522 |          'name' => get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn'), | 
| 523 | 523 | 'children' => bigbluebuttonbn_get_users_select($context) | 
| 524 | - ); | |
| 524 | + ); | |
| 525 | 525 | return $data; | 
| 526 | 526 | } | 
| 527 | 527 | |
| @@ -568,9 +568,9 @@ discard block | ||
| 568 | 568 | continue; | 
| 569 | 569 | } | 
| 570 | 570 | $participantlistarray[] = array( | 
| 571 | - 'selectiontype' => 'role', | |
| 572 | - 'selectionid' => $moderatordefault, | |
| 573 | - 'role' => BIGBLUEBUTTONBN_ROLE_MODERATOR); | |
| 571 | + 'selectiontype' => 'role', | |
| 572 | + 'selectionid' => $moderatordefault, | |
| 573 | + 'role' => BIGBLUEBUTTONBN_ROLE_MODERATOR); | |
| 574 | 574 | } | 
| 575 | 575 | return $participantlistarray; | 
| 576 | 576 | } | 
| @@ -581,11 +581,11 @@ discard block | ||
| 581 | 581 |              'all' => get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn'), | 
| 582 | 582 |              'role' => get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn'), | 
| 583 | 583 |              'user' => get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn'), | 
| 584 | - ], | |
| 584 | + ], | |
| 585 | 585 | 'type_selected' => 'all', | 
| 586 | 586 | 'options' => ['all' => '---------------'], | 
| 587 | 587 | 'selected' => 'all', | 
| 588 | - ]; | |
| 588 | + ]; | |
| 589 | 589 | } | 
| 590 | 590 | |
| 591 | 591 |  function bigbluebuttonbn_is_moderator($user, $roles, $participants) { | 
| @@ -14,7 +14,7 @@ discard block | ||
| 14 | 14 | |
| 15 | 15 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 16 | 16 | |
| 17 | -require_once(dirname(__FILE__).'/lib.php'); | |
| 17 | +require_once(dirname(__FILE__) . '/lib.php'); | |
| 18 | 18 | |
| 19 | 19 | const BIGBLUEBUTTONBN_FORCED = true; | 
| 20 | 20 | |
| @@ -33,21 +33,21 @@ discard block | ||
| 33 | 33 | const BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED = 'recording_published'; | 
| 34 | 34 | const BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED = 'recording_unpublished'; | 
| 35 | 35 | |
| 36 | -function bigbluebuttonbn_logs(array $bbbsession, $event, array $overrides = [], $meta = NULL ) { | |
| 36 | +function bigbluebuttonbn_logs(array $bbbsession, $event, array $overrides = [], $meta = NULL) { | |
| 37 | 37 | global $DB; | 
| 38 | 38 | |
| 39 | 39 | $log = new stdClass(); | 
| 40 | 40 | |
| 41 | - $log->courseid = isset($overrides['courseid'])? $overrides['courseid']: $bbbsession['course']->id; | |
| 42 | - $log->bigbluebuttonbnid = isset($overrides['bigbluebuttonbnid'])? $overrides['bigbluebuttonbnid']: $bbbsession['bigbluebuttonbn']->id; | |
| 43 | - $log->userid = isset($overrides['userid'])? $overrides['userid']: $bbbsession['userID']; | |
| 44 | - $log->meetingid = isset($overrides['meetingid'])? $overrides['meetingid']: $bbbsession['meetingid']; | |
| 45 | - $log->timecreated = isset($overrides['timecreated'])? $overrides['timecreated']: time(); | |
| 41 | + $log->courseid = isset($overrides['courseid']) ? $overrides['courseid'] : $bbbsession['course']->id; | |
| 42 | + $log->bigbluebuttonbnid = isset($overrides['bigbluebuttonbnid']) ? $overrides['bigbluebuttonbnid'] : $bbbsession['bigbluebuttonbn']->id; | |
| 43 | + $log->userid = isset($overrides['userid']) ? $overrides['userid'] : $bbbsession['userID']; | |
| 44 | + $log->meetingid = isset($overrides['meetingid']) ? $overrides['meetingid'] : $bbbsession['meetingid']; | |
| 45 | + $log->timecreated = isset($overrides['timecreated']) ? $overrides['timecreated'] : time(); | |
| 46 | 46 | $log->log = $event; | 
| 47 | -    if ( isset($meta) ) { | |
| 47 | +    if (isset($meta)) { | |
| 48 | 48 | $log->meta = $meta; | 
| 49 | -    } else if( $event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE) { | |
| 50 | -        $log->meta = '{"record":'.($bbbsession['record']? 'true': 'false').'}'; | |
| 49 | +    } else if ($event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE) { | |
| 50 | +        $log->meta = '{"record":' . ($bbbsession['record'] ? 'true' : 'false') . '}'; | |
| 51 | 51 | } | 
| 52 | 52 | |
| 53 | 53 |      $returnid = $DB->insert_record('bigbluebuttonbn_logs', $log); | 
| @@ -56,132 +56,132 @@ discard block | ||
| 56 | 56 | //////////////////////////// | 
| 57 | 57 | // BigBlueButton API Calls // | 
| 58 | 58 | //////////////////////////// | 
| 59 | -function bigbluebuttonbn_getJoinURL( $meetingID, $userName, $PW, $SALT, $URL, $logoutURL ) { | |
| 60 | - $url_join = $URL."api/join?"; | |
| 61 | - $params = 'meetingID='.urlencode($meetingID).'&fullName='.urlencode($userName).'&password='.urlencode($PW).'&logoutURL='.urlencode($logoutURL); | |
| 62 | -    $url = $url_join.$params.'&checksum='.sha1("join".$params.$SALT); | |
| 59 | +function bigbluebuttonbn_getJoinURL($meetingID, $userName, $PW, $SALT, $URL, $logoutURL) { | |
| 60 | + $url_join = $URL . "api/join?"; | |
| 61 | + $params = 'meetingID=' . urlencode($meetingID) . '&fullName=' . urlencode($userName) . '&password=' . urlencode($PW) . '&logoutURL=' . urlencode($logoutURL); | |
| 62 | +    $url = $url_join . $params . '&checksum=' . sha1("join" . $params . $SALT); | |
| 63 | 63 | return $url; | 
| 64 | 64 | } | 
| 65 | 65 | |
| 66 | -function bigbluebuttonbn_getCreateMeetingURL($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL, $record = 'false', $duration=0, $voiceBridge=0, $maxParticipants=0, $metadata=array() ) { | |
| 67 | - $url_create = $URL."api/create?"; | |
| 66 | +function bigbluebuttonbn_getCreateMeetingURL($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL, $record = 'false', $duration = 0, $voiceBridge = 0, $maxParticipants = 0, $metadata = array()) { | |
| 67 | + $url_create = $URL . "api/create?"; | |
| 68 | 68 | |
| 69 | - $params = 'name='.urlencode($name).'&meetingID='.urlencode($meetingID).'&attendeePW='.urlencode($attendeePW).'&moderatorPW='.urlencode($moderatorPW).'&logoutURL='.urlencode($logoutURL).'&record='.$record; | |
| 69 | + $params = 'name=' . urlencode($name) . '&meetingID=' . urlencode($meetingID) . '&attendeePW=' . urlencode($attendeePW) . '&moderatorPW=' . urlencode($moderatorPW) . '&logoutURL=' . urlencode($logoutURL) . '&record=' . $record; | |
| 70 | 70 | |
| 71 | 71 | $voiceBridge = intval($voiceBridge); | 
| 72 | -    if ( $voiceBridge > 0 && $voiceBridge < 79999) { | |
| 73 | - $params .= '&voiceBridge='.$voiceBridge; | |
| 72 | +    if ($voiceBridge > 0 && $voiceBridge < 79999) { | |
| 73 | + $params .= '&voiceBridge=' . $voiceBridge; | |
| 74 | 74 | } | 
| 75 | 75 | |
| 76 | 76 | $duration = intval($duration); | 
| 77 | -    if( $duration > 0 ) { | |
| 78 | - $params .= '&duration='.$duration; | |
| 77 | +    if ($duration > 0) { | |
| 78 | + $params .= '&duration=' . $duration; | |
| 79 | 79 | } | 
| 80 | 80 | |
| 81 | 81 | $maxParticipants = intval($maxParticipants); | 
| 82 | -    if( $maxParticipants > 0 ) { | |
| 83 | - $params .= '&maxParticipants='.$maxParticipants; | |
| 82 | +    if ($maxParticipants > 0) { | |
| 83 | + $params .= '&maxParticipants=' . $maxParticipants; | |
| 84 | 84 | } | 
| 85 | 85 | |
| 86 | -    if( trim( $welcome ) ) { | |
| 87 | - $params .= '&welcome='.urlencode($welcome); | |
| 86 | +    if (trim($welcome)) { | |
| 87 | + $params .= '&welcome=' . urlencode($welcome); | |
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | 90 |      foreach ($metadata as $key => $value) { | 
| 91 | - $params .= '&'.$key.'='.urlencode($value); | |
| 91 | + $params .= '&' . $key . '=' . urlencode($value); | |
| 92 | 92 | } | 
| 93 | 93 | |
| 94 | -    $url = $url_create.$params.'&checksum='.sha1("create".$params.$SALT); | |
| 94 | +    $url = $url_create . $params . '&checksum=' . sha1("create" . $params . $SALT); | |
| 95 | 95 | return $url; | 
| 96 | 96 | } | 
| 97 | 97 | |
| 98 | -function bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) { | |
| 99 | - $base_url = $URL."api/isMeetingRunning?"; | |
| 100 | - $params = 'meetingID='.urlencode($meetingID); | |
| 101 | -    $url = $base_url.$params.'&checksum='.sha1("isMeetingRunning".$params.$SALT); | |
| 98 | +function bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT) { | |
| 99 | + $base_url = $URL . "api/isMeetingRunning?"; | |
| 100 | + $params = 'meetingID=' . urlencode($meetingID); | |
| 101 | +    $url = $base_url . $params . '&checksum=' . sha1("isMeetingRunning" . $params . $SALT); | |
| 102 | 102 | return $url; | 
| 103 | 103 | } | 
| 104 | 104 | |
| 105 | -function bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) { | |
| 106 | - $base_url = $URL."api/getMeetingInfo?"; | |
| 107 | - $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW); | |
| 108 | -    $url = $base_url.$params.'&checksum='.sha1("getMeetingInfo".$params.$SALT); | |
| 105 | +function bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT) { | |
| 106 | + $base_url = $URL . "api/getMeetingInfo?"; | |
| 107 | + $params = 'meetingID=' . urlencode($meetingID) . '&password=' . urlencode($modPW); | |
| 108 | +    $url = $base_url . $params . '&checksum=' . sha1("getMeetingInfo" . $params . $SALT); | |
| 109 | 109 | return $url; | 
| 110 | 110 | } | 
| 111 | 111 | |
| 112 | -function bigbluebuttonbn_getMeetingsURL( $URL, $SALT ) { | |
| 113 | - $base_url = $URL."api/getMeetings?"; | |
| 114 | -    $url = $base_url.'&checksum='.sha1("getMeetings".$SALT); | |
| 112 | +function bigbluebuttonbn_getMeetingsURL($URL, $SALT) { | |
| 113 | + $base_url = $URL . "api/getMeetings?"; | |
| 114 | +    $url = $base_url . '&checksum=' . sha1("getMeetings" . $SALT); | |
| 115 | 115 | return $url; | 
| 116 | 116 | } | 
| 117 | 117 | |
| 118 | -function bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) { | |
| 119 | - $base_url = $URL."api/end?"; | |
| 120 | - $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW); | |
| 121 | -    $url = $base_url.$params.'&checksum='.sha1("end".$params.$SALT); | |
| 118 | +function bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $URL, $SALT) { | |
| 119 | + $base_url = $URL . "api/end?"; | |
| 120 | + $params = 'meetingID=' . urlencode($meetingID) . '&password=' . urlencode($modPW); | |
| 121 | +    $url = $base_url . $params . '&checksum=' . sha1("end" . $params . $SALT); | |
| 122 | 122 | return $url; | 
| 123 | 123 | } | 
| 124 | 124 | |
| 125 | -function bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingID=null ) { | |
| 126 | - $base_url_record = $URL."api/getRecordings?"; | |
| 127 | -    if( $meetingID == null ) { | |
| 125 | +function bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingID = null) { | |
| 126 | + $base_url_record = $URL . "api/getRecordings?"; | |
| 127 | +    if ($meetingID == null) { | |
| 128 | 128 | $params = ""; | 
| 129 | 129 |      } else { | 
| 130 | - $params = "meetingID=".urlencode($meetingID); | |
| 130 | + $params = "meetingID=" . urlencode($meetingID); | |
| 131 | 131 | } | 
| 132 | -    $url = $base_url_record.$params."&checksum=".sha1("getRecordings".$params.$SALT); | |
| 132 | +    $url = $base_url_record . $params . "&checksum=" . sha1("getRecordings" . $params . $SALT); | |
| 133 | 133 | return $url; | 
| 134 | 134 | } | 
| 135 | 135 | |
| 136 | -function bigbluebuttonbn_getDeleteRecordingsURL( $recordID, $URL, $SALT ) { | |
| 137 | - $url_delete = $URL."api/deleteRecordings?"; | |
| 138 | - $params = 'recordID='.urlencode($recordID); | |
| 139 | -    $url = $url_delete.$params.'&checksum='.sha1("deleteRecordings".$params.$SALT); | |
| 136 | +function bigbluebuttonbn_getDeleteRecordingsURL($recordID, $URL, $SALT) { | |
| 137 | + $url_delete = $URL . "api/deleteRecordings?"; | |
| 138 | + $params = 'recordID=' . urlencode($recordID); | |
| 139 | +    $url = $url_delete . $params . '&checksum=' . sha1("deleteRecordings" . $params . $SALT); | |
| 140 | 140 | return $url; | 
| 141 | 141 | } | 
| 142 | 142 | |
| 143 | -function bigbluebuttonbn_getPublishRecordingsURL( $recordID, $set, $URL, $SALT ) { | |
| 144 | - $url_publish = $URL."api/publishRecordings?"; | |
| 145 | - $params = 'recordID='.$recordID."&publish=".$set; | |
| 146 | -    $url = $url_publish.$params.'&checksum='.sha1("publishRecordings".$params.$SALT); | |
| 143 | +function bigbluebuttonbn_getPublishRecordingsURL($recordID, $set, $URL, $SALT) { | |
| 144 | + $url_publish = $URL . "api/publishRecordings?"; | |
| 145 | + $params = 'recordID=' . $recordID . "&publish=" . $set; | |
| 146 | +    $url = $url_publish . $params . '&checksum=' . sha1("publishRecordings" . $params . $SALT); | |
| 147 | 147 | return $url; | 
| 148 | 148 | } | 
| 149 | 149 | |
| 150 | -function bigbluebuttonbn_getCreateMeetingArray( $username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL, $record='false', $duration=0, $voiceBridge=0, $maxParticipants=0, $metadata=array(), $presentation_name=null, $presentation_url=null ) { | |
| 150 | +function bigbluebuttonbn_getCreateMeetingArray($username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL, $record = 'false', $duration = 0, $voiceBridge = 0, $maxParticipants = 0, $metadata = array(), $presentation_name = null, $presentation_url = null) { | |
| 151 | 151 | $create_meeting_url = bigbluebuttonbn_getCreateMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL, $record, $duration, $voiceBridge, $maxParticipants, $metadata); | 
| 152 | -    if( !is_null($presentation_name) && !is_null($presentation_url) ) { | |
| 153 | - $xml = bigbluebuttonbn_wrap_xml_load_file( $create_meeting_url, | |
| 152 | +    if (!is_null($presentation_name) && !is_null($presentation_url)) { | |
| 153 | + $xml = bigbluebuttonbn_wrap_xml_load_file($create_meeting_url, | |
| 154 | 154 | BIGBLUEBUTTONBN_METHOD_POST, | 
| 155 | - "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='".$presentation_url."' /></module></modules>" | |
| 155 | + "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='" . $presentation_url . "' /></module></modules>" | |
| 156 | 156 | ); | 
| 157 | 157 |      } else { | 
| 158 | - $xml = bigbluebuttonbn_wrap_xml_load_file( $create_meeting_url ); | |
| 158 | + $xml = bigbluebuttonbn_wrap_xml_load_file($create_meeting_url); | |
| 159 | 159 | } | 
| 160 | 160 | |
| 161 | -    if ( $xml ) { | |
| 161 | +    if ($xml) { | |
| 162 | 162 |          if ($xml->meetingID) { | 
| 163 | -            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded ); | |
| 163 | +            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded); | |
| 164 | 164 |          } else { | 
| 165 | -            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey ); | |
| 165 | +            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); | |
| 166 | 166 | } | 
| 167 | 167 |      } else { | 
| 168 | 168 | return null; | 
| 169 | 169 | } | 
| 170 | 170 | } | 
| 171 | 171 | |
| 172 | -function bigbluebuttonbn_getMeetingsArray($meetingID, $URL, $SALT ) { | |
| 173 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL($URL, $SALT) ); | |
| 172 | +function bigbluebuttonbn_getMeetingsArray($meetingID, $URL, $SALT) { | |
| 173 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingsURL($URL, $SALT)); | |
| 174 | 174 | |
| 175 | -    if ( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey ) {    //The meetings were returned | |
| 175 | +    if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey) {    //The meetings were returned | |
| 176 | 176 |          return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); | 
| 177 | 177 | |
| 178 | -    } else if($xml && $xml->returncode == 'SUCCESS') {                    //If there were meetings already created | |
| 178 | +    } else if ($xml && $xml->returncode == 'SUCCESS') {                    //If there were meetings already created | |
| 179 | 179 |          foreach ($xml->meetings->meeting as $meeting) { | 
| 180 | - $meetings[] = array( 'meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running ); | |
| 180 | +            $meetings[] = array('meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running); | |
| 181 | 181 | } | 
| 182 | 182 | return $meetings; | 
| 183 | 183 | |
| 184 | -    } else if( $xml ) { //If the xml packet returned failure it displays the message to the user | |
| 184 | +    } else if ($xml) { //If the xml packet returned failure it displays the message to the user | |
| 185 | 185 |          return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); | 
| 186 | 186 | |
| 187 | 187 |      } else { //If the server is unreachable, then prompts the user of the necessary action | 
| @@ -189,21 +189,21 @@ discard block | ||
| 189 | 189 | } | 
| 190 | 190 | } | 
| 191 | 191 | |
| 192 | -function bigbluebuttonbn_getMeetingInfo( $meetingID, $modPW, $URL, $SALT ) { | |
| 193 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) ); | |
| 192 | +function bigbluebuttonbn_getMeetingInfo($meetingID, $modPW, $URL, $SALT) { | |
| 193 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT)); | |
| 194 | 194 | return $xml; | 
| 195 | 195 | } | 
| 196 | 196 | |
| 197 | -function bigbluebuttonbn_getMeetingInfoArray( $meetingID, $modPW, $URL, $SALT ) { | |
| 198 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) ); | |
| 197 | +function bigbluebuttonbn_getMeetingInfoArray($meetingID, $modPW, $URL, $SALT) { | |
| 198 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingInfoURL($meetingID, $modPW, $URL, $SALT)); | |
| 199 | 199 | |
| 200 | -    if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null){//The meeting info was returned | |
| 201 | -        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey ); | |
| 200 | +    if ($xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null) {//The meeting info was returned | |
| 201 | +        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); | |
| 202 | 202 | |
| 203 | -    } else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created | |
| 204 | -        return array('returncode' => $xml->returncode, 'meetingID' => $xml->meetingID, 'moderatorPW' => $xml->moderatorPW, 'attendeePW' => $xml->attendeePW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, 'running' => $xml->running, 'recording' => $xml->recording, 'startTime' => $xml->startTime, 'endTime' => $xml->endTime, 'participantCount' => $xml->participantCount, 'moderatorCount' => $xml->moderatorCount, 'attendees' => $xml->attendees, 'metadata' => $xml->metadata ); | |
| 203 | +    } else if ($xml && $xml->returncode == 'SUCCESS') { //If there were meetings already created | |
| 204 | +        return array('returncode' => $xml->returncode, 'meetingID' => $xml->meetingID, 'moderatorPW' => $xml->moderatorPW, 'attendeePW' => $xml->attendeePW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, 'running' => $xml->running, 'recording' => $xml->recording, 'startTime' => $xml->startTime, 'endTime' => $xml->endTime, 'participantCount' => $xml->participantCount, 'moderatorCount' => $xml->moderatorCount, 'attendees' => $xml->attendees, 'metadata' => $xml->metadata); | |
| 205 | 205 | |
| 206 | -    } else if( ($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user | |
| 206 | +    } else if (($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user | |
| 207 | 207 |          return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); | 
| 208 | 208 | |
| 209 | 209 |      } else { //If the server is unreachable, then prompts the user of the necessary action | 
| @@ -211,19 +211,19 @@ discard block | ||
| 211 | 211 | } | 
| 212 | 212 | } | 
| 213 | 213 | |
| 214 | -function bigbluebuttonbn_getRecordingsArray( $meetingIDs, $URL, $SALT ) { | |
| 214 | +function bigbluebuttonbn_getRecordingsArray($meetingIDs, $URL, $SALT) { | |
| 215 | 215 | $recordings = array(); | 
| 216 | 216 | |
| 217 | -    if ( is_array($meetingIDs) ) { | |
| 217 | +    if (is_array($meetingIDs)) { | |
| 218 | 218 | // getRecordings is executed using a method POST (supported only on BBB 1.0 and later) | 
| 219 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT ), BIGBLUEBUTTONBN_METHOD_POST, $meetingIDs ); | |
| 219 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT), BIGBLUEBUTTONBN_METHOD_POST, $meetingIDs); | |
| 220 | 220 |      } else { | 
| 221 | 221 | // getRecordings is executed using a method GET (supported by all versions of BBB) | 
| 222 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingIDs ) ); | |
| 222 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingIDs)); | |
| 223 | 223 | } | 
| 224 | 224 | |
| 225 | -    if ( $xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings) ) { //If there were meetings already created | |
| 226 | -        foreach ( $xml->recordings->recording as $recording ) { | |
| 225 | +    if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) { //If there were meetings already created | |
| 226 | +        foreach ($xml->recordings->recording as $recording) { | |
| 227 | 227 | $recordings[] = bigbluebuttonbn_getRecordingArrayRow($recording); | 
| 228 | 228 | } | 
| 229 | 229 | |
| @@ -233,7 +233,7 @@ discard block | ||
| 233 | 233 | return $recordings; | 
| 234 | 234 | } | 
| 235 | 235 | |
| 236 | -function bigbluebuttonbn_index_recordings($recordings, $index_key='recordID') { | |
| 236 | +function bigbluebuttonbn_index_recordings($recordings, $index_key = 'recordID') { | |
| 237 | 237 | $indexed_recordings = array(); | 
| 238 | 238 | |
| 239 | 239 |      foreach ($recordings as $recording) { | 
| @@ -243,14 +243,14 @@ discard block | ||
| 243 | 243 | return $indexed_recordings; | 
| 244 | 244 | } | 
| 245 | 245 | |
| 246 | -function bigbluebuttonbn_getRecordingArray( $recordingID, $meetingID, $URL, $SALT ) { | |
| 246 | +function bigbluebuttonbn_getRecordingArray($recordingID, $meetingID, $URL, $SALT) { | |
| 247 | 247 | $recordingArray = array(); | 
| 248 | 248 | |
| 249 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getRecordingsURL( $URL, $SALT, $meetingID ) ); | |
| 249 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getRecordingsURL($URL, $SALT, $meetingID)); | |
| 250 | 250 | |
| 251 | -    if ( $xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings) ) { //If there were meetings already created | |
| 251 | +    if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) { //If there were meetings already created | |
| 252 | 252 |          foreach ($xml->recordings->recording as $recording) { | 
| 253 | -            if( $recording->recordID == $recordingID ) { | |
| 253 | +            if ($recording->recordID == $recordingID) { | |
| 254 | 254 | $recordingArray = bigbluebuttonbn_getRecordingArrayRow($recording); | 
| 255 | 255 | break; | 
| 256 | 256 | } | 
| @@ -260,64 +260,64 @@ discard block | ||
| 260 | 260 | return $recordingArray; | 
| 261 | 261 | } | 
| 262 | 262 | |
| 263 | -function bigbluebuttonbn_getRecordingArrayRow( $recording ) { | |
| 263 | +function bigbluebuttonbn_getRecordingArrayRow($recording) { | |
| 264 | 264 | |
| 265 | 265 | $playbackArray = array(); | 
| 266 | -    foreach ( $recording->playback->format as $format ) { | |
| 267 | - $playbackArray[(string) $format->type] = array( 'type' => (string) $format->type, 'url' => (string) $format->url, 'length' => (string) $format->length ); | |
| 266 | +    foreach ($recording->playback->format as $format) { | |
| 267 | +        $playbackArray[(string)$format->type] = array('type' => (string)$format->type, 'url' => (string)$format->url, 'length' => (string)$format->length); | |
| 268 | 268 | } | 
| 269 | 269 | |
| 270 | 270 | //Add the metadata to the recordings array | 
| 271 | 271 | $metadataArray = array(); | 
| 272 | 272 | $metadata = get_object_vars($recording->metadata); | 
| 273 | -    foreach ( $metadata as $key => $value ) { | |
| 274 | -        if ( is_object($value) ) { | |
| 273 | +    foreach ($metadata as $key => $value) { | |
| 274 | +        if (is_object($value)) { | |
| 275 | 275 | $value = ''; | 
| 276 | 276 | } | 
| 277 | - $metadataArray['meta_'.$key] = $value; | |
| 277 | + $metadataArray['meta_' . $key] = $value; | |
| 278 | 278 | } | 
| 279 | 279 | |
| 280 | - $recordingArrayRow = array( 'recordID' => (string) $recording->recordID, 'meetingID' => (string) $recording->meetingID, 'meetingName' => (string) $recording->name, 'published' => (string) $recording->published, 'startTime' => (string) $recording->startTime, 'endTime' => (string) $recording->endTime, 'playbacks' => $playbackArray ) + $metadataArray; | |
| 280 | +    $recordingArrayRow = array('recordID' => (string)$recording->recordID, 'meetingID' => (string)$recording->meetingID, 'meetingName' => (string)$recording->name, 'published' => (string)$recording->published, 'startTime' => (string)$recording->startTime, 'endTime' => (string)$recording->endTime, 'playbacks' => $playbackArray) + $metadataArray; | |
| 281 | 281 | |
| 282 | 282 | return $recordingArrayRow; | 
| 283 | 283 | } | 
| 284 | 284 | |
| 285 | -function bigbluebuttonbn_recordingBuildSorter($a, $b){ | |
| 286 | -    if ( $a['startTime'] < $b['startTime'] ) { | |
| 285 | +function bigbluebuttonbn_recordingBuildSorter($a, $b) { | |
| 286 | +    if ($a['startTime'] < $b['startTime']) { | |
| 287 | 287 | return -1; | 
| 288 | -    } else if ( $a['startTime'] == $b['startTime']) { | |
| 288 | +    } else if ($a['startTime'] == $b['startTime']) { | |
| 289 | 289 | return 0; | 
| 290 | 290 |      } else { | 
| 291 | 291 | return 1; | 
| 292 | 292 | } | 
| 293 | 293 | } | 
| 294 | 294 | |
| 295 | -function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) { | |
| 296 | -    $ids = 	explode(",", $recordIDs); | |
| 297 | -    foreach( $ids as $id){ | |
| 298 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT) ); | |
| 299 | -        if( $xml && $xml->returncode != 'SUCCESS' ) { | |
| 295 | +function bigbluebuttonbn_doDeleteRecordings($recordIDs, $URL, $SALT) { | |
| 296 | +    $ids = explode(",", $recordIDs); | |
| 297 | +    foreach ($ids as $id) { | |
| 298 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT)); | |
| 299 | +        if ($xml && $xml->returncode != 'SUCCESS') { | |
| 300 | 300 | return false; | 
| 301 | 301 | } | 
| 302 | 302 | } | 
| 303 | 303 | return true; | 
| 304 | 304 | } | 
| 305 | 305 | |
| 306 | -function bigbluebuttonbn_doPublishRecordings( $recordIDs, $set, $URL, $SALT ) { | |
| 307 | -    $ids = 	explode(",", $recordIDs); | |
| 308 | -    foreach( $ids as $id){ | |
| 309 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT) ); | |
| 310 | -        if( $xml && $xml->returncode != 'SUCCESS' ) { | |
| 306 | +function bigbluebuttonbn_doPublishRecordings($recordIDs, $set, $URL, $SALT) { | |
| 307 | +    $ids = explode(",", $recordIDs); | |
| 308 | +    foreach ($ids as $id) { | |
| 309 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT)); | |
| 310 | +        if ($xml && $xml->returncode != 'SUCCESS') { | |
| 311 | 311 | return false; | 
| 312 | 312 | } | 
| 313 | 313 | } | 
| 314 | 314 | return true; | 
| 315 | 315 | } | 
| 316 | 316 | |
| 317 | -function bigbluebuttonbn_doEndMeeting( $meetingID, $modPW, $URL, $SALT ) { | |
| 318 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getEndMeetingURL( $meetingID, $modPW, $URL, $SALT ) ); | |
| 317 | +function bigbluebuttonbn_doEndMeeting($meetingID, $modPW, $URL, $SALT) { | |
| 318 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $URL, $SALT)); | |
| 319 | 319 | |
| 320 | -    if( $xml ) { //If the xml packet returned failure it displays the message to the user | |
| 320 | +    if ($xml) { //If the xml packet returned failure it displays the message to the user | |
| 321 | 321 |          return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey); | 
| 322 | 322 | } | 
| 323 | 323 |      else { //If the server is unreachable, then prompts the user of the necessary action | 
| @@ -325,46 +325,46 @@ discard block | ||
| 325 | 325 | } | 
| 326 | 326 | } | 
| 327 | 327 | |
| 328 | -function bigbluebuttonbn_isMeetingRunning( $meetingID, $URL, $SALT ) { | |
| 329 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) ); | |
| 330 | -    if ( $xml && $xml->returncode == 'SUCCESS' ) { | |
| 331 | - return ( ( $xml->running == 'true' ) ? true : false); | |
| 328 | +function bigbluebuttonbn_isMeetingRunning($meetingID, $URL, $SALT) { | |
| 329 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT)); | |
| 330 | +    if ($xml && $xml->returncode == 'SUCCESS') { | |
| 331 | + return (($xml->running == 'true') ? true : false); | |
| 332 | 332 |      } else { | 
| 333 | - return ( false ); | |
| 333 | + return (false); | |
| 334 | 334 | } | 
| 335 | 335 | } | 
| 336 | 336 | |
| 337 | 337 | |
| 338 | -function bigbluebuttonbn_getServerVersion( $URL ){ | |
| 339 | - $xml = bigbluebuttonbn_wrap_xml_load_file( $URL."api" ); | |
| 340 | -    if ( $xml && $xml->returncode == 'SUCCESS' ) { | |
| 338 | +function bigbluebuttonbn_getServerVersion($URL) { | |
| 339 | + $xml = bigbluebuttonbn_wrap_xml_load_file($URL . "api"); | |
| 340 | +    if ($xml && $xml->returncode == 'SUCCESS') { | |
| 341 | 341 | return $xml->version; | 
| 342 | 342 |      } else { | 
| 343 | 343 | return NULL; | 
| 344 | 344 | } | 
| 345 | 345 | } | 
| 346 | 346 | |
| 347 | -function bigbluebuttonbn_getMeetingXML( $meetingID, $URL, $SALT ) { | |
| 348 | - $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getIsMeetingRunningURL( $meetingID, $URL, $SALT ) ); | |
| 349 | -    if ( $xml && $xml->returncode == 'SUCCESS') { | |
| 350 | -        return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML()))); | |
| 347 | +function bigbluebuttonbn_getMeetingXML($meetingID, $URL, $SALT) { | |
| 348 | + $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT)); | |
| 349 | +    if ($xml && $xml->returncode == 'SUCCESS') { | |
| 350 | +        return (str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML()))); | |
| 351 | 351 |      } else { | 
| 352 | 352 | return 'false'; | 
| 353 | 353 | } | 
| 354 | 354 | } | 
| 355 | 355 | |
| 356 | -function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) { | |
| 357 | -    if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url); | |
| 356 | +function bigbluebuttonbn_wrap_xml_load_file($url, $method = BIGBLUEBUTTONBN_METHOD_GET, $data = null) { | |
| 357 | +    if (bigbluebuttonbn_debugdisplay()) error_log("Request to: " . $url); | |
| 358 | 358 | |
| 359 | 359 |      if (extension_loaded('curl')) { | 
| 360 | 360 | $c = new curl(); | 
| 361 | - $c->setopt( Array( "SSL_VERIFYPEER" => true)); | |
| 362 | -        if( $method == BIGBLUEBUTTONBN_METHOD_POST ) { | |
| 363 | -            if( !is_null($data) ) { | |
| 364 | -                if( !is_array($data) ) { | |
| 361 | +        $c->setopt(Array("SSL_VERIFYPEER" => true)); | |
| 362 | +        if ($method == BIGBLUEBUTTONBN_METHOD_POST) { | |
| 363 | +            if (!is_null($data)) { | |
| 364 | +                if (!is_array($data)) { | |
| 365 | 365 | $options['CURLOPT_HTTPHEADER'] = array( | 
| 366 | 366 | 'Content-Type: text/xml', | 
| 367 | - 'Content-Length: '.strlen($data), | |
| 367 | + 'Content-Length: ' . strlen($data), | |
| 368 | 368 | 'Content-Language: en-US' | 
| 369 | 369 | ); | 
| 370 | 370 | $response = $c->post($url, $data, $options); | 
| @@ -386,7 +386,7 @@ discard block | ||
| 386 | 386 |              try { | 
| 387 | 387 | $xml = new SimpleXMLElement($response, LIBXML_NOCDATA); | 
| 388 | 388 | return $xml; | 
| 389 | -            } catch (Exception $e){ | |
| 389 | +            } catch (Exception $e) { | |
| 390 | 390 | libxml_use_internal_errors($previous); | 
| 391 | 391 | // Caught exception $e->getMessage(). | 
| 392 | 392 | return NULL; | 
| @@ -399,9 +399,9 @@ discard block | ||
| 399 | 399 |      } else { | 
| 400 | 400 | $previous = libxml_use_internal_errors(true); | 
| 401 | 401 |          try { | 
| 402 | - $xml = simplexml_load_file($url,'SimpleXMLElement', LIBXML_NOCDATA); | |
| 402 | + $xml = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA); | |
| 403 | 403 | return $xml; | 
| 404 | -        } catch  (Exception $e){ | |
| 404 | +        } catch (Exception $e) { | |
| 405 | 405 | libxml_use_internal_errors($previous); | 
| 406 | 406 | return NULL; | 
| 407 | 407 | } | 
| @@ -415,10 +415,10 @@ discard block | ||
| 415 | 415 | $user_roles = get_user_roles($context, $userid); | 
| 416 | 416 |      if ($user_roles) { | 
| 417 | 417 | $where = ''; | 
| 418 | -        foreach ($user_roles as $key => $value){ | |
| 419 | - $where .= (empty($where) ? ' WHERE' : ' OR').' id='.$value->roleid; | |
| 418 | +        foreach ($user_roles as $key => $value) { | |
| 419 | + $where .= (empty($where) ? ' WHERE' : ' OR') . ' id=' . $value->roleid; | |
| 420 | 420 | } | 
| 421 | -        $user_roles = $DB->get_records_sql('SELECT * FROM {role}'.$where); | |
| 421 | +        $user_roles = $DB->get_records_sql('SELECT * FROM {role}' . $where); | |
| 422 | 422 | } | 
| 423 | 423 | return $user_roles; | 
| 424 | 424 | } | 
| @@ -429,7 +429,7 @@ discard block | ||
| 429 | 429 | } | 
| 430 | 430 | |
| 431 | 431 |  function bigbluebuttonbn_get_users(context $context = null) { | 
| 432 | - $users = get_enrolled_users($context,'',0,'u.*',null,0,0,true); | |
| 432 | + $users = get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true); | |
| 433 | 433 |      foreach ($users as $key => $value) { | 
| 434 | 434 | $users[$key] = fullname($value); | 
| 435 | 435 | } | 
| @@ -448,7 +448,7 @@ discard block | ||
| 448 | 448 | } | 
| 449 | 449 | |
| 450 | 450 |  function bigbluebuttonbn_get_users_select(context $context = null) { | 
| 451 | - $users = get_enrolled_users($context,'',0,'u.*',null,0,0,true); | |
| 451 | + $users = get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true); | |
| 452 | 452 |      foreach ($users as $key => $value) { | 
| 453 | 453 |          $users[$key] = array('id' => $value->id, 'name' => fullname($value)); | 
| 454 | 454 | } | 
| @@ -466,13 +466,13 @@ discard block | ||
| 466 | 466 | return role_get_name($role); | 
| 467 | 467 | } | 
| 468 | 468 | |
| 469 | -function bigbluebuttonbn_get_roles($rolename='all', $format='json'){ | |
| 469 | +function bigbluebuttonbn_get_roles($rolename = 'all', $format = 'json') { | |
| 470 | 470 | $roles = bigbluebuttonbn_get_moodle_roles($rolename); | 
| 471 | 471 | $roles_array = array(); | 
| 472 | -    foreach($roles as $role) { | |
| 473 | -        if( $format=='json' ) { | |
| 472 | +    foreach ($roles as $role) { | |
| 473 | +        if ($format == 'json') { | |
| 474 | 474 | array_push($roles_array, | 
| 475 | - array( "id" => $role->id, | |
| 475 | +                    array("id" => $role->id, | |
| 476 | 476 | "name" => bigbluebuttonbn_get_role_name($role->id) | 
| 477 | 477 | ) | 
| 478 | 478 | ); | 
| @@ -483,12 +483,12 @@ discard block | ||
| 483 | 483 | return $roles_array; | 
| 484 | 484 | } | 
| 485 | 485 | |
| 486 | -function bigbluebuttonbn_get_roles_json($rolename='all'){ | |
| 486 | +function bigbluebuttonbn_get_roles_json($rolename = 'all') { | |
| 487 | 487 | return json_encode(bigbluebuttonbn_get_roles($rolename)); | 
| 488 | 488 | } | 
| 489 | 489 | |
| 490 | 490 |  function bigbluebuttonbn_get_roles_select(context $context = null) { | 
| 491 | - $roles = (array) role_get_names($context); | |
| 491 | + $roles = (array)role_get_names($context); | |
| 492 | 492 |      foreach ($roles as $key => $value) { | 
| 493 | 493 |          $roles[$key] = array('id' => $value->id, 'name' => $value->localname); | 
| 494 | 494 | } | 
| @@ -496,7 +496,7 @@ discard block | ||
| 496 | 496 | } | 
| 497 | 497 | |
| 498 | 498 |  function bigbluebuttonbn_get_role($id) { | 
| 499 | - $roles = (array) role_get_names(); | |
| 499 | + $roles = (array)role_get_names(); | |
| 500 | 500 |      if (is_numeric($id) && array_key_exists($id, $roles)) { | 
| 501 | 501 | return $roles[$id]; | 
| 502 | 502 | } | 
| @@ -595,8 +595,8 @@ discard block | ||
| 595 | 595 | } | 
| 596 | 596 | // Iterate looking for all configuration. | 
| 597 | 597 |      foreach ($participantlist as $participant) { | 
| 598 | -        if( $participant->selectiontype == 'all' ) { | |
| 599 | -            if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) { | |
| 598 | +        if ($participant->selectiontype == 'all') { | |
| 599 | +            if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR) { | |
| 600 | 600 | return true; | 
| 601 | 601 | } | 
| 602 | 602 | } | 
| @@ -607,22 +607,22 @@ discard block | ||
| 607 | 607 |          if ($participant->selectiontype == 'role') { | 
| 608 | 608 | $selectionid = $participant->selectionid; | 
| 609 | 609 | // For backward compatibility when selectiontype contains the role shortname. | 
| 610 | -            if ( !is_numeric($selectionid) ) { | |
| 610 | +            if (!is_numeric($selectionid)) { | |
| 611 | 611 | $moodlerole = bigbluebuttonbn_moodle_db_role_lookup($moodleroles, $selectionid); | 
| 612 | 612 | $selectionid = $moodlerole->id; | 
| 613 | 613 | } | 
| 614 | 614 |              if (array_key_exists($selectionid, $roles)) { | 
| 615 | -                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) { | |
| 615 | +                if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR) { | |
| 616 | 616 | return true; | 
| 617 | 617 | } | 
| 618 | 618 | } | 
| 619 | 619 | } | 
| 620 | 620 | } | 
| 621 | 621 | // Iterate looking for users. | 
| 622 | -    foreach($participantlist as $participant) { | |
| 623 | -        if( $participant->selectiontype == 'user' ) { | |
| 624 | -            if( $participant->selectionid == $user ) { | |
| 625 | -                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) { | |
| 622 | +    foreach ($participantlist as $participant) { | |
| 623 | +        if ($participant->selectiontype == 'user') { | |
| 624 | +            if ($participant->selectionid == $user) { | |
| 625 | +                if ($participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR) { | |
| 626 | 626 | return true; | 
| 627 | 627 | } | 
| 628 | 628 | } | 
| @@ -632,11 +632,11 @@ discard block | ||
| 632 | 632 | } | 
| 633 | 633 | |
| 634 | 634 |  function bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role_id) { | 
| 635 | -    if ( is_numeric($role_id) && array_key_exists($role_id, $db_moodle_roles) ) { | |
| 635 | +    if (is_numeric($role_id) && array_key_exists($role_id, $db_moodle_roles)) { | |
| 636 | 636 | return $db_moodle_roles[$role_id]; | 
| 637 | 637 | } | 
| 638 | -    foreach( $db_moodle_roles as $db_moodle_role ) { | |
| 639 | -        if ( $role_id == $db_moodle_role->shortname ) { | |
| 638 | +    foreach ($db_moodle_roles as $db_moodle_role) { | |
| 639 | +        if ($role_id == $db_moodle_role->shortname) { | |
| 640 | 640 | return $db_moodle_role; | 
| 641 | 641 | } | 
| 642 | 642 | } | 
| @@ -644,25 +644,25 @@ discard block | ||
| 644 | 644 | |
| 645 | 645 |  function bigbluebuttonbn_get_error_key($messageKey, $defaultKey = null) { | 
| 646 | 646 | $key = $defaultKey; | 
| 647 | -    if ( $messageKey == "checksumError" ) { | |
| 647 | +    if ($messageKey == "checksumError") { | |
| 648 | 648 | $key = 'index_error_checksum'; | 
| 649 | -    } else if ( $messageKey == 'maxConcurrent' ) { | |
| 649 | +    } else if ($messageKey == 'maxConcurrent') { | |
| 650 | 650 | $key = 'view_error_max_concurrent'; | 
| 651 | 651 | } | 
| 652 | 652 | return $key; | 
| 653 | 653 | } | 
| 654 | 654 | |
| 655 | -function bigbluebuttonbn_voicebridge_unique($voicebridge, $id=null) { | |
| 655 | +function bigbluebuttonbn_voicebridge_unique($voicebridge, $id = null) { | |
| 656 | 656 | global $DB; | 
| 657 | 657 | |
| 658 | 658 | $is_unique = true; | 
| 659 | -    if ( $voicebridge != 0 ) { | |
| 659 | +    if ($voicebridge != 0) { | |
| 660 | 660 | $table = "bigbluebuttonbn"; | 
| 661 | - $select = "voicebridge = ".$voicebridge; | |
| 662 | -        if ( $id ) { | |
| 663 | - $select .= " AND id <> ".$id; | |
| 661 | + $select = "voicebridge = " . $voicebridge; | |
| 662 | +        if ($id) { | |
| 663 | + $select .= " AND id <> " . $id; | |
| 664 | 664 | } | 
| 665 | -        if ( $rooms = $DB->get_records_select($table, $select)  ) { | |
| 665 | +        if ($rooms = $DB->get_records_select($table, $select)) { | |
| 666 | 666 | $is_unique = false; | 
| 667 | 667 | } | 
| 668 | 668 | } | 
| @@ -675,8 +675,8 @@ discard block | ||
| 675 | 675 | |
| 676 | 676 | $duration = 0; | 
| 677 | 677 | $now = time(); | 
| 678 | -    if ( $closingtime > 0 && $now < $closingtime ) { | |
| 679 | - $duration = ceil(($closingtime - $now)/60); | |
| 678 | +    if ($closingtime > 0 && $now < $closingtime) { | |
| 679 | + $duration = ceil(($closingtime - $now) / 60); | |
| 680 | 680 | $compensation_time = intval(bigbluebuttonbn_get_cfg_scheduled_duration_compensation()); | 
| 681 | 681 | $duration = intval($duration) + $compensation_time; | 
| 682 | 682 | } | 
| @@ -684,13 +684,13 @@ discard block | ||
| 684 | 684 | return $duration; | 
| 685 | 685 | } | 
| 686 | 686 | |
| 687 | -function bigbluebuttonbn_get_presentation_array($context, $presentation, $id=null) { | |
| 687 | +function bigbluebuttonbn_get_presentation_array($context, $presentation, $id = null) { | |
| 688 | 688 | $presentation_name = null; | 
| 689 | 689 | $presentation_url = null; | 
| 690 | 690 | $presentation_icon = null; | 
| 691 | 691 | $presentation_mimetype_description = null; | 
| 692 | 692 | |
| 693 | -    if ( !empty($presentation) ) { | |
| 693 | +    if (!empty($presentation)) { | |
| 694 | 694 | $fs = get_file_storage(); | 
| 695 | 695 | $files = $fs->get_area_files($context->id, 'mod_bigbluebuttonbn', 'presentation', 0, 'itemid, filepath, filename', false); | 
| 696 | 696 |          if (count($files) < 1) { | 
| @@ -704,12 +704,12 @@ discard block | ||
| 704 | 704 | $presentation_icon = file_file_icon($file, 24); | 
| 705 | 705 | $presentation_mimetype_description = get_mimetype_description($file); | 
| 706 | 706 | |
| 707 | -            if( !is_null($id) ) { | |
| 707 | +            if (!is_null($id)) { | |
| 708 | 708 | //Create the nonce component for granting a temporary public access | 
| 709 | 709 | $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'presentation_cache'); | 
| 710 | 710 | $presentation_nonce_key = sha1($id); | 
| 711 | 711 | $presentation_nonce_value = bigbluebuttonbn_generate_nonce(); | 
| 712 | - $cache->set($presentation_nonce_key, array( "value" => $presentation_nonce_value, "counter" => 0 )); | |
| 712 | +                $cache->set($presentation_nonce_key, array("value" => $presentation_nonce_value, "counter" => 0)); | |
| 713 | 713 | |
| 714 | 714 | //The item id was adapted for granting public access to the presentation once in order to allow BigBlueButton to gather the file | 
| 715 | 715 | $url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(), $file->get_filearea(), $presentation_nonce_value, $file->get_filepath(), $file->get_filename()); | 
| @@ -720,7 +720,7 @@ discard block | ||
| 720 | 720 | } | 
| 721 | 721 | } | 
| 722 | 722 | |
| 723 | - $presentation_array = array( "url" => $presentation_url, "name" => $presentation_name, "icon" => $presentation_icon, "mimetype_description" => $presentation_mimetype_description); | |
| 723 | +    $presentation_array = array("url" => $presentation_url, "name" => $presentation_name, "icon" => $presentation_icon, "mimetype_description" => $presentation_mimetype_description); | |
| 724 | 724 | |
| 725 | 725 | return $presentation_array; | 
| 726 | 726 | } | 
| @@ -730,13 +730,13 @@ discard block | ||
| 730 | 730 | $mt = microtime(); | 
| 731 | 731 | $rand = mt_rand(); | 
| 732 | 732 | |
| 733 | - return md5($mt.$rand); | |
| 733 | + return md5($mt . $rand); | |
| 734 | 734 | } | 
| 735 | 735 | |
| 736 | -function bigbluebuttonbn_random_password( $length = 8 ) { | |
| 736 | +function bigbluebuttonbn_random_password($length = 8) { | |
| 737 | 737 | |
| 738 | 738 | $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?"; | 
| 739 | - $password = substr( str_shuffle( $chars ), 0, $length ); | |
| 739 | + $password = substr(str_shuffle($chars), 0, $length); | |
| 740 | 740 | |
| 741 | 741 | return $password; | 
| 742 | 742 | } | 
| @@ -828,7 +828,7 @@ discard block | ||
| 828 | 828 | global $CFG; | 
| 829 | 829 | |
| 830 | 830 | $version_major = bigbluebuttonbn_get_moodle_version_major(); | 
| 831 | -    if ( $version_major < '2014051200' ) { | |
| 831 | +    if ($version_major < '2014051200') { | |
| 832 | 832 | //This is valid before v2.7 | 
| 833 | 833 | bigbluebuttonbn_event_log_legacy($event_type, $bigbluebuttonbn, $context, $cm); | 
| 834 | 834 | |
| @@ -838,7 +838,7 @@ discard block | ||
| 838 | 838 | } | 
| 839 | 839 | } | 
| 840 | 840 | |
| 841 | -function bigbluebuttonbn_bbb_broker_get_recordings($meetingid, $password, $forced=false) { | |
| 841 | +function bigbluebuttonbn_bbb_broker_get_recordings($meetingid, $password, $forced = false) { | |
| 842 | 842 | global $CFG; | 
| 843 | 843 | |
| 844 | 844 | $recordings = array(); | 
| @@ -854,19 +854,19 @@ discard block | ||
| 854 | 854 | $result = $cache->get($meetingid); | 
| 855 | 855 | $meeting_info = json_decode($result['meeting_info']); | 
| 856 | 856 | $meeting_info->participantCount += 1; | 
| 857 | -    if( $is_moderator ) { | |
| 857 | +    if ($is_moderator) { | |
| 858 | 858 | $meeting_info->moderatorCount += 1; | 
| 859 | 859 | } | 
| 860 | -    $cache->set($meetingid, array('creation_time' => $result['creation_time'], 'meeting_info' => json_encode($meeting_info) )); | |
| 860 | +    $cache->set($meetingid, array('creation_time' => $result['creation_time'], 'meeting_info' => json_encode($meeting_info))); | |
| 861 | 861 | } | 
| 862 | 862 | |
| 863 | 863 |  function bigbluebuttonbn_bbb_broker_is_meeting_running($meeting_info) { | 
| 864 | - $meeting_running = ( isset($meeting_info) && isset($meeting_info->returncode) && $meeting_info->returncode == 'SUCCESS' ); | |
| 864 | + $meeting_running = (isset($meeting_info) && isset($meeting_info->returncode) && $meeting_info->returncode == 'SUCCESS'); | |
| 865 | 865 | |
| 866 | 866 | return $meeting_running; | 
| 867 | 867 | } | 
| 868 | 868 | |
| 869 | -function bigbluebuttonbn_bbb_broker_get_meeting_info($meetingid, $password, $forced=false) { | |
| 869 | +function bigbluebuttonbn_bbb_broker_get_meeting_info($meetingid, $password, $forced = false) { | |
| 870 | 870 | global $CFG; | 
| 871 | 871 | |
| 872 | 872 | $meeting_info = array(); | 
| @@ -877,19 +877,19 @@ discard block | ||
| 877 | 877 | $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn', 'meetings_cache'); | 
| 878 | 878 | $result = $cache->get($meetingid); | 
| 879 | 879 | $now = time(); | 
| 880 | -    if( isset($result) && $now < ($result['creation_time'] + $cache_ttl) && !$forced ) { | |
| 880 | +    if (isset($result) && $now < ($result['creation_time'] + $cache_ttl) && !$forced) { | |
| 881 | 881 | //Use the value in the cache | 
| 882 | 882 | $meeting_info = json_decode($result['meeting_info']); | 
| 883 | 883 |      } else { | 
| 884 | 884 | //Ping again and refresh the cache | 
| 885 | - $meeting_info = (array) bigbluebuttonbn_getMeetingInfo( $meetingid, $password, $endpoint, $shared_secret ); | |
| 886 | -        $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meeting_info) )); | |
| 885 | + $meeting_info = (array)bigbluebuttonbn_getMeetingInfo($meetingid, $password, $endpoint, $shared_secret); | |
| 886 | +        $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meeting_info))); | |
| 887 | 887 | } | 
| 888 | 888 | |
| 889 | 889 | return $meeting_info; | 
| 890 | 890 | } | 
| 891 | 891 | |
| 892 | -function bigbluebuttonbn_bbb_broker_do_end_meeting($meetingid, $password){ | |
| 892 | +function bigbluebuttonbn_bbb_broker_do_end_meeting($meetingid, $password) { | |
| 893 | 893 | global $CFG; | 
| 894 | 894 | |
| 895 | 895 | $endpoint = bigbluebuttonbn_get_cfg_server_url(); | 
| @@ -898,16 +898,16 @@ discard block | ||
| 898 | 898 | bigbluebuttonbn_doEndMeeting($meetingid, $password, $endpoint, $shared_secret); | 
| 899 | 899 | } | 
| 900 | 900 | |
| 901 | -function bigbluebuttonbn_bbb_broker_do_publish_recording($recordingid, $publish=true){ | |
| 901 | +function bigbluebuttonbn_bbb_broker_do_publish_recording($recordingid, $publish = true) { | |
| 902 | 902 | global $CFG; | 
| 903 | 903 | |
| 904 | 904 | $endpoint = bigbluebuttonbn_get_cfg_server_url(); | 
| 905 | 905 | $shared_secret = bigbluebuttonbn_get_cfg_shared_secret(); | 
| 906 | 906 | |
| 907 | - bigbluebuttonbn_doPublishRecordings($recordingid, ($publish)? 'true': 'false', $endpoint, $shared_secret); | |
| 907 | + bigbluebuttonbn_doPublishRecordings($recordingid, ($publish) ? 'true' : 'false', $endpoint, $shared_secret); | |
| 908 | 908 | } | 
| 909 | 909 | |
| 910 | -function bigbluebuttonbn_bbb_broker_do_publish_recording_imported($recordingid, $courseID, $bigbluebuttonbnID, $publish=true){ | |
| 910 | +function bigbluebuttonbn_bbb_broker_do_publish_recording_imported($recordingid, $courseID, $bigbluebuttonbnID, $publish = true) { | |
| 911 | 911 | global $DB; | 
| 912 | 912 | |
| 913 | 913 | //Locate the record to be updated | 
| @@ -916,9 +916,9 @@ discard block | ||
| 916 | 916 | $recordings_imported = array(); | 
| 917 | 917 |      foreach ($records as $key => $record) { | 
| 918 | 918 | $meta = json_decode($record->meta, true); | 
| 919 | -        if( $recordingid == $meta['recording']['recordID'] ) { | |
| 919 | +        if ($recordingid == $meta['recording']['recordID']) { | |
| 920 | 920 | // Found, prepare data for the update | 
| 921 | - $meta['recording']['published'] = ($publish)? 'true': 'false'; | |
| 921 | + $meta['recording']['published'] = ($publish) ? 'true' : 'false'; | |
| 922 | 922 | $records[$key]->meta = json_encode($meta); | 
| 923 | 923 | |
| 924 | 924 | // Proceed with the update | 
| @@ -927,7 +927,7 @@ discard block | ||
| 927 | 927 | } | 
| 928 | 928 | } | 
| 929 | 929 | |
| 930 | -function bigbluebuttonbn_bbb_broker_do_delete_recording($recordingid){ | |
| 930 | +function bigbluebuttonbn_bbb_broker_do_delete_recording($recordingid) { | |
| 931 | 931 | global $CFG; | 
| 932 | 932 | |
| 933 | 933 | $endpoint = bigbluebuttonbn_get_cfg_server_url(); | 
| @@ -936,7 +936,7 @@ discard block | ||
| 936 | 936 | bigbluebuttonbn_doDeleteRecordings($recordingid, $endpoint, $shared_secret); | 
| 937 | 937 | } | 
| 938 | 938 | |
| 939 | -function bigbluebuttonbn_bbb_broker_do_delete_recording_imported($recordingid, $courseID, $bigbluebuttonbnID){ | |
| 939 | +function bigbluebuttonbn_bbb_broker_do_delete_recording_imported($recordingid, $courseID, $bigbluebuttonbnID) { | |
| 940 | 940 | global $DB; | 
| 941 | 941 | |
| 942 | 942 | //Locate the record to be updated | 
| @@ -945,7 +945,7 @@ discard block | ||
| 945 | 945 | $recordings_imported = array(); | 
| 946 | 946 |      foreach ($records as $key => $record) { | 
| 947 | 947 | $meta = json_decode($record->meta, true); | 
| 948 | -        if( $recordingid == $meta['recording']['recordID'] ) { | |
| 948 | +        if ($recordingid == $meta['recording']['recordID']) { | |
| 949 | 949 | // Execute delete | 
| 950 | 950 |              $DB->delete_records("bigbluebuttonbn_logs", array('id' => $key)); | 
| 951 | 951 | } | 
| @@ -955,18 +955,18 @@ discard block | ||
| 955 | 955 |  function bigbluebuttonbn_bbb_broker_validate_parameters($params) { | 
| 956 | 956 | $error = ''; | 
| 957 | 957 | |
| 958 | -    if ( !isset($params['callback']) ) { | |
| 958 | +    if (!isset($params['callback'])) { | |
| 959 | 959 | $error = bigbluebuttonbn_bbb_broker_add_error($error, 'This call must include a javascript callback.'); | 
| 960 | 960 | } | 
| 961 | 961 | |
| 962 | -    if ( !isset($params['action']) ) { | |
| 962 | +    if (!isset($params['action'])) { | |
| 963 | 963 | $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action parameter must be included.'); | 
| 964 | 964 |      } else { | 
| 965 | -        switch ( strtolower($params['action']) ){ | |
| 965 | +        switch (strtolower($params['action'])) { | |
| 966 | 966 | case 'server_ping': | 
| 967 | 967 | case 'meeting_info': | 
| 968 | 968 | case 'meeting_end': | 
| 969 | -                if ( !isset($params['id']) ) { | |
| 969 | +                if (!isset($params['id'])) { | |
| 970 | 970 | $error = bigbluebuttonbn_bbb_broker_add_error($error, 'The meetingID must be specified.'); | 
| 971 | 971 | } | 
| 972 | 972 | break; | 
| @@ -976,76 +976,76 @@ discard block | ||
| 976 | 976 | case 'recording_unpublish': | 
| 977 | 977 | case 'recording_delete': | 
| 978 | 978 | case 'recording_import': | 
| 979 | -                if ( !isset($params['id']) ) { | |
| 979 | +                if (!isset($params['id'])) { | |
| 980 | 980 | $error = bigbluebuttonbn_bbb_broker_add_error($error, 'The recordingID must be specified.'); | 
| 981 | 981 | } | 
| 982 | 982 | break; | 
| 983 | 983 | case 'recording_ready': | 
| 984 | -                if( empty($params['signed_parameters']) ) { | |
| 984 | +                if (empty($params['signed_parameters'])) { | |
| 985 | 985 | $error = bigbluebuttonbn_bbb_broker_add_error($error, 'A JWT encoded string must be included as [signed_parameters].'); | 
| 986 | 986 | } | 
| 987 | 987 | break; | 
| 988 | 988 | default: | 
| 989 | - $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action '.$params['action'].' can not be performed.'); | |
| 989 | + $error = bigbluebuttonbn_bbb_broker_add_error($error, 'Action ' . $params['action'] . ' can not be performed.'); | |
| 990 | 990 | } | 
| 991 | 991 | } | 
| 992 | 992 | |
| 993 | 993 | return $error; | 
| 994 | 994 | } | 
| 995 | 995 | |
| 996 | -function bigbluebuttonbn_bbb_broker_add_error($org_msg, $new_msg='') { | |
| 996 | +function bigbluebuttonbn_bbb_broker_add_error($org_msg, $new_msg = '') { | |
| 997 | 997 | $error = $org_msg; | 
| 998 | 998 | |
| 999 | -    if( !empty($new_msg) ) { | |
| 1000 | - if( !empty($error) ) $error .= ' '; | |
| 999 | +    if (!empty($new_msg)) { | |
| 1000 | + if (!empty($error)) $error .= ' '; | |
| 1001 | 1001 | $error .= $new_msg; | 
| 1002 | 1002 | } | 
| 1003 | 1003 | |
| 1004 | 1004 | return $error; | 
| 1005 | 1005 | } | 
| 1006 | 1006 | |
| 1007 | -function bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools=["publishing", "deleting"]) { | |
| 1007 | +function bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools = ["publishing", "deleting"]) { | |
| 1008 | 1008 | global $OUTPUT, $CFG, $USER; | 
| 1009 | 1009 | |
| 1010 | 1010 | $row = null; | 
| 1011 | 1011 | |
| 1012 | -    if ( $bbbsession['managerecordings'] || $recording['published'] == 'true' ) { | |
| 1013 | - $startTime = isset($recording['startTime'])? floatval($recording['startTime']):0; | |
| 1012 | +    if ($bbbsession['managerecordings'] || $recording['published'] == 'true') { | |
| 1013 | + $startTime = isset($recording['startTime']) ? floatval($recording['startTime']) : 0; | |
| 1014 | 1014 | $startTime = $startTime - ($startTime % 1000); | 
| 1015 | 1015 | $duration = intval(array_values($recording['playbacks'])[0]['length']); | 
| 1016 | 1016 | |
| 1017 | 1017 | //For backward compatibility | 
| 1018 | -        if( isset($recording['meta_contextactivity']) ) { | |
| 1018 | +        if (isset($recording['meta_contextactivity'])) { | |
| 1019 | 1019 |              $meta_activity = str_replace('"', '\"', $recording['meta_contextactivity']); | 
| 1020 | -        } if( isset($recording['meta_bbb-recording-name']) ) { | |
| 1020 | +        } if (isset($recording['meta_bbb-recording-name'])) { | |
| 1021 | 1021 |              $meta_activity = str_replace('"', '\"', $recording['meta_bbb-recording-name']); | 
| 1022 | 1022 |          } else { | 
| 1023 | 1023 |              $meta_activity = str_replace('"', '\"', $recording['meetingName']); | 
| 1024 | 1024 | } | 
| 1025 | 1025 | |
| 1026 | -        if( isset($recording['meta_contextactivitydescription']) ) { | |
| 1026 | +        if (isset($recording['meta_contextactivitydescription'])) { | |
| 1027 | 1027 |              $meta_description = str_replace('"', '\"', $recording['meta_contextactivitydescription']); | 
| 1028 | -        } else if( isset($recording['meta_bbb-recording-description']) ) { | |
| 1028 | +        } else if (isset($recording['meta_bbb-recording-description'])) { | |
| 1029 | 1029 |              $meta_description = str_replace('"', '\"', $recording['meta_bbb-recording-description']); | 
| 1030 | 1030 |          } else { | 
| 1031 | 1031 | $meta_description = ''; | 
| 1032 | 1032 | } | 
| 1033 | 1033 | |
| 1034 | 1034 | //Set recording_types | 
| 1035 | -        if ( isset($recording['imported']) ) { | |
| 1036 | -            $attributes = 'data-imported="true" title='.get_string('view_recording_link_warning', 'bigbluebuttonbn'); | |
| 1035 | +        if (isset($recording['imported'])) { | |
| 1036 | +            $attributes = 'data-imported="true" title=' . get_string('view_recording_link_warning', 'bigbluebuttonbn'); | |
| 1037 | 1037 |          } else { | 
| 1038 | 1038 | $attributes = 'data-imported="false"'; | 
| 1039 | 1039 | } | 
| 1040 | 1040 | |
| 1041 | 1041 | $recording_types = ''; | 
| 1042 | 1042 |          if ($recording['published'] == 'true') { | 
| 1043 | - $recording_types .= '<div id="playbacks-'.$recording['recordID'].'" '.$attributes.'>'; | |
| 1043 | + $recording_types .= '<div id="playbacks-' . $recording['recordID'] . '" ' . $attributes . '>'; | |
| 1044 | 1044 |          } else { | 
| 1045 | - $recording_types .= '<div id="playbacks-'.$recording['recordID'].'" '.$attributes.'" hidden>'; | |
| 1045 | + $recording_types .= '<div id="playbacks-' . $recording['recordID'] . '" ' . $attributes . '" hidden>'; | |
| 1046 | 1046 | } | 
| 1047 | -        foreach ( $recording['playbacks'] as $playback ) { | |
| 1048 | -            $recording_types .= $OUTPUT->action_link($playback['url'], get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn'), null, array('title' => get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn'), 'target' => '_new') ).' '; | |
| 1047 | +        foreach ($recording['playbacks'] as $playback) { | |
| 1048 | +            $recording_types .= $OUTPUT->action_link($playback['url'], get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn'), null, array('title' => get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn'), 'target' => '_new')) . ' '; | |
| 1049 | 1049 | } | 
| 1050 | 1050 | $recording_types .= '</div>'; | 
| 1051 | 1051 | |
| @@ -1054,11 +1054,11 @@ discard block | ||
| 1054 | 1054 | |
| 1055 | 1055 | //Set actionbar, if user is allowed to manage recordings | 
| 1056 | 1056 | $actionbar = ''; | 
| 1057 | -        if ( $bbbsession['managerecordings'] ) { | |
| 1057 | +        if ($bbbsession['managerecordings']) { | |
| 1058 | 1058 | // Set style for imported links | 
| 1059 | -            if( isset($recording['imported']) ) { | |
| 1059 | +            if (isset($recording['imported'])) { | |
| 1060 | 1060 | $recordings_imported_count = 0; | 
| 1061 | -                $tag_tail = ' '.get_string('view_recording_link', 'bigbluebuttonbn'); | |
| 1061 | +                $tag_tail = ' ' . get_string('view_recording_link', 'bigbluebuttonbn'); | |
| 1062 | 1062 | $head = '<i>'; | 
| 1063 | 1063 | $tail = '</i>'; | 
| 1064 | 1064 |              } else { | 
| @@ -1072,53 +1072,53 @@ discard block | ||
| 1072 | 1072 | |
| 1073 | 1073 |              if (in_array("publishing", $tools)) { | 
| 1074 | 1074 | ///Set action [show|hide] | 
| 1075 | -                if ( $recording['published'] == 'true' ){ | |
| 1075 | +                if ($recording['published'] == 'true') { | |
| 1076 | 1076 | $manage_tag = 'hide'; | 
| 1077 | 1077 | $manage_action = 'unpublish'; | 
| 1078 | 1078 |                  } else { | 
| 1079 | 1079 | $manage_tag = 'show'; | 
| 1080 | 1080 | $manage_action = 'publish'; | 
| 1081 | 1081 | } | 
| 1082 | -                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("'.$manage_action.'", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");'; | |
| 1082 | +                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("' . $manage_action . '", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");'; | |
| 1083 | 1083 | |
| 1084 | -                if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) { | |
| 1084 | +                if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) { | |
| 1085 | 1085 | //With icon for publish/unpublish | 
| 1086 | -                    $icon_attributes = array('id' => 'recording-btn-'.$manage_action.'-'.$recording['recordID']); | |
| 1087 | -                    $icon = new pix_icon('t/'.$manage_tag, get_string($manage_tag).$tag_tail, 'moodle', $icon_attributes); | |
| 1088 | -                    $link_attributes = array('id' => 'recording-link-'.$manage_action.'-'.$recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count); | |
| 1086 | +                    $icon_attributes = array('id' => 'recording-btn-' . $manage_action . '-' . $recording['recordID']); | |
| 1087 | +                    $icon = new pix_icon('t/' . $manage_tag, get_string($manage_tag) . $tag_tail, 'moodle', $icon_attributes); | |
| 1088 | +                    $link_attributes = array('id' => 'recording-link-' . $manage_action . '-' . $recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count); | |
| 1089 | 1089 | $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false); | 
| 1090 | 1090 |                  } else { | 
| 1091 | 1091 | //With text for publish/unpublish | 
| 1092 | -                    $link_attributes = array('title' => get_string($manage_tag).$tag_tail, 'class' => 'btn btn-xs', 'onclick' => $onclick, 'data-links' => $recordings_imported_count); | |
| 1093 | - $actionbar .= $OUTPUT->action_link($url, get_string($manage_tag).$tag_tail, $action, $link_attributes); | |
| 1092 | +                    $link_attributes = array('title' => get_string($manage_tag) . $tag_tail, 'class' => 'btn btn-xs', 'onclick' => $onclick, 'data-links' => $recordings_imported_count); | |
| 1093 | + $actionbar .= $OUTPUT->action_link($url, get_string($manage_tag) . $tag_tail, $action, $link_attributes); | |
| 1094 | 1094 | $actionbar .= " "; | 
| 1095 | 1095 | } | 
| 1096 | 1096 | } | 
| 1097 | 1097 | |
| 1098 | 1098 |              if (in_array("deleting", $tools)) { | 
| 1099 | -                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("delete", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");'; | |
| 1099 | +                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("delete", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");'; | |
| 1100 | 1100 | |
| 1101 | -                if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) { | |
| 1101 | +                if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) { | |
| 1102 | 1102 | //With icon for delete | 
| 1103 | -                    $icon_attributes = array('id' => 'recording-btn-delete-'.$recording['recordID']); | |
| 1104 | -                    $icon = new pix_icon('t/delete', get_string('delete').$tag_tail, 'moodle', $icon_attributes); | |
| 1105 | -                    $link_attributes = array('id' => 'recording-link-delete-'.$recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count); | |
| 1103 | +                    $icon_attributes = array('id' => 'recording-btn-delete-' . $recording['recordID']); | |
| 1104 | +                    $icon = new pix_icon('t/delete', get_string('delete') . $tag_tail, 'moodle', $icon_attributes); | |
| 1105 | +                    $link_attributes = array('id' => 'recording-link-delete-' . $recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count); | |
| 1106 | 1106 | $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false); | 
| 1107 | 1107 |                  } else { | 
| 1108 | 1108 | //With text for delete | 
| 1109 | -                    $link_attributes = array('title' => get_string('delete').$tag_tail, 'class' => 'btn btn-xs btn-danger', 'onclick' => $onclick, 'data-links' => $recordings_imported_count); | |
| 1110 | -                    $actionbar .= $OUTPUT->action_link($url, get_string('delete').$tag_tail, $action, $link_attributes); | |
| 1109 | +                    $link_attributes = array('title' => get_string('delete') . $tag_tail, 'class' => 'btn btn-xs btn-danger', 'onclick' => $onclick, 'data-links' => $recordings_imported_count); | |
| 1110 | +                    $actionbar .= $OUTPUT->action_link($url, get_string('delete') . $tag_tail, $action, $link_attributes); | |
| 1111 | 1111 | } | 
| 1112 | 1112 | } | 
| 1113 | 1113 | |
| 1114 | 1114 |              if (in_array("importing", $tools)) { | 
| 1115 | -                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("import", "'.$recording['recordID'].'", "'.$recording['meetingID'].'");'; | |
| 1115 | +                $onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("import", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");'; | |
| 1116 | 1116 | |
| 1117 | -                if ( bigbluebuttonbn_get_cfg_recording_icons_enabled() ) { | |
| 1117 | +                if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) { | |
| 1118 | 1118 | //With icon for import | 
| 1119 | -                    $icon_attributes = array('id' => 'recording-btn-import-'.$recording['recordID']); | |
| 1119 | +                    $icon_attributes = array('id' => 'recording-btn-import-' . $recording['recordID']); | |
| 1120 | 1120 |                      $icon = new pix_icon('i/import', get_string('import'), 'moodle', $icon_attributes); | 
| 1121 | -                    $link_attributes = array('id' => 'recording-link-import-'.$recording['recordID'], 'onclick' => $onclick); | |
| 1121 | +                    $link_attributes = array('id' => 'recording-link-import-' . $recording['recordID'], 'onclick' => $onclick); | |
| 1122 | 1122 | $actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false); | 
| 1123 | 1123 |                  } else { | 
| 1124 | 1124 | //With text for import | 
| @@ -1129,7 +1129,7 @@ discard block | ||
| 1129 | 1129 | } | 
| 1130 | 1130 | |
| 1131 | 1131 | //Set corresponding format | 
| 1132 | -        $dateformat = get_string('strftimerecentfull', 'langconfig').' %Z'; | |
| 1132 | +        $dateformat = get_string('strftimerecentfull', 'langconfig') . ' %Z'; | |
| 1133 | 1133 | $formattedStartDate = userdate($startTime / 1000, $dateformat, usertimezone($USER->timezone)); | 
| 1134 | 1134 | |
| 1135 | 1135 | $row = new stdClass(); | 
| @@ -1140,7 +1140,7 @@ discard block | ||
| 1140 | 1140 |          $row->date_formatted = "{$head}{$formattedStartDate}{$tail}"; | 
| 1141 | 1141 |          $row->duration = "{$duration}"; | 
| 1142 | 1142 |          $row->duration_formatted = "{$head}{$duration}{$tail}"; | 
| 1143 | -        if ( $bbbsession['managerecordings'] ) { | |
| 1143 | +        if ($bbbsession['managerecordings']) { | |
| 1144 | 1144 | $row->actionbar = $actionbar; | 
| 1145 | 1145 | } | 
| 1146 | 1146 | } | 
| @@ -1166,21 +1166,21 @@ discard block | ||
| 1166 | 1166 |          array("key" =>"duration", "label" => $view_recording_duration, "width" => "50px") | 
| 1167 | 1167 | ); | 
| 1168 | 1168 | |
| 1169 | -    if ( $bbbsession['managerecordings'] ) { | |
| 1169 | +    if ($bbbsession['managerecordings']) { | |
| 1170 | 1170 |          array_push($recordingsbn_columns, array("key" =>"actionbar", "label" => $view_recording_actionbar, "width" => "75px", "allowHTML" => true)); | 
| 1171 | 1171 | } | 
| 1172 | 1172 | |
| 1173 | 1173 | return $recordingsbn_columns; | 
| 1174 | 1174 | } | 
| 1175 | 1175 | |
| 1176 | -function bigbluebuttonbn_get_recording_data($bbbsession, $recordings, $tools=["publishing", "deleting"]) { | |
| 1176 | +function bigbluebuttonbn_get_recording_data($bbbsession, $recordings, $tools = ["publishing", "deleting"]) { | |
| 1177 | 1177 | $table_data = array(); | 
| 1178 | 1178 | |
| 1179 | 1179 | ///Build table content | 
| 1180 | -    if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting | |
| 1181 | -        foreach ( $recordings as $recording ) { | |
| 1180 | +    if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting | |
| 1181 | +        foreach ($recordings as $recording) { | |
| 1182 | 1182 | $row = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools); | 
| 1183 | -            if( $row != null ) { | |
| 1183 | +            if ($row != null) { | |
| 1184 | 1184 | array_push($table_data, $row); | 
| 1185 | 1185 | } | 
| 1186 | 1186 | } | 
| @@ -1189,7 +1189,7 @@ discard block | ||
| 1189 | 1189 | return $table_data; | 
| 1190 | 1190 | } | 
| 1191 | 1191 | |
| 1192 | -function bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools=['publishing','deleting']) { | |
| 1192 | +function bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools = ['publishing', 'deleting']) { | |
| 1193 | 1193 | global $OUTPUT, $CFG; | 
| 1194 | 1194 | |
| 1195 | 1195 | ///Set strings to show | 
| @@ -1208,23 +1208,23 @@ discard block | ||
| 1208 | 1208 | $table->data = array(); | 
| 1209 | 1209 | |
| 1210 | 1210 | ///Initialize table headers | 
| 1211 | -    if ( $bbbsession['managerecordings'] ) { | |
| 1212 | - $table->head = array ($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration, $view_recording_actionbar); | |
| 1213 | -        $table->align = array ('left', 'left', 'left', 'left', 'center', 'left'); | |
| 1211 | +    if ($bbbsession['managerecordings']) { | |
| 1212 | + $table->head = array($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration, $view_recording_actionbar); | |
| 1213 | +        $table->align = array('left', 'left', 'left', 'left', 'center', 'left'); | |
| 1214 | 1214 |      } else { | 
| 1215 | - $table->head = array ($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration); | |
| 1216 | -        $table->align = array ('left', 'left', 'left', 'left', 'center'); | |
| 1215 | + $table->head = array($view_recording_recording, $view_recording_activity, $view_recording_description, $view_recording_date, $view_recording_duration); | |
| 1216 | +        $table->align = array('left', 'left', 'left', 'left', 'center'); | |
| 1217 | 1217 | } | 
| 1218 | 1218 | |
| 1219 | 1219 | ///Build table content | 
| 1220 | -    if ( isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting. | |
| 1221 | -        foreach ( $recordings as $recording ) { | |
| 1222 | -            if ( !isset($recording['imported']) && isset($bbbsession['group']) && $recording['meetingID'] != $bbbsession['meetingid'] ) { | |
| 1220 | +    if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {  // There are recordings for this meeting. | |
| 1221 | +        foreach ($recordings as $recording) { | |
| 1222 | +            if (!isset($recording['imported']) && isset($bbbsession['group']) && $recording['meetingID'] != $bbbsession['meetingid']) { | |
| 1223 | 1223 | continue; | 
| 1224 | 1224 | } | 
| 1225 | 1225 | $row = new html_table_row(); | 
| 1226 | - $row->id = 'recording-td-'.$recording['recordID']; | |
| 1227 | -            if ( isset($recording['imported']) ) { | |
| 1226 | + $row->id = 'recording-td-' . $recording['recordID']; | |
| 1227 | +            if (isset($recording['imported'])) { | |
| 1228 | 1228 | $row->attributes['data-imported'] = 'true'; | 
| 1229 | 1229 |                  $row->attributes['title'] = get_string('view_recording_link_warning', 'bigbluebuttonbn'); | 
| 1230 | 1230 |              } else { | 
| @@ -1232,12 +1232,12 @@ discard block | ||
| 1232 | 1232 | } | 
| 1233 | 1233 | |
| 1234 | 1234 | $row_data = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools); | 
| 1235 | -            if( $row_data != null ) { | |
| 1235 | +            if ($row_data != null) { | |
| 1236 | 1236 |                  $row_data->date_formatted = str_replace(" ", " ", $row_data->date_formatted); | 
| 1237 | -                if ( $bbbsession['managerecordings'] ) { | |
| 1238 | - $row->cells = array ($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted, $row_data->actionbar ); | |
| 1237 | +                if ($bbbsession['managerecordings']) { | |
| 1238 | + $row->cells = array($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted, $row_data->actionbar); | |
| 1239 | 1239 |                  } else { | 
| 1240 | - $row->cells = array ($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted ); | |
| 1240 | + $row->cells = array($row_data->recording, $row_data->activity, $row_data->description, $row_data->date_formatted, $row_data->duration_formatted); | |
| 1241 | 1241 | } | 
| 1242 | 1242 | |
| 1243 | 1243 | array_push($table->data, $row); | 
| @@ -1257,12 +1257,12 @@ discard block | ||
| 1257 | 1257 | /// Build the message_body | 
| 1258 | 1258 | $msg->activity_type = ""; | 
| 1259 | 1259 | $msg->activity_title = $bigbluebuttonbn->name; | 
| 1260 | -    $message_text = '<p>'.get_string('email_body_recording_ready_for', 'bigbluebuttonbn').' '.$msg->activity_type.' "'.$msg->activity_title.'" '.get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn').'.</p>'; | |
| 1260 | +    $message_text = '<p>' . get_string('email_body_recording_ready_for', 'bigbluebuttonbn') . ' ' . $msg->activity_type . ' "' . $msg->activity_title . '" ' . get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn') . '.</p>'; | |
| 1261 | 1261 | |
| 1262 | 1262 | bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $message_text); | 
| 1263 | 1263 | } | 
| 1264 | 1264 | |
| 1265 | -function bigbluebuttonbn_server_offers($capability_name){ | |
| 1265 | +function bigbluebuttonbn_server_offers($capability_name) { | |
| 1266 | 1266 | global $CFG; | 
| 1267 | 1267 | |
| 1268 | 1268 | $capability_offered = null; | 
| @@ -1276,12 +1276,12 @@ discard block | ||
| 1276 | 1276 |      $host_ends = explode(".", $host); | 
| 1277 | 1277 | $host_ends_length = count($host_ends); | 
| 1278 | 1278 | |
| 1279 | -    if( $host_ends_length > 0 && $host_ends[$host_ends_length -1] == 'com' &&  $host_ends[$host_ends_length -2] == 'blindsidenetworks' ) { | |
| 1279 | +    if ($host_ends_length > 0 && $host_ends[$host_ends_length - 1] == 'com' && $host_ends[$host_ends_length - 2] == 'blindsidenetworks') { | |
| 1280 | 1280 | //Validate the capabilities offered | 
| 1281 | - $capabilities = bigbluebuttonbn_getCapabilitiesArray( $endpoint, $shared_secret ); | |
| 1282 | -        if( $capabilities ) { | |
| 1281 | + $capabilities = bigbluebuttonbn_getCapabilitiesArray($endpoint, $shared_secret); | |
| 1282 | +        if ($capabilities) { | |
| 1283 | 1283 |              foreach ($capabilities as $capability) { | 
| 1284 | -                if ( $capability["name"] == $capability_name) { | |
| 1284 | +                if ($capability["name"] == $capability_name) { | |
| 1285 | 1285 | $capability_offered = $capability; | 
| 1286 | 1286 | } | 
| 1287 | 1287 | } | 
| @@ -1291,14 +1291,14 @@ discard block | ||
| 1291 | 1291 | return $capability_offered; | 
| 1292 | 1292 | } | 
| 1293 | 1293 | |
| 1294 | -function bigbluebuttonbn_server_offers_bn_capabilities(){ | |
| 1294 | +function bigbluebuttonbn_server_offers_bn_capabilities() { | |
| 1295 | 1295 | //Validates if the server may have extended capabilities | 
| 1296 | 1296 | $parsed_url = parse_url(bigbluebuttonbn_get_cfg_server_url()); | 
| 1297 | 1297 | $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; | 
| 1298 | 1298 |      $host_ends = explode(".", $host); | 
| 1299 | 1299 | $host_ends_length = count($host_ends); | 
| 1300 | 1300 | |
| 1301 | - return ( $host_ends_length > 0 && $host_ends[$host_ends_length -1] == 'com' && $host_ends[$host_ends_length -2] == 'blindsidenetworks' ); | |
| 1301 | + return ($host_ends_length > 0 && $host_ends[$host_ends_length - 1] == 'com' && $host_ends[$host_ends_length - 2] == 'blindsidenetworks'); | |
| 1302 | 1302 | } | 
| 1303 | 1303 | |
| 1304 | 1304 |  function bigbluebuttonbn_get_locales_for_ui() { | 
| @@ -1343,89 +1343,89 @@ discard block | ||
| 1343 | 1343 | |
| 1344 | 1344 |  function bigbluebuttonbn_get_cfg_server_url_default() { | 
| 1345 | 1345 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1346 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url: (isset($CFG->bigbluebuttonbn_server_url)? $CFG->bigbluebuttonbn_server_url: (isset($CFG->BigBlueButtonBNServerURL)? $CFG->BigBlueButtonBNServerURL: BIGBLUEBUTTONBN_DEFAULT_SERVER_URL))); | |
| 1346 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_server_url : (isset($CFG->bigbluebuttonbn_server_url) ? $CFG->bigbluebuttonbn_server_url : (isset($CFG->BigBlueButtonBNServerURL) ? $CFG->BigBlueButtonBNServerURL : BIGBLUEBUTTONBN_DEFAULT_SERVER_URL))); | |
| 1347 | 1347 | } | 
| 1348 | 1348 | |
| 1349 | 1349 |  function bigbluebuttonbn_get_cfg_shared_secret_default() { | 
| 1350 | 1350 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1351 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret: (isset($CFG->bigbluebuttonbn_shared_secret)? $CFG->bigbluebuttonbn_shared_secret: (isset($CFG->BigBlueButtonBNSecuritySalt)? $CFG->BigBlueButtonBNSecuritySalt: BIGBLUEBUTTONBN_DEFAULT_SHARED_SECRET))); | |
| 1351 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_shared_secret : (isset($CFG->bigbluebuttonbn_shared_secret) ? $CFG->bigbluebuttonbn_shared_secret : (isset($CFG->BigBlueButtonBNSecuritySalt) ? $CFG->BigBlueButtonBNSecuritySalt : BIGBLUEBUTTONBN_DEFAULT_SHARED_SECRET))); | |
| 1352 | 1352 | } | 
| 1353 | 1353 | |
| 1354 | 1354 |  function bigbluebuttonbn_get_cfg_voicebridge_editable() { | 
| 1355 | 1355 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1356 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable: (isset($CFG->bigbluebuttonbn_voicebridge_editable)? $CFG->bigbluebuttonbn_voicebridge_editable: false)); | |
| 1356 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_voicebridge_editable : (isset($CFG->bigbluebuttonbn_voicebridge_editable) ? $CFG->bigbluebuttonbn_voicebridge_editable : false)); | |
| 1357 | 1357 | } | 
| 1358 | 1358 | |
| 1359 | 1359 |  function bigbluebuttonbn_get_cfg_recording_default() { | 
| 1360 | 1360 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1361 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default: (isset($CFG->bigbluebuttonbn_recording_default)? $CFG->bigbluebuttonbn_recording_default: true)); | |
| 1361 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_default : (isset($CFG->bigbluebuttonbn_recording_default) ? $CFG->bigbluebuttonbn_recording_default : true)); | |
| 1362 | 1362 | } | 
| 1363 | 1363 | |
| 1364 | 1364 |  function bigbluebuttonbn_get_cfg_recording_editable() { | 
| 1365 | 1365 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1366 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable: (isset($CFG->bigbluebuttonbn_recording_editable)? $CFG->bigbluebuttonbn_recording_editable: true)); | |
| 1366 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_editable : (isset($CFG->bigbluebuttonbn_recording_editable) ? $CFG->bigbluebuttonbn_recording_editable : true)); | |
| 1367 | 1367 | } | 
| 1368 | 1368 | |
| 1369 | 1369 |  function bigbluebuttonbn_get_cfg_recording_tagging_default() { | 
| 1370 | 1370 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1371 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default: (isset($CFG->bigbluebuttonbn_recordingtagging_default)? $CFG->bigbluebuttonbn_recordingtagging_default: false)); | |
| 1371 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_default : (isset($CFG->bigbluebuttonbn_recordingtagging_default) ? $CFG->bigbluebuttonbn_recordingtagging_default : false)); | |
| 1372 | 1372 | } | 
| 1373 | 1373 | |
| 1374 | 1374 |  function bigbluebuttonbn_get_cfg_recording_tagging_editable() { | 
| 1375 | 1375 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1376 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable: (isset($CFG->bigbluebuttonbn_recordingtagging_editable)? $CFG->bigbluebuttonbn_recordingtagging_editable: false)); | |
| 1376 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingtagging_editable : (isset($CFG->bigbluebuttonbn_recordingtagging_editable) ? $CFG->bigbluebuttonbn_recordingtagging_editable : false)); | |
| 1377 | 1377 | } | 
| 1378 | 1378 | |
| 1379 | 1379 |  function bigbluebuttonbn_get_cfg_recording_icons_enabled() { | 
| 1380 | 1380 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1381 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled: (isset($CFG->bigbluebuttonbn_recording_icons_enabled)? $CFG->bigbluebuttonbn_recording_icons_enabled: true)); | |
| 1381 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recording_icons_enabled : (isset($CFG->bigbluebuttonbn_recording_icons_enabled) ? $CFG->bigbluebuttonbn_recording_icons_enabled : true)); | |
| 1382 | 1382 | } | 
| 1383 | 1383 | |
| 1384 | 1384 |  function bigbluebuttonbn_get_cfg_importrecordings_enabled() { | 
| 1385 | 1385 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1386 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled: (isset($CFG->bigbluebuttonbn_importrecordings_enabled)? $CFG->bigbluebuttonbn_importrecordings_enabled: false)); | |
| 1386 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_enabled : (isset($CFG->bigbluebuttonbn_importrecordings_enabled) ? $CFG->bigbluebuttonbn_importrecordings_enabled : false)); | |
| 1387 | 1387 | } | 
| 1388 | 1388 | |
| 1389 | 1389 |  function bigbluebuttonbn_get_cfg_importrecordings_from_deleted_activities_enabled() { | 
| 1390 | 1390 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1391 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled: (isset($CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled)? $CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled: false)); | |
| 1391 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled : (isset($CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled) ? $CFG->bigbluebuttonbn_importrecordings_from_deleted_activities_enabled : false)); | |
| 1392 | 1392 | } | 
| 1393 | 1393 | |
| 1394 | 1394 |  function bigbluebuttonbn_get_cfg_waitformoderator_default() { | 
| 1395 | 1395 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1396 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default: (isset($CFG->bigbluebuttonbn_waitformoderator_default)? $CFG->bigbluebuttonbn_waitformoderator_default: false)); | |
| 1396 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_default : (isset($CFG->bigbluebuttonbn_waitformoderator_default) ? $CFG->bigbluebuttonbn_waitformoderator_default : false)); | |
| 1397 | 1397 | } | 
| 1398 | 1398 | |
| 1399 | 1399 |  function bigbluebuttonbn_get_cfg_waitformoderator_editable() { | 
| 1400 | 1400 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1401 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable: (isset($CFG->bigbluebuttonbn_waitformoderator_editable)? $CFG->bigbluebuttonbn_waitformoderator_editable: true)); | |
| 1401 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_editable : (isset($CFG->bigbluebuttonbn_waitformoderator_editable) ? $CFG->bigbluebuttonbn_waitformoderator_editable : true)); | |
| 1402 | 1402 | } | 
| 1403 | 1403 | |
| 1404 | 1404 |  function bigbluebuttonbn_get_cfg_waitformoderator_ping_interval() { | 
| 1405 | 1405 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1406 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval: (isset($CFG->bigbluebuttonbn_waitformoderator_ping_interval)? $CFG->bigbluebuttonbn_waitformoderator_ping_interval: 15)); | |
| 1406 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_ping_interval : (isset($CFG->bigbluebuttonbn_waitformoderator_ping_interval) ? $CFG->bigbluebuttonbn_waitformoderator_ping_interval : 15)); | |
| 1407 | 1407 | } | 
| 1408 | 1408 | |
| 1409 | 1409 |  function bigbluebuttonbn_get_cfg_waitformoderator_cache_ttl() { | 
| 1410 | 1410 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1411 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl: (isset($CFG->bigbluebuttonbn_waitformoderator_cache_ttl)? $CFG->bigbluebuttonbn_waitformoderator_cache_ttl: 60)); | |
| 1411 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_waitformoderator_cache_ttl : (isset($CFG->bigbluebuttonbn_waitformoderator_cache_ttl) ? $CFG->bigbluebuttonbn_waitformoderator_cache_ttl : 60)); | |
| 1412 | 1412 | } | 
| 1413 | 1413 | |
| 1414 | 1414 |  function bigbluebuttonbn_get_cfg_userlimit_default() { | 
| 1415 | 1415 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1416 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default: (isset($CFG->bigbluebuttonbn_userlimit_default)? $CFG->bigbluebuttonbn_userlimit_default: 0)); | |
| 1416 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_default : (isset($CFG->bigbluebuttonbn_userlimit_default) ? $CFG->bigbluebuttonbn_userlimit_default : 0)); | |
| 1417 | 1417 | } | 
| 1418 | 1418 | |
| 1419 | 1419 |  function bigbluebuttonbn_get_cfg_userlimit_editable() { | 
| 1420 | 1420 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1421 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable: (isset($CFG->bigbluebuttonbn_userlimit_editable)? $CFG->bigbluebuttonbn_userlimit_editable: false)); | |
| 1421 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_userlimit_editable : (isset($CFG->bigbluebuttonbn_userlimit_editable) ? $CFG->bigbluebuttonbn_userlimit_editable : false)); | |
| 1422 | 1422 | } | 
| 1423 | 1423 | |
| 1424 | 1424 |  function bigbluebuttonbn_get_cfg_preuploadpresentation_enabled() { | 
| 1425 | 1425 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1426 | 1426 |      if (extension_loaded('curl')) { | 
| 1427 | 1427 | // This feature only works if curl is installed | 
| 1428 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled: (isset($CFG->bigbluebuttonbn_preuploadpresentation_enabled)? $CFG->bigbluebuttonbn_preuploadpresentation_enabled: false)); | |
| 1428 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_preuploadpresentation_enabled : (isset($CFG->bigbluebuttonbn_preuploadpresentation_enabled) ? $CFG->bigbluebuttonbn_preuploadpresentation_enabled : false)); | |
| 1429 | 1429 |      } else { | 
| 1430 | 1430 | return false; | 
| 1431 | 1431 | } | 
| @@ -1433,42 +1433,42 @@ discard block | ||
| 1433 | 1433 | |
| 1434 | 1434 |  function bigbluebuttonbn_get_cfg_sendnotifications_enabled() { | 
| 1435 | 1435 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1436 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled: (isset($CFG->bigbluebuttonbn_sendnotifications_enabled)? $CFG->bigbluebuttonbn_sendnotifications_enabled: false)); | |
| 1436 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_sendnotifications_enabled : (isset($CFG->bigbluebuttonbn_sendnotifications_enabled) ? $CFG->bigbluebuttonbn_sendnotifications_enabled : false)); | |
| 1437 | 1437 | } | 
| 1438 | 1438 | |
| 1439 | 1439 |  function bigbluebuttonbn_get_cfg_recordingready_enabled() { | 
| 1440 | 1440 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1441 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled: (isset($CFG->bigbluebuttonbn_recordingready_enabled)? $CFG->bigbluebuttonbn_recordingready_enabled: false)); | |
| 1441 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingready_enabled : (isset($CFG->bigbluebuttonbn_recordingready_enabled) ? $CFG->bigbluebuttonbn_recordingready_enabled : false)); | |
| 1442 | 1442 | } | 
| 1443 | 1443 | |
| 1444 | 1444 |  function bigbluebuttonbn_get_cfg_recordingstatus_enabled() { | 
| 1445 | 1445 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1446 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingstatus_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingstatus_enabled: (isset($CFG->bigbluebuttonbn_recordingstatus_enabled)? $CFG->bigbluebuttonbn_recordingstatus_enabled: false)); | |
| 1446 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingstatus_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_recordingstatus_enabled : (isset($CFG->bigbluebuttonbn_recordingstatus_enabled) ? $CFG->bigbluebuttonbn_recordingstatus_enabled : false)); | |
| 1447 | 1447 | } | 
| 1448 | 1448 | |
| 1449 | 1449 |  function bigbluebuttonbn_get_cfg_moderator_default() { | 
| 1450 | 1450 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1451 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default: (isset($CFG->bigbluebuttonbn_moderator_default)? $CFG->bigbluebuttonbn_moderator_default: '0')); | |
| 1451 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_moderator_default : (isset($CFG->bigbluebuttonbn_moderator_default) ? $CFG->bigbluebuttonbn_moderator_default : '0')); | |
| 1452 | 1452 | } | 
| 1453 | 1453 | |
| 1454 | 1454 |  function bigbluebuttonbn_get_cfg_scheduled_duration_enabled() { | 
| 1455 | 1455 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1456 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled: (isset($CFG->bigbluebuttonbn_scheduled_duration_enabled)? $CFG->bigbluebuttonbn_scheduled_duration_enabled: false)); | |
| 1456 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_enabled : (isset($CFG->bigbluebuttonbn_scheduled_duration_enabled) ? $CFG->bigbluebuttonbn_scheduled_duration_enabled : false)); | |
| 1457 | 1457 | } | 
| 1458 | 1458 | |
| 1459 | 1459 |  function bigbluebuttonbn_get_cfg_scheduled_duration_compensation() { | 
| 1460 | 1460 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1461 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_compensation)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_compensation: (isset($CFG->bigbluebuttonbn_scheduled_duration_compensation)? $CFG->bigbluebuttonbn_scheduled_duration_compensation: 10)); | |
| 1461 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_compensation) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_duration_compensation : (isset($CFG->bigbluebuttonbn_scheduled_duration_compensation) ? $CFG->bigbluebuttonbn_scheduled_duration_compensation : 10)); | |
| 1462 | 1462 | } | 
| 1463 | 1463 | |
| 1464 | 1464 |  function bigbluebuttonbn_get_cfg_scheduled_pre_opening() { | 
| 1465 | 1465 | global $BIGBLUEBUTTONBN_CFG, $CFG; | 
| 1466 | - return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_pre_opening)? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_pre_opening: (isset($CFG->bigbluebuttonbn_scheduled_pre_opening)? $CFG->bigbluebuttonbn_scheduled_pre_opening: 10)); | |
| 1466 | + return (isset($BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_pre_opening) ? $BIGBLUEBUTTONBN_CFG->bigbluebuttonbn_scheduled_pre_opening : (isset($CFG->bigbluebuttonbn_scheduled_pre_opening) ? $CFG->bigbluebuttonbn_scheduled_pre_opening : 10)); | |
| 1467 | 1467 | } | 
| 1468 | 1468 | |
| 1469 | 1469 |  function bigbluebuttonbn_import_get_courses_for_select(array $bbbsession) { | 
| 1470 | 1470 | |
| 1471 | -    if( $bbbsession['administrator'] ) { | |
| 1471 | +    if ($bbbsession['administrator']) { | |
| 1472 | 1472 |          $courses = get_courses('all', 'c.id ASC', 'c.id,c.shortname,c.fullname'); | 
| 1473 | 1473 | //It includes the name of the site as a course (category 0), so remove the first one | 
| 1474 | 1474 | unset($courses["1"]); | 
| @@ -1477,21 +1477,21 @@ discard block | ||
| 1477 | 1477 | } | 
| 1478 | 1478 | |
| 1479 | 1479 | $courses_for_select = []; | 
| 1480 | -    foreach($courses as $course) { | |
| 1481 | -        if( $course->id != $bbbsession['course']->id ) { | |
| 1480 | +    foreach ($courses as $course) { | |
| 1481 | +        if ($course->id != $bbbsession['course']->id) { | |
| 1482 | 1482 | $courses_for_select[$course->id] = $course->fullname; | 
| 1483 | 1483 | } | 
| 1484 | 1484 | } | 
| 1485 | 1485 | return $courses_for_select; | 
| 1486 | 1486 | } | 
| 1487 | 1487 | |
| 1488 | -function bigbluebuttonbn_getRecordedMeetingsDeleted($courseID, $bigbluebuttonbnID=NULL) { | |
| 1488 | +function bigbluebuttonbn_getRecordedMeetingsDeleted($courseID, $bigbluebuttonbnID = NULL) { | |
| 1489 | 1489 | global $DB; | 
| 1490 | 1490 | |
| 1491 | 1491 | $records_deleted = array(); | 
| 1492 | 1492 | |
| 1493 | -    $filter = array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_DELETE ); | |
| 1494 | -    if ( $bigbluebuttonbnID != NULL ) { | |
| 1493 | +    $filter = array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_DELETE); | |
| 1494 | +    if ($bigbluebuttonbnID != NULL) { | |
| 1495 | 1495 | $filter['id'] = $bigbluebuttonbnID; | 
| 1496 | 1496 | } | 
| 1497 | 1497 | |
| @@ -1500,17 +1500,17 @@ discard block | ||
| 1500 | 1500 |      foreach ($bigbluebuttonbns_deleted as $key => $bigbluebuttonbn_deleted) { | 
| 1501 | 1501 |          $records = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_CREATE)); | 
| 1502 | 1502 | |
| 1503 | -        if( !empty($records) ) { | |
| 1503 | +        if (!empty($records)) { | |
| 1504 | 1504 | //Remove duplicates | 
| 1505 | 1505 | $unique_records = array(); | 
| 1506 | 1506 |              foreach ($records as $key => $record) { | 
| 1507 | -                if (array_key_exists($record->meetingid, $unique_records) ) { | |
| 1507 | +                if (array_key_exists($record->meetingid, $unique_records)) { | |
| 1508 | 1508 | unset($records[$key]); | 
| 1509 | 1509 |                  } else { | 
| 1510 | 1510 | $meta = json_decode($record->meta); | 
| 1511 | -                    if ( !$meta->record ) { | |
| 1511 | +                    if (!$meta->record) { | |
| 1512 | 1512 | unset($records[$key]); | 
| 1513 | -                    } else if ( $bigbluebuttonbn_deleted->meetingid != substr($record->meetingid, 0, strlen($bigbluebuttonbn_deleted->meetingid))) { | |
| 1513 | +                    } else if ($bigbluebuttonbn_deleted->meetingid != substr($record->meetingid, 0, strlen($bigbluebuttonbn_deleted->meetingid))) { | |
| 1514 | 1514 | unset($records[$key]); | 
| 1515 | 1515 |                      } else { | 
| 1516 | 1516 | array_push($unique_records, $record->meetingid); | 
| @@ -1525,27 +1525,27 @@ discard block | ||
| 1525 | 1525 | return $records_deleted; | 
| 1526 | 1526 | } | 
| 1527 | 1527 | |
| 1528 | -function bigbluebuttonbn_getRecordedMeetings($courseID, $bigbluebuttonbnID=NULL) { | |
| 1528 | +function bigbluebuttonbn_getRecordedMeetings($courseID, $bigbluebuttonbnID = NULL) { | |
| 1529 | 1529 | global $DB; | 
| 1530 | 1530 | |
| 1531 | 1531 | $records = Array(); | 
| 1532 | 1532 | |
| 1533 | 1533 |      $filter = array('course' => $courseID); | 
| 1534 | -    if ( $bigbluebuttonbnID != NULL ) { | |
| 1534 | +    if ($bigbluebuttonbnID != NULL) { | |
| 1535 | 1535 | $filter['id'] = $bigbluebuttonbnID; | 
| 1536 | 1536 | } | 
| 1537 | 1537 |      $bigbluebuttonbns = $DB->get_records('bigbluebuttonbn', $filter); | 
| 1538 | 1538 | |
| 1539 | -    if ( !empty($bigbluebuttonbns) ) { | |
| 1539 | +    if (!empty($bigbluebuttonbns)) { | |
| 1540 | 1540 | $table = 'bigbluebuttonbn_logs'; | 
| 1541 | 1541 | |
| 1542 | 1542 | //Prepare select for loading records based on existent bigbluebuttonbns | 
| 1543 | 1543 | $select = ""; | 
| 1544 | 1544 |          foreach ($bigbluebuttonbns as $key => $bigbluebuttonbn) { | 
| 1545 | -            $select .= strlen($select) == 0? "(": " OR "; | |
| 1546 | - $select .= "bigbluebuttonbnid=".$bigbluebuttonbn->id; | |
| 1545 | +            $select .= strlen($select) == 0 ? "(" : " OR "; | |
| 1546 | + $select .= "bigbluebuttonbnid=" . $bigbluebuttonbn->id; | |
| 1547 | 1547 | } | 
| 1548 | - $select .= ") AND log='".BIGBLUEBUTTONBN_LOG_EVENT_CREATE."'"; | |
| 1548 | + $select .= ") AND log='" . BIGBLUEBUTTONBN_LOG_EVENT_CREATE . "'"; | |
| 1549 | 1549 | |
| 1550 | 1550 | //Execute select for loading records based on existent bigbluebuttonbns | 
| 1551 | 1551 | $records = $DB->get_records_select($table, $select); | 
| @@ -1553,8 +1553,8 @@ discard block | ||
| 1553 | 1553 | //Remove duplicates | 
| 1554 | 1554 | $unique_records = array(); | 
| 1555 | 1555 |          foreach ($records as $key => $record) { | 
| 1556 | - $record_key = $record->meetingid.','.$record->bigbluebuttonbnid.','.$record->meta; | |
| 1557 | -            if( array_search($record_key, $unique_records) === false ) { | |
| 1556 | + $record_key = $record->meetingid . ',' . $record->bigbluebuttonbnid . ',' . $record->meta; | |
| 1557 | +            if (array_search($record_key, $unique_records) === false) { | |
| 1558 | 1558 | array_push($unique_records, $record_key); | 
| 1559 | 1559 |              } else { | 
| 1560 | 1560 | unset($records[$key]); | 
| @@ -1564,7 +1564,7 @@ discard block | ||
| 1564 | 1564 | //Remove the ones with record=false | 
| 1565 | 1565 |          foreach ($records as $key => $record) { | 
| 1566 | 1566 | $meta = json_decode($record->meta); | 
| 1567 | -            if ( !$meta || !$meta->record ) { | |
| 1567 | +            if (!$meta || !$meta->record) { | |
| 1568 | 1568 | unset($records[$key]); | 
| 1569 | 1569 | } | 
| 1570 | 1570 | } | 
| @@ -1577,15 +1577,15 @@ discard block | ||
| 1577 | 1577 | $recordings = array(); | 
| 1578 | 1578 | |
| 1579 | 1579 | // Load the meetingIDs to be used in the getRecordings request | 
| 1580 | -    if ( is_numeric($courseID) ) { | |
| 1580 | +    if (is_numeric($courseID)) { | |
| 1581 | 1581 | $results = bigbluebuttonbn_getRecordedMeetings($courseID); | 
| 1582 | 1582 | |
| 1583 | -        if( bigbluebuttonbn_get_cfg_importrecordings_from_deleted_activities_enabled() ) { | |
| 1583 | +        if (bigbluebuttonbn_get_cfg_importrecordings_from_deleted_activities_enabled()) { | |
| 1584 | 1584 | $results_deleted = bigbluebuttonbn_getRecordedMeetingsDeleted($courseID); | 
| 1585 | 1585 | $results = array_merge($results, $results_deleted); | 
| 1586 | 1586 | } | 
| 1587 | 1587 | |
| 1588 | -        if( $results ) { | |
| 1588 | +        if ($results) { | |
| 1589 | 1589 | $mIDs = array(); | 
| 1590 | 1590 | //Eliminates duplicates | 
| 1591 | 1591 |              foreach ($results as $result) { | 
| @@ -1593,10 +1593,10 @@ discard block | ||
| 1593 | 1593 | } | 
| 1594 | 1594 | |
| 1595 | 1595 | // If there are mIDs excecute a paginated getRecordings request | 
| 1596 | -            if ( !empty($mIDs) ) { | |
| 1596 | +            if (!empty($mIDs)) { | |
| 1597 | 1597 | $pages = floor(sizeof($mIDs) / 25) + 1; | 
| 1598 | -                for ( $page = 1; $page <= $pages; $page++ ) { | |
| 1599 | - $meetingIDs = array_slice($mIDs, ($page-1)*25, 25); | |
| 1598 | +                for ($page = 1; $page <= $pages; $page++) { | |
| 1599 | + $meetingIDs = array_slice($mIDs, ($page - 1) * 25, 25); | |
| 1600 | 1600 |                      $fetched_recordings = bigbluebuttonbn_getRecordingsArray(implode(',', $meetingIDs), $URL, $SALT); | 
| 1601 | 1601 | $recordings = array_merge($recordings, $fetched_recordings); | 
| 1602 | 1602 | } | 
| @@ -1623,37 +1623,37 @@ discard block | ||
| 1623 | 1623 | $recordings_already_imported_indexed = bigbluebuttonbn_index_recordings($recordings_already_imported); | 
| 1624 | 1624 | |
| 1625 | 1625 |      foreach ($recordings as $key => $recording) { | 
| 1626 | -        if( isset($recordings_already_imported_indexed[$recording['recordID']]) ) { | |
| 1626 | +        if (isset($recordings_already_imported_indexed[$recording['recordID']])) { | |
| 1627 | 1627 | unset($recordings[$key]); | 
| 1628 | 1628 | } | 
| 1629 | 1629 | } | 
| 1630 | 1630 | return $recordings; | 
| 1631 | 1631 | } | 
| 1632 | 1632 | |
| 1633 | -function bigbluebutton_output_recording_table($bbbsession, $recordings, $tools=['publishing','deleting']) { | |
| 1633 | +function bigbluebutton_output_recording_table($bbbsession, $recordings, $tools = ['publishing', 'deleting']) { | |
| 1634 | 1634 | |
| 1635 | -    if ( isset($recordings) && !empty($recordings) ) {  // There are recordings for this meeting | |
| 1635 | +    if (isset($recordings) && !empty($recordings)) {  // There are recordings for this meeting | |
| 1636 | 1636 | $table = bigbluebuttonbn_get_recording_table($bbbsession, $recordings, $tools); | 
| 1637 | 1637 | } | 
| 1638 | 1638 | |
| 1639 | 1639 | $output = ''; | 
| 1640 | -    if( isset($table->data) ) { | |
| 1640 | +    if (isset($table->data)) { | |
| 1641 | 1641 | //Print the table | 
| 1642 | - $output .= '<div id="bigbluebuttonbn_html_table">'."\n"; | |
| 1643 | - $output .= html_writer::table($table)."\n"; | |
| 1644 | - $output .= '</div>'."\n"; | |
| 1642 | + $output .= '<div id="bigbluebuttonbn_html_table">' . "\n"; | |
| 1643 | + $output .= html_writer::table($table) . "\n"; | |
| 1644 | + $output .= '</div>' . "\n"; | |
| 1645 | 1645 | |
| 1646 | 1646 |      } else { | 
| 1647 | -        $output .= get_string('view_message_norecordings', 'bigbluebuttonbn').'<br>'."\n"; | |
| 1647 | +        $output .= get_string('view_message_norecordings', 'bigbluebuttonbn') . '<br>' . "\n"; | |
| 1648 | 1648 | } | 
| 1649 | 1649 | |
| 1650 | 1650 | return $output; | 
| 1651 | 1651 | } | 
| 1652 | 1652 | |
| 1653 | -function bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID=NULL) { | |
| 1653 | +function bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID = NULL) { | |
| 1654 | 1654 | global $DB; | 
| 1655 | 1655 | |
| 1656 | -    if ( $bigbluebuttonbnID != NULL ) { | |
| 1656 | +    if ($bigbluebuttonbnID != NULL) { | |
| 1657 | 1657 | // Fetch only those related to the $courseID and $bigbluebuttonbnID requested | 
| 1658 | 1658 |          $recordings_imported = $DB->get_records('bigbluebuttonbn_logs', array('courseid' => $courseID, 'bigbluebuttonbnid' => $bigbluebuttonbnID, 'log' => BIGBLUEBUTTONBN_LOG_EVENT_IMPORT)); | 
| 1659 | 1659 |      } else { | 
| @@ -1663,7 +1663,7 @@ discard block | ||
| 1663 | 1663 | return $recordings_imported; | 
| 1664 | 1664 | } | 
| 1665 | 1665 | |
| 1666 | -function bigbluebuttonbn_getRecordingsImportedArray($courseID, $bigbluebuttonbnID=NULL) { | |
| 1666 | +function bigbluebuttonbn_getRecordingsImportedArray($courseID, $bigbluebuttonbnID = NULL) { | |
| 1667 | 1667 | $recordings_imported = bigbluebuttonbn_getRecordingsImported($courseID, $bigbluebuttonbnID); | 
| 1668 | 1668 | $recordings_imported_array = bigbluebuttonbn_import_get_recordings_imported($recordings_imported); | 
| 1669 | 1669 | return $recordings_imported_array; | 
| @@ -1672,7 +1672,7 @@ discard block | ||
| 1672 | 1672 |  function bigbluebuttonbn_getRecordingsImportedAllInstances($recordID) { | 
| 1673 | 1673 | global $DB, $CFG; | 
| 1674 | 1674 | |
| 1675 | -    $recordings_imported = $DB->get_records_sql('SELECT * FROM '.$CFG->prefix.'bigbluebuttonbn_logs WHERE log=? AND '.$DB->sql_like('meta', '?'), array( BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, '%'.$recordID.'%' )); | |
| 1675 | +    $recordings_imported = $DB->get_records_sql('SELECT * FROM ' . $CFG->prefix . 'bigbluebuttonbn_logs WHERE log=? AND ' . $DB->sql_like('meta', '?'), array(BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, '%' . $recordID . '%')); | |
| 1676 | 1676 | return $recordings_imported; | 
| 1677 | 1677 | } | 
| 1678 | 1678 | |
| @@ -1691,8 +1691,8 @@ discard block | ||
| 1691 | 1691 |  function bigbluebuttonbn_html2text($html, $len) { | 
| 1692 | 1692 | $text = strip_tags($html); | 
| 1693 | 1693 |      $text = str_replace(" ", ' ', $text); | 
| 1694 | -    if( strlen($text) > $len ) { | |
| 1695 | - $text = substr($text, 0, $len)."..."; | |
| 1694 | +    if (strlen($text) > $len) { | |
| 1695 | + $text = substr($text, 0, $len) . "..."; | |
| 1696 | 1696 |      } else { | 
| 1697 | 1697 | $text = substr($text, 0, $len); | 
| 1698 | 1698 | } | 
| @@ -93,7 +93,7 @@ | ||
| 93 | 93 |          } else { | 
| 94 | 94 | $getArray = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $endpoint, $shared_secret)); | 
| 95 | 95 | } | 
| 96 | -	   redirect('index.php?id=' . $id); | |
| 96 | +        redirect('index.php?id=' . $id); | |
| 97 | 97 | } | 
| 98 | 98 | } | 
| 99 | 99 | |
| @@ -38,8 +38,8 @@ | ||
| 38 | 38 | * @return string | 
| 39 | 39 | */ | 
| 40 | 40 |      public function get_description() { | 
| 41 | - $rid = isset($this->other['rid'])? $this->other['rid']: ''; | |
| 42 | -        $a = (object) array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid); | |
| 41 | + $rid = isset($this->other['rid']) ? $this->other['rid'] : ''; | |
| 42 | +        $a = (object)array('userid' => $this->userid, 'recordingid' => $rid, 'courseid' => $this->contextinstanceid); | |
| 43 | 43 | return "The user with id '$a->userid' has deleted a recording with id '$a->recordingid' from the course id '$a->courseid'."; | 
| 44 | 44 | } | 
| 45 | 45 | |
| @@ -38,7 +38,7 @@ | ||
| 38 | 38 | * @return string | 
| 39 | 39 | */ | 
| 40 | 40 |      public function get_description() { | 
| 41 | -        $a = (object) array('userid' => $this->userid, 'bigbluebuttonbnid' => $this->objectid, 'courseid' => $this->contextinstanceid); | |
| 41 | +        $a = (object)array('userid' => $this->userid, 'bigbluebuttonbnid' => $this->objectid, 'courseid' => $this->contextinstanceid); | |
| 42 | 42 | return "The user with id '$a->userid' viewed the bigbluebuttonbn activity with id '$a->bigbluebuttonbnid' for " . | 
| 43 | 43 | "the course id '$a->courseid'."; | 
| 44 | 44 | } |