Code Duplication    Length = 7-13 lines in 10 locations

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

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

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

main/admin/settings.lib.php 1 location

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

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

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

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

@@ 2564-2572 (lines=9) @@
2561
    /**
2562
     * @return int
2563
     */
2564
    public static function getNumberOfTrackAccessOverview()
2565
    {
2566
        $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
2567
        $sql = "SELECT COUNT(course_access_id) count FROM $table";
2568
        $result = Database::query($sql);
2569
        $row = Database::fetch_assoc($result);
2570
2571
        return $row['count'];
2572
    }
2573
2574
    /**
2575
     * @param $from

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

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

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;