@@ -18,6 +18,7 @@ discard block |
||
| 18 | 18 | * Get all files of lang folder (forum.inc.php,gradebook.inc.php,notebook.inc.php) |
| 19 | 19 | * @param String The lang path folder (/var/www/my_lms/main/lang/spanish) |
| 20 | 20 | * @param bool true if we only want the "subname" trad4all instead of trad4all.inc.php |
| 21 | + * @param string $path |
|
| 21 | 22 | * |
| 22 | 23 | * @return Array All file of lang folder |
| 23 | 24 | */ |
@@ -68,6 +69,7 @@ discard block |
||
| 68 | 69 | /** |
| 69 | 70 | * Get all information of language |
| 70 | 71 | * @param Integer The parent id(Language father id) |
| 72 | + * @param integer $parent_id |
|
| 71 | 73 | * @return Array All information about language |
| 72 | 74 | */ |
| 73 | 75 | public static function get_all_information_of_language($parent_id) |
@@ -86,6 +88,7 @@ discard block |
||
| 86 | 88 | /** |
| 87 | 89 | * Get all information of chamilo file |
| 88 | 90 | * @param String The chamilo path file (/var/www/chamilo/main/lang/spanish/gradebook.inc.php) |
| 91 | + * @param string $system_path_file |
|
| 89 | 92 | * @patam Bool Whether we want to remove the '$' prefix in the results or not |
| 90 | 93 | * @return Array Contains all information of chamilo file |
| 91 | 94 | */ |
@@ -345,7 +348,7 @@ discard block |
||
| 345 | 348 | /** |
| 346 | 349 | * Make available the language |
| 347 | 350 | * @param Integer The language id |
| 348 | - * @return void |
|
| 351 | + * @return boolean |
|
| 349 | 352 | */ |
| 350 | 353 | public static function make_available_language($language_id) |
| 351 | 354 | { |
@@ -29,8 +29,9 @@ |
||
| 29 | 29 | while (($file = readdir($dh)) !== false) { |
| 30 | 30 | if ($file[0] <> '.' && substr($file, -4, strlen($file)) == '.php') { |
| 31 | 31 | if ($only_main_name) { |
| 32 | - if ($file != '' && strpos($file, '.inc.php')) |
|
| 33 | - $content_dir[] = substr($file, 0, strpos($file, '.inc.php')); |
|
| 32 | + if ($file != '' && strpos($file, '.inc.php')) { |
|
| 33 | + $content_dir[] = substr($file, 0, strpos($file, '.inc.php')); |
|
| 34 | + } |
|
| 34 | 35 | } else { |
| 35 | 36 | $content_dir[] = $file; |
| 36 | 37 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | public static function getAllLanguages() |
| 22 | 22 | { |
| 23 | 23 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 24 | - $sql = 'SELECT * FROM ' . $table; |
|
| 24 | + $sql = 'SELECT * FROM '.$table; |
|
| 25 | 25 | $rs = Database::query($sql); |
| 26 | 26 | $all_languages = []; |
| 27 | 27 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | public static function get_all_information_of_sub_language($parent_id, $sub_language_id) |
| 71 | 71 | { |
| 72 | 72 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 73 | - $sql = 'SELECT * FROM ' . $table . ' |
|
| 73 | + $sql = 'SELECT * FROM '.$table.' |
|
| 74 | 74 | WHERE |
| 75 | 75 | parent_id= ' . intval($parent_id).' AND |
| 76 | - id= ' . intval($sub_language_id) . ''; |
|
| 76 | + id= ' . intval($sub_language_id).''; |
|
| 77 | 77 | $rs = Database::query($sql); |
| 78 | 78 | $all_information = array(); |
| 79 | 79 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | public static function get_all_information_of_language($parent_id) |
| 92 | 92 | { |
| 93 | 93 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 94 | - $sql = 'SELECT * FROM ' . $table . ' WHERE id = "' . intval($parent_id) . '"'; |
|
| 94 | + $sql = 'SELECT * FROM '.$table.' WHERE id = "'.intval($parent_id).'"'; |
|
| 95 | 95 | $rs = Database::query($sql); |
| 96 | 96 | $all_information = array(); |
| 97 | 97 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public static function add_file_in_language_directory($system_path_file) |
| 139 | 139 | { |
| 140 | - $return_value = @file_put_contents($system_path_file, '<?php' . PHP_EOL); |
|
| 140 | + $return_value = @file_put_contents($system_path_file, '<?php'.PHP_EOL); |
|
| 141 | 141 | |
| 142 | 142 | return $return_value; |
| 143 | 143 | } |
@@ -152,10 +152,10 @@ discard block |
||
| 152 | 152 | public static function write_data_in_file($path_file, $new_term, $new_variable) |
| 153 | 153 | { |
| 154 | 154 | $return_value = false; |
| 155 | - $new_data = $new_variable . '=' . $new_term; |
|
| 155 | + $new_data = $new_variable.'='.$new_term; |
|
| 156 | 156 | $resource = @fopen($path_file, "a"); |
| 157 | 157 | if (file_exists($path_file) && $resource) { |
| 158 | - if (fwrite($resource, $new_data . PHP_EOL) === false) { |
|
| 158 | + if (fwrite($resource, $new_data.PHP_EOL) === false) { |
|
| 159 | 159 | //not allow to write |
| 160 | 160 | $return_value = false; |
| 161 | 161 | } else { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | if (empty($sub_language_dir)) { |
| 178 | 178 | return false; |
| 179 | 179 | } |
| 180 | - $dir = api_get_path(SYS_LANG_PATH) . $sub_language_dir; |
|
| 180 | + $dir = api_get_path(SYS_LANG_PATH).$sub_language_dir; |
|
| 181 | 181 | if (is_dir($dir)) { |
| 182 | 182 | return true; |
| 183 | 183 | } //even if the dir already exists, we reach the objective of having the directory there |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | return false; |
| 202 | 202 | } |
| 203 | 203 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 204 | - $sql = 'SELECT dokeos_folder FROM ' . $table . ' |
|
| 205 | - WHERE parent_id = ' . $parent_id . ' and id = ' . $sub_language_id; |
|
| 204 | + $sql = 'SELECT dokeos_folder FROM '.$table.' |
|
| 205 | + WHERE parent_id = ' . $parent_id.' and id = '.$sub_language_id; |
|
| 206 | 206 | $res = Database::query($sql); |
| 207 | 207 | if ($res === false or Database::num_rows($res) < 1) { |
| 208 | 208 | return false; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | if ($res === false) { |
| 213 | 213 | return false; |
| 214 | 214 | } //can't delete dir, so do not delete language record |
| 215 | - $sql = 'DELETE FROM ' . $table . ' |
|
| 215 | + $sql = 'DELETE FROM '.$table.' |
|
| 216 | 216 | WHERE id= ' . intval($sub_language_id); |
| 217 | 217 | $res = Database::query($sql); |
| 218 | 218 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | if (empty($sub_language_dir)) { |
| 230 | 230 | return false; |
| 231 | 231 | } |
| 232 | - $dir = api_get_path(SYS_LANG_PATH) . $sub_language_dir; |
|
| 232 | + $dir = api_get_path(SYS_LANG_PATH).$sub_language_dir; |
|
| 233 | 233 | if (!is_dir($dir)) { |
| 234 | 234 | return true; |
| 235 | 235 | } //even if the dir does not exist, we reach the objective of not having the directory there |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | if (count($content) > 0) { |
| 239 | 239 | foreach ($content as $value_content) { |
| 240 | - $path_file = $dir . '/' . $value_content; |
|
| 240 | + $path_file = $dir.'/'.$value_content; |
|
| 241 | 241 | unlink($path_file); |
| 242 | 242 | } |
| 243 | 243 | return @rmdir($dir); |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | { |
| 256 | 256 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 257 | 257 | $sql = 'SELECT count(*) as count |
| 258 | - FROM ' . $table . ' |
|
| 259 | - WHERE id="' . intval($language_id) . '"'; |
|
| 258 | + FROM ' . $table.' |
|
| 259 | + WHERE id="' . intval($language_id).'"'; |
|
| 260 | 260 | $rs = Database::query($sql); |
| 261 | 261 | if (Database::num_rows($rs) > 0) { |
| 262 | 262 | if (Database::result($rs, 0, 'count') == 1) { |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | { |
| 279 | 279 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 280 | 280 | $sql = 'SELECT original_name |
| 281 | - FROM ' . $table . ' |
|
| 282 | - WHERE id= ' . intval($language_id) . ''; |
|
| 281 | + FROM ' . $table.' |
|
| 282 | + WHERE id= ' . intval($language_id).''; |
|
| 283 | 283 | $rs = Database::query($sql); |
| 284 | 284 | if (Database::num_rows($rs) > 0) { |
| 285 | 285 | return Database::result($rs, 0, 'original_name'); |
@@ -297,8 +297,8 @@ discard block |
||
| 297 | 297 | public static function check_if_language_is_sub_language($language_id) |
| 298 | 298 | { |
| 299 | 299 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 300 | - $sql = 'SELECT count(*) AS count FROM ' . $table . ' |
|
| 301 | - WHERE id = ' . intval($language_id) . ' AND NOT ISNULL(parent_id)'; |
|
| 300 | + $sql = 'SELECT count(*) AS count FROM '.$table.' |
|
| 301 | + WHERE id = ' . intval($language_id).' AND NOT ISNULL(parent_id)'; |
|
| 302 | 302 | $rs = Database::query($sql); |
| 303 | 303 | |
| 304 | 304 | if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') == 1) { |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | $language_info = self::get_all_information_of_language($language_id); |
| 318 | 318 | $table = Database :: get_main_table(TABLE_MAIN_USER); |
| 319 | - $sql = 'SELECT count(*) AS count FROM ' . $table . ' |
|
| 319 | + $sql = 'SELECT count(*) AS count FROM '.$table.' |
|
| 320 | 320 | WHERE language ="' . Database::escape_string($language_info['english_name']).'"'; |
| 321 | 321 | $rs = Database::query($sql); |
| 322 | 322 | if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') >= 1) { |
@@ -334,8 +334,8 @@ discard block |
||
| 334 | 334 | public static function check_if_language_is_father($language_id) |
| 335 | 335 | { |
| 336 | 336 | $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 337 | - $sql = 'SELECT count(*) AS count FROM ' . $table . ' |
|
| 338 | - WHERE parent_id= ' . intval($language_id) . ' AND NOT ISNULL(parent_id);'; |
|
| 337 | + $sql = 'SELECT count(*) AS count FROM '.$table.' |
|
| 338 | + WHERE parent_id= ' . intval($language_id).' AND NOT ISNULL(parent_id);'; |
|
| 339 | 339 | $rs = Database::query($sql); |
| 340 | 340 | |
| 341 | 341 | if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') == 1) { |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | { |
| 355 | 355 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 356 | 356 | $sql = "UPDATE $tbl_admin_languages SET available='0' |
| 357 | - WHERE id = " . intval($language_id) . ""; |
|
| 357 | + WHERE id = ".intval($language_id).""; |
|
| 358 | 358 | $result = Database::query($sql); |
| 359 | 359 | |
| 360 | 360 | return $result !== false; //only return false on sql error |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | { |
| 370 | 370 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 371 | 371 | $sql = "UPDATE $tbl_admin_languages SET available='1' |
| 372 | - WHERE id = " . intval($language_id) . ""; |
|
| 372 | + WHERE id = ".intval($language_id).""; |
|
| 373 | 373 | $result = Database::query($sql); |
| 374 | 374 | |
| 375 | 375 | return $result !== false; //only return false on sql error |
@@ -387,11 +387,11 @@ discard block |
||
| 387 | 387 | } |
| 388 | 388 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 389 | 389 | $tbl_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
| 390 | - $sql = "SELECT english_name FROM " . $tbl_admin_languages . " |
|
| 391 | - WHERE id= " . intval($language_id) . ""; |
|
| 390 | + $sql = "SELECT english_name FROM ".$tbl_admin_languages." |
|
| 391 | + WHERE id= " . intval($language_id).""; |
|
| 392 | 392 | $result = Database::query($sql); |
| 393 | 393 | $lang = Database::fetch_array($result); |
| 394 | - $sql_update_2 = "UPDATE " . $tbl_settings_current . " SET selected_value='" . $lang['english_name'] . "' |
|
| 394 | + $sql_update_2 = "UPDATE ".$tbl_settings_current." SET selected_value='".$lang['english_name']."' |
|
| 395 | 395 | WHERE variable='platformLanguage'"; |
| 396 | 396 | $result_2 = Database::query($sql_update_2); |
| 397 | 397 | Event::addEvent( |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | { |
| 412 | 412 | $name = api_get_setting('platformLanguage'); |
| 413 | 413 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 414 | - $sql = "SELECT id FROM " . $tbl_admin_languages . " WHERE english_name ='$name'"; |
|
| 414 | + $sql = "SELECT id FROM ".$tbl_admin_languages." WHERE english_name ='$name'"; |
|
| 415 | 415 | $res = Database::query($sql); |
| 416 | 416 | if (Database::num_rows($res) < 1) { |
| 417 | 417 | return false; |
@@ -430,10 +430,10 @@ discard block |
||
| 430 | 430 | { |
| 431 | 431 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 432 | 432 | $sql = "SELECT dokeos_folder |
| 433 | - FROM " . $tbl_admin_languages . " |
|
| 433 | + FROM " . $tbl_admin_languages." |
|
| 434 | 434 | WHERE id = ( |
| 435 | - SELECT parent_id FROM " . $tbl_admin_languages . " |
|
| 436 | - WHERE dokeos_folder = '" . Database::escape_string($language_path) . "' |
|
| 435 | + SELECT parent_id FROM " . $tbl_admin_languages." |
|
| 436 | + WHERE dokeos_folder = '" . Database::escape_string($language_path)."' |
|
| 437 | 437 | ) |
| 438 | 438 | "; |
| 439 | 439 | $result = Database::query($sql); |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | $adminLanguagesTable = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
| 456 | 456 | // select language - if case several languages match, get the last (more recent) one |
| 457 | 457 | $sql = "SELECT english_name |
| 458 | - FROM " . $adminLanguagesTable . " |
|
| 458 | + FROM " . $adminLanguagesTable." |
|
| 459 | 459 | WHERE |
| 460 | 460 | isocode ='$isocode' AND |
| 461 | 461 | available = 1 |
@@ -14,6 +14,9 @@ |
||
| 14 | 14 | class Session implements \ArrayAccess |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param string $variable |
|
| 19 | + */ |
|
| 17 | 20 | static function read($variable, $default = null) |
| 18 | 21 | { |
| 19 | 22 | return isset($_SESSION[$variable]) ? $_SESSION[$variable] : $default; |
@@ -31,6 +31,10 @@ |
||
| 31 | 31 | return $method == 'GET'; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | + /** |
|
| 35 | + * @param string $key |
|
| 36 | + * @param string $default |
|
| 37 | + */ |
|
| 34 | 38 | public static function post($key, $default = null) |
| 35 | 39 | { |
| 36 | 40 | return isset($_POST[$key]) ? $_POST[$key] : $default; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public static function has($key){ |
|
| 18 | + public static function has($key) { |
|
| 19 | 19 | return isset($_REQUEST[$key]); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -16,7 +16,6 @@ |
||
| 16 | 16 | * @author Patrick Cool |
| 17 | 17 | * @author René Haentjens, added CSV file import (October 2004) |
| 18 | 18 | * @package chamilo.link |
| 19 | - |
|
| 20 | 19 | */ |
| 21 | 20 | |
| 22 | 21 | // Including libraries |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
| 81 | 81 | * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column. |
| 82 | 82 | * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3] |
| 83 | - * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
| 83 | + * @param integer $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
| 84 | 84 | * @return array The sorted dataset |
| 85 | 85 | * @author [email protected] |
| 86 | 86 | */ |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $new_data_order = array(); |
| 159 | 159 | if (!empty($docs_to_sort)) { |
| 160 | - foreach($docs_to_sort as $id => $document) { |
|
| 160 | + foreach ($docs_to_sort as $id => $document) { |
|
| 161 | 161 | if (isset($new_data[$id])) { |
| 162 | 162 | $new_data_order[] = $new_data[$id]; |
| 163 | 163 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | if (!empty($folder_to_sort)) { |
| 168 | - foreach($folder_to_sort as $id => $document) { |
|
| 168 | + foreach ($folder_to_sort as $id => $document) { |
|
| 169 | 169 | if (isset($new_data[$id])) { |
| 170 | 170 | $new_data_order[] = $new_data[$id]; |
| 171 | 171 | } |
@@ -15,16 +15,16 @@ discard block |
||
| 15 | 15 | class TableSort |
| 16 | 16 | { |
| 17 | 17 | /** |
| 18 | - * Sorts 2-dimensional table. |
|
| 19 | - * @param array $data The data to be sorted. |
|
| 20 | - * @param int $column The column on which the data should be sorted (default = 0) |
|
| 21 | - * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC) |
|
| 22 | - * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, |
|
| 23 | - * SORT_STRING,SORT_DATE,SORT_IMAGE) |
|
| 24 | - * @return array The sorted dataset |
|
| 25 | - * @author [email protected] |
|
| 26 | - */ |
|
| 27 | - public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR) |
|
| 18 | + * Sorts 2-dimensional table. |
|
| 19 | + * @param array $data The data to be sorted. |
|
| 20 | + * @param int $column The column on which the data should be sorted (default = 0) |
|
| 21 | + * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC) |
|
| 22 | + * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, |
|
| 23 | + * SORT_STRING,SORT_DATE,SORT_IMAGE) |
|
| 24 | + * @return array The sorted dataset |
|
| 25 | + * @author [email protected] |
|
| 26 | + */ |
|
| 27 | + public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR) |
|
| 28 | 28 | { |
| 29 | 29 | if (!is_array($data) || empty($data)) { |
| 30 | 30 | return array(); |
@@ -71,20 +71,20 @@ discard block |
||
| 71 | 71 | usort($data, create_function('$a, $b', $compare_function)); |
| 72 | 72 | |
| 73 | 73 | return $data; |
| 74 | - } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted. |
|
| 78 | - * @param array $data The data to be sorted. |
|
| 79 | - * @param int $column The column on which the data should be sorted (default = 0) |
|
| 80 | - * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
|
| 81 | - * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column. |
|
| 82 | - * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3] |
|
| 83 | - * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
| 84 | - * @return array The sorted dataset |
|
| 85 | - * @author [email protected] |
|
| 86 | - */ |
|
| 87 | - public static function sort_table_config( |
|
| 76 | + /** |
|
| 77 | + * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted. |
|
| 78 | + * @param array $data The data to be sorted. |
|
| 79 | + * @param int $column The column on which the data should be sorted (default = 0) |
|
| 80 | + * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
|
| 81 | + * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column. |
|
| 82 | + * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3] |
|
| 83 | + * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
| 84 | + * @return array The sorted dataset |
|
| 85 | + * @author [email protected] |
|
| 86 | + */ |
|
| 87 | + public static function sort_table_config( |
|
| 88 | 88 | $data, |
| 89 | 89 | $column = 0, |
| 90 | 90 | $direction = SORT_ASC, |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | if (!empty($data)) { |
| 133 | 133 | foreach ($data as $document) { |
| 134 | 134 | if ($document['type'] == 'folder') { |
| 135 | - $docs_to_sort[$document['id']] = api_strtolower($document['name']); |
|
| 135 | + $docs_to_sort[$document['id']] = api_strtolower($document['name']); |
|
| 136 | 136 | } else { |
| 137 | - $folder_to_sort[$document['id']] = api_strtolower($document['name']); |
|
| 137 | + $folder_to_sort[$document['id']] = api_strtolower($document['name']); |
|
| 138 | 138 | } |
| 139 | 139 | $new_data[$document['id']] = $document; |
| 140 | 140 | } |
@@ -196,91 +196,91 @@ discard block |
||
| 196 | 196 | usort($data, create_function('$a, $b', $compare_function)); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if (is_array($column_show) && !empty($column_show)) { |
|
| 199 | + if (is_array($column_show) && !empty($column_show)) { |
|
| 200 | 200 | |
| 201 | - // We show only the columns data that were set up on the $column_show array |
|
| 202 | - $new_order_data = array(); |
|
| 203 | - $count_data = count($data); |
|
| 204 | - $count_column_show = count($column_show); |
|
| 205 | - for ($j = 0; $j < $count_data; $j++) { |
|
| 206 | - $k = 0; |
|
| 207 | - for ($i = 0; $i < $count_column_show; $i++) { |
|
| 208 | - if ($column_show[$i]) { |
|
| 209 | - $new_order_data[$j][$k] = $data[$j][$i]; |
|
| 210 | - } |
|
| 211 | - $k++; |
|
| 212 | - } |
|
| 213 | - } |
|
| 214 | - // Replace the multi-arrays |
|
| 215 | - $data = $new_order_data; |
|
| 216 | - } |
|
| 201 | + // We show only the columns data that were set up on the $column_show array |
|
| 202 | + $new_order_data = array(); |
|
| 203 | + $count_data = count($data); |
|
| 204 | + $count_column_show = count($column_show); |
|
| 205 | + for ($j = 0; $j < $count_data; $j++) { |
|
| 206 | + $k = 0; |
|
| 207 | + for ($i = 0; $i < $count_column_show; $i++) { |
|
| 208 | + if ($column_show[$i]) { |
|
| 209 | + $new_order_data[$j][$k] = $data[$j][$i]; |
|
| 210 | + } |
|
| 211 | + $k++; |
|
| 212 | + } |
|
| 213 | + } |
|
| 214 | + // Replace the multi-arrays |
|
| 215 | + $data = $new_order_data; |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | - return $data; |
|
| 219 | - } |
|
| 218 | + return $data; |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - /** |
|
| 222 | - * Checks whether a column of a 2D-array contains only numeric values |
|
| 223 | - * @param array $data The data-array |
|
| 224 | - * @param int $column The index of the column to check |
|
| 225 | - * @return bool TRUE if column contains only dates, FALSE otherwise |
|
| 226 | - * @todo Take locale into account (eg decimal point or comma ?) |
|
| 227 | - * @author [email protected] |
|
| 228 | - */ |
|
| 229 | - private static function is_numeric_column(& $data, $column) |
|
| 221 | + /** |
|
| 222 | + * Checks whether a column of a 2D-array contains only numeric values |
|
| 223 | + * @param array $data The data-array |
|
| 224 | + * @param int $column The index of the column to check |
|
| 225 | + * @return bool TRUE if column contains only dates, FALSE otherwise |
|
| 226 | + * @todo Take locale into account (eg decimal point or comma ?) |
|
| 227 | + * @author [email protected] |
|
| 228 | + */ |
|
| 229 | + private static function is_numeric_column(& $data, $column) |
|
| 230 | 230 | { |
| 231 | - $is_numeric = true; |
|
| 232 | - foreach ($data as $index => & $row) { |
|
| 233 | - $is_numeric &= is_numeric(strip_tags($row[$column])); |
|
| 234 | - if (!$is_numeric) { |
|
| 235 | - break; |
|
| 236 | - } |
|
| 237 | - } |
|
| 238 | - return $is_numeric; |
|
| 239 | - } |
|
| 231 | + $is_numeric = true; |
|
| 232 | + foreach ($data as $index => & $row) { |
|
| 233 | + $is_numeric &= is_numeric(strip_tags($row[$column])); |
|
| 234 | + if (!$is_numeric) { |
|
| 235 | + break; |
|
| 236 | + } |
|
| 237 | + } |
|
| 238 | + return $is_numeric; |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Checks whether a column of a 2D-array contains only dates (GNU date syntax) |
|
| 243 | - * @param array $data The data-array |
|
| 244 | - * @param int $column The index of the column to check |
|
| 245 | - * @return bool TRUE if column contains only dates, FALSE otherwise |
|
| 246 | - * @author [email protected] |
|
| 247 | - */ |
|
| 248 | - private static function is_date_column(& $data, $column) |
|
| 241 | + /** |
|
| 242 | + * Checks whether a column of a 2D-array contains only dates (GNU date syntax) |
|
| 243 | + * @param array $data The data-array |
|
| 244 | + * @param int $column The index of the column to check |
|
| 245 | + * @return bool TRUE if column contains only dates, FALSE otherwise |
|
| 246 | + * @author [email protected] |
|
| 247 | + */ |
|
| 248 | + private static function is_date_column(& $data, $column) |
|
| 249 | 249 | { |
| 250 | - $is_date = true; |
|
| 251 | - foreach ($data as $index => & $row) { |
|
| 252 | - if (strlen(strip_tags($row[$column])) != 0) { |
|
| 253 | - $check_date = strtotime(strip_tags($row[$column])); |
|
| 254 | - // strtotime Returns a timestamp on success, FALSE otherwise. |
|
| 255 | - // Previous to PHP 5.1.0, this function would return -1 on failure. |
|
| 256 | - $is_date &= ($check_date != -1 && $check_date); |
|
| 257 | - } else { |
|
| 258 | - $is_date &= false; |
|
| 259 | - } |
|
| 260 | - if (!$is_date) { |
|
| 261 | - break; |
|
| 262 | - } |
|
| 263 | - } |
|
| 264 | - return $is_date; |
|
| 265 | - } |
|
| 250 | + $is_date = true; |
|
| 251 | + foreach ($data as $index => & $row) { |
|
| 252 | + if (strlen(strip_tags($row[$column])) != 0) { |
|
| 253 | + $check_date = strtotime(strip_tags($row[$column])); |
|
| 254 | + // strtotime Returns a timestamp on success, FALSE otherwise. |
|
| 255 | + // Previous to PHP 5.1.0, this function would return -1 on failure. |
|
| 256 | + $is_date &= ($check_date != -1 && $check_date); |
|
| 257 | + } else { |
|
| 258 | + $is_date &= false; |
|
| 259 | + } |
|
| 260 | + if (!$is_date) { |
|
| 261 | + break; |
|
| 262 | + } |
|
| 263 | + } |
|
| 264 | + return $is_date; |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - /** |
|
| 268 | - * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>) |
|
| 269 | - * @param array $data The data-array |
|
| 270 | - * @param int $column The index of the column to check |
|
| 271 | - * @return bool TRUE if column contains only images, FALSE otherwise |
|
| 272 | - * @author [email protected] |
|
| 273 | - */ |
|
| 274 | - private static function is_image_column(& $data, $column) |
|
| 267 | + /** |
|
| 268 | + * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>) |
|
| 269 | + * @param array $data The data-array |
|
| 270 | + * @param int $column The index of the column to check |
|
| 271 | + * @return bool TRUE if column contains only images, FALSE otherwise |
|
| 272 | + * @author [email protected] |
|
| 273 | + */ |
|
| 274 | + private static function is_image_column(& $data, $column) |
|
| 275 | 275 | { |
| 276 | - $is_image = true; |
|
| 277 | - foreach ($data as $index => & $row) { |
|
| 278 | - $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag |
|
| 279 | - $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values |
|
| 280 | - if (!$is_image) { |
|
| 281 | - break; |
|
| 282 | - } |
|
| 283 | - } |
|
| 284 | - return $is_image; |
|
| 285 | - } |
|
| 276 | + $is_image = true; |
|
| 277 | + foreach ($data as $index => & $row) { |
|
| 278 | + $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag |
|
| 279 | + $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values |
|
| 280 | + if (!$is_image) { |
|
| 281 | + break; |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | + return $is_image; |
|
| 285 | + } |
|
| 286 | 286 | } |
@@ -330,6 +330,7 @@ discard block |
||
| 330 | 330 | /** |
| 331 | 331 | * Sets the footer visibility |
| 332 | 332 | * @param bool true if we show the footer |
| 333 | + * @param boolean $status |
|
| 333 | 334 | */ |
| 334 | 335 | public function set_footer($status) |
| 335 | 336 | { |
@@ -370,6 +371,7 @@ discard block |
||
| 370 | 371 | /** |
| 371 | 372 | * Sets the header visibility |
| 372 | 373 | * @param bool true if we show the header |
| 374 | + * @param boolean $status |
|
| 373 | 375 | */ |
| 374 | 376 | public function set_header($status) |
| 375 | 377 | { |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $content = '<li class="help">'; |
| 265 | 265 | $content .= Display::url( |
| 266 | 266 | Display::return_icon('help.large.png', get_lang('Help')), |
| 267 | - api_get_path(WEB_CODE_PATH) . 'help/help.php?open=' . $help, |
|
| 267 | + api_get_path(WEB_CODE_PATH).'help/help.php?open='.$help, |
|
| 268 | 268 | [ |
| 269 | 269 | 'class' => 'ajax', |
| 270 | 270 | 'data-title' => get_lang('Help') |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | 'web_course' => api_get_path(WEB_COURSE_PATH), |
| 479 | 479 | 'web_main' => api_get_path(WEB_CODE_PATH), |
| 480 | 480 | 'web_css' => api_get_path(WEB_CSS_PATH), |
| 481 | - 'web_css_theme' => api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/', |
|
| 481 | + 'web_css_theme' => api_get_path(WEB_CSS_PATH).'themes/'.$this->theme.'/', |
|
| 482 | 482 | 'web_ajax' => api_get_path(WEB_AJAX_PATH), |
| 483 | 483 | 'web_img' => api_get_path(WEB_IMG_PATH), |
| 484 | 484 | 'web_plugin' => api_get_path(WEB_PLUGIN_PATH), |
@@ -536,12 +536,12 @@ discard block |
||
| 536 | 536 | foreach ($bowerCSSFiles as $file) { |
| 537 | 537 | $css[] = api_get_path(WEB_PATH).'web/assets/'.$file; |
| 538 | 538 | } |
| 539 | - $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/bootstrap-select/css/bootstrap-select.min.css'; |
|
| 540 | - $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chosen/chosen.css'; |
|
| 541 | - $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/style.css'; |
|
| 539 | + $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/bootstrap-select/css/bootstrap-select.min.css'; |
|
| 540 | + $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chosen/chosen.css'; |
|
| 541 | + $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css'; |
|
| 542 | 542 | |
| 543 | 543 | if (api_is_global_chat_enabled()) { |
| 544 | - $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chat/css/chat.css'; |
|
| 544 | + $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chat/css/chat.css'; |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | //THEME CSS STYLE |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | |
| 609 | 609 | $style_print = ''; |
| 610 | 610 | if (is_readable(api_get_path(SYS_CSS_PATH).$this->theme.'/print.css')) { |
| 611 | - $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH) . $this->theme . '/print.css'), |
|
| 611 | + $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->theme.'/print.css'), |
|
| 612 | 612 | 'print'); |
| 613 | 613 | } |
| 614 | 614 | $this->assign('css_style_print', $style_print); |
@@ -631,10 +631,10 @@ discard block |
||
| 631 | 631 | |
| 632 | 632 | $isoCode = api_get_language_isocode(); |
| 633 | 633 | |
| 634 | - $selectLink = 'bootstrap-select/js/i18n/defaults-' . $isoCode . '_' . strtoupper($isoCode) . '.min.js'; |
|
| 634 | + $selectLink = 'bootstrap-select/js/i18n/defaults-'.$isoCode.'_'.strtoupper($isoCode).'.min.js'; |
|
| 635 | 635 | |
| 636 | 636 | if ($isoCode == 'en') { |
| 637 | - $selectLink = 'bootstrap-select/js/i18n/defaults-' . $isoCode . '_US.min.js'; |
|
| 637 | + $selectLink = 'bootstrap-select/js/i18n/defaults-'.$isoCode.'_US.min.js'; |
|
| 638 | 638 | } |
| 639 | 639 | // JS files |
| 640 | 640 | $js_files = array( |
@@ -684,8 +684,8 @@ discard block |
||
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | if ($isoCode != 'en') { |
| 687 | - $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-' . $isoCode . '.js'; |
|
| 688 | - $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-' . $isoCode . '.min.js'; |
|
| 687 | + $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-'.$isoCode.'.js'; |
|
| 688 | + $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-'.$isoCode.'.min.js'; |
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | foreach ($bowerJsFiles as $file) { |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | $this->assign('online_button', Display::return_icon('statusonline.png', null, null, ICON_SIZE_ATOM)); |
| 769 | - $this->assign('offline_button',Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM)); |
|
| 769 | + $this->assign('offline_button', Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM)); |
|
| 770 | 770 | |
| 771 | 771 | // Get language iso-code for this page - ignore errors |
| 772 | 772 | $this->assign('document_language', api_get_language_isocode()); |
@@ -825,15 +825,15 @@ discard block |
||
| 825 | 825 | $this->assign('section_name', 'section-'.$this_section); |
| 826 | 826 | |
| 827 | 827 | //Defaul root chamilo favicon |
| 828 | - $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_PATH) . 'favicon.ico" type="image/x-icon" />'; |
|
| 828 | + $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_PATH).'favicon.ico" type="image/x-icon" />'; |
|
| 829 | 829 | |
| 830 | 830 | //Added to verify if in the current Chamilo Theme exist a favicon |
| 831 | - $favicoThemeUrl = api_get_path(SYS_CSS_PATH) . 'themes/' . $this->theme . '/images/'; |
|
| 831 | + $favicoThemeUrl = api_get_path(SYS_CSS_PATH).'themes/'.$this->theme.'/images/'; |
|
| 832 | 832 | |
| 833 | 833 | //If exist pick the current chamilo theme favicon |
| 834 | - if (is_file($favicoThemeUrl . 'favicon.ico')) { |
|
| 835 | - $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_CSS_PATH) |
|
| 836 | - . 'themes/' . $this->theme . '/images/favicon.ico" type="image/x-icon" />'; |
|
| 834 | + if (is_file($favicoThemeUrl.'favicon.ico')) { |
|
| 835 | + $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_CSS_PATH) |
|
| 836 | + . 'themes/'.$this->theme.'/images/favicon.ico" type="image/x-icon" />'; |
|
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | if (api_is_multiple_url_enabled()) { |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) { |
| 864 | 864 | $bug_notification_link = '<li class="report"> |
| 865 | 865 | <a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank"> |
| 866 | - '. $iconBug . ' |
|
| 866 | + '. $iconBug.' |
|
| 867 | 867 | </a> |
| 868 | 868 | </li>'; |
| 869 | 869 | } |
@@ -975,13 +975,13 @@ discard block |
||
| 975 | 975 | $socialMeta = ''; |
| 976 | 976 | $metaTitle = api_get_setting('meta_title'); |
| 977 | 977 | if (!empty($metaTitle)) { |
| 978 | - $socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n"; |
|
| 978 | + $socialMeta .= '<meta name="twitter:card" content="summary" />'."\n"; |
|
| 979 | 979 | $metaSite = api_get_setting('meta_twitter_site'); |
| 980 | 980 | if (!empty($metaSite)) { |
| 981 | - $socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n"; |
|
| 981 | + $socialMeta .= '<meta name="twitter:site" content="'.$metaSite.'" />'."\n"; |
|
| 982 | 982 | $metaCreator = api_get_setting('meta_twitter_creator'); |
| 983 | 983 | if (!empty($metaCreator)) { |
| 984 | - $socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n"; |
|
| 984 | + $socialMeta .= '<meta name="twitter:creator" content="'.$metaCreator.'" />'."\n"; |
|
| 985 | 985 | } |
| 986 | 986 | } |
| 987 | 987 | |
@@ -993,19 +993,19 @@ discard block |
||
| 993 | 993 | if (!$userId && !$skillId) { |
| 994 | 994 | // no combination of user and skill ID has been defined, |
| 995 | 995 | // so print the normal OpenGraph meta tags |
| 996 | - $socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n"; |
|
| 997 | - $socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n"; |
|
| 996 | + $socialMeta .= '<meta property="og:title" content="'.$metaTitle.'" />'."\n"; |
|
| 997 | + $socialMeta .= '<meta property="og:url" content="'.api_get_path(WEB_PATH).'" />'."\n"; |
|
| 998 | 998 | |
| 999 | 999 | $metaDescription = api_get_setting('meta_description'); |
| 1000 | 1000 | if (!empty($metaDescription)) { |
| 1001 | - $socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n"; |
|
| 1001 | + $socialMeta .= '<meta property="og:description" content="'.$metaDescription.'" />'."\n"; |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | $metaImage = api_get_setting('meta_image_path'); |
| 1005 | 1005 | if (!empty($metaImage)) { |
| 1006 | - if (is_file(api_get_path(SYS_PATH) . $metaImage)) { |
|
| 1007 | - $path = api_get_path(WEB_PATH) . $metaImage; |
|
| 1008 | - $socialMeta .= '<meta property="og:image" content="' . $path . '" />' . "\n"; |
|
| 1006 | + if (is_file(api_get_path(SYS_PATH).$metaImage)) { |
|
| 1007 | + $path = api_get_path(WEB_PATH).$metaImage; |
|
| 1008 | + $socialMeta .= '<meta property="og:image" content="'.$path.'" />'."\n"; |
|
| 1009 | 1009 | } |
| 1010 | 1010 | } |
| 1011 | 1011 | } |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | // Tutor name |
| 1040 | 1040 | if (api_get_setting('show_tutor_data') == 'true') { |
| 1041 | 1041 | // Course manager |
| 1042 | - $courseId = api_get_course_int_id(); |
|
| 1042 | + $courseId = api_get_course_int_id(); |
|
| 1043 | 1043 | $id_session = api_get_session_id(); |
| 1044 | 1044 | if (!empty($courseId)) { |
| 1045 | 1045 | $tutor_data = ''; |
@@ -1071,7 +1071,7 @@ discard block |
||
| 1071 | 1071 | $courseId = api_get_course_int_id(); |
| 1072 | 1072 | if (!empty($courseId)) { |
| 1073 | 1073 | $teacher_data = ''; |
| 1074 | - $mail= CourseManager::get_emails_of_tutors_to_course($courseId); |
|
| 1074 | + $mail = CourseManager::get_emails_of_tutors_to_course($courseId); |
|
| 1075 | 1075 | if (!empty($mail)) { |
| 1076 | 1076 | $teachers_parsed = array(); |
| 1077 | 1077 | foreach ($mail as $value) { |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | 'sessionVar' => basename(__FILE__, '.php'), |
| 1306 | 1306 | 'imageOptions' => array( |
| 1307 | 1307 | 'font_size' => 20, |
| 1308 | - 'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/', |
|
| 1308 | + 'font_path' => api_get_path(SYS_FONTS_PATH).'opensans/', |
|
| 1309 | 1309 | 'font_file' => 'OpenSans-Regular.ttf', |
| 1310 | 1310 | //'output' => 'gif' |
| 1311 | 1311 | ) |
@@ -52,6 +52,7 @@ discard block |
||
| 52 | 52 | * Converts the text of a html-document to a given encoding, the meta-tag is changed accordingly. |
| 53 | 53 | * @param string $string The input full-html document. |
| 54 | 54 | * @param string The new encoding value to be set. |
| 55 | + * @param string $encoding |
|
| 55 | 56 | */ |
| 56 | 57 | function api_set_encoding_html(&$string, $encoding) { |
| 57 | 58 | $old_encoding = api_detect_encoding_html($string); |
@@ -74,7 +75,7 @@ discard block |
||
| 74 | 75 | * Returns the title of a html document. |
| 75 | 76 | * @param string $string The contents of the input document. |
| 76 | 77 | * @param string $input_encoding The encoding of the input document. If the value is not set, it is detected. |
| 77 | - * @param string $$output_encoding The encoding of the retrieved title. If the value is not set, the system encoding is assumend. |
|
| 78 | + * @param string $output_encoding The encoding of the retrieved title. If the value is not set, the system encoding is assumend. |
|
| 78 | 79 | * @return string The retrieved title, html-entities and extra-whitespace between the words are cleaned. |
| 79 | 80 | */ |
| 80 | 81 | function api_get_title_html(&$string, $output_encoding = null, $input_encoding = null) { |
@@ -433,7 +434,7 @@ discard block |
||
| 433 | 434 | * @since wordpress 2.8.1 |
| 434 | 435 | * @access private |
| 435 | 436 | * |
| 436 | - * @param string|array $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles. |
|
| 437 | + * @param string[] $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles. |
|
| 437 | 438 | * @param string $subject The string being searched and replaced on, otherwise known as the haystack. |
| 438 | 439 | * @return string The string with the replaced svalues. |
| 439 | 440 | */ |
@@ -628,6 +629,7 @@ discard block |
||
| 628 | 629 | * @param string The text to "cut" |
| 629 | 630 | * @param int Count of chars |
| 630 | 631 | * @param bool Whether to embed in a <span title="...">...</span> |
| 632 | + * @param integer $maxchar |
|
| 631 | 633 | * @return string |
| 632 | 634 | * */ |
| 633 | 635 | function cut($text, $maxchar, $embed = false) { |
@@ -645,7 +647,7 @@ discard block |
||
| 645 | 647 | * |
| 646 | 648 | * @param mixed Number to convert |
| 647 | 649 | * @param int Decimal points 0=never, 1=if needed, 2=always |
| 648 | - * @return mixed An integer or a float depends on the parameter |
|
| 650 | + * @return string|null An integer or a float depends on the parameter |
|
| 649 | 651 | */ |
| 650 | 652 | function float_format($number, $flag = 1) { |
| 651 | 653 | if (is_numeric($number)) { |
@@ -689,7 +691,7 @@ discard block |
||
| 689 | 691 | /** |
| 690 | 692 | * Gets the week from a day |
| 691 | 693 | * @param string Date in UTC (2010-01-01 12:12:12) |
| 692 | - * @return int Returns an integer with the week number of the year |
|
| 694 | + * @return string Returns an integer with the week number of the year |
|
| 693 | 695 | */ |
| 694 | 696 | function get_week_from_day($date) { |
| 695 | 697 | if (!empty($date)) { |
@@ -739,6 +741,9 @@ discard block |
||
| 739 | 741 | return $output.$end; |
| 740 | 742 | } |
| 741 | 743 | |
| 744 | +/** |
|
| 745 | + * @param string $glue |
|
| 746 | + */ |
|
| 742 | 747 | function implode_with_key($glue, $array) { |
| 743 | 748 | if (!empty($array)) { |
| 744 | 749 | $string = ''; |
@@ -817,7 +822,7 @@ discard block |
||
| 817 | 822 | /** |
| 818 | 823 | * @param string $string |
| 819 | 824 | * @param bool $capitalizeFirstCharacter |
| 820 | - * @return mixed |
|
| 825 | + * @return string |
|
| 821 | 826 | */ |
| 822 | 827 | function underScoreToCamelCase($string, $capitalizeFirstCharacter = true) |
| 823 | 828 | { |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | if (@preg_match('/(.*<head.*)(<meta[^>]*content=[^>]*>)(.*<\/head>.*)/si', $string, $matches)) { |
| 59 | 59 | $meta = $matches[2]; |
| 60 | 60 | if (@preg_match("/(<meta[^>]*charset=)(.*)([\"';][^>]*>)/si", $meta, $matches1)) { |
| 61 | - $meta = $matches1[1] . $encoding . $matches1[3]; |
|
| 62 | - $string = $matches[1] . $meta . $matches[3]; |
|
| 61 | + $meta = $matches1[1].$encoding.$matches1[3]; |
|
| 62 | + $string = $matches[1].$meta.$matches[3]; |
|
| 63 | 63 | } else { |
| 64 | - $string = $matches[1] . '<meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/>' . $matches[3]; |
|
| 64 | + $string = $matches[1].'<meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/>'.$matches[3]; |
|
| 65 | 65 | } |
| 66 | 66 | } else { |
| 67 | 67 | $count = 1; |
@@ -168,9 +168,9 @@ discard block |
||
| 168 | 168 | if (!preg_match(_PCRE_XML_ENCODING, $string)) { |
| 169 | 169 | if (strpos($matches[0], 'standalone') !== false) { |
| 170 | 170 | // The encoding option should precede the standalone option, othewise DOMDocument fails to load the document. |
| 171 | - $replace = str_replace('standalone', ' encoding="'.$to_encoding.'" standalone' , $matches[0]); |
|
| 171 | + $replace = str_replace('standalone', ' encoding="'.$to_encoding.'" standalone', $matches[0]); |
|
| 172 | 172 | } else { |
| 173 | - $replace = str_replace('?>', ' encoding="'.$to_encoding.'"?>' , $matches[0]); |
|
| 173 | + $replace = str_replace('?>', ' encoding="'.$to_encoding.'"?>', $matches[0]); |
|
| 174 | 174 | } |
| 175 | 175 | return api_convert_encoding(str_replace($matches[0], $replace, $string), $to_encoding, $from_encoding); |
| 176 | 176 | } |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | function _make_url_clickable_cb($matches) { |
| 336 | 336 | $url = $matches[2]; |
| 337 | 337 | |
| 338 | - if ( ')' == $matches[3] && strpos( $url, '(' ) ) { |
|
| 338 | + if (')' == $matches[3] && strpos($url, '(')) { |
|
| 339 | 339 | // If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL. |
| 340 | 340 | // Then we can let the parenthesis balancer do its thing below. |
| 341 | 341 | $url .= $matches[3]; |
@@ -345,16 +345,16 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | // Include parentheses in the URL only if paired |
| 348 | - while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) { |
|
| 349 | - $suffix = strrchr( $url, ')' ) . $suffix; |
|
| 350 | - $url = substr( $url, 0, strrpos( $url, ')' ) ); |
|
| 348 | + while (substr_count($url, '(') < substr_count($url, ')')) { |
|
| 349 | + $suffix = strrchr($url, ')').$suffix; |
|
| 350 | + $url = substr($url, 0, strrpos($url, ')')); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | $url = esc_url($url); |
| 354 | - if ( empty($url) ) |
|
| 354 | + if (empty($url)) |
|
| 355 | 355 | return $matches[0]; |
| 356 | 356 | |
| 357 | - return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix; |
|
| 357 | + return $matches[1]."<a href=\"$url\" rel=\"nofollow\">$url</a>".$suffix; |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /** |
@@ -374,10 +374,10 @@ discard block |
||
| 374 | 374 | * @param string $_context Private. Use esc_url_raw() for database usage. |
| 375 | 375 | * @return string The cleaned $url after the 'clean_url' filter is applied. |
| 376 | 376 | */ |
| 377 | -function esc_url( $url, $protocols = null, $_context = 'display' ) { |
|
| 377 | +function esc_url($url, $protocols = null, $_context = 'display') { |
|
| 378 | 378 | //$original_url = $url; |
| 379 | 379 | |
| 380 | - if ( '' == $url ) |
|
| 380 | + if ('' == $url) |
|
| 381 | 381 | return $url; |
| 382 | 382 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url); |
| 383 | 383 | $strip = array('%0d', '%0a', '%0D', '%0A'); |
@@ -387,9 +387,9 @@ discard block |
||
| 387 | 387 | * presume it needs http:// appended (unless a relative |
| 388 | 388 | * link starting with /, # or ? or a php file). |
| 389 | 389 | */ |
| 390 | - if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) && |
|
| 391 | - ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) |
|
| 392 | - $url = 'http://' . $url; |
|
| 390 | + if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && |
|
| 391 | + !preg_match('/^[a-z0-9-]+?\.php/i', $url)) |
|
| 392 | + $url = 'http://'.$url; |
|
| 393 | 393 | |
| 394 | 394 | return Security::remove_XSS($url); |
| 395 | 395 | |
@@ -437,12 +437,12 @@ discard block |
||
| 437 | 437 | * @param string $subject The string being searched and replaced on, otherwise known as the haystack. |
| 438 | 438 | * @return string The string with the replaced svalues. |
| 439 | 439 | */ |
| 440 | -function _deep_replace( $search, $subject ) { |
|
| 440 | +function _deep_replace($search, $subject) { |
|
| 441 | 441 | $subject = (string) $subject; |
| 442 | 442 | |
| 443 | 443 | $count = 1; |
| 444 | - while ( $count ) { |
|
| 445 | - $subject = str_replace( $search, '', $subject, $count ); |
|
| 444 | + while ($count) { |
|
| 445 | + $subject = str_replace($search, '', $subject, $count); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | return $subject; |
@@ -464,17 +464,17 @@ discard block |
||
| 464 | 464 | function _make_web_ftp_clickable_cb($matches) { |
| 465 | 465 | $ret = ''; |
| 466 | 466 | $dest = $matches[2]; |
| 467 | - $dest = 'http://' . $dest; |
|
| 467 | + $dest = 'http://'.$dest; |
|
| 468 | 468 | $dest = esc_url($dest); |
| 469 | - if ( empty($dest) ) |
|
| 469 | + if (empty($dest)) |
|
| 470 | 470 | return $matches[0]; |
| 471 | 471 | |
| 472 | 472 | // removed trailing [.,;:)] from URL |
| 473 | - if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) { |
|
| 473 | + if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) { |
|
| 474 | 474 | $ret = substr($dest, -1); |
| 475 | - $dest = substr($dest, 0, strlen($dest)-1); |
|
| 475 | + $dest = substr($dest, 0, strlen($dest) - 1); |
|
| 476 | 476 | } |
| 477 | - return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret"; |
|
| 477 | + return $matches[1]."<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret"; |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | /** |
@@ -490,8 +490,8 @@ discard block |
||
| 490 | 490 | * @return string HTML A element with email address. |
| 491 | 491 | */ |
| 492 | 492 | function _make_email_clickable_cb($matches) { |
| 493 | - $email = $matches[2] . '@' . $matches[3]; |
|
| 494 | - return $matches[1] . "<a href=\"mailto:$email\">$email</a>"; |
|
| 493 | + $email = $matches[2].'@'.$matches[3]; |
|
| 494 | + return $matches[1]."<a href=\"mailto:$email\">$email</a>"; |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | /** |
@@ -505,30 +505,30 @@ discard block |
||
| 505 | 505 | * @param string $text Content to convert URIs. |
| 506 | 506 | * @return string Content with converted URIs. |
| 507 | 507 | */ |
| 508 | -function make_clickable( $text ) { |
|
| 508 | +function make_clickable($text) { |
|
| 509 | 509 | $r = ''; |
| 510 | - $textarr = preg_split( '/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // split out HTML tags |
|
| 510 | + $textarr = preg_split('/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // split out HTML tags |
|
| 511 | 511 | $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code> |
| 512 | - foreach ( $textarr as $piece ) { |
|
| 512 | + foreach ($textarr as $piece) { |
|
| 513 | 513 | |
| 514 | - if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) |
|
| 514 | + if (preg_match('|^<code[\s>]|i', $piece) || preg_match('|^<pre[\s>]|i', $piece)) |
|
| 515 | 515 | $nested_code_pre++; |
| 516 | - elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) |
|
| 516 | + elseif (('</code>' === strtolower($piece) || '</pre>' === strtolower($piece)) && $nested_code_pre) |
|
| 517 | 517 | $nested_code_pre--; |
| 518 | 518 | |
| 519 | - if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) { |
|
| 519 | + if ($nested_code_pre || empty($piece) || ($piece[0] === '<' && !preg_match('|^<\s*[\w]{1,20}+://|', $piece))) { |
|
| 520 | 520 | $r .= $piece; |
| 521 | 521 | continue; |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | // Long strings might contain expensive edge cases ... |
| 525 | - if ( 10000 < strlen( $piece ) ) { |
|
| 525 | + if (10000 < strlen($piece)) { |
|
| 526 | 526 | // ... break it up |
| 527 | - foreach ( _split_str_by_whitespace( $piece, 2100 ) as $chunk ) { // 2100: Extra room for scheme and leading and trailing paretheses |
|
| 528 | - if ( 2101 < strlen( $chunk ) ) { |
|
| 527 | + foreach (_split_str_by_whitespace($piece, 2100) as $chunk) { // 2100: Extra room for scheme and leading and trailing paretheses |
|
| 528 | + if (2101 < strlen($chunk)) { |
|
| 529 | 529 | $r .= $chunk; // Too big, no whitespace: bail. |
| 530 | 530 | } else { |
| 531 | - $r .= make_clickable( $chunk ); |
|
| 531 | + $r .= make_clickable($chunk); |
|
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | } else { |
@@ -549,18 +549,18 @@ discard block |
||
| 549 | 549 | ~xS'; // The regex is a non-anchored pattern and does not have a single fixed starting character. |
| 550 | 550 | // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times. |
| 551 | 551 | |
| 552 | - $ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret ); |
|
| 552 | + $ret = preg_replace_callback($url_clickable, '_make_url_clickable_cb', $ret); |
|
| 553 | 553 | |
| 554 | - $ret = preg_replace_callback( '#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret ); |
|
| 555 | - $ret = preg_replace_callback( '#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret ); |
|
| 554 | + $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret); |
|
| 555 | + $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret); |
|
| 556 | 556 | |
| 557 | - $ret = substr( $ret, 1, -1 ); // Remove our whitespace padding. |
|
| 557 | + $ret = substr($ret, 1, -1); // Remove our whitespace padding. |
|
| 558 | 558 | $r .= $ret; |
| 559 | 559 | } |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | // Cleanup of accidental links within links |
| 563 | - $r = preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r ); |
|
| 563 | + $r = preg_replace('#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r); |
|
| 564 | 564 | return $r; |
| 565 | 565 | } |
| 566 | 566 | |
@@ -595,27 +595,27 @@ discard block |
||
| 595 | 595 | * @param int $goal The desired chunk length. |
| 596 | 596 | * @return array Numeric array of chunks. |
| 597 | 597 | */ |
| 598 | -function _split_str_by_whitespace( $string, $goal ) { |
|
| 598 | +function _split_str_by_whitespace($string, $goal) { |
|
| 599 | 599 | $chunks = array(); |
| 600 | 600 | |
| 601 | - $string_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" ); |
|
| 601 | + $string_nullspace = strtr($string, "\r\n\t\v\f ", "\000\000\000\000\000\000"); |
|
| 602 | 602 | |
| 603 | - while ( $goal < strlen( $string_nullspace ) ) { |
|
| 604 | - $pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" ); |
|
| 603 | + while ($goal < strlen($string_nullspace)) { |
|
| 604 | + $pos = strrpos(substr($string_nullspace, 0, $goal + 1), "\000"); |
|
| 605 | 605 | |
| 606 | - if ( false === $pos ) { |
|
| 607 | - $pos = strpos( $string_nullspace, "\000", $goal + 1 ); |
|
| 608 | - if ( false === $pos ) { |
|
| 606 | + if (false === $pos) { |
|
| 607 | + $pos = strpos($string_nullspace, "\000", $goal + 1); |
|
| 608 | + if (false === $pos) { |
|
| 609 | 609 | break; |
| 610 | 610 | } |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | - $chunks[] = substr( $string, 0, $pos + 1 ); |
|
| 614 | - $string = substr( $string, $pos + 1 ); |
|
| 615 | - $string_nullspace = substr( $string_nullspace, $pos + 1 ); |
|
| 613 | + $chunks[] = substr($string, 0, $pos + 1); |
|
| 614 | + $string = substr($string, $pos + 1); |
|
| 615 | + $string_nullspace = substr($string_nullspace, $pos + 1); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | - if ( $string ) { |
|
| 618 | + if ($string) { |
|
| 619 | 619 | $chunks[] = $string; |
| 620 | 620 | } |
| 621 | 621 | |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | */ |
| 694 | 694 | function get_week_from_day($date) { |
| 695 | 695 | if (!empty($date)) { |
| 696 | - $time = api_strtotime($date,'UTC'); |
|
| 696 | + $time = api_strtotime($date, 'UTC'); |
|
| 697 | 697 | return date('W', $time); |
| 698 | 698 | } else { |
| 699 | 699 | return date('W'); |
@@ -710,17 +710,17 @@ discard block |
||
| 710 | 710 | * @return a reduce string |
| 711 | 711 | */ |
| 712 | 712 | |
| 713 | -function substrwords($text,$maxchar,$end='...') |
|
| 713 | +function substrwords($text, $maxchar, $end = '...') |
|
| 714 | 714 | { |
| 715 | - if(strlen($text)>$maxchar) |
|
| 715 | + if (strlen($text) > $maxchar) |
|
| 716 | 716 | { |
| 717 | - $words=explode(" ",$text); |
|
| 717 | + $words = explode(" ", $text); |
|
| 718 | 718 | $output = ''; |
| 719 | - $i=0; |
|
| 720 | - while(1) |
|
| 719 | + $i = 0; |
|
| 720 | + while (1) |
|
| 721 | 721 | { |
| 722 | - $length = (strlen($output)+strlen($words[$i])); |
|
| 723 | - if($length>$maxchar) |
|
| 722 | + $length = (strlen($output) + strlen($words[$i])); |
|
| 723 | + if ($length > $maxchar) |
|
| 724 | 724 | { |
| 725 | 725 | break; |
| 726 | 726 | } |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | function implode_with_key($glue, $array) { |
| 743 | 743 | if (!empty($array)) { |
| 744 | 744 | $string = ''; |
| 745 | - foreach($array as $key => $value) { |
|
| 745 | + foreach ($array as $key => $value) { |
|
| 746 | 746 | if (empty($value)) { |
| 747 | 747 | $value = 'null'; |
| 748 | 748 | } |
@@ -764,13 +764,13 @@ discard block |
||
| 764 | 764 | { |
| 765 | 765 | $file_size = intval($file_size); |
| 766 | 766 | if ($file_size >= 1073741824) { |
| 767 | - $file_size = round($file_size / 1073741824 * 100) / 100 . 'G'; |
|
| 768 | - } elseif($file_size >= 1048576) { |
|
| 769 | - $file_size = round($file_size / 1048576 * 100) / 100 . 'M'; |
|
| 770 | - } elseif($file_size >= 1024) { |
|
| 771 | - $file_size = round($file_size / 1024 * 100) / 100 . 'k'; |
|
| 767 | + $file_size = round($file_size / 1073741824 * 100) / 100.'G'; |
|
| 768 | + } elseif ($file_size >= 1048576) { |
|
| 769 | + $file_size = round($file_size / 1048576 * 100) / 100.'M'; |
|
| 770 | + } elseif ($file_size >= 1024) { |
|
| 771 | + $file_size = round($file_size / 1024 * 100) / 100.'k'; |
|
| 772 | 772 | } else { |
| 773 | - $file_size = $file_size . 'B'; |
|
| 773 | + $file_size = $file_size.'B'; |
|
| 774 | 774 | } |
| 775 | 775 | return $file_size; |
| 776 | 776 | } |
@@ -779,18 +779,18 @@ discard block |
||
| 779 | 779 | { |
| 780 | 780 | $year = '0000'; |
| 781 | 781 | $month = $day = $hours = $minutes = $seconds = '00'; |
| 782 | - if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) { |
|
| 782 | + if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) { |
|
| 783 | 783 | $year = $array['Y']; |
| 784 | - $month = isset($array['F'])?$array['F']:$array['M']; |
|
| 785 | - if (intval($month) < 10 ) $month = '0'.$month; |
|
| 784 | + $month = isset($array['F']) ? $array['F'] : $array['M']; |
|
| 785 | + if (intval($month) < 10) $month = '0'.$month; |
|
| 786 | 786 | $day = $array['d']; |
| 787 | - if (intval($day) < 10 ) $day = '0'.$day; |
|
| 787 | + if (intval($day) < 10) $day = '0'.$day; |
|
| 788 | 788 | $hours = $array['H']; |
| 789 | - if (intval($hours) < 10 ) $hours = '0'.$hours; |
|
| 789 | + if (intval($hours) < 10) $hours = '0'.$hours; |
|
| 790 | 790 | $minutes = $array['i']; |
| 791 | - if (intval($minutes) < 10 ) $minutes = '0'.$minutes; |
|
| 791 | + if (intval($minutes) < 10) $minutes = '0'.$minutes; |
|
| 792 | 792 | } |
| 793 | - if (checkdate($month,$day,$year)) { |
|
| 793 | + if (checkdate($month, $day, $year)) { |
|
| 794 | 794 | $datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds; |
| 795 | 795 | } |
| 796 | 796 | return $datetime; |
@@ -351,8 +351,9 @@ discard block |
||
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | $url = esc_url($url); |
| 354 | - if ( empty($url) ) |
|
| 355 | - return $matches[0]; |
|
| 354 | + if ( empty($url) ) { |
|
| 355 | + return $matches[0]; |
|
| 356 | + } |
|
| 356 | 357 | |
| 357 | 358 | return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix; |
| 358 | 359 | } |
@@ -377,8 +378,9 @@ discard block |
||
| 377 | 378 | function esc_url( $url, $protocols = null, $_context = 'display' ) { |
| 378 | 379 | //$original_url = $url; |
| 379 | 380 | |
| 380 | - if ( '' == $url ) |
|
| 381 | - return $url; |
|
| 381 | + if ( '' == $url ) { |
|
| 382 | + return $url; |
|
| 383 | + } |
|
| 382 | 384 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url); |
| 383 | 385 | $strip = array('%0d', '%0a', '%0D', '%0A'); |
| 384 | 386 | $url = _deep_replace($strip, $url); |
@@ -388,8 +390,9 @@ discard block |
||
| 388 | 390 | * link starting with /, # or ? or a php file). |
| 389 | 391 | */ |
| 390 | 392 | if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) && |
| 391 | - ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) |
|
| 392 | - $url = 'http://' . $url; |
|
| 393 | + ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) { |
|
| 394 | + $url = 'http://' . $url; |
|
| 395 | + } |
|
| 393 | 396 | |
| 394 | 397 | return Security::remove_XSS($url); |
| 395 | 398 | |
@@ -466,8 +469,9 @@ discard block |
||
| 466 | 469 | $dest = $matches[2]; |
| 467 | 470 | $dest = 'http://' . $dest; |
| 468 | 471 | $dest = esc_url($dest); |
| 469 | - if ( empty($dest) ) |
|
| 470 | - return $matches[0]; |
|
| 472 | + if ( empty($dest) ) { |
|
| 473 | + return $matches[0]; |
|
| 474 | + } |
|
| 471 | 475 | |
| 472 | 476 | // removed trailing [.,;:)] from URL |
| 473 | 477 | if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) { |
@@ -511,10 +515,11 @@ discard block |
||
| 511 | 515 | $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code> |
| 512 | 516 | foreach ( $textarr as $piece ) { |
| 513 | 517 | |
| 514 | - if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) |
|
| 515 | - $nested_code_pre++; |
|
| 516 | - elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) |
|
| 517 | - $nested_code_pre--; |
|
| 518 | + if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) { |
|
| 519 | + $nested_code_pre++; |
|
| 520 | + } elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) { |
|
| 521 | + $nested_code_pre--; |
|
| 522 | + } |
|
| 518 | 523 | |
| 519 | 524 | if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) { |
| 520 | 525 | $r .= $piece; |
@@ -723,15 +728,13 @@ discard block |
||
| 723 | 728 | if($length>$maxchar) |
| 724 | 729 | { |
| 725 | 730 | break; |
| 726 | - } |
|
| 727 | - else |
|
| 731 | + } else |
|
| 728 | 732 | { |
| 729 | 733 | $output = $output." ".$words[$i]; |
| 730 | 734 | $i++; |
| 731 | 735 | }; |
| 732 | 736 | }; |
| 733 | - } |
|
| 734 | - else |
|
| 737 | + } else |
|
| 735 | 738 | { |
| 736 | 739 | $output = $text; |
| 737 | 740 | return $output; |
@@ -782,13 +785,21 @@ discard block |
||
| 782 | 785 | if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) { |
| 783 | 786 | $year = $array['Y']; |
| 784 | 787 | $month = isset($array['F'])?$array['F']:$array['M']; |
| 785 | - if (intval($month) < 10 ) $month = '0'.$month; |
|
| 788 | + if (intval($month) < 10 ) { |
|
| 789 | + $month = '0'.$month; |
|
| 790 | + } |
|
| 786 | 791 | $day = $array['d']; |
| 787 | - if (intval($day) < 10 ) $day = '0'.$day; |
|
| 792 | + if (intval($day) < 10 ) { |
|
| 793 | + $day = '0'.$day; |
|
| 794 | + } |
|
| 788 | 795 | $hours = $array['H']; |
| 789 | - if (intval($hours) < 10 ) $hours = '0'.$hours; |
|
| 796 | + if (intval($hours) < 10 ) { |
|
| 797 | + $hours = '0'.$hours; |
|
| 798 | + } |
|
| 790 | 799 | $minutes = $array['i']; |
| 791 | - if (intval($minutes) < 10 ) $minutes = '0'.$minutes; |
|
| 800 | + if (intval($minutes) < 10 ) { |
|
| 801 | + $minutes = '0'.$minutes; |
|
| 802 | + } |
|
| 792 | 803 | } |
| 793 | 804 | if (checkdate($month,$day,$year)) { |
| 794 | 805 | $datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds; |
@@ -693,8 +693,8 @@ discard block |
||
| 693 | 693 | */ |
| 694 | 694 | function get_week_from_day($date) { |
| 695 | 695 | if (!empty($date)) { |
| 696 | - $time = api_strtotime($date,'UTC'); |
|
| 697 | - return date('W', $time); |
|
| 696 | + $time = api_strtotime($date,'UTC'); |
|
| 697 | + return date('W', $time); |
|
| 698 | 698 | } else { |
| 699 | 699 | return date('W'); |
| 700 | 700 | } |
@@ -712,31 +712,31 @@ discard block |
||
| 712 | 712 | |
| 713 | 713 | function substrwords($text,$maxchar,$end='...') |
| 714 | 714 | { |
| 715 | - if(strlen($text)>$maxchar) |
|
| 716 | - { |
|
| 717 | - $words=explode(" ",$text); |
|
| 718 | - $output = ''; |
|
| 719 | - $i=0; |
|
| 720 | - while(1) |
|
| 721 | - { |
|
| 722 | - $length = (strlen($output)+strlen($words[$i])); |
|
| 723 | - if($length>$maxchar) |
|
| 724 | - { |
|
| 725 | - break; |
|
| 726 | - } |
|
| 727 | - else |
|
| 728 | - { |
|
| 729 | - $output = $output." ".$words[$i]; |
|
| 730 | - $i++; |
|
| 731 | - }; |
|
| 732 | - }; |
|
| 733 | - } |
|
| 734 | - else |
|
| 735 | - { |
|
| 736 | - $output = $text; |
|
| 737 | - return $output; |
|
| 738 | - } |
|
| 739 | - return $output.$end; |
|
| 715 | + if(strlen($text)>$maxchar) |
|
| 716 | + { |
|
| 717 | + $words=explode(" ",$text); |
|
| 718 | + $output = ''; |
|
| 719 | + $i=0; |
|
| 720 | + while(1) |
|
| 721 | + { |
|
| 722 | + $length = (strlen($output)+strlen($words[$i])); |
|
| 723 | + if($length>$maxchar) |
|
| 724 | + { |
|
| 725 | + break; |
|
| 726 | + } |
|
| 727 | + else |
|
| 728 | + { |
|
| 729 | + $output = $output." ".$words[$i]; |
|
| 730 | + $i++; |
|
| 731 | + }; |
|
| 732 | + }; |
|
| 733 | + } |
|
| 734 | + else |
|
| 735 | + { |
|
| 736 | + $output = $text; |
|
| 737 | + return $output; |
|
| 738 | + } |
|
| 739 | + return $output.$end; |
|
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | function implode_with_key($glue, $array) { |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | * @todo the form should be auto generated |
| 74 | 74 | * @param string url |
| 75 | 75 | * @param string action add, edit |
| 76 | - * @return obj form validator obj |
|
| 76 | + * @return FormValidator form validator obj |
|
| 77 | 77 | */ |
| 78 | 78 | public function return_form($url, $action) |
| 79 | 79 | { |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | ); |
| 26 | 26 | public $is_course_model = true; |
| 27 | 27 | |
| 28 | - public function __construct() |
|
| 28 | + public function __construct() |
|
| 29 | 29 | { |
| 30 | 30 | $this->table = Database::get_course_table(TABLE_TIMELINE); |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Get the count of elements |
@@ -52,16 +52,16 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * Displays the title + grid |
| 54 | 54 | */ |
| 55 | - public function listing() |
|
| 55 | + public function listing() |
|
| 56 | 56 | { |
| 57 | - // action links |
|
| 58 | - $html = '<div class="actions">'; |
|
| 57 | + // action links |
|
| 58 | + $html = '<div class="actions">'; |
|
| 59 | 59 | //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
| 60 | - $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
| 61 | - $html .= '</div>'; |
|
| 60 | + $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
| 61 | + $html .= '</div>'; |
|
| 62 | 62 | $html .= Display::grid_html('timelines'); |
| 63 | 63 | return $html; |
| 64 | - } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | 66 | public function get_status_list() |
| 67 | 67 | { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $form->addElement('text', 'headline', get_lang('Name'), array('size' => '70')); |
| 91 | 91 | //$form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Careers','Width' => '100%', 'Height' => '250')); |
| 92 | - $status_list = $this->get_status_list(); |
|
| 92 | + $status_list = $this->get_status_list(); |
|
| 93 | 93 | $form->addElement('select', 'status', get_lang('Status'), $status_list); |
| 94 | 94 | if ($action == 'edit') { |
| 95 | 95 | //$form->addElement('text', 'created_at', get_lang('CreatedAt')); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | // Setting the rules |
| 175 | 175 | $form->addRule('headline', get_lang('ThisFieldIsRequired'), 'required'); |
| 176 | - return $form; |
|
| 176 | + return $form; |
|
| 177 | 177 | |
| 178 | 178 | } |
| 179 | 179 | |
@@ -184,11 +184,11 @@ discard block |
||
| 184 | 184 | public function save_item($params) |
| 185 | 185 | { |
| 186 | 186 | $params['c_id'] = api_get_course_int_id(); |
| 187 | - $id = parent::save($params); |
|
| 188 | - if (!empty($id)) { |
|
| 189 | - //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
| 190 | - } |
|
| 191 | - return $id; |
|
| 187 | + $id = parent::save($params); |
|
| 188 | + if (!empty($id)) { |
|
| 189 | + //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
| 190 | + } |
|
| 191 | + return $id; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -199,16 +199,16 @@ discard block |
||
| 199 | 199 | $params['c_id'] = api_get_course_int_id(); |
| 200 | 200 | $params['parent_id'] = '0'; |
| 201 | 201 | $params['type'] = 'default'; |
| 202 | - $id = parent::save($params); |
|
| 203 | - if (!empty($id)) { |
|
| 204 | - //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
| 205 | - } |
|
| 206 | - return $id; |
|
| 202 | + $id = parent::save($params); |
|
| 203 | + if (!empty($id)) { |
|
| 204 | + //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
| 205 | + } |
|
| 206 | + return $id; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | public function delete($id) { |
| 210 | - parent::delete($id); |
|
| 211 | - //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
| 210 | + parent::delete($id); |
|
| 211 | + //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | public function get_url($id) { |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $item['asset'] = array( 'media' => $item['media'], |
| 248 | 248 | 'credit' => $item['media_credit'], |
| 249 | 249 | 'caption' => $item['media_caption'], |
| 250 | - ); |
|
| 250 | + ); |
|
| 251 | 251 | |
| 252 | 252 | //Cleaning items |
| 253 | 253 | unset($item['id']); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public function __construct() |
| 29 | 29 | { |
| 30 | - $this->table = Database::get_course_table(TABLE_TIMELINE); |
|
| 30 | + $this->table = Database::get_course_table(TABLE_TIMELINE); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function get_all($where_conditions = array()) |
| 48 | 48 | { |
| 49 | - return Database::select('*',$this->table, array('where'=>$where_conditions,'order' =>'headline ASC')); |
|
| 49 | + return Database::select('*', $this->table, array('where'=>$where_conditions, 'order' =>'headline ASC')); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | // action links |
| 58 | 58 | $html = '<div class="actions">'; |
| 59 | 59 | //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
| 60 | - $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
| 60 | + $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', '32').'</a>'; |
|
| 61 | 61 | $html .= '</div>'; |
| 62 | 62 | $html .= Display::grid_html('timelines'); |
| 63 | 63 | return $html; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | unset($item['end_date']); |
| 246 | 246 | // Assets |
| 247 | - $item['asset'] = array( 'media' => $item['media'], |
|
| 247 | + $item['asset'] = array('media' => $item['media'], |
|
| 248 | 248 | 'credit' => $item['media_credit'], |
| 249 | 249 | 'caption' => $item['media_caption'], |
| 250 | 250 | ); |
@@ -1287,6 +1287,8 @@ discard block |
||
| 1287 | 1287 | * @param string type of time filter: 'last_week' or 'custom' |
| 1288 | 1288 | * @param string start date date('Y-m-d H:i:s') |
| 1289 | 1289 | * @param string end date date('Y-m-d H:i:s') |
| 1290 | + * @param string $start_date |
|
| 1291 | + * @param string $end_date |
|
| 1290 | 1292 | * @return timestamp $nb_seconds |
| 1291 | 1293 | */ |
| 1292 | 1294 | public static function get_time_spent_on_the_platform( |
@@ -1390,7 +1392,7 @@ discard block |
||
| 1390 | 1392 | * Get first connection date for a student |
| 1391 | 1393 | * @param int $student_id |
| 1392 | 1394 | * |
| 1393 | - * @return string|bool Date format long without day or false if there are no connections |
|
| 1395 | + * @return string|false Date format long without day or false if there are no connections |
|
| 1394 | 1396 | */ |
| 1395 | 1397 | public static function get_first_connection_date($student_id) |
| 1396 | 1398 | { |
@@ -1420,7 +1422,7 @@ discard block |
||
| 1420 | 1422 | * @param int $student_id |
| 1421 | 1423 | * @param bool $warning_message Show a warning message (optional) |
| 1422 | 1424 | * @param bool $return_timestamp True for returning results in timestamp (optional) |
| 1423 | - * @return string|int|bool Date format long without day, false if there are no connections or |
|
| 1425 | + * @return string Date format long without day, false if there are no connections or |
|
| 1424 | 1426 | * timestamp if parameter $return_timestamp is true |
| 1425 | 1427 | */ |
| 1426 | 1428 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
@@ -2667,6 +2669,9 @@ discard block |
||
| 2667 | 2669 | * @param array Limit average to listed lp ids |
| 2668 | 2670 | * @param int Session id (optional), if param $session_id is |
| 2669 | 2671 | * null(default) it'll return results including sessions, 0 = session is not filtered |
| 2672 | + * @param integer $student_id |
|
| 2673 | + * @param string $course_code |
|
| 2674 | + * @param integer $session_id |
|
| 2670 | 2675 | * @return int Total time |
| 2671 | 2676 | */ |
| 2672 | 2677 | public static function get_time_spent_in_lp($student_id, $course_code, $lp_ids = array(), $session_id = null) |
@@ -2733,6 +2738,8 @@ discard block |
||
| 2733 | 2738 | * @param int|array Student id(s) |
| 2734 | 2739 | * @param string Course code |
| 2735 | 2740 | * @param int Learning path id |
| 2741 | + * @param integer $student_id |
|
| 2742 | + * @param string $course_code |
|
| 2736 | 2743 | * @return int Total time |
| 2737 | 2744 | */ |
| 2738 | 2745 | public static function get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id = 0) |
@@ -5400,7 +5407,7 @@ discard block |
||
| 5400 | 5407 | |
| 5401 | 5408 | /** |
| 5402 | 5409 | * @param FormValidator $form |
| 5403 | - * @return mixed |
|
| 5410 | + * @return FormValidator |
|
| 5404 | 5411 | */ |
| 5405 | 5412 | public static function setUserSearchForm($form) |
| 5406 | 5413 | { |
@@ -5439,7 +5446,6 @@ discard block |
||
| 5439 | 5446 | * @param int $sessionId The session ID (session.id) |
| 5440 | 5447 | * @param int $courseId The course ID (course.id) |
| 5441 | 5448 | * @param int $exerciseId The quiz ID (c_quiz.id) |
| 5442 | - * @param int $answer The answer status (0 = incorrect, 1 = correct, 2 = both) |
|
| 5443 | 5449 | * @param array $options An array of options you can pass to the query (limit, where and order) |
| 5444 | 5450 | * @return array An array with the data of exercise(s) progress |
| 5445 | 5451 | */ |
@@ -6876,7 +6882,7 @@ discard block |
||
| 6876 | 6882 | * @param int $user_id |
| 6877 | 6883 | * @param int $course_id |
| 6878 | 6884 | * @param int $session_id |
| 6879 | - * @return array |
|
| 6885 | + * @return string[] |
|
| 6880 | 6886 | */ |
| 6881 | 6887 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
| 6882 | 6888 | { |
@@ -6922,9 +6928,9 @@ discard block |
||
| 6922 | 6928 | /** |
| 6923 | 6929 | * Displays the exercise results for a specific user in a specific course. |
| 6924 | 6930 | * @param string $view |
| 6925 | - * @param int $user_id User ID |
|
| 6931 | + * @param int $userId User ID |
|
| 6926 | 6932 | * @param string $courseCode Course code |
| 6927 | - * @return array |
|
| 6933 | + * @return string[] |
|
| 6928 | 6934 | * @todo remove globals |
| 6929 | 6935 | */ |
| 6930 | 6936 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
@@ -2259,7 +2259,9 @@ discard block |
||
| 2259 | 2259 | $debug = false; |
| 2260 | 2260 | } |
| 2261 | 2261 | |
| 2262 | - if ($debug) echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
| 2262 | + if ($debug) { |
|
| 2263 | + echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
| 2264 | + } |
|
| 2263 | 2265 | $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
| 2264 | 2266 | $tbl_stats_attempts = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
| 2265 | 2267 | |
@@ -2336,7 +2338,9 @@ discard block |
||
| 2336 | 2338 | $condition_user1 AND |
| 2337 | 2339 | session_id = $session_id |
| 2338 | 2340 | GROUP BY lp_id, user_id"; |
| 2339 | - if ($debug) echo $sql; |
|
| 2341 | + if ($debug) { |
|
| 2342 | + echo $sql; |
|
| 2343 | + } |
|
| 2340 | 2344 | |
| 2341 | 2345 | $rs_last_lp_view_id = Database::query($sql); |
| 2342 | 2346 | |
@@ -2352,7 +2356,9 @@ discard block |
||
| 2352 | 2356 | $lp_view_id = $row_lp_view['id']; |
| 2353 | 2357 | $lp_id = $row_lp_view['lp_id']; |
| 2354 | 2358 | $user_id = $row_lp_view['user_id']; |
| 2355 | - if ($debug) echo '<h2>LP id '.$lp_id.'</h2>'; |
|
| 2359 | + if ($debug) { |
|
| 2360 | + echo '<h2>LP id '.$lp_id.'</h2>'; |
|
| 2361 | + } |
|
| 2356 | 2362 | |
| 2357 | 2363 | if ($get_only_latest_attempt_results) { |
| 2358 | 2364 | //Getting lp_items done by the user |
@@ -2409,7 +2415,9 @@ discard block |
||
| 2409 | 2415 | lp_i.c_id = $course_id AND |
| 2410 | 2416 | (lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."') |
| 2411 | 2417 | WHERE lp_view_id = $lp_view_id "; |
| 2412 | - if ($debug) echo $sql.'<br />'; |
|
| 2418 | + if ($debug) { |
|
| 2419 | + echo $sql.'<br />'; |
|
| 2420 | + } |
|
| 2413 | 2421 | $res_max_score = Database::query($sql); |
| 2414 | 2422 | |
| 2415 | 2423 | while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
@@ -2428,7 +2436,9 @@ discard block |
||
| 2428 | 2436 | $max_score_item_view = $row_max_score['max_score_item_view']; |
| 2429 | 2437 | $score = $row_max_score['score']; |
| 2430 | 2438 | |
| 2431 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
| 2439 | + if ($debug) { |
|
| 2440 | + echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
| 2441 | + } |
|
| 2432 | 2442 | |
| 2433 | 2443 | if ($row_max_score['item_type'] == 'sco') { |
| 2434 | 2444 | /* Check if it is sco (easier to get max_score) |
@@ -2448,7 +2458,9 @@ discard block |
||
| 2448 | 2458 | if (!empty($max_score)) { |
| 2449 | 2459 | $lp_partial_total += $score/$max_score; |
| 2450 | 2460 | } |
| 2451 | - if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
| 2461 | + if ($debug) { |
|
| 2462 | + echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
| 2463 | + } |
|
| 2452 | 2464 | } else { |
| 2453 | 2465 | // Case of a TOOL_QUIZ element |
| 2454 | 2466 | $item_id = $row_max_score['iid']; |
@@ -2470,12 +2482,16 @@ discard block |
||
| 2470 | 2482 | ORDER BY exe_date DESC |
| 2471 | 2483 | LIMIT 1"; |
| 2472 | 2484 | |
| 2473 | - if ($debug) echo $sql .'<br />'; |
|
| 2485 | + if ($debug) { |
|
| 2486 | + echo $sql .'<br />'; |
|
| 2487 | + } |
|
| 2474 | 2488 | $result_last_attempt = Database::query($sql); |
| 2475 | 2489 | $num = Database :: num_rows($result_last_attempt); |
| 2476 | 2490 | if ($num > 0 ) { |
| 2477 | 2491 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
| 2478 | - if ($debug) echo $id_last_attempt.'<br />'; |
|
| 2492 | + if ($debug) { |
|
| 2493 | + echo $id_last_attempt.'<br />'; |
|
| 2494 | + } |
|
| 2479 | 2495 | |
| 2480 | 2496 | // Within the last attempt number tracking, get the sum of |
| 2481 | 2497 | // the max_scores of all questions that it was |
@@ -2494,7 +2510,9 @@ discard block |
||
| 2494 | 2510 | q.c_id = $course_id |
| 2495 | 2511 | ) |
| 2496 | 2512 | AS t"; |
| 2497 | - if ($debug) echo '$sql: '.$sql.' <br />'; |
|
| 2513 | + if ($debug) { |
|
| 2514 | + echo '$sql: '.$sql.' <br />'; |
|
| 2515 | + } |
|
| 2498 | 2516 | $res_max_score_bis = Database::query($sql); |
| 2499 | 2517 | $row_max_score_bis = Database::fetch_array($res_max_score_bis); |
| 2500 | 2518 | |
@@ -2504,7 +2522,9 @@ discard block |
||
| 2504 | 2522 | if (!empty($max_score) && floatval($max_score) > 0) { |
| 2505 | 2523 | $lp_partial_total += $score/$max_score; |
| 2506 | 2524 | } |
| 2507 | - if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
| 2525 | + if ($debug) { |
|
| 2526 | + echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
| 2527 | + } |
|
| 2508 | 2528 | } |
| 2509 | 2529 | } |
| 2510 | 2530 | |
@@ -2517,17 +2537,25 @@ discard block |
||
| 2517 | 2537 | $count_items++; |
| 2518 | 2538 | } |
| 2519 | 2539 | } |
| 2520 | - if ($debug) echo '$count_items: '.$count_items; |
|
| 2540 | + if ($debug) { |
|
| 2541 | + echo '$count_items: '.$count_items; |
|
| 2542 | + } |
|
| 2521 | 2543 | } |
| 2522 | 2544 | } //end for |
| 2523 | 2545 | |
| 2524 | 2546 | $score_of_scorm_calculate += $count_items ? (($lp_partial_total / $count_items) * 100) : 0; |
| 2525 | 2547 | |
| 2526 | - if ($debug) echo '<h3>$count_items '.$count_items.'</h3>'; |
|
| 2527 | - if ($debug) echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
| 2548 | + if ($debug) { |
|
| 2549 | + echo '<h3>$count_items '.$count_items.'</h3>'; |
|
| 2550 | + } |
|
| 2551 | + if ($debug) { |
|
| 2552 | + echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
| 2553 | + } |
|
| 2528 | 2554 | |
| 2529 | 2555 | $global_result += $score_of_scorm_calculate; |
| 2530 | - if ($debug) echo '<h3>$global_result '.$global_result.'</h3>'; |
|
| 2556 | + if ($debug) { |
|
| 2557 | + echo '<h3>$global_result '.$global_result.'</h3>'; |
|
| 2558 | + } |
|
| 2531 | 2559 | } // end while |
| 2532 | 2560 | } |
| 2533 | 2561 | |
@@ -2540,7 +2568,9 @@ discard block |
||
| 2540 | 2568 | c_id = $course_id AND |
| 2541 | 2569 | (item_type = 'quiz' OR item_type = 'sco') AND |
| 2542 | 2570 | lp_id = ".$lp_id; |
| 2543 | - if ($debug) echo $sql; |
|
| 2571 | + if ($debug) { |
|
| 2572 | + echo $sql; |
|
| 2573 | + } |
|
| 2544 | 2574 | $result_have_quiz = Database::query($sql); |
| 2545 | 2575 | |
| 2546 | 2576 | if (Database::num_rows($result_have_quiz) > 0 ) { |
@@ -2551,19 +2581,29 @@ discard block |
||
| 2551 | 2581 | } |
| 2552 | 2582 | } |
| 2553 | 2583 | |
| 2554 | - if ($debug) echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
| 2555 | - if ($debug) echo '<h3>Final return</h3>'; |
|
| 2584 | + if ($debug) { |
|
| 2585 | + echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
| 2586 | + } |
|
| 2587 | + if ($debug) { |
|
| 2588 | + echo '<h3>Final return</h3>'; |
|
| 2589 | + } |
|
| 2556 | 2590 | |
| 2557 | 2591 | if ($lp_with_quiz != 0) { |
| 2558 | 2592 | if (!$return_array) { |
| 2559 | 2593 | $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
| 2560 | - if ($debug) var_dump($score_of_scorm_calculate); |
|
| 2594 | + if ($debug) { |
|
| 2595 | + var_dump($score_of_scorm_calculate); |
|
| 2596 | + } |
|
| 2561 | 2597 | if (empty($lp_ids)) { |
| 2562 | - if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
| 2598 | + if ($debug) { |
|
| 2599 | + echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
| 2600 | + } |
|
| 2563 | 2601 | } |
| 2564 | 2602 | return $score_of_scorm_calculate; |
| 2565 | 2603 | } else { |
| 2566 | - if ($debug) var_dump($global_result, $lp_with_quiz); |
|
| 2604 | + if ($debug) { |
|
| 2605 | + var_dump($global_result, $lp_with_quiz); |
|
| 2606 | + } |
|
| 2567 | 2607 | return array($global_result, $lp_with_quiz); |
| 2568 | 2608 | } |
| 2569 | 2609 | } else { |
@@ -3050,11 +3090,13 @@ discard block |
||
| 3050 | 3090 | |
| 3051 | 3091 | if (!empty ($id_session)) { |
| 3052 | 3092 | $sql .= ' WHERE session_course.session_id=' . $id_session; |
| 3053 | - if (api_is_multiple_url_enabled()) |
|
| 3054 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
| 3055 | - } else { |
|
| 3056 | - if (api_is_multiple_url_enabled()) |
|
| 3057 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
| 3093 | + if (api_is_multiple_url_enabled()) { |
|
| 3094 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
| 3095 | + } |
|
| 3096 | + } else { |
|
| 3097 | + if (api_is_multiple_url_enabled()) { |
|
| 3098 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
| 3099 | + } |
|
| 3058 | 3100 | } |
| 3059 | 3101 | |
| 3060 | 3102 | $result = Database::query($sql); |
@@ -3162,8 +3204,7 @@ discard block |
||
| 3162 | 3204 | if ($session['access_start_date'] == '0000-00-00 00:00:00' || empty($session['access_start_date']) |
| 3163 | 3205 | ) { |
| 3164 | 3206 | $session['status'] = get_lang('SessionActive'); |
| 3165 | - } |
|
| 3166 | - else { |
|
| 3207 | + } else { |
|
| 3167 | 3208 | $time_start = api_strtotime($session['access_start_date'], 'UTC'); |
| 3168 | 3209 | $time_end = api_strtotime($session['access_end_date'], 'UTC'); |
| 3169 | 3210 | if ($time_start < time() && time() < $time_end) { |
@@ -6599,8 +6640,9 @@ discard block |
||
| 6599 | 6640 | if (is_array($hpresults)) { |
| 6600 | 6641 | for($i = 0; $i < sizeof($hpresults); $i++) { |
| 6601 | 6642 | $title = GetQuizName($hpresults[$i][0],''); |
| 6602 | - if ($title == '') |
|
| 6603 | - $title = basename($hpresults[$i][0]); |
|
| 6643 | + if ($title == '') { |
|
| 6644 | + $title = basename($hpresults[$i][0]); |
|
| 6645 | + } |
|
| 6604 | 6646 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
| 6605 | 6647 | ?> |
| 6606 | 6648 | <tr> |
@@ -6972,8 +7014,9 @@ discard block |
||
| 6972 | 7014 | for($i = 0; $i < sizeof($hpresults); $i++) { |
| 6973 | 7015 | $title = GetQuizName($hpresults[$i][0],''); |
| 6974 | 7016 | |
| 6975 | - if ($title == '') |
|
| 6976 | - $title = basename($hpresults[$i][0]); |
|
| 7017 | + if ($title == '') { |
|
| 7018 | + $title = basename($hpresults[$i][0]); |
|
| 7019 | + } |
|
| 6977 | 7020 | |
| 6978 | 7021 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
| 6979 | 7022 | |
@@ -311,8 +311,8 @@ discard block |
||
| 311 | 311 | $extend_link = ''; |
| 312 | 312 | if (!empty($inter_num)) { |
| 313 | 313 | $extend_link = Display::url( |
| 314 | - Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
| 315 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
| 314 | + Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
| 315 | + api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
| 316 | 316 | ); |
| 317 | 317 | } |
| 318 | 318 | $title = $row['mytitle']; |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | case 'last_30_days': |
| 1320 | 1320 | $new_date = date('Y-m-d H:i:s', strtotime('-30 day')); |
| 1321 | 1321 | $condition_time = ' AND (login_date >= "'.$new_date.'" AND logout_date <= "'.$today.'") '; |
| 1322 | - break; |
|
| 1322 | + break; |
|
| 1323 | 1323 | case 'custom': |
| 1324 | 1324 | if (!empty($start_date) && !empty($end_date)) { |
| 1325 | 1325 | $start_date = Database::escape_string($start_date); |
@@ -1329,10 +1329,10 @@ discard block |
||
| 1329 | 1329 | break; |
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | - $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
| 1332 | + $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
| 1333 | 1333 | FROM '.$tbl_track_login.' |
| 1334 | 1334 | WHERE '.$userCondition.$condition_time; |
| 1335 | - $rs = Database::query($sql); |
|
| 1335 | + $rs = Database::query($sql); |
|
| 1336 | 1336 | $row = Database::fetch_array($rs, 'ASSOC'); |
| 1337 | 1337 | $diff = $row['diff']; |
| 1338 | 1338 | |
@@ -1354,18 +1354,18 @@ discard block |
||
| 1354 | 1354 | public static function get_time_spent_on_the_course($user_id, $courseId, $session_id = 0) |
| 1355 | 1355 | { |
| 1356 | 1356 | $courseId = intval($courseId); |
| 1357 | - $session_id = intval($session_id); |
|
| 1358 | - |
|
| 1359 | - $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1360 | - if (is_array($user_id)) { |
|
| 1361 | - $user_id = array_map('intval', $user_id); |
|
| 1362 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
| 1363 | - } else { |
|
| 1364 | - $user_id = intval($user_id); |
|
| 1365 | - $condition_user = " AND user_id = $user_id "; |
|
| 1366 | - } |
|
| 1367 | - |
|
| 1368 | - $sql = "SELECT |
|
| 1357 | + $session_id = intval($session_id); |
|
| 1358 | + |
|
| 1359 | + $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1360 | + if (is_array($user_id)) { |
|
| 1361 | + $user_id = array_map('intval', $user_id); |
|
| 1362 | + $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
| 1363 | + } else { |
|
| 1364 | + $user_id = intval($user_id); |
|
| 1365 | + $condition_user = " AND user_id = $user_id "; |
|
| 1366 | + } |
|
| 1367 | + |
|
| 1368 | + $sql = "SELECT |
|
| 1369 | 1369 | SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds |
| 1370 | 1370 | FROM $tbl_track_course |
| 1371 | 1371 | WHERE UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) "; |
@@ -1381,9 +1381,9 @@ discard block |
||
| 1381 | 1381 | $sql .= $condition_user; |
| 1382 | 1382 | |
| 1383 | 1383 | $rs = Database::query($sql); |
| 1384 | - $row = Database::fetch_array($rs); |
|
| 1384 | + $row = Database::fetch_array($rs); |
|
| 1385 | 1385 | |
| 1386 | - return $row['nb_seconds']; |
|
| 1386 | + return $row['nb_seconds']; |
|
| 1387 | 1387 | } |
| 1388 | 1388 | |
| 1389 | 1389 | /** |
@@ -1394,25 +1394,25 @@ discard block |
||
| 1394 | 1394 | */ |
| 1395 | 1395 | public static function get_first_connection_date($student_id) |
| 1396 | 1396 | { |
| 1397 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
| 1398 | - $sql = 'SELECT login_date |
|
| 1397 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
| 1398 | + $sql = 'SELECT login_date |
|
| 1399 | 1399 | FROM ' . $tbl_track_login . ' |
| 1400 | 1400 | WHERE login_user_id = ' . intval($student_id) . ' |
| 1401 | 1401 | ORDER BY login_date ASC |
| 1402 | 1402 | LIMIT 0,1'; |
| 1403 | 1403 | |
| 1404 | - $rs = Database::query($sql); |
|
| 1405 | - if (Database::num_rows($rs)>0) { |
|
| 1406 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
| 1404 | + $rs = Database::query($sql); |
|
| 1405 | + if (Database::num_rows($rs)>0) { |
|
| 1406 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
| 1407 | 1407 | return api_convert_and_format_date( |
| 1408 | 1408 | $first_login_date, |
| 1409 | 1409 | DATE_FORMAT_SHORT, |
| 1410 | 1410 | date_default_timezone_get() |
| 1411 | 1411 | ); |
| 1412 | - } |
|
| 1413 | - } |
|
| 1412 | + } |
|
| 1413 | + } |
|
| 1414 | 1414 | |
| 1415 | - return false; |
|
| 1415 | + return false; |
|
| 1416 | 1416 | } |
| 1417 | 1417 | |
| 1418 | 1418 | /** |
@@ -1425,38 +1425,38 @@ discard block |
||
| 1425 | 1425 | */ |
| 1426 | 1426 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
| 1427 | 1427 | { |
| 1428 | - $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
| 1429 | - $sql = 'SELECT login_date |
|
| 1428 | + $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
| 1429 | + $sql = 'SELECT login_date |
|
| 1430 | 1430 | FROM ' . $table . ' |
| 1431 | 1431 | WHERE login_user_id = ' . intval($student_id) . ' |
| 1432 | 1432 | ORDER BY login_date |
| 1433 | 1433 | DESC LIMIT 0,1'; |
| 1434 | 1434 | |
| 1435 | - $rs = Database::query($sql); |
|
| 1436 | - if (Database::num_rows($rs) > 0) { |
|
| 1437 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
| 1438 | - $last_login_date = api_get_local_time($last_login_date); |
|
| 1439 | - if ($return_timestamp) { |
|
| 1440 | - return api_strtotime($last_login_date,'UTC'); |
|
| 1441 | - } else { |
|
| 1442 | - if (!$warning_message) { |
|
| 1443 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
| 1444 | - } else { |
|
| 1445 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
| 1446 | - $currentTimestamp = time(); |
|
| 1447 | - |
|
| 1448 | - //If the last connection is > than 7 days, the text is red |
|
| 1449 | - //345600 = 7 days in seconds |
|
| 1450 | - if ($currentTimestamp - $timestamp > 604800) { |
|
| 1451 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
| 1452 | - } else { |
|
| 1453 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
| 1454 | - } |
|
| 1455 | - } |
|
| 1456 | - } |
|
| 1457 | - } |
|
| 1458 | - } |
|
| 1459 | - return false; |
|
| 1435 | + $rs = Database::query($sql); |
|
| 1436 | + if (Database::num_rows($rs) > 0) { |
|
| 1437 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
| 1438 | + $last_login_date = api_get_local_time($last_login_date); |
|
| 1439 | + if ($return_timestamp) { |
|
| 1440 | + return api_strtotime($last_login_date,'UTC'); |
|
| 1441 | + } else { |
|
| 1442 | + if (!$warning_message) { |
|
| 1443 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
| 1444 | + } else { |
|
| 1445 | + $timestamp = api_strtotime($last_login_date,'UTC'); |
|
| 1446 | + $currentTimestamp = time(); |
|
| 1447 | + |
|
| 1448 | + //If the last connection is > than 7 days, the text is red |
|
| 1449 | + //345600 = 7 days in seconds |
|
| 1450 | + if ($currentTimestamp - $timestamp > 604800) { |
|
| 1451 | + return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
| 1452 | + } else { |
|
| 1453 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
| 1454 | + } |
|
| 1455 | + } |
|
| 1456 | + } |
|
| 1457 | + } |
|
| 1458 | + } |
|
| 1459 | + return false; |
|
| 1460 | 1460 | } |
| 1461 | 1461 | |
| 1462 | 1462 | /** |
@@ -1510,30 +1510,30 @@ discard block |
||
| 1510 | 1510 | $session_id = 0, |
| 1511 | 1511 | $convert_date = true |
| 1512 | 1512 | ) { |
| 1513 | - $student_id = intval($student_id); |
|
| 1513 | + $student_id = intval($student_id); |
|
| 1514 | 1514 | $courseId = intval($courseId); |
| 1515 | - $session_id = intval($session_id); |
|
| 1515 | + $session_id = intval($session_id); |
|
| 1516 | 1516 | |
| 1517 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1518 | - $sql = 'SELECT login_course_date |
|
| 1517 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1518 | + $sql = 'SELECT login_course_date |
|
| 1519 | 1519 | FROM '.$tbl_track_login.' |
| 1520 | 1520 | WHERE |
| 1521 | 1521 | user_id = '.$student_id.' AND |
| 1522 | 1522 | c_id = '.$courseId.' AND |
| 1523 | 1523 | session_id = '.$session_id.' |
| 1524 | 1524 | ORDER BY login_course_date ASC LIMIT 0,1'; |
| 1525 | - $rs = Database::query($sql); |
|
| 1526 | - if (Database::num_rows($rs) > 0) { |
|
| 1527 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
| 1528 | - if ($convert_date) { |
|
| 1529 | - return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
| 1530 | - } else { |
|
| 1531 | - return $first_login_date; |
|
| 1532 | - } |
|
| 1533 | - } |
|
| 1534 | - } |
|
| 1535 | - |
|
| 1536 | - return false; |
|
| 1525 | + $rs = Database::query($sql); |
|
| 1526 | + if (Database::num_rows($rs) > 0) { |
|
| 1527 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
| 1528 | + if ($convert_date) { |
|
| 1529 | + return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
| 1530 | + } else { |
|
| 1531 | + return $first_login_date; |
|
| 1532 | + } |
|
| 1533 | + } |
|
| 1534 | + } |
|
| 1535 | + |
|
| 1536 | + return false; |
|
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | 1539 | /** |
@@ -1549,13 +1549,13 @@ discard block |
||
| 1549 | 1549 | $session_id = 0, |
| 1550 | 1550 | $convert_date = true |
| 1551 | 1551 | ) { |
| 1552 | - // protect data |
|
| 1553 | - $student_id = intval($student_id); |
|
| 1552 | + // protect data |
|
| 1553 | + $student_id = intval($student_id); |
|
| 1554 | 1554 | $courseId = $courseInfo['real_id']; |
| 1555 | - $session_id = intval($session_id); |
|
| 1555 | + $session_id = intval($session_id); |
|
| 1556 | 1556 | |
| 1557 | - $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
| 1558 | - $sql = 'SELECT access_date |
|
| 1557 | + $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
| 1558 | + $sql = 'SELECT access_date |
|
| 1559 | 1559 | FROM '.$tbl_track_e_access.' |
| 1560 | 1560 | WHERE access_user_id = '.$student_id.' AND |
| 1561 | 1561 | c_id = "'.$courseId.'" AND |
@@ -1563,39 +1563,39 @@ discard block |
||
| 1563 | 1563 | ORDER BY access_date DESC |
| 1564 | 1564 | LIMIT 0,1'; |
| 1565 | 1565 | |
| 1566 | - $rs = Database::query($sql); |
|
| 1567 | - if (Database::num_rows($rs) > 0) { |
|
| 1568 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
| 1566 | + $rs = Database::query($sql); |
|
| 1567 | + if (Database::num_rows($rs) > 0) { |
|
| 1568 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
| 1569 | 1569 | if (empty($last_login_date) || $last_login_date == '0000-00-00 00:00:00') { |
| 1570 | 1570 | return false; |
| 1571 | 1571 | } |
| 1572 | 1572 | //see #5736 |
| 1573 | 1573 | $last_login_date_timestamp = api_strtotime($last_login_date); |
| 1574 | - $now = time(); |
|
| 1575 | - //If the last connection is > than 7 days, the text is red |
|
| 1576 | - //345600 = 7 days in seconds |
|
| 1577 | - if ($now - $last_login_date_timestamp > 604800) { |
|
| 1578 | - if ($convert_date) { |
|
| 1574 | + $now = time(); |
|
| 1575 | + //If the last connection is > than 7 days, the text is red |
|
| 1576 | + //345600 = 7 days in seconds |
|
| 1577 | + if ($now - $last_login_date_timestamp > 604800) { |
|
| 1578 | + if ($convert_date) { |
|
| 1579 | 1579 | $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
| 1580 | 1580 | $icon = api_is_allowed_to_edit() ? |
| 1581 | 1581 | '<a href="'.api_get_path(REL_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang('RemindInactiveUser').'"> |
| 1582 | 1582 | '.Display::return_icon('messagebox_warning.gif').' |
| 1583 | 1583 | </a>' |
| 1584 | 1584 | : null; |
| 1585 | - return $icon. Display::label($last_login_date, 'warning'); |
|
| 1586 | - } else { |
|
| 1587 | - return $last_login_date; |
|
| 1588 | - } |
|
| 1589 | - } else { |
|
| 1590 | - if ($convert_date) { |
|
| 1591 | - return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
| 1592 | - } else { |
|
| 1593 | - return $last_login_date; |
|
| 1594 | - } |
|
| 1595 | - } |
|
| 1596 | - } |
|
| 1597 | - } |
|
| 1598 | - return false; |
|
| 1585 | + return $icon. Display::label($last_login_date, 'warning'); |
|
| 1586 | + } else { |
|
| 1587 | + return $last_login_date; |
|
| 1588 | + } |
|
| 1589 | + } else { |
|
| 1590 | + if ($convert_date) { |
|
| 1591 | + return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
| 1592 | + } else { |
|
| 1593 | + return $last_login_date; |
|
| 1594 | + } |
|
| 1595 | + } |
|
| 1596 | + } |
|
| 1597 | + } |
|
| 1598 | + return false; |
|
| 1599 | 1599 | } |
| 1600 | 1600 | |
| 1601 | 1601 | /** |
@@ -1608,36 +1608,36 @@ discard block |
||
| 1608 | 1608 | */ |
| 1609 | 1609 | public static function get_course_connections_count($courseId, $session_id = 0, $start = 0, $stop = null) |
| 1610 | 1610 | { |
| 1611 | - if ($start < 0) { |
|
| 1612 | - $start = 0; |
|
| 1613 | - } |
|
| 1614 | - if (!isset($stop) or ($stop < 0)) { |
|
| 1615 | - $stop = api_get_utc_datetime(); |
|
| 1616 | - } |
|
| 1611 | + if ($start < 0) { |
|
| 1612 | + $start = 0; |
|
| 1613 | + } |
|
| 1614 | + if (!isset($stop) or ($stop < 0)) { |
|
| 1615 | + $stop = api_get_utc_datetime(); |
|
| 1616 | + } |
|
| 1617 | 1617 | |
| 1618 | 1618 | $start = Database::escape_string($start); |
| 1619 | 1619 | $stop = Database::escape_string($stop); |
| 1620 | 1620 | |
| 1621 | - $month_filter = " AND login_course_date > '$start' AND login_course_date < '$stop' "; |
|
| 1621 | + $month_filter = " AND login_course_date > '$start' AND login_course_date < '$stop' "; |
|
| 1622 | 1622 | |
| 1623 | 1623 | $courseId = intval($courseId); |
| 1624 | - $session_id = intval($session_id); |
|
| 1625 | - $count = 0; |
|
| 1624 | + $session_id = intval($session_id); |
|
| 1625 | + $count = 0; |
|
| 1626 | 1626 | |
| 1627 | - $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1628 | - $sql = "SELECT count(*) as count_connections |
|
| 1627 | + $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1628 | + $sql = "SELECT count(*) as count_connections |
|
| 1629 | 1629 | FROM $tbl_track_e_course_access |
| 1630 | 1630 | WHERE |
| 1631 | 1631 | c_id = $courseId AND |
| 1632 | 1632 | session_id = $session_id |
| 1633 | 1633 | $month_filter"; |
| 1634 | - $rs = Database::query($sql); |
|
| 1635 | - if (Database::num_rows($rs)>0) { |
|
| 1636 | - $row = Database::fetch_object($rs); |
|
| 1637 | - $count = $row->count_connections; |
|
| 1638 | - } |
|
| 1634 | + $rs = Database::query($sql); |
|
| 1635 | + if (Database::num_rows($rs)>0) { |
|
| 1636 | + $row = Database::fetch_object($rs); |
|
| 1637 | + $count = $row->count_connections; |
|
| 1638 | + } |
|
| 1639 | 1639 | |
| 1640 | - return $count; |
|
| 1640 | + return $count; |
|
| 1641 | 1641 | } |
| 1642 | 1642 | |
| 1643 | 1643 | /** |
@@ -1648,25 +1648,25 @@ discard block |
||
| 1648 | 1648 | */ |
| 1649 | 1649 | public static function count_course_per_student($user_id, $include_sessions = true) |
| 1650 | 1650 | { |
| 1651 | - $user_id = intval($user_id); |
|
| 1652 | - $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
| 1653 | - $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
| 1651 | + $user_id = intval($user_id); |
|
| 1652 | + $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
| 1653 | + $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
| 1654 | 1654 | |
| 1655 | - $sql = 'SELECT DISTINCT c_id |
|
| 1655 | + $sql = 'SELECT DISTINCT c_id |
|
| 1656 | 1656 | FROM ' . $tbl_course_rel_user . ' |
| 1657 | 1657 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
| 1658 | - $rs = Database::query($sql); |
|
| 1659 | - $nb_courses = Database::num_rows($rs); |
|
| 1658 | + $rs = Database::query($sql); |
|
| 1659 | + $nb_courses = Database::num_rows($rs); |
|
| 1660 | 1660 | |
| 1661 | - if ($include_sessions) { |
|
| 1662 | - $sql = 'SELECT DISTINCT c_id |
|
| 1661 | + if ($include_sessions) { |
|
| 1662 | + $sql = 'SELECT DISTINCT c_id |
|
| 1663 | 1663 | FROM ' . $tbl_session_course_rel_user . ' |
| 1664 | 1664 | WHERE user_id = ' . $user_id; |
| 1665 | - $rs = Database::query($sql); |
|
| 1666 | - $nb_courses += Database::num_rows($rs); |
|
| 1667 | - } |
|
| 1665 | + $rs = Database::query($sql); |
|
| 1666 | + $nb_courses += Database::num_rows($rs); |
|
| 1667 | + } |
|
| 1668 | 1668 | |
| 1669 | - return $nb_courses; |
|
| 1669 | + return $nb_courses; |
|
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | 1672 | /** |
@@ -1697,25 +1697,25 @@ discard block |
||
| 1697 | 1697 | $into_lp = 0 |
| 1698 | 1698 | ) { |
| 1699 | 1699 | $course_code = Database::escape_string($course_code); |
| 1700 | - $course_info = api_get_course_info($course_code); |
|
| 1701 | - if (!empty($course_info)) { |
|
| 1702 | - // table definition |
|
| 1703 | - $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 1704 | - $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
| 1705 | - |
|
| 1706 | - // Compose a filter based on optional exercise given |
|
| 1707 | - $condition_quiz = ""; |
|
| 1708 | - if (!empty($exercise_id)) { |
|
| 1709 | - $exercise_id = intval($exercise_id); |
|
| 1710 | - $condition_quiz =" AND id = $exercise_id "; |
|
| 1711 | - } |
|
| 1712 | - |
|
| 1713 | - // Compose a filter based on optional session id given |
|
| 1714 | - $condition_session = ""; |
|
| 1715 | - if (isset($session_id)) { |
|
| 1716 | - $session_id = intval($session_id); |
|
| 1717 | - $condition_session = " AND session_id = $session_id "; |
|
| 1718 | - } |
|
| 1700 | + $course_info = api_get_course_info($course_code); |
|
| 1701 | + if (!empty($course_info)) { |
|
| 1702 | + // table definition |
|
| 1703 | + $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 1704 | + $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
| 1705 | + |
|
| 1706 | + // Compose a filter based on optional exercise given |
|
| 1707 | + $condition_quiz = ""; |
|
| 1708 | + if (!empty($exercise_id)) { |
|
| 1709 | + $exercise_id = intval($exercise_id); |
|
| 1710 | + $condition_quiz =" AND id = $exercise_id "; |
|
| 1711 | + } |
|
| 1712 | + |
|
| 1713 | + // Compose a filter based on optional session id given |
|
| 1714 | + $condition_session = ""; |
|
| 1715 | + if (isset($session_id)) { |
|
| 1716 | + $session_id = intval($session_id); |
|
| 1717 | + $condition_session = " AND session_id = $session_id "; |
|
| 1718 | + } |
|
| 1719 | 1719 | if ($active_filter == 1) { |
| 1720 | 1720 | $condition_active = 'AND active <> -1'; |
| 1721 | 1721 | } elseif ($active_filter == 0) { |
@@ -1731,25 +1731,25 @@ discard block |
||
| 1731 | 1731 | $select_lp_id = ', orig_lp_id as lp_id '; |
| 1732 | 1732 | } |
| 1733 | 1733 | |
| 1734 | - $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
| 1734 | + $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
| 1735 | 1735 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz "; |
| 1736 | - $count_quiz = Database::fetch_row(Database::query($sql)); |
|
| 1736 | + $count_quiz = Database::fetch_row(Database::query($sql)); |
|
| 1737 | 1737 | |
| 1738 | - if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
| 1739 | - if (is_array($student_id)) { |
|
| 1738 | + if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
| 1739 | + if (is_array($student_id)) { |
|
| 1740 | 1740 | $student_id = array_map('intval', $student_id); |
| 1741 | - $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
| 1742 | - } else { |
|
| 1741 | + $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
| 1742 | + } else { |
|
| 1743 | 1743 | $student_id = intval($student_id); |
| 1744 | - $condition_user = " AND exe_user_id = '$student_id' "; |
|
| 1745 | - } |
|
| 1744 | + $condition_user = " AND exe_user_id = '$student_id' "; |
|
| 1745 | + } |
|
| 1746 | 1746 | |
| 1747 | - if (empty($exercise_id)) { |
|
| 1748 | - $sql = "SELECT id FROM $tbl_course_quiz |
|
| 1747 | + if (empty($exercise_id)) { |
|
| 1748 | + $sql = "SELECT id FROM $tbl_course_quiz |
|
| 1749 | 1749 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz"; |
| 1750 | 1750 | $result = Database::query($sql); |
| 1751 | 1751 | $exercise_list = array(); |
| 1752 | - $exercise_id = null; |
|
| 1752 | + $exercise_id = null; |
|
| 1753 | 1753 | if (Database::num_rows($result)) { |
| 1754 | 1754 | while ($row = Database::fetch_array($result)) { |
| 1755 | 1755 | $exercise_list[] = $row['id']; |
@@ -1758,11 +1758,11 @@ discard block |
||
| 1758 | 1758 | if (!empty($exercise_list)) { |
| 1759 | 1759 | $exercise_id = implode("','",$exercise_list); |
| 1760 | 1760 | } |
| 1761 | - } |
|
| 1761 | + } |
|
| 1762 | 1762 | |
| 1763 | - $count_quiz = Database::fetch_row(Database::query($sql)); |
|
| 1763 | + $count_quiz = Database::fetch_row(Database::query($sql)); |
|
| 1764 | 1764 | |
| 1765 | - $sql = "SELECT |
|
| 1765 | + $sql = "SELECT |
|
| 1766 | 1766 | SUM(exe_result/exe_weighting*100) as avg_score, |
| 1767 | 1767 | COUNT(*) as num_attempts |
| 1768 | 1768 | $select_lp_id |
@@ -1776,20 +1776,20 @@ discard block |
||
| 1776 | 1776 | $condition_into_lp |
| 1777 | 1777 | ORDER BY exe_date DESC"; |
| 1778 | 1778 | |
| 1779 | - $res = Database::query($sql); |
|
| 1780 | - $row = Database::fetch_array($res); |
|
| 1781 | - $quiz_avg_score = null; |
|
| 1779 | + $res = Database::query($sql); |
|
| 1780 | + $row = Database::fetch_array($res); |
|
| 1781 | + $quiz_avg_score = null; |
|
| 1782 | 1782 | |
| 1783 | - if (!empty($row['avg_score'])) { |
|
| 1784 | - $quiz_avg_score = round($row['avg_score'],2); |
|
| 1785 | - } |
|
| 1783 | + if (!empty($row['avg_score'])) { |
|
| 1784 | + $quiz_avg_score = round($row['avg_score'],2); |
|
| 1785 | + } |
|
| 1786 | 1786 | |
| 1787 | - if(!empty($row['num_attempts'])) { |
|
| 1788 | - $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
| 1789 | - } |
|
| 1790 | - if (is_array($student_id)) { |
|
| 1791 | - $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
| 1792 | - } |
|
| 1787 | + if(!empty($row['num_attempts'])) { |
|
| 1788 | + $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
| 1789 | + } |
|
| 1790 | + if (is_array($student_id)) { |
|
| 1791 | + $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
| 1792 | + } |
|
| 1793 | 1793 | if ($into_lp == 0) { |
| 1794 | 1794 | return $quiz_avg_score; |
| 1795 | 1795 | } else { |
@@ -1812,9 +1812,9 @@ discard block |
||
| 1812 | 1812 | return array($quiz_avg_score, null); |
| 1813 | 1813 | } |
| 1814 | 1814 | } |
| 1815 | - } |
|
| 1816 | - } |
|
| 1817 | - return null; |
|
| 1815 | + } |
|
| 1816 | + } |
|
| 1817 | + return null; |
|
| 1818 | 1818 | } |
| 1819 | 1819 | |
| 1820 | 1820 | /** |
@@ -1847,15 +1847,15 @@ discard block |
||
| 1847 | 1847 | $find_all_lp = 0 |
| 1848 | 1848 | ) { |
| 1849 | 1849 | $courseId = intval($courseId); |
| 1850 | - $student_id = intval($student_id); |
|
| 1851 | - $exercise_id = intval($exercise_id); |
|
| 1852 | - $session_id = intval($session_id); |
|
| 1850 | + $student_id = intval($student_id); |
|
| 1851 | + $exercise_id = intval($exercise_id); |
|
| 1852 | + $session_id = intval($session_id); |
|
| 1853 | 1853 | |
| 1854 | - $lp_id = intval($lp_id); |
|
| 1854 | + $lp_id = intval($lp_id); |
|
| 1855 | 1855 | $lp_item_id = intval($lp_item_id); |
| 1856 | - $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
| 1856 | + $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
| 1857 | 1857 | |
| 1858 | - $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
| 1858 | + $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
| 1859 | 1859 | WHERE ex.c_id = $courseId |
| 1860 | 1860 | AND ex.exe_exo_id = $exercise_id |
| 1861 | 1861 | AND status = '' |
@@ -1870,11 +1870,11 @@ discard block |
||
| 1870 | 1870 | AND orig_lp_item_id = $lp_item_id"; |
| 1871 | 1871 | } |
| 1872 | 1872 | |
| 1873 | - $rs = Database::query($sql); |
|
| 1874 | - $row = Database::fetch_row($rs); |
|
| 1875 | - $count_attempts = $row[0]; |
|
| 1873 | + $rs = Database::query($sql); |
|
| 1874 | + $row = Database::fetch_row($rs); |
|
| 1875 | + $count_attempts = $row[0]; |
|
| 1876 | 1876 | |
| 1877 | - return $count_attempts; |
|
| 1877 | + return $count_attempts; |
|
| 1878 | 1878 | } |
| 1879 | 1879 | |
| 1880 | 1880 | /** |
@@ -1884,7 +1884,7 @@ discard block |
||
| 1884 | 1884 | * @param int $user_id |
| 1885 | 1885 | * @param int $courseId |
| 1886 | 1886 | * @param int $session_id |
| 1887 | - */ |
|
| 1887 | + */ |
|
| 1888 | 1888 | public static function get_exercise_student_progress($exercise_list, $user_id, $courseId, $session_id) |
| 1889 | 1889 | { |
| 1890 | 1890 | $courseId = intval($courseId); |
@@ -3500,8 +3500,8 @@ discard block |
||
| 3500 | 3500 | |
| 3501 | 3501 | $condition_session = ''; |
| 3502 | 3502 | if (isset($session_id)) { |
| 3503 | - $session_id = intval($session_id); |
|
| 3504 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
| 3503 | + $session_id = intval($session_id); |
|
| 3504 | + $condition_session = ' AND f.session_id = '. $session_id; |
|
| 3505 | 3505 | } |
| 3506 | 3506 | |
| 3507 | 3507 | $groupId = intval($groupId); |
@@ -5400,9 +5400,9 @@ discard block |
||
| 5400 | 5400 | } |
| 5401 | 5401 | |
| 5402 | 5402 | /** |
| 5403 | - * @param FormValidator $form |
|
| 5404 | - * @return mixed |
|
| 5405 | - */ |
|
| 5403 | + * @param FormValidator $form |
|
| 5404 | + * @return mixed |
|
| 5405 | + */ |
|
| 5406 | 5406 | public static function setUserSearchForm($form) |
| 5407 | 5407 | { |
| 5408 | 5408 | global $_configuration; |
@@ -5681,26 +5681,26 @@ discard block |
||
| 5681 | 5681 | $session_id = api_get_session_id(); |
| 5682 | 5682 | $course_id = api_get_course_int_id(); |
| 5683 | 5683 | |
| 5684 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
| 5685 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 5684 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
| 5685 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 5686 | 5686 | |
| 5687 | - $sql = "SELECT count(tool) AS total_number_of_items |
|
| 5687 | + $sql = "SELECT count(tool) AS total_number_of_items |
|
| 5688 | 5688 | FROM $table_item_property track_resource, $table_user user |
| 5689 | 5689 | WHERE |
| 5690 | 5690 | track_resource.c_id = $course_id AND |
| 5691 | 5691 | track_resource.insert_user_id = user.user_id AND |
| 5692 | 5692 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
| 5693 | 5693 | |
| 5694 | - if (isset($_GET['keyword'])) { |
|
| 5695 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
| 5696 | - $sql .= " AND ( |
|
| 5694 | + if (isset($_GET['keyword'])) { |
|
| 5695 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
| 5696 | + $sql .= " AND ( |
|
| 5697 | 5697 | user.username LIKE '%".$keyword."%' OR |
| 5698 | 5698 | lastedit_type LIKE '%".$keyword."%' OR |
| 5699 | 5699 | tool LIKE '%".$keyword."%' |
| 5700 | 5700 | )"; |
| 5701 | - } |
|
| 5701 | + } |
|
| 5702 | 5702 | |
| 5703 | - $sql .= " AND tool IN ( |
|
| 5703 | + $sql .= " AND tool IN ( |
|
| 5704 | 5704 | 'document', |
| 5705 | 5705 | 'learnpath', |
| 5706 | 5706 | 'quiz', |
@@ -5712,10 +5712,10 @@ discard block |
||
| 5712 | 5712 | 'thematic_advance', |
| 5713 | 5713 | 'thematic_plan' |
| 5714 | 5714 | )"; |
| 5715 | - $res = Database::query($sql); |
|
| 5716 | - $obj = Database::fetch_object($res); |
|
| 5715 | + $res = Database::query($sql); |
|
| 5716 | + $obj = Database::fetch_object($res); |
|
| 5717 | 5717 | |
| 5718 | - return $obj->total_number_of_items; |
|
| 5718 | + return $obj->total_number_of_items; |
|
| 5719 | 5719 | } |
| 5720 | 5720 | |
| 5721 | 5721 | /** |
@@ -5730,12 +5730,12 @@ discard block |
||
| 5730 | 5730 | $session_id = api_get_session_id(); |
| 5731 | 5731 | $course_id = api_get_course_int_id(); |
| 5732 | 5732 | |
| 5733 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
| 5734 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 5735 | - $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
| 5736 | - $session_id = intval($session_id); |
|
| 5733 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
| 5734 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 5735 | + $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
| 5736 | + $session_id = intval($session_id); |
|
| 5737 | 5737 | |
| 5738 | - $sql = "SELECT |
|
| 5738 | + $sql = "SELECT |
|
| 5739 | 5739 | tool as col0, |
| 5740 | 5740 | lastedit_type as col1, |
| 5741 | 5741 | ref as ref, |
@@ -5749,16 +5749,16 @@ discard block |
||
| 5749 | 5749 | track_resource.insert_user_id = user.user_id AND |
| 5750 | 5750 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
| 5751 | 5751 | |
| 5752 | - if (isset($_GET['keyword'])) { |
|
| 5753 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
| 5754 | - $sql .= " AND ( |
|
| 5752 | + if (isset($_GET['keyword'])) { |
|
| 5753 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
| 5754 | + $sql .= " AND ( |
|
| 5755 | 5755 | user.username LIKE '%".$keyword."%' OR |
| 5756 | 5756 | lastedit_type LIKE '%".$keyword."%' OR |
| 5757 | 5757 | tool LIKE '%".$keyword."%' |
| 5758 | 5758 | ) "; |
| 5759 | - } |
|
| 5759 | + } |
|
| 5760 | 5760 | |
| 5761 | - $sql .= " AND tool IN ( |
|
| 5761 | + $sql .= " AND tool IN ( |
|
| 5762 | 5762 | 'document', |
| 5763 | 5763 | 'learnpath', |
| 5764 | 5764 | 'quiz', |
@@ -5771,41 +5771,41 @@ discard block |
||
| 5771 | 5771 | 'thematic_plan' |
| 5772 | 5772 | )"; |
| 5773 | 5773 | |
| 5774 | - if ($column == 0) { |
|
| 5775 | - $column = '0'; |
|
| 5776 | - } |
|
| 5777 | - if ($column != '' && $direction != '') { |
|
| 5778 | - if ($column != 2 && $column != 4) { |
|
| 5779 | - $sql .= " ORDER BY col$column $direction"; |
|
| 5780 | - } |
|
| 5781 | - } else { |
|
| 5782 | - $sql .= " ORDER BY col5 DESC "; |
|
| 5783 | - } |
|
| 5774 | + if ($column == 0) { |
|
| 5775 | + $column = '0'; |
|
| 5776 | + } |
|
| 5777 | + if ($column != '' && $direction != '') { |
|
| 5778 | + if ($column != 2 && $column != 4) { |
|
| 5779 | + $sql .= " ORDER BY col$column $direction"; |
|
| 5780 | + } |
|
| 5781 | + } else { |
|
| 5782 | + $sql .= " ORDER BY col5 DESC "; |
|
| 5783 | + } |
|
| 5784 | 5784 | |
| 5785 | 5785 | $from = intval($from); |
| 5786 | 5786 | $number_of_items = intval($number_of_items); |
| 5787 | 5787 | |
| 5788 | - $sql .= " LIMIT $from, $number_of_items "; |
|
| 5789 | - |
|
| 5790 | - $res = Database::query($sql); |
|
| 5791 | - $resources = array(); |
|
| 5792 | - $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
| 5793 | - while ($row = Database::fetch_array($res)) { |
|
| 5794 | - $ref = $row['ref']; |
|
| 5795 | - $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
| 5796 | - $table_tool = Database :: get_course_table($table_name['table_name']); |
|
| 5797 | - |
|
| 5798 | - $id = $table_name['id_tool']; |
|
| 5799 | - $recorset = false; |
|
| 5788 | + $sql .= " LIMIT $from, $number_of_items "; |
|
| 5800 | 5789 | |
| 5801 | - if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
| 5802 | - $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
| 5803 | - $sql = "SELECT thematic_id FROM $table_tool |
|
| 5790 | + $res = Database::query($sql); |
|
| 5791 | + $resources = array(); |
|
| 5792 | + $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
| 5793 | + while ($row = Database::fetch_array($res)) { |
|
| 5794 | + $ref = $row['ref']; |
|
| 5795 | + $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
| 5796 | + $table_tool = Database :: get_course_table($table_name['table_name']); |
|
| 5797 | + |
|
| 5798 | + $id = $table_name['id_tool']; |
|
| 5799 | + $recorset = false; |
|
| 5800 | + |
|
| 5801 | + if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
| 5802 | + $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
| 5803 | + $sql = "SELECT thematic_id FROM $table_tool |
|
| 5804 | 5804 | WHERE c_id = $course_id AND id = $ref"; |
| 5805 | - $rs_thematic = Database::query($sql); |
|
| 5806 | - if (Database::num_rows($rs_thematic)) { |
|
| 5807 | - $row_thematic = Database::fetch_array($rs_thematic); |
|
| 5808 | - $thematic_id = $row_thematic['thematic_id']; |
|
| 5805 | + $rs_thematic = Database::query($sql); |
|
| 5806 | + if (Database::num_rows($rs_thematic)) { |
|
| 5807 | + $row_thematic = Database::fetch_array($rs_thematic); |
|
| 5808 | + $thematic_id = $row_thematic['thematic_id']; |
|
| 5809 | 5809 | |
| 5810 | 5810 | $sql = "SELECT session.id, session.name, user.username |
| 5811 | 5811 | FROM $tbl_thematic t, $table_session session, $table_user user |
@@ -5814,9 +5814,9 @@ discard block |
||
| 5814 | 5814 | t.session_id = session.id AND |
| 5815 | 5815 | session.id_coach = user.user_id AND |
| 5816 | 5816 | t.id = $thematic_id"; |
| 5817 | - $recorset = Database::query($sql); |
|
| 5818 | - } |
|
| 5819 | - } else { |
|
| 5817 | + $recorset = Database::query($sql); |
|
| 5818 | + } |
|
| 5819 | + } else { |
|
| 5820 | 5820 | $sql = "SELECT session.id, session.name, user.username |
| 5821 | 5821 | FROM $table_tool tool, $table_session session, $table_user user |
| 5822 | 5822 | WHERE |
@@ -5824,127 +5824,127 @@ discard block |
||
| 5824 | 5824 | tool.session_id = session.id AND |
| 5825 | 5825 | session.id_coach = user.user_id AND |
| 5826 | 5826 | tool.$id = $ref"; |
| 5827 | - $recorset = Database::query($sql); |
|
| 5828 | - } |
|
| 5829 | - |
|
| 5830 | - if (!empty($recorset)) { |
|
| 5831 | - $obj = Database::fetch_object($recorset); |
|
| 5832 | - |
|
| 5833 | - $name_session = ''; |
|
| 5834 | - $coach_name = ''; |
|
| 5835 | - if (!empty($obj)) { |
|
| 5836 | - $name_session = $obj->name; |
|
| 5837 | - $coach_name = $obj->username; |
|
| 5838 | - } |
|
| 5839 | - |
|
| 5840 | - $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
| 5841 | - $row[0] = ''; |
|
| 5842 | - if ($row['col6'] != 2) { |
|
| 5843 | - if (in_array($row['col0'], $thematic_tools)) { |
|
| 5844 | - |
|
| 5845 | - $exp_thematic_tool = explode('_', $row['col0']); |
|
| 5846 | - $thematic_tool_title = ''; |
|
| 5847 | - if (is_array($exp_thematic_tool)) { |
|
| 5848 | - foreach ($exp_thematic_tool as $exp) { |
|
| 5849 | - $thematic_tool_title .= api_ucfirst($exp); |
|
| 5850 | - } |
|
| 5851 | - } else { |
|
| 5852 | - $thematic_tool_title = api_ucfirst($row['col0']); |
|
| 5853 | - } |
|
| 5854 | - |
|
| 5855 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
| 5856 | - } else { |
|
| 5857 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
| 5858 | - } |
|
| 5859 | - } else { |
|
| 5860 | - $row[0] = api_ucfirst($row['col0']); |
|
| 5861 | - } |
|
| 5862 | - $row[1] = get_lang($row[1]); |
|
| 5863 | - $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
| 5864 | - $row[5] = ''; |
|
| 5865 | - //@todo Improve this code please |
|
| 5866 | - switch ($table_name['table_name']) { |
|
| 5867 | - case 'document' : |
|
| 5868 | - $sql = "SELECT tool.title as title FROM $table_tool tool |
|
| 5827 | + $recorset = Database::query($sql); |
|
| 5828 | + } |
|
| 5829 | + |
|
| 5830 | + if (!empty($recorset)) { |
|
| 5831 | + $obj = Database::fetch_object($recorset); |
|
| 5832 | + |
|
| 5833 | + $name_session = ''; |
|
| 5834 | + $coach_name = ''; |
|
| 5835 | + if (!empty($obj)) { |
|
| 5836 | + $name_session = $obj->name; |
|
| 5837 | + $coach_name = $obj->username; |
|
| 5838 | + } |
|
| 5839 | + |
|
| 5840 | + $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
| 5841 | + $row[0] = ''; |
|
| 5842 | + if ($row['col6'] != 2) { |
|
| 5843 | + if (in_array($row['col0'], $thematic_tools)) { |
|
| 5844 | + |
|
| 5845 | + $exp_thematic_tool = explode('_', $row['col0']); |
|
| 5846 | + $thematic_tool_title = ''; |
|
| 5847 | + if (is_array($exp_thematic_tool)) { |
|
| 5848 | + foreach ($exp_thematic_tool as $exp) { |
|
| 5849 | + $thematic_tool_title .= api_ucfirst($exp); |
|
| 5850 | + } |
|
| 5851 | + } else { |
|
| 5852 | + $thematic_tool_title = api_ucfirst($row['col0']); |
|
| 5853 | + } |
|
| 5854 | + |
|
| 5855 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
| 5856 | + } else { |
|
| 5857 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
| 5858 | + } |
|
| 5859 | + } else { |
|
| 5860 | + $row[0] = api_ucfirst($row['col0']); |
|
| 5861 | + } |
|
| 5862 | + $row[1] = get_lang($row[1]); |
|
| 5863 | + $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
| 5864 | + $row[5] = ''; |
|
| 5865 | + //@todo Improve this code please |
|
| 5866 | + switch ($table_name['table_name']) { |
|
| 5867 | + case 'document' : |
|
| 5868 | + $sql = "SELECT tool.title as title FROM $table_tool tool |
|
| 5869 | 5869 | WHERE c_id = $course_id AND id = $ref"; |
| 5870 | - $rs_document = Database::query($sql); |
|
| 5871 | - $obj_document = Database::fetch_object($rs_document); |
|
| 5872 | - $row[5] = $obj_document->title; |
|
| 5870 | + $rs_document = Database::query($sql); |
|
| 5871 | + $obj_document = Database::fetch_object($rs_document); |
|
| 5872 | + $row[5] = $obj_document->title; |
|
| 5873 | 5873 | |
| 5874 | - break; |
|
| 5875 | - case 'announcement': |
|
| 5874 | + break; |
|
| 5875 | + case 'announcement': |
|
| 5876 | 5876 | $sql = "SELECT title FROM $table_tool |
| 5877 | 5877 | WHERE c_id = $course_id AND id = $ref"; |
| 5878 | - $rs_document = Database::query($sql); |
|
| 5879 | - $obj_document = Database::fetch_object($rs_document); |
|
| 5878 | + $rs_document = Database::query($sql); |
|
| 5879 | + $obj_document = Database::fetch_object($rs_document); |
|
| 5880 | 5880 | if ($obj_document) { |
| 5881 | 5881 | $row[5] = $obj_document->title; |
| 5882 | 5882 | } |
| 5883 | - break; |
|
| 5884 | - case 'glossary': |
|
| 5883 | + break; |
|
| 5884 | + case 'glossary': |
|
| 5885 | 5885 | $sql = "SELECT name FROM $table_tool |
| 5886 | 5886 | WHERE c_id = $course_id AND glossary_id = $ref"; |
| 5887 | - $rs_document = Database::query($sql); |
|
| 5888 | - $obj_document = Database::fetch_object($rs_document); |
|
| 5887 | + $rs_document = Database::query($sql); |
|
| 5888 | + $obj_document = Database::fetch_object($rs_document); |
|
| 5889 | 5889 | if ($obj_document) { |
| 5890 | 5890 | $row[5] = $obj_document->name; |
| 5891 | 5891 | } |
| 5892 | - break; |
|
| 5893 | - case 'lp': |
|
| 5892 | + break; |
|
| 5893 | + case 'lp': |
|
| 5894 | 5894 | $sql = "SELECT name |
| 5895 | 5895 | FROM $table_tool WHERE c_id = $course_id AND id = $ref"; |
| 5896 | - $rs_document = Database::query($sql); |
|
| 5897 | - $obj_document = Database::fetch_object($rs_document); |
|
| 5898 | - $row[5] = $obj_document->name; |
|
| 5899 | - break; |
|
| 5900 | - case 'quiz': |
|
| 5896 | + $rs_document = Database::query($sql); |
|
| 5897 | + $obj_document = Database::fetch_object($rs_document); |
|
| 5898 | + $row[5] = $obj_document->name; |
|
| 5899 | + break; |
|
| 5900 | + case 'quiz': |
|
| 5901 | 5901 | $sql = "SELECT title FROM $table_tool |
| 5902 | 5902 | WHERE c_id = $course_id AND id = $ref"; |
| 5903 | - $rs_document = Database::query($sql); |
|
| 5904 | - $obj_document = Database::fetch_object($rs_document); |
|
| 5903 | + $rs_document = Database::query($sql); |
|
| 5904 | + $obj_document = Database::fetch_object($rs_document); |
|
| 5905 | 5905 | if ($obj_document) { |
| 5906 | 5906 | $row[5] = $obj_document->title; |
| 5907 | 5907 | } |
| 5908 | - break; |
|
| 5909 | - case 'course_description': |
|
| 5908 | + break; |
|
| 5909 | + case 'course_description': |
|
| 5910 | 5910 | $sql = "SELECT title FROM $table_tool |
| 5911 | 5911 | WHERE c_id = $course_id AND id = $ref"; |
| 5912 | - $rs_document = Database::query($sql); |
|
| 5913 | - $obj_document = Database::fetch_object($rs_document); |
|
| 5912 | + $rs_document = Database::query($sql); |
|
| 5913 | + $obj_document = Database::fetch_object($rs_document); |
|
| 5914 | 5914 | if ($obj_document) { |
| 5915 | 5915 | $row[5] = $obj_document->title; |
| 5916 | 5916 | } |
| 5917 | - break; |
|
| 5918 | - case 'thematic': |
|
| 5919 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
| 5920 | - if (Database::num_rows($rs) > 0) { |
|
| 5921 | - $obj = Database::fetch_object($rs); |
|
| 5922 | - $row[5] = $obj->title; |
|
| 5923 | - } |
|
| 5924 | - break; |
|
| 5925 | - case 'thematic_advance': |
|
| 5926 | - $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
| 5927 | - if (Database::num_rows($rs) > 0) { |
|
| 5928 | - $obj = Database::fetch_object($rs); |
|
| 5929 | - $row[5] = $obj->content; |
|
| 5930 | - } |
|
| 5931 | - break; |
|
| 5932 | - case 'thematic_plan': |
|
| 5933 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
| 5934 | - if (Database::num_rows($rs) > 0) { |
|
| 5935 | - $obj = Database::fetch_object($rs); |
|
| 5936 | - $row[5] = $obj->title; |
|
| 5937 | - } |
|
| 5938 | - break; |
|
| 5939 | - default: |
|
| 5940 | - break; |
|
| 5941 | - } |
|
| 5942 | - |
|
| 5943 | - $row2 = $name_session; |
|
| 5944 | - if (!empty($coach_name)) { |
|
| 5945 | - $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
| 5946 | - } |
|
| 5947 | - $row[2] = $row2; |
|
| 5917 | + break; |
|
| 5918 | + case 'thematic': |
|
| 5919 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
| 5920 | + if (Database::num_rows($rs) > 0) { |
|
| 5921 | + $obj = Database::fetch_object($rs); |
|
| 5922 | + $row[5] = $obj->title; |
|
| 5923 | + } |
|
| 5924 | + break; |
|
| 5925 | + case 'thematic_advance': |
|
| 5926 | + $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
| 5927 | + if (Database::num_rows($rs) > 0) { |
|
| 5928 | + $obj = Database::fetch_object($rs); |
|
| 5929 | + $row[5] = $obj->content; |
|
| 5930 | + } |
|
| 5931 | + break; |
|
| 5932 | + case 'thematic_plan': |
|
| 5933 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
| 5934 | + if (Database::num_rows($rs) > 0) { |
|
| 5935 | + $obj = Database::fetch_object($rs); |
|
| 5936 | + $row[5] = $obj->title; |
|
| 5937 | + } |
|
| 5938 | + break; |
|
| 5939 | + default: |
|
| 5940 | + break; |
|
| 5941 | + } |
|
| 5942 | + |
|
| 5943 | + $row2 = $name_session; |
|
| 5944 | + if (!empty($coach_name)) { |
|
| 5945 | + $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
| 5946 | + } |
|
| 5947 | + $row[2] = $row2; |
|
| 5948 | 5948 | if (!empty($row['col3'])) { |
| 5949 | 5949 | $userInfo = api_get_user_info($row['user_id']); |
| 5950 | 5950 | |
@@ -5961,11 +5961,11 @@ discard block |
||
| 5961 | 5961 | $row[4] = $ip; |
| 5962 | 5962 | } |
| 5963 | 5963 | |
| 5964 | - $resources[] = $row; |
|
| 5965 | - } |
|
| 5966 | - } |
|
| 5964 | + $resources[] = $row; |
|
| 5965 | + } |
|
| 5966 | + } |
|
| 5967 | 5967 | |
| 5968 | - return $resources; |
|
| 5968 | + return $resources; |
|
| 5969 | 5969 | } |
| 5970 | 5970 | |
| 5971 | 5971 | /** |
@@ -5975,63 +5975,63 @@ discard block |
||
| 5975 | 5975 | */ |
| 5976 | 5976 | public static function get_tool_name_table($tool) |
| 5977 | 5977 | { |
| 5978 | - switch ($tool) { |
|
| 5979 | - case 'document': |
|
| 5980 | - $table_name = TABLE_DOCUMENT; |
|
| 5981 | - $link_tool = 'document/document.php'; |
|
| 5982 | - $id_tool = 'id'; |
|
| 5983 | - break; |
|
| 5984 | - case 'learnpath': |
|
| 5985 | - $table_name = TABLE_LP_MAIN; |
|
| 5986 | - $link_tool = 'newscorm/lp_controller.php'; |
|
| 5987 | - $id_tool = 'id'; |
|
| 5988 | - break; |
|
| 5989 | - case 'quiz': |
|
| 5990 | - $table_name = TABLE_QUIZ_TEST; |
|
| 5991 | - $link_tool = 'exercice/exercice.php'; |
|
| 5992 | - $id_tool = 'id'; |
|
| 5993 | - break; |
|
| 5994 | - case 'glossary': |
|
| 5995 | - $table_name = TABLE_GLOSSARY; |
|
| 5996 | - $link_tool = 'glossary/index.php'; |
|
| 5997 | - $id_tool = 'glossary_id'; |
|
| 5998 | - break; |
|
| 5999 | - case 'link': |
|
| 6000 | - $table_name = TABLE_LINK; |
|
| 6001 | - $link_tool = 'link/link.php'; |
|
| 6002 | - $id_tool = 'id'; |
|
| 6003 | - break; |
|
| 6004 | - case 'course_description': |
|
| 6005 | - $table_name = TABLE_COURSE_DESCRIPTION; |
|
| 6006 | - $link_tool = 'course_description/'; |
|
| 6007 | - $id_tool = 'id'; |
|
| 6008 | - break; |
|
| 6009 | - case 'announcement': |
|
| 6010 | - $table_name = TABLE_ANNOUNCEMENT; |
|
| 6011 | - $link_tool = 'announcements/announcements.php'; |
|
| 6012 | - $id_tool = 'id'; |
|
| 6013 | - break; |
|
| 6014 | - case 'thematic': |
|
| 6015 | - $table_name = TABLE_THEMATIC; |
|
| 6016 | - $link_tool = 'course_progress/index.php'; |
|
| 6017 | - $id_tool = 'id'; |
|
| 6018 | - break; |
|
| 6019 | - case 'thematic_advance': |
|
| 6020 | - $table_name = TABLE_THEMATIC_ADVANCE; |
|
| 6021 | - $link_tool = 'course_progress/index.php'; |
|
| 6022 | - $id_tool = 'id'; |
|
| 6023 | - break; |
|
| 6024 | - case 'thematic_plan': |
|
| 6025 | - $table_name = TABLE_THEMATIC_PLAN; |
|
| 6026 | - $link_tool = 'course_progress/index.php'; |
|
| 6027 | - $id_tool = 'id'; |
|
| 6028 | - break; |
|
| 6029 | - default: |
|
| 6030 | - $table_name = $tool; |
|
| 6031 | - break; |
|
| 6032 | - } |
|
| 6033 | - |
|
| 6034 | - return array( |
|
| 5978 | + switch ($tool) { |
|
| 5979 | + case 'document': |
|
| 5980 | + $table_name = TABLE_DOCUMENT; |
|
| 5981 | + $link_tool = 'document/document.php'; |
|
| 5982 | + $id_tool = 'id'; |
|
| 5983 | + break; |
|
| 5984 | + case 'learnpath': |
|
| 5985 | + $table_name = TABLE_LP_MAIN; |
|
| 5986 | + $link_tool = 'newscorm/lp_controller.php'; |
|
| 5987 | + $id_tool = 'id'; |
|
| 5988 | + break; |
|
| 5989 | + case 'quiz': |
|
| 5990 | + $table_name = TABLE_QUIZ_TEST; |
|
| 5991 | + $link_tool = 'exercice/exercice.php'; |
|
| 5992 | + $id_tool = 'id'; |
|
| 5993 | + break; |
|
| 5994 | + case 'glossary': |
|
| 5995 | + $table_name = TABLE_GLOSSARY; |
|
| 5996 | + $link_tool = 'glossary/index.php'; |
|
| 5997 | + $id_tool = 'glossary_id'; |
|
| 5998 | + break; |
|
| 5999 | + case 'link': |
|
| 6000 | + $table_name = TABLE_LINK; |
|
| 6001 | + $link_tool = 'link/link.php'; |
|
| 6002 | + $id_tool = 'id'; |
|
| 6003 | + break; |
|
| 6004 | + case 'course_description': |
|
| 6005 | + $table_name = TABLE_COURSE_DESCRIPTION; |
|
| 6006 | + $link_tool = 'course_description/'; |
|
| 6007 | + $id_tool = 'id'; |
|
| 6008 | + break; |
|
| 6009 | + case 'announcement': |
|
| 6010 | + $table_name = TABLE_ANNOUNCEMENT; |
|
| 6011 | + $link_tool = 'announcements/announcements.php'; |
|
| 6012 | + $id_tool = 'id'; |
|
| 6013 | + break; |
|
| 6014 | + case 'thematic': |
|
| 6015 | + $table_name = TABLE_THEMATIC; |
|
| 6016 | + $link_tool = 'course_progress/index.php'; |
|
| 6017 | + $id_tool = 'id'; |
|
| 6018 | + break; |
|
| 6019 | + case 'thematic_advance': |
|
| 6020 | + $table_name = TABLE_THEMATIC_ADVANCE; |
|
| 6021 | + $link_tool = 'course_progress/index.php'; |
|
| 6022 | + $id_tool = 'id'; |
|
| 6023 | + break; |
|
| 6024 | + case 'thematic_plan': |
|
| 6025 | + $table_name = TABLE_THEMATIC_PLAN; |
|
| 6026 | + $link_tool = 'course_progress/index.php'; |
|
| 6027 | + $id_tool = 'id'; |
|
| 6028 | + break; |
|
| 6029 | + default: |
|
| 6030 | + $table_name = $tool; |
|
| 6031 | + break; |
|
| 6032 | + } |
|
| 6033 | + |
|
| 6034 | + return array( |
|
| 6035 | 6035 | 'table_name' => $table_name, |
| 6036 | 6036 | 'link_tool' => $link_tool, |
| 6037 | 6037 | 'id_tool' => $id_tool |
@@ -6040,45 +6040,45 @@ discard block |
||
| 6040 | 6040 | |
| 6041 | 6041 | public static function display_additional_profile_fields() |
| 6042 | 6042 | { |
| 6043 | - // getting all the extra profile fields that are defined by the platform administrator |
|
| 6044 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
| 6045 | - |
|
| 6046 | - // creating the form |
|
| 6047 | - $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
| 6048 | - |
|
| 6049 | - // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
| 6050 | - // the information the users have entered or selected. |
|
| 6051 | - $return .= '<select name="additional_profile_field">'; |
|
| 6052 | - $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
| 6053 | - $extra_fields_to_show = 0; |
|
| 6054 | - foreach ($extra_fields as $key=>$field) { |
|
| 6055 | - // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
| 6056 | - if ($field[6]==1 && $field[8] == 1) { |
|
| 6057 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
| 6058 | - $selected = 'selected="selected"'; |
|
| 6059 | - } else { |
|
| 6060 | - $selected = ''; |
|
| 6061 | - } |
|
| 6062 | - $extra_fields_to_show++; |
|
| 6063 | - $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
| 6064 | - } |
|
| 6065 | - } |
|
| 6066 | - $return .= '</select>'; |
|
| 6067 | - |
|
| 6068 | - // the form elements for the $_GET parameters (because the form is passed through GET |
|
| 6069 | - foreach ($_GET as $key=>$value){ |
|
| 6070 | - if ($key <> 'additional_profile_field') { |
|
| 6071 | - $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
| 6072 | - } |
|
| 6073 | - } |
|
| 6074 | - // the submit button |
|
| 6075 | - $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
| 6076 | - $return .= '</form>'; |
|
| 6077 | - if ($extra_fields_to_show > 0) { |
|
| 6078 | - return $return; |
|
| 6079 | - } else { |
|
| 6080 | - return ''; |
|
| 6081 | - } |
|
| 6043 | + // getting all the extra profile fields that are defined by the platform administrator |
|
| 6044 | + $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
| 6045 | + |
|
| 6046 | + // creating the form |
|
| 6047 | + $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
| 6048 | + |
|
| 6049 | + // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
| 6050 | + // the information the users have entered or selected. |
|
| 6051 | + $return .= '<select name="additional_profile_field">'; |
|
| 6052 | + $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
| 6053 | + $extra_fields_to_show = 0; |
|
| 6054 | + foreach ($extra_fields as $key=>$field) { |
|
| 6055 | + // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
| 6056 | + if ($field[6]==1 && $field[8] == 1) { |
|
| 6057 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
| 6058 | + $selected = 'selected="selected"'; |
|
| 6059 | + } else { |
|
| 6060 | + $selected = ''; |
|
| 6061 | + } |
|
| 6062 | + $extra_fields_to_show++; |
|
| 6063 | + $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
| 6064 | + } |
|
| 6065 | + } |
|
| 6066 | + $return .= '</select>'; |
|
| 6067 | + |
|
| 6068 | + // the form elements for the $_GET parameters (because the form is passed through GET |
|
| 6069 | + foreach ($_GET as $key=>$value){ |
|
| 6070 | + if ($key <> 'additional_profile_field') { |
|
| 6071 | + $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
| 6072 | + } |
|
| 6073 | + } |
|
| 6074 | + // the submit button |
|
| 6075 | + $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
| 6076 | + $return .= '</form>'; |
|
| 6077 | + if ($extra_fields_to_show > 0) { |
|
| 6078 | + return $return; |
|
| 6079 | + } else { |
|
| 6080 | + return ''; |
|
| 6081 | + } |
|
| 6082 | 6082 | } |
| 6083 | 6083 | |
| 6084 | 6084 | /** |
@@ -6097,31 +6097,31 @@ discard block |
||
| 6097 | 6097 | */ |
| 6098 | 6098 | public static function get_addtional_profile_information_of_field_by_user($field_id, $users) |
| 6099 | 6099 | { |
| 6100 | - // Database table definition |
|
| 6101 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
| 6102 | - $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
| 6100 | + // Database table definition |
|
| 6101 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
| 6102 | + $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
| 6103 | 6103 | $extraField = Database::get_main_table(TABLE_EXTRA_FIELD); |
| 6104 | - $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
| 6105 | - |
|
| 6106 | - if (!empty($users)) { |
|
| 6107 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
| 6108 | - foreach($users as $user_id) { |
|
| 6109 | - $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
| 6110 | - $tag_list = array(); |
|
| 6111 | - foreach($user_result as $item) { |
|
| 6112 | - $tag_list[] = $item['tag']; |
|
| 6113 | - } |
|
| 6114 | - $return[$user_id][] = implode(', ',$tag_list); |
|
| 6115 | - } |
|
| 6116 | - } else { |
|
| 6117 | - $new_user_array = array(); |
|
| 6118 | - foreach ($users as $user_id) { |
|
| 6119 | - $new_user_array[]= "'".$user_id."'"; |
|
| 6120 | - } |
|
| 6121 | - $users = implode(',',$new_user_array); |
|
| 6104 | + $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
| 6105 | + |
|
| 6106 | + if (!empty($users)) { |
|
| 6107 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
| 6108 | + foreach($users as $user_id) { |
|
| 6109 | + $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
| 6110 | + $tag_list = array(); |
|
| 6111 | + foreach($user_result as $item) { |
|
| 6112 | + $tag_list[] = $item['tag']; |
|
| 6113 | + } |
|
| 6114 | + $return[$user_id][] = implode(', ',$tag_list); |
|
| 6115 | + } |
|
| 6116 | + } else { |
|
| 6117 | + $new_user_array = array(); |
|
| 6118 | + foreach ($users as $user_id) { |
|
| 6119 | + $new_user_array[]= "'".$user_id."'"; |
|
| 6120 | + } |
|
| 6121 | + $users = implode(',',$new_user_array); |
|
| 6122 | 6122 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
| 6123 | - // Selecting only the necessary information NOT ALL the user list |
|
| 6124 | - $sql = "SELECT user.user_id, v.value |
|
| 6123 | + // Selecting only the necessary information NOT ALL the user list |
|
| 6124 | + $sql = "SELECT user.user_id, v.value |
|
| 6125 | 6125 | FROM $table_user user |
| 6126 | 6126 | INNER JOIN $table_user_field_values v |
| 6127 | 6127 | ON (user.user_id = v.item_id) |
@@ -6132,27 +6132,27 @@ discard block |
||
| 6132 | 6132 | v.field_id=".intval($field_id)." AND |
| 6133 | 6133 | user.user_id IN ($users)"; |
| 6134 | 6134 | |
| 6135 | - $result = Database::query($sql); |
|
| 6136 | - while($row = Database::fetch_array($result)) { |
|
| 6137 | - // get option value for field type double select by id |
|
| 6138 | - if (!empty($row['value'])) { |
|
| 6139 | - if ($result_extra_field['field_type'] == |
|
| 6135 | + $result = Database::query($sql); |
|
| 6136 | + while($row = Database::fetch_array($result)) { |
|
| 6137 | + // get option value for field type double select by id |
|
| 6138 | + if (!empty($row['value'])) { |
|
| 6139 | + if ($result_extra_field['field_type'] == |
|
| 6140 | 6140 | ExtraField::FIELD_TYPE_DOUBLE_SELECT |
| 6141 | 6141 | ) { |
| 6142 | - $id_double_select = explode(';', $row['value']); |
|
| 6143 | - if (is_array($id_double_select)) { |
|
| 6144 | - $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
| 6145 | - $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
| 6146 | - $row['value'] = ($value1.';'.$value2); |
|
| 6147 | - } |
|
| 6148 | - } |
|
| 6149 | - } |
|
| 6150 | - // get other value from extra field |
|
| 6151 | - $return[$row['user_id']][] = $row['value']; |
|
| 6152 | - } |
|
| 6153 | - } |
|
| 6154 | - } |
|
| 6155 | - return $return; |
|
| 6142 | + $id_double_select = explode(';', $row['value']); |
|
| 6143 | + if (is_array($id_double_select)) { |
|
| 6144 | + $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
| 6145 | + $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
| 6146 | + $row['value'] = ($value1.';'.$value2); |
|
| 6147 | + } |
|
| 6148 | + } |
|
| 6149 | + } |
|
| 6150 | + // get other value from extra field |
|
| 6151 | + $return[$row['user_id']][] = $row['value']; |
|
| 6152 | + } |
|
| 6153 | + } |
|
| 6154 | + } |
|
| 6155 | + return $return; |
|
| 6156 | 6156 | } |
| 6157 | 6157 | |
| 6158 | 6158 | /** |
@@ -6161,18 +6161,18 @@ discard block |
||
| 6161 | 6161 | */ |
| 6162 | 6162 | public function count_student_in_course() |
| 6163 | 6163 | { |
| 6164 | - global $nbStudents; |
|
| 6165 | - return $nbStudents; |
|
| 6164 | + global $nbStudents; |
|
| 6165 | + return $nbStudents; |
|
| 6166 | 6166 | } |
| 6167 | 6167 | |
| 6168 | 6168 | public function sort_users($a, $b) |
| 6169 | 6169 | { |
| 6170 | - return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
| 6170 | + return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
| 6171 | 6171 | } |
| 6172 | 6172 | |
| 6173 | 6173 | public function sort_users_desc($a, $b) |
| 6174 | 6174 | { |
| 6175 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
| 6175 | + return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
| 6176 | 6176 | } |
| 6177 | 6177 | |
| 6178 | 6178 | /** |
@@ -6181,8 +6181,8 @@ discard block |
||
| 6181 | 6181 | */ |
| 6182 | 6182 | public static function get_number_of_users() |
| 6183 | 6183 | { |
| 6184 | - global $user_ids; |
|
| 6185 | - return count($user_ids); |
|
| 6184 | + global $user_ids; |
|
| 6185 | + return count($user_ids); |
|
| 6186 | 6186 | } |
| 6187 | 6187 | |
| 6188 | 6188 | /** |
@@ -6198,37 +6198,37 @@ discard block |
||
| 6198 | 6198 | { |
| 6199 | 6199 | global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order, $csv_content, $session_id; |
| 6200 | 6200 | |
| 6201 | - $course_code = Database::escape_string($course_code); |
|
| 6202 | - $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
| 6203 | - $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
| 6201 | + $course_code = Database::escape_string($course_code); |
|
| 6202 | + $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
| 6203 | + $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
| 6204 | 6204 | |
| 6205 | - $access_url_id = api_get_current_access_url_id(); |
|
| 6205 | + $access_url_id = api_get_current_access_url_id(); |
|
| 6206 | 6206 | |
| 6207 | - // get all users data from a course for sortable with limit |
|
| 6208 | - if (is_array($user_ids)) { |
|
| 6209 | - $user_ids = array_map('intval', $user_ids); |
|
| 6210 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
| 6211 | - } else { |
|
| 6212 | - $user_ids = intval($user_ids); |
|
| 6213 | - $condition_user = " WHERE user.user_id = $user_ids "; |
|
| 6214 | - } |
|
| 6207 | + // get all users data from a course for sortable with limit |
|
| 6208 | + if (is_array($user_ids)) { |
|
| 6209 | + $user_ids = array_map('intval', $user_ids); |
|
| 6210 | + $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
| 6211 | + } else { |
|
| 6212 | + $user_ids = intval($user_ids); |
|
| 6213 | + $condition_user = " WHERE user.user_id = $user_ids "; |
|
| 6214 | + } |
|
| 6215 | 6215 | |
| 6216 | - if (!empty($_GET['user_keyword'])) { |
|
| 6217 | - $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
| 6218 | - $condition_user .= " AND ( |
|
| 6216 | + if (!empty($_GET['user_keyword'])) { |
|
| 6217 | + $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
| 6218 | + $condition_user .= " AND ( |
|
| 6219 | 6219 | user.firstname LIKE '%".$keyword."%' OR |
| 6220 | 6220 | user.lastname LIKE '%".$keyword."%' OR |
| 6221 | 6221 | user.username LIKE '%".$keyword."%' OR |
| 6222 | 6222 | user.email LIKE '%".$keyword."%' |
| 6223 | 6223 | ) "; |
| 6224 | - } |
|
| 6224 | + } |
|
| 6225 | 6225 | |
| 6226 | 6226 | $url_table = null; |
| 6227 | 6227 | $url_condition = null; |
| 6228 | - if (api_is_multiple_url_enabled()) { |
|
| 6229 | - $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
| 6230 | - $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
| 6231 | - } |
|
| 6228 | + if (api_is_multiple_url_enabled()) { |
|
| 6229 | + $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
| 6230 | + $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
| 6231 | + } |
|
| 6232 | 6232 | |
| 6233 | 6233 | $invitedUsersCondition = ''; |
| 6234 | 6234 | |
@@ -6236,7 +6236,7 @@ discard block |
||
| 6236 | 6236 | $invitedUsersCondition = " AND user.status != " . INVITEE; |
| 6237 | 6237 | } |
| 6238 | 6238 | |
| 6239 | - $sql = "SELECT user.user_id as user_id, |
|
| 6239 | + $sql = "SELECT user.user_id as user_id, |
|
| 6240 | 6240 | user.official_code as col0, |
| 6241 | 6241 | user.lastname as col1, |
| 6242 | 6242 | user.firstname as col2, |
@@ -6244,17 +6244,17 @@ discard block |
||
| 6244 | 6244 | FROM $tbl_user as user $url_table |
| 6245 | 6245 | $condition_user $url_condition $invitedUsersCondition"; |
| 6246 | 6246 | |
| 6247 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
| 6248 | - $direction = 'ASC'; |
|
| 6249 | - } |
|
| 6247 | + if (!in_array($direction, array('ASC','DESC'))) { |
|
| 6248 | + $direction = 'ASC'; |
|
| 6249 | + } |
|
| 6250 | 6250 | |
| 6251 | - $column = intval($column); |
|
| 6251 | + $column = intval($column); |
|
| 6252 | 6252 | |
| 6253 | - $from = intval($from); |
|
| 6254 | - $number_of_items = intval($number_of_items); |
|
| 6253 | + $from = intval($from); |
|
| 6254 | + $number_of_items = intval($number_of_items); |
|
| 6255 | 6255 | |
| 6256 | - $sql .= " ORDER BY col$column $direction "; |
|
| 6257 | - $sql .= " LIMIT $from,$number_of_items"; |
|
| 6256 | + $sql .= " ORDER BY col$column $direction "; |
|
| 6257 | + $sql .= " LIMIT $from,$number_of_items"; |
|
| 6258 | 6258 | |
| 6259 | 6259 | $res = Database::query($sql); |
| 6260 | 6260 | $users = array(); |
@@ -6288,7 +6288,7 @@ discard block |
||
| 6288 | 6288 | } |
| 6289 | 6289 | } |
| 6290 | 6290 | |
| 6291 | - while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
| 6291 | + while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
| 6292 | 6292 | $courseInfo = api_get_course_info($course_code); |
| 6293 | 6293 | $courseId = $courseInfo['real_id']; |
| 6294 | 6294 | |
@@ -6319,10 +6319,10 @@ discard block |
||
| 6319 | 6319 | $session_id |
| 6320 | 6320 | ); |
| 6321 | 6321 | |
| 6322 | - if (empty($avg_student_progress)) { |
|
| 6322 | + if (empty($avg_student_progress)) { |
|
| 6323 | 6323 | $avg_student_progress = 0; |
| 6324 | - } |
|
| 6325 | - $user['average_progress'] = $avg_student_progress.'%'; |
|
| 6324 | + } |
|
| 6325 | + $user['average_progress'] = $avg_student_progress.'%'; |
|
| 6326 | 6326 | |
| 6327 | 6327 | $total_user_exercise = Tracking::get_exercise_student_progress( |
| 6328 | 6328 | $total_exercises, |
@@ -6342,11 +6342,11 @@ discard block |
||
| 6342 | 6342 | |
| 6343 | 6343 | $user['exercise_average_best_attempt'] = $total_user_exercise; |
| 6344 | 6344 | |
| 6345 | - if (is_numeric($avg_student_score)) { |
|
| 6346 | - $user['student_score'] = $avg_student_score.'%'; |
|
| 6347 | - } else { |
|
| 6348 | - $user['student_score'] = $avg_student_score; |
|
| 6349 | - } |
|
| 6345 | + if (is_numeric($avg_student_score)) { |
|
| 6346 | + $user['student_score'] = $avg_student_score.'%'; |
|
| 6347 | + } else { |
|
| 6348 | + $user['student_score'] = $avg_student_score; |
|
| 6349 | + } |
|
| 6350 | 6350 | |
| 6351 | 6351 | $user['count_assignments'] = Tracking::count_student_assignments( |
| 6352 | 6352 | $user['user_id'], |
@@ -6369,29 +6369,29 @@ discard block |
||
| 6369 | 6369 | $session_id |
| 6370 | 6370 | ); |
| 6371 | 6371 | |
| 6372 | - // we need to display an additional profile field |
|
| 6373 | - $user['additional'] = ''; |
|
| 6372 | + // we need to display an additional profile field |
|
| 6373 | + $user['additional'] = ''; |
|
| 6374 | 6374 | |
| 6375 | - if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
| 6376 | - if (isset($additional_user_profile_info[$user['user_id']]) && |
|
| 6375 | + if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
| 6376 | + if (isset($additional_user_profile_info[$user['user_id']]) && |
|
| 6377 | 6377 | is_array($additional_user_profile_info[$user['user_id']]) |
| 6378 | 6378 | ) { |
| 6379 | - $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
| 6380 | - } |
|
| 6381 | - } |
|
| 6379 | + $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
| 6380 | + } |
|
| 6381 | + } |
|
| 6382 | 6382 | |
| 6383 | 6383 | if (empty($session_id)) { |
| 6384 | 6384 | $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
| 6385 | 6385 | } |
| 6386 | 6386 | |
| 6387 | - $user['link'] = '<center> |
|
| 6387 | + $user['link'] = '<center> |
|
| 6388 | 6388 | <a href="../mySpace/myStudents.php?student='.$user['user_id'].'&details=true&course='.$course_code.'&origin=tracking_course&id_session='.$session_id.'"> |
| 6389 | 6389 | '.Display::return_icon('2rightarrow.png').' |
| 6390 | 6390 | </a> |
| 6391 | 6391 | </center>'; |
| 6392 | 6392 | |
| 6393 | - // store columns in array $users |
|
| 6394 | - $is_western_name_order = api_is_western_name_order(); |
|
| 6393 | + // store columns in array $users |
|
| 6394 | + $is_western_name_order = api_is_western_name_order(); |
|
| 6395 | 6395 | $user_row = array(); |
| 6396 | 6396 | $user_row[]= $user['official_code']; //0 |
| 6397 | 6397 | if ($is_western_name_order) { |
@@ -6424,21 +6424,21 @@ discard block |
||
| 6424 | 6424 | |
| 6425 | 6425 | $users[] = $user_row; |
| 6426 | 6426 | |
| 6427 | - if ($export_csv) { |
|
| 6428 | - if (empty($session_id)) { |
|
| 6427 | + if ($export_csv) { |
|
| 6428 | + if (empty($session_id)) { |
|
| 6429 | 6429 | $user_row = array_map('strip_tags', $user_row); |
| 6430 | - unset($user_row[14]); |
|
| 6431 | - unset($user_row[15]); |
|
| 6430 | + unset($user_row[14]); |
|
| 6431 | + unset($user_row[15]); |
|
| 6432 | 6432 | } else { |
| 6433 | 6433 | $user_row = array_map('strip_tags', $user_row); |
| 6434 | 6434 | unset($user_row[13]); |
| 6435 | 6435 | unset($user_row[14]); |
| 6436 | 6436 | } |
| 6437 | 6437 | |
| 6438 | - $csv_content[] = $user_row; |
|
| 6439 | - } |
|
| 6440 | - } |
|
| 6441 | - return $users; |
|
| 6438 | + $csv_content[] = $user_row; |
|
| 6439 | + } |
|
| 6440 | + } |
|
| 6441 | + return $users; |
|
| 6442 | 6442 | } |
| 6443 | 6443 | } |
| 6444 | 6444 | |
@@ -6456,18 +6456,18 @@ discard block |
||
| 6456 | 6456 | */ |
| 6457 | 6457 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
| 6458 | 6458 | { |
| 6459 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
| 6460 | - |
|
| 6461 | - // protected data |
|
| 6462 | - $user_id = intval($user_id); |
|
| 6463 | - $session_id = intval($session_id); |
|
| 6464 | - $course_id = Database::escape_string($course_id); |
|
| 6465 | - |
|
| 6466 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
| 6467 | - $tempView = $view; |
|
| 6468 | - if(substr($view,0,1) == '1') { |
|
| 6469 | - $new_view = substr_replace($view,'0',0,1); |
|
| 6470 | - echo " |
|
| 6459 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
| 6460 | + |
|
| 6461 | + // protected data |
|
| 6462 | + $user_id = intval($user_id); |
|
| 6463 | + $session_id = intval($session_id); |
|
| 6464 | + $course_id = Database::escape_string($course_id); |
|
| 6465 | + |
|
| 6466 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
| 6467 | + $tempView = $view; |
|
| 6468 | + if(substr($view,0,1) == '1') { |
|
| 6469 | + $new_view = substr_replace($view,'0',0,1); |
|
| 6470 | + echo " |
|
| 6471 | 6471 | <tr> |
| 6472 | 6472 | <td valign='top'> |
| 6473 | 6473 | <font color='#0000FF'>- </font>" . |
@@ -6475,9 +6475,9 @@ discard block |
||
| 6475 | 6475 | </td> |
| 6476 | 6476 | </tr> |
| 6477 | 6477 | "; |
| 6478 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
| 6478 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
| 6479 | 6479 | |
| 6480 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
| 6480 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
| 6481 | 6481 | FROM $track_access_table |
| 6482 | 6482 | WHERE access_user_id = $user_id |
| 6483 | 6483 | AND c_id = $course_id |
@@ -6485,11 +6485,11 @@ discard block |
||
| 6485 | 6485 | GROUP BY YEAR(access_date),MONTH(access_date) |
| 6486 | 6486 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
| 6487 | 6487 | |
| 6488 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6489 | - $results = getManyResults3Col($sql); |
|
| 6488 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6489 | + $results = getManyResults3Col($sql); |
|
| 6490 | 6490 | |
| 6491 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
| 6492 | - echo "<tr> |
|
| 6491 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
| 6492 | + echo "<tr> |
|
| 6493 | 6493 | <td class='secLine'> |
| 6494 | 6494 | ".get_lang('LoginsTitleMonthColumn')." |
| 6495 | 6495 | </td> |
@@ -6497,36 +6497,36 @@ discard block |
||
| 6497 | 6497 | ".get_lang('LoginsTitleCountColumn')." |
| 6498 | 6498 | </td> |
| 6499 | 6499 | </tr>"; |
| 6500 | - $total = 0; |
|
| 6501 | - if (is_array($results)) { |
|
| 6502 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6503 | - echo "<tr>"; |
|
| 6504 | - echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
| 6505 | - echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
| 6506 | - echo"</tr>"; |
|
| 6507 | - $total = $total + $results[$j][1]; |
|
| 6508 | - } |
|
| 6509 | - echo "<tr>"; |
|
| 6510 | - echo "<td>".get_lang('Total')."</td>"; |
|
| 6511 | - echo "<td align='right' class='content'>".$total."</td>"; |
|
| 6512 | - echo"</tr>"; |
|
| 6513 | - } else { |
|
| 6514 | - echo "<tr>"; |
|
| 6515 | - echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
| 6516 | - echo"</tr>"; |
|
| 6517 | - } |
|
| 6518 | - echo "</table>"; |
|
| 6519 | - echo "</td></tr>"; |
|
| 6520 | - } else { |
|
| 6521 | - $new_view = substr_replace($view,'1',0,1); |
|
| 6522 | - echo " |
|
| 6500 | + $total = 0; |
|
| 6501 | + if (is_array($results)) { |
|
| 6502 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6503 | + echo "<tr>"; |
|
| 6504 | + echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
| 6505 | + echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
| 6506 | + echo"</tr>"; |
|
| 6507 | + $total = $total + $results[$j][1]; |
|
| 6508 | + } |
|
| 6509 | + echo "<tr>"; |
|
| 6510 | + echo "<td>".get_lang('Total')."</td>"; |
|
| 6511 | + echo "<td align='right' class='content'>".$total."</td>"; |
|
| 6512 | + echo"</tr>"; |
|
| 6513 | + } else { |
|
| 6514 | + echo "<tr>"; |
|
| 6515 | + echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
| 6516 | + echo"</tr>"; |
|
| 6517 | + } |
|
| 6518 | + echo "</table>"; |
|
| 6519 | + echo "</td></tr>"; |
|
| 6520 | + } else { |
|
| 6521 | + $new_view = substr_replace($view,'1',0,1); |
|
| 6522 | + echo " |
|
| 6523 | 6523 | <tr> |
| 6524 | 6524 | <td valign='top'> |
| 6525 | 6525 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".$user_id."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LoginsAndAccessTools')."</a> |
| 6526 | 6526 | </td> |
| 6527 | 6527 | </tr> |
| 6528 | 6528 | "; |
| 6529 | - } |
|
| 6529 | + } |
|
| 6530 | 6530 | } |
| 6531 | 6531 | |
| 6532 | 6532 | /** |
@@ -6539,38 +6539,38 @@ discard block |
||
| 6539 | 6539 | */ |
| 6540 | 6540 | public function display_exercise_tracking_info($view, $user_id, $courseCode) |
| 6541 | 6541 | { |
| 6542 | - global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
| 6542 | + global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
| 6543 | 6543 | $courseId = api_get_course_int_id($courseCode); |
| 6544 | - if(substr($view,1,1) == '1') { |
|
| 6545 | - $new_view = substr_replace($view,'0',1,1); |
|
| 6546 | - echo "<tr> |
|
| 6544 | + if(substr($view,1,1) == '1') { |
|
| 6545 | + $new_view = substr_replace($view,'0',1,1); |
|
| 6546 | + echo "<tr> |
|
| 6547 | 6547 | <td valign='top'> |
| 6548 | 6548 | <font color='#0000FF'>- </font><b>".get_lang('ExercicesResults')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>] |
| 6549 | 6549 | </td> |
| 6550 | 6550 | </tr>"; |
| 6551 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
| 6551 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
| 6552 | 6552 | |
| 6553 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6553 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6554 | 6554 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
| 6555 | 6555 | WHERE te.c_id = $courseId |
| 6556 | 6556 | AND te.exe_user_id = ".intval($user_id)." |
| 6557 | 6557 | AND te.exe_exo_id = ce.id |
| 6558 | 6558 | ORDER BY ce.title ASC, te.exe_date ASC"; |
| 6559 | 6559 | |
| 6560 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6560 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6561 | 6561 | FROM $TBL_TRACK_HOTPOTATOES AS te |
| 6562 | 6562 | WHERE te.exe_user_id = '".intval($user_id)."' AND te.c_id = $courseId |
| 6563 | 6563 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
| 6564 | 6564 | |
| 6565 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
| 6565 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
| 6566 | 6566 | |
| 6567 | - $NoTestRes = 0; |
|
| 6568 | - $NoHPTestRes = 0; |
|
| 6567 | + $NoTestRes = 0; |
|
| 6568 | + $NoHPTestRes = 0; |
|
| 6569 | 6569 | |
| 6570 | - echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
| 6571 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
| 6572 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
| 6573 | - echo " |
|
| 6570 | + echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
| 6571 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
| 6572 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
| 6573 | + echo " |
|
| 6574 | 6574 | <tr bgcolor='#E6E6E6'> |
| 6575 | 6575 | <td> |
| 6576 | 6576 | ".get_lang('ExercicesTitleExerciceColumn')." |
@@ -6583,28 +6583,28 @@ discard block |
||
| 6583 | 6583 | </td> |
| 6584 | 6584 | </tr>"; |
| 6585 | 6585 | |
| 6586 | - if (is_array($results)) { |
|
| 6587 | - for($i = 0; $i < sizeof($results); $i++) { |
|
| 6588 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
| 6589 | - echo "<tr>\n"; |
|
| 6590 | - echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
| 6591 | - echo "<td class='content'>".$display_date."</td>\n"; |
|
| 6592 | - echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
| 6593 | - echo "</tr>\n"; |
|
| 6594 | - } |
|
| 6595 | - } else { |
|
| 6596 | - // istvan begin |
|
| 6597 | - $NoTestRes = 1; |
|
| 6598 | - } |
|
| 6599 | - |
|
| 6600 | - // The Result of Tests |
|
| 6601 | - if (is_array($hpresults)) { |
|
| 6602 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 6603 | - $title = GetQuizName($hpresults[$i][0],''); |
|
| 6604 | - if ($title == '') |
|
| 6605 | - $title = basename($hpresults[$i][0]); |
|
| 6606 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
| 6607 | - ?> |
|
| 6586 | + if (is_array($results)) { |
|
| 6587 | + for($i = 0; $i < sizeof($results); $i++) { |
|
| 6588 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
| 6589 | + echo "<tr>\n"; |
|
| 6590 | + echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
| 6591 | + echo "<td class='content'>".$display_date."</td>\n"; |
|
| 6592 | + echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
| 6593 | + echo "</tr>\n"; |
|
| 6594 | + } |
|
| 6595 | + } else { |
|
| 6596 | + // istvan begin |
|
| 6597 | + $NoTestRes = 1; |
|
| 6598 | + } |
|
| 6599 | + |
|
| 6600 | + // The Result of Tests |
|
| 6601 | + if (is_array($hpresults)) { |
|
| 6602 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 6603 | + $title = GetQuizName($hpresults[$i][0],''); |
|
| 6604 | + if ($title == '') |
|
| 6605 | + $title = basename($hpresults[$i][0]); |
|
| 6606 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
| 6607 | + ?> |
|
| 6608 | 6608 | <tr> |
| 6609 | 6609 | <td class="content"><?php echo $title; ?></td> |
| 6610 | 6610 | <td class="content" align="center"><?php echo $display_date; ?></td> |
@@ -6614,26 +6614,26 @@ discard block |
||
| 6614 | 6614 | |
| 6615 | 6615 | <?php |
| 6616 | 6616 | } |
| 6617 | - } else { |
|
| 6618 | - $NoHPTestRes = 1; |
|
| 6619 | - } |
|
| 6620 | - |
|
| 6621 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
| 6622 | - echo "<tr>\n"; |
|
| 6623 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
| 6624 | - echo "</tr>\n"; |
|
| 6625 | - } |
|
| 6626 | - echo "</table>"; |
|
| 6627 | - echo "</td>\n</tr>\n"; |
|
| 6628 | - } else { |
|
| 6629 | - $new_view = substr_replace($view,'1',1,1); |
|
| 6630 | - echo " |
|
| 6617 | + } else { |
|
| 6618 | + $NoHPTestRes = 1; |
|
| 6619 | + } |
|
| 6620 | + |
|
| 6621 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
| 6622 | + echo "<tr>\n"; |
|
| 6623 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
| 6624 | + echo "</tr>\n"; |
|
| 6625 | + } |
|
| 6626 | + echo "</table>"; |
|
| 6627 | + echo "</td>\n</tr>\n"; |
|
| 6628 | + } else { |
|
| 6629 | + $new_view = substr_replace($view,'1',1,1); |
|
| 6630 | + echo " |
|
| 6631 | 6631 | <tr> |
| 6632 | 6632 | <td valign='top'> |
| 6633 | 6633 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=$user_id&view=".$new_view."' class='specialLink'>".get_lang('ExercicesResults')."</a> |
| 6634 | 6634 | </td> |
| 6635 | 6635 | </tr>"; |
| 6636 | - } |
|
| 6636 | + } |
|
| 6637 | 6637 | } |
| 6638 | 6638 | |
| 6639 | 6639 | /** |
@@ -6642,27 +6642,27 @@ discard block |
||
| 6642 | 6642 | */ |
| 6643 | 6643 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
| 6644 | 6644 | { |
| 6645 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
| 6645 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
| 6646 | 6646 | $_course = api_get_course_info_by_id($course_id); |
| 6647 | 6647 | |
| 6648 | - if (substr($view,2,1) == '1') { |
|
| 6649 | - $new_view = substr_replace($view,'0',2,1); |
|
| 6650 | - echo "<tr> |
|
| 6648 | + if (substr($view,2,1) == '1') { |
|
| 6649 | + $new_view = substr_replace($view,'0',2,1); |
|
| 6650 | + echo "<tr> |
|
| 6651 | 6651 | <td valign='top'> |
| 6652 | 6652 | <font color='#0000FF'>- </font><b>".get_lang('WorkUploads')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>] |
| 6653 | 6653 | </td> |
| 6654 | 6654 | </tr>"; |
| 6655 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
| 6656 | - $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
| 6655 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
| 6656 | + $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
| 6657 | 6657 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
| 6658 | 6658 | WHERE u.upload_work_id = w.id |
| 6659 | 6659 | AND u.upload_user_id = '".intval($user_id)."' |
| 6660 | 6660 | AND u.c_id = '".intval($course_id)."' |
| 6661 | 6661 | ORDER BY u.upload_date DESC"; |
| 6662 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6663 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
| 6664 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
| 6665 | - echo "<tr> |
|
| 6662 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6663 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
| 6664 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
| 6665 | + echo "<tr> |
|
| 6666 | 6666 | <td class='secLine' width='40%'> |
| 6667 | 6667 | ".get_lang('WorkTitle')." |
| 6668 | 6668 | </td> |
@@ -6673,35 +6673,35 @@ discard block |
||
| 6673 | 6673 | ".get_lang('Date')." |
| 6674 | 6674 | </td> |
| 6675 | 6675 | </tr>"; |
| 6676 | - if (is_array($results)) { |
|
| 6677 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6678 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
| 6679 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
| 6680 | - echo "<tr>"; |
|
| 6681 | - echo "<td class='content'>" |
|
| 6682 | - ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
| 6683 | - ."</td>"; |
|
| 6684 | - echo "<td class='content'>".$results[$j][2]."</td>"; |
|
| 6685 | - echo "<td class='content'>".$beautifulDate."</td>"; |
|
| 6686 | - echo"</tr>"; |
|
| 6687 | - } |
|
| 6688 | - } else { |
|
| 6689 | - echo "<tr>"; |
|
| 6690 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
| 6691 | - echo"</tr>"; |
|
| 6692 | - } |
|
| 6693 | - echo "</table>"; |
|
| 6694 | - echo "</td></tr>"; |
|
| 6695 | - } else { |
|
| 6696 | - $new_view = substr_replace($view,'1',2,1); |
|
| 6697 | - echo " |
|
| 6676 | + if (is_array($results)) { |
|
| 6677 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6678 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
| 6679 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
| 6680 | + echo "<tr>"; |
|
| 6681 | + echo "<td class='content'>" |
|
| 6682 | + ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
| 6683 | + ."</td>"; |
|
| 6684 | + echo "<td class='content'>".$results[$j][2]."</td>"; |
|
| 6685 | + echo "<td class='content'>".$beautifulDate."</td>"; |
|
| 6686 | + echo"</tr>"; |
|
| 6687 | + } |
|
| 6688 | + } else { |
|
| 6689 | + echo "<tr>"; |
|
| 6690 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
| 6691 | + echo"</tr>"; |
|
| 6692 | + } |
|
| 6693 | + echo "</table>"; |
|
| 6694 | + echo "</td></tr>"; |
|
| 6695 | + } else { |
|
| 6696 | + $new_view = substr_replace($view,'1',2,1); |
|
| 6697 | + echo " |
|
| 6698 | 6698 | <tr> |
| 6699 | 6699 | <td valign='top'> |
| 6700 | 6700 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('WorkUploads')."</a> |
| 6701 | 6701 | </td> |
| 6702 | 6702 | </tr> |
| 6703 | 6703 | "; |
| 6704 | - } |
|
| 6704 | + } |
|
| 6705 | 6705 | } |
| 6706 | 6706 | |
| 6707 | 6707 | /** |
@@ -6710,55 +6710,55 @@ discard block |
||
| 6710 | 6710 | */ |
| 6711 | 6711 | public function display_links_tracking_info($view, $user_id, $courseCode) |
| 6712 | 6712 | { |
| 6713 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
| 6713 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
| 6714 | 6714 | $courseId = api_get_course_int_id($courseCode); |
| 6715 | - if (substr($view,3,1) == '1') { |
|
| 6716 | - $new_view = substr_replace($view,'0',3,1); |
|
| 6717 | - echo " |
|
| 6715 | + if (substr($view,3,1) == '1') { |
|
| 6716 | + $new_view = substr_replace($view,'0',3,1); |
|
| 6717 | + echo " |
|
| 6718 | 6718 | <tr> |
| 6719 | 6719 | <td valign='top'> |
| 6720 | 6720 | <font color='#0000FF'>- </font><b>".get_lang('LinksAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00010'>".get_lang('ExportAsCSV')."</a>] |
| 6721 | 6721 | </td> |
| 6722 | 6722 | </tr> |
| 6723 | 6723 | "; |
| 6724 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
| 6725 | - $sql = "SELECT cl.title, cl.url |
|
| 6724 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
| 6725 | + $sql = "SELECT cl.title, cl.url |
|
| 6726 | 6726 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
| 6727 | 6727 | WHERE sl.links_link_id = cl.id |
| 6728 | 6728 | AND sl.c_id = $courseId |
| 6729 | 6729 | AND sl.links_user_id = ".intval($user_id)." |
| 6730 | 6730 | GROUP BY cl.title, cl.url"; |
| 6731 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6732 | - $results = StatsUtils::getManyResults2Col($sql); |
|
| 6733 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
| 6734 | - echo "<tr> |
|
| 6731 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6732 | + $results = StatsUtils::getManyResults2Col($sql); |
|
| 6733 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
| 6734 | + echo "<tr> |
|
| 6735 | 6735 | <td class='secLine'> |
| 6736 | 6736 | ".get_lang('LinksTitleLinkColumn')." |
| 6737 | 6737 | </td> |
| 6738 | 6738 | </tr>"; |
| 6739 | - if (is_array($results)) { |
|
| 6740 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6741 | - echo "<tr>"; |
|
| 6742 | - echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
| 6743 | - echo"</tr>"; |
|
| 6744 | - } |
|
| 6745 | - } else { |
|
| 6746 | - echo "<tr>"; |
|
| 6747 | - echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
| 6748 | - echo"</tr>"; |
|
| 6749 | - } |
|
| 6750 | - echo "</table>"; |
|
| 6751 | - echo "</td></tr>"; |
|
| 6752 | - } else { |
|
| 6753 | - $new_view = substr_replace($view,'1',3,1); |
|
| 6754 | - echo " |
|
| 6739 | + if (is_array($results)) { |
|
| 6740 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6741 | + echo "<tr>"; |
|
| 6742 | + echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
| 6743 | + echo"</tr>"; |
|
| 6744 | + } |
|
| 6745 | + } else { |
|
| 6746 | + echo "<tr>"; |
|
| 6747 | + echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
| 6748 | + echo"</tr>"; |
|
| 6749 | + } |
|
| 6750 | + echo "</table>"; |
|
| 6751 | + echo "</td></tr>"; |
|
| 6752 | + } else { |
|
| 6753 | + $new_view = substr_replace($view,'1',3,1); |
|
| 6754 | + echo " |
|
| 6755 | 6755 | <tr> |
| 6756 | 6756 | <td valign='top'> |
| 6757 | 6757 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LinksAccess')."</a> |
| 6758 | 6758 | </td> |
| 6759 | 6759 | </tr> |
| 6760 | 6760 | "; |
| 6761 | - } |
|
| 6761 | + } |
|
| 6762 | 6762 | } |
| 6763 | 6763 | |
| 6764 | 6764 | /** |
@@ -6771,61 +6771,61 @@ discard block |
||
| 6771 | 6771 | */ |
| 6772 | 6772 | public static function display_document_tracking_info($view, $user_id, $course_code, $session_id = 0) |
| 6773 | 6773 | { |
| 6774 | - // protect data |
|
| 6774 | + // protect data |
|
| 6775 | 6775 | $user_id = intval($user_id); |
| 6776 | 6776 | $courseId = api_get_course_int_id($course_code); |
| 6777 | - $session_id = intval($session_id); |
|
| 6777 | + $session_id = intval($session_id); |
|
| 6778 | 6778 | |
| 6779 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
| 6780 | - if(substr($view,4,1) == '1') { |
|
| 6781 | - $new_view = substr_replace($view,'0',4,1); |
|
| 6782 | - echo " |
|
| 6779 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
| 6780 | + if(substr($view,4,1) == '1') { |
|
| 6781 | + $new_view = substr_replace($view,'0',4,1); |
|
| 6782 | + echo " |
|
| 6783 | 6783 | <tr> |
| 6784 | 6784 | <td valign='top'> |
| 6785 | 6785 | <font color='#0000FF'>- </font><b>".get_lang('DocumentsAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00001'>".get_lang('ExportAsCSV')."</a>] |
| 6786 | 6786 | </td> |
| 6787 | 6787 | </tr> |
| 6788 | 6788 | "; |
| 6789 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
| 6789 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
| 6790 | 6790 | |
| 6791 | - $sql = "SELECT down_doc_path |
|
| 6791 | + $sql = "SELECT down_doc_path |
|
| 6792 | 6792 | FROM $downloads_table |
| 6793 | 6793 | WHERE c_id = $courseId |
| 6794 | 6794 | AND down_user_id = $user_id |
| 6795 | 6795 | AND down_session_id = $session_id |
| 6796 | 6796 | GROUP BY down_doc_path"; |
| 6797 | 6797 | |
| 6798 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6799 | - $results = StatsUtils::getManyResults1Col($sql); |
|
| 6800 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
| 6801 | - echo "<tr> |
|
| 6798 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6799 | + $results = StatsUtils::getManyResults1Col($sql); |
|
| 6800 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
| 6801 | + echo "<tr> |
|
| 6802 | 6802 | <td class='secLine'> |
| 6803 | 6803 | ".get_lang('DocumentsTitleDocumentColumn')." |
| 6804 | 6804 | </td> |
| 6805 | 6805 | </tr>"; |
| 6806 | - if (is_array($results)) { |
|
| 6807 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6808 | - echo "<tr>"; |
|
| 6809 | - echo "<td class='content'>".$results[$j]."</td>"; |
|
| 6810 | - echo"</tr>"; |
|
| 6811 | - } |
|
| 6812 | - } else { |
|
| 6813 | - echo "<tr>"; |
|
| 6814 | - echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
| 6815 | - echo"</tr>"; |
|
| 6816 | - } |
|
| 6817 | - echo "</table>"; |
|
| 6818 | - echo "</td></tr>"; |
|
| 6819 | - } else { |
|
| 6820 | - $new_view = substr_replace($view,'1',4,1); |
|
| 6821 | - echo " |
|
| 6806 | + if (is_array($results)) { |
|
| 6807 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6808 | + echo "<tr>"; |
|
| 6809 | + echo "<td class='content'>".$results[$j]."</td>"; |
|
| 6810 | + echo"</tr>"; |
|
| 6811 | + } |
|
| 6812 | + } else { |
|
| 6813 | + echo "<tr>"; |
|
| 6814 | + echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
| 6815 | + echo"</tr>"; |
|
| 6816 | + } |
|
| 6817 | + echo "</table>"; |
|
| 6818 | + echo "</td></tr>"; |
|
| 6819 | + } else { |
|
| 6820 | + $new_view = substr_replace($view,'1',4,1); |
|
| 6821 | + echo " |
|
| 6822 | 6822 | <tr> |
| 6823 | 6823 | <td valign='top'> |
| 6824 | 6824 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('DocumentsAccess')."</a> |
| 6825 | 6825 | </td> |
| 6826 | 6826 | </tr> |
| 6827 | 6827 | "; |
| 6828 | - } |
|
| 6828 | + } |
|
| 6829 | 6829 | } |
| 6830 | 6830 | |
| 6831 | 6831 | /** |
@@ -6882,43 +6882,43 @@ discard block |
||
| 6882 | 6882 | */ |
| 6883 | 6883 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
| 6884 | 6884 | { |
| 6885 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
| 6886 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
| 6887 | - |
|
| 6888 | - // protected data |
|
| 6889 | - $user_id = intval($user_id); |
|
| 6890 | - $session_id = intval($session_id); |
|
| 6891 | - $course_id = intval($course_id); |
|
| 6892 | - |
|
| 6893 | - $tempView = $view; |
|
| 6894 | - if (substr($view,0,1) == '1') { |
|
| 6895 | - $new_view = substr_replace($view,'0',0,1); |
|
| 6896 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
| 6897 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
| 6885 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
| 6886 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
| 6887 | + |
|
| 6888 | + // protected data |
|
| 6889 | + $user_id = intval($user_id); |
|
| 6890 | + $session_id = intval($session_id); |
|
| 6891 | + $course_id = intval($course_id); |
|
| 6892 | + |
|
| 6893 | + $tempView = $view; |
|
| 6894 | + if (substr($view,0,1) == '1') { |
|
| 6895 | + $new_view = substr_replace($view,'0',0,1); |
|
| 6896 | + $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
| 6897 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
| 6898 | 6898 | FROM $track_access_table |
| 6899 | 6899 | WHERE access_user_id = $user_id |
| 6900 | 6900 | AND c_id = $course_id |
| 6901 | 6901 | AND access_session_id = $session_id |
| 6902 | 6902 | GROUP BY YEAR(access_date),MONTH(access_date) |
| 6903 | 6903 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
| 6904 | - //$results = getManyResults2Col($sql); |
|
| 6905 | - $results = getManyResults3Col($sql); |
|
| 6906 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
| 6907 | - $line=''; |
|
| 6908 | - $total = 0; |
|
| 6909 | - if (is_array($results)) { |
|
| 6910 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6911 | - $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
| 6912 | - $total = $total + $results[$j][1]; |
|
| 6913 | - } |
|
| 6914 | - $line .= get_lang('Total').";".$total."\n"; |
|
| 6915 | - } else { |
|
| 6916 | - $line= get_lang('NoResult')."</center></td>"; |
|
| 6917 | - } |
|
| 6918 | - } else { |
|
| 6919 | - $new_view = substr_replace($view,'1',0,1); |
|
| 6920 | - } |
|
| 6921 | - return array($title_line, $line); |
|
| 6904 | + //$results = getManyResults2Col($sql); |
|
| 6905 | + $results = getManyResults3Col($sql); |
|
| 6906 | + $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
| 6907 | + $line=''; |
|
| 6908 | + $total = 0; |
|
| 6909 | + if (is_array($results)) { |
|
| 6910 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6911 | + $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
| 6912 | + $total = $total + $results[$j][1]; |
|
| 6913 | + } |
|
| 6914 | + $line .= get_lang('Total').";".$total."\n"; |
|
| 6915 | + } else { |
|
| 6916 | + $line= get_lang('NoResult')."</center></td>"; |
|
| 6917 | + } |
|
| 6918 | + } else { |
|
| 6919 | + $new_view = substr_replace($view,'1',0,1); |
|
| 6920 | + } |
|
| 6921 | + return array($title_line, $line); |
|
| 6922 | 6922 | } |
| 6923 | 6923 | |
| 6924 | 6924 | /** |
@@ -6931,67 +6931,67 @@ discard block |
||
| 6931 | 6931 | */ |
| 6932 | 6932 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
| 6933 | 6933 | { |
| 6934 | - global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
| 6934 | + global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
| 6935 | 6935 | $courseId = api_get_course_int_id($courseCode); |
| 6936 | 6936 | $userId = intval($userId); |
| 6937 | - if (substr($view,1,1) == '1') { |
|
| 6938 | - $new_view = substr_replace($view,'0',1,1); |
|
| 6939 | - $title[1] = get_lang('ExercicesDetails'); |
|
| 6940 | - $line = ''; |
|
| 6941 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6937 | + if (substr($view,1,1) == '1') { |
|
| 6938 | + $new_view = substr_replace($view,'0',1,1); |
|
| 6939 | + $title[1] = get_lang('ExercicesDetails'); |
|
| 6940 | + $line = ''; |
|
| 6941 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6942 | 6942 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
| 6943 | 6943 | WHERE te.c_id = $courseId |
| 6944 | 6944 | AND te.exe_user_id = $userId |
| 6945 | 6945 | AND te.exe_exo_id = ce.id |
| 6946 | 6946 | ORDER BY ce.title ASC, te.exe_date ASC"; |
| 6947 | 6947 | |
| 6948 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6948 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6949 | 6949 | FROM $TABLETRACK_HOTPOTATOES AS te |
| 6950 | 6950 | WHERE te.exe_user_id = '$userId' AND te.c_id = $courseId |
| 6951 | 6951 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
| 6952 | 6952 | |
| 6953 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
| 6953 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
| 6954 | 6954 | |
| 6955 | - $NoTestRes = 0; |
|
| 6956 | - $NoHPTestRes = 0; |
|
| 6955 | + $NoTestRes = 0; |
|
| 6956 | + $NoHPTestRes = 0; |
|
| 6957 | 6957 | |
| 6958 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
| 6959 | - $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
| 6958 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
| 6959 | + $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
| 6960 | 6960 | |
| 6961 | - if (is_array($results)) { |
|
| 6962 | - for($i = 0; $i < sizeof($results); $i++) |
|
| 6963 | - { |
|
| 6964 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
| 6965 | - $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
| 6966 | - } |
|
| 6967 | - } else { |
|
| 6961 | + if (is_array($results)) { |
|
| 6962 | + for($i = 0; $i < sizeof($results); $i++) |
|
| 6963 | + { |
|
| 6964 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
| 6965 | + $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
| 6966 | + } |
|
| 6967 | + } else { |
|
| 6968 | 6968 | // istvan begin |
| 6969 | - $NoTestRes = 1; |
|
| 6970 | - } |
|
| 6971 | - |
|
| 6972 | - // The Result of Tests |
|
| 6973 | - if (is_array($hpresults)) { |
|
| 6974 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 6975 | - $title = GetQuizName($hpresults[$i][0],''); |
|
| 6976 | - |
|
| 6977 | - if ($title == '') |
|
| 6978 | - $title = basename($hpresults[$i][0]); |
|
| 6979 | - |
|
| 6980 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
| 6981 | - |
|
| 6982 | - $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
| 6983 | - } |
|
| 6984 | - } else { |
|
| 6985 | - $NoHPTestRes = 1; |
|
| 6986 | - } |
|
| 6987 | - |
|
| 6988 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
| 6989 | - $line=get_lang('NoResult'); |
|
| 6990 | - } |
|
| 6991 | - } else { |
|
| 6992 | - $new_view = substr_replace($view,'1',1,1); |
|
| 6993 | - } |
|
| 6994 | - return array($title_line, $line); |
|
| 6969 | + $NoTestRes = 1; |
|
| 6970 | + } |
|
| 6971 | + |
|
| 6972 | + // The Result of Tests |
|
| 6973 | + if (is_array($hpresults)) { |
|
| 6974 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 6975 | + $title = GetQuizName($hpresults[$i][0],''); |
|
| 6976 | + |
|
| 6977 | + if ($title == '') |
|
| 6978 | + $title = basename($hpresults[$i][0]); |
|
| 6979 | + |
|
| 6980 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
| 6981 | + |
|
| 6982 | + $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
| 6983 | + } |
|
| 6984 | + } else { |
|
| 6985 | + $NoHPTestRes = 1; |
|
| 6986 | + } |
|
| 6987 | + |
|
| 6988 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
| 6989 | + $line=get_lang('NoResult'); |
|
| 6990 | + } |
|
| 6991 | + } else { |
|
| 6992 | + $new_view = substr_replace($view,'1',1,1); |
|
| 6993 | + } |
|
| 6994 | + return array($title_line, $line); |
|
| 6995 | 6995 | } |
| 6996 | 6996 | |
| 6997 | 6997 | /** |
@@ -7000,37 +7000,37 @@ discard block |
||
| 7000 | 7000 | */ |
| 7001 | 7001 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
| 7002 | 7002 | { |
| 7003 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
| 7003 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
| 7004 | 7004 | $_course = api_get_course_info(); |
| 7005 | 7005 | $user_id = intval($user_id); |
| 7006 | 7006 | $course_id = intval($course_id); |
| 7007 | 7007 | |
| 7008 | - if (substr($view,2,1) == '1') { |
|
| 7009 | - $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
| 7008 | + if (substr($view,2,1) == '1') { |
|
| 7009 | + $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
| 7010 | 7010 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
| 7011 | 7011 | WHERE |
| 7012 | 7012 | u.upload_work_id = w.id AND |
| 7013 | 7013 | u.upload_user_id = '$user_id' AND |
| 7014 | 7014 | u.c_id = '$course_id' |
| 7015 | 7015 | ORDER BY u.upload_date DESC"; |
| 7016 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
| 7017 | - |
|
| 7018 | - $title[1]=get_lang('WorksDetails'); |
|
| 7019 | - $line=''; |
|
| 7020 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
| 7021 | - |
|
| 7022 | - if (is_array($results)) { |
|
| 7023 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 7024 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
| 7025 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
| 7026 | - $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
| 7027 | - } |
|
| 7028 | - |
|
| 7029 | - } else { |
|
| 7030 | - $line= get_lang('NoResult'); |
|
| 7031 | - } |
|
| 7032 | - } |
|
| 7033 | - return array($title_line, $line); |
|
| 7016 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
| 7017 | + |
|
| 7018 | + $title[1]=get_lang('WorksDetails'); |
|
| 7019 | + $line=''; |
|
| 7020 | + $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
| 7021 | + |
|
| 7022 | + if (is_array($results)) { |
|
| 7023 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
| 7024 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
| 7025 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
| 7026 | + $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
| 7027 | + } |
|
| 7028 | + |
|
| 7029 | + } else { |
|
| 7030 | + $line= get_lang('NoResult'); |
|
| 7031 | + } |
|
| 7032 | + } |
|
| 7033 | + return array($title_line, $line); |
|
| 7034 | 7034 | } |
| 7035 | 7035 | |
| 7036 | 7036 | /** |
@@ -7039,32 +7039,32 @@ discard block |
||
| 7039 | 7039 | */ |
| 7040 | 7040 | public function display_links_tracking_info($view, $userId, $courseCode) |
| 7041 | 7041 | { |
| 7042 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
| 7042 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
| 7043 | 7043 | $courseId = api_get_course_int_id($courseCode); |
| 7044 | 7044 | $userId = intval($userId); |
| 7045 | 7045 | $line = null; |
| 7046 | - if (substr($view,3,1) == '1') { |
|
| 7047 | - $new_view = substr_replace($view,'0',3,1); |
|
| 7048 | - $title[1]=get_lang('LinksDetails'); |
|
| 7049 | - $sql = "SELECT cl.title, cl.url |
|
| 7046 | + if (substr($view,3,1) == '1') { |
|
| 7047 | + $new_view = substr_replace($view,'0',3,1); |
|
| 7048 | + $title[1]=get_lang('LinksDetails'); |
|
| 7049 | + $sql = "SELECT cl.title, cl.url |
|
| 7050 | 7050 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
| 7051 | 7051 | WHERE sl.links_link_id = cl.id |
| 7052 | 7052 | AND sl.c_id = $courseId |
| 7053 | 7053 | AND sl.links_user_id = $userId |
| 7054 | 7054 | GROUP BY cl.title, cl.url"; |
| 7055 | - $results = StatsUtils::getManyResults2Col($sql); |
|
| 7056 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
| 7057 | - if (is_array($results)) { |
|
| 7058 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
| 7059 | - $line .= $results[$j][0]."\n"; |
|
| 7060 | - } |
|
| 7061 | - } else { |
|
| 7062 | - $line=get_lang('NoResult'); |
|
| 7063 | - } |
|
| 7064 | - } else { |
|
| 7065 | - $new_view = substr_replace($view,'1',3,1); |
|
| 7066 | - } |
|
| 7067 | - return array($title_line, $line); |
|
| 7055 | + $results = StatsUtils::getManyResults2Col($sql); |
|
| 7056 | + $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
| 7057 | + if (is_array($results)) { |
|
| 7058 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
| 7059 | + $line .= $results[$j][0]."\n"; |
|
| 7060 | + } |
|
| 7061 | + } else { |
|
| 7062 | + $line=get_lang('NoResult'); |
|
| 7063 | + } |
|
| 7064 | + } else { |
|
| 7065 | + $new_view = substr_replace($view,'1',3,1); |
|
| 7066 | + } |
|
| 7067 | + return array($title_line, $line); |
|
| 7068 | 7068 | } |
| 7069 | 7069 | |
| 7070 | 7070 | /** |
@@ -7077,38 +7077,38 @@ discard block |
||
| 7077 | 7077 | */ |
| 7078 | 7078 | public function display_document_tracking_info($view, $user_id, $courseCode, $session_id = 0) |
| 7079 | 7079 | { |
| 7080 | - // protect data |
|
| 7081 | - $user_id = intval($user_id); |
|
| 7080 | + // protect data |
|
| 7081 | + $user_id = intval($user_id); |
|
| 7082 | 7082 | $courseId = api_get_course_int_id($courseCode); |
| 7083 | - $session_id = intval($session_id); |
|
| 7083 | + $session_id = intval($session_id); |
|
| 7084 | 7084 | |
| 7085 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
| 7085 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
| 7086 | 7086 | |
| 7087 | - if (substr($view,4,1) == '1') { |
|
| 7088 | - $new_view = substr_replace($view,'0',4,1); |
|
| 7089 | - $title[1]= get_lang('DocumentsDetails'); |
|
| 7087 | + if (substr($view,4,1) == '1') { |
|
| 7088 | + $new_view = substr_replace($view,'0',4,1); |
|
| 7089 | + $title[1]= get_lang('DocumentsDetails'); |
|
| 7090 | 7090 | |
| 7091 | - $sql = "SELECT down_doc_path |
|
| 7091 | + $sql = "SELECT down_doc_path |
|
| 7092 | 7092 | FROM $downloads_table |
| 7093 | 7093 | WHERE c_id = $courseId |
| 7094 | 7094 | AND down_user_id = $user_id |
| 7095 | 7095 | AND down_session_id = $session_id |
| 7096 | 7096 | GROUP BY down_doc_path"; |
| 7097 | 7097 | |
| 7098 | - $results = StatsUtils::getManyResults1Col($sql); |
|
| 7099 | - $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
| 7098 | + $results = StatsUtils::getManyResults1Col($sql); |
|
| 7099 | + $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
| 7100 | 7100 | $line = null; |
| 7101 | - if (is_array($results)) { |
|
| 7102 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
| 7103 | - $line .= $results[$j]."\n"; |
|
| 7104 | - } |
|
| 7105 | - } else { |
|
| 7106 | - $line = get_lang('NoResult'); |
|
| 7107 | - } |
|
| 7108 | - } else { |
|
| 7109 | - $new_view = substr_replace($view,'1',4,1); |
|
| 7110 | - } |
|
| 7111 | - return array($title_line, $line); |
|
| 7101 | + if (is_array($results)) { |
|
| 7102 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
| 7103 | + $line .= $results[$j]."\n"; |
|
| 7104 | + } |
|
| 7105 | + } else { |
|
| 7106 | + $line = get_lang('NoResult'); |
|
| 7107 | + } |
|
| 7108 | + } else { |
|
| 7109 | + $new_view = substr_replace($view,'1',4,1); |
|
| 7110 | + } |
|
| 7111 | + return array($title_line, $line); |
|
| 7112 | 7112 | } |
| 7113 | 7113 | |
| 7114 | 7114 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $extendedAttempt = null, |
| 112 | 112 | $extendedAll = null, |
| 113 | 113 | $type = 'classic', |
| 114 | - $allowExtend = true |
|
| 114 | + $allowExtend = true |
|
| 115 | 115 | ) { |
| 116 | 116 | if (empty($courseInfo) || empty($lp_id)) { |
| 117 | 117 | return null; |
@@ -135,22 +135,22 @@ discard block |
||
| 135 | 135 | $extend_all = 0; |
| 136 | 136 | |
| 137 | 137 | if ($origin == 'tracking') { |
| 138 | - $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin; |
|
| 138 | + $url_suffix = '&session_id='.$session_id.'&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.$lp_id.'&origin='.$origin; |
|
| 139 | 139 | } else { |
| 140 | - $url_suffix = '&lp_id=' . $lp_id; |
|
| 140 | + $url_suffix = '&lp_id='.$lp_id; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | if (!empty($extendedAll)) { |
| 144 | 144 | $extend_all_link = Display::url( |
| 145 | 145 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
| 146 | - api_get_self() . '?action=stats' . $url_suffix |
|
| 146 | + api_get_self().'?action=stats'.$url_suffix |
|
| 147 | 147 | ); |
| 148 | 148 | |
| 149 | 149 | $extend_all = 1; |
| 150 | 150 | } else { |
| 151 | 151 | $extend_all_link = Display::url( |
| 152 | 152 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')), |
| 153 | - api_get_self() . '?action=stats&extend_all=1' . $url_suffix |
|
| 153 | + api_get_self().'?action=stats&extend_all=1'.$url_suffix |
|
| 154 | 154 | ); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -162,24 +162,24 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | $actionColumn = null; |
| 164 | 164 | if ($type == 'classic') { |
| 165 | - $actionColumn = ' <th>' . get_lang('Actions') . '</th>'; |
|
| 165 | + $actionColumn = ' <th>'.get_lang('Actions').'</th>'; |
|
| 166 | 166 | } |
| 167 | 167 | $output .= '<div class="table-responsive">'; |
| 168 | 168 | $output .= '<table class="table tracking"> |
| 169 | 169 | <thead> |
| 170 | 170 | <tr class="table-header"> |
| 171 | - <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ') . '</th> |
|
| 171 | + <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ').'</th> |
|
| 172 | 172 | <th colspan="4"> |
| 173 | - ' . get_lang('ScormLessonTitle') .' |
|
| 173 | + ' . get_lang('ScormLessonTitle').' |
|
| 174 | 174 | </th> |
| 175 | 175 | <th colspan="2"> |
| 176 | - ' . get_lang('ScormStatus') . ' |
|
| 176 | + ' . get_lang('ScormStatus').' |
|
| 177 | 177 | </th> |
| 178 | 178 | <th colspan="2"> |
| 179 | - ' . get_lang('ScormScore') . ' |
|
| 179 | + ' . get_lang('ScormScore').' |
|
| 180 | 180 | </th> |
| 181 | 181 | <th colspan="2"> |
| 182 | - ' . get_lang('ScormTime') . ' |
|
| 182 | + ' . get_lang('ScormTime').' |
|
| 183 | 183 | </th> |
| 184 | 184 | '.$actionColumn.' |
| 185 | 185 | </tr> |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | // Prepare statement to go through each attempt. |
| 243 | 243 | $viewCondition = null; |
| 244 | 244 | if (!empty($view)) { |
| 245 | - $viewCondition = " AND v.view_count = $view "; |
|
| 245 | + $viewCondition = " AND v.view_count = $view "; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | $sql = "SELECT |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | FROM $TBL_QUIZ |
| 291 | 291 | WHERE |
| 292 | 292 | c_id = $course_id AND |
| 293 | - id ='" . $my_path . "'"; |
|
| 293 | + id ='".$my_path."'"; |
|
| 294 | 294 | $res_result_disabled = Database::query($sql); |
| 295 | 295 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
| 296 | 296 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | if (!empty($inter_num)) { |
| 313 | 313 | $extend_link = Display::url( |
| 314 | 314 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
| 315 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
| 315 | + api_get_self().'?action=stats&fold_id='.$my_item_id.$url_suffix |
|
| 316 | 316 | ); |
| 317 | 317 | } |
| 318 | 318 | $title = $row['mytitle']; |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | $action = null; |
| 332 | 332 | if ($type == 'classic') { |
| 333 | - $action = '<td></td>'; |
|
| 333 | + $action = '<td></td>'; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | if (in_array($row['item_type'], $chapterTypes)) { |
@@ -374,13 +374,13 @@ discard block |
||
| 374 | 374 | $extend_this_attempt = 1; |
| 375 | 375 | $extend_attempt_link = Display::url( |
| 376 | 376 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
| 377 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
| 377 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
| 378 | 378 | ); |
| 379 | 379 | } else { // Same case if fold_attempt_id is set, so not implemented explicitly. |
| 380 | 380 | // The extend button for this attempt has not been clicked. |
| 381 | 381 | $extend_attempt_link = Display::url( |
| 382 | 382 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
| 383 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
| 383 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
| 384 | 384 | ); |
| 385 | 385 | } |
| 386 | 386 | } |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | // Remove "NaN" if any (@todo: locate the source of these NaN) |
| 416 | - $time = str_replace('NaN', '00' . $h . '00\'00"', $time); |
|
| 416 | + $time = str_replace('NaN', '00'.$h.'00\'00"', $time); |
|
| 417 | 417 | |
| 418 | 418 | if ($row['item_type'] != 'dokeos_chapter') { |
| 419 | 419 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
@@ -441,13 +441,13 @@ discard block |
||
| 441 | 441 | $action = '<td></td>'; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - $output .= '<tr class="' . $oddclass . '"> |
|
| 444 | + $output .= '<tr class="'.$oddclass.'"> |
|
| 445 | 445 | <td></td> |
| 446 | - <td>' . $extend_attempt_link . '</td> |
|
| 447 | - <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td> |
|
| 448 | - <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td> |
|
| 449 | - <td colspan="2">' . $view_score . '</td> |
|
| 450 | - <td colspan="2">' . $time . '</td> |
|
| 446 | + <td>' . $extend_attempt_link.'</td> |
|
| 447 | + <td colspan="3">' . get_lang('Attempt').' '.$attemptCount.'</td> |
|
| 448 | + <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type).'</td> |
|
| 449 | + <td colspan="2">' . $view_score.'</td> |
|
| 450 | + <td colspan="2">' . $time.'</td> |
|
| 451 | 451 | '.$action.' |
| 452 | 452 | </tr>'; |
| 453 | 453 | $attemptCount++; |
@@ -460,10 +460,10 @@ discard block |
||
| 460 | 460 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
| 461 | 461 | $temp[] = '/'; |
| 462 | 462 | } else { |
| 463 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
| 463 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
| 464 | 464 | } |
| 465 | 465 | } else { |
| 466 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
| 466 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
| 467 | 467 | } |
| 468 | 468 | $temp[] = $time; |
| 469 | 469 | $csv_content[] = $temp; |
@@ -500,13 +500,13 @@ discard block |
||
| 500 | 500 | <td></td> |
| 501 | 501 | <td></td> |
| 502 | 502 | <td></td> |
| 503 | - <td>'.$interaction['order_id'] . '</td> |
|
| 504 | - <td>'.$interaction['id'] . '</td> |
|
| 503 | + <td>'.$interaction['order_id'].'</td> |
|
| 504 | + <td>'.$interaction['id'].'</td> |
|
| 505 | 505 | <td colspan="2">' . $interaction['type'].'</td> |
| 506 | - <td>'.$student_response . '</td> |
|
| 507 | - <td>'.$interaction['result'] . '</td> |
|
| 508 | - <td>'.$interaction['latency'] . '</td> |
|
| 509 | - <td>'.$interaction['time'] . '</td> |
|
| 506 | + <td>'.$student_response.'</td> |
|
| 507 | + <td>'.$interaction['result'].'</td> |
|
| 508 | + <td>'.$interaction['latency'].'</td> |
|
| 509 | + <td>'.$interaction['time'].'</td> |
|
| 510 | 510 | '.$action.' |
| 511 | 511 | </tr>'; |
| 512 | 512 | $counter++; |
@@ -523,12 +523,12 @@ discard block |
||
| 523 | 523 | <td></td> |
| 524 | 524 | <td></td> |
| 525 | 525 | <td></td> |
| 526 | - <td>' . $interaction['order_id'] . '</td> |
|
| 527 | - <td colspan="2">' . $interaction['objective_id'] . '</td> |
|
| 528 | - <td colspan="2">' . $interaction['status'] .'</td> |
|
| 529 | - <td>' . $interaction['score_raw'] . '</td> |
|
| 530 | - <td>' . $interaction['score_max'] . '</td> |
|
| 531 | - <td>' . $interaction['score_min'] . '</td> |
|
| 526 | + <td>' . $interaction['order_id'].'</td> |
|
| 527 | + <td colspan="2">' . $interaction['objective_id'].'</td> |
|
| 528 | + <td colspan="2">' . $interaction['status'].'</td> |
|
| 529 | + <td>' . $interaction['score_raw'].'</td> |
|
| 530 | + <td>' . $interaction['score_max'].'</td> |
|
| 531 | + <td>' . $interaction['score_min'].'</td> |
|
| 532 | 532 | '.$action.' |
| 533 | 533 | </tr>'; |
| 534 | 534 | $counter++; |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | $my_path = Database::escape_string($my_path); |
| 552 | 552 | $sql = "SELECT results_disabled |
| 553 | 553 | FROM $TBL_QUIZ |
| 554 | - WHERE c_id = $course_id AND id ='" . $my_path . "'"; |
|
| 554 | + WHERE c_id = $course_id AND id ='".$my_path."'"; |
|
| 555 | 555 | $res_result_disabled = Database::query($sql); |
| 556 | 556 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
| 557 | 557 | |
@@ -575,14 +575,14 @@ discard block |
||
| 575 | 575 | $extend_this_attempt = 1; |
| 576 | 576 | $extend_attempt_link = Display::url( |
| 577 | 577 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
| 578 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
| 578 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
| 579 | 579 | ); |
| 580 | 580 | } else { |
| 581 | 581 | // Same case if fold_attempt_id is set, so not implemented explicitly. |
| 582 | 582 | // The extend button for this attempt has not been clicked. |
| 583 | 583 | $extend_attempt_link = Display::url( |
| 584 | 584 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
| 585 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
| 585 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
| 586 | 586 | ); |
| 587 | 587 | } |
| 588 | 588 | } |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | if ($inter_num > 1) { |
| 598 | 598 | $extend_link = Display::url( |
| 599 | 599 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
| 600 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
| 600 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
| 601 | 601 | ); |
| 602 | 602 | } |
| 603 | 603 | |
@@ -613,15 +613,15 @@ discard block |
||
| 613 | 613 | |
| 614 | 614 | // Selecting the exe_id from stats attempts tables in order to look the max score value. |
| 615 | 615 | |
| 616 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
| 616 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
| 617 | 617 | WHERE |
| 618 | - exe_exo_id="' . $row['path'] . '" AND |
|
| 619 | - exe_user_id="' . $user_id . '" AND |
|
| 620 | - orig_lp_id = "' . $lp_id . '" AND |
|
| 621 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
| 622 | - c_id = ' . $course_id . ' AND |
|
| 618 | + exe_exo_id="' . $row['path'].'" AND |
|
| 619 | + exe_user_id="' . $user_id.'" AND |
|
| 620 | + orig_lp_id = "' . $lp_id.'" AND |
|
| 621 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
| 622 | + c_id = ' . $course_id.' AND |
|
| 623 | 623 | status <> "incomplete" AND |
| 624 | - session_id = ' . $session_id . ' |
|
| 624 | + session_id = ' . $session_id.' |
|
| 625 | 625 | ORDER BY exe_date DESC |
| 626 | 626 | LIMIT 1'; |
| 627 | 627 | |
@@ -652,8 +652,8 @@ discard block |
||
| 652 | 652 | FROM $TBL_LP_ITEM_VIEW |
| 653 | 653 | WHERE |
| 654 | 654 | c_id = $course_id AND |
| 655 | - lp_item_id = '" . (int) $my_id . "' AND |
|
| 656 | - lp_view_id = '" . (int) $my_lp_view_id . "' |
|
| 655 | + lp_item_id = '".(int) $my_id."' AND |
|
| 656 | + lp_view_id = '" . (int) $my_lp_view_id."' |
|
| 657 | 657 | ORDER BY view_count DESC limit 1"; |
| 658 | 658 | $res_score = Database::query($sql); |
| 659 | 659 | $row_score = Database::fetch_array($res_score); |
@@ -662,8 +662,8 @@ discard block |
||
| 662 | 662 | FROM $TBL_LP_ITEM_VIEW |
| 663 | 663 | WHERE |
| 664 | 664 | c_id = $course_id AND |
| 665 | - lp_item_id = '" . (int) $my_id . "' AND |
|
| 666 | - lp_view_id = '" . (int) $my_lp_view_id . "'"; |
|
| 665 | + lp_item_id = '".(int) $my_id."' AND |
|
| 666 | + lp_view_id = '" . (int) $my_lp_view_id."'"; |
|
| 667 | 667 | $res_time = Database::query($sql); |
| 668 | 668 | $row_time = Database::fetch_array($res_time); |
| 669 | 669 | |
@@ -722,16 +722,16 @@ discard block |
||
| 722 | 722 | } else { |
| 723 | 723 | $correct_test_link = '-'; |
| 724 | 724 | if ($row['item_type'] == 'quiz') { |
| 725 | - $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin; |
|
| 726 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
| 725 | + $my_url_suffix = '&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.intval($row['mylpid']).'&origin='.$origin; |
|
| 726 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
| 727 | 727 | WHERE |
| 728 | - exe_exo_id="' . $row['path'] . '" AND |
|
| 729 | - exe_user_id="' . $user_id . '" AND |
|
| 730 | - orig_lp_id = "' . $lp_id . '" AND |
|
| 731 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
| 732 | - c_id = ' . $course_id . ' AND |
|
| 728 | + exe_exo_id="' . $row['path'].'" AND |
|
| 729 | + exe_user_id="' . $user_id.'" AND |
|
| 730 | + orig_lp_id = "' . $lp_id.'" AND |
|
| 731 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
| 732 | + c_id = ' . $course_id.' AND |
|
| 733 | 733 | status <> "incomplete" AND |
| 734 | - session_id = ' . $session_id . ' |
|
| 734 | + session_id = ' . $session_id.' |
|
| 735 | 735 | ORDER BY exe_date DESC '; |
| 736 | 736 | |
| 737 | 737 | $resultLastAttempt = Database::query($sql); |
@@ -743,12 +743,12 @@ discard block |
||
| 743 | 743 | ) { |
| 744 | 744 | $correct_test_link = Display::url( |
| 745 | 745 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
| 746 | - api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
| 746 | + api_get_self().'?action=stats'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
| 747 | 747 | ); |
| 748 | 748 | } else { |
| 749 | 749 | $correct_test_link = Display::url( |
| 750 | 750 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')), |
| 751 | - api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
| 751 | + api_get_self().'?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
| 752 | 752 | ); |
| 753 | 753 | } |
| 754 | 754 | } |
@@ -758,14 +758,14 @@ discard block |
||
| 758 | 758 | |
| 759 | 759 | $action = null; |
| 760 | 760 | if ($type == 'classic') { |
| 761 | - $action = '<td>' . $correct_test_link . '</td>'; |
|
| 761 | + $action = '<td>'.$correct_test_link.'</td>'; |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | if ($lp_id == $my_lp_id && false) { |
| 765 | 765 | |
| 766 | - $output .= '<tr class =' . $oddclass . '> |
|
| 767 | - <td>' . $extend_link . '</td> |
|
| 768 | - <td colspan="4">' . $title . '</td> |
|
| 766 | + $output .= '<tr class ='.$oddclass.'> |
|
| 767 | + <td>' . $extend_link.'</td> |
|
| 768 | + <td colspan="4">' . $title.'</td> |
|
| 769 | 769 | <td colspan="2"> </td> |
| 770 | 770 | <td colspan="2"> </td> |
| 771 | 771 | <td colspan="2"> </td> |
@@ -790,13 +790,13 @@ discard block |
||
| 790 | 790 | $scoreItem .= ExerciseLib::show_score($score, $maxscore, false); |
| 791 | 791 | } |
| 792 | 792 | } else { |
| 793 | - $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore); |
|
| 793 | + $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.$maxscore); |
|
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | $output .= ' |
| 797 | 797 | <td>'.$extend_link.'</td> |
| 798 | - <td colspan="4">' . $title . '</td> |
|
| 799 | - <td colspan="2">' . learnpathitem::humanize_status($lesson_status) .'</td> |
|
| 798 | + <td colspan="4">' . $title.'</td> |
|
| 799 | + <td colspan="2">' . learnpathitem::humanize_status($lesson_status).'</td> |
|
| 800 | 800 | <td colspan="2">'.$scoreItem.'</td> |
| 801 | 801 | <td colspan="2">'.$time.'</td> |
| 802 | 802 | '.$action.' |
@@ -813,10 +813,10 @@ discard block |
||
| 813 | 813 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
| 814 | 814 | $temp[] = '/'; |
| 815 | 815 | } else { |
| 816 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
| 816 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
| 817 | 817 | } |
| 818 | 818 | } else { |
| 819 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
| 819 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
| 820 | 820 | } |
| 821 | 821 | $temp[] = $time; |
| 822 | 822 | $csv_content[] = $temp; |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | |
| 828 | 828 | $action = null; |
| 829 | 829 | if ($type == 'classic') { |
| 830 | - $action = '<td></td>'; |
|
| 830 | + $action = '<td></td>'; |
|
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | if ($extend_this_attempt || $extend_all) { |
@@ -864,11 +864,11 @@ discard block |
||
| 864 | 864 | <td></td> |
| 865 | 865 | <td></td> |
| 866 | 866 | <td></td> |
| 867 | - <td>' . $interaction['order_id'] . '</td> |
|
| 868 | - <td colspan="2">'.$interaction['objective_id'] . '</td> |
|
| 869 | - <td colspan="2">' . $interaction['status'] . '</td> |
|
| 867 | + <td>' . $interaction['order_id'].'</td> |
|
| 868 | + <td colspan="2">'.$interaction['objective_id'].'</td> |
|
| 869 | + <td colspan="2">' . $interaction['status'].'</td> |
|
| 870 | 870 | <td>' . $interaction['score_raw'].'</td> |
| 871 | - <td>' . $interaction['score_max'] .'</td> |
|
| 871 | + <td>' . $interaction['score_max'].'</td> |
|
| 872 | 872 | <td>' . $interaction['score_min'].'</td> |
| 873 | 873 | '.$action.' |
| 874 | 874 | </tr>'; |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | } |
| 878 | 878 | |
| 879 | 879 | // Attempts listing by exercise. |
| 880 | - if ($lp_id == $my_lp_id && $lp_item_id== $my_id && $extendedAttempt) { |
|
| 880 | + if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) { |
|
| 881 | 881 | // Get attempts of a exercise. |
| 882 | 882 | if (!empty($lp_id) && |
| 883 | 883 | !empty($lp_item_id) && |
@@ -892,15 +892,15 @@ discard block |
||
| 892 | 892 | $row_path = Database::fetch_array($res_path); |
| 893 | 893 | |
| 894 | 894 | if (Database::num_rows($res_path) > 0) { |
| 895 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
| 895 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
| 896 | 896 | WHERE |
| 897 | - exe_exo_id="' . (int) $row_path['path'] . '" AND |
|
| 897 | + exe_exo_id="' . (int) $row_path['path'].'" AND |
|
| 898 | 898 | status <> "incomplete" AND |
| 899 | - exe_user_id="' . $user_id . '" AND |
|
| 900 | - orig_lp_id = "' . (int) $lp_id . '" AND |
|
| 901 | - orig_lp_item_id = "' . (int) $lp_item_id . '" AND |
|
| 902 | - c_id = ' . $course_id . ' AND |
|
| 903 | - session_id = ' . $session_id . ' |
|
| 899 | + exe_user_id="' . $user_id.'" AND |
|
| 900 | + orig_lp_id = "' . (int) $lp_id.'" AND |
|
| 901 | + orig_lp_item_id = "' . (int) $lp_item_id.'" AND |
|
| 902 | + c_id = ' . $course_id.' AND |
|
| 903 | + session_id = ' . $session_id.' |
|
| 904 | 904 | ORDER BY exe_date'; |
| 905 | 905 | $res_attempts = Database::query($sql); |
| 906 | 906 | $num_attempts = Database::num_rows($res_attempts); |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | if ($mktime_start_date && $mktime_exe_date) { |
| 919 | 919 | $mytime = ((int) $mktime_exe_date - (int) $mktime_start_date); |
| 920 | 920 | $time_attemp = learnpathItem :: getScormTimeFromParameter('js', $mytime); |
| 921 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
| 921 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
| 922 | 922 | } else { |
| 923 | 923 | $time_attemp = ' - '; |
| 924 | 924 | } |
@@ -944,33 +944,33 @@ discard block |
||
| 944 | 944 | $my_lesson_status = learnpathitem::humanize_status('incomplete'); |
| 945 | 945 | } |
| 946 | 946 | |
| 947 | - $output .= '<tr class="' . $oddclass . '" > |
|
| 947 | + $output .= '<tr class="'.$oddclass.'" > |
|
| 948 | 948 | <td></td> |
| 949 | - <td>' . $extend_attempt_link . '</td> |
|
| 950 | - <td colspan="3">' . get_lang('Attempt').' '. $n.'</td> |
|
| 951 | - <td colspan="2">' . $my_lesson_status . '</td> |
|
| 952 | - <td colspan="2">'.$view_score . '</td> |
|
| 953 | - <td colspan="2">'.$time_attemp . '</td>'; |
|
| 949 | + <td>' . $extend_attempt_link.'</td> |
|
| 950 | + <td colspan="3">' . get_lang('Attempt').' '.$n.'</td> |
|
| 951 | + <td colspan="2">' . $my_lesson_status.'</td> |
|
| 952 | + <td colspan="2">'.$view_score.'</td> |
|
| 953 | + <td colspan="2">'.$time_attemp.'</td>'; |
|
| 954 | 954 | if ($action == 'classic') { |
| 955 | 955 | if ($origin != 'tracking') { |
| 956 | 956 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
| 957 | 957 | $output .= '<td> |
| 958 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
| 958 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
| 959 | 959 | </td>'; |
| 960 | 960 | } else { |
| 961 | 961 | $output .= '<td> |
| 962 | - <a href="../exercice/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent"> |
|
| 963 | - <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
| 962 | + <a href="../exercice/exercise_show.php?origin=' . $origin.'&id='.$my_exe_id.'&cidReq='.$courseCode.'" target="_parent"> |
|
| 963 | + <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
| 964 | 964 | </a></td>'; |
| 965 | 965 | } |
| 966 | 966 | } else { |
| 967 | 967 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
| 968 | 968 | $output .= '<td> |
| 969 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>'; |
|
| 969 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></td>'; |
|
| 970 | 970 | } else { |
| 971 | 971 | $output .= '<td> |
| 972 | - <a href="../exercice/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent"> |
|
| 973 | - <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>'; |
|
| 972 | + <a href="../exercice/exercise_show.php?cidReq=' . $courseCode.'&origin=correct_exercise_in_lp&id='.$my_exe_id.'" target="_parent"> |
|
| 973 | + <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>'; |
|
| 974 | 974 | } |
| 975 | 975 | } |
| 976 | 976 | } |
@@ -1029,13 +1029,13 @@ discard block |
||
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time); |
| 1032 | - $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time); |
|
| 1032 | + $total_time = str_replace('NaN', '00'.$h.'00\'00"', $total_time); |
|
| 1033 | 1033 | |
| 1034 | 1034 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
| 1035 | 1035 | $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); |
| 1036 | 1036 | } else { |
| 1037 | 1037 | if (is_numeric($total_score)) { |
| 1038 | - $final_score = $total_score . '%'; |
|
| 1038 | + $final_score = $total_score.'%'; |
|
| 1039 | 1039 | } else { |
| 1040 | 1040 | $final_score = $total_score; |
| 1041 | 1041 | } |
@@ -1051,19 +1051,19 @@ discard block |
||
| 1051 | 1051 | |
| 1052 | 1052 | $action = null; |
| 1053 | 1053 | if ($type == 'classic') { |
| 1054 | - $action = '<td></td>'; |
|
| 1054 | + $action = '<td></td>'; |
|
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | 1057 | $output .= '<tr class="'.$oddclass.'"> |
| 1058 | 1058 | <td></td> |
| 1059 | 1059 | <td colspan="4"> |
| 1060 | - <i>' . get_lang('AccomplishedStepsTotal') .'</i> |
|
| 1060 | + <i>' . get_lang('AccomplishedStepsTotal').'</i> |
|
| 1061 | 1061 | </td> |
| 1062 | 1062 | <td colspan="2">'.$progress.'%</td> |
| 1063 | 1063 | <td colspan="2"> |
| 1064 | 1064 | ' . $final_score.' |
| 1065 | 1065 | </td> |
| 1066 | - <td colspan="2">' . $total_time . '</div> |
|
| 1066 | + <td colspan="2">' . $total_time.'</div> |
|
| 1067 | 1067 | '.$action.' |
| 1068 | 1068 | </tr>'; |
| 1069 | 1069 | |
@@ -1359,7 +1359,7 @@ discard block |
||
| 1359 | 1359 | $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
| 1360 | 1360 | if (is_array($user_id)) { |
| 1361 | 1361 | $user_id = array_map('intval', $user_id); |
| 1362 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
| 1362 | + $condition_user = " AND user_id IN (".implode(',', $user_id).") "; |
|
| 1363 | 1363 | } else { |
| 1364 | 1364 | $user_id = intval($user_id); |
| 1365 | 1365 | $condition_user = " AND user_id = $user_id "; |
@@ -1396,13 +1396,13 @@ discard block |
||
| 1396 | 1396 | { |
| 1397 | 1397 | $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
| 1398 | 1398 | $sql = 'SELECT login_date |
| 1399 | - FROM ' . $tbl_track_login . ' |
|
| 1400 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
| 1399 | + FROM ' . $tbl_track_login.' |
|
| 1400 | + WHERE login_user_id = ' . intval($student_id).' |
|
| 1401 | 1401 | ORDER BY login_date ASC |
| 1402 | 1402 | LIMIT 0,1'; |
| 1403 | 1403 | |
| 1404 | 1404 | $rs = Database::query($sql); |
| 1405 | - if (Database::num_rows($rs)>0) { |
|
| 1405 | + if (Database::num_rows($rs) > 0) { |
|
| 1406 | 1406 | if ($first_login_date = Database::result($rs, 0, 0)) { |
| 1407 | 1407 | return api_convert_and_format_date( |
| 1408 | 1408 | $first_login_date, |
@@ -1427,8 +1427,8 @@ discard block |
||
| 1427 | 1427 | { |
| 1428 | 1428 | $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
| 1429 | 1429 | $sql = 'SELECT login_date |
| 1430 | - FROM ' . $table . ' |
|
| 1431 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
| 1430 | + FROM ' . $table.' |
|
| 1431 | + WHERE login_user_id = ' . intval($student_id).' |
|
| 1432 | 1432 | ORDER BY login_date |
| 1433 | 1433 | DESC LIMIT 0,1'; |
| 1434 | 1434 | |
@@ -1437,18 +1437,18 @@ discard block |
||
| 1437 | 1437 | if ($last_login_date = Database::result($rs, 0, 0)) { |
| 1438 | 1438 | $last_login_date = api_get_local_time($last_login_date); |
| 1439 | 1439 | if ($return_timestamp) { |
| 1440 | - return api_strtotime($last_login_date,'UTC'); |
|
| 1440 | + return api_strtotime($last_login_date, 'UTC'); |
|
| 1441 | 1441 | } else { |
| 1442 | 1442 | if (!$warning_message) { |
| 1443 | 1443 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
| 1444 | 1444 | } else { |
| 1445 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
| 1445 | + $timestamp = api_strtotime($last_login_date, 'UTC'); |
|
| 1446 | 1446 | $currentTimestamp = time(); |
| 1447 | 1447 | |
| 1448 | 1448 | //If the last connection is > than 7 days, the text is red |
| 1449 | 1449 | //345600 = 7 days in seconds |
| 1450 | 1450 | if ($currentTimestamp - $timestamp > 604800) { |
| 1451 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
| 1451 | + return '<span style="color: #F00;">'.api_format_date($last_login_date, DATE_FORMAT_SHORT).'</span>'; |
|
| 1452 | 1452 | } else { |
| 1453 | 1453 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
| 1454 | 1454 | } |
@@ -1483,7 +1483,7 @@ discard block |
||
| 1483 | 1483 | $sql = "$select |
| 1484 | 1484 | FROM $tbl_track_login |
| 1485 | 1485 | WHERE |
| 1486 | - login_user_id IN (' ". implode("','", $studentList) . "' ) AND |
|
| 1486 | + login_user_id IN (' ".implode("','", $studentList)."' ) AND |
|
| 1487 | 1487 | login_date < '$date' |
| 1488 | 1488 | "; |
| 1489 | 1489 | $rs = Database::query($sql); |
@@ -1582,7 +1582,7 @@ discard block |
||
| 1582 | 1582 | '.Display::return_icon('messagebox_warning.gif').' |
| 1583 | 1583 | </a>' |
| 1584 | 1584 | : null; |
| 1585 | - return $icon. Display::label($last_login_date, 'warning'); |
|
| 1585 | + return $icon.Display::label($last_login_date, 'warning'); |
|
| 1586 | 1586 | } else { |
| 1587 | 1587 | return $last_login_date; |
| 1588 | 1588 | } |
@@ -1632,7 +1632,7 @@ discard block |
||
| 1632 | 1632 | session_id = $session_id |
| 1633 | 1633 | $month_filter"; |
| 1634 | 1634 | $rs = Database::query($sql); |
| 1635 | - if (Database::num_rows($rs)>0) { |
|
| 1635 | + if (Database::num_rows($rs) > 0) { |
|
| 1636 | 1636 | $row = Database::fetch_object($rs); |
| 1637 | 1637 | $count = $row->count_connections; |
| 1638 | 1638 | } |
@@ -1653,14 +1653,14 @@ discard block |
||
| 1653 | 1653 | $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
| 1654 | 1654 | |
| 1655 | 1655 | $sql = 'SELECT DISTINCT c_id |
| 1656 | - FROM ' . $tbl_course_rel_user . ' |
|
| 1656 | + FROM ' . $tbl_course_rel_user.' |
|
| 1657 | 1657 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
| 1658 | 1658 | $rs = Database::query($sql); |
| 1659 | 1659 | $nb_courses = Database::num_rows($rs); |
| 1660 | 1660 | |
| 1661 | 1661 | if ($include_sessions) { |
| 1662 | 1662 | $sql = 'SELECT DISTINCT c_id |
| 1663 | - FROM ' . $tbl_session_course_rel_user . ' |
|
| 1663 | + FROM ' . $tbl_session_course_rel_user.' |
|
| 1664 | 1664 | WHERE user_id = ' . $user_id; |
| 1665 | 1665 | $rs = Database::query($sql); |
| 1666 | 1666 | $nb_courses += Database::num_rows($rs); |
@@ -1707,7 +1707,7 @@ discard block |
||
| 1707 | 1707 | $condition_quiz = ""; |
| 1708 | 1708 | if (!empty($exercise_id)) { |
| 1709 | 1709 | $exercise_id = intval($exercise_id); |
| 1710 | - $condition_quiz =" AND id = $exercise_id "; |
|
| 1710 | + $condition_quiz = " AND id = $exercise_id "; |
|
| 1711 | 1711 | } |
| 1712 | 1712 | |
| 1713 | 1713 | // Compose a filter based on optional session id given |
@@ -1756,7 +1756,7 @@ discard block |
||
| 1756 | 1756 | } |
| 1757 | 1757 | } |
| 1758 | 1758 | if (!empty($exercise_list)) { |
| 1759 | - $exercise_id = implode("','",$exercise_list); |
|
| 1759 | + $exercise_id = implode("','", $exercise_list); |
|
| 1760 | 1760 | } |
| 1761 | 1761 | } |
| 1762 | 1762 | |
@@ -1781,10 +1781,10 @@ discard block |
||
| 1781 | 1781 | $quiz_avg_score = null; |
| 1782 | 1782 | |
| 1783 | 1783 | if (!empty($row['avg_score'])) { |
| 1784 | - $quiz_avg_score = round($row['avg_score'],2); |
|
| 1784 | + $quiz_avg_score = round($row['avg_score'], 2); |
|
| 1785 | 1785 | } |
| 1786 | 1786 | |
| 1787 | - if(!empty($row['num_attempts'])) { |
|
| 1787 | + if (!empty($row['num_attempts'])) { |
|
| 1788 | 1788 | $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
| 1789 | 1789 | } |
| 1790 | 1790 | if (is_array($student_id)) { |
@@ -1914,7 +1914,7 @@ discard block |
||
| 1914 | 1914 | $row = Database::fetch_row($rs); |
| 1915 | 1915 | $count = $row[0]; |
| 1916 | 1916 | } |
| 1917 | - $count = ($count != 0 ) ? 100*round(intval($count)/count($exercise_list), 2) .'%' : '0%'; |
|
| 1917 | + $count = ($count != 0) ? 100 * round(intval($count) / count($exercise_list), 2).'%' : '0%'; |
|
| 1918 | 1918 | return $count; |
| 1919 | 1919 | } |
| 1920 | 1920 | |
@@ -1939,7 +1939,7 @@ discard block |
||
| 1939 | 1939 | ); |
| 1940 | 1940 | |
| 1941 | 1941 | if (!empty($best_attempt) && !empty($best_attempt['exe_weighting'])) { |
| 1942 | - $result += $best_attempt['exe_result']/$best_attempt['exe_weighting']; |
|
| 1942 | + $result += $best_attempt['exe_result'] / $best_attempt['exe_weighting']; |
|
| 1943 | 1943 | } |
| 1944 | 1944 | } |
| 1945 | 1945 | $result = $result / count($exercise_list); |
@@ -1976,7 +1976,7 @@ discard block |
||
| 1976 | 1976 | $query = sprintf($sql, intval($courseId), $sessionId); |
| 1977 | 1977 | $rs = Database::query($query); |
| 1978 | 1978 | $teachers = array(); |
| 1979 | - while ($teacher = Database::fetch_array($rs,'ASSOC')) { |
|
| 1979 | + while ($teacher = Database::fetch_array($rs, 'ASSOC')) { |
|
| 1980 | 1980 | $teachers[] = $teacher; |
| 1981 | 1981 | } |
| 1982 | 1982 | $data = array(); |
@@ -2100,7 +2100,7 @@ discard block |
||
| 2100 | 2100 | $data[] = array( |
| 2101 | 2101 | 'course' => $course['title'], |
| 2102 | 2102 | 'session' => $teacher['name'], |
| 2103 | - 'tutor' => $tutor['username'] . ' - ' . $tutor['lastname'] . ' ' . $tutor['firstname'], |
|
| 2103 | + 'tutor' => $tutor['username'].' - '.$tutor['lastname'].' '.$tutor['firstname'], |
|
| 2104 | 2104 | 'documents' => $totalDocuments, |
| 2105 | 2105 | 'links' => $totalLinks, |
| 2106 | 2106 | 'forums' => $totalForums, |
@@ -2163,7 +2163,7 @@ discard block |
||
| 2163 | 2163 | for ($i = 0; $i < count($lpIdList); $i++) { |
| 2164 | 2164 | $placeHolders[] = '?'; |
| 2165 | 2165 | } |
| 2166 | - $lpConditions['AND id IN(' . implode(', ', $placeHolders) . ') '] = $lpIdList; |
|
| 2166 | + $lpConditions['AND id IN('.implode(', ', $placeHolders).') '] = $lpIdList; |
|
| 2167 | 2167 | } |
| 2168 | 2168 | |
| 2169 | 2169 | if ($onlySeriousGame) { |
@@ -2183,12 +2183,12 @@ discard block |
||
| 2183 | 2183 | |
| 2184 | 2184 | $conditions = [ |
| 2185 | 2185 | " c_id = {$courseInfo['real_id']} ", |
| 2186 | - " lp_view.lp_id IN(" . implode(', ', $filteredLP) . ") " |
|
| 2186 | + " lp_view.lp_id IN(".implode(', ', $filteredLP).") " |
|
| 2187 | 2187 | ]; |
| 2188 | 2188 | |
| 2189 | 2189 | if (is_array($studentId)) { |
| 2190 | 2190 | $studentId = array_map('intval', $studentId); |
| 2191 | - $conditions[] = " lp_view.user_id IN (" . implode(',', $studentId) . ") "; |
|
| 2191 | + $conditions[] = " lp_view.user_id IN (".implode(',', $studentId).") "; |
|
| 2192 | 2192 | |
| 2193 | 2193 | $groupBy = 'GROUP BY lp_id'; |
| 2194 | 2194 | } else { |
@@ -2329,7 +2329,7 @@ discard block |
||
| 2329 | 2329 | // Compose a filter based on optional learning paths list given |
| 2330 | 2330 | $condition_lp = ""; |
| 2331 | 2331 | if (count($lp_ids) > 0) { |
| 2332 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
| 2332 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
| 2333 | 2333 | } |
| 2334 | 2334 | |
| 2335 | 2335 | // Compose a filter based on optional session id |
@@ -2369,9 +2369,9 @@ discard block |
||
| 2369 | 2369 | // prepare filter on users |
| 2370 | 2370 | if (is_array($student_id)) { |
| 2371 | 2371 | array_walk($student_id, 'intval'); |
| 2372 | - $condition_user1 =" AND user_id IN (".implode(',', $student_id).") "; |
|
| 2372 | + $condition_user1 = " AND user_id IN (".implode(',', $student_id).") "; |
|
| 2373 | 2373 | } else { |
| 2374 | - $condition_user1 =" AND user_id = $student_id "; |
|
| 2374 | + $condition_user1 = " AND user_id = $student_id "; |
|
| 2375 | 2375 | } |
| 2376 | 2376 | |
| 2377 | 2377 | if ($count_row_lp > 0 && !empty($student_id)) { |
@@ -2414,7 +2414,7 @@ discard block |
||
| 2414 | 2414 | ORDER BY lp_item_id"; |
| 2415 | 2415 | $res_lp_item = Database::query($sql); |
| 2416 | 2416 | |
| 2417 | - while ($row_lp_item = Database::fetch_array($res_lp_item,'ASSOC')) { |
|
| 2417 | + while ($row_lp_item = Database::fetch_array($res_lp_item, 'ASSOC')) { |
|
| 2418 | 2418 | $my_lp_item_id = $row_lp_item['lp_item_id']; |
| 2419 | 2419 | |
| 2420 | 2420 | // Getting the most recent attempt |
@@ -2437,8 +2437,8 @@ discard block |
||
| 2437 | 2437 | ORDER BY view_count DESC |
| 2438 | 2438 | LIMIT 1"; |
| 2439 | 2439 | $res_lp_item_result = Database::query($sql); |
| 2440 | - while ($row_max_score = Database::fetch_array($res_lp_item_result,'ASSOC')) { |
|
| 2441 | - $list[]= $row_max_score; |
|
| 2440 | + while ($row_max_score = Database::fetch_array($res_lp_item_result, 'ASSOC')) { |
|
| 2441 | + $list[] = $row_max_score; |
|
| 2442 | 2442 | } |
| 2443 | 2443 | } |
| 2444 | 2444 | } else { |
@@ -2462,8 +2462,8 @@ discard block |
||
| 2462 | 2462 | if ($debug) echo $sql.'<br />'; |
| 2463 | 2463 | $res_max_score = Database::query($sql); |
| 2464 | 2464 | |
| 2465 | - while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
|
| 2466 | - $list[]= $row_max_score; |
|
| 2465 | + while ($row_max_score = Database::fetch_array($res_max_score, 'ASSOC')) { |
|
| 2466 | + $list[] = $row_max_score; |
|
| 2467 | 2467 | } |
| 2468 | 2468 | } |
| 2469 | 2469 | |
@@ -2478,7 +2478,7 @@ discard block |
||
| 2478 | 2478 | $max_score_item_view = $row_max_score['max_score_item_view']; |
| 2479 | 2479 | $score = $row_max_score['score']; |
| 2480 | 2480 | |
| 2481 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
| 2481 | + if ($debug) echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>'; |
|
| 2482 | 2482 | |
| 2483 | 2483 | if ($row_max_score['item_type'] == 'sco') { |
| 2484 | 2484 | /* Check if it is sco (easier to get max_score) |
@@ -2496,7 +2496,7 @@ discard block |
||
| 2496 | 2496 | } |
| 2497 | 2497 | // Avoid division by zero errors |
| 2498 | 2498 | if (!empty($max_score)) { |
| 2499 | - $lp_partial_total += $score/$max_score; |
|
| 2499 | + $lp_partial_total += $score / $max_score; |
|
| 2500 | 2500 | } |
| 2501 | 2501 | if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
| 2502 | 2502 | } else { |
@@ -2520,10 +2520,10 @@ discard block |
||
| 2520 | 2520 | ORDER BY exe_date DESC |
| 2521 | 2521 | LIMIT 1"; |
| 2522 | 2522 | |
| 2523 | - if ($debug) echo $sql .'<br />'; |
|
| 2523 | + if ($debug) echo $sql.'<br />'; |
|
| 2524 | 2524 | $result_last_attempt = Database::query($sql); |
| 2525 | 2525 | $num = Database :: num_rows($result_last_attempt); |
| 2526 | - if ($num > 0 ) { |
|
| 2526 | + if ($num > 0) { |
|
| 2527 | 2527 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
| 2528 | 2528 | if ($debug) echo $id_last_attempt.'<br />'; |
| 2529 | 2529 | |
@@ -2552,13 +2552,13 @@ discard block |
||
| 2552 | 2552 | $max_score = $row_max_score_bis['maxscore']; |
| 2553 | 2553 | } |
| 2554 | 2554 | if (!empty($max_score) && floatval($max_score) > 0) { |
| 2555 | - $lp_partial_total += $score/$max_score; |
|
| 2555 | + $lp_partial_total += $score / $max_score; |
|
| 2556 | 2556 | } |
| 2557 | 2557 | if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
| 2558 | 2558 | } |
| 2559 | 2559 | } |
| 2560 | 2560 | |
| 2561 | - if (in_array($row_max_score['item_type'], array('quiz','sco'))) { |
|
| 2561 | + if (in_array($row_max_score['item_type'], array('quiz', 'sco'))) { |
|
| 2562 | 2562 | // Normal way |
| 2563 | 2563 | if ($use_max_score[$lp_id]) { |
| 2564 | 2564 | $count_items++; |
@@ -2593,8 +2593,8 @@ discard block |
||
| 2593 | 2593 | if ($debug) echo $sql; |
| 2594 | 2594 | $result_have_quiz = Database::query($sql); |
| 2595 | 2595 | |
| 2596 | - if (Database::num_rows($result_have_quiz) > 0 ) { |
|
| 2597 | - $row = Database::fetch_array($result_have_quiz,'ASSOC'); |
|
| 2596 | + if (Database::num_rows($result_have_quiz) > 0) { |
|
| 2597 | + $row = Database::fetch_array($result_have_quiz, 'ASSOC'); |
|
| 2598 | 2598 | if (is_numeric($row['count']) && $row['count'] != 0) { |
| 2599 | 2599 | $lp_with_quiz++; |
| 2600 | 2600 | } |
@@ -2606,7 +2606,7 @@ discard block |
||
| 2606 | 2606 | |
| 2607 | 2607 | if ($lp_with_quiz != 0) { |
| 2608 | 2608 | if (!$return_array) { |
| 2609 | - $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
|
| 2609 | + $score_of_scorm_calculate = round(($global_result / $lp_with_quiz), 2); |
|
| 2610 | 2610 | if ($debug) var_dump($score_of_scorm_calculate); |
| 2611 | 2611 | if (empty($lp_ids)) { |
| 2612 | 2612 | if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
@@ -2680,9 +2680,9 @@ discard block |
||
| 2680 | 2680 | |
| 2681 | 2681 | if (is_array($student_id)) { |
| 2682 | 2682 | array_walk($student_id, 'intval'); |
| 2683 | - $conditions[] =" lp_view.user_id IN (".implode(',', $student_id).") "; |
|
| 2683 | + $conditions[] = " lp_view.user_id IN (".implode(',', $student_id).") "; |
|
| 2684 | 2684 | } else { |
| 2685 | - $conditions[] =" lp_view.user_id = $student_id "; |
|
| 2685 | + $conditions[] = " lp_view.user_id = $student_id "; |
|
| 2686 | 2686 | } |
| 2687 | 2687 | |
| 2688 | 2688 | $conditionsToString = implode('AND ', $conditions); |
@@ -2706,7 +2706,7 @@ discard block |
||
| 2706 | 2706 | return 0; |
| 2707 | 2707 | } |
| 2708 | 2708 | |
| 2709 | - return ($row['sum_score'] / $row['sum_max_score'])*100; |
|
| 2709 | + return ($row['sum_score'] / $row['sum_max_score']) * 100; |
|
| 2710 | 2710 | |
| 2711 | 2711 | } |
| 2712 | 2712 | |
@@ -2736,7 +2736,7 @@ discard block |
||
| 2736 | 2736 | // Compose a filter based on optional learning paths list given |
| 2737 | 2737 | $condition_lp = ""; |
| 2738 | 2738 | if (count($lp_ids) > 0) { |
| 2739 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
| 2739 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
| 2740 | 2740 | } |
| 2741 | 2741 | |
| 2742 | 2742 | // Compose a filter based on optional session id |
@@ -2795,7 +2795,7 @@ discard block |
||
| 2795 | 2795 | |
| 2796 | 2796 | if (!empty($course)) { |
| 2797 | 2797 | |
| 2798 | - $course_id = $course['real_id']; |
|
| 2798 | + $course_id = $course['real_id']; |
|
| 2799 | 2799 | |
| 2800 | 2800 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 2801 | 2801 | $t_lpv = Database :: get_course_table(TABLE_LP_VIEW); |
@@ -2809,8 +2809,8 @@ discard block |
||
| 2809 | 2809 | // calculates last connection time |
| 2810 | 2810 | if ($count_row_lp > 0) { |
| 2811 | 2811 | $sql = 'SELECT MAX(start_time) |
| 2812 | - FROM ' . $t_lpiv . ' AS item_view |
|
| 2813 | - INNER JOIN ' . $t_lpv . ' AS view |
|
| 2812 | + FROM ' . $t_lpiv.' AS item_view |
|
| 2813 | + INNER JOIN ' . $t_lpv.' AS view |
|
| 2814 | 2814 | ON item_view.lp_view_id = view.id |
| 2815 | 2815 | WHERE |
| 2816 | 2816 | item_view.c_id = '.$course_id.' AND |
@@ -2846,15 +2846,15 @@ discard block |
||
| 2846 | 2846 | |
| 2847 | 2847 | // At first, courses where $coach_id is coach of the course // |
| 2848 | 2848 | $sql = 'SELECT session_id, c_id |
| 2849 | - FROM ' . $tbl_session_course_user . ' |
|
| 2849 | + FROM ' . $tbl_session_course_user.' |
|
| 2850 | 2850 | WHERE user_id=' . $coach_id.' AND status=2'; |
| 2851 | 2851 | |
| 2852 | 2852 | if (api_is_multiple_url_enabled()) { |
| 2853 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
| 2853 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
| 2854 | 2854 | $access_url_id = api_get_current_access_url_id(); |
| 2855 | 2855 | if ($access_url_id != -1) { |
| 2856 | 2856 | $sql = 'SELECT scu.session_id, scu.c_id |
| 2857 | - FROM ' . $tbl_session_course_user . ' scu |
|
| 2857 | + FROM ' . $tbl_session_course_user.' scu |
|
| 2858 | 2858 | INNER JOIN '.$tbl_session_rel_access_url.' sru |
| 2859 | 2859 | ON (scu.session_id=sru.session_id) |
| 2860 | 2860 | WHERE |
@@ -2888,28 +2888,28 @@ discard block |
||
| 2888 | 2888 | |
| 2889 | 2889 | // Then, courses where $coach_id is coach of the session // |
| 2890 | 2890 | $sql = 'SELECT session_course_user.user_id |
| 2891 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
| 2891 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
| 2892 | 2892 | INNER JOIN '.$tbl_session_user.' sru |
| 2893 | 2893 | ON session_course_user.user_id = sru.user_id AND session_course_user.session_id = sru.session_id |
| 2894 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
| 2894 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
| 2895 | 2895 | ON session_course.c_id = session_course_user.c_id |
| 2896 | 2896 | AND session_course_user.session_id = session_course.session_id |
| 2897 | - INNER JOIN ' . $tbl_session . ' as session |
|
| 2897 | + INNER JOIN ' . $tbl_session.' as session |
|
| 2898 | 2898 | ON session.id = session_course.session_id |
| 2899 | 2899 | AND session.id_coach = ' . $coach_id; |
| 2900 | 2900 | if (api_is_multiple_url_enabled()) { |
| 2901 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
| 2901 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
| 2902 | 2902 | $access_url_id = api_get_current_access_url_id(); |
| 2903 | - if ($access_url_id != -1){ |
|
| 2903 | + if ($access_url_id != -1) { |
|
| 2904 | 2904 | $sql = 'SELECT session_course_user.user_id |
| 2905 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
| 2905 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
| 2906 | 2906 | INNER JOIN '.$tbl_session_user.' sru |
| 2907 | 2907 | ON session_course_user.user_id = sru.user_id AND |
| 2908 | 2908 | session_course_user.session_id = sru.session_id |
| 2909 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
| 2909 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
| 2910 | 2910 | ON session_course.c_id = session_course_user.c_id AND |
| 2911 | 2911 | session_course_user.session_id = session_course.session_id |
| 2912 | - INNER JOIN ' . $tbl_session . ' as session |
|
| 2912 | + INNER JOIN ' . $tbl_session.' as session |
|
| 2913 | 2913 | ON session.id = session_course.session_id AND |
| 2914 | 2914 | session.id_coach = ' . $coach_id.' |
| 2915 | 2915 | INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url |
@@ -2939,8 +2939,8 @@ discard block |
||
| 2939 | 2939 | |
| 2940 | 2940 | $students = []; |
| 2941 | 2941 | // At first, courses where $coach_id is coach of the course // |
| 2942 | - $sql = 'SELECT c_id FROM ' . $tbl_session_course_user . ' |
|
| 2943 | - WHERE session_id="' . $id_session . '" AND user_id=' . $coach_id.' AND status=2'; |
|
| 2942 | + $sql = 'SELECT c_id FROM '.$tbl_session_course_user.' |
|
| 2943 | + WHERE session_id="' . $id_session.'" AND user_id='.$coach_id.' AND status=2'; |
|
| 2944 | 2944 | $result = Database::query($sql); |
| 2945 | 2945 | |
| 2946 | 2946 | while ($a_courses = Database::fetch_array($result)) { |
@@ -2950,7 +2950,7 @@ discard block |
||
| 2950 | 2950 | FROM $tbl_session_course_user AS srcru |
| 2951 | 2951 | WHERE |
| 2952 | 2952 | c_id = '$courseId' AND |
| 2953 | - session_id = '" . $id_session . "'"; |
|
| 2953 | + session_id = '".$id_session."'"; |
|
| 2954 | 2954 | $rs = Database::query($sql); |
| 2955 | 2955 | while ($row = Database::fetch_array($rs)) { |
| 2956 | 2956 | $students[$row['user_id']] = $row['user_id']; |
@@ -2958,15 +2958,15 @@ discard block |
||
| 2958 | 2958 | } |
| 2959 | 2959 | |
| 2960 | 2960 | // Then, courses where $coach_id is coach of the session |
| 2961 | - $sql = 'SELECT id_coach FROM ' . $tbl_session . ' |
|
| 2962 | - WHERE id="' . $id_session.'" AND id_coach="' . $coach_id . '"'; |
|
| 2961 | + $sql = 'SELECT id_coach FROM '.$tbl_session.' |
|
| 2962 | + WHERE id="' . $id_session.'" AND id_coach="'.$coach_id.'"'; |
|
| 2963 | 2963 | $result = Database::query($sql); |
| 2964 | 2964 | |
| 2965 | 2965 | //He is the session_coach so we select all the users in the session |
| 2966 | 2966 | if (Database::num_rows($result) > 0) { |
| 2967 | 2967 | $sql = 'SELECT DISTINCT srcru.user_id |
| 2968 | - FROM ' . $tbl_session_course_user . ' AS srcru |
|
| 2969 | - WHERE session_id="' . $id_session . '"'; |
|
| 2968 | + FROM ' . $tbl_session_course_user.' AS srcru |
|
| 2969 | + WHERE session_id="' . $id_session.'"'; |
|
| 2970 | 2970 | $result = Database::query($sql); |
| 2971 | 2971 | while ($row = Database::fetch_array($result)) { |
| 2972 | 2972 | $students[$row['user_id']] = $row['user_id']; |
@@ -2993,8 +2993,8 @@ discard block |
||
| 2993 | 2993 | |
| 2994 | 2994 | // At first, courses where $coach_id is coach of the course // |
| 2995 | 2995 | |
| 2996 | - $sql = 'SELECT 1 FROM ' . $tbl_session_course_user . ' |
|
| 2997 | - WHERE user_id=' . $coach_id .' AND status=2'; |
|
| 2996 | + $sql = 'SELECT 1 FROM '.$tbl_session_course_user.' |
|
| 2997 | + WHERE user_id=' . $coach_id.' AND status=2'; |
|
| 2998 | 2998 | $result = Database::query($sql); |
| 2999 | 2999 | if (Database::num_rows($result) > 0) { |
| 3000 | 3000 | return true; |
@@ -3002,12 +3002,12 @@ discard block |
||
| 3002 | 3002 | |
| 3003 | 3003 | // Then, courses where $coach_id is coach of the session |
| 3004 | 3004 | $sql = 'SELECT session_course_user.user_id |
| 3005 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
| 3006 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
| 3005 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
| 3006 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
| 3007 | 3007 | ON session_course.c_id = session_course_user.c_id |
| 3008 | - INNER JOIN ' . $tbl_session . ' as session |
|
| 3008 | + INNER JOIN ' . $tbl_session.' as session |
|
| 3009 | 3009 | ON session.id = session_course.session_id |
| 3010 | - AND session.id_coach = ' . $coach_id . ' |
|
| 3010 | + AND session.id_coach = ' . $coach_id.' |
|
| 3011 | 3011 | WHERE user_id = ' . $student_id; |
| 3012 | 3012 | $result = Database::query($sql); |
| 3013 | 3013 | if (Database::num_rows($result) > 0) { |
@@ -3039,16 +3039,16 @@ discard block |
||
| 3039 | 3039 | // At first, courses where $coach_id is coach of the course. |
| 3040 | 3040 | |
| 3041 | 3041 | $sql = 'SELECT DISTINCT c.code |
| 3042 | - FROM ' . $tbl_session_course_user . ' sc |
|
| 3042 | + FROM ' . $tbl_session_course_user.' sc |
|
| 3043 | 3043 | INNER JOIN '.$tbl_course.' c |
| 3044 | 3044 | ON (c.id = sc.c_id) |
| 3045 | 3045 | WHERE user_id = ' . $coach_id.' AND status = 2'; |
| 3046 | 3046 | |
| 3047 | 3047 | if (api_is_multiple_url_enabled()) { |
| 3048 | 3048 | $access_url_id = api_get_current_access_url_id(); |
| 3049 | - if ($access_url_id != -1){ |
|
| 3049 | + if ($access_url_id != -1) { |
|
| 3050 | 3050 | $sql = 'SELECT DISTINCT c.code |
| 3051 | - FROM ' . $tbl_session_course_user . ' scu |
|
| 3051 | + FROM ' . $tbl_session_course_user.' scu |
|
| 3052 | 3052 | INNER JOIN '.$tbl_course.' c |
| 3053 | 3053 | ON (c.code = scu.c_id) |
| 3054 | 3054 | INNER JOIN '.$tbl_course_rel_access_url.' cru |
@@ -3061,7 +3061,7 @@ discard block |
||
| 3061 | 3061 | } |
| 3062 | 3062 | |
| 3063 | 3063 | if (!empty($id_session)) { |
| 3064 | - $sql .= ' AND session_id=' . $id_session; |
|
| 3064 | + $sql .= ' AND session_id='.$id_session; |
|
| 3065 | 3065 | } |
| 3066 | 3066 | |
| 3067 | 3067 | $courseList = array(); |
@@ -3073,25 +3073,25 @@ discard block |
||
| 3073 | 3073 | // Then, courses where $coach_id is coach of the session |
| 3074 | 3074 | |
| 3075 | 3075 | $sql = 'SELECT DISTINCT course.code |
| 3076 | - FROM ' . $tbl_session_course . ' as session_course |
|
| 3077 | - INNER JOIN ' . $tbl_session . ' as session |
|
| 3076 | + FROM ' . $tbl_session_course.' as session_course |
|
| 3077 | + INNER JOIN ' . $tbl_session.' as session |
|
| 3078 | 3078 | ON session.id = session_course.session_id |
| 3079 | - AND session.id_coach = ' . $coach_id . ' |
|
| 3080 | - INNER JOIN ' . $tbl_course . ' as course |
|
| 3079 | + AND session.id_coach = ' . $coach_id.' |
|
| 3080 | + INNER JOIN ' . $tbl_course.' as course |
|
| 3081 | 3081 | ON course.id = session_course.c_id'; |
| 3082 | 3082 | |
| 3083 | 3083 | if (api_is_multiple_url_enabled()) { |
| 3084 | 3084 | $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
| 3085 | 3085 | $access_url_id = api_get_current_access_url_id(); |
| 3086 | - if ($access_url_id != -1){ |
|
| 3086 | + if ($access_url_id != -1) { |
|
| 3087 | 3087 | $sql = 'SELECT DISTINCT c.code |
| 3088 | - FROM ' . $tbl_session_course . ' as session_course |
|
| 3088 | + FROM ' . $tbl_session_course.' as session_course |
|
| 3089 | 3089 | INNER JOIN '.$tbl_course.' c |
| 3090 | 3090 | ON (c.id = session_course.c_id) |
| 3091 | - INNER JOIN ' . $tbl_session . ' as session |
|
| 3091 | + INNER JOIN ' . $tbl_session.' as session |
|
| 3092 | 3092 | ON session.id = session_course.session_id |
| 3093 | - AND session.id_coach = ' . $coach_id . ' |
|
| 3094 | - INNER JOIN ' . $tbl_course . ' as course |
|
| 3093 | + AND session.id_coach = ' . $coach_id.' |
|
| 3094 | + INNER JOIN ' . $tbl_course.' as course |
|
| 3095 | 3095 | ON course.id = session_course.c_id |
| 3096 | 3096 | INNER JOIN '.$tbl_course_rel_access_url.' course_rel_url |
| 3097 | 3097 | ON (course_rel_url.c_id = c.id)'; |
@@ -3099,12 +3099,12 @@ discard block |
||
| 3099 | 3099 | } |
| 3100 | 3100 | |
| 3101 | 3101 | if (!empty ($id_session)) { |
| 3102 | - $sql .= ' WHERE session_course.session_id=' . $id_session; |
|
| 3102 | + $sql .= ' WHERE session_course.session_id='.$id_session; |
|
| 3103 | 3103 | if (api_is_multiple_url_enabled()) |
| 3104 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
| 3105 | - } else { |
|
| 3104 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
| 3105 | + } else { |
|
| 3106 | 3106 | if (api_is_multiple_url_enabled()) |
| 3107 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
| 3107 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
| 3108 | 3108 | } |
| 3109 | 3109 | |
| 3110 | 3110 | $result = Database::query($sql); |
@@ -3160,7 +3160,7 @@ discard block |
||
| 3160 | 3160 | } |
| 3161 | 3161 | } |
| 3162 | 3162 | |
| 3163 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
| 3163 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
| 3164 | 3164 | $access_url_id = api_get_current_access_url_id(); |
| 3165 | 3165 | |
| 3166 | 3166 | $sql = " |
@@ -3280,7 +3280,7 @@ discard block |
||
| 3280 | 3280 | // table definition |
| 3281 | 3281 | $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
| 3282 | 3282 | $tbl_document = Database :: get_course_table(TABLE_DOCUMENT); |
| 3283 | - $course_id = $a_course['real_id']; |
|
| 3283 | + $course_id = $a_course['real_id']; |
|
| 3284 | 3284 | if (is_array($student_id)) { |
| 3285 | 3285 | $studentList = array_map('intval', $student_id); |
| 3286 | 3286 | $condition_user = " AND ip.insert_user_id IN ('".implode(',', $studentList)."') "; |
@@ -3331,7 +3331,7 @@ discard block |
||
| 3331 | 3331 | $a_course = CourseManager::get_course_information($course_code); |
| 3332 | 3332 | if (!empty($a_course)) { |
| 3333 | 3333 | $course_id = $a_course['real_id']; |
| 3334 | - $conditions[]= " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
| 3334 | + $conditions[] = " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
| 3335 | 3335 | } |
| 3336 | 3336 | |
| 3337 | 3337 | // table definition |
@@ -3340,14 +3340,14 @@ discard block |
||
| 3340 | 3340 | |
| 3341 | 3341 | if (is_array($student_id)) { |
| 3342 | 3342 | $studentList = array_map('intval', $student_id); |
| 3343 | - $conditions[]= " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
| 3343 | + $conditions[] = " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
| 3344 | 3344 | } else { |
| 3345 | 3345 | $student_id = intval($student_id); |
| 3346 | - $conditions[]= " ip.insert_user_id = '$student_id' "; |
|
| 3346 | + $conditions[] = " ip.insert_user_id = '$student_id' "; |
|
| 3347 | 3347 | } |
| 3348 | 3348 | if (isset($session_id)) { |
| 3349 | 3349 | $session_id = intval($session_id); |
| 3350 | - $conditions[]= " pub.session_id = $session_id "; |
|
| 3350 | + $conditions[] = " pub.session_id = $session_id "; |
|
| 3351 | 3351 | } |
| 3352 | 3352 | $conditionToString = implode('AND', $conditions); |
| 3353 | 3353 | |
@@ -3380,8 +3380,8 @@ discard block |
||
| 3380 | 3380 | $courseCondition = null; |
| 3381 | 3381 | $conditions = array(); |
| 3382 | 3382 | if (!empty($courseInfo)) { |
| 3383 | - $course_id = $courseInfo['real_id']; |
|
| 3384 | - $conditions[]= " post.c_id = $course_id AND forum.c_id = $course_id "; |
|
| 3383 | + $course_id = $courseInfo['real_id']; |
|
| 3384 | + $conditions[] = " post.c_id = $course_id AND forum.c_id = $course_id "; |
|
| 3385 | 3385 | } |
| 3386 | 3386 | |
| 3387 | 3387 | // Table definition. |
@@ -3390,15 +3390,15 @@ discard block |
||
| 3390 | 3390 | |
| 3391 | 3391 | if (is_array($student_id)) { |
| 3392 | 3392 | $studentList = array_map('intval', $student_id); |
| 3393 | - $conditions[]= " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
| 3393 | + $conditions[] = " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
| 3394 | 3394 | } else { |
| 3395 | 3395 | $student_id = intval($student_id); |
| 3396 | - $conditions[]= " post.poster_id = '$student_id' "; |
|
| 3396 | + $conditions[] = " post.poster_id = '$student_id' "; |
|
| 3397 | 3397 | } |
| 3398 | 3398 | |
| 3399 | 3399 | if (isset($session_id)) { |
| 3400 | 3400 | $session_id = intval($session_id); |
| 3401 | - $conditions[]= " forum.session_id = $session_id"; |
|
| 3401 | + $conditions[] = " forum.session_id = $session_id"; |
|
| 3402 | 3402 | } |
| 3403 | 3403 | |
| 3404 | 3404 | $conditionsToString = implode('AND ', $conditions); |
@@ -3433,7 +3433,7 @@ discard block |
||
| 3433 | 3433 | $condition_session = ''; |
| 3434 | 3434 | if (isset($session_id)) { |
| 3435 | 3435 | $session_id = intval($session_id); |
| 3436 | - $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
| 3436 | + $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
| 3437 | 3437 | } |
| 3438 | 3438 | |
| 3439 | 3439 | $course_id = $courseInfo['real_id']; |
@@ -3489,7 +3489,7 @@ discard block |
||
| 3489 | 3489 | $condition_session = ''; |
| 3490 | 3490 | if (isset($session_id)) { |
| 3491 | 3491 | $session_id = intval($session_id); |
| 3492 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
| 3492 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
| 3493 | 3493 | } |
| 3494 | 3494 | |
| 3495 | 3495 | $groupId = intval($groupId); |
@@ -3550,7 +3550,7 @@ discard block |
||
| 3550 | 3550 | $condition_session = ''; |
| 3551 | 3551 | if (isset($session_id)) { |
| 3552 | 3552 | $session_id = intval($session_id); |
| 3553 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
| 3553 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
| 3554 | 3554 | } |
| 3555 | 3555 | |
| 3556 | 3556 | $groupId = intval($groupId); |
@@ -3629,7 +3629,7 @@ discard block |
||
| 3629 | 3629 | { |
| 3630 | 3630 | $student_id = intval($student_id); |
| 3631 | 3631 | $courseId = intval($courseId); |
| 3632 | - $session_id = intval($session_id); |
|
| 3632 | + $session_id = intval($session_id); |
|
| 3633 | 3633 | $date_time = ''; |
| 3634 | 3634 | |
| 3635 | 3635 | // table definition |
@@ -3698,7 +3698,7 @@ discard block |
||
| 3698 | 3698 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
| 3699 | 3699 | |
| 3700 | 3700 | $sql = 'SELECT 1 |
| 3701 | - FROM ' . $table . ' |
|
| 3701 | + FROM ' . $table.' |
|
| 3702 | 3702 | WHERE down_user_id = '.$student_id.' |
| 3703 | 3703 | AND c_id = "'.$courseId.'" |
| 3704 | 3704 | AND down_session_id = '.$session_id.' '; |
@@ -3776,30 +3776,30 @@ discard block |
||
| 3776 | 3776 | '.$inner.' |
| 3777 | 3777 | WHERE c.id = '.$courseId.' |
| 3778 | 3778 | GROUP BY stats_login.user_id |
| 3779 | - HAVING DATE_SUB( "' . $now . '", INTERVAL '.$since.' DAY) > max_date '; |
|
| 3779 | + HAVING DATE_SUB( "' . $now.'", INTERVAL '.$since.' DAY) > max_date '; |
|
| 3780 | 3780 | |
| 3781 | 3781 | if ($since == 'never') { |
| 3782 | 3782 | if (empty($session_id)) { |
| 3783 | 3783 | $sql = 'SELECT course_user.user_id |
| 3784 | - FROM ' . $table_course_rel_user . ' course_user |
|
| 3785 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
| 3784 | + FROM ' . $table_course_rel_user.' course_user |
|
| 3785 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
| 3786 | 3786 | ON course_user.user_id = stats_login.user_id AND |
| 3787 | - relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' |
|
| 3788 | - INNER JOIN ' . $tableCourse . ' c |
|
| 3787 | + relation_type<>' . COURSE_RELATION_TYPE_RRHH.' |
|
| 3788 | + INNER JOIN ' . $tableCourse.' c |
|
| 3789 | 3789 | ON (c.id = course_user.c_id) |
| 3790 | 3790 | WHERE |
| 3791 | - course_user.c_id = ' . $courseId . ' AND |
|
| 3791 | + course_user.c_id = ' . $courseId.' AND |
|
| 3792 | 3792 | stats_login.login_course_date IS NULL |
| 3793 | 3793 | GROUP BY course_user.user_id'; |
| 3794 | 3794 | } else { |
| 3795 | 3795 | $sql = 'SELECT session_course_user.user_id |
| 3796 | 3796 | FROM '.$tbl_session_course_user.' session_course_user |
| 3797 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
| 3797 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
| 3798 | 3798 | ON session_course_user.user_id = stats_login.user_id |
| 3799 | - INNER JOIN ' . $tableCourse . ' c |
|
| 3799 | + INNER JOIN ' . $tableCourse.' c |
|
| 3800 | 3800 | ON (c.id = session_course_user.c_id) |
| 3801 | 3801 | WHERE |
| 3802 | - session_course_user.c_id = ' . $courseId . ' AND |
|
| 3802 | + session_course_user.c_id = ' . $courseId.' AND |
|
| 3803 | 3803 | stats_login.login_course_date IS NULL |
| 3804 | 3804 | GROUP BY session_course_user.user_id'; |
| 3805 | 3805 | |
@@ -3808,7 +3808,7 @@ discard block |
||
| 3808 | 3808 | |
| 3809 | 3809 | $rs = Database::query($sql); |
| 3810 | 3810 | $inactive_users = array(); |
| 3811 | - while($user = Database::fetch_array($rs)) { |
|
| 3811 | + while ($user = Database::fetch_array($rs)) { |
|
| 3812 | 3812 | $inactive_users[] = $user['user_id']; |
| 3813 | 3813 | } |
| 3814 | 3814 | |
@@ -3830,10 +3830,10 @@ discard block |
||
| 3830 | 3830 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
| 3831 | 3831 | |
| 3832 | 3832 | $sql = 'SELECT '.$student_id.' |
| 3833 | - FROM ' . $table . ' |
|
| 3833 | + FROM ' . $table.' |
|
| 3834 | 3834 | WHERE |
| 3835 | - access_user_id=' . $student_id . ' AND |
|
| 3836 | - c_id="' . $courseId . '" AND |
|
| 3835 | + access_user_id=' . $student_id.' AND |
|
| 3836 | + c_id="' . $courseId.'" AND |
|
| 3837 | 3837 | access_session_id = "'.$session_id.'" '; |
| 3838 | 3838 | |
| 3839 | 3839 | $rs = Database::query($sql); |
@@ -3851,13 +3851,13 @@ discard block |
||
| 3851 | 3851 | { |
| 3852 | 3852 | $hr_dept_id = intval($hr_dept_id); |
| 3853 | 3853 | $a_students = array(); |
| 3854 | - $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 3854 | + $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 3855 | 3855 | |
| 3856 | 3856 | $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user |
| 3857 | 3857 | WHERE hr_dept_id='.$hr_dept_id; |
| 3858 | 3858 | $rs = Database::query($sql); |
| 3859 | 3859 | |
| 3860 | - while($user = Database :: fetch_array($rs)) { |
|
| 3860 | + while ($user = Database :: fetch_array($rs)) { |
|
| 3861 | 3861 | $a_students[$user['user_id']] = $user['user_id']; |
| 3862 | 3862 | } |
| 3863 | 3863 | |
@@ -3882,7 +3882,7 @@ discard block |
||
| 3882 | 3882 | $condition_session = ''; |
| 3883 | 3883 | if (isset($session_id)) { |
| 3884 | 3884 | $session_id = intval($session_id); |
| 3885 | - $condition_session = ' AND access_session_id = '. $session_id; |
|
| 3885 | + $condition_session = ' AND access_session_id = '.$session_id; |
|
| 3886 | 3886 | } |
| 3887 | 3887 | $sql = "SELECT |
| 3888 | 3888 | access_tool, |
@@ -3994,7 +3994,7 @@ discard block |
||
| 3994 | 3994 | if (!empty($date_from) && !empty($date_to)) { |
| 3995 | 3995 | $fieldStartDate = $fields['start_date']; |
| 3996 | 3996 | if (!isset($fields['end_date'])) { |
| 3997 | - $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to) ; |
|
| 3997 | + $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to); |
|
| 3998 | 3998 | } else { |
| 3999 | 3999 | $fieldEndDate = $fields['end_date']; |
| 4000 | 4000 | $where .= sprintf(" AND fieldStartDate >= '%s' |
@@ -4010,12 +4010,12 @@ discard block |
||
| 4010 | 4010 | $where |
| 4011 | 4011 | GROUP BY %s"; |
| 4012 | 4012 | $sql = sprintf($sql, |
| 4013 | - $fields['user'], //user field |
|
| 4014 | - $tableName, //FROM |
|
| 4015 | - $fields['course'], //course condition |
|
| 4016 | - $course['real_id'], //course condition |
|
| 4017 | - $fields['user'], //user condition |
|
| 4018 | - $userId, //user condition |
|
| 4013 | + $fields['user'], //user field |
|
| 4014 | + $tableName, //FROM |
|
| 4015 | + $fields['course'], //course condition |
|
| 4016 | + $course['real_id'], //course condition |
|
| 4017 | + $fields['user'], //user condition |
|
| 4018 | + $userId, //user condition |
|
| 4019 | 4019 | $fields['user'] //GROUP BY |
| 4020 | 4020 | ); |
| 4021 | 4021 | $rs = Database::query($sql); |
@@ -4023,7 +4023,7 @@ discard block |
||
| 4023 | 4023 | //iterate query |
| 4024 | 4024 | if (Database::num_rows($rs) > 0) { |
| 4025 | 4025 | while ($row = Database::fetch_array($rs)) { |
| 4026 | - $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total]: $row['total']; |
|
| 4026 | + $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total] : $row['total']; |
|
| 4027 | 4027 | } |
| 4028 | 4028 | } |
| 4029 | 4029 | } |
@@ -4046,11 +4046,11 @@ discard block |
||
| 4046 | 4046 | $courseId = api_get_course_int_id($course_code); |
| 4047 | 4047 | $data = array(); |
| 4048 | 4048 | |
| 4049 | - $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
| 4049 | + $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
| 4050 | 4050 | $condition_session = ''; |
| 4051 | 4051 | if (isset($session_id)) { |
| 4052 | 4052 | $session_id = intval($session_id); |
| 4053 | - $condition_session = ' AND down_session_id = '. $session_id; |
|
| 4053 | + $condition_session = ' AND down_session_id = '.$session_id; |
|
| 4054 | 4054 | } |
| 4055 | 4055 | $sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path) as count_down |
| 4056 | 4056 | FROM $TABLETRACK_DOWNLOADS |
@@ -4235,7 +4235,7 @@ discard block |
||
| 4235 | 4235 | |
| 4236 | 4236 | $final_course_data = array(); |
| 4237 | 4237 | |
| 4238 | - foreach($my_course_data as $course_id => $value) { |
|
| 4238 | + foreach ($my_course_data as $course_id => $value) { |
|
| 4239 | 4239 | $final_course_data[$course_id] = $course_list[$course_id]; |
| 4240 | 4240 | } |
| 4241 | 4241 | $course_in_session[$my_session_id]['course_list'] = $final_course_data; |
@@ -4256,7 +4256,7 @@ discard block |
||
| 4256 | 4256 | '.Display::tag('th', get_lang('Course'), array('width'=>'300px')).' |
| 4257 | 4257 | '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
| 4258 | 4258 | '.Display::tag('th', get_lang('Progress'), array('class'=>'head')).' |
| 4259 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')),array('class'=>'head')).' |
|
| 4259 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
| 4260 | 4260 | '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
| 4261 | 4261 | '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
| 4262 | 4262 | </tr>'; |
@@ -4343,7 +4343,7 @@ discard block |
||
| 4343 | 4343 | $all_exercise_start_time = array(); |
| 4344 | 4344 | |
| 4345 | 4345 | foreach ($course_in_session as $my_session_id => $session_data) { |
| 4346 | - $course_list = $session_data['course_list']; |
|
| 4346 | + $course_list = $session_data['course_list']; |
|
| 4347 | 4347 | $user_count = count(SessionManager::get_users_by_session($my_session_id)); |
| 4348 | 4348 | $exercise_graph_name_list = array(); |
| 4349 | 4349 | //$user_results = array(); |
@@ -4388,20 +4388,20 @@ discard block |
||
| 4388 | 4388 | |
| 4389 | 4389 | $score = 0; |
| 4390 | 4390 | if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) { |
| 4391 | - $score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100); |
|
| 4391 | + $score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100); |
|
| 4392 | 4392 | } |
| 4393 | 4393 | $time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0; |
| 4394 | 4394 | $all_exercise_start_time[] = $time; |
| 4395 | 4395 | $my_results[] = $score; |
| 4396 | - if (count($exercise_list)<=10) { |
|
| 4396 | + if (count($exercise_list) <= 10) { |
|
| 4397 | 4397 | $title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30); |
| 4398 | - $exercise_graph_name_list[]= $title; |
|
| 4398 | + $exercise_graph_name_list[] = $title; |
|
| 4399 | 4399 | $all_exercise_graph_name_list[] = $title; |
| 4400 | 4400 | } else { |
| 4401 | 4401 | // if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool |
| 4402 | 4402 | $title = cut($exercise_data['title'], 30); |
| 4403 | - $exercise_graph_name_list[]= $title; |
|
| 4404 | - $all_exercise_graph_name_list[]= $title; |
|
| 4403 | + $exercise_graph_name_list[] = $title; |
|
| 4404 | + $all_exercise_graph_name_list[] = $title; |
|
| 4405 | 4405 | } |
| 4406 | 4406 | } |
| 4407 | 4407 | } |
@@ -4434,7 +4434,7 @@ discard block |
||
| 4434 | 4434 | } |
| 4435 | 4435 | |
| 4436 | 4436 | $html .= Display::page_subheader( |
| 4437 | - Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('Sessions') |
|
| 4437 | + Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions') |
|
| 4438 | 4438 | ); |
| 4439 | 4439 | |
| 4440 | 4440 | $html .= '<table class="data_table" width="100%">'; |
@@ -4484,7 +4484,7 @@ discard block |
||
| 4484 | 4484 | $courseInfo['real_id'], |
| 4485 | 4485 | $my_session_id |
| 4486 | 4486 | ); |
| 4487 | - if ($attempts > 1) { |
|
| 4487 | + if ($attempts > 1) { |
|
| 4488 | 4488 | $answered_exercises++; |
| 4489 | 4489 | } |
| 4490 | 4490 | } |
@@ -4497,7 +4497,7 @@ discard block |
||
| 4497 | 4497 | $all_average += $average; |
| 4498 | 4498 | } |
| 4499 | 4499 | |
| 4500 | - $all_average = $all_average / count($course_list); |
|
| 4500 | + $all_average = $all_average / count($course_list); |
|
| 4501 | 4501 | |
| 4502 | 4502 | if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) { |
| 4503 | 4503 | $html .= '<tr style="background-color:#FBF09D">'; |
@@ -4522,31 +4522,31 @@ discard block |
||
| 4522 | 4522 | $html .= '</tr>'; |
| 4523 | 4523 | } |
| 4524 | 4524 | $html .= '</table><br />'; |
| 4525 | - $html .= Display::div($main_session_graph, array('id'=>'session_graph','class'=>'chart-session', 'style'=>'position:relative; text-align: center;') ); |
|
| 4525 | + $html .= Display::div($main_session_graph, array('id'=>'session_graph', 'class'=>'chart-session', 'style'=>'position:relative; text-align: center;')); |
|
| 4526 | 4526 | |
| 4527 | 4527 | // Checking selected session. |
| 4528 | 4528 | |
| 4529 | 4529 | if (isset($_GET['session_id'])) { |
| 4530 | 4530 | $session_id_from_get = intval($_GET['session_id']); |
| 4531 | - $session_data = $course_in_session[$session_id_from_get]; |
|
| 4532 | - $course_list = $session_data['course_list']; |
|
| 4531 | + $session_data = $course_in_session[$session_id_from_get]; |
|
| 4532 | + $course_list = $session_data['course_list']; |
|
| 4533 | 4533 | |
| 4534 | - $html .= Display::tag('h3',$session_data['name'].' - '.get_lang('CourseList')); |
|
| 4534 | + $html .= Display::tag('h3', $session_data['name'].' - '.get_lang('CourseList')); |
|
| 4535 | 4535 | |
| 4536 | 4536 | $html .= '<table class="data_table" width="100%">'; |
| 4537 | 4537 | //'.Display::tag('th', get_lang('DoneExercises'), array('class'=>'head')).' |
| 4538 | 4538 | $html .= ' |
| 4539 | 4539 | <tr> |
| 4540 | 4540 | <th width="300px">'.get_lang('Course').'</th> |
| 4541 | - '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
| 4542 | - '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
| 4543 | - '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
| 4544 | - '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
| 4545 | - '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
| 4546 | - '.Display::tag('th', get_lang('LPProgress') , array('class'=>'head')).' |
|
| 4547 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
| 4548 | - '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
| 4549 | - '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
| 4541 | + '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
| 4542 | + '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
| 4543 | + '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
| 4544 | + '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
| 4545 | + '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
| 4546 | + '.Display::tag('th', get_lang('LPProgress'), array('class'=>'head')).' |
|
| 4547 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
| 4548 | + '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
| 4549 | + '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
| 4550 | 4550 | </tr>'; |
| 4551 | 4551 | |
| 4552 | 4552 | foreach ($course_list as $course_data) { |
@@ -4562,14 +4562,14 @@ discard block |
||
| 4562 | 4562 | $count_exercises = count($exercises); |
| 4563 | 4563 | } |
| 4564 | 4564 | $answered_exercises = 0; |
| 4565 | - foreach($exercises as $exercise_item) { |
|
| 4565 | + foreach ($exercises as $exercise_item) { |
|
| 4566 | 4566 | $attempts = Event::count_exercise_attempts_by_user( |
| 4567 | 4567 | api_get_user_id(), |
| 4568 | 4568 | $exercise_item['id'], |
| 4569 | 4569 | $courseId, |
| 4570 | 4570 | $session_id_from_get |
| 4571 | 4571 | ); |
| 4572 | - if ($attempts > 1) { |
|
| 4572 | + if ($attempts > 1) { |
|
| 4573 | 4573 | $answered_exercises++; |
| 4574 | 4574 | } |
| 4575 | 4575 | } |
@@ -4578,7 +4578,7 @@ discard block |
||
| 4578 | 4578 | |
| 4579 | 4579 | // Average |
| 4580 | 4580 | $average = ExerciseLib::get_average_score_by_course($courseId, $session_id_from_get); |
| 4581 | - $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
| 4581 | + $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
| 4582 | 4582 | |
| 4583 | 4583 | $stats_array[$course_code] = array( |
| 4584 | 4584 | 'exercises' => $count_exercises, |
@@ -4648,11 +4648,11 @@ discard block |
||
| 4648 | 4648 | } |
| 4649 | 4649 | //Score |
| 4650 | 4650 | $html .= Display::tag('td', $percentage_score, array('align'=>'center')); |
| 4651 | - $html .= Display::tag('td', $last_connection, array('align'=>'center')); |
|
| 4651 | + $html .= Display::tag('td', $last_connection, array('align'=>'center')); |
|
| 4652 | 4652 | |
| 4653 | 4653 | if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) { |
| 4654 | 4654 | $details = '<a href="#">'; |
| 4655 | - $details .=Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
| 4655 | + $details .= Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
| 4656 | 4656 | } else { |
| 4657 | 4657 | $details = '<a href="'.api_get_self().'?course='.$course_code.'&session_id='.$session_id_from_get.$extra_params.'">'; |
| 4658 | 4658 | $details .= Display::return_icon('2rightarrow.png', get_lang('Details')); |
@@ -4775,7 +4775,7 @@ discard block |
||
| 4775 | 4775 | ); |
| 4776 | 4776 | |
| 4777 | 4777 | $latest_attempt_url = ''; |
| 4778 | - $best_score = $position = $percentage_score_result = '-'; |
|
| 4778 | + $best_score = $position = $percentage_score_result = '-'; |
|
| 4779 | 4779 | $graph = $normal_graph = null; |
| 4780 | 4780 | |
| 4781 | 4781 | // Getting best results |
@@ -4811,7 +4811,7 @@ discard block |
||
| 4811 | 4811 | $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url); |
| 4812 | 4812 | $my_score = 0; |
| 4813 | 4813 | if (!empty($weighting) && intval($weighting) != 0) { |
| 4814 | - $my_score = $score/$weighting; |
|
| 4814 | + $my_score = $score / $weighting; |
|
| 4815 | 4815 | } |
| 4816 | 4816 | //@todo this function slows the page |
| 4817 | 4817 | $position = ExerciseLib::get_exercise_result_ranking($my_score, $exe_id, $exercices['id'], $course_info['code'], $session_id, $user_list); |
@@ -4822,14 +4822,14 @@ discard block |
||
| 4822 | 4822 | } |
| 4823 | 4823 | $html .= Display::div( |
| 4824 | 4824 | $normal_graph, |
| 4825 | - array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none') |
|
| 4825 | + array('id'=>'main_graph_'.$exercices['id'], 'class'=>'dialog', 'style'=>'display:none') |
|
| 4826 | 4826 | ); |
| 4827 | 4827 | |
| 4828 | 4828 | if (empty($graph)) { |
| 4829 | 4829 | $graph = '-'; |
| 4830 | 4830 | } else { |
| 4831 | 4831 | $graph = Display::url( |
| 4832 | - '<img src="' . $graph . '" >', |
|
| 4832 | + '<img src="'.$graph.'" >', |
|
| 4833 | 4833 | $normal_graph, |
| 4834 | 4834 | array( |
| 4835 | 4835 | 'id' => $exercices['id'], |
@@ -4862,7 +4862,7 @@ discard block |
||
| 4862 | 4862 | |
| 4863 | 4863 | |
| 4864 | 4864 | // LP table results |
| 4865 | - $html .='<table class="data_table">'; |
|
| 4865 | + $html .= '<table class="data_table">'; |
|
| 4866 | 4866 | $html .= Display::tag('th', get_lang('Learnpaths'), array('class'=>'head', 'style'=>'color:#000')); |
| 4867 | 4867 | $html .= Display::tag('th', get_lang('LatencyTimeSpent'), array('class'=>'head', 'style'=>'color:#000')); |
| 4868 | 4868 | $html .= Display::tag('th', get_lang('Progress'), array('class'=>'head', 'style'=>'color:#000')); |
@@ -4916,7 +4916,7 @@ discard block |
||
| 4916 | 4916 | if (!empty($last_connection_in_lp)) { |
| 4917 | 4917 | $last_connection = api_convert_and_format_date($last_connection_in_lp, DATE_TIME_FORMAT_LONG); |
| 4918 | 4918 | } |
| 4919 | - $html .= Display::tag('td', $last_connection, array('align'=>'center','width'=>'180px')); |
|
| 4919 | + $html .= Display::tag('td', $last_connection, array('align'=>'center', 'width'=>'180px')); |
|
| 4920 | 4920 | $html .= "</tr>"; |
| 4921 | 4921 | } |
| 4922 | 4922 | } else { |
@@ -4926,7 +4926,7 @@ discard block |
||
| 4926 | 4926 | </td> |
| 4927 | 4927 | </tr>'; |
| 4928 | 4928 | } |
| 4929 | - $html .='</table>'; |
|
| 4929 | + $html .= '</table>'; |
|
| 4930 | 4930 | } |
| 4931 | 4931 | |
| 4932 | 4932 | return $html; |
@@ -4953,7 +4953,7 @@ discard block |
||
| 4953 | 4953 | $myData->setSerieDescription('Serie1', get_lang('MyResults')); |
| 4954 | 4954 | $myData->setSerieDescription('Serie2', get_lang('AverageScore')); |
| 4955 | 4955 | $myData->setAxisUnit(0, '%'); |
| 4956 | - $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
| 4956 | + $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
| 4957 | 4957 | // Cache definition |
| 4958 | 4958 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
| 4959 | 4959 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
@@ -4961,9 +4961,9 @@ discard block |
||
| 4961 | 4961 | |
| 4962 | 4962 | if ($myCache->isInCache($chartHash)) { |
| 4963 | 4963 | //if we already created the img |
| 4964 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
| 4964 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
| 4965 | 4965 | $myCache->saveFromCache($chartHash, $imgPath); |
| 4966 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
| 4966 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
| 4967 | 4967 | } else { |
| 4968 | 4968 | /* Define width, height and angle */ |
| 4969 | 4969 | $mainWidth = 860; |
@@ -4992,7 +4992,7 @@ discard block |
||
| 4992 | 4992 | /* Set the default font */ |
| 4993 | 4993 | $myPicture->setFontProperties( |
| 4994 | 4994 | array( |
| 4995 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
| 4995 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
| 4996 | 4996 | 'FontSize' => 10) |
| 4997 | 4997 | ); |
| 4998 | 4998 | /* Write the chart title */ |
@@ -5009,7 +5009,7 @@ discard block |
||
| 5009 | 5009 | /* Set the default font */ |
| 5010 | 5010 | $myPicture->setFontProperties( |
| 5011 | 5011 | array( |
| 5012 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
| 5012 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
| 5013 | 5013 | 'FontSize' => 6 |
| 5014 | 5014 | ) |
| 5015 | 5015 | ); |
@@ -5051,7 +5051,7 @@ discard block |
||
| 5051 | 5051 | /* Draw the line chart */ |
| 5052 | 5052 | $myPicture->setFontProperties( |
| 5053 | 5053 | array( |
| 5054 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
| 5054 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
| 5055 | 5055 | 'FontSize' => 10 |
| 5056 | 5056 | ) |
| 5057 | 5057 | ); |
@@ -5084,12 +5084,12 @@ discard block |
||
| 5084 | 5084 | ); |
| 5085 | 5085 | |
| 5086 | 5086 | $myCache->writeToCache($chartHash, $myPicture); |
| 5087 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
| 5087 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
| 5088 | 5088 | $myCache->saveFromCache($chartHash, $imgPath); |
| 5089 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
| 5089 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
| 5090 | 5090 | } |
| 5091 | 5091 | |
| 5092 | - $html = '<img src="' . $imgPath . '">'; |
|
| 5092 | + $html = '<img src="'.$imgPath.'">'; |
|
| 5093 | 5093 | |
| 5094 | 5094 | return $html; |
| 5095 | 5095 | } |
@@ -5110,12 +5110,12 @@ discard block |
||
| 5110 | 5110 | |
| 5111 | 5111 | foreach ($attempts as $attempt) { |
| 5112 | 5112 | if (api_get_user_id() == $attempt['exe_user_id']) { |
| 5113 | - if ($attempt['exe_weighting'] != 0 ) { |
|
| 5114 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
| 5113 | + if ($attempt['exe_weighting'] != 0) { |
|
| 5114 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
| 5115 | 5115 | } |
| 5116 | 5116 | } else { |
| 5117 | - if ($attempt['exe_weighting'] != 0 ) { |
|
| 5118 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
| 5117 | + if ($attempt['exe_weighting'] != 0) { |
|
| 5118 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
| 5119 | 5119 | } |
| 5120 | 5120 | } |
| 5121 | 5121 | } |
@@ -5124,27 +5124,27 @@ discard block |
||
| 5124 | 5124 | rsort($my_exercise_result_array); |
| 5125 | 5125 | $my_exercise_result = 0; |
| 5126 | 5126 | if (isset($my_exercise_result_array[0])) { |
| 5127 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
| 5127 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
| 5128 | 5128 | } |
| 5129 | 5129 | |
| 5130 | 5130 | $max = 100; |
| 5131 | - $pieces = 5 ; |
|
| 5131 | + $pieces = 5; |
|
| 5132 | 5132 | $part = round($max / $pieces); |
| 5133 | 5133 | $x_axis = array(); |
| 5134 | 5134 | $final_array = array(); |
| 5135 | 5135 | $my_final_array = array(); |
| 5136 | 5136 | |
| 5137 | - for ($i=1; $i <=$pieces; $i++) { |
|
| 5137 | + for ($i = 1; $i <= $pieces; $i++) { |
|
| 5138 | 5138 | $sum = 1; |
| 5139 | 5139 | if ($i == 1) { |
| 5140 | 5140 | $sum = 0; |
| 5141 | 5141 | } |
| 5142 | - $min = ($i-1)*$part + $sum; |
|
| 5143 | - $max = ($i)*$part; |
|
| 5144 | - $x_axis[]= $min." - ".$max; |
|
| 5142 | + $min = ($i - 1) * $part + $sum; |
|
| 5143 | + $max = ($i) * $part; |
|
| 5144 | + $x_axis[] = $min." - ".$max; |
|
| 5145 | 5145 | $count = 0; |
| 5146 | - foreach($exercise_result as $result) { |
|
| 5147 | - $percentage = $result*100; |
|
| 5146 | + foreach ($exercise_result as $result) { |
|
| 5147 | + $percentage = $result * 100; |
|
| 5148 | 5148 | //echo $percentage.' - '.$min.' - '.$max."<br />"; |
| 5149 | 5149 | if ($percentage >= $min && $percentage <= $max) { |
| 5150 | 5150 | //echo ' is > '; |
@@ -5152,7 +5152,7 @@ discard block |
||
| 5152 | 5152 | } |
| 5153 | 5153 | } |
| 5154 | 5154 | //echo '<br />'; |
| 5155 | - $final_array[]= $count; |
|
| 5155 | + $final_array[] = $count; |
|
| 5156 | 5156 | |
| 5157 | 5157 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
| 5158 | 5158 | $my_final_array[] = 1; |
@@ -5162,9 +5162,9 @@ discard block |
||
| 5162 | 5162 | } |
| 5163 | 5163 | |
| 5164 | 5164 | //Fix to remove the data of the user with my data |
| 5165 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
| 5165 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
| 5166 | 5166 | if (!empty($my_final_array[$i])) { |
| 5167 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
| 5167 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
| 5168 | 5168 | $final_array[$i] = 0; |
| 5169 | 5169 | } |
| 5170 | 5170 | } |
@@ -5174,16 +5174,16 @@ discard block |
||
| 5174 | 5174 | $dataSet->addPoints($final_array, 'Serie1'); |
| 5175 | 5175 | $dataSet->addPoints($my_final_array, 'Serie2'); |
| 5176 | 5176 | $dataSet->normalize(100, "%"); |
| 5177 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
| 5177 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
| 5178 | 5178 | |
| 5179 | 5179 | // Cache definition |
| 5180 | 5180 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
| 5181 | 5181 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
| 5182 | 5182 | $chartHash = $myCache->getHash($dataSet); |
| 5183 | 5183 | if ($myCache->isInCache($chartHash)) { |
| 5184 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
| 5184 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
| 5185 | 5185 | $myCache->saveFromCache($chartHash, $imgPath); |
| 5186 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
| 5186 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
| 5187 | 5187 | } else { |
| 5188 | 5188 | /* Create the pChart object */ |
| 5189 | 5189 | $widthSize = 80; |
@@ -5199,7 +5199,7 @@ discard block |
||
| 5199 | 5199 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
| 5200 | 5200 | |
| 5201 | 5201 | /* Set the default font */ |
| 5202 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
| 5202 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
| 5203 | 5203 | |
| 5204 | 5204 | /* Do not write the chart title */ |
| 5205 | 5205 | |
@@ -5263,9 +5263,9 @@ discard block |
||
| 5263 | 5263 | |
| 5264 | 5264 | /* Save and write in cache */ |
| 5265 | 5265 | $myCache->writeToCache($chartHash, $myPicture); |
| 5266 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
| 5266 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
| 5267 | 5267 | $myCache->saveFromCache($chartHash, $imgPath); |
| 5268 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
| 5268 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
| 5269 | 5269 | } |
| 5270 | 5270 | |
| 5271 | 5271 | return $imgPath; |
@@ -5285,12 +5285,12 @@ discard block |
||
| 5285 | 5285 | } |
| 5286 | 5286 | foreach ($attempts as $attempt) { |
| 5287 | 5287 | if (api_get_user_id() == $attempt['exe_user_id']) { |
| 5288 | - if ($attempt['exe_weighting'] != 0 ) { |
|
| 5289 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
| 5288 | + if ($attempt['exe_weighting'] != 0) { |
|
| 5289 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
| 5290 | 5290 | } |
| 5291 | 5291 | } else { |
| 5292 | - if ($attempt['exe_weighting'] != 0 ) { |
|
| 5293 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
| 5292 | + if ($attempt['exe_weighting'] != 0) { |
|
| 5293 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
| 5294 | 5294 | } |
| 5295 | 5295 | } |
| 5296 | 5296 | } |
@@ -5299,32 +5299,32 @@ discard block |
||
| 5299 | 5299 | rsort($my_exercise_result_array); |
| 5300 | 5300 | $my_exercise_result = 0; |
| 5301 | 5301 | if (isset($my_exercise_result_array[0])) { |
| 5302 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
| 5302 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
| 5303 | 5303 | } |
| 5304 | 5304 | |
| 5305 | 5305 | $max = 100; |
| 5306 | - $pieces = 5 ; |
|
| 5306 | + $pieces = 5; |
|
| 5307 | 5307 | $part = round($max / $pieces); |
| 5308 | 5308 | $x_axis = array(); |
| 5309 | 5309 | $final_array = array(); |
| 5310 | 5310 | $my_final_array = array(); |
| 5311 | 5311 | |
| 5312 | - for ($i=1; $i <=$pieces; $i++) { |
|
| 5312 | + for ($i = 1; $i <= $pieces; $i++) { |
|
| 5313 | 5313 | $sum = 1; |
| 5314 | 5314 | if ($i == 1) { |
| 5315 | 5315 | $sum = 0; |
| 5316 | 5316 | } |
| 5317 | - $min = ($i-1)*$part + $sum; |
|
| 5318 | - $max = ($i)*$part; |
|
| 5319 | - $x_axis[]= $min." - ".$max; |
|
| 5317 | + $min = ($i - 1) * $part + $sum; |
|
| 5318 | + $max = ($i) * $part; |
|
| 5319 | + $x_axis[] = $min." - ".$max; |
|
| 5320 | 5320 | $count = 0; |
| 5321 | - foreach($exercise_result as $result) { |
|
| 5322 | - $percentage = $result*100; |
|
| 5321 | + foreach ($exercise_result as $result) { |
|
| 5322 | + $percentage = $result * 100; |
|
| 5323 | 5323 | if ($percentage >= $min && $percentage <= $max) { |
| 5324 | 5324 | $count++; |
| 5325 | 5325 | } |
| 5326 | 5326 | } |
| 5327 | - $final_array[]= $count; |
|
| 5327 | + $final_array[] = $count; |
|
| 5328 | 5328 | |
| 5329 | 5329 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
| 5330 | 5330 | $my_final_array[] = 1; |
@@ -5335,9 +5335,9 @@ discard block |
||
| 5335 | 5335 | |
| 5336 | 5336 | //Fix to remove the data of the user with my data |
| 5337 | 5337 | |
| 5338 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
| 5338 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
| 5339 | 5339 | if (!empty($my_final_array[$i])) { |
| 5340 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
| 5340 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
| 5341 | 5341 | $final_array[$i] = 0; |
| 5342 | 5342 | } |
| 5343 | 5343 | } |
@@ -5355,7 +5355,7 @@ discard block |
||
| 5355 | 5355 | $dataSet->setXAxisName(get_lang('Score')); |
| 5356 | 5356 | $dataSet->normalize(100, "%"); |
| 5357 | 5357 | |
| 5358 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
| 5358 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
| 5359 | 5359 | |
| 5360 | 5360 | // Cache definition |
| 5361 | 5361 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
@@ -5363,9 +5363,9 @@ discard block |
||
| 5363 | 5363 | $chartHash = $myCache->getHash($dataSet); |
| 5364 | 5364 | |
| 5365 | 5365 | if ($myCache->isInCache($chartHash)) { |
| 5366 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
| 5366 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
| 5367 | 5367 | $myCache->saveFromCache($chartHash, $imgPath); |
| 5368 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
| 5368 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
| 5369 | 5369 | } else { |
| 5370 | 5370 | /* Create the pChart object */ |
| 5371 | 5371 | $widthSize = 480; |
@@ -5381,7 +5381,7 @@ discard block |
||
| 5381 | 5381 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
| 5382 | 5382 | |
| 5383 | 5383 | /* Set the default font */ |
| 5384 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
| 5384 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
| 5385 | 5385 | |
| 5386 | 5386 | /* Write the chart title */ |
| 5387 | 5387 | $myPicture->drawText( |
@@ -5440,9 +5440,9 @@ discard block |
||
| 5440 | 5440 | |
| 5441 | 5441 | /* Write and save into cache */ |
| 5442 | 5442 | $myCache->writeToCache($chartHash, $myPicture); |
| 5443 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
| 5443 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
| 5444 | 5444 | $myCache->saveFromCache($chartHash, $imgPath); |
| 5445 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
| 5445 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
| 5446 | 5446 | } |
| 5447 | 5447 | |
| 5448 | 5448 | return $imgPath; |
@@ -5568,7 +5568,7 @@ discard block |
||
| 5568 | 5568 | $whereSessionParams .= $sessionIdx.','; |
| 5569 | 5569 | } |
| 5570 | 5570 | } |
| 5571 | - $whereSessionParams = substr($whereSessionParams,0,-1); |
|
| 5571 | + $whereSessionParams = substr($whereSessionParams, 0, -1); |
|
| 5572 | 5572 | } |
| 5573 | 5573 | |
| 5574 | 5574 | if (!empty($exerciseId)) { |
@@ -5629,7 +5629,7 @@ discard block |
||
| 5629 | 5629 | qq.position = rq.question_order AND |
| 5630 | 5630 | ta.question_id = rq.question_id |
| 5631 | 5631 | WHERE |
| 5632 | - te.c_id = $courseIdx ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")." |
|
| 5632 | + te.c_id = $courseIdx ".(empty($whereSessionParams) ? '' : "AND te.session_id IN ($whereSessionParams)")." |
|
| 5633 | 5633 | AND q.c_id = $courseIdx |
| 5634 | 5634 | $where $order $limit"; |
| 5635 | 5635 | $sql_query = vsprintf($sql, $whereParams); |
@@ -5677,7 +5677,7 @@ discard block |
||
| 5677 | 5677 | // Now fill users data |
| 5678 | 5678 | $sqlUsers = "SELECT user_id, username, lastname, firstname |
| 5679 | 5679 | FROM $tuser |
| 5680 | - WHERE user_id IN (".implode(',',$userIds).")"; |
|
| 5680 | + WHERE user_id IN (".implode(',', $userIds).")"; |
|
| 5681 | 5681 | $resUsers = Database::query($sqlUsers); |
| 5682 | 5682 | while ($rowUser = Database::fetch_assoc($resUsers)) { |
| 5683 | 5683 | $users[$rowUser['user_id']] = $rowUser; |
@@ -5738,7 +5738,7 @@ discard block |
||
| 5738 | 5738 | WHERE |
| 5739 | 5739 | track_resource.c_id = $course_id AND |
| 5740 | 5740 | track_resource.insert_user_id = user.user_id AND |
| 5741 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
| 5741 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
| 5742 | 5742 | |
| 5743 | 5743 | if (isset($_GET['keyword'])) { |
| 5744 | 5744 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -5796,7 +5796,7 @@ discard block |
||
| 5796 | 5796 | WHERE |
| 5797 | 5797 | track_resource.c_id = $course_id AND |
| 5798 | 5798 | track_resource.insert_user_id = user.user_id AND |
| 5799 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
| 5799 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
| 5800 | 5800 | |
| 5801 | 5801 | if (isset($_GET['keyword'])) { |
| 5802 | 5802 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -6090,7 +6090,7 @@ discard block |
||
| 6090 | 6090 | public static function display_additional_profile_fields() |
| 6091 | 6091 | { |
| 6092 | 6092 | // getting all the extra profile fields that are defined by the platform administrator |
| 6093 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
| 6093 | + $extra_fields = UserManager :: get_extra_fields(0, 50, 5, 'ASC'); |
|
| 6094 | 6094 | |
| 6095 | 6095 | // creating the form |
| 6096 | 6096 | $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
@@ -6102,8 +6102,8 @@ discard block |
||
| 6102 | 6102 | $extra_fields_to_show = 0; |
| 6103 | 6103 | foreach ($extra_fields as $key=>$field) { |
| 6104 | 6104 | // show only extra fields that are visible + and can be filtered, added by J.Montoya |
| 6105 | - if ($field[6]==1 && $field[8] == 1) { |
|
| 6106 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
| 6105 | + if ($field[6] == 1 && $field[8] == 1) { |
|
| 6106 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field']) { |
|
| 6107 | 6107 | $selected = 'selected="selected"'; |
| 6108 | 6108 | } else { |
| 6109 | 6109 | $selected = ''; |
@@ -6115,8 +6115,8 @@ discard block |
||
| 6115 | 6115 | $return .= '</select>'; |
| 6116 | 6116 | |
| 6117 | 6117 | // the form elements for the $_GET parameters (because the form is passed through GET |
| 6118 | - foreach ($_GET as $key=>$value){ |
|
| 6119 | - if ($key <> 'additional_profile_field') { |
|
| 6118 | + foreach ($_GET as $key=>$value) { |
|
| 6119 | + if ($key <> 'additional_profile_field') { |
|
| 6120 | 6120 | $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
| 6121 | 6121 | } |
| 6122 | 6122 | } |
@@ -6153,21 +6153,21 @@ discard block |
||
| 6153 | 6153 | $result_extra_field = UserManager::get_extra_field_information($field_id); |
| 6154 | 6154 | |
| 6155 | 6155 | if (!empty($users)) { |
| 6156 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
| 6157 | - foreach($users as $user_id) { |
|
| 6156 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG) { |
|
| 6157 | + foreach ($users as $user_id) { |
|
| 6158 | 6158 | $user_result = UserManager::get_user_tags($user_id, $field_id); |
| 6159 | 6159 | $tag_list = array(); |
| 6160 | - foreach($user_result as $item) { |
|
| 6160 | + foreach ($user_result as $item) { |
|
| 6161 | 6161 | $tag_list[] = $item['tag']; |
| 6162 | 6162 | } |
| 6163 | - $return[$user_id][] = implode(', ',$tag_list); |
|
| 6163 | + $return[$user_id][] = implode(', ', $tag_list); |
|
| 6164 | 6164 | } |
| 6165 | 6165 | } else { |
| 6166 | 6166 | $new_user_array = array(); |
| 6167 | 6167 | foreach ($users as $user_id) { |
| 6168 | - $new_user_array[]= "'".$user_id."'"; |
|
| 6168 | + $new_user_array[] = "'".$user_id."'"; |
|
| 6169 | 6169 | } |
| 6170 | - $users = implode(',',$new_user_array); |
|
| 6170 | + $users = implode(',', $new_user_array); |
|
| 6171 | 6171 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
| 6172 | 6172 | // Selecting only the necessary information NOT ALL the user list |
| 6173 | 6173 | $sql = "SELECT user.user_id, v.value |
@@ -6182,7 +6182,7 @@ discard block |
||
| 6182 | 6182 | user.user_id IN ($users)"; |
| 6183 | 6183 | |
| 6184 | 6184 | $result = Database::query($sql); |
| 6185 | - while($row = Database::fetch_array($result)) { |
|
| 6185 | + while ($row = Database::fetch_array($result)) { |
|
| 6186 | 6186 | // get option value for field type double select by id |
| 6187 | 6187 | if (!empty($row['value'])) { |
| 6188 | 6188 | if ($result_extra_field['field_type'] == |
@@ -6221,7 +6221,7 @@ discard block |
||
| 6221 | 6221 | |
| 6222 | 6222 | public function sort_users_desc($a, $b) |
| 6223 | 6223 | { |
| 6224 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
| 6224 | + return strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
| 6225 | 6225 | } |
| 6226 | 6226 | |
| 6227 | 6227 | /** |
@@ -6256,7 +6256,7 @@ discard block |
||
| 6256 | 6256 | // get all users data from a course for sortable with limit |
| 6257 | 6257 | if (is_array($user_ids)) { |
| 6258 | 6258 | $user_ids = array_map('intval', $user_ids); |
| 6259 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
| 6259 | + $condition_user = " WHERE user.user_id IN (".implode(',', $user_ids).") "; |
|
| 6260 | 6260 | } else { |
| 6261 | 6261 | $user_ids = intval($user_ids); |
| 6262 | 6262 | $condition_user = " WHERE user.user_id = $user_ids "; |
@@ -6264,7 +6264,7 @@ discard block |
||
| 6264 | 6264 | |
| 6265 | 6265 | if (!empty($_GET['user_keyword'])) { |
| 6266 | 6266 | $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
| 6267 | - $condition_user .= " AND ( |
|
| 6267 | + $condition_user .= " AND ( |
|
| 6268 | 6268 | user.firstname LIKE '%".$keyword."%' OR |
| 6269 | 6269 | user.lastname LIKE '%".$keyword."%' OR |
| 6270 | 6270 | user.username LIKE '%".$keyword."%' OR |
@@ -6282,7 +6282,7 @@ discard block |
||
| 6282 | 6282 | $invitedUsersCondition = ''; |
| 6283 | 6283 | |
| 6284 | 6284 | if (!$includeInvitedUsers) { |
| 6285 | - $invitedUsersCondition = " AND user.status != " . INVITEE; |
|
| 6285 | + $invitedUsersCondition = " AND user.status != ".INVITEE; |
|
| 6286 | 6286 | } |
| 6287 | 6287 | |
| 6288 | 6288 | $sql = "SELECT user.user_id as user_id, |
@@ -6293,7 +6293,7 @@ discard block |
||
| 6293 | 6293 | FROM $tbl_user as user $url_table |
| 6294 | 6294 | $condition_user $url_condition $invitedUsersCondition"; |
| 6295 | 6295 | |
| 6296 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
| 6296 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
| 6297 | 6297 | $direction = 'ASC'; |
| 6298 | 6298 | } |
| 6299 | 6299 | |
@@ -6430,7 +6430,7 @@ discard block |
||
| 6430 | 6430 | } |
| 6431 | 6431 | |
| 6432 | 6432 | if (empty($session_id)) { |
| 6433 | - $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
|
| 6433 | + $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0).' / '.$total_surveys; |
|
| 6434 | 6434 | } |
| 6435 | 6435 | |
| 6436 | 6436 | $user['link'] = '<center> |
@@ -6442,34 +6442,34 @@ discard block |
||
| 6442 | 6442 | // store columns in array $users |
| 6443 | 6443 | $is_western_name_order = api_is_western_name_order(); |
| 6444 | 6444 | $user_row = array(); |
| 6445 | - $user_row[]= $user['official_code']; //0 |
|
| 6445 | + $user_row[] = $user['official_code']; //0 |
|
| 6446 | 6446 | if ($is_western_name_order) { |
| 6447 | - $user_row[]= $user['firstname']; |
|
| 6448 | - $user_row[]= $user['lastname']; |
|
| 6447 | + $user_row[] = $user['firstname']; |
|
| 6448 | + $user_row[] = $user['lastname']; |
|
| 6449 | 6449 | } else { |
| 6450 | - $user_row[]= $user['lastname']; |
|
| 6451 | - $user_row[]= $user['firstname']; |
|
| 6450 | + $user_row[] = $user['lastname']; |
|
| 6451 | + $user_row[] = $user['firstname']; |
|
| 6452 | 6452 | } |
| 6453 | - $user_row[]= $user['username']; |
|
| 6454 | - $user_row[]= $user['time']; |
|
| 6455 | - $user_row[]= $user['average_progress']; |
|
| 6456 | - $user_row[]= $user['exercise_progress']; |
|
| 6457 | - $user_row[]= $user['exercise_average_best_attempt']; |
|
| 6458 | - $user_row[]= $user['student_score']; |
|
| 6459 | - $user_row[]= $user['count_assignments']; |
|
| 6460 | - $user_row[]= $user['count_messages']; |
|
| 6453 | + $user_row[] = $user['username']; |
|
| 6454 | + $user_row[] = $user['time']; |
|
| 6455 | + $user_row[] = $user['average_progress']; |
|
| 6456 | + $user_row[] = $user['exercise_progress']; |
|
| 6457 | + $user_row[] = $user['exercise_average_best_attempt']; |
|
| 6458 | + $user_row[] = $user['student_score']; |
|
| 6459 | + $user_row[] = $user['count_assignments']; |
|
| 6460 | + $user_row[] = $user['count_messages']; |
|
| 6461 | 6461 | |
| 6462 | 6462 | if (empty($session_id)) { |
| 6463 | - $user_row[]= $user['survey']; |
|
| 6463 | + $user_row[] = $user['survey']; |
|
| 6464 | 6464 | } |
| 6465 | 6465 | |
| 6466 | - $user_row[]= $user['first_connection']; |
|
| 6467 | - $user_row[]= $user['last_connection']; |
|
| 6466 | + $user_row[] = $user['first_connection']; |
|
| 6467 | + $user_row[] = $user['last_connection']; |
|
| 6468 | 6468 | if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
| 6469 | - $user_row[]= $user['additional']; |
|
| 6469 | + $user_row[] = $user['additional']; |
|
| 6470 | 6470 | } |
| 6471 | 6471 | |
| 6472 | - $user_row[]= $user['link']; |
|
| 6472 | + $user_row[] = $user['link']; |
|
| 6473 | 6473 | |
| 6474 | 6474 | $users[] = $user_row; |
| 6475 | 6475 | |
@@ -6514,8 +6514,8 @@ discard block |
||
| 6514 | 6514 | |
| 6515 | 6515 | $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
| 6516 | 6516 | $tempView = $view; |
| 6517 | - if(substr($view,0,1) == '1') { |
|
| 6518 | - $new_view = substr_replace($view,'0',0,1); |
|
| 6517 | + if (substr($view, 0, 1) == '1') { |
|
| 6518 | + $new_view = substr_replace($view, '0', 0, 1); |
|
| 6519 | 6519 | echo " |
| 6520 | 6520 | <tr> |
| 6521 | 6521 | <td valign='top'> |
@@ -6548,9 +6548,9 @@ discard block |
||
| 6548 | 6548 | </tr>"; |
| 6549 | 6549 | $total = 0; |
| 6550 | 6550 | if (is_array($results)) { |
| 6551 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6551 | + for ($j = 0; $j < count($results); $j++) { |
|
| 6552 | 6552 | echo "<tr>"; |
| 6553 | - echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
| 6553 | + echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0]) - 1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
| 6554 | 6554 | echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
| 6555 | 6555 | echo"</tr>"; |
| 6556 | 6556 | $total = $total + $results[$j][1]; |
@@ -6567,7 +6567,7 @@ discard block |
||
| 6567 | 6567 | echo "</table>"; |
| 6568 | 6568 | echo "</td></tr>"; |
| 6569 | 6569 | } else { |
| 6570 | - $new_view = substr_replace($view,'1',0,1); |
|
| 6570 | + $new_view = substr_replace($view, '1', 0, 1); |
|
| 6571 | 6571 | echo " |
| 6572 | 6572 | <tr> |
| 6573 | 6573 | <td valign='top'> |
@@ -6590,8 +6590,8 @@ discard block |
||
| 6590 | 6590 | { |
| 6591 | 6591 | global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
| 6592 | 6592 | $courseId = api_get_course_int_id($courseCode); |
| 6593 | - if(substr($view,1,1) == '1') { |
|
| 6594 | - $new_view = substr_replace($view,'0',1,1); |
|
| 6593 | + if (substr($view, 1, 1) == '1') { |
|
| 6594 | + $new_view = substr_replace($view, '0', 1, 1); |
|
| 6595 | 6595 | echo "<tr> |
| 6596 | 6596 | <td valign='top'> |
| 6597 | 6597 | <font color='#0000FF'>- </font><b>".get_lang('ExercicesResults')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>] |
@@ -6633,7 +6633,7 @@ discard block |
||
| 6633 | 6633 | </tr>"; |
| 6634 | 6634 | |
| 6635 | 6635 | if (is_array($results)) { |
| 6636 | - for($i = 0; $i < sizeof($results); $i++) { |
|
| 6636 | + for ($i = 0; $i < sizeof($results); $i++) { |
|
| 6637 | 6637 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
| 6638 | 6638 | echo "<tr>\n"; |
| 6639 | 6639 | echo "<td class='content'>".$results[$i][0]."</td>\n"; |
@@ -6648,8 +6648,8 @@ discard block |
||
| 6648 | 6648 | |
| 6649 | 6649 | // The Result of Tests |
| 6650 | 6650 | if (is_array($hpresults)) { |
| 6651 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 6652 | - $title = GetQuizName($hpresults[$i][0],''); |
|
| 6651 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 6652 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
| 6653 | 6653 | if ($title == '') |
| 6654 | 6654 | $title = basename($hpresults[$i][0]); |
| 6655 | 6655 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
@@ -6675,7 +6675,7 @@ discard block |
||
| 6675 | 6675 | echo "</table>"; |
| 6676 | 6676 | echo "</td>\n</tr>\n"; |
| 6677 | 6677 | } else { |
| 6678 | - $new_view = substr_replace($view,'1',1,1); |
|
| 6678 | + $new_view = substr_replace($view, '1', 1, 1); |
|
| 6679 | 6679 | echo " |
| 6680 | 6680 | <tr> |
| 6681 | 6681 | <td valign='top'> |
@@ -6694,8 +6694,8 @@ discard block |
||
| 6694 | 6694 | global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
| 6695 | 6695 | $_course = api_get_course_info_by_id($course_id); |
| 6696 | 6696 | |
| 6697 | - if (substr($view,2,1) == '1') { |
|
| 6698 | - $new_view = substr_replace($view,'0',2,1); |
|
| 6697 | + if (substr($view, 2, 1) == '1') { |
|
| 6698 | + $new_view = substr_replace($view, '0', 2, 1); |
|
| 6699 | 6699 | echo "<tr> |
| 6700 | 6700 | <td valign='top'> |
| 6701 | 6701 | <font color='#0000FF'>- </font><b>".get_lang('WorkUploads')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>] |
@@ -6709,7 +6709,7 @@ discard block |
||
| 6709 | 6709 | AND u.c_id = '".intval($course_id)."' |
| 6710 | 6710 | ORDER BY u.upload_date DESC"; |
| 6711 | 6711 | echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
| 6712 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
| 6712 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
| 6713 | 6713 | echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
| 6714 | 6714 | echo "<tr> |
| 6715 | 6715 | <td class='secLine' width='40%'> |
@@ -6723,7 +6723,7 @@ discard block |
||
| 6723 | 6723 | </td> |
| 6724 | 6724 | </tr>"; |
| 6725 | 6725 | if (is_array($results)) { |
| 6726 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6726 | + for ($j = 0; $j < count($results); $j++) { |
|
| 6727 | 6727 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
| 6728 | 6728 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
| 6729 | 6729 | echo "<tr>"; |
@@ -6742,7 +6742,7 @@ discard block |
||
| 6742 | 6742 | echo "</table>"; |
| 6743 | 6743 | echo "</td></tr>"; |
| 6744 | 6744 | } else { |
| 6745 | - $new_view = substr_replace($view,'1',2,1); |
|
| 6745 | + $new_view = substr_replace($view, '1', 2, 1); |
|
| 6746 | 6746 | echo " |
| 6747 | 6747 | <tr> |
| 6748 | 6748 | <td valign='top'> |
@@ -6761,8 +6761,8 @@ discard block |
||
| 6761 | 6761 | { |
| 6762 | 6762 | global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
| 6763 | 6763 | $courseId = api_get_course_int_id($courseCode); |
| 6764 | - if (substr($view,3,1) == '1') { |
|
| 6765 | - $new_view = substr_replace($view,'0',3,1); |
|
| 6764 | + if (substr($view, 3, 1) == '1') { |
|
| 6765 | + $new_view = substr_replace($view, '0', 3, 1); |
|
| 6766 | 6766 | echo " |
| 6767 | 6767 | <tr> |
| 6768 | 6768 | <td valign='top'> |
@@ -6786,7 +6786,7 @@ discard block |
||
| 6786 | 6786 | </td> |
| 6787 | 6787 | </tr>"; |
| 6788 | 6788 | if (is_array($results)) { |
| 6789 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6789 | + for ($j = 0; $j < count($results); $j++) { |
|
| 6790 | 6790 | echo "<tr>"; |
| 6791 | 6791 | echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
| 6792 | 6792 | echo"</tr>"; |
@@ -6799,7 +6799,7 @@ discard block |
||
| 6799 | 6799 | echo "</table>"; |
| 6800 | 6800 | echo "</td></tr>"; |
| 6801 | 6801 | } else { |
| 6802 | - $new_view = substr_replace($view,'1',3,1); |
|
| 6802 | + $new_view = substr_replace($view, '1', 3, 1); |
|
| 6803 | 6803 | echo " |
| 6804 | 6804 | <tr> |
| 6805 | 6805 | <td valign='top'> |
@@ -6826,8 +6826,8 @@ discard block |
||
| 6826 | 6826 | $session_id = intval($session_id); |
| 6827 | 6827 | |
| 6828 | 6828 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
| 6829 | - if(substr($view,4,1) == '1') { |
|
| 6830 | - $new_view = substr_replace($view,'0',4,1); |
|
| 6829 | + if (substr($view, 4, 1) == '1') { |
|
| 6830 | + $new_view = substr_replace($view, '0', 4, 1); |
|
| 6831 | 6831 | echo " |
| 6832 | 6832 | <tr> |
| 6833 | 6833 | <td valign='top'> |
@@ -6853,7 +6853,7 @@ discard block |
||
| 6853 | 6853 | </td> |
| 6854 | 6854 | </tr>"; |
| 6855 | 6855 | if (is_array($results)) { |
| 6856 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6856 | + for ($j = 0; $j < count($results); $j++) { |
|
| 6857 | 6857 | echo "<tr>"; |
| 6858 | 6858 | echo "<td class='content'>".$results[$j]."</td>"; |
| 6859 | 6859 | echo"</tr>"; |
@@ -6866,7 +6866,7 @@ discard block |
||
| 6866 | 6866 | echo "</table>"; |
| 6867 | 6867 | echo "</td></tr>"; |
| 6868 | 6868 | } else { |
| 6869 | - $new_view = substr_replace($view,'1',4,1); |
|
| 6869 | + $new_view = substr_replace($view, '1', 4, 1); |
|
| 6870 | 6870 | echo " |
| 6871 | 6871 | <tr> |
| 6872 | 6872 | <td valign='top'> |
@@ -6900,11 +6900,11 @@ discard block |
||
| 6900 | 6900 | ORDER BY login_date DESC LIMIT 1"; |
| 6901 | 6901 | $ip = ''; |
| 6902 | 6902 | $res_ip = Database::query($sql_ip); |
| 6903 | - if ($res_ip !== false && Database::num_rows($res_ip)>0) { |
|
| 6903 | + if ($res_ip !== false && Database::num_rows($res_ip) > 0) { |
|
| 6904 | 6904 | $row_ip = Database::fetch_row($res_ip); |
| 6905 | 6905 | if ($return_as_link) { |
| 6906 | 6906 | $ip = Display::url( |
| 6907 | - (empty($body_replace)?$row_ip[1]:$body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
| 6907 | + (empty($body_replace) ? $row_ip[1] : $body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
| 6908 | 6908 | array('title'=>get_lang('TraceIP'), 'target'=>'_blank') |
| 6909 | 6909 | ); |
| 6910 | 6910 | } else { |
@@ -6940,9 +6940,9 @@ discard block |
||
| 6940 | 6940 | $course_id = intval($course_id); |
| 6941 | 6941 | |
| 6942 | 6942 | $tempView = $view; |
| 6943 | - if (substr($view,0,1) == '1') { |
|
| 6944 | - $new_view = substr_replace($view,'0',0,1); |
|
| 6945 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
| 6943 | + if (substr($view, 0, 1) == '1') { |
|
| 6944 | + $new_view = substr_replace($view, '0', 0, 1); |
|
| 6945 | + $title[1] = get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
| 6946 | 6946 | $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
| 6947 | 6947 | FROM $track_access_table |
| 6948 | 6948 | WHERE access_user_id = $user_id |
@@ -6952,20 +6952,20 @@ discard block |
||
| 6952 | 6952 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
| 6953 | 6953 | //$results = getManyResults2Col($sql); |
| 6954 | 6954 | $results = getManyResults3Col($sql); |
| 6955 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
| 6956 | - $line=''; |
|
| 6955 | + $title_line = get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
| 6956 | + $line = ''; |
|
| 6957 | 6957 | $total = 0; |
| 6958 | 6958 | if (is_array($results)) { |
| 6959 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6959 | + for ($j = 0; $j < count($results); $j++) { |
|
| 6960 | 6960 | $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
| 6961 | 6961 | $total = $total + $results[$j][1]; |
| 6962 | 6962 | } |
| 6963 | 6963 | $line .= get_lang('Total').";".$total."\n"; |
| 6964 | 6964 | } else { |
| 6965 | - $line= get_lang('NoResult')."</center></td>"; |
|
| 6965 | + $line = get_lang('NoResult')."</center></td>"; |
|
| 6966 | 6966 | } |
| 6967 | 6967 | } else { |
| 6968 | - $new_view = substr_replace($view,'1',0,1); |
|
| 6968 | + $new_view = substr_replace($view, '1', 0, 1); |
|
| 6969 | 6969 | } |
| 6970 | 6970 | return array($title_line, $line); |
| 6971 | 6971 | } |
@@ -6983,8 +6983,8 @@ discard block |
||
| 6983 | 6983 | global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
| 6984 | 6984 | $courseId = api_get_course_int_id($courseCode); |
| 6985 | 6985 | $userId = intval($userId); |
| 6986 | - if (substr($view,1,1) == '1') { |
|
| 6987 | - $new_view = substr_replace($view,'0',1,1); |
|
| 6986 | + if (substr($view, 1, 1) == '1') { |
|
| 6987 | + $new_view = substr_replace($view, '0', 1, 1); |
|
| 6988 | 6988 | $title[1] = get_lang('ExercicesDetails'); |
| 6989 | 6989 | $line = ''; |
| 6990 | 6990 | $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
@@ -7008,7 +7008,7 @@ discard block |
||
| 7008 | 7008 | $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
| 7009 | 7009 | |
| 7010 | 7010 | if (is_array($results)) { |
| 7011 | - for($i = 0; $i < sizeof($results); $i++) |
|
| 7011 | + for ($i = 0; $i < sizeof($results); $i++) |
|
| 7012 | 7012 | { |
| 7013 | 7013 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
| 7014 | 7014 | $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
@@ -7020,8 +7020,8 @@ discard block |
||
| 7020 | 7020 | |
| 7021 | 7021 | // The Result of Tests |
| 7022 | 7022 | if (is_array($hpresults)) { |
| 7023 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 7024 | - $title = GetQuizName($hpresults[$i][0],''); |
|
| 7023 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 7024 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
| 7025 | 7025 | |
| 7026 | 7026 | if ($title == '') |
| 7027 | 7027 | $title = basename($hpresults[$i][0]); |
@@ -7035,10 +7035,10 @@ discard block |
||
| 7035 | 7035 | } |
| 7036 | 7036 | |
| 7037 | 7037 | if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
| 7038 | - $line=get_lang('NoResult'); |
|
| 7038 | + $line = get_lang('NoResult'); |
|
| 7039 | 7039 | } |
| 7040 | 7040 | } else { |
| 7041 | - $new_view = substr_replace($view,'1',1,1); |
|
| 7041 | + $new_view = substr_replace($view, '1', 1, 1); |
|
| 7042 | 7042 | } |
| 7043 | 7043 | return array($title_line, $line); |
| 7044 | 7044 | } |
@@ -7054,7 +7054,7 @@ discard block |
||
| 7054 | 7054 | $user_id = intval($user_id); |
| 7055 | 7055 | $course_id = intval($course_id); |
| 7056 | 7056 | |
| 7057 | - if (substr($view,2,1) == '1') { |
|
| 7057 | + if (substr($view, 2, 1) == '1') { |
|
| 7058 | 7058 | $sql = "SELECT u.upload_date, w.title, w.author, w.url |
| 7059 | 7059 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
| 7060 | 7060 | WHERE |
@@ -7062,21 +7062,21 @@ discard block |
||
| 7062 | 7062 | u.upload_user_id = '$user_id' AND |
| 7063 | 7063 | u.c_id = '$course_id' |
| 7064 | 7064 | ORDER BY u.upload_date DESC"; |
| 7065 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
| 7065 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
| 7066 | 7066 | |
| 7067 | - $title[1]=get_lang('WorksDetails'); |
|
| 7068 | - $line=''; |
|
| 7069 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
| 7067 | + $title[1] = get_lang('WorksDetails'); |
|
| 7068 | + $line = ''; |
|
| 7069 | + $title_line = get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
| 7070 | 7070 | |
| 7071 | 7071 | if (is_array($results)) { |
| 7072 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 7072 | + for ($j = 0; $j < count($results); $j++) { |
|
| 7073 | 7073 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
| 7074 | 7074 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
| 7075 | 7075 | $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
| 7076 | 7076 | } |
| 7077 | 7077 | |
| 7078 | 7078 | } else { |
| 7079 | - $line= get_lang('NoResult'); |
|
| 7079 | + $line = get_lang('NoResult'); |
|
| 7080 | 7080 | } |
| 7081 | 7081 | } |
| 7082 | 7082 | return array($title_line, $line); |
@@ -7092,9 +7092,9 @@ discard block |
||
| 7092 | 7092 | $courseId = api_get_course_int_id($courseCode); |
| 7093 | 7093 | $userId = intval($userId); |
| 7094 | 7094 | $line = null; |
| 7095 | - if (substr($view,3,1) == '1') { |
|
| 7096 | - $new_view = substr_replace($view,'0',3,1); |
|
| 7097 | - $title[1]=get_lang('LinksDetails'); |
|
| 7095 | + if (substr($view, 3, 1) == '1') { |
|
| 7096 | + $new_view = substr_replace($view, '0', 3, 1); |
|
| 7097 | + $title[1] = get_lang('LinksDetails'); |
|
| 7098 | 7098 | $sql = "SELECT cl.title, cl.url |
| 7099 | 7099 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
| 7100 | 7100 | WHERE sl.links_link_id = cl.id |
@@ -7102,16 +7102,16 @@ discard block |
||
| 7102 | 7102 | AND sl.links_user_id = $userId |
| 7103 | 7103 | GROUP BY cl.title, cl.url"; |
| 7104 | 7104 | $results = StatsUtils::getManyResults2Col($sql); |
| 7105 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
| 7105 | + $title_line = get_lang('LinksTitleLinkColumn')."\n"; |
|
| 7106 | 7106 | if (is_array($results)) { |
| 7107 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
| 7107 | + for ($j = 0; $j < count($results); $j++) { |
|
| 7108 | 7108 | $line .= $results[$j][0]."\n"; |
| 7109 | 7109 | } |
| 7110 | 7110 | } else { |
| 7111 | - $line=get_lang('NoResult'); |
|
| 7111 | + $line = get_lang('NoResult'); |
|
| 7112 | 7112 | } |
| 7113 | 7113 | } else { |
| 7114 | - $new_view = substr_replace($view,'1',3,1); |
|
| 7114 | + $new_view = substr_replace($view, '1', 3, 1); |
|
| 7115 | 7115 | } |
| 7116 | 7116 | return array($title_line, $line); |
| 7117 | 7117 | } |
@@ -7133,9 +7133,9 @@ discard block |
||
| 7133 | 7133 | |
| 7134 | 7134 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
| 7135 | 7135 | |
| 7136 | - if (substr($view,4,1) == '1') { |
|
| 7137 | - $new_view = substr_replace($view,'0',4,1); |
|
| 7138 | - $title[1]= get_lang('DocumentsDetails'); |
|
| 7136 | + if (substr($view, 4, 1) == '1') { |
|
| 7137 | + $new_view = substr_replace($view, '0', 4, 1); |
|
| 7138 | + $title[1] = get_lang('DocumentsDetails'); |
|
| 7139 | 7139 | |
| 7140 | 7140 | $sql = "SELECT down_doc_path |
| 7141 | 7141 | FROM $downloads_table |
@@ -7148,14 +7148,14 @@ discard block |
||
| 7148 | 7148 | $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
| 7149 | 7149 | $line = null; |
| 7150 | 7150 | if (is_array($results)) { |
| 7151 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
| 7151 | + for ($j = 0; $j < count($results); $j++) { |
|
| 7152 | 7152 | $line .= $results[$j]."\n"; |
| 7153 | 7153 | } |
| 7154 | 7154 | } else { |
| 7155 | 7155 | $line = get_lang('NoResult'); |
| 7156 | 7156 | } |
| 7157 | 7157 | } else { |
| 7158 | - $new_view = substr_replace($view,'1',4,1); |
|
| 7158 | + $new_view = substr_replace($view, '1', 4, 1); |
|
| 7159 | 7159 | } |
| 7160 | 7160 | return array($title_line, $line); |
| 7161 | 7161 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * @param string $url The URL of the site |
| 19 | 19 | * @param string $description The description of the site |
| 20 | 20 | * @param int $active is active or not |
| 21 | - * @return boolean if success |
|
| 21 | + * @return Doctrine\DBAL\Driver\Statement|null if success |
|
| 22 | 22 | */ |
| 23 | 23 | public static function add($url, $description, $active) |
| 24 | 24 | { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @param string $url |
| 44 | 44 | * @param string $description The description of the site |
| 45 | 45 | * @param int $active is active or not |
| 46 | - * @return boolean if success |
|
| 46 | + * @return Doctrine\DBAL\Driver\Statement|null if success |
|
| 47 | 47 | */ |
| 48 | 48 | public static function update($url_id, $url, $description, $active) |
| 49 | 49 | { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @author Julio Montoya |
| 68 | 68 | * @param int $id url id |
| 69 | 69 | * |
| 70 | - * @return boolean true if success |
|
| 70 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
| 71 | 71 | * */ |
| 72 | 72 | public static function delete($id) |
| 73 | 73 | { |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | * @author Julio Montoya |
| 367 | 367 | * @param int user id |
| 368 | 368 | * @param int url id |
| 369 | - * @return boolean true if success |
|
| 369 | + * @return integer true if success |
|
| 370 | 370 | * */ |
| 371 | 371 | public static function relation_url_user_exist($user_id, $url_id) |
| 372 | 372 | { |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | * @author Julio Montoya |
| 385 | 385 | * @param int $courseId |
| 386 | 386 | * @param int $urlId |
| 387 | - * @return boolean true if success |
|
| 387 | + * @return integer true if success |
|
| 388 | 388 | * */ |
| 389 | 389 | public static function relation_url_course_exist($courseId, $urlId) |
| 390 | 390 | { |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | * @author Julio Montoya |
| 406 | 406 | * @param int $userGroupId |
| 407 | 407 | * @param int $urlId |
| 408 | - * @return boolean true if success |
|
| 408 | + * @return integer true if success |
|
| 409 | 409 | * */ |
| 410 | 410 | public static function relationUrlUsergroupExist($userGroupId, $urlId) |
| 411 | 411 | { |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | * @author Julio Montoya |
| 425 | 425 | * @param int user id |
| 426 | 426 | * @param int url id |
| 427 | - * @return boolean true if success |
|
| 427 | + * @return integer true if success |
|
| 428 | 428 | * */ |
| 429 | 429 | public static function relation_url_session_exist($session_id, $url_id) |
| 430 | 430 | { |
@@ -545,6 +545,8 @@ discard block |
||
| 545 | 545 | * @author Julio Montoya |
| 546 | 546 | * @param array of course ids |
| 547 | 547 | * @param array of url_ids |
| 548 | + * @param integer[] $courseCategoryList |
|
| 549 | + * @param integer[] $urlList |
|
| 548 | 550 | * @return array |
| 549 | 551 | **/ |
| 550 | 552 | public static function addCourseCategoryListToUrl($courseCategoryList, $urlList) |
@@ -575,7 +577,7 @@ discard block |
||
| 575 | 577 | * @author Julio Montoya |
| 576 | 578 | * @param int $categoryCourseId |
| 577 | 579 | * @param int $urlId |
| 578 | - * @return boolean true if success |
|
| 580 | + * @return integer true if success |
|
| 579 | 581 | * */ |
| 580 | 582 | public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId) |
| 581 | 583 | { |
@@ -592,7 +594,7 @@ discard block |
||
| 592 | 594 | /** |
| 593 | 595 | * @param int $userGroupId |
| 594 | 596 | * @param int $urlId |
| 595 | - * @return int |
|
| 597 | + * @return string |
|
| 596 | 598 | */ |
| 597 | 599 | public static function addUserGroupToUrl($userGroupId, $urlId) |
| 598 | 600 | { |
@@ -692,7 +694,7 @@ discard block |
||
| 692 | 694 | * @param int $courseId |
| 693 | 695 | * @param int $url_id |
| 694 | 696 | * |
| 695 | - * @return resource |
|
| 697 | + * @return boolean |
|
| 696 | 698 | */ |
| 697 | 699 | public static function add_course_to_url($courseId, $url_id = 1) |
| 698 | 700 | { |
@@ -763,7 +765,7 @@ discard block |
||
| 763 | 765 | * @param int $courseId |
| 764 | 766 | * @param int $urlId |
| 765 | 767 | * |
| 766 | - * @return boolean true if success |
|
| 768 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
| 767 | 769 | * */ |
| 768 | 770 | public static function delete_url_rel_course($courseId, $urlId) |
| 769 | 771 | { |
@@ -781,7 +783,7 @@ discard block |
||
| 781 | 783 | * @param int $userGroupId |
| 782 | 784 | * @param int $urlId |
| 783 | 785 | * |
| 784 | - * @return boolean true if success |
|
| 786 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
| 785 | 787 | * */ |
| 786 | 788 | public static function delete_url_rel_usergroup($userGroupId, $urlId) |
| 787 | 789 | { |
@@ -800,7 +802,7 @@ discard block |
||
| 800 | 802 | * @param int $userGroupId |
| 801 | 803 | * @param int $urlId |
| 802 | 804 | * |
| 803 | - * @return boolean true if success |
|
| 805 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
| 804 | 806 | * */ |
| 805 | 807 | public static function deleteUrlRelCourseCategory($userGroupId, $urlId) |
| 806 | 808 | { |
@@ -819,7 +821,7 @@ discard block |
||
| 819 | 821 | * @param char course code |
| 820 | 822 | * @param int url id |
| 821 | 823 | * |
| 822 | - * @return boolean true if success |
|
| 824 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
| 823 | 825 | * */ |
| 824 | 826 | public static function delete_url_rel_session($session_id, $url_id) |
| 825 | 827 | { |
@@ -11,15 +11,15 @@ discard block |
||
| 11 | 11 | class UrlManager |
| 12 | 12 | { |
| 13 | 13 | /** |
| 14 | - * Creates a new url access |
|
| 15 | - * |
|
| 16 | - * @author Julio Montoya <[email protected]>, |
|
| 17 | - * |
|
| 18 | - * @param string $url The URL of the site |
|
| 19 | - * @param string $description The description of the site |
|
| 20 | - * @param int $active is active or not |
|
| 21 | - * @return boolean if success |
|
| 22 | - */ |
|
| 14 | + * Creates a new url access |
|
| 15 | + * |
|
| 16 | + * @author Julio Montoya <[email protected]>, |
|
| 17 | + * |
|
| 18 | + * @param string $url The URL of the site |
|
| 19 | + * @param string $description The description of the site |
|
| 20 | + * @param int $active is active or not |
|
| 21 | + * @return boolean if success |
|
| 22 | + */ |
|
| 23 | 23 | public static function add($url, $description, $active) |
| 24 | 24 | { |
| 25 | 25 | $tms = time(); |
@@ -36,15 +36,15 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * Updates an URL access |
|
| 40 | - * @author Julio Montoya <[email protected]>, |
|
| 41 | - * |
|
| 42 | - * @param int $url_id The url id |
|
| 43 | - * @param string $url |
|
| 44 | - * @param string $description The description of the site |
|
| 45 | - * @param int $active is active or not |
|
| 46 | - * @return boolean if success |
|
| 47 | - */ |
|
| 39 | + * Updates an URL access |
|
| 40 | + * @author Julio Montoya <[email protected]>, |
|
| 41 | + * |
|
| 42 | + * @param int $url_id The url id |
|
| 43 | + * @param string $url |
|
| 44 | + * @param string $description The description of the site |
|
| 45 | + * @param int $active is active or not |
|
| 46 | + * @return boolean if success |
|
| 47 | + */ |
|
| 48 | 48 | public static function update($url_id, $url, $description, $active) |
| 49 | 49 | { |
| 50 | 50 | $url_id = intval($url_id); |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * Deletes an url |
|
| 67 | - * @author Julio Montoya |
|
| 68 | - * @param int $id url id |
|
| 66 | + * Deletes an url |
|
| 67 | + * @author Julio Montoya |
|
| 68 | + * @param int $id url id |
|
| 69 | 69 | * |
| 70 | - * @return boolean true if success |
|
| 71 | - * */ |
|
| 70 | + * @return boolean true if success |
|
| 71 | + * */ |
|
| 72 | 72 | public static function delete($id) |
| 73 | 73 | { |
| 74 | 74 | $id = intval($id); |
@@ -200,12 +200,12 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | - * Gets the inner join of access_url and the course table |
|
| 204 | - * |
|
| 205 | - * @author Julio Montoya |
|
| 206 | - * @param int access url id |
|
| 207 | - * @return array Database::store_result of the result |
|
| 208 | - **/ |
|
| 203 | + * Gets the inner join of access_url and the course table |
|
| 204 | + * |
|
| 205 | + * @author Julio Montoya |
|
| 206 | + * @param int access url id |
|
| 207 | + * @return array Database::store_result of the result |
|
| 208 | + **/ |
|
| 209 | 209 | public static function get_url_rel_course_data($access_url_id = null) |
| 210 | 210 | { |
| 211 | 211 | $where = ''; |
@@ -362,12 +362,12 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | /** |
| 365 | - * Checks the relationship between an URL and a User (return the num_rows) |
|
| 366 | - * @author Julio Montoya |
|
| 367 | - * @param int user id |
|
| 368 | - * @param int url id |
|
| 369 | - * @return boolean true if success |
|
| 370 | - * */ |
|
| 365 | + * Checks the relationship between an URL and a User (return the num_rows) |
|
| 366 | + * @author Julio Montoya |
|
| 367 | + * @param int user id |
|
| 368 | + * @param int url id |
|
| 369 | + * @return boolean true if success |
|
| 370 | + * */ |
|
| 371 | 371 | public static function relation_url_user_exist($user_id, $url_id) |
| 372 | 372 | { |
| 373 | 373 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
@@ -377,15 +377,15 @@ discard block |
||
| 377 | 377 | $num = Database::num_rows($result); |
| 378 | 378 | |
| 379 | 379 | return $num; |
| 380 | - } |
|
| 380 | + } |
|
| 381 | 381 | |
| 382 | 382 | /** |
| 383 | - * Checks the relationship between an URL and a Course (return the num_rows) |
|
| 384 | - * @author Julio Montoya |
|
| 385 | - * @param int $courseId |
|
| 386 | - * @param int $urlId |
|
| 387 | - * @return boolean true if success |
|
| 388 | - * */ |
|
| 383 | + * Checks the relationship between an URL and a Course (return the num_rows) |
|
| 384 | + * @author Julio Montoya |
|
| 385 | + * @param int $courseId |
|
| 386 | + * @param int $urlId |
|
| 387 | + * @return boolean true if success |
|
| 388 | + * */ |
|
| 389 | 389 | public static function relation_url_course_exist($courseId, $urlId) |
| 390 | 390 | { |
| 391 | 391 | $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
@@ -420,12 +420,12 @@ discard block |
||
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | /** |
| 423 | - * Checks the relationship between an URL and a Session (return the num_rows) |
|
| 424 | - * @author Julio Montoya |
|
| 425 | - * @param int user id |
|
| 426 | - * @param int url id |
|
| 427 | - * @return boolean true if success |
|
| 428 | - * */ |
|
| 423 | + * Checks the relationship between an URL and a Session (return the num_rows) |
|
| 424 | + * @author Julio Montoya |
|
| 425 | + * @param int user id |
|
| 426 | + * @param int url id |
|
| 427 | + * @return boolean true if success |
|
| 428 | + * */ |
|
| 429 | 429 | public static function relation_url_session_exist($session_id, $url_id) |
| 430 | 430 | { |
| 431 | 431 | $table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
@@ -737,13 +737,13 @@ discard block |
||
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | /** |
| 740 | - * Deletes an url and user relationship |
|
| 741 | - * @author Julio Montoya |
|
| 742 | - * @param int user id |
|
| 743 | - * @param int url id |
|
| 740 | + * Deletes an url and user relationship |
|
| 741 | + * @author Julio Montoya |
|
| 742 | + * @param int user id |
|
| 743 | + * @param int url id |
|
| 744 | 744 | * |
| 745 | - * @return boolean true if success |
|
| 746 | - * */ |
|
| 745 | + * @return boolean true if success |
|
| 746 | + * */ |
|
| 747 | 747 | public static function delete_url_rel_user($user_id, $url_id) |
| 748 | 748 | { |
| 749 | 749 | $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
@@ -758,13 +758,13 @@ discard block |
||
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | /** |
| 761 | - * Deletes an url and course relationship |
|
| 762 | - * @author Julio Montoya |
|
| 763 | - * @param int $courseId |
|
| 764 | - * @param int $urlId |
|
| 761 | + * Deletes an url and course relationship |
|
| 762 | + * @author Julio Montoya |
|
| 763 | + * @param int $courseId |
|
| 764 | + * @param int $urlId |
|
| 765 | 765 | * |
| 766 | - * @return boolean true if success |
|
| 767 | - * */ |
|
| 766 | + * @return boolean true if success |
|
| 767 | + * */ |
|
| 768 | 768 | public static function delete_url_rel_course($courseId, $urlId) |
| 769 | 769 | { |
| 770 | 770 | $table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
@@ -814,13 +814,13 @@ discard block |
||
| 814 | 814 | } |
| 815 | 815 | |
| 816 | 816 | /** |
| 817 | - * Deletes an url and session relationship |
|
| 818 | - * @author Julio Montoya |
|
| 819 | - * @param char course code |
|
| 820 | - * @param int url id |
|
| 817 | + * Deletes an url and session relationship |
|
| 818 | + * @author Julio Montoya |
|
| 819 | + * @param char course code |
|
| 820 | + * @param int url id |
|
| 821 | 821 | * |
| 822 | - * @return boolean true if success |
|
| 823 | - * */ |
|
| 822 | + * @return boolean true if success |
|
| 823 | + * */ |
|
| 824 | 824 | public static function delete_url_rel_session($session_id, $url_id) |
| 825 | 825 | { |
| 826 | 826 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
@@ -262,8 +262,9 @@ |
||
| 262 | 262 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
| 263 | 263 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
| 264 | 264 | |
| 265 | - if (!empty($access_url_id)) |
|
| 266 | - $where ="WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
| 265 | + if (!empty($access_url_id)) { |
|
| 266 | + $where ="WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
| 267 | + } |
|
| 267 | 268 | |
| 268 | 269 | $sql = "SELECT id, name, access_url_id |
| 269 | 270 | FROM $tbl_session u |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public static function add($url, $description, $active) |
| 24 | 24 | { |
| 25 | 25 | $tms = time(); |
| 26 | - $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 26 | + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 27 | 27 | $sql = "INSERT INTO $table |
| 28 | 28 | SET url = '".Database::escape_string($url)."', |
| 29 | 29 | description = '".Database::escape_string($description)."', |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $id = intval($id); |
| 75 | 75 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
| 76 | - $sql= "DELETE FROM $table WHERE id = ".$id; |
|
| 76 | + $sql = "DELETE FROM $table WHERE id = ".$id; |
|
| 77 | 77 | $result = Database::query($sql); |
| 78 | 78 | |
| 79 | 79 | return $result; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public static function url_exist($url) |
| 88 | 88 | { |
| 89 | - $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 89 | + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 90 | 90 | $sql = "SELECT id FROM $table |
| 91 | 91 | WHERE url = '".Database::escape_string($url)."' "; |
| 92 | 92 | $res = Database::query($sql); |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | * */ |
| 121 | 121 | public static function url_count() |
| 122 | 122 | { |
| 123 | - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 123 | + $table_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 124 | 124 | $sql = "SELECT count(id) as count_result FROM $table_access_url"; |
| 125 | 125 | $res = Database::query($sql); |
| 126 | - $url = Database::fetch_array($res,'ASSOC'); |
|
| 126 | + $url = Database::fetch_array($res, 'ASSOC'); |
|
| 127 | 127 | $result = $url['count_result']; |
| 128 | 128 | |
| 129 | 129 | return $result; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | FROM $table |
| 142 | 142 | ORDER BY id"; |
| 143 | 143 | $res = Database::query($sql); |
| 144 | - $urls = array (); |
|
| 144 | + $urls = array(); |
|
| 145 | 145 | while ($url = Database::fetch_array($res)) { |
| 146 | 146 | $urls[] = $url; |
| 147 | 147 | } |
@@ -258,12 +258,12 @@ discard block |
||
| 258 | 258 | **/ |
| 259 | 259 | public static function get_url_rel_session_data($access_url_id = null) |
| 260 | 260 | { |
| 261 | - $where =''; |
|
| 261 | + $where = ''; |
|
| 262 | 262 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
| 263 | 263 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
| 264 | 264 | |
| 265 | 265 | if (!empty($access_url_id)) |
| 266 | - $where ="WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
| 266 | + $where = "WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
| 267 | 267 | |
| 268 | 268 | $sql = "SELECT id, name, access_url_id |
| 269 | 269 | FROM $tbl_session u |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $table_user_group = Database::get_main_table(TABLE_USERGROUP); |
| 294 | 294 | |
| 295 | 295 | if (!empty($access_url_id)) { |
| 296 | - $where ="WHERE $table_url_rel_usergroup.access_url_id = ".intval($access_url_id); |
|
| 296 | + $where = "WHERE $table_url_rel_usergroup.access_url_id = ".intval($access_url_id); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | $sql = "SELECT id, name, access_url_id |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | public static function relation_url_user_exist($user_id, $url_id) |
| 372 | 372 | { |
| 373 | 373 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
| 374 | - $sql= "SELECT user_id FROM $table |
|
| 374 | + $sql = "SELECT user_id FROM $table |
|
| 375 | 375 | WHERE access_url_id = ".intval($url_id)." AND user_id = ".intval($user_id)." "; |
| 376 | 376 | $result = Database::query($sql); |
| 377 | 377 | $num = Database::num_rows($result); |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | public static function relation_url_course_exist($courseId, $urlId) |
| 390 | 390 | { |
| 391 | 391 | $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
| 392 | - $sql= "SELECT c_id FROM $table_url_rel_course |
|
| 392 | + $sql = "SELECT c_id FROM $table_url_rel_course |
|
| 393 | 393 | WHERE |
| 394 | 394 | access_url_id = ".intval($urlId)." AND |
| 395 | 395 | c_id = '".intval($courseId)."'"; |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | public static function relationUrlUsergroupExist($userGroupId, $urlId) |
| 411 | 411 | { |
| 412 | 412 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP); |
| 413 | - $sql= "SELECT usergroup_id FROM $table |
|
| 413 | + $sql = "SELECT usergroup_id FROM $table |
|
| 414 | 414 | WHERE access_url_id = ".intval($urlId)." AND |
| 415 | 415 | usergroup_id = ".intval($userGroupId); |
| 416 | 416 | $result = Database::query($sql); |
@@ -428,9 +428,9 @@ discard block |
||
| 428 | 428 | * */ |
| 429 | 429 | public static function relation_url_session_exist($session_id, $url_id) |
| 430 | 430 | { |
| 431 | - $table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
| 431 | + $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
| 432 | 432 | $session_id = intval($session_id); |
| 433 | - $url_id = intval($url_id); |
|
| 433 | + $url_id = intval($url_id); |
|
| 434 | 434 | $sql = "SELECT session_id FROM $table_url_rel_session |
| 435 | 435 | WHERE |
| 436 | 436 | access_url_id = ".intval($url_id)." AND |
@@ -453,11 +453,11 @@ discard block |
||
| 453 | 453 | $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
| 454 | 454 | $result_array = array(); |
| 455 | 455 | |
| 456 | - if (is_array($user_list) && is_array($url_list)){ |
|
| 456 | + if (is_array($user_list) && is_array($url_list)) { |
|
| 457 | 457 | foreach ($url_list as $url_id) { |
| 458 | 458 | foreach ($user_list as $user_id) { |
| 459 | - $count = UrlManager::relation_url_user_exist($user_id,$url_id); |
|
| 460 | - if ($count==0) { |
|
| 459 | + $count = UrlManager::relation_url_user_exist($user_id, $url_id); |
|
| 460 | + if ($count == 0) { |
|
| 461 | 461 | $sql = "INSERT INTO $table_url_rel_user |
| 462 | 462 | SET user_id = ".intval($user_id).", access_url_id = ".intval($url_id); |
| 463 | 463 | $result = Database::query($sql); |
@@ -482,19 +482,19 @@ discard block |
||
| 482 | 482 | * @param array of url_ids |
| 483 | 483 | * @return array |
| 484 | 484 | **/ |
| 485 | - public static function add_courses_to_urls($course_list,$url_list) |
|
| 485 | + public static function add_courses_to_urls($course_list, $url_list) |
|
| 486 | 486 | { |
| 487 | 487 | $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
| 488 | 488 | $result_array = array(); |
| 489 | 489 | |
| 490 | - if (is_array($course_list) && is_array($url_list)){ |
|
| 490 | + if (is_array($course_list) && is_array($url_list)) { |
|
| 491 | 491 | foreach ($url_list as $url_id) { |
| 492 | 492 | foreach ($course_list as $course_code) { |
| 493 | 493 | $courseInfo = api_get_course_info($course_code); |
| 494 | 494 | $courseId = $courseInfo['real_id']; |
| 495 | 495 | |
| 496 | 496 | $count = self::relation_url_course_exist($courseId, $url_id); |
| 497 | - if ($count==0) { |
|
| 497 | + if ($count == 0) { |
|
| 498 | 498 | $sql = "INSERT INTO $table_url_rel_course |
| 499 | 499 | SET c_id = '".$courseId."', access_url_id = ".intval($url_id); |
| 500 | 500 | $result = Database::query($sql); |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId) |
| 581 | 581 | { |
| 582 | 582 | $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY); |
| 583 | - $sql= "SELECT course_category_id FROM $table |
|
| 583 | + $sql = "SELECT course_category_id FROM $table |
|
| 584 | 584 | WHERE access_url_id = ".intval($urlId)." AND |
| 585 | 585 | course_category_id = ".intval($categoryCourseId); |
| 586 | 586 | $result = Database::query($sql); |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
| 750 | 750 | $result = true; |
| 751 | 751 | if (!empty($user_id) && !empty($url_id)) { |
| 752 | - $sql= "DELETE FROM $table_url_rel_user |
|
| 752 | + $sql = "DELETE FROM $table_url_rel_user |
|
| 753 | 753 | WHERE user_id = ".intval($user_id)." AND access_url_id = ".intval($url_id); |
| 754 | 754 | $result = Database::query($sql); |
| 755 | 755 | } |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
| 770 | 770 | $result = true; |
| 771 | 771 | if (!empty($userId)) { |
| 772 | - $sql= "DELETE FROM $table_url_rel_user |
|
| 772 | + $sql = "DELETE FROM $table_url_rel_user |
|
| 773 | 773 | WHERE user_id = ".intval($userId); |
| 774 | 774 | Database::query($sql); |
| 775 | 775 | } |
@@ -787,8 +787,8 @@ discard block |
||
| 787 | 787 | * */ |
| 788 | 788 | public static function delete_url_rel_course($courseId, $urlId) |
| 789 | 789 | { |
| 790 | - $table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
| 791 | - $sql= "DELETE FROM $table_url_rel_course |
|
| 790 | + $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
| 791 | + $sql = "DELETE FROM $table_url_rel_course |
|
| 792 | 792 | WHERE c_id = '".intval($courseId)."' AND access_url_id=".intval($urlId)." "; |
| 793 | 793 | $result = Database::query($sql); |
| 794 | 794 | |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | public static function delete_url_rel_usergroup($userGroupId, $urlId) |
| 807 | 807 | { |
| 808 | 808 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP); |
| 809 | - $sql= "DELETE FROM $table |
|
| 809 | + $sql = "DELETE FROM $table |
|
| 810 | 810 | WHERE usergroup_id = '".intval($userGroupId)."' AND |
| 811 | 811 | access_url_id=".intval($urlId)." "; |
| 812 | 812 | $result = Database::query($sql); |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | public static function deleteUrlRelCourseCategory($userGroupId, $urlId) |
| 826 | 826 | { |
| 827 | 827 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY); |
| 828 | - $sql= "DELETE FROM $table |
|
| 828 | + $sql = "DELETE FROM $table |
|
| 829 | 829 | WHERE course_category_id = '".intval($userGroupId)."' AND |
| 830 | 830 | access_url_id=".intval($urlId)." "; |
| 831 | 831 | $result = Database::query($sql); |
@@ -844,9 +844,9 @@ discard block |
||
| 844 | 844 | public static function delete_url_rel_session($session_id, $url_id) |
| 845 | 845 | { |
| 846 | 846 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
| 847 | - $sql= "DELETE FROM $table_url_rel_session |
|
| 847 | + $sql = "DELETE FROM $table_url_rel_session |
|
| 848 | 848 | WHERE session_id = ".intval($session_id)." AND access_url_id=".intval($url_id)." "; |
| 849 | - $result = Database::query($sql,'ASSOC'); |
|
| 849 | + $result = Database::query($sql, 'ASSOC'); |
|
| 850 | 850 | |
| 851 | 851 | return $result; |
| 852 | 852 | } |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | * */ |
| 860 | 860 | public static function update_urls_rel_user($user_list, $access_url_id) |
| 861 | 861 | { |
| 862 | - $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
| 862 | + $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
| 863 | 863 | $sql = "SELECT user_id FROM $table_url_rel_user WHERE access_url_id = ".intval($access_url_id); |
| 864 | 864 | $result = Database::query($sql); |
| 865 | 865 | $existing_users = array(); |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | $result = Database::query($sql); |
| 914 | 914 | |
| 915 | 915 | $existing_courses = array(); |
| 916 | - while ($row = Database::fetch_array($result)){ |
|
| 916 | + while ($row = Database::fetch_array($result)) { |
|
| 917 | 917 | $existing_courses[] = $row['c_id']; |
| 918 | 918 | } |
| 919 | 919 | |
@@ -946,7 +946,7 @@ discard block |
||
| 946 | 946 | $result = Database::query($sql); |
| 947 | 947 | $existingItems = array(); |
| 948 | 948 | |
| 949 | - while ($row = Database::fetch_array($result)){ |
|
| 949 | + while ($row = Database::fetch_array($result)) { |
|
| 950 | 950 | $existingItems[] = $row['usergroup_id']; |
| 951 | 951 | } |
| 952 | 952 | |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | $result = Database::query($sql); |
| 980 | 980 | $existingItems = array(); |
| 981 | 981 | |
| 982 | - while ($row = Database::fetch_array($result)){ |
|
| 982 | + while ($row = Database::fetch_array($result)) { |
|
| 983 | 983 | $existingItems[] = $row['course_category_id']; |
| 984 | 984 | } |
| 985 | 985 | |
@@ -1020,15 +1020,15 @@ discard block |
||
| 1020 | 1020 | * @param array user list |
| 1021 | 1021 | * @param int access_url_id |
| 1022 | 1022 | * */ |
| 1023 | - public static function update_urls_rel_session($session_list,$access_url_id) |
|
| 1023 | + public static function update_urls_rel_session($session_list, $access_url_id) |
|
| 1024 | 1024 | { |
| 1025 | - $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
| 1025 | + $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
| 1026 | 1026 | |
| 1027 | 1027 | $sql = "SELECT session_id FROM $table_url_rel_session WHERE access_url_id=".intval($access_url_id); |
| 1028 | 1028 | $result = Database::query($sql); |
| 1029 | 1029 | $existing_sessions = array(); |
| 1030 | 1030 | |
| 1031 | - while ($row = Database::fetch_array($result)){ |
|
| 1031 | + while ($row = Database::fetch_array($result)) { |
|
| 1032 | 1032 | $existing_sessions[] = $row['session_id']; |
| 1033 | 1033 | } |
| 1034 | 1034 | |
@@ -1057,13 +1057,13 @@ discard block |
||
| 1057 | 1057 | */ |
| 1058 | 1058 | public static function get_access_url_from_user($user_id) |
| 1059 | 1059 | { |
| 1060 | - $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
| 1061 | - $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 1060 | + $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
| 1061 | + $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 1062 | 1062 | $sql = "SELECT url, access_url_id FROM $table_url_rel_user url_rel_user INNER JOIN $table_url u |
| 1063 | 1063 | ON (url_rel_user.access_url_id = u.id) |
| 1064 | 1064 | WHERE user_id = ".intval($user_id); |
| 1065 | 1065 | $result = Database::query($sql); |
| 1066 | - $url_list = Database::store_result($result,'ASSOC'); |
|
| 1066 | + $url_list = Database::store_result($result, 'ASSOC'); |
|
| 1067 | 1067 | return $url_list; |
| 1068 | 1068 | } |
| 1069 | 1069 | |
@@ -1073,14 +1073,14 @@ discard block |
||
| 1073 | 1073 | */ |
| 1074 | 1074 | public static function get_access_url_from_course($courseId) |
| 1075 | 1075 | { |
| 1076 | - $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
| 1077 | - $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 1076 | + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
| 1077 | + $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 1078 | 1078 | $sql = "SELECT url, access_url_id FROM $table c INNER JOIN $table_url u |
| 1079 | 1079 | ON (c.access_url_id = u.id) |
| 1080 | 1080 | WHERE c_id = ".intval($courseId); |
| 1081 | 1081 | |
| 1082 | 1082 | $result = Database::query($sql); |
| 1083 | - $url_list = Database::store_result($result,'ASSOC'); |
|
| 1083 | + $url_list = Database::store_result($result, 'ASSOC'); |
|
| 1084 | 1084 | return $url_list; |
| 1085 | 1085 | } |
| 1086 | 1086 | |
@@ -1091,7 +1091,7 @@ discard block |
||
| 1091 | 1091 | public static function get_access_url_from_session($session_id) |
| 1092 | 1092 | { |
| 1093 | 1093 | $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
| 1094 | - $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 1094 | + $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 1095 | 1095 | $sql = "SELECT url, access_url_id FROM $table_url_rel_session url_rel_session INNER JOIN $table_url u |
| 1096 | 1096 | ON (url_rel_session.access_url_id = u.id) |
| 1097 | 1097 | WHERE session_id = ".intval($session_id); |
@@ -1107,7 +1107,7 @@ discard block |
||
| 1107 | 1107 | */ |
| 1108 | 1108 | public static function get_url_id($url) |
| 1109 | 1109 | { |
| 1110 | - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 1110 | + $table_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 1111 | 1111 | $sql = "SELECT id FROM $table_access_url WHERE url = '".Database::escape_string($url)."'"; |
| 1112 | 1112 | $result = Database::query($sql); |
| 1113 | 1113 | $access_url_id = Database::result($result, 0, 0); |