Code Duplication    Length = 7-13 lines in 8 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/sessionmanager.lib.php 1 location

@@ 1191-1199 (lines=9) @@
1188
    /**
1189
     * @return int
1190
     */
1191
    public static function get_number_of_tracking_access_overview()
1192
    {
1193
        $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1194
        $sql = "SELECT COUNT(course_access_id) count FROM $table";
1195
        $result = Database::query($sql);
1196
        $row = Database::fetch_assoc($result);
1197
1198
        return $row['count'];
1199
    }
1200
1201
    /**
1202
     * Get the ip, total of clicks, login date and time logged in for all user, in one session

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/admin/settings.lib.php 1 location

@@ 942-954 (lines=13) @@
939
 * @version August 2008
940
 * @since v1.8.6
941
 */
942
function getNumberOfTemplates()
943
{
944
    // Database table definition.
945
    $table_system_template = Database::get_main_table('system_template');
946
947
    // The sql statement.
948
    $sql = "SELECT COUNT(id) AS total FROM $table_system_template";
949
    $result = Database::query($sql);
950
    $row = Database::fetch_array($result);
951
952
    // Returning the number of templates.
953
    return $row['total'];
954
}
955
956
/**
957
 * Gets all the template data for the sortable table.

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

@@ 3129-3135 (lines=7) @@
3126
     * @param string Category code
3127
     * @return array Course category
3128
     */
3129
    public static function get_course_category($code)
3130
    {
3131
        $table_categories = Database::get_main_table(TABLE_MAIN_CATEGORY);
3132
        $code = Database::escape_string($code);
3133
        $sql = "SELECT * FROM $table_categories WHERE code = '$code'";
3134
        return Database::fetch_array(Database::query($sql));
3135
    }
3136
3137
    /**
3138
     * Returns the details of a course category

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

@@ 2552-2560 (lines=9) @@
2549
    /**
2550
     * @return int
2551
     */
2552
    public static function getNumberOfTrackAccessOverview()
2553
    {
2554
        $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
2555
        $sql = "SELECT COUNT(course_access_id) count FROM $table";
2556
        $result = Database::query($sql);
2557
        $row = Database::fetch_assoc($result);
2558
2559
        return $row['count'];
2560
    }
2561
2562
    /**
2563
     * @param $from

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