Code Duplication    Length = 7-7 lines in 2 locations

locallib.php 2 locations

@@ 2010-2016 (lines=7) @@
2007
 *
2008
 * @return array
2009
 */
2010
function bigbluebuttonbn_views_instance_id($id) {
2011
    global $DB;
2012
    $cm = get_coursemodule_from_id('bigbluebuttonbn', $id, 0, false, MUST_EXIST);
2013
    $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
2014
    $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $cm->instance), '*', MUST_EXIST);
2015
    return array('cm' => $cm, 'course' => $course, 'bigbluebuttonbn' => $bigbluebuttonbn);
2016
}
2017
2018
/**
2019
 * Helper function returns array with the instance settings used in views based on bigbluebuttonbnid.
@@ 2025-2031 (lines=7) @@
2022
 *
2023
 * @return array
2024
 */
2025
function bigbluebuttonbn_views_instance_bigbluebuttonbn($bigbluebuttonbnid) {
2026
    global $DB;
2027
    $bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $bigbluebuttonbnid), '*', MUST_EXIST);
2028
    $course = $DB->get_record('course', array('id' => $bigbluebuttonbn->course), '*', MUST_EXIST);
2029
    $cm = get_coursemodule_from_instance('bigbluebuttonbn', $bigbluebuttonbn->id, $course->id, false, MUST_EXIST);
2030
    return array('cm' => $cm, 'course' => $course, 'bigbluebuttonbn' => $bigbluebuttonbn);
2031
}
2032
2033
/**
2034
 * Helper function renders general settings if the feature is enabled.