Code Duplication    Length = 18-22 lines in 2 locations

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

@@ 3938-3955 (lines=18) @@
3935
 * @param int $ref
3936
 * @return array|resource
3937
 */
3938
function api_get_track_item_property_history($tool, $ref)
3939
{
3940
    $tbl_stats_item_property = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY);
3941
    $course_id = api_get_course_int_id(); //numeric
3942
    $course_code = api_get_course_id(); //alphanumeric
3943
    $item_property_id = api_get_item_property_id($course_code, $tool, $ref);
3944
    $sql = "SELECT * FROM $tbl_stats_item_property
3945
            WHERE item_property_id = $item_property_id AND course_id = $course_id
3946
            ORDER BY lastedit_date DESC";
3947
    $result = Database::query($sql);
3948
    if ($result == false) {
3949
        $result = array();
3950
    } else {
3951
        $result = Database::store_result($result,'ASSOC');
3952
    }
3953
3954
    return $result;
3955
}
3956
3957
/**
3958
 * Gets item property data from tool of a course id

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

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