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

@@ 5934-5942 (lines=9) @@
5931
     * @param int  $category_id
5932
     * @return int course id
5933
     */
5934
    public static function get_course_by_category($category_id)
5935
    {
5936
        $category_id = intval($category_id);
5937
        $info = Database::fetch_array(
5938
            Database::query('SELECT c_id FROM ' . Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY) . '
5939
            WHERE id=' . $category_id), 'ASSOC'
5940
        );
5941
        return $info ? $info['c_id'] : false;
5942
    }
5943
5944
    /**
5945
     * This function gets all the courses that are not in a session

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

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