Code Duplication    Length = 42-42 lines in 2 locations

bbb_view.php 1 location

@@ 305-346 (lines=42) @@
302
 * @param  array    $bbbsession
303
 * @return object
304
 */
305
function bigbluebutton_bbb_view_create_meeting_data(&$bbbsession) {
306
    $data = ['meetingID' => $bbbsession['meetingid'],
307
              'name' => bigbluebuttonbn_html2text($bbbsession['meetingname'], 64),
308
              'attendeePW' => $bbbsession['viewerPW'],
309
              'moderatorPW' => $bbbsession['modPW'],
310
              'logoutURL' => $bbbsession['logoutURL'],
311
            ];
312
    $data['record'] = bigbluebutton_bbb_view_create_meeting_data_record($bbbsession['record']);
313
    // Check if auto_start_record is enable.
314
    if ($data['record'] == 'true' && $bbbsession['recordallfromstart']) {
315
        $data['autoStartRecording'] = 'true';
316
        // Check if hide_record_button is enable.
317
        if ($bbbsession['recordallfromstart'] && $bbbsession['recordhidebutton']) {
318
            $data['allowStartStopRecording'] = 'false';
319
        }
320
    }
321
322
    $data['welcome'] = trim($bbbsession['welcome']);
323
    // Set the duration for the meeting.
324
    $durationtime = bigbluebutton_bbb_view_create_meeting_data_duration($bbbsession['bigbluebuttonbn']->closingtime);
325
    if ($durationtime > 0) {
326
        $data['duration'] = $durationtime;
327
        $data['welcome'] .= '<br><br>';
328
        $data['welcome'] .= str_replace(
329
            '%duration%',
330
            (string) $durationtime,
331
            get_string('bbbdurationwarning', 'bigbluebuttonbn')
332
          );
333
    }
334
    $voicebridge = intval($bbbsession['voicebridge']);
335
    if ($voicebridge > 0 && $voicebridge < 79999) {
336
        $data['voiceBridge'] = $voicebridge;
337
    }
338
    $maxparticipants = intval($bbbsession['userlimit']);
339
    if ($maxparticipants > 0) {
340
        $data['maxParticipants'] = $maxparticipants;
341
    }
342
    if ($bbbsession['muteonstart']) {
343
        $data['muteOnStart'] = 'true';
344
    }
345
    return $data;
346
}
347
348
/**
349
 * Helper for returning the flag to know if the meeting is recorded.

classes/locallib/mobileview.php 1 location

@@ 206-247 (lines=42) @@
203
     * @return array
204
     * @throws \coding_exception
205
     */
206
    public static function bigbluebutton_bbb_view_create_meeting_data(&$bbbsession) {
207
        $data = ['meetingID' => $bbbsession['meetingid'],
208
            'name' => bigbluebuttonbn_html2text($bbbsession['meetingname'], 64),
209
            'attendeePW' => $bbbsession['viewerPW'],
210
            'moderatorPW' => $bbbsession['modPW'],
211
            'logoutURL' => $bbbsession['logoutURL'],
212
        ];
213
        $data['record'] = self::bigbluebutton_bbb_view_create_meeting_data_record($bbbsession['record']);
214
        // Check if auto_start_record is enable.
215
        if ($data['record'] == 'true' && $bbbsession['recordallfromstart']) {
216
            $data['autoStartRecording'] = 'true';
217
            // Check if hide_record_button is enable.
218
            if ($bbbsession['recordallfromstart'] && $bbbsession['recordhidebutton']) {
219
                $data['allowStartStopRecording'] = 'false';
220
            }
221
        }
222
223
        $data['welcome'] = trim($bbbsession['welcome']);
224
        // Set the duration for the meeting.
225
        $durationtime = self::bigbluebutton_bbb_view_create_meeting_data_duration($bbbsession['bigbluebuttonbn']->closingtime);
226
        if ($durationtime > 0) {
227
            $data['duration'] = $durationtime;
228
            $data['welcome'] .= '<br><br>';
229
            $data['welcome'] .= str_replace(
230
                '%duration%',
231
                (string) $durationtime,
232
                get_string('bbbdurationwarning', 'bigbluebuttonbn')
233
            );
234
        }
235
        $voicebridge = intval($bbbsession['voicebridge']);
236
        if ($voicebridge > 0 && $voicebridge < 79999) {
237
            $data['voiceBridge'] = $voicebridge;
238
        }
239
        $maxparticipants = intval($bbbsession['userlimit']);
240
        if ($maxparticipants > 0) {
241
            $data['maxParticipants'] = $maxparticipants;
242
        }
243
        if ($bbbsession['muteonstart']) {
244
            $data['muteOnStart'] = 'true';
245
        }
246
        return $data;
247
    }
248
249
    /**
250
     * Helper for returning the flag to know if the meeting is recorded.