Code Duplication    Length = 7-13 lines in 10 locations

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

@@ 280-291 (lines=12) @@
277
     * Gets the number of terms and conditions available
278
     * @return int
279
     */
280
    public static function count()
281
    {
282
        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
283
        $sql = "SELECT count(*) as count_result
284
                FROM $legal_conditions_table
285
                ORDER BY id DESC ";
286
        $result = Database::query($sql);
287
        $url = Database::fetch_array($result, 'ASSOC');
288
        $result = $url['count_result'];
289
290
        return $result;
291
    }
292
293
    /**
294
     * Get type of terms and conditions

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

@@ 33-43 (lines=11) @@
30
     * @param sql : a sql query (as a string)
31
     * @desc Return many results of a query in a 1 column tab
32
     */
33
    public static function getManyResults1Col($sql)
34
    {
35
        $res = Database::query($sql);
36
        if ($res !== false) {
37
            $i = 0;
38
            while ($resA = Database::fetch_array($res, 'NUM')) {
39
                $resu[$i++] = $resA[0];
40
            }
41
        }
42
        return $resu;
43
    }
44
45
    /**
46
     * @author Sebastien Piraux <[email protected]>

main/inc/lib/TicketManager.php 1 location

@@ 125-136 (lines=12) @@
122
    /**
123
     * @return int
124
     */
125
    public static function getCategoriesCount()
126
    {
127
        $table = Database::get_main_table(TABLE_TICKET_CATEGORY);
128
129
        $sql = "SELECT count(id) count
130
                FROM $table ";
131
132
        $result = Database::query($sql);
133
        $category = Database::fetch_array($result);
134
135
        return $category['count'];
136
    }
137
138
    /**
139
     * @param int $id

plugin/sepe/src/sepe.lib.php 2 locations

@@ 60-67 (lines=8) @@
57
    }
58
}
59
60
function getActionId($courseId)
61
{
62
    global $tableSepeCourseActions;
63
    $sql = "SELECT action_id FROM $tableSepeCourseActions WHERE course_id = $courseId";
64
    $rs = Database::query($sql);
65
    $aux = Database::fetch_assoc($rs);
66
    return $aux['action_id'];
67
}
68
69
function getCourse($actionId)
70
{
@@ 69-76 (lines=8) @@
66
    return $aux['action_id'];
67
}
68
69
function getCourse($actionId)
70
{
71
    global $tableSepeCourseActions;
72
    $sql = "SELECT course_id FROM $tableSepeCourseActions WHERE action_id = $actionId";
73
    $rs = Database::query($sql);
74
    $aux = Database::fetch_assoc($rs);
75
    return $aux['course_id'];
76
}
77
function getCourseCode($actionId)
78
{
79
    global $tableCourse;

main/admin/settings.lib.php 1 location

@@ 929-941 (lines=13) @@
926
 * @version August 2008
927
 * @since v1.8.6
928
 */
929
function getNumberOfTemplates()
930
{
931
    // Database table definition.
932
    $table_system_template = Database::get_main_table('system_template');
933
934
    // The sql statement.
935
    $sql = "SELECT COUNT(id) AS total FROM $table_system_template";
936
    $result = Database::query($sql);
937
    $row = Database::fetch_array($result);
938
939
    // Returning the number of templates.
940
    return $row['total'];
941
}
942
943
/**
944
 * Gets all the template data for the sortable table.

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

@@ 3174-3180 (lines=7) @@
3171
     * @param string Category code
3172
     * @return array Course category
3173
     */
3174
    public static function get_course_category($code)
3175
    {
3176
        $table_categories = Database::get_main_table(TABLE_MAIN_CATEGORY);
3177
        $code = Database::escape_string($code);
3178
        $sql = "SELECT * FROM $table_categories WHERE code = '$code'";
3179
        return Database::fetch_array(Database::query($sql));
3180
    }
3181
3182
    /**
3183
     * Returns the details of a course category

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

@@ 2578-2586 (lines=9) @@
2575
    /**
2576
     * @return int
2577
     */
2578
    public static function getNumberOfTrackAccessOverview()
2579
    {
2580
        $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
2581
        $sql = "SELECT COUNT(course_access_id) count FROM $table";
2582
        $result = Database::query($sql);
2583
        $row = Database::fetch_assoc($result);
2584
2585
        return $row['count'];
2586
    }
2587
2588
    /**
2589
     * @param $from

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

@@ 1233-1241 (lines=9) @@
1230
    /**
1231
     * @return int
1232
     */
1233
    public static function get_number_of_tracking_access_overview()
1234
    {
1235
        $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1236
        $sql = "SELECT COUNT(course_access_id) count FROM $table";
1237
        $result = Database::query($sql);
1238
        $row = Database::fetch_assoc($result);
1239
1240
        return $row['count'];
1241
    }
1242
1243
    /**
1244
     * Get the ip, total of clicks, login date and time logged in for all user, in one session

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

@@ 139-148 (lines=10) @@
136
     * @author Julio Montoya
137
     * @return int count of urls
138
     * */
139
    public static function url_count()
140
    {
141
        $table_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
142
        $sql = "SELECT count(id) as count_result FROM $table_access_url";
143
        $res = Database::query($sql);
144
        $url = Database::fetch_array($res, 'ASSOC');
145
        $result = $url['count_result'];
146
147
        return $result;
148
    }
149
150
    /**
151
     * Gets the id, url, description, and active status of ALL URLs