Code Duplication    Length = 10-13 lines in 6 locations

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

@@ 216-227 (lines=12) @@
213
	 * Gets the number of terms and conditions available
214
	 * @return int
215
	 */
216
	public static function count()
217
    {
218
		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
219
		$sql = "SELECT count(*) as count_result
220
		        FROM $legal_conditions_table
221
		        ORDER BY legal_id DESC ";
222
		$result = Database::query($sql);
223
		$url = Database::fetch_array($result,'ASSOC');
224
		$result = $url['count_result'];
225
226
		return $result;
227
	}
228
229
	/**
230
	 * Get type of terms and conditions

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

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

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

plugin/ticket/src/ticket.class.php 1 location

@@ 90-101 (lines=12) @@
87
    /**
88
     * @return int
89
     */
90
    public static function getCategoriesCount()
91
    {
92
        $table = Database::get_main_table(TABLE_TICKET_CATEGORY);
93
94
        $sql = "SELECT count(id) count
95
                FROM $table ";
96
97
        $result = Database::query($sql);
98
        $category = Database::fetch_array($result);
99
100
        return $category['count'];
101
    }
102
103
    /**
104
     * @param int $id

main/exercice/TestCategory.php 1 location

@@ 782-791 (lines=10) @@
779
    /**
780
	 * @return array
781
	 */
782
	function get_all_categories()
783
	{
784
		$table = Database::get_course_table(TABLE_QUIZ_CATEGORY);
785
		$sql = "SELECT * FROM $table ORDER BY title ASC";
786
		$res = Database::query($sql);
787
		while ($row = Database::fetch_array($res,'ASSOC')) {
788
			$array[] = $row;
789
		}
790
		return $array;
791
	}
792
793
	/**
794
	 * @param Exercise $exercise

main/admin/settings.lib.php 1 location

@@ 905-917 (lines=13) @@
902
 * @version August 2008
903
 * @since v1.8.6
904
 */
905
function getNumberOfTemplates()
906
{
907
    // Database table definition.
908
    $table_system_template = Database :: get_main_table('system_template');
909
910
    // The sql statement.
911
    $sql = "SELECT COUNT(id) AS total FROM $table_system_template";
912
    $result = Database::query($sql);
913
    $row = Database::fetch_array($result);
914
915
    // Returning the number of templates.
916
    return $row['total'];
917
}
918
919
/**
920
 * Gets all the template data for the sortable table.