Code Duplication    Length = 18-22 lines in 2 locations

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

@@ 3996-4013 (lines=18) @@
3993
 * @param int $ref
3994
 * @return array|resource
3995
 */
3996
function api_get_track_item_property_history($tool, $ref)
3997
{
3998
    $tbl_stats_item_property = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY);
3999
    $course_id = api_get_course_int_id(); //numeric
4000
    $course_code = api_get_course_id(); //alphanumeric
4001
    $item_property_id = api_get_item_property_id($course_code, $tool, $ref);
4002
    $sql = "SELECT * FROM $tbl_stats_item_property
4003
            WHERE item_property_id = $item_property_id AND course_id = $course_id
4004
            ORDER BY lastedit_date DESC";
4005
    $result = Database::query($sql);
4006
    if ($result == false) {
4007
        $result = array();
4008
    } else {
4009
        $result = Database::store_result($result,'ASSOC');
4010
    }
4011
4012
    return $result;
4013
}
4014
4015
/**
4016
 * Gets item property data from tool of a course id

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

@@ 4697-4718 (lines=22) @@
4694
     * @return bool    True if the user is a coach
4695
     *
4696
     */
4697
    public static function is_session_course_coach($user_id, $courseId, $session_id)
4698
    {
4699
        $tbl_session_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
4700
        // Protect data
4701
        $user_id = intval($user_id);
4702
        $courseId = intval($courseId);
4703
        $session_id = intval($session_id);
4704
        $result = false;
4705
4706
        $sql = "SELECT session_id FROM $tbl_session_course_rel_user
4707
                WHERE
4708
                  session_id = $session_id AND
4709
                  c_id = $courseId AND
4710
                  user_id = $user_id AND
4711
                  status = 2 ";
4712
        $res = Database::query($sql);
4713
4714
        if (Database::num_rows($res) > 0) {
4715
            $result = true;
4716
        }
4717
        return $result;
4718
    }
4719
4720
    /**
4721
     * This function returns an icon path that represents the favicon of the website of which the url given.