Code Duplication    Length = 18-22 lines in 2 locations

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

@@ 4654-4675 (lines=22) @@
4651
     * @return bool    True if the user is a coach
4652
     *
4653
     */
4654
    public static function is_session_course_coach($user_id, $courseId, $session_id)
4655
    {
4656
        $tbl_session_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
4657
        // Protect data
4658
        $user_id = intval($user_id);
4659
        $courseId = intval($courseId);
4660
        $session_id = intval($session_id);
4661
        $result = false;
4662
4663
        $sql = "SELECT session_id FROM $tbl_session_course_rel_user
4664
                WHERE
4665
                  session_id = $session_id AND
4666
                  c_id = $courseId AND
4667
                  user_id = $user_id AND
4668
                  status = 2 ";
4669
        $res = Database::query($sql);
4670
4671
        if (Database::num_rows($res) > 0) {
4672
            $result = true;
4673
        }
4674
        return $result;
4675
    }
4676
4677
    /**
4678
     * 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

@@ 3956-3973 (lines=18) @@
3953
 * @param int $ref
3954
 * @return array|resource
3955
 */
3956
function api_get_track_item_property_history($tool, $ref)
3957
{
3958
    $tbl_stats_item_property = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY);
3959
    $course_id = api_get_course_int_id(); //numeric
3960
    $course_code = api_get_course_id(); //alphanumeric
3961
    $item_property_id = api_get_item_property_id($course_code, $tool, $ref);
3962
    $sql = "SELECT * FROM $tbl_stats_item_property
3963
            WHERE item_property_id = $item_property_id AND course_id = $course_id
3964
            ORDER BY lastedit_date DESC";
3965
    $result = Database::query($sql);
3966
    if ($result == false) {
3967
        $result = array();
3968
    } else {
3969
        $result = Database::store_result($result,'ASSOC');
3970
    }
3971
3972
    return $result;
3973
}
3974
3975
/**
3976
 * Gets item property data from tool of a course id