Code Duplication    Length = 18-22 lines in 2 locations

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

@@ 3983-4000 (lines=18) @@
3980
 * @param int $ref
3981
 * @return array|resource
3982
 */
3983
function api_get_track_item_property_history($tool, $ref)
3984
{
3985
    $tbl_stats_item_property = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY);
3986
    $course_id = api_get_course_int_id(); //numeric
3987
    $course_code = api_get_course_id(); //alphanumeric
3988
    $item_property_id = api_get_item_property_id($course_code, $tool, $ref);
3989
    $sql = "SELECT * FROM $tbl_stats_item_property
3990
            WHERE item_property_id = $item_property_id AND course_id = $course_id
3991
            ORDER BY lastedit_date DESC";
3992
    $result = Database::query($sql);
3993
    if ($result == false) {
3994
        $result = array();
3995
    } else {
3996
        $result = Database::store_result($result,'ASSOC');
3997
    }
3998
3999
    return $result;
4000
}
4001
4002
/**
4003
 * Gets item property data from tool of a course id

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.