Code Duplication    Length = 18-22 lines in 2 locations

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

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

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

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