| @@ 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]> |
|
| @@ 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 |
|
| @@ 908-920 (lines=13) @@ | ||
| 905 | * @version August 2008 |
|
| 906 | * @since v1.8.6 |
|
| 907 | */ |
|
| 908 | function getNumberOfTemplates() |
|
| 909 | { |
|
| 910 | // Database table definition. |
|
| 911 | $table_system_template = Database :: get_main_table('system_template'); |
|
| 912 | ||
| 913 | // The sql statement. |
|
| 914 | $sql = "SELECT COUNT(id) AS total FROM $table_system_template"; |
|
| 915 | $result = Database::query($sql); |
|
| 916 | $row = Database::fetch_array($result); |
|
| 917 | ||
| 918 | // Returning the number of templates. |
|
| 919 | return $row['total']; |
|
| 920 | } |
|
| 921 | ||
| 922 | /** |
|
| 923 | * Gets all the template data for the sortable table. |
|
| @@ 248-259 (lines=12) @@ | ||
| 245 | * Gets the number of terms and conditions available |
|
| 246 | * @return int |
|
| 247 | */ |
|
| 248 | public static function count() |
|
| 249 | { |
|
| 250 | $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
| 251 | $sql = "SELECT count(*) as count_result |
|
| 252 | FROM $legal_conditions_table |
|
| 253 | ORDER BY id DESC "; |
|
| 254 | $result = Database::query($sql); |
|
| 255 | $url = Database::fetch_array($result,'ASSOC'); |
|
| 256 | $result = $url['count_result']; |
|
| 257 | ||
| 258 | return $result; |
|
| 259 | } |
|
| 260 | ||
| 261 | /** |
|
| 262 | * Get type of terms and conditions |
|
| @@ 884-892 (lines=9) @@ | ||
| 881 | * |
|
| 882 | * @return integer Total number of courses |
|
| 883 | */ |
|
| 884 | public static function get_total_number_courses() |
|
| 885 | { |
|
| 886 | $table = Database :: get_main_table(TABLE_MAIN_COURSE); |
|
| 887 | $sql = "SELECT COUNT(id) count FROM $table"; |
|
| 888 | $result = Database::query($sql); |
|
| 889 | $row = Database::fetch_assoc($result); |
|
| 890 | ||
| 891 | return $row['count']; |
|
| 892 | } |
|
| 893 | ||
| 894 | /** |
|
| 895 | * Get data for the courses |
|
| @@ 1221-1229 (lines=9) @@ | ||
| 1218 | * |
|
| 1219 | * @return integer Total number of sessions |
|
| 1220 | */ |
|
| 1221 | public static function get_total_number_sessions() |
|
| 1222 | { |
|
| 1223 | $table = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
| 1224 | $sql = "SELECT COUNT(id) count FROM $table"; |
|
| 1225 | $result = Database::query($sql); |
|
| 1226 | $row = Database::fetch_assoc($result); |
|
| 1227 | ||
| 1228 | return $row['count']; |
|
| 1229 | } |
|
| 1230 | ||
| 1231 | /** |
|
| 1232 | * Get data for the sessions |
|
| @@ 1875-1883 (lines=9) @@ | ||
| 1872 | * @version Dokeos 1.8.6 |
|
| 1873 | * @since October 2008 |
|
| 1874 | */ |
|
| 1875 | public static function get_number_of_users_tracking_overview() |
|
| 1876 | { |
|
| 1877 | $table = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 1878 | $sql = "SELECT COUNT(id) count FROM $table"; |
|
| 1879 | $result = Database::query($sql); |
|
| 1880 | $row = Database::fetch_assoc($result); |
|
| 1881 | ||
| 1882 | return $row['count']; |
|
| 1883 | } |
|
| 1884 | ||
| 1885 | /** |
|
| 1886 | * get all the data for the sortable table of the reporting progress of all users and all the courses the user is subscribed to. |
|
| @@ 2560-2568 (lines=9) @@ | ||
| 2557 | /** |
|
| 2558 | * @return int |
|
| 2559 | */ |
|
| 2560 | public static function getNumberOfTrackAccessOverview() |
|
| 2561 | { |
|
| 2562 | $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 2563 | $sql = "SELECT COUNT(course_access_id) count FROM $table"; |
|
| 2564 | $result = Database::query($sql); |
|
| 2565 | $row = Database::fetch_assoc($result); |
|
| 2566 | ||
| 2567 | return $row['count']; |
|
| 2568 | } |
|
| 2569 | ||
| 2570 | /** |
|
| 2571 | * @param $from |
|
| @@ 782-793 (lines=12) @@ | ||
| 779 | /** |
|
| 780 | * @return array |
|
| 781 | */ |
|
| 782 | public static 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 | $array = []; |
|
| 788 | while ($row = Database::fetch_array($res, 'ASSOC')) { |
|
| 789 | $array[] = $row; |
|
| 790 | } |
|
| 791 | ||
| 792 | return $array; |
|
| 793 | } |
|
| 794 | ||
| 795 | /** |
|
| 796 | * @param Exercise $exercise |
|
| @@ 1186-1194 (lines=9) @@ | ||
| 1183 | /** |
|
| 1184 | * @return int |
|
| 1185 | */ |
|
| 1186 | public static function get_number_of_tracking_access_overview() |
|
| 1187 | { |
|
| 1188 | $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1189 | $sql = "SELECT COUNT(course_access_id) count FROM $table"; |
|
| 1190 | $result = Database::query($sql); |
|
| 1191 | $row = Database::fetch_assoc($result); |
|
| 1192 | ||
| 1193 | return $row['count']; |
|
| 1194 | } |
|
| 1195 | ||
| 1196 | /** |
|
| 1197 | * Get the ip, total of clicks, login date and time logged in for all user, in one session |
|