Code Duplication    Length = 9-11 lines in 3 locations

main/inc/lib/urlmanager.lib.php 1 location

@@ 620-630 (lines=11) @@
617
     * @param int $urlId
618
     * @return int
619
     */
620
    public static function addUserGroupToUrl($userGroupId, $urlId)
621
    {
622
        $urlRelUserGroupTable = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP);
623
        $sql = "INSERT INTO $urlRelUserGroupTable
624
                SET
625
                usergroup_id = '".intval($userGroupId)."',
626
                access_url_id = ".intval($urlId);
627
        Database::query($sql);
628
629
        return Database::insert_id();
630
    }
631
632
    /**
633
     * @param int $categoryId

main/inc/lib/course.lib.php 1 location

@@ 5886-5894 (lines=9) @@
5883
     * @param int  $category_id
5884
     * @return int course id
5885
     */
5886
    public static function get_course_by_category($category_id)
5887
    {
5888
        $category_id = intval($category_id);
5889
        $info = Database::fetch_array(
5890
            Database::query('SELECT c_id FROM ' . Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY) . '
5891
            WHERE id=' . $category_id), 'ASSOC'
5892
        );
5893
        return $info ? $info['c_id'] : false;
5894
    }
5895
5896
    /**
5897
     * This function gets all the courses that are not in a session

main/inc/lib/sessionmanager.lib.php 1 location

@@ 300-308 (lines=9) @@
297
     *
298
     * @return bool
299
     */
300
    public static function session_name_exists($name)
301
    {
302
        $name = Database::escape_string($name);
303
        $sql = "SELECT COUNT(*) as count FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . "
304
                WHERE name = '$name'";
305
        $result = Database::fetch_array(Database::query($sql));
306
307
        return $result['count'] > 0;
308
    }
309
310
    /**
311
     * @param string $where_condition