Code Duplication    Length = 15-17 lines in 2 locations

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

@@ 50-64 (lines=15) @@
47
     *
48
     * @return string The glossary description
49
     */
50
    public static function get_glossary_term_by_glossary_id($glossary_id)
51
    {
52
        $glossary_table = Database::get_course_table(TABLE_GLOSSARY);
53
        $course_id = api_get_course_int_id();
54
        $sql = "SELECT description FROM $glossary_table
55
                WHERE c_id = $course_id  AND glossary_id =".intval($glossary_id);
56
        $rs = Database::query($sql);
57
        if (Database::num_rows($rs) > 0) {
58
            $row = Database::fetch_array($rs);
59
60
            return $row['description'];
61
        } else {
62
            return '';
63
        }
64
    }
65
66
    /**
67
     * Get glossary term by glossary id

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

@@ 2894-2910 (lines=17) @@
2891
     *
2892
     * @return bool
2893
     */
2894
    public function hasChildren($eventId, $courseId)
2895
    {
2896
        $eventId = intval($eventId);
2897
        $courseId = intval($courseId);
2898
2899
        $sql = "SELECT count(DISTINCT(id)) as count
2900
                FROM ".$this->tbl_course_agenda."
2901
                WHERE
2902
                    c_id = $courseId AND
2903
                    parent_event_id = $eventId";
2904
        $result = Database::query($sql);
2905
        if (Database::num_rows($result)) {
2906
            $row = Database::fetch_array($result, 'ASSOC');
2907
2908
            return $row['count'] > 0;
2909
        }
2910
2911
        return false;
2912
    }
2913