Code Duplication    Length = 18-22 lines in 2 locations

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

@@ 4669-4690 (lines=22) @@
4666
     * @return bool    True if the user is a coach
4667
     *
4668
     */
4669
    public static function is_session_course_coach($user_id, $courseId, $session_id)
4670
    {
4671
        $tbl_session_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
4672
        // Protect data
4673
        $user_id = intval($user_id);
4674
        $courseId = intval($courseId);
4675
        $session_id = intval($session_id);
4676
        $result = false;
4677
4678
        $sql = "SELECT session_id FROM $tbl_session_course_rel_user
4679
                WHERE
4680
                  session_id = $session_id AND
4681
                  c_id = $courseId AND
4682
                  user_id = $user_id AND
4683
                  status = 2 ";
4684
        $res = Database::query($sql);
4685
4686
        if (Database::num_rows($res) > 0) {
4687
            $result = true;
4688
        }
4689
        return $result;
4690
    }
4691
4692
    /**
4693
     * This function returns an icon path that represents the favicon of the website of which the url given.

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

@@ 3967-3984 (lines=18) @@
3964
 * @param int $ref
3965
 * @return array|resource
3966
 */
3967
function api_get_track_item_property_history($tool, $ref)
3968
{
3969
    $tbl_stats_item_property = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY);
3970
    $course_id = api_get_course_int_id(); //numeric
3971
    $course_code = api_get_course_id(); //alphanumeric
3972
    $item_property_id = api_get_item_property_id($course_code, $tool, $ref);
3973
    $sql = "SELECT * FROM $tbl_stats_item_property
3974
            WHERE item_property_id = $item_property_id AND course_id = $course_id
3975
            ORDER BY lastedit_date DESC";
3976
    $result = Database::query($sql);
3977
    if ($result == false) {
3978
        $result = array();
3979
    } else {
3980
        $result = Database::store_result($result,'ASSOC');
3981
    }
3982
3983
    return $result;
3984
}
3985
3986
/**
3987
 * Gets item property data from tool of a course id