@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * Checks whether a given course code has been already occupied. |
| 20 | 20 | * @param string $wanted_course_code The code to be checked. |
| 21 | - * @return string |
|
| 21 | + * @return boolean |
|
| 22 | 22 | * Returns TRUE if there is created: |
| 23 | 23 | * - a course with the same code OR visual_code (visualcode). |
| 24 | 24 | * - a course request with the same code as the given one, or |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | /** |
| 371 | - * @param null $status |
|
| 371 | + * @param integer $status |
|
| 372 | 372 | * @return bool |
| 373 | 373 | */ |
| 374 | 374 | public static function count_course_requests($status = null) |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | /** |
| 392 | 392 | * Gets all the information about a course request using its database id as an access key. |
| 393 | - * @param int/string $id The id (an integer number) of the corresponding database record. |
|
| 393 | + * @param integer $id The id (an integer number) of the corresponding database record. |
|
| 394 | 394 | * @return array/bool Returns the requested data as an array or FALSE on failure. |
| 395 | 395 | */ |
| 396 | 396 | public static function get_course_request_info($id) |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | $exemplary_content |
| 66 | 66 | ) { |
| 67 | 67 | $wanted_code = trim($wanted_code); |
| 68 | - $user_id = (int)$user_id; |
|
| 69 | - $exemplary_content = (bool)$exemplary_content ? 1 : 0; |
|
| 68 | + $user_id = (int) $user_id; |
|
| 69 | + $exemplary_content = (bool) $exemplary_content ? 1 : 0; |
|
| 70 | 70 | |
| 71 | 71 | if ($wanted_code == '') { |
| 72 | 72 | return false; |
@@ -254,10 +254,10 @@ discard block |
||
| 254 | 254 | $user_id, |
| 255 | 255 | $exemplary_content |
| 256 | 256 | ) { |
| 257 | - $id = (int)$id; |
|
| 257 | + $id = (int) $id; |
|
| 258 | 258 | $wanted_code = trim($wanted_code); |
| 259 | - $user_id = (int)$user_id; |
|
| 260 | - $exemplary_content = (bool)$exemplary_content ? 1 : 0; |
|
| 259 | + $user_id = (int) $user_id; |
|
| 260 | + $exemplary_content = (bool) $exemplary_content ? 1 : 0; |
|
| 261 | 261 | |
| 262 | 262 | if ($wanted_code == '') { |
| 263 | 263 | return false; |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public static function delete_course_request($id) |
| 362 | 362 | { |
| 363 | - $id = (int)$id; |
|
| 363 | + $id = (int) $id; |
|
| 364 | 364 | $sql = "DELETE FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
| 365 | 365 | WHERE id = ".$id; |
| 366 | 366 | $result = Database::query($sql); |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | if (is_null($status)) { |
| 378 | 378 | $sql = "SELECT COUNT(id) AS number FROM ".$course_table; |
| 379 | 379 | } else { |
| 380 | - $status = (int)$status; |
|
| 380 | + $status = (int) $status; |
|
| 381 | 381 | $sql = "SELECT COUNT(id) AS number FROM ".$course_table." |
| 382 | 382 | WHERE status = ".$status; |
| 383 | 383 | } |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | public static function get_course_request_info($id) |
| 397 | 397 | { |
| 398 | - $id = (int)$id; |
|
| 398 | + $id = (int) $id; |
|
| 399 | 399 | $sql = "SELECT * |
| 400 | 400 | FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
| 401 | 401 | WHERE id = ".$id; |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | */ |
| 414 | 414 | public static function get_course_request_code($id) |
| 415 | 415 | { |
| 416 | - $id = (int)$id; |
|
| 416 | + $id = (int) $id; |
|
| 417 | 417 | $sql = "SELECT code |
| 418 | 418 | FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
| 419 | 419 | WHERE id = ".$id; |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | */ |
| 435 | 435 | public static function accept_course_request($id) |
| 436 | 436 | { |
| 437 | - $id = (int)$id; |
|
| 437 | + $id = (int) $id; |
|
| 438 | 438 | |
| 439 | 439 | // Retrieve request's data |
| 440 | 440 | $course_request_info = self::get_course_request_info($id); |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | return false; |
| 448 | 448 | }*/ |
| 449 | 449 | |
| 450 | - $user_id = (int)$course_request_info['user_id']; |
|
| 450 | + $user_id = (int) $course_request_info['user_id']; |
|
| 451 | 451 | if ($user_id <= 0) { |
| 452 | 452 | return false; |
| 453 | 453 | } |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | */ |
| 532 | 532 | public static function reject_course_request($id) |
| 533 | 533 | { |
| 534 | - $id = (int)$id; |
|
| 534 | + $id = (int) $id; |
|
| 535 | 535 | // Retrieve request's data |
| 536 | 536 | $course_request_info = self::get_course_request_info($id); |
| 537 | 537 | if (!is_array($course_request_info)) { |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | */ |
| 610 | 610 | public static function ask_for_additional_info($id) |
| 611 | 611 | { |
| 612 | - $id = (int)$id; |
|
| 612 | + $id = (int) $id; |
|
| 613 | 613 | |
| 614 | 614 | // Retrieve request's data |
| 615 | 615 | $course_request_info = self::get_course_request_info($id); |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | */ |
| 701 | 701 | public static function additional_info_asked($id) |
| 702 | 702 | { |
| 703 | - $id = (int)$id; |
|
| 703 | + $id = (int) $id; |
|
| 704 | 704 | $sql = "SELECT id FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
| 705 | 705 | WHERE (id = ".$id." AND info > 0)"; |
| 706 | 706 | $result = Database::num_rows(Database::query($sql)); |
@@ -493,6 +493,7 @@ |
||
| 493 | 493 | * This function update extra user blocks data after closing a dashboard block |
| 494 | 494 | * @param int User id |
| 495 | 495 | * @param string plugin path |
| 496 | + * @param integer $user_id |
|
| 496 | 497 | * @return bool |
| 497 | 498 | */ |
| 498 | 499 | public static function close_user_block($user_id, $path) |
@@ -249,282 +249,282 @@ |
||
| 249 | 249 | return $affected_rows; |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Get all plugins path inside dashboard directory |
|
| 254 | - * @return array name plugins directories |
|
| 255 | - */ |
|
| 256 | - public static function getPossibleDashboardPluginsPath() |
|
| 252 | + /** |
|
| 253 | + * Get all plugins path inside dashboard directory |
|
| 254 | + * @return array name plugins directories |
|
| 255 | + */ |
|
| 256 | + public static function getPossibleDashboardPluginsPath() |
|
| 257 | 257 | { |
| 258 | - // get all plugins path inside plugin directory |
|
| 259 | - /* We scan the plugin directory. Each folder is a potential plugin. */ |
|
| 260 | - $possiblePlugins = array(); |
|
| 261 | - $dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/'; |
|
| 262 | - $handle = @opendir($dashboard_pluginpath); |
|
| 263 | - while (false !== ($file = readdir($handle))) { |
|
| 264 | - if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) { |
|
| 265 | - $possiblePlugins[] = $file; |
|
| 266 | - } |
|
| 267 | - } |
|
| 268 | - @closedir($handle); |
|
| 269 | - |
|
| 270 | - return $possiblePlugins; |
|
| 271 | - } |
|
| 272 | - |
|
| 273 | - /** |
|
| 274 | - * Get all blocks data without plugin directory |
|
| 275 | - * @return array Block data |
|
| 276 | - */ |
|
| 277 | - public static function get_block_data_without_plugin() |
|
| 258 | + // get all plugins path inside plugin directory |
|
| 259 | + /* We scan the plugin directory. Each folder is a potential plugin. */ |
|
| 260 | + $possiblePlugins = array(); |
|
| 261 | + $dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/'; |
|
| 262 | + $handle = @opendir($dashboard_pluginpath); |
|
| 263 | + while (false !== ($file = readdir($handle))) { |
|
| 264 | + if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) { |
|
| 265 | + $possiblePlugins[] = $file; |
|
| 266 | + } |
|
| 267 | + } |
|
| 268 | + @closedir($handle); |
|
| 269 | + |
|
| 270 | + return $possiblePlugins; |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + /** |
|
| 274 | + * Get all blocks data without plugin directory |
|
| 275 | + * @return array Block data |
|
| 276 | + */ |
|
| 277 | + public static function get_block_data_without_plugin() |
|
| 278 | 278 | { |
| 279 | - $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK); |
|
| 280 | - $possibleplugins = self::getPossibleDashboardPluginsPath(); |
|
| 281 | - |
|
| 282 | - // We check if plugin exists inside directory for updating active field |
|
| 283 | - $sql = "SELECT * FROM $tbl_block"; |
|
| 284 | - $rs = Database::query($sql); |
|
| 285 | - if (Database::num_rows($rs) > 0){ |
|
| 286 | - while ($row = Database::fetch_array($rs)) { |
|
| 287 | - $path = $row['path']; |
|
| 288 | - if (!in_array($row['path'],$possibleplugins)) { |
|
| 289 | - $active = 0; |
|
| 290 | - } else { |
|
| 291 | - $active = 1; |
|
| 292 | - } |
|
| 293 | - // update active |
|
| 294 | - $upd = "UPDATE $tbl_block SET active = '$active' |
|
| 279 | + $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK); |
|
| 280 | + $possibleplugins = self::getPossibleDashboardPluginsPath(); |
|
| 281 | + |
|
| 282 | + // We check if plugin exists inside directory for updating active field |
|
| 283 | + $sql = "SELECT * FROM $tbl_block"; |
|
| 284 | + $rs = Database::query($sql); |
|
| 285 | + if (Database::num_rows($rs) > 0){ |
|
| 286 | + while ($row = Database::fetch_array($rs)) { |
|
| 287 | + $path = $row['path']; |
|
| 288 | + if (!in_array($row['path'],$possibleplugins)) { |
|
| 289 | + $active = 0; |
|
| 290 | + } else { |
|
| 291 | + $active = 1; |
|
| 292 | + } |
|
| 293 | + // update active |
|
| 294 | + $upd = "UPDATE $tbl_block SET active = '$active' |
|
| 295 | 295 | WHERE path = '".$row['path']."'"; |
| 296 | - Database::query($upd); |
|
| 297 | - } |
|
| 298 | - } |
|
| 299 | - |
|
| 300 | - // get disabled block data |
|
| 301 | - $block_data = array(); |
|
| 302 | - $sql = "SELECT * FROM $tbl_block WHERE active = 0"; |
|
| 303 | - $rs_block = Database::query($sql); |
|
| 304 | - if (Database::num_rows($rs_block) > 0) { |
|
| 305 | - while ($row_block = Database::fetch_array($rs_block)) { |
|
| 306 | - $block_data[] = $row_block; |
|
| 307 | - } |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - return $block_data; |
|
| 311 | - |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - /** |
|
| 315 | - * get data about enabled dashboard block (stored insise block table) |
|
| 316 | - * @param string plugin path |
|
| 317 | - * @return array data |
|
| 318 | - */ |
|
| 319 | - public static function get_enabled_dashboard_blocks($path = '') |
|
| 296 | + Database::query($upd); |
|
| 297 | + } |
|
| 298 | + } |
|
| 299 | + |
|
| 300 | + // get disabled block data |
|
| 301 | + $block_data = array(); |
|
| 302 | + $sql = "SELECT * FROM $tbl_block WHERE active = 0"; |
|
| 303 | + $rs_block = Database::query($sql); |
|
| 304 | + if (Database::num_rows($rs_block) > 0) { |
|
| 305 | + while ($row_block = Database::fetch_array($rs_block)) { |
|
| 306 | + $block_data[] = $row_block; |
|
| 307 | + } |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + return $block_data; |
|
| 311 | + |
|
| 312 | + } |
|
| 313 | + |
|
| 314 | + /** |
|
| 315 | + * get data about enabled dashboard block (stored insise block table) |
|
| 316 | + * @param string plugin path |
|
| 317 | + * @return array data |
|
| 318 | + */ |
|
| 319 | + public static function get_enabled_dashboard_blocks($path = '') |
|
| 320 | 320 | { |
| 321 | - $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK); |
|
| 322 | - $condition_path = ''; |
|
| 323 | - if (!empty($path)) { |
|
| 324 | - $path = Database::escape_string($path); |
|
| 325 | - $condition_path = ' AND path = "'.$path.'" '; |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - $sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path "; |
|
| 329 | - $rs = Database::query($sql); |
|
| 330 | - $block_data = array(); |
|
| 331 | - if (Database::num_rows($rs) > 0) { |
|
| 332 | - while ($row = Database::fetch_array($rs)) { |
|
| 333 | - $block_data[$row['path']] = $row; |
|
| 334 | - } |
|
| 335 | - } |
|
| 336 | - return $block_data; |
|
| 337 | - } |
|
| 338 | - |
|
| 339 | - /** |
|
| 340 | - * display user dashboard list |
|
| 341 | - * @param int User id |
|
| 342 | - * @return void |
|
| 343 | - */ |
|
| 344 | - public static function display_user_dashboard_list($user_id) |
|
| 321 | + $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK); |
|
| 322 | + $condition_path = ''; |
|
| 323 | + if (!empty($path)) { |
|
| 324 | + $path = Database::escape_string($path); |
|
| 325 | + $condition_path = ' AND path = "'.$path.'" '; |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + $sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path "; |
|
| 329 | + $rs = Database::query($sql); |
|
| 330 | + $block_data = array(); |
|
| 331 | + if (Database::num_rows($rs) > 0) { |
|
| 332 | + while ($row = Database::fetch_array($rs)) { |
|
| 333 | + $block_data[$row['path']] = $row; |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + return $block_data; |
|
| 337 | + } |
|
| 338 | + |
|
| 339 | + /** |
|
| 340 | + * display user dashboard list |
|
| 341 | + * @param int User id |
|
| 342 | + * @return void |
|
| 343 | + */ |
|
| 344 | + public static function display_user_dashboard_list($user_id) |
|
| 345 | 345 | { |
| 346 | - $enabled_dashboard_plugins = self::get_enabled_dashboard_blocks(); |
|
| 347 | - $user_block_data = self::get_user_block_data($user_id); |
|
| 348 | - |
|
| 349 | - if (count($enabled_dashboard_plugins) > 0) { |
|
| 350 | - echo '<div style="margin-top:20px">'; |
|
| 351 | - echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />'; |
|
| 352 | - echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">'; |
|
| 353 | - echo '<table class="data_table">'; |
|
| 354 | - echo '<tr>'; |
|
| 355 | - echo '<th width="5%">'; |
|
| 356 | - echo get_lang('Enabled'); |
|
| 357 | - echo '</th>'; |
|
| 358 | - echo '<th width="30%">'; |
|
| 359 | - echo get_lang('Name'); |
|
| 360 | - echo '</th>'; |
|
| 361 | - echo '<th width="40%">'; |
|
| 362 | - echo get_lang('Description'); |
|
| 363 | - echo '</th>'; |
|
| 364 | - echo '<th>'; |
|
| 365 | - echo get_lang('ColumnPosition'); |
|
| 366 | - echo '</th>'; |
|
| 367 | - echo '</tr>'; |
|
| 368 | - |
|
| 369 | - // We display all enabled plugins and the checkboxes |
|
| 370 | - foreach ($enabled_dashboard_plugins as $block) { |
|
| 371 | - |
|
| 372 | - $path = $block['path']; |
|
| 373 | - $controller_class = $block['controller']; |
|
| 374 | - $filename_controller = $path.'.class.php'; |
|
| 375 | - $dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/'; |
|
| 376 | - require_once $dashboard_plugin_path.$filename_controller; |
|
| 377 | - if (class_exists($controller_class)) { |
|
| 378 | - $obj_block = new $controller_class($user_id); |
|
| 379 | - |
|
| 380 | - // check if user is allowed to see the block |
|
| 381 | - if (method_exists($obj_block, 'is_block_visible_for_user')) { |
|
| 382 | - $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id); |
|
| 383 | - if (!$is_block_visible_for_user) continue; |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - echo '<tr>'; |
|
| 387 | - // checkboxes |
|
| 388 | - self::display_user_dashboard_list_checkboxes($user_id, $block['id']); |
|
| 389 | - echo '<td>'.$block['name'].'</td>'; |
|
| 390 | - echo '<td>'.$block['description'].'</td>'; |
|
| 391 | - echo '<td> |
|
| 346 | + $enabled_dashboard_plugins = self::get_enabled_dashboard_blocks(); |
|
| 347 | + $user_block_data = self::get_user_block_data($user_id); |
|
| 348 | + |
|
| 349 | + if (count($enabled_dashboard_plugins) > 0) { |
|
| 350 | + echo '<div style="margin-top:20px">'; |
|
| 351 | + echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />'; |
|
| 352 | + echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">'; |
|
| 353 | + echo '<table class="data_table">'; |
|
| 354 | + echo '<tr>'; |
|
| 355 | + echo '<th width="5%">'; |
|
| 356 | + echo get_lang('Enabled'); |
|
| 357 | + echo '</th>'; |
|
| 358 | + echo '<th width="30%">'; |
|
| 359 | + echo get_lang('Name'); |
|
| 360 | + echo '</th>'; |
|
| 361 | + echo '<th width="40%">'; |
|
| 362 | + echo get_lang('Description'); |
|
| 363 | + echo '</th>'; |
|
| 364 | + echo '<th>'; |
|
| 365 | + echo get_lang('ColumnPosition'); |
|
| 366 | + echo '</th>'; |
|
| 367 | + echo '</tr>'; |
|
| 368 | + |
|
| 369 | + // We display all enabled plugins and the checkboxes |
|
| 370 | + foreach ($enabled_dashboard_plugins as $block) { |
|
| 371 | + |
|
| 372 | + $path = $block['path']; |
|
| 373 | + $controller_class = $block['controller']; |
|
| 374 | + $filename_controller = $path.'.class.php'; |
|
| 375 | + $dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/'; |
|
| 376 | + require_once $dashboard_plugin_path.$filename_controller; |
|
| 377 | + if (class_exists($controller_class)) { |
|
| 378 | + $obj_block = new $controller_class($user_id); |
|
| 379 | + |
|
| 380 | + // check if user is allowed to see the block |
|
| 381 | + if (method_exists($obj_block, 'is_block_visible_for_user')) { |
|
| 382 | + $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id); |
|
| 383 | + if (!$is_block_visible_for_user) continue; |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + echo '<tr>'; |
|
| 387 | + // checkboxes |
|
| 388 | + self::display_user_dashboard_list_checkboxes($user_id, $block['id']); |
|
| 389 | + echo '<td>'.$block['name'].'</td>'; |
|
| 390 | + echo '<td>'.$block['description'].'</td>'; |
|
| 391 | + echo '<td> |
|
| 392 | 392 | <select class="selectpicker show-tick form-control" name="columns['.$block['id'].']"> |
| 393 | 393 | <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==1?'selected':'').' >1</option> |
| 394 | 394 | <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==2?'selected':'').' >2</option> |
| 395 | 395 | </select> |
| 396 | 396 | </td>'; |
| 397 | - echo '</tr>'; |
|
| 398 | - } else { |
|
| 399 | - echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3'))); |
|
| 400 | - } |
|
| 401 | - } |
|
| 402 | - |
|
| 403 | - echo '</table>'; |
|
| 404 | - echo '<div class="row"><div class="col-md-12">'; |
|
| 405 | - echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '. |
|
| 397 | + echo '</tr>'; |
|
| 398 | + } else { |
|
| 399 | + echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3'))); |
|
| 400 | + } |
|
| 401 | + } |
|
| 402 | + |
|
| 403 | + echo '</table>'; |
|
| 404 | + echo '<div class="row"><div class="col-md-12">'; |
|
| 405 | + echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '. |
|
| 406 | 406 | get_lang('EnableDashboardBlock').'</button></form>'; |
| 407 | - echo '</div></div>'; |
|
| 408 | - } else { |
|
| 409 | - echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>'; |
|
| 410 | - if (api_is_platform_admin()) { |
|
| 411 | - echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'. |
|
| 407 | + echo '</div></div>'; |
|
| 408 | + } else { |
|
| 409 | + echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>'; |
|
| 410 | + if (api_is_platform_admin()) { |
|
| 411 | + echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'. |
|
| 412 | 412 | get_lang('ConfigureDashboardPlugin').'</a>'; |
| 413 | - } |
|
| 414 | - } |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - /** |
|
| 418 | - * display checkboxes for user dashboard list |
|
| 419 | - * @param int User id |
|
| 420 | - * @param int Block id |
|
| 421 | - * @return void |
|
| 422 | - */ |
|
| 423 | - public static function display_user_dashboard_list_checkboxes($user_id, $block_id) { |
|
| 424 | - |
|
| 425 | - $user_id = intval($user_id); |
|
| 426 | - $user_block_data = self::get_user_block_data($user_id); |
|
| 427 | - $enabled_blocks_id = array_keys($user_block_data); |
|
| 428 | - |
|
| 429 | - $checked = ''; |
|
| 430 | - if (in_array($block_id, $enabled_blocks_id)) { |
|
| 431 | - $checked = "checked"; |
|
| 432 | - } |
|
| 433 | - |
|
| 434 | - echo "<td align=\"center\">"; |
|
| 435 | - echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>'; |
|
| 436 | - echo "</td>"; |
|
| 437 | - } |
|
| 438 | - |
|
| 439 | - /** |
|
| 440 | - * This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields |
|
| 441 | - * @param int User id |
|
| 442 | - * @param array selected blocks |
|
| 443 | - * @param array columns position |
|
| 444 | - * @return bool |
|
| 445 | - */ |
|
| 446 | - public static function store_user_blocks($user_id, $enabled_blocks, $columns) { |
|
| 447 | - $selected_blocks_id = array(); |
|
| 448 | - if (is_array($enabled_blocks) && count($enabled_blocks) > 0) { |
|
| 449 | - $selected_blocks_id = array_keys($enabled_blocks); |
|
| 450 | - } |
|
| 451 | - |
|
| 452 | - // build data for storing inside extra user field |
|
| 453 | - $fname = 'dashboard'; |
|
| 454 | - $fvalue = array(); |
|
| 455 | - foreach ($selected_blocks_id as $block_id) { |
|
| 456 | - $fvalue[] = $block_id.':'.$columns[$block_id]; |
|
| 457 | - } |
|
| 413 | + } |
|
| 414 | + } |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + /** |
|
| 418 | + * display checkboxes for user dashboard list |
|
| 419 | + * @param int User id |
|
| 420 | + * @param int Block id |
|
| 421 | + * @return void |
|
| 422 | + */ |
|
| 423 | + public static function display_user_dashboard_list_checkboxes($user_id, $block_id) { |
|
| 424 | + |
|
| 425 | + $user_id = intval($user_id); |
|
| 426 | + $user_block_data = self::get_user_block_data($user_id); |
|
| 427 | + $enabled_blocks_id = array_keys($user_block_data); |
|
| 428 | + |
|
| 429 | + $checked = ''; |
|
| 430 | + if (in_array($block_id, $enabled_blocks_id)) { |
|
| 431 | + $checked = "checked"; |
|
| 432 | + } |
|
| 433 | + |
|
| 434 | + echo "<td align=\"center\">"; |
|
| 435 | + echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>'; |
|
| 436 | + echo "</td>"; |
|
| 437 | + } |
|
| 438 | + |
|
| 439 | + /** |
|
| 440 | + * This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields |
|
| 441 | + * @param int User id |
|
| 442 | + * @param array selected blocks |
|
| 443 | + * @param array columns position |
|
| 444 | + * @return bool |
|
| 445 | + */ |
|
| 446 | + public static function store_user_blocks($user_id, $enabled_blocks, $columns) { |
|
| 447 | + $selected_blocks_id = array(); |
|
| 448 | + if (is_array($enabled_blocks) && count($enabled_blocks) > 0) { |
|
| 449 | + $selected_blocks_id = array_keys($enabled_blocks); |
|
| 450 | + } |
|
| 451 | + |
|
| 452 | + // build data for storing inside extra user field |
|
| 453 | + $fname = 'dashboard'; |
|
| 454 | + $fvalue = array(); |
|
| 455 | + foreach ($selected_blocks_id as $block_id) { |
|
| 456 | + $fvalue[] = $block_id.':'.$columns[$block_id]; |
|
| 457 | + } |
|
| 458 | 458 | $upd_extra_field = UserManager::update_extra_field_value( |
| 459 | 459 | $user_id, |
| 460 | 460 | $fname, |
| 461 | 461 | $fvalue |
| 462 | 462 | ); |
| 463 | 463 | |
| 464 | - return $upd_extra_field; |
|
| 464 | + return $upd_extra_field; |
|
| 465 | 465 | |
| 466 | - } |
|
| 466 | + } |
|
| 467 | 467 | |
| 468 | - /** |
|
| 469 | - * This function get user block data (block id with its number of column) from extra user data |
|
| 470 | - * @param int User id |
|
| 471 | - * @return array data (block_id,column) |
|
| 472 | - */ |
|
| 473 | - public static function get_user_block_data($user_id) |
|
| 468 | + /** |
|
| 469 | + * This function get user block data (block id with its number of column) from extra user data |
|
| 470 | + * @param int User id |
|
| 471 | + * @return array data (block_id,column) |
|
| 472 | + */ |
|
| 473 | + public static function get_user_block_data($user_id) |
|
| 474 | 474 | { |
| 475 | - $user_id = intval($user_id); |
|
| 476 | - $field_variable = 'dashboard'; |
|
| 477 | - $extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable); |
|
| 478 | - $extra_user_data = explode(';',$extra_user_data[$field_variable]); |
|
| 479 | - $data = array(); |
|
| 480 | - foreach ($extra_user_data as $extra) { |
|
| 481 | - $split_extra = explode(':',$extra); |
|
| 482 | - if (!empty($split_extra)) { |
|
| 483 | - $block_id = $split_extra[0]; |
|
| 484 | - $column = isset($split_extra[1]) ? $split_extra[1] : null; |
|
| 485 | - $data[$block_id] = array('block_id' => $block_id, 'column' => $column); |
|
| 486 | - } |
|
| 487 | - } |
|
| 488 | - |
|
| 489 | - return $data; |
|
| 490 | - } |
|
| 491 | - |
|
| 492 | - /** |
|
| 493 | - * This function update extra user blocks data after closing a dashboard block |
|
| 494 | - * @param int User id |
|
| 495 | - * @param string plugin path |
|
| 496 | - * @return bool |
|
| 497 | - */ |
|
| 498 | - public static function close_user_block($user_id, $path) |
|
| 475 | + $user_id = intval($user_id); |
|
| 476 | + $field_variable = 'dashboard'; |
|
| 477 | + $extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable); |
|
| 478 | + $extra_user_data = explode(';',$extra_user_data[$field_variable]); |
|
| 479 | + $data = array(); |
|
| 480 | + foreach ($extra_user_data as $extra) { |
|
| 481 | + $split_extra = explode(':',$extra); |
|
| 482 | + if (!empty($split_extra)) { |
|
| 483 | + $block_id = $split_extra[0]; |
|
| 484 | + $column = isset($split_extra[1]) ? $split_extra[1] : null; |
|
| 485 | + $data[$block_id] = array('block_id' => $block_id, 'column' => $column); |
|
| 486 | + } |
|
| 487 | + } |
|
| 488 | + |
|
| 489 | + return $data; |
|
| 490 | + } |
|
| 491 | + |
|
| 492 | + /** |
|
| 493 | + * This function update extra user blocks data after closing a dashboard block |
|
| 494 | + * @param int User id |
|
| 495 | + * @param string plugin path |
|
| 496 | + * @return bool |
|
| 497 | + */ |
|
| 498 | + public static function close_user_block($user_id, $path) |
|
| 499 | 499 | { |
| 500 | - $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path); |
|
| 501 | - $user_block_data = self::get_user_block_data($user_id); |
|
| 502 | - |
|
| 503 | - foreach ($enabled_dashboard_blocks as $enabled_block) { |
|
| 504 | - unset($user_block_data[$enabled_block['id']]); |
|
| 505 | - } |
|
| 506 | - |
|
| 507 | - // get columns and blocks id for updating extra user data |
|
| 508 | - $columns = array(); |
|
| 509 | - $user_blocks_id = array(); |
|
| 510 | - foreach ($user_block_data as $data) { |
|
| 511 | - $user_blocks_id[$data['block_id']] = true; |
|
| 512 | - $columns[$data['block_id']] = $data['column']; |
|
| 513 | - } |
|
| 514 | - |
|
| 515 | - // update extra user blocks data |
|
| 516 | - $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns); |
|
| 517 | - |
|
| 518 | - return $upd_extra_field; |
|
| 519 | - } |
|
| 520 | - |
|
| 521 | - /** |
|
| 522 | - * get links for styles from dashboard plugins |
|
| 523 | - * @return string links |
|
| 524 | - */ |
|
| 525 | - public static function get_links_for_styles_from_dashboard_plugins() { |
|
| 526 | - |
|
| 527 | - return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL; |
|
| 528 | - } |
|
| 500 | + $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path); |
|
| 501 | + $user_block_data = self::get_user_block_data($user_id); |
|
| 502 | + |
|
| 503 | + foreach ($enabled_dashboard_blocks as $enabled_block) { |
|
| 504 | + unset($user_block_data[$enabled_block['id']]); |
|
| 505 | + } |
|
| 506 | + |
|
| 507 | + // get columns and blocks id for updating extra user data |
|
| 508 | + $columns = array(); |
|
| 509 | + $user_blocks_id = array(); |
|
| 510 | + foreach ($user_block_data as $data) { |
|
| 511 | + $user_blocks_id[$data['block_id']] = true; |
|
| 512 | + $columns[$data['block_id']] = $data['column']; |
|
| 513 | + } |
|
| 514 | + |
|
| 515 | + // update extra user blocks data |
|
| 516 | + $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns); |
|
| 517 | + |
|
| 518 | + return $upd_extra_field; |
|
| 519 | + } |
|
| 520 | + |
|
| 521 | + /** |
|
| 522 | + * get links for styles from dashboard plugins |
|
| 523 | + * @return string links |
|
| 524 | + */ |
|
| 525 | + public static function get_links_for_styles_from_dashboard_plugins() { |
|
| 526 | + |
|
| 527 | + return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL; |
|
| 528 | + } |
|
| 529 | 529 | |
| 530 | 530 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | echo '<tr>'; |
| 54 | 54 | self::display_dashboard_plugin_checkboxes($testplugin); |
| 55 | - for ($i = 0 ; $i < count($table_cols); $i++) { |
|
| 55 | + for ($i = 0; $i < count($table_cols); $i++) { |
|
| 56 | 56 | if (isset($plugin_info[strtolower($table_cols[$i])])) { |
| 57 | 57 | echo '<td>'; |
| 58 | 58 | echo $plugin_info[$table_cols[$i]]; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | echo Display::tag( |
| 68 | 68 | 'tr', |
| 69 | 69 | Display::tag('td', |
| 70 | - get_lang('CheckFilePermissions') . ' ' . Security::remove_XSS($plugin_info_file), |
|
| 70 | + get_lang('CheckFilePermissions').' '.Security::remove_XSS($plugin_info_file), |
|
| 71 | 71 | array('colspan' => '3')) |
| 72 | 72 | ); |
| 73 | 73 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | foreach ($disabled_blocks_data as $disabled_block) { |
| 80 | 80 | echo '<tr style="background-color:#eee">'; |
| 81 | 81 | echo '<td><center><input type="checkbox" name="disabled_block" value="true" checked disabled /></center>'; |
| 82 | - for ($j = 0 ; $j < count($table_cols); $j++) { |
|
| 82 | + for ($j = 0; $j < count($table_cols); $j++) { |
|
| 83 | 83 | if (isset($disabled_block[strtolower($table_cols[$j])])) { |
| 84 | 84 | if ($j == 2) { |
| 85 | 85 | echo '<td>'; |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | // clean from block data |
| 191 | 191 | if (!empty($not_selected_blocks_id)) { |
| 192 | - $sql_check = "SELECT id FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")"; |
|
| 192 | + $sql_check = "SELECT id FROM $tbl_block WHERE id IN(".implode(',', $not_selected_blocks_id).")"; |
|
| 193 | 193 | $rs_check = Database::query($sql_check); |
| 194 | 194 | if (Database::num_rows($rs_check) > 0) { |
| 195 | - $del = "DELETE FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")"; |
|
| 195 | + $del = "DELETE FROM $tbl_block WHERE id IN(".implode(',', $not_selected_blocks_id).")"; |
|
| 196 | 196 | Database::query($del); |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $affected_rows = Database::affected_rows($result); |
| 213 | 213 | } else { |
| 214 | 214 | // insert |
| 215 | - $plugin_info_file = $dashboard_pluginpath . $testplugin . "/$testplugin.info"; |
|
| 215 | + $plugin_info_file = $dashboard_pluginpath.$testplugin."/$testplugin.info"; |
|
| 216 | 216 | $plugin_info = array(); |
| 217 | 217 | if (file_exists($plugin_info_file)) { |
| 218 | 218 | $plugin_info = parse_info_file($plugin_info_file); |
@@ -282,10 +282,10 @@ discard block |
||
| 282 | 282 | // We check if plugin exists inside directory for updating active field |
| 283 | 283 | $sql = "SELECT * FROM $tbl_block"; |
| 284 | 284 | $rs = Database::query($sql); |
| 285 | - if (Database::num_rows($rs) > 0){ |
|
| 285 | + if (Database::num_rows($rs) > 0) { |
|
| 286 | 286 | while ($row = Database::fetch_array($rs)) { |
| 287 | 287 | $path = $row['path']; |
| 288 | - if (!in_array($row['path'],$possibleplugins)) { |
|
| 288 | + if (!in_array($row['path'], $possibleplugins)) { |
|
| 289 | 289 | $active = 0; |
| 290 | 290 | } else { |
| 291 | 291 | $active = 1; |
@@ -390,13 +390,13 @@ discard block |
||
| 390 | 390 | echo '<td>'.$block['description'].'</td>'; |
| 391 | 391 | echo '<td> |
| 392 | 392 | <select class="selectpicker show-tick form-control" name="columns['.$block['id'].']"> |
| 393 | - <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==1?'selected':'').' >1</option> |
|
| 394 | - <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==2?'selected':'').' >2</option> |
|
| 393 | + <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column'] == 1 ? 'selected' : '').' >1</option> |
|
| 394 | + <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column'] == 2 ? 'selected' : '').' >2</option> |
|
| 395 | 395 | </select> |
| 396 | 396 | </td>'; |
| 397 | 397 | echo '</tr>'; |
| 398 | 398 | } else { |
| 399 | - echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3'))); |
|
| 399 | + echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3'))); |
|
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | |
@@ -475,10 +475,10 @@ discard block |
||
| 475 | 475 | $user_id = intval($user_id); |
| 476 | 476 | $field_variable = 'dashboard'; |
| 477 | 477 | $extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable); |
| 478 | - $extra_user_data = explode(';',$extra_user_data[$field_variable]); |
|
| 478 | + $extra_user_data = explode(';', $extra_user_data[$field_variable]); |
|
| 479 | 479 | $data = array(); |
| 480 | 480 | foreach ($extra_user_data as $extra) { |
| 481 | - $split_extra = explode(':',$extra); |
|
| 481 | + $split_extra = explode(':', $extra); |
|
| 482 | 482 | if (!empty($split_extra)) { |
| 483 | 483 | $block_id = $split_extra[0]; |
| 484 | 484 | $column = isset($split_extra[1]) ? $split_extra[1] : null; |
@@ -380,7 +380,9 @@ |
||
| 380 | 380 | // check if user is allowed to see the block |
| 381 | 381 | if (method_exists($obj_block, 'is_block_visible_for_user')) { |
| 382 | 382 | $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id); |
| 383 | - if (!$is_block_visible_for_user) continue; |
|
| 383 | + if (!$is_block_visible_for_user) { |
|
| 384 | + continue; |
|
| 385 | + } |
|
| 384 | 386 | } |
| 385 | 387 | |
| 386 | 388 | echo '<tr>'; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @param string $table |
| 68 | 68 | * |
| 69 | - * @return mixed |
|
| 69 | + * @return string |
|
| 70 | 70 | */ |
| 71 | 71 | public static function get_main_table($table) |
| 72 | 72 | { |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | /** |
| 267 | 267 | * Frees all the memory associated with the provided result identifier. |
| 268 | - * @return bool Returns TRUE on success or FALSE on failure. |
|
| 268 | + * @return boolean|null Returns TRUE on success or FALSE on failure. |
|
| 269 | 269 | * Notes: Use this method if you are concerned about how much memory is being used for queries that return large result sets. |
| 270 | 270 | * Anyway, all associated result memory is automatically freed at the end of the script's execution. |
| 271 | 271 | */ |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | * @param array $attributes |
| 382 | 382 | * @param bool $show_query |
| 383 | 383 | * |
| 384 | - * @return bool|int |
|
| 384 | + * @return false|string |
|
| 385 | 385 | */ |
| 386 | 386 | public static function insert($table_name, $attributes, $show_query = false) |
| 387 | 387 | { |
@@ -115,8 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public static function getUTCDateTimeTypeClass() |
| 117 | 117 | { |
| 118 | - return isset(self::$utcDateTimeClass) ? self::$utcDateTimeClass : |
|
| 119 | - 'Application\DoctrineExtensions\DBAL\Types\UTCDateTimeType'; |
|
| 118 | + return isset(self::$utcDateTimeClass) ? self::$utcDateTimeClass : 'Application\DoctrineExtensions\DBAL\Types\UTCDateTimeType'; |
|
| 120 | 119 | } |
| 121 | 120 | |
| 122 | 121 | /** |
@@ -393,7 +392,7 @@ discard block |
||
| 393 | 392 | |
| 394 | 393 | if (!empty($params)) { |
| 395 | 394 | $sql = 'INSERT INTO '.$table_name.' ('.implode(',', $params).') |
| 396 | - VALUES (:'.implode(', :' ,$params).')'; |
|
| 395 | + VALUES (:'.implode(', :', $params).')'; |
|
| 397 | 396 | |
| 398 | 397 | $statement = self::getManager()->getConnection()->prepare($sql); |
| 399 | 398 | $result = $statement->execute($attributes); |
@@ -434,7 +433,7 @@ discard block |
||
| 434 | 433 | foreach ($attributes as $key => $value) { |
| 435 | 434 | $update_sql .= "$key = :$key "; |
| 436 | 435 | if ($count < count($attributes)) { |
| 437 | - $update_sql.=', '; |
|
| 436 | + $update_sql .= ', '; |
|
| 438 | 437 | } |
| 439 | 438 | $count++; |
| 440 | 439 | } |
@@ -481,7 +480,7 @@ discard block |
||
| 481 | 480 | if ($columns == '*') { |
| 482 | 481 | $clean_columns = '*'; |
| 483 | 482 | } else { |
| 484 | - $clean_columns = (string)$columns; |
|
| 483 | + $clean_columns = (string) $columns; |
|
| 485 | 484 | } |
| 486 | 485 | } |
| 487 | 486 | |
@@ -527,9 +526,9 @@ discard block |
||
| 527 | 526 | foreach ($condition_data as $condition => $value_array) { |
| 528 | 527 | if (is_array($value_array)) { |
| 529 | 528 | $clean_values = array(); |
| 530 | - foreach($value_array as $item) { |
|
| 529 | + foreach ($value_array as $item) { |
|
| 531 | 530 | $item = Database::escape_string($item); |
| 532 | - $clean_values[]= $item; |
|
| 531 | + $clean_values[] = $item; |
|
| 533 | 532 | } |
| 534 | 533 | } else { |
| 535 | 534 | $value_array = Database::escape_string($value_array); |
@@ -537,23 +536,23 @@ discard block |
||
| 537 | 536 | } |
| 538 | 537 | |
| 539 | 538 | if (!empty($condition) && $clean_values != '') { |
| 540 | - $condition = str_replace('%',"'@percentage@'", $condition); //replace "%" |
|
| 541 | - $condition = str_replace("'?'","%s", $condition); |
|
| 542 | - $condition = str_replace("?","%s", $condition); |
|
| 539 | + $condition = str_replace('%', "'@percentage@'", $condition); //replace "%" |
|
| 540 | + $condition = str_replace("'?'", "%s", $condition); |
|
| 541 | + $condition = str_replace("?", "%s", $condition); |
|
| 543 | 542 | |
| 544 | - $condition = str_replace("@%s@","@-@", $condition); |
|
| 545 | - $condition = str_replace("%s","'%s'", $condition); |
|
| 546 | - $condition = str_replace("@-@","@%s@", $condition); |
|
| 543 | + $condition = str_replace("@%s@", "@-@", $condition); |
|
| 544 | + $condition = str_replace("%s", "'%s'", $condition); |
|
| 545 | + $condition = str_replace("@-@", "@%s@", $condition); |
|
| 547 | 546 | |
| 548 | 547 | // Treat conditions as string |
| 549 | 548 | $condition = vsprintf($condition, $clean_values); |
| 550 | - $condition = str_replace('@percentage@','%', $condition); //replace "%" |
|
| 549 | + $condition = str_replace('@percentage@', '%', $condition); //replace "%" |
|
| 551 | 550 | $where_return .= $condition; |
| 552 | 551 | } |
| 553 | 552 | } |
| 554 | 553 | |
| 555 | 554 | if (!empty($where_return)) { |
| 556 | - $return_value = " WHERE $where_return" ; |
|
| 555 | + $return_value = " WHERE $where_return"; |
|
| 557 | 556 | } |
| 558 | 557 | break; |
| 559 | 558 | case 'order': |
@@ -565,7 +564,7 @@ discard block |
||
| 565 | 564 | $new_order_array = explode(',', $order_array); |
| 566 | 565 | $temp_value = array(); |
| 567 | 566 | |
| 568 | - foreach($new_order_array as $element) { |
|
| 567 | + foreach ($new_order_array as $element) { |
|
| 569 | 568 | $element = explode(' ', $element); |
| 570 | 569 | $element = array_filter($element); |
| 571 | 570 | $element = array_values($element); |
@@ -576,10 +575,10 @@ discard block |
||
| 576 | 575 | if (in_array($element[1], array('desc', 'asc'))) { |
| 577 | 576 | $order = $element[1]; |
| 578 | 577 | } |
| 579 | - $temp_value[]= $element[0].' '.$order.' '; |
|
| 578 | + $temp_value[] = $element[0].' '.$order.' '; |
|
| 580 | 579 | } else { |
| 581 | 580 | //by default DESC |
| 582 | - $temp_value[]= $element[0].' DESC '; |
|
| 581 | + $temp_value[] = $element[0].' DESC '; |
|
| 583 | 582 | } |
| 584 | 583 | } |
| 585 | 584 | if (!empty($temp_value)) { |
@@ -594,7 +593,7 @@ discard block |
||
| 594 | 593 | if (!empty($limit_array)) { |
| 595 | 594 | if (count($limit_array) > 1) { |
| 596 | 595 | $return_value .= ' LIMIT '.intval($limit_array[0]).' , '.intval($limit_array[1]); |
| 597 | - } else { |
|
| 596 | + } else { |
|
| 598 | 597 | $return_value .= ' LIMIT '.intval($limit_array[0]); |
| 599 | 598 | } |
| 600 | 599 | } |
@@ -594,7 +594,7 @@ |
||
| 594 | 594 | if (!empty($limit_array)) { |
| 595 | 595 | if (count($limit_array) > 1) { |
| 596 | 596 | $return_value .= ' LIMIT '.intval($limit_array[0]).' , '.intval($limit_array[1]); |
| 597 | - } else { |
|
| 597 | + } else { |
|
| 598 | 598 | $return_value .= ' LIMIT '.intval($limit_array[0]); |
| 599 | 599 | } |
| 600 | 600 | } |
@@ -351,6 +351,12 @@ |
||
| 351 | 351 | |
| 352 | 352 | /** |
| 353 | 353 | * Additional functions needed for fast integration |
| 354 | + * @param integer $status |
|
| 355 | + * @param string $section |
|
| 356 | + * @param string $title |
|
| 357 | + * @param string $url |
|
| 358 | + * @param string|null $formatter |
|
| 359 | + * @param string $comment |
|
| 354 | 360 | */ |
| 355 | 361 | public function build_setting($status, $section, $title, $url, $current_value, $expected_value, $formatter, $comment, $img_path = null) { |
| 356 | 362 | switch ($status) { |
@@ -401,19 +401,19 @@ |
||
| 401 | 401 | |
| 402 | 402 | public function format_yes_no_optional($value) |
| 403 | 403 | { |
| 404 | - $return = ''; |
|
| 405 | - switch($value) { |
|
| 406 | - case 0: |
|
| 407 | - $return = get_lang('No'); |
|
| 408 | - break; |
|
| 409 | - case 1: |
|
| 410 | - $return = get_lang('Yes'); |
|
| 411 | - break; |
|
| 412 | - case 2: |
|
| 413 | - $return = get_lang('Optional'); |
|
| 414 | - break; |
|
| 415 | - } |
|
| 416 | - return $return; |
|
| 404 | + $return = ''; |
|
| 405 | + switch($value) { |
|
| 406 | + case 0: |
|
| 407 | + $return = get_lang('No'); |
|
| 408 | + break; |
|
| 409 | + case 1: |
|
| 410 | + $return = get_lang('Yes'); |
|
| 411 | + break; |
|
| 412 | + case 2: |
|
| 413 | + $return = get_lang('Optional'); |
|
| 414 | + break; |
|
| 415 | + } |
|
| 416 | + return $return; |
|
| 417 | 417 | |
| 418 | 418 | } |
| 419 | 419 | |
@@ -158,8 +158,9 @@ discard block |
||
| 158 | 158 | $array[] = $this->build_setting($status, '[INI]', 'display_errors', 'http://www.php.net/manual/en/ini.core.php#ini.display_errors', $setting, $req_setting, 'on_off', get_lang('DisplayErrorsInfo')); |
| 159 | 159 | |
| 160 | 160 | $setting = ini_get('default_charset'); |
| 161 | - if ($setting == '') |
|
| 162 | - $setting = null; |
|
| 161 | + if ($setting == '') { |
|
| 162 | + $setting = null; |
|
| 163 | + } |
|
| 163 | 164 | $req_setting = null; |
| 164 | 165 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_ERROR; |
| 165 | 166 | $array[] = $this->build_setting($status, '[INI]', 'default_charset', 'http://www.php.net/manual/en/ini.core.php#ini.default-charset', $setting, $req_setting, null, get_lang('DefaultCharsetInfo')); |
@@ -177,22 +178,25 @@ discard block |
||
| 177 | 178 | $setting = ini_get('memory_limit'); |
| 178 | 179 | $req_setting = '>= '.REQUIRED_MIN_MEMORY_LIMIT.'M'; |
| 179 | 180 | $status = self :: STATUS_ERROR; |
| 180 | - if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT) |
|
| 181 | - $status = self :: STATUS_OK; |
|
| 181 | + if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT) { |
|
| 182 | + $status = self :: STATUS_OK; |
|
| 183 | + } |
|
| 182 | 184 | $array[] = $this->build_setting($status, '[INI]', 'memory_limit', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', $setting, $req_setting, null, get_lang('MemoryLimitInfo')); |
| 183 | 185 | |
| 184 | 186 | $setting = ini_get('post_max_size'); |
| 185 | 187 | $req_setting = '>= '.REQUIRED_MIN_POST_MAX_SIZE.'M'; |
| 186 | 188 | $status = self :: STATUS_ERROR; |
| 187 | - if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE) |
|
| 188 | - $status = self :: STATUS_OK; |
|
| 189 | + if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE) { |
|
| 190 | + $status = self :: STATUS_OK; |
|
| 191 | + } |
|
| 189 | 192 | $array[] = $this->build_setting($status, '[INI]', 'post_max_size', 'http://www.php.net/manual/en/ini.core.php#ini.post-max-size', $setting, $req_setting, null, get_lang('PostMaxSizeInfo')); |
| 190 | 193 | |
| 191 | 194 | $setting = ini_get('upload_max_filesize'); |
| 192 | 195 | $req_setting = '>= '.REQUIRED_MIN_UPLOAD_MAX_FILESIZE.'M'; |
| 193 | 196 | $status = self :: STATUS_ERROR; |
| 194 | - if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) |
|
| 195 | - $status = self :: STATUS_OK; |
|
| 197 | + if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) { |
|
| 198 | + $status = self :: STATUS_OK; |
|
| 199 | + } |
|
| 196 | 200 | $array[] = $this->build_setting($status, '[INI]', 'upload_max_filesize', 'http://www.php.net/manual/en/ini.core.php#ini.upload_max_filesize', $setting, $req_setting, null, get_lang('UploadMaxFilesizeInfo')); |
| 197 | 201 | |
| 198 | 202 | $setting = ini_get('variables_order'); |
@@ -205,7 +209,7 @@ discard block |
||
| 205 | 209 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
| 206 | 210 | $array[] = $this->build_setting($status, '[SESSION]', 'session.gc_maxlifetime', 'http://www.php.net/manual/en/ini.core.php#session.gc-maxlifetime', $setting, $req_setting, null, get_lang('SessionGCMaxLifetimeInfo')); |
| 207 | 211 | |
| 208 | - if (api_check_browscap()){$setting = true;}else{$setting=false;} |
|
| 212 | + if (api_check_browscap()){$setting = true;} else{$setting=false;} |
|
| 209 | 213 | $req_setting = true; |
| 210 | 214 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
| 211 | 215 | $array[] = $this->build_setting($status, '[INI]', 'browscap', 'http://www.php.net/manual/en/misc.configuration.php#ini.browscap', $setting, $req_setting, 'on_off', get_lang('BrowscapInfo')); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | const STATUS_OK = 1; |
| 17 | 17 | const STATUS_WARNING = 2; |
| 18 | - const STATUS_ERROR = 3; |
|
| 18 | + const STATUS_ERROR = 3; |
|
| 19 | 19 | const STATUS_INFORMATION = 4; |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -44,21 +44,21 @@ discard block |
||
| 44 | 44 | $html .= '<li>'; |
| 45 | 45 | } |
| 46 | 46 | $params['section'] = $section; |
| 47 | - $html .='<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>'; |
|
| 47 | + $html .= '<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>'; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $html .= '</ul><div class="tab-pane">'; |
| 51 | 51 | |
| 52 | - $data = call_user_func(array($this, 'get_' . $current_section . '_data')); |
|
| 52 | + $data = call_user_func(array($this, 'get_'.$current_section.'_data')); |
|
| 53 | 53 | echo $html; |
| 54 | 54 | $table = new SortableTableFromArray($data, 1, 100); |
| 55 | 55 | |
| 56 | - $table->set_header(0,'', false); |
|
| 57 | - $table->set_header(1,get_lang('Section'), false); |
|
| 58 | - $table->set_header(2,get_lang('Setting'), false); |
|
| 59 | - $table->set_header(3,get_lang('Current'), false); |
|
| 60 | - $table->set_header(4,get_lang('Expected'), false); |
|
| 61 | - $table->set_header(5,get_lang('Comment'), false); |
|
| 56 | + $table->set_header(0, '', false); |
|
| 57 | + $table->set_header(1, get_lang('Section'), false); |
|
| 58 | + $table->set_header(2, get_lang('Setting'), false); |
|
| 59 | + $table->set_header(3, get_lang('Current'), false); |
|
| 60 | + $table->set_header(4, get_lang('Expected'), false); |
|
| 61 | + $table->set_header(5, get_lang('Comment'), false); |
|
| 62 | 62 | |
| 63 | 63 | $table->display(); |
| 64 | 64 | echo '</div></div>'; |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $array = array(); |
| 74 | 74 | $writable_folders = array( |
| 75 | - api_get_path(SYS_APP_PATH) .'cache', |
|
| 75 | + api_get_path(SYS_APP_PATH).'cache', |
|
| 76 | 76 | api_get_path(SYS_COURSE_PATH), |
| 77 | - api_get_path(SYS_APP_PATH) .'home', |
|
| 78 | - api_get_path(SYS_APP_PATH) .'upload/users/', |
|
| 79 | - api_get_path(SYS_PATH) .'main/default_course_document/images/', |
|
| 77 | + api_get_path(SYS_APP_PATH).'home', |
|
| 78 | + api_get_path(SYS_APP_PATH).'upload/users/', |
|
| 79 | + api_get_path(SYS_PATH).'main/default_course_document/images/', |
|
| 80 | 80 | ); |
| 81 | 81 | foreach ($writable_folders as $index => $folder) { |
| 82 | 82 | $writable = is_writable($folder); |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $exists = file_exists(api_get_path(SYS_CODE_PATH).'install'); |
| 97 | 97 | $status = $exists ? self :: STATUS_WARNING : self :: STATUS_OK; |
| 98 | - $array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists') . ': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved')); |
|
| 98 | + $array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists').': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved')); |
|
| 99 | 99 | |
| 100 | 100 | $app_version = api_get_setting('chamilo_database_version'); |
| 101 | - $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null, 'Chamilo DB version'); |
|
| 101 | + $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null, 'Chamilo DB version'); |
|
| 102 | 102 | |
| 103 | 103 | return $array; |
| 104 | 104 | } |
@@ -165,33 +165,33 @@ discard block |
||
| 165 | 165 | $array[] = $this->build_setting($status, '[INI]', 'default_charset', 'http://www.php.net/manual/en/ini.core.php#ini.default-charset', $setting, $req_setting, null, get_lang('DefaultCharsetInfo')); |
| 166 | 166 | |
| 167 | 167 | $setting = ini_get('max_execution_time'); |
| 168 | - $req_setting = '300 (' . get_lang('Minimum') . ')'; |
|
| 168 | + $req_setting = '300 ('.get_lang('Minimum').')'; |
|
| 169 | 169 | $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING; |
| 170 | 170 | $array[] = $this->build_setting($status, '[INI]', 'max_execution_time', 'http://www.php.net/manual/en/ini.core.php#ini.max-execution-time', $setting, $req_setting, null, get_lang('MaxExecutionTimeInfo')); |
| 171 | 171 | |
| 172 | 172 | $setting = ini_get('max_input_time'); |
| 173 | - $req_setting = '300 (' . get_lang('Minimum') . ')'; |
|
| 173 | + $req_setting = '300 ('.get_lang('Minimum').')'; |
|
| 174 | 174 | $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING; |
| 175 | 175 | $array[] = $this->build_setting($status, '[INI]', 'max_input_time', 'http://www.php.net/manual/en/ini.core.php#ini.max-input-time', $setting, $req_setting, null, get_lang('MaxInputTimeInfo')); |
| 176 | 176 | |
| 177 | 177 | $setting = ini_get('memory_limit'); |
| 178 | 178 | $req_setting = '>= '.REQUIRED_MIN_MEMORY_LIMIT.'M'; |
| 179 | 179 | $status = self :: STATUS_ERROR; |
| 180 | - if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT) |
|
| 180 | + if ((float) $setting >= REQUIRED_MIN_MEMORY_LIMIT) |
|
| 181 | 181 | $status = self :: STATUS_OK; |
| 182 | 182 | $array[] = $this->build_setting($status, '[INI]', 'memory_limit', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', $setting, $req_setting, null, get_lang('MemoryLimitInfo')); |
| 183 | 183 | |
| 184 | 184 | $setting = ini_get('post_max_size'); |
| 185 | 185 | $req_setting = '>= '.REQUIRED_MIN_POST_MAX_SIZE.'M'; |
| 186 | 186 | $status = self :: STATUS_ERROR; |
| 187 | - if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE) |
|
| 187 | + if ((float) $setting >= REQUIRED_MIN_POST_MAX_SIZE) |
|
| 188 | 188 | $status = self :: STATUS_OK; |
| 189 | 189 | $array[] = $this->build_setting($status, '[INI]', 'post_max_size', 'http://www.php.net/manual/en/ini.core.php#ini.post-max-size', $setting, $req_setting, null, get_lang('PostMaxSizeInfo')); |
| 190 | 190 | |
| 191 | 191 | $setting = ini_get('upload_max_filesize'); |
| 192 | 192 | $req_setting = '>= '.REQUIRED_MIN_UPLOAD_MAX_FILESIZE.'M'; |
| 193 | 193 | $status = self :: STATUS_ERROR; |
| 194 | - if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) |
|
| 194 | + if ((float) $setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) |
|
| 195 | 195 | $status = self :: STATUS_OK; |
| 196 | 196 | $array[] = $this->build_setting($status, '[INI]', 'upload_max_filesize', 'http://www.php.net/manual/en/ini.core.php#ini.upload_max_filesize', $setting, $req_setting, null, get_lang('UploadMaxFilesizeInfo')); |
| 197 | 197 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
| 206 | 206 | $array[] = $this->build_setting($status, '[SESSION]', 'session.gc_maxlifetime', 'http://www.php.net/manual/en/ini.core.php#session.gc-maxlifetime', $setting, $req_setting, null, get_lang('SessionGCMaxLifetimeInfo')); |
| 207 | 207 | |
| 208 | - if (api_check_browscap()){$setting = true;}else{$setting=false;} |
|
| 208 | + if (api_check_browscap()) {$setting = true; } else {$setting = false; } |
|
| 209 | 209 | $req_setting = true; |
| 210 | 210 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
| 211 | 211 | $array[] = $this->build_setting($status, '[INI]', 'browscap', 'http://www.php.net/manual/en/misc.configuration.php#ini.browscap', $setting, $req_setting, 'on_off', get_lang('BrowscapInfo')); |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | $loaded = extension_loaded($extension); |
| 263 | 263 | $status = $loaded ? self :: STATUS_OK : self :: STATUS_ERROR; |
| 264 | - $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension') . ': ' . $extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment); |
|
| 264 | + $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension').': '.$extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | return $array; |
@@ -384,9 +384,9 @@ discard block |
||
| 384 | 384 | $formatted_expected_value = $expected_value; |
| 385 | 385 | |
| 386 | 386 | if ($formatter) { |
| 387 | - if (method_exists($this, 'format_' . $formatter)) { |
|
| 388 | - $formatted_current_value = call_user_func(array($this, 'format_' . $formatter), $current_value); |
|
| 389 | - $formatted_expected_value = call_user_func(array($this, 'format_' . $formatter), $expected_value); |
|
| 387 | + if (method_exists($this, 'format_'.$formatter)) { |
|
| 388 | + $formatted_current_value = call_user_func(array($this, 'format_'.$formatter), $current_value); |
|
| 389 | + $formatted_expected_value = call_user_func(array($this, 'format_'.$formatter), $expected_value); |
|
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | |
@@ -401,13 +401,13 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | public function get_link($title, $url) |
| 403 | 403 | { |
| 404 | - return '<a href="' . $url . '" target="about:bank">' . $title . '</a>'; |
|
| 404 | + return '<a href="'.$url.'" target="about:bank">'.$title.'</a>'; |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | public function format_yes_no_optional($value) |
| 408 | 408 | { |
| 409 | 409 | $return = ''; |
| 410 | - switch($value) { |
|
| 410 | + switch ($value) { |
|
| 411 | 411 | case 0: |
| 412 | 412 | $return = get_lang('No'); |
| 413 | 413 | break; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * @return array |
|
| 35 | + * @return string[] |
|
| 36 | 36 | */ |
| 37 | 37 | public static function toolList() |
| 38 | 38 | { |
@@ -290,7 +290,6 @@ discard block |
||
| 290 | 290 | * 'page_nr' = The page to display |
| 291 | 291 | * 'hide_navigation' = true to hide the navigation |
| 292 | 292 | * @param array $query_vars Additional variables to add in the query-string |
| 293 | - * @param array $form actions Additional variables to add in the query-string |
|
| 294 | 293 | * @param mixed An array with bool values to know which columns show. |
| 295 | 294 | * i.e: $visibility_options= array(true, false) we will only show the first column |
| 296 | 295 | * Can be also only a bool value. TRUE: show all columns, FALSE: show nothing |
@@ -331,7 +330,6 @@ discard block |
||
| 331 | 330 | * 'page_nr' = The page to display |
| 332 | 331 | * 'hide_navigation' = true to hide the navigation |
| 333 | 332 | * @param array $query_vars Additional variables to add in the query-string |
| 334 | - * @param array $form actions Additional variables to add in the query-string |
|
| 335 | 333 | * @param mixed An array with bool values to know which columns show. i.e: |
| 336 | 334 | * $visibility_options= array(true, false) we will only show the first column |
| 337 | 335 | * Can be also only a bool value. TRUE: show all columns, FALSE: show nothing |
@@ -388,10 +386,11 @@ discard block |
||
| 388 | 386 | * 'per_page' = number of items to show per page |
| 389 | 387 | * 'page_nr' = The page to display |
| 390 | 388 | * @param array $query_vars Additional variables to add in the query-string |
| 391 | - * @param array $column_show Array of binaries 1= show columns 0. hide a column |
|
| 389 | + * @param integer[] $column_show Array of binaries 1= show columns 0. hide a column |
|
| 392 | 390 | * @param array $column_order An array of integers that let us decide how the columns are going to be sort. |
| 393 | 391 | * i.e: $column_order=array('1''4','3','4'); The 2nd column will be order like the 4th column |
| 394 | 392 | * @param array $form_actions Set optional forms actions |
| 393 | + * @param string $table_name |
|
| 395 | 394 | * |
| 396 | 395 | * @author Julio Montoya |
| 397 | 396 | */ |
@@ -444,7 +443,7 @@ discard block |
||
| 444 | 443 | * @param bool $filter (true) or not (false) |
| 445 | 444 | * @param bool $returnValue |
| 446 | 445 | * |
| 447 | - * @return void |
|
| 446 | + * @return string|null |
|
| 448 | 447 | */ |
| 449 | 448 | public static function display_normal_message($message, $filter = true, $returnValue = false) |
| 450 | 449 | { |
@@ -474,7 +473,7 @@ discard block |
||
| 474 | 473 | /** |
| 475 | 474 | * Displays an confirmation message. Use this if something has been done successfully |
| 476 | 475 | * @param bool Filter (true) or not (false) |
| 477 | - * @return void |
|
| 476 | + * @return string|null |
|
| 478 | 477 | */ |
| 479 | 478 | public static function display_confirmation_message ($message, $filter = true, $returnValue = false) |
| 480 | 479 | { |
@@ -491,7 +490,7 @@ discard block |
||
| 491 | 490 | * @param string $message - include any additional html |
| 492 | 491 | * tags if you need them |
| 493 | 492 | * @param bool Filter (true) or not (false) |
| 494 | - * @return void |
|
| 493 | + * @return string|null |
|
| 495 | 494 | */ |
| 496 | 495 | public static function display_error_message ($message, $filter = true, $returnValue = false) |
| 497 | 496 | { |
@@ -681,6 +680,7 @@ discard block |
||
| 681 | 680 | * @param string The alt text (probably a language variable) |
| 682 | 681 | * @param array additional attributes (for instance height, width, onclick, ...) |
| 683 | 682 | * @param integer The wanted width of the icon (to be looked for in the corresponding img/icons/ folder) |
| 683 | + * @param string $image |
|
| 684 | 684 | * @return void |
| 685 | 685 | */ |
| 686 | 686 | public static function display_icon( |
@@ -881,6 +881,7 @@ discard block |
||
| 881 | 881 | /** |
| 882 | 882 | * Displays an HTML input tag |
| 883 | 883 | * |
| 884 | + * @param string $type |
|
| 884 | 885 | */ |
| 885 | 886 | public static function input($type, $name, $value, $attributes = array()) |
| 886 | 887 | { |
@@ -897,8 +898,8 @@ discard block |
||
| 897 | 898 | } |
| 898 | 899 | |
| 899 | 900 | /** |
| 900 | - * @param $name |
|
| 901 | - * @param $value |
|
| 901 | + * @param string $name |
|
| 902 | + * @param string $value |
|
| 902 | 903 | * @param array $attributes |
| 903 | 904 | * @return string |
| 904 | 905 | */ |
@@ -913,6 +914,7 @@ discard block |
||
| 913 | 914 | /** |
| 914 | 915 | * Displays an HTML select tag |
| 915 | 916 | * |
| 917 | + * @param string $blank_item_text |
|
| 916 | 918 | */ |
| 917 | 919 | public static function select( |
| 918 | 920 | $name, |
@@ -983,6 +985,8 @@ discard block |
||
| 983 | 985 | * @param array content that will be showed |
| 984 | 986 | * @param string the id of the container of the tab in the example "tabs" |
| 985 | 987 | * @param array attributes for the ul |
| 988 | + * @param string[] $header_list |
|
| 989 | + * @param string[] $content_list |
|
| 986 | 990 | * |
| 987 | 991 | */ |
| 988 | 992 | public static function tabs($header_list, $content_list, $id = 'tabs', $attributes = array(), $ul_attributes = array()) |
@@ -1029,7 +1033,7 @@ discard block |
||
| 1029 | 1033 | |
| 1030 | 1034 | /** |
| 1031 | 1035 | * @param $headers |
| 1032 | - * @param null $selected |
|
| 1036 | + * @param integer $selected |
|
| 1033 | 1037 | * |
| 1034 | 1038 | * @return string |
| 1035 | 1039 | */ |
@@ -1067,6 +1071,7 @@ discard block |
||
| 1067 | 1071 | * As you can see both function use the same "my_grid_name" this is very important otherwise nothing will work |
| 1068 | 1072 | * |
| 1069 | 1073 | * @param string the div id, this value must be the same with the first parameter of Display::grid_js() |
| 1074 | + * @param string $div_id |
|
| 1070 | 1075 | * @return string html |
| 1071 | 1076 | * |
| 1072 | 1077 | */ |
@@ -1622,6 +1627,8 @@ discard block |
||
| 1622 | 1627 | * @param string url that will be added (for jquery see hot_courses.tpl) |
| 1623 | 1628 | * @param string point info array see function CourseManager::get_course_ranking() |
| 1624 | 1629 | * @param bool add a div wrapper |
| 1630 | + * @param string $id |
|
| 1631 | + * @param string $url |
|
| 1625 | 1632 | * @todo use templates |
| 1626 | 1633 | **/ |
| 1627 | 1634 | public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true) |
@@ -1717,6 +1724,9 @@ discard block |
||
| 1717 | 1724 | return '<'.$size.'>'.Security::remove_XSS($title).'</'.$size.'>'; |
| 1718 | 1725 | } |
| 1719 | 1726 | |
| 1727 | + /** |
|
| 1728 | + * @param string $title |
|
| 1729 | + */ |
|
| 1720 | 1730 | public static function page_subheader2($title, $second_title = null) |
| 1721 | 1731 | { |
| 1722 | 1732 | return self::page_header($title, $second_title, 'h4'); |
@@ -1947,6 +1957,7 @@ discard block |
||
| 1947 | 1957 | |
| 1948 | 1958 | /** |
| 1949 | 1959 | * @todo use twig |
| 1960 | + * @param string $title |
|
| 1950 | 1961 | */ |
| 1951 | 1962 | public static function group_button($title, $elements) |
| 1952 | 1963 | { |
@@ -2164,9 +2175,9 @@ discard block |
||
| 2164 | 2175 | |
| 2165 | 2176 | /** |
| 2166 | 2177 | * @param int $id |
| 2167 | - * @param array $content |
|
| 2178 | + * @param string[] $content |
|
| 2168 | 2179 | * @param int $col |
| 2169 | - * @param bool|true $right |
|
| 2180 | + * @param boolean $right |
|
| 2170 | 2181 | * @return string |
| 2171 | 2182 | */ |
| 2172 | 2183 | public static function toolbarAction($id, $content = array(), $col = 2, $right = true) |
@@ -2248,10 +2259,10 @@ discard block |
||
| 2248 | 2259 | /** |
| 2249 | 2260 | * @param string $title |
| 2250 | 2261 | * @param string $content |
| 2251 | - * @param null $id |
|
| 2262 | + * @param string $id |
|
| 2252 | 2263 | * @param array $params |
| 2253 | - * @param null $idAccordion |
|
| 2254 | - * @param null $idCollapse |
|
| 2264 | + * @param string $idAccordion |
|
| 2265 | + * @param string $idCollapse |
|
| 2255 | 2266 | * @param bool|true $open |
| 2256 | 2267 | * @param bool|false $fullClickable |
| 2257 | 2268 | * @return null|string |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | ); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Displays the page header |
|
| 54 | - * @param string The name of the page (will be showed in the page title) |
|
| 55 | - * @param string Optional help file name |
|
| 56 | - * @param string $page_header |
|
| 57 | - */ |
|
| 52 | + /** |
|
| 53 | + * Displays the page header |
|
| 54 | + * @param string The name of the page (will be showed in the page title) |
|
| 55 | + * @param string Optional help file name |
|
| 56 | + * @param string $page_header |
|
| 57 | + */ |
|
| 58 | 58 | public static function display_header($tool_name ='', $help = null, $page_header = null) |
| 59 | 59 | { |
| 60 | 60 | $origin = api_get_origin(); |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | */ |
| 449 | 449 | public static function display_normal_message($message, $filter = true, $returnValue = false) |
| 450 | 450 | { |
| 451 | - $message = self::return_message($message, 'normal', $filter); |
|
| 451 | + $message = self::return_message($message, 'normal', $filter); |
|
| 452 | 452 | if ($returnValue) { |
| 453 | 453 | return $message; |
| 454 | 454 | } else { |
@@ -524,22 +524,22 @@ discard block |
||
| 524 | 524 | public static function return_message($message, $type = 'normal', $filter = true) |
| 525 | 525 | { |
| 526 | 526 | if ($filter) { |
| 527 | - $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()); |
|
| 527 | + $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()); |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | $class = ""; |
| 531 | 531 | switch($type) { |
| 532 | 532 | case 'warning': |
| 533 | 533 | $class .= 'alert alert-warning'; |
| 534 | - break; |
|
| 534 | + break; |
|
| 535 | 535 | case 'error': |
| 536 | 536 | $class .= 'alert alert-danger'; |
| 537 | - break; |
|
| 537 | + break; |
|
| 538 | 538 | case 'confirmation': |
| 539 | 539 | case 'confirm': |
| 540 | 540 | case 'success': |
| 541 | 541 | $class .= 'alert alert-success'; |
| 542 | - break; |
|
| 542 | + break; |
|
| 543 | 543 | case 'normal': |
| 544 | 544 | default: |
| 545 | 545 | $class .= 'alert alert-info'; |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | * @param array additional attributes (for instance height, width, onclick, ...) |
| 683 | 683 | * @param integer The wanted width of the icon (to be looked for in the corresponding img/icons/ folder) |
| 684 | 684 | * @return void |
| 685 | - */ |
|
| 685 | + */ |
|
| 686 | 686 | public static function display_icon( |
| 687 | 687 | $image, |
| 688 | 688 | $alt_text = '', |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | * @author Julio Montoya 2010 Function improved, adding image constants |
| 706 | 706 | * @author Yannick Warnier 2011 Added size handler |
| 707 | 707 | * @version Feb 2011 |
| 708 | - */ |
|
| 708 | + */ |
|
| 709 | 709 | public static function return_icon( |
| 710 | 710 | $image, |
| 711 | 711 | $alt_text = '', |
@@ -884,14 +884,14 @@ discard block |
||
| 884 | 884 | */ |
| 885 | 885 | public static function input($type, $name, $value, $attributes = array()) |
| 886 | 886 | { |
| 887 | - if (isset($type)) { |
|
| 888 | - $attributes['type']= $type; |
|
| 889 | - } |
|
| 890 | - if (isset($name)) { |
|
| 891 | - $attributes['name']= $name; |
|
| 892 | - } |
|
| 893 | - if (isset($value)) { |
|
| 894 | - $attributes['value']= $value; |
|
| 887 | + if (isset($type)) { |
|
| 888 | + $attributes['type']= $type; |
|
| 889 | + } |
|
| 890 | + if (isset($name)) { |
|
| 891 | + $attributes['name']= $name; |
|
| 892 | + } |
|
| 893 | + if (isset($value)) { |
|
| 894 | + $attributes['value']= $value; |
|
| 895 | 895 | } |
| 896 | 896 | return self::tag('input', '', $attributes); |
| 897 | 897 | } |
@@ -904,10 +904,10 @@ discard block |
||
| 904 | 904 | */ |
| 905 | 905 | public static function button($name, $value, $attributes = array()) |
| 906 | 906 | { |
| 907 | - if (!empty($name)) { |
|
| 907 | + if (!empty($name)) { |
|
| 908 | 908 | $attributes['name'] = $name; |
| 909 | - } |
|
| 910 | - return self::tag('button', $value, $attributes); |
|
| 909 | + } |
|
| 910 | + return self::tag('button', $value, $attributes); |
|
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | /** |
@@ -974,7 +974,7 @@ discard block |
||
| 974 | 974 | * in the $htmlHeadXtra variable before the display_header |
| 975 | 975 | * Add this script |
| 976 | 976 | * @example |
| 977 | - * <script> |
|
| 977 | + * <script> |
|
| 978 | 978 | $(function() { |
| 979 | 979 | $( "#tabs" ).tabs(); |
| 980 | 980 | }); |
@@ -1035,20 +1035,20 @@ discard block |
||
| 1035 | 1035 | */ |
| 1036 | 1036 | public static function tabsOnlyLink($headers, $selected = null) |
| 1037 | 1037 | { |
| 1038 | - $id = uniqid(); |
|
| 1039 | - $i = 1; |
|
| 1040 | - $lis = null; |
|
| 1041 | - foreach ($headers as $item) { |
|
| 1038 | + $id = uniqid(); |
|
| 1039 | + $i = 1; |
|
| 1040 | + $lis = null; |
|
| 1041 | + foreach ($headers as $item) { |
|
| 1042 | 1042 | $class = null; |
| 1043 | 1043 | if ($i == $selected) { |
| 1044 | 1044 | $class = 'active'; |
| 1045 | 1045 | } |
| 1046 | - $item = self::tag( |
|
| 1047 | - 'a', |
|
| 1048 | - $item['content'], |
|
| 1049 | - array('id' => $id.'-'.$i, 'href' => $item['url']) |
|
| 1050 | - ); |
|
| 1051 | - $lis .= self::tag('li', $item, array('class' => $class)); |
|
| 1046 | + $item = self::tag( |
|
| 1047 | + 'a', |
|
| 1048 | + $item['content'], |
|
| 1049 | + array('id' => $id.'-'.$i, 'href' => $item['url']) |
|
| 1050 | + ); |
|
| 1051 | + $lis .= self::tag('li', $item, array('class' => $class)); |
|
| 1052 | 1052 | $i++; |
| 1053 | 1053 | } |
| 1054 | 1054 | return self::tag('ul', $lis, array('class' => 'nav nav-tabs tabs-margin')); |
@@ -1260,8 +1260,8 @@ discard block |
||
| 1260 | 1260 | */ |
| 1261 | 1261 | public static function table($headers, $rows, $attributes = array()) |
| 1262 | 1262 | { |
| 1263 | - if (empty($attributes)) { |
|
| 1264 | - $attributes['class'] = 'data_table'; |
|
| 1263 | + if (empty($attributes)) { |
|
| 1264 | + $attributes['class'] = 'data_table'; |
|
| 1265 | 1265 | } |
| 1266 | 1266 | $table = new HTML_Table($attributes); |
| 1267 | 1267 | $row = 0; |
@@ -1269,17 +1269,17 @@ discard block |
||
| 1269 | 1269 | |
| 1270 | 1270 | // Course headers |
| 1271 | 1271 | if (!empty($headers)) { |
| 1272 | - foreach ($headers as $item) { |
|
| 1273 | - $table->setHeaderContents($row, $column, $item); |
|
| 1274 | - $column++; |
|
| 1275 | - } |
|
| 1276 | - $row = 1; |
|
| 1277 | - $column = 0; |
|
| 1272 | + foreach ($headers as $item) { |
|
| 1273 | + $table->setHeaderContents($row, $column, $item); |
|
| 1274 | + $column++; |
|
| 1275 | + } |
|
| 1276 | + $row = 1; |
|
| 1277 | + $column = 0; |
|
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | 1280 | if (!empty($rows)) { |
| 1281 | - foreach($rows as $content) { |
|
| 1282 | - $table->setCellContents($row, $column, $content); |
|
| 1281 | + foreach($rows as $content) { |
|
| 1282 | + $table->setCellContents($row, $column, $content); |
|
| 1283 | 1283 | $row++; |
| 1284 | 1284 | } |
| 1285 | 1285 | } |
@@ -1385,7 +1385,7 @@ discard block |
||
| 1385 | 1385 | //$item_property['tool'] != TOOL_DROPBOX && |
| 1386 | 1386 | $item_property['tool'] != TOOL_NOTEBOOK && |
| 1387 | 1387 | $item_property['tool'] != TOOL_CHAT) |
| 1388 | - ) |
|
| 1388 | + ) |
|
| 1389 | 1389 | ) |
| 1390 | 1390 | // Take only what's visible or "invisible but where the user is a teacher" or where the visibility is unset. |
| 1391 | 1391 | && ($item_property['visibility'] == '1' |
@@ -1401,7 +1401,7 @@ discard block |
||
| 1401 | 1401 | ($item_property['to_user_id'] != $user_id) && |
| 1402 | 1402 | (!isset($item_property['to_group_id']) || !in_array($item_property['to_group_id'], $group_ids))) |
| 1403 | 1403 | ) { |
| 1404 | - continue; |
|
| 1404 | + continue; |
|
| 1405 | 1405 | } |
| 1406 | 1406 | |
| 1407 | 1407 | // If it's a survey, make sure the user's invited. Otherwise drop it. |
@@ -1620,21 +1620,21 @@ discard block |
||
| 1620 | 1620 | * |
| 1621 | 1621 | * @param string id of the rating ul element |
| 1622 | 1622 | * @param string url that will be added (for jquery see hot_courses.tpl) |
| 1623 | - * @param string point info array see function CourseManager::get_course_ranking() |
|
| 1624 | - * @param bool add a div wrapper |
|
| 1625 | - * @todo use templates |
|
| 1623 | + * @param string point info array see function CourseManager::get_course_ranking() |
|
| 1624 | + * @param bool add a div wrapper |
|
| 1625 | + * @todo use templates |
|
| 1626 | 1626 | **/ |
| 1627 | 1627 | public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true) |
| 1628 | 1628 | { |
| 1629 | - $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null; |
|
| 1630 | - $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
|
| 1629 | + $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null; |
|
| 1630 | + $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
|
| 1631 | 1631 | |
| 1632 | - if (!empty($percentage)) { |
|
| 1632 | + if (!empty($percentage)) { |
|
| 1633 | 1633 | $percentage = $percentage*125/100; |
| 1634 | 1634 | } |
| 1635 | - $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
| 1635 | + $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
| 1636 | 1636 | |
| 1637 | - $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
|
| 1637 | + $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
|
| 1638 | 1638 | |
| 1639 | 1639 | $html = '<ul id="'.$id.'" class="star-rating"> |
| 1640 | 1640 | <li class="current-rating" style="width:'.$percentage.'px;"></li> |
@@ -1645,26 +1645,26 @@ discard block |
||
| 1645 | 1645 | <li><a href="javascript:void(0);" data-link="'.$url.'&star=5" title="'.$star_label.'" class="five-stars">5</a></li> |
| 1646 | 1646 | </ul>'; |
| 1647 | 1647 | |
| 1648 | - $labels = array(); |
|
| 1648 | + $labels = array(); |
|
| 1649 | 1649 | |
| 1650 | - $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
| 1651 | - $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
| 1652 | - if (!empty($number_of_users_who_voted)) { |
|
| 1653 | - $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
|
| 1654 | - } |
|
| 1650 | + $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
| 1651 | + $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
| 1652 | + if (!empty($number_of_users_who_voted)) { |
|
| 1653 | + $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
|
| 1654 | + } |
|
| 1655 | 1655 | |
| 1656 | - $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
| 1656 | + $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
| 1657 | 1657 | |
| 1658 | - if (!$add_div_wrapper && api_is_anonymous()) { |
|
| 1659 | - $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
| 1660 | - } |
|
| 1658 | + if (!$add_div_wrapper && api_is_anonymous()) { |
|
| 1659 | + $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
| 1660 | + } |
|
| 1661 | 1661 | |
| 1662 | 1662 | $html .= Display::div(implode(' | ', $labels) , array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
| 1663 | 1663 | $html .= ' '.Display::span(' ', array('id' => 'vote_label2_'.$id)); |
| 1664 | 1664 | |
| 1665 | 1665 | if ($add_div_wrapper) { |
| 1666 | - $html = Display::div($html, array('id' => 'rating_wrapper_'.$id)); |
|
| 1667 | - } |
|
| 1666 | + $html = Display::div($html, array('id' => 'rating_wrapper_'.$id)); |
|
| 1667 | + } |
|
| 1668 | 1668 | |
| 1669 | 1669 | return $html; |
| 1670 | 1670 | } |
@@ -1702,8 +1702,8 @@ discard block |
||
| 1702 | 1702 | return self::page_header($title, $second_title); |
| 1703 | 1703 | } |
| 1704 | 1704 | |
| 1705 | - public static function page_subheader_and_translate($title, $second_title = null) |
|
| 1706 | - { |
|
| 1705 | + public static function page_subheader_and_translate($title, $second_title = null) |
|
| 1706 | + { |
|
| 1707 | 1707 | $title = get_lang($title); |
| 1708 | 1708 | return self::page_subheader($title, $second_title); |
| 1709 | 1709 | } |
@@ -666,9 +666,10 @@ |
||
| 666 | 666 | $result = ''; |
| 667 | 667 | for ($i = $min; $i <= $max; $i ++) { |
| 668 | 668 | $result .= '<option value="'.$i.'"'; |
| 669 | - if (is_int($selected_num)) |
|
| 670 | - if ($selected_num == $i) { |
|
| 669 | + if (is_int($selected_num)) { |
|
| 670 | + if ($selected_num == $i) { |
|
| 671 | 671 | $result .= ' selected="selected"'; |
| 672 | + } |
|
| 672 | 673 | } |
| 673 | 674 | $result .= '>'.$i.'</option>'; |
| 674 | 675 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param string Optional help file name |
| 56 | 56 | * @param string $page_header |
| 57 | 57 | */ |
| 58 | - public static function display_header($tool_name ='', $help = null, $page_header = null) |
|
| 58 | + public static function display_header($tool_name = '', $help = null, $page_header = null) |
|
| 59 | 59 | { |
| 60 | 60 | $origin = api_get_origin(); |
| 61 | 61 | $showHeader = true; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $grid_class = array(), |
| 352 | 352 | $elementCount = 0 |
| 353 | 353 | ) { |
| 354 | - $column = 0; |
|
| 354 | + $column = 0; |
|
| 355 | 355 | $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20; |
| 356 | 356 | |
| 357 | 357 | $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name); |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | * @param bool Filter (true) or not (false) |
| 477 | 477 | * @return void |
| 478 | 478 | */ |
| 479 | - public static function display_confirmation_message ($message, $filter = true, $returnValue = false) |
|
| 479 | + public static function display_confirmation_message($message, $filter = true, $returnValue = false) |
|
| 480 | 480 | { |
| 481 | 481 | $message = self::return_message($message, 'confirm', $filter); |
| 482 | 482 | if ($returnValue) { |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * @param bool Filter (true) or not (false) |
| 494 | 494 | * @return void |
| 495 | 495 | */ |
| 496 | - public static function display_error_message ($message, $filter = true, $returnValue = false) |
|
| 496 | + public static function display_error_message($message, $filter = true, $returnValue = false) |
|
| 497 | 497 | { |
| 498 | 498 | $message = self::return_message($message, 'error', $filter); |
| 499 | 499 | if ($returnValue) { |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | * @param string $type |
| 509 | 509 | * @param bool $filter |
| 510 | 510 | */ |
| 511 | - public static function return_message_and_translate($message, $type='normal', $filter = true) |
|
| 511 | + public static function return_message_and_translate($message, $type = 'normal', $filter = true) |
|
| 512 | 512 | { |
| 513 | 513 | $message = get_lang($message); |
| 514 | 514 | echo self::return_message($message, $type, $filter); |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | $class = ""; |
| 535 | - switch($type) { |
|
| 535 | + switch ($type) { |
|
| 536 | 536 | case 'warning': |
| 537 | 537 | $class .= 'alert alert-warning'; |
| 538 | 538 | break; |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | * @param string optional, class from stylesheet |
| 561 | 561 | * @return string encrypted mailto hyperlink |
| 562 | 562 | */ |
| 563 | - public static function encrypted_mailto_link ($email, $clickable_text = null, $style_class = '') |
|
| 563 | + public static function encrypted_mailto_link($email, $clickable_text = null, $style_class = '') |
|
| 564 | 564 | { |
| 565 | 565 | if (is_null($clickable_text)) { |
| 566 | 566 | $clickable_text = $email; |
@@ -575,14 +575,14 @@ discard block |
||
| 575 | 575 | } |
| 576 | 576 | // Encrypt email |
| 577 | 577 | $hmail = ''; |
| 578 | - for ($i = 0; $i < strlen($email); $i ++) { |
|
| 578 | + for ($i = 0; $i < strlen($email); $i++) { |
|
| 579 | 579 | $hmail .= '&#'.ord($email { |
| 580 | 580 | $i }).';'; |
| 581 | 581 | } |
| 582 | 582 | $hclickable_text = null; |
| 583 | 583 | // Encrypt clickable text if @ is present |
| 584 | 584 | if (strpos($clickable_text, '@')) { |
| 585 | - for ($i = 0; $i < strlen($clickable_text); $i ++) { |
|
| 585 | + for ($i = 0; $i < strlen($clickable_text); $i++) { |
|
| 586 | 586 | $hclickable_text .= '&#'.ord($clickable_text { |
| 587 | 587 | $i }).';'; |
| 588 | 588 | } |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | } |
| 615 | 615 | // Encrypt email |
| 616 | 616 | $hmail = ''; |
| 617 | - for ($i = 0; $i < strlen($email); $i ++) { |
|
| 617 | + for ($i = 0; $i < strlen($email); $i++) { |
|
| 618 | 618 | $hmail .= '&#'.ord($email { |
| 619 | 619 | $i }).';'; |
| 620 | 620 | } |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | public static function get_alphabet_options($selected_letter = '') |
| 648 | 648 | { |
| 649 | 649 | $result = ''; |
| 650 | - for ($i = 65; $i <= 90; $i ++) { |
|
| 650 | + for ($i = 65; $i <= 90; $i++) { |
|
| 651 | 651 | $letter = chr($i); |
| 652 | 652 | $result .= '<option value="'.$letter.'"'; |
| 653 | 653 | if ($selected_letter == $letter) { |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | public static function get_numeric_options($min, $max, $selected_num = 0) |
| 669 | 669 | { |
| 670 | 670 | $result = ''; |
| 671 | - for ($i = $min; $i <= $max; $i ++) { |
|
| 671 | + for ($i = $min; $i <= $max; $i++) { |
|
| 672 | 672 | $result .= '<option value="'.$i.'"'; |
| 673 | 673 | if (is_int($selected_num)) |
| 674 | 674 | if ($selected_num == $i) { |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | $size = ICON_SIZE_SMALL; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | - $size_extra = $size . '/'; |
|
| 748 | + $size_extra = $size.'/'; |
|
| 749 | 749 | |
| 750 | 750 | // Checking the img/ folder |
| 751 | 751 | $icon = $w_code_path.'img/'.$image; |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | $theme = 'themes/chamilo/icons/'; |
| 754 | 754 | |
| 755 | 755 | if ($loadThemeIcon) { |
| 756 | - $theme = 'themes/' . api_get_visual_theme() . '/icons/'; |
|
| 756 | + $theme = 'themes/'.api_get_visual_theme().'/icons/'; |
|
| 757 | 757 | // Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX |
| 758 | 758 | if (is_file($alternateCssPath.$theme.$size_extra.$image)) { |
| 759 | 759 | $icon = $alternateWebCssPath.$theme.$size_extra.$image; |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | } |
| 860 | 860 | } |
| 861 | 861 | //some tags don't have this </XXX> |
| 862 | - if (in_array($tag, array('img','input','br'))) { |
|
| 862 | + if (in_array($tag, array('img', 'input', 'br'))) { |
|
| 863 | 863 | $return_value = '<'.$tag.' '.$attribute_list.' />'; |
| 864 | 864 | } else { |
| 865 | 865 | $return_value = '<'.$tag.' '.$attribute_list.' > '.$content.'</'.$tag.'>'; |
@@ -912,13 +912,13 @@ discard block |
||
| 912 | 912 | public static function input($type, $name, $value, $attributes = array()) |
| 913 | 913 | { |
| 914 | 914 | if (isset($type)) { |
| 915 | - $attributes['type']= $type; |
|
| 915 | + $attributes['type'] = $type; |
|
| 916 | 916 | } |
| 917 | 917 | if (isset($name)) { |
| 918 | - $attributes['name']= $name; |
|
| 918 | + $attributes['name'] = $name; |
|
| 919 | 919 | } |
| 920 | 920 | if (isset($value)) { |
| 921 | - $attributes['value']= $value; |
|
| 921 | + $attributes['value'] = $value; |
|
| 922 | 922 | } |
| 923 | 923 | return self::tag('input', '', $attributes); |
| 924 | 924 | } |
@@ -951,14 +951,14 @@ discard block |
||
| 951 | 951 | ) { |
| 952 | 952 | $html = ''; |
| 953 | 953 | $extra = ''; |
| 954 | - $default_id = 'id="' . $name . '" '; |
|
| 954 | + $default_id = 'id="'.$name.'" '; |
|
| 955 | 955 | foreach ($extra_attributes as $key => $parameter) { |
| 956 | 956 | if ($key == 'id') { |
| 957 | 957 | $default_id = ''; |
| 958 | 958 | } |
| 959 | - $extra .= $key . '="' . $parameter . '" '; |
|
| 959 | + $extra .= $key.'="'.$parameter.'" '; |
|
| 960 | 960 | } |
| 961 | - $html .= '<select name="' . $name . '" ' . $default_id . ' ' . $extra . '>'; |
|
| 961 | + $html .= '<select name="'.$name.'" '.$default_id.' '.$extra.'>'; |
|
| 962 | 962 | |
| 963 | 963 | if ($show_blank_item) { |
| 964 | 964 | if (empty($blank_item_text)) { |
@@ -966,14 +966,14 @@ discard block |
||
| 966 | 966 | } else { |
| 967 | 967 | $blank_item_text = Security::remove_XSS($blank_item_text); |
| 968 | 968 | } |
| 969 | - $html .= self::tag('option', '-- ' . $blank_item_text . ' --', array('value' => '-1')); |
|
| 969 | + $html .= self::tag('option', '-- '.$blank_item_text.' --', array('value' => '-1')); |
|
| 970 | 970 | } |
| 971 | 971 | if ($values) { |
| 972 | 972 | foreach ($values as $key => $value) { |
| 973 | 973 | if (is_array($value) && isset($value['name'])) { |
| 974 | 974 | $value = $value['name']; |
| 975 | 975 | } |
| 976 | - $html .= '<option value="' . $key . '"'; |
|
| 976 | + $html .= '<option value="'.$key.'"'; |
|
| 977 | 977 | |
| 978 | 978 | if (is_array($default)) { |
| 979 | 979 | foreach ($default as $item) { |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | } |
| 989 | 989 | } |
| 990 | 990 | |
| 991 | - $html .= '>' . $value . '</option>'; |
|
| 991 | + $html .= '>'.$value.'</option>'; |
|
| 992 | 992 | } |
| 993 | 993 | } |
| 994 | 994 | $html .= '</select>'; |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | */ |
| 1015 | 1015 | public static function tabs($header_list, $content_list, $id = 'tabs', $attributes = array(), $ul_attributes = array()) |
| 1016 | 1016 | { |
| 1017 | - if (empty($header_list) || count($header_list) == 0 ) { |
|
| 1017 | + if (empty($header_list) || count($header_list) == 0) { |
|
| 1018 | 1018 | return ''; |
| 1019 | 1019 | } |
| 1020 | 1020 | |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | |
| 1052 | 1052 | $main_div = self::tag('div', $ul.self::tag('div', $divs, ['class' => 'tab-content']), $attributes); |
| 1053 | 1053 | |
| 1054 | - return $main_div ; |
|
| 1054 | + return $main_div; |
|
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | 1057 | /** |
@@ -1099,8 +1099,8 @@ discard block |
||
| 1099 | 1099 | */ |
| 1100 | 1100 | public static function grid_html($div_id) |
| 1101 | 1101 | { |
| 1102 | - $table = self::tag('table','', array('id' => $div_id)); |
|
| 1103 | - $table .= self::tag('div','', array('id' => $div_id.'_pager')); |
|
| 1102 | + $table = self::tag('table', '', array('id' => $div_id)); |
|
| 1103 | + $table .= self::tag('div', '', array('id' => $div_id.'_pager')); |
|
| 1104 | 1104 | return $table; |
| 1105 | 1105 | } |
| 1106 | 1106 | |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | $obj->colNames = $column_names; |
| 1162 | 1162 | $obj->colModel = $column_model; |
| 1163 | 1163 | $obj->pager = '#'.$div_id.'_pager'; |
| 1164 | - $obj->datatype = 'json'; |
|
| 1164 | + $obj->datatype = 'json'; |
|
| 1165 | 1165 | $obj->viewrecords = 'true'; |
| 1166 | 1166 | |
| 1167 | 1167 | $all_value = 10000000; |
@@ -1222,10 +1222,10 @@ discard block |
||
| 1222 | 1222 | // Adding static data. |
| 1223 | 1223 | if (!empty($data)) { |
| 1224 | 1224 | $data_var = $div_id.'_data'; |
| 1225 | - $json.=' var '.$data_var.' = '.json_encode($data).';'; |
|
| 1225 | + $json .= ' var '.$data_var.' = '.json_encode($data).';'; |
|
| 1226 | 1226 | $obj->data = $data_var; |
| 1227 | 1227 | $obj->datatype = 'local'; |
| 1228 | - $json.="\n"; |
|
| 1228 | + $json .= "\n"; |
|
| 1229 | 1229 | } |
| 1230 | 1230 | |
| 1231 | 1231 | $obj->end = 'end'; |
@@ -1239,12 +1239,12 @@ discard block |
||
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | 1241 | // Fixing true/false js values that doesn't need the "" |
| 1242 | - $json_encode = str_replace(':"true"',':true',$json_encode); |
|
| 1242 | + $json_encode = str_replace(':"true"', ':true', $json_encode); |
|
| 1243 | 1243 | // wrap_cell is not a valid jqgrid attributes is a hack to wrap a text |
| 1244 | 1244 | $json_encode = str_replace('"wrap_cell":true', 'cellattr : function(rowId, value, rowObject, colModel, arrData) { return \'class = "jqgrid_whitespace"\'; }', $json_encode); |
| 1245 | - $json_encode = str_replace(':"false"',':false',$json_encode); |
|
| 1245 | + $json_encode = str_replace(':"false"', ':false', $json_encode); |
|
| 1246 | 1246 | $json_encode = str_replace('"formatter":"action_formatter"', 'formatter:action_formatter', $json_encode); |
| 1247 | - $json_encode = str_replace(array('{"first":"first",','"end":"end"}'), '', $json_encode); |
|
| 1247 | + $json_encode = str_replace(array('{"first":"first",', '"end":"end"}'), '', $json_encode); |
|
| 1248 | 1248 | |
| 1249 | 1249 | // Creating the jqgrid element. |
| 1250 | 1250 | $json .= '$("#'.$div_id.'").jqGrid({'; |
@@ -1259,22 +1259,22 @@ discard block |
||
| 1259 | 1259 | $groups = ''; |
| 1260 | 1260 | foreach ($extra_params['groupHeaders'] as $group) { |
| 1261 | 1261 | //{ "startColumnName" : "courses", "numberOfColumns" : 1, "titleText" : "Order Info" }, |
| 1262 | - $groups .= '{ "startColumnName" : "' . $group['startColumnName'] . '", "numberOfColumns" : ' . $group['numberOfColumns'] . ', "titleText" : "' . $group['titleText'] . '" },'; |
|
| 1262 | + $groups .= '{ "startColumnName" : "'.$group['startColumnName'].'", "numberOfColumns" : '.$group['numberOfColumns'].', "titleText" : "'.$group['titleText'].'" },'; |
|
| 1263 | 1263 | |
| 1264 | 1264 | } |
| 1265 | 1265 | $json .= '$("#'.$div_id.'").jqGrid("setGroupHeaders", { |
| 1266 | 1266 | "useColSpanStyle" : false, |
| 1267 | 1267 | "groupHeaders" : [ |
| 1268 | - ' . $groups . ' |
|
| 1268 | + ' . $groups.' |
|
| 1269 | 1269 | ] |
| 1270 | 1270 | });'; |
| 1271 | 1271 | } |
| 1272 | 1272 | |
| 1273 | 1273 | $all_text = addslashes(get_lang('All')); |
| 1274 | 1274 | $json .= '$("'.$obj->pager.' option[value='.$all_value.']").text("'.$all_text.'");'; |
| 1275 | - $json.= "\n"; |
|
| 1275 | + $json .= "\n"; |
|
| 1276 | 1276 | // Adding edit/delete icons. |
| 1277 | - $json.= $formatter; |
|
| 1277 | + $json .= $formatter; |
|
| 1278 | 1278 | |
| 1279 | 1279 | return $json; |
| 1280 | 1280 | } |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | if (!empty($rows)) { |
| 1308 | - foreach($rows as $content) { |
|
| 1308 | + foreach ($rows as $content) { |
|
| 1309 | 1309 | $table->setCellContents($row, $column, $content); |
| 1310 | 1310 | $row++; |
| 1311 | 1311 | } |
@@ -1467,7 +1467,7 @@ discard block |
||
| 1467 | 1467 | |
| 1468 | 1468 | // Show all tool icons where there is something new. |
| 1469 | 1469 | $return = ' '; |
| 1470 | - foreach($notifications as $notification) { |
|
| 1470 | + foreach ($notifications as $notification) { |
|
| 1471 | 1471 | $lastDate = date('d/m/Y H:i', convert_sql_date($notification['lastedit_date'])); |
| 1472 | 1472 | $type = $notification['lastedit_type']; |
| 1473 | 1473 | $label = get_lang('TitleNotification').": ".get_lang($type)." ($lastDate)"; |
@@ -1510,9 +1510,9 @@ discard block |
||
| 1510 | 1510 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
| 1511 | 1511 | $active = false; |
| 1512 | 1512 | // Request for the name of the general coach |
| 1513 | - $sql ='SELECT tu.lastname, tu.firstname, ts.* |
|
| 1513 | + $sql = 'SELECT tu.lastname, tu.firstname, ts.* |
|
| 1514 | 1514 | FROM '.$tbl_session.' ts |
| 1515 | - LEFT JOIN '.$main_user_table .' tu |
|
| 1515 | + LEFT JOIN '.$main_user_table.' tu |
|
| 1516 | 1516 | ON ts.id_coach = tu.user_id |
| 1517 | 1517 | WHERE ts.id = '.intval($session_id); |
| 1518 | 1518 | $rs = Database::query($sql); |
@@ -1522,7 +1522,7 @@ discard block |
||
| 1522 | 1522 | $session = array(); |
| 1523 | 1523 | $session['title'] = $session_info['name']; |
| 1524 | 1524 | $session['coach'] = ''; |
| 1525 | - $session['dates'] = ''; |
|
| 1525 | + $session['dates'] = ''; |
|
| 1526 | 1526 | |
| 1527 | 1527 | if ( |
| 1528 | 1528 | ( |
@@ -1604,8 +1604,8 @@ discard block |
||
| 1604 | 1604 | ); |
| 1605 | 1605 | } |
| 1606 | 1606 | |
| 1607 | - if ( api_get_setting('show_session_coach') === 'true' ) { |
|
| 1608 | - $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name( |
|
| 1607 | + if (api_get_setting('show_session_coach') === 'true') { |
|
| 1608 | + $session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name( |
|
| 1609 | 1609 | $session_info['firstname'], |
| 1610 | 1610 | $session_info['lastname'] |
| 1611 | 1611 | ); |
@@ -1657,9 +1657,9 @@ discard block |
||
| 1657 | 1657 | $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
| 1658 | 1658 | |
| 1659 | 1659 | if (!empty($percentage)) { |
| 1660 | - $percentage = $percentage*125/100; |
|
| 1660 | + $percentage = $percentage * 125 / 100; |
|
| 1661 | 1661 | } |
| 1662 | - $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
| 1662 | + $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
| 1663 | 1663 | |
| 1664 | 1664 | $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
| 1665 | 1665 | |
@@ -1674,19 +1674,19 @@ discard block |
||
| 1674 | 1674 | |
| 1675 | 1675 | $labels = array(); |
| 1676 | 1676 | |
| 1677 | - $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
| 1678 | - $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
| 1677 | + $labels[] = $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
| 1678 | + $labels[] = $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
| 1679 | 1679 | if (!empty($number_of_users_who_voted)) { |
| 1680 | - $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
|
| 1680 | + $labels[] = get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
|
| 1681 | 1681 | } |
| 1682 | 1682 | |
| 1683 | - $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
| 1683 | + $labels[] = $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote').' [?] '; |
|
| 1684 | 1684 | |
| 1685 | 1685 | if (!$add_div_wrapper && api_is_anonymous()) { |
| 1686 | - $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
| 1686 | + $labels[] = Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
| 1687 | 1687 | } |
| 1688 | 1688 | |
| 1689 | - $html .= Display::div(implode(' | ', $labels) , array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
|
| 1689 | + $html .= Display::div(implode(' | ', $labels), array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
|
| 1690 | 1690 | $html .= ' '.Display::span(' ', array('id' => 'vote_label2_'.$id)); |
| 1691 | 1691 | |
| 1692 | 1692 | if ($add_div_wrapper) { |
@@ -1764,8 +1764,8 @@ discard block |
||
| 1764 | 1764 | if (!empty($list)) { |
| 1765 | 1765 | $html = '<dl class="dl-horizontal">'; |
| 1766 | 1766 | foreach ($list as $item) { |
| 1767 | - $html .= '<dt>' . $item['title'] . '</dt>'; |
|
| 1768 | - $html .= '<dd>' . $item['content'] . '</dd>'; |
|
| 1767 | + $html .= '<dt>'.$item['title'].'</dt>'; |
|
| 1768 | + $html .= '<dd>'.$item['content'].'</dd>'; |
|
| 1769 | 1769 | } |
| 1770 | 1770 | $html .= '</dl>'; |
| 1771 | 1771 | } |
@@ -1807,7 +1807,7 @@ discard block |
||
| 1807 | 1807 | * @param string $type |
| 1808 | 1808 | * @return null|string |
| 1809 | 1809 | */ |
| 1810 | - public static function badge($count, $type ="warning") |
|
| 1810 | + public static function badge($count, $type = "warning") |
|
| 1811 | 1811 | { |
| 1812 | 1812 | $class = ''; |
| 1813 | 1813 | |
@@ -1883,7 +1883,7 @@ discard block |
||
| 1883 | 1883 | if (!empty($content)) { |
| 1884 | 1884 | $html = '<span class="label '.$class.'">'; |
| 1885 | 1885 | $html .= $content; |
| 1886 | - $html .='</span>'; |
|
| 1886 | + $html .= '</span>'; |
|
| 1887 | 1887 | } |
| 1888 | 1888 | |
| 1889 | 1889 | return $html; |
@@ -1904,7 +1904,7 @@ discard block |
||
| 1904 | 1904 | $class = 'class ="active"'; |
| 1905 | 1905 | } |
| 1906 | 1906 | |
| 1907 | - if (basename($_SERVER['REQUEST_URI']) == basename($value['url']) ) { |
|
| 1907 | + if (basename($_SERVER['REQUEST_URI']) == basename($value['url'])) { |
|
| 1908 | 1908 | $class = 'class ="active"'; |
| 1909 | 1909 | } |
| 1910 | 1910 | $html .= "<li $class >"; |
@@ -2120,7 +2120,7 @@ discard block |
||
| 2120 | 2120 | */ |
| 2121 | 2121 | public static function getVCardUserLink($userId) |
| 2122 | 2122 | { |
| 2123 | - $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId);; |
|
| 2123 | + $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId); ; |
|
| 2124 | 2124 | |
| 2125 | 2125 | return $vCardUrl; |
| 2126 | 2126 | } |
@@ -2138,7 +2138,7 @@ discard block |
||
| 2138 | 2138 | { |
| 2139 | 2139 | $title = !empty($title) ? '<div class="panel-heading"><h3 class="panel-title">'.$title.'</h3>'.$extra.'</div>' : ''; |
| 2140 | 2140 | $footer = !empty($footer) ? '<div class="panel-footer ">'.$footer.'</div>' : ''; |
| 2141 | - $styles = ['primary','success','info','warning','danger']; |
|
| 2141 | + $styles = ['primary', 'success', 'info', 'warning', 'danger']; |
|
| 2142 | 2142 | $style = !in_array($style, $styles) ? 'default' : $style; |
| 2143 | 2143 | |
| 2144 | 2144 | return ' |
@@ -2183,7 +2183,7 @@ discard block |
||
| 2183 | 2183 | $attributes['class'] = isset($attributes['class']) ? "$buttonClass {$attributes['class']}" : $buttonClass; |
| 2184 | 2184 | |
| 2185 | 2185 | if (!$includeText) { |
| 2186 | - $text = '<span class="sr-only">' . $text . '</span>'; |
|
| 2186 | + $text = '<span class="sr-only">'.$text.'</span>'; |
|
| 2187 | 2187 | } |
| 2188 | 2188 | |
| 2189 | 2189 | return self::url("$icon $text", $url, $attributes); |
@@ -2198,16 +2198,16 @@ discard block |
||
| 2198 | 2198 | */ |
| 2199 | 2199 | public static function toolbarAction($id, $content = array(), $col = 2, $right = true) |
| 2200 | 2200 | { |
| 2201 | - $columns = 12/$col; |
|
| 2201 | + $columns = 12 / $col; |
|
| 2202 | 2202 | $html = ''; |
| 2203 | - $html .= '<div id="' . $id . '" class="actions">'; |
|
| 2203 | + $html .= '<div id="'.$id.'" class="actions">'; |
|
| 2204 | 2204 | $html .= '<div class="row">'; |
| 2205 | 2205 | if ($col > 4) { |
| 2206 | 2206 | $html = '<div class="alert alert-warning" role="alert">Action toolbar design does not work when exceeding four columns - check Display::toolbarAction()</div>'; |
| 2207 | 2207 | } else { |
| 2208 | - for ( $i = 0; $i < $col; $i++ ) { |
|
| 2209 | - $html .= '<div class="col-md-' . $columns . '">'; |
|
| 2210 | - if ( $col == 2 && $i == 1 ) { |
|
| 2208 | + for ($i = 0; $i < $col; $i++) { |
|
| 2209 | + $html .= '<div class="col-md-'.$columns.'">'; |
|
| 2210 | + if ($col == 2 && $i == 1) { |
|
| 2211 | 2211 | if ($right === true) { |
| 2212 | 2212 | $html .= '<div class="pull-right">'; |
| 2213 | 2213 | $html .= (isset($content[$i]) ? $content[$i] : ''); |
@@ -2322,9 +2322,9 @@ discard block |
||
| 2322 | 2322 | $params['class'] = 'panel panel-default'; |
| 2323 | 2323 | $html = null; |
| 2324 | 2324 | if (!empty($title)) { |
| 2325 | - $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL; |
|
| 2325 | + $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL; |
|
| 2326 | 2326 | } |
| 2327 | - $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL; |
|
| 2327 | + $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL; |
|
| 2328 | 2328 | $html = Display::div($html, $params); |
| 2329 | 2329 | } |
| 2330 | 2330 | return $html; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
| 242 | - * @param doc_id id of document (id in mainDb.document table) |
|
| 242 | + * @param doc_id string of document (id in mainDb.document table) |
|
| 243 | 243 | * @author Sebastien Piraux <[email protected]> |
| 244 | 244 | * @desc Record information for upload event |
| 245 | 245 | * used in the works tool to record informations when |
@@ -311,6 +311,8 @@ discard block |
||
| 311 | 311 | * @param int session_id |
| 312 | 312 | * @param int learnpath_id (id of the learnpath) |
| 313 | 313 | * @param int learnpath_item_id (id of the learnpath_item) |
| 314 | + * @param integer $weighting |
|
| 315 | + * @param integer $session_id |
|
| 314 | 316 | * |
| 315 | 317 | * @author Sebastien Piraux <[email protected]> |
| 316 | 318 | * @author Julio Montoya Armas <[email protected]> Reworked 2010 |
@@ -412,7 +414,9 @@ discard block |
||
| 412 | 414 | * @param integer Session ID (from the session table). Default value of null means "get from context". |
| 413 | 415 | * @param integer Learnpath ID (from c_lp table). Default value of null means "get from context". |
| 414 | 416 | * @param integer Learnpath item ID (from the c_lp_item table). Default value of null means "get from context". |
| 415 | - * @return boolean Result of the insert query |
|
| 417 | + * @param integer $exe_id |
|
| 418 | + * @param integer $position |
|
| 419 | + * @return false|string Result of the insert query |
|
| 416 | 420 | */ |
| 417 | 421 | public static function saveQuestionAttempt( |
| 418 | 422 | $score, |
@@ -582,6 +586,7 @@ discard block |
||
| 582 | 586 | * @param int Whether this answer is correct (1) or not (0) |
| 583 | 587 | * @param string Coordinates of this point (e.g. 123;324) |
| 584 | 588 | * @param bool update results? |
| 589 | + * @param integer $exe_id |
|
| 585 | 590 | * @return boolean Result of the insert query |
| 586 | 591 | * @uses Course code and user_id from global scope $_cid and $_user |
| 587 | 592 | */ |
@@ -714,7 +719,6 @@ discard block |
||
| 714 | 719 | /** |
| 715 | 720 | * Get every email stored in the database |
| 716 | 721 | * |
| 717 | - * @param int $etId |
|
| 718 | 722 | * @return type |
| 719 | 723 | * @assert () !== false |
| 720 | 724 | */ |
@@ -782,11 +786,11 @@ discard block |
||
| 782 | 786 | /** |
| 783 | 787 | * Save the new message for one event and for one language |
| 784 | 788 | * |
| 785 | - * @param string $eventName |
|
| 789 | + * @param string $event_name |
|
| 786 | 790 | * @param array $users |
| 787 | 791 | * @param string $message |
| 788 | 792 | * @param string $subject |
| 789 | - * @param string $eventMessageLanguage |
|
| 793 | + * @param string $event_message_language |
|
| 790 | 794 | * @param int $activated |
| 791 | 795 | */ |
| 792 | 796 | public static function save_event_type_message($event_name, $users, $message, $subject, $event_message_language, $activated) |
@@ -920,10 +924,10 @@ discard block |
||
| 920 | 924 | } |
| 921 | 925 | |
| 922 | 926 | /** |
| 923 | - * @param $user_id |
|
| 927 | + * @param integer $user_id |
|
| 924 | 928 | * @param $exerciseId |
| 925 | - * @param $lp_id |
|
| 926 | - * @param $lp_item_id |
|
| 929 | + * @param integer $lp_id |
|
| 930 | + * @param integer $lp_item_id |
|
| 927 | 931 | * @return int |
| 928 | 932 | */ |
| 929 | 933 | public static function get_attempt_count_not_finished($user_id, $exerciseId, $lp_id, $lp_item_id) |
@@ -1100,6 +1104,7 @@ discard block |
||
| 1100 | 1104 | * @param int exercise id |
| 1101 | 1105 | * @param int $courseId |
| 1102 | 1106 | * @param int session id |
| 1107 | + * @param integer $user_id |
|
| 1103 | 1108 | * @return array with the results |
| 1104 | 1109 | * |
| 1105 | 1110 | */ |
@@ -1195,6 +1200,7 @@ discard block |
||
| 1195 | 1200 | * @param int exercise id |
| 1196 | 1201 | * @param int $courseId |
| 1197 | 1202 | * @param int session id |
| 1203 | + * @param integer $user_id |
|
| 1198 | 1204 | * @return array with the results |
| 1199 | 1205 | * |
| 1200 | 1206 | */ |
@@ -1235,6 +1241,7 @@ discard block |
||
| 1235 | 1241 | * @param int exercise id |
| 1236 | 1242 | * @param string course code |
| 1237 | 1243 | * @param int session id |
| 1244 | + * @param integer $exe_id |
|
| 1238 | 1245 | * @return array with the results |
| 1239 | 1246 | * |
| 1240 | 1247 | */ |
@@ -1284,6 +1291,7 @@ discard block |
||
| 1284 | 1291 | * @param int lp id |
| 1285 | 1292 | * @param int lp item id |
| 1286 | 1293 | * @param string order asc or desc |
| 1294 | + * @param integer $courseId |
|
| 1287 | 1295 | * @return array with the results |
| 1288 | 1296 | * |
| 1289 | 1297 | */ |
@@ -1343,7 +1351,7 @@ discard block |
||
| 1343 | 1351 | * @param int exercise id |
| 1344 | 1352 | * @param int $courseId |
| 1345 | 1353 | * @param int session id |
| 1346 | - * @return array with the results |
|
| 1354 | + * @return string with the results |
|
| 1347 | 1355 | * |
| 1348 | 1356 | */ |
| 1349 | 1357 | public static function count_exercise_attempts_by_user($user_id, $exercise_id, $courseId, $session_id = 0) |
@@ -1519,7 +1527,7 @@ discard block |
||
| 1519 | 1527 | * @param int exercise id |
| 1520 | 1528 | * @param int course id |
| 1521 | 1529 | * @param int session id |
| 1522 | - * @return array with the results |
|
| 1530 | + * @return integer with the results |
|
| 1523 | 1531 | * |
| 1524 | 1532 | */ |
| 1525 | 1533 | public static function get_count_exercises_attempted_by_course($courseId, $session_id = 0) |
@@ -78,9 +78,7 @@ discard block |
||
| 78 | 78 | Database::query($sql); |
| 79 | 79 | |
| 80 | 80 | // Auto subscribe |
| 81 | - $user_status = $userInfo['status'] == SESSIONADMIN ? 'sessionadmin' : |
|
| 82 | - $userInfo['status'] == COURSEMANAGER ? 'teacher' : |
|
| 83 | - $userInfo['status'] == DRH ? 'DRH' : 'student'; |
|
| 81 | + $user_status = $userInfo['status'] == SESSIONADMIN ? 'sessionadmin' : $userInfo['status'] == COURSEMANAGER ? 'teacher' : $userInfo['status'] == DRH ? 'DRH' : 'student'; |
|
| 84 | 82 | $autoSubscribe = api_get_setting($user_status.'_autosubscribe'); |
| 85 | 83 | if ($autoSubscribe) { |
| 86 | 84 | $autoSubscribe = explode('|', $autoSubscribe); |
@@ -334,7 +332,7 @@ discard block |
||
| 334 | 332 | global $debug; |
| 335 | 333 | |
| 336 | 334 | if ($debug) error_log('Called to update_event_exercice'); |
| 337 | - if ($debug) error_log('duration:' . $duration); |
|
| 335 | + if ($debug) error_log('duration:'.$duration); |
|
| 338 | 336 | |
| 339 | 337 | if ($exeid != '') { |
| 340 | 338 | /* |
@@ -382,7 +380,7 @@ discard block |
||
| 382 | 380 | status = '".$status."', |
| 383 | 381 | questions_to_check = '".$remind_list."', |
| 384 | 382 | data_tracking = '".implode(',', $question_list)."', |
| 385 | - user_ip = '" . Database::escape_string(api_get_real_ip()) . "' |
|
| 383 | + user_ip = '" . Database::escape_string(api_get_real_ip())."' |
|
| 386 | 384 | WHERE exe_id = '".Database::escape_string($exeid)."'"; |
| 387 | 385 | $res = Database::query($sql); |
| 388 | 386 | |
@@ -1036,15 +1034,15 @@ discard block |
||
| 1036 | 1034 | |
| 1037 | 1035 | if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) { |
| 1038 | 1036 | $sql = "DELETE FROM $track_e_exercises |
| 1039 | - WHERE exe_id IN (" . implode(',', $exe_list) . ")"; |
|
| 1037 | + WHERE exe_id IN (".implode(',', $exe_list).")"; |
|
| 1040 | 1038 | Database::query($sql); |
| 1041 | 1039 | |
| 1042 | 1040 | $sql = "DELETE FROM $track_attempts |
| 1043 | - WHERE exe_id IN (" . implode(',', $exe_list) . ")"; |
|
| 1041 | + WHERE exe_id IN (".implode(',', $exe_list).")"; |
|
| 1044 | 1042 | Database::query($sql); |
| 1045 | 1043 | |
| 1046 | 1044 | $sql = "DELETE FROM $recording_table |
| 1047 | - WHERE exe_id IN (" . implode(',', $exe_list) . ")"; |
|
| 1045 | + WHERE exe_id IN (".implode(',', $exe_list).")"; |
|
| 1048 | 1046 | Database::query($sql); |
| 1049 | 1047 | } |
| 1050 | 1048 | |
@@ -1086,7 +1084,7 @@ discard block |
||
| 1086 | 1084 | Event::addEvent( |
| 1087 | 1085 | LOG_EXERCISE_RESULT_DELETE, |
| 1088 | 1086 | LOG_EXERCISE_AND_USER_ID, |
| 1089 | - $exercise_id . '-' . $user_id, |
|
| 1087 | + $exercise_id.'-'.$user_id, |
|
| 1090 | 1088 | null, |
| 1091 | 1089 | null, |
| 1092 | 1090 | $course_id, |
@@ -1458,7 +1456,7 @@ discard block |
||
| 1458 | 1456 | $res = Database::query($sql); |
| 1459 | 1457 | $list = array(); |
| 1460 | 1458 | while ($row = Database::fetch_array($res, 'ASSOC')) { |
| 1461 | - $list[$row['exe_id']] = $row; /* |
|
| 1459 | + $list[$row['exe_id']] = $row; /* |
|
| 1462 | 1460 | $sql = "SELECT * FROM $table_track_attempt WHERE exe_id = {$row['exe_id']}"; |
| 1463 | 1461 | $res_question = Database::query($sql); |
| 1464 | 1462 | while($row_q = Database::fetch_array($res_question,'ASSOC')) { |
@@ -1684,7 +1682,7 @@ discard block |
||
| 1684 | 1682 | Event::addEvent( |
| 1685 | 1683 | LOG_QUESTION_RESULT_DELETE, |
| 1686 | 1684 | LOG_EXERCISE_ATTEMPT_QUESTION_ID, |
| 1687 | - $exe_id . '-' . $question_id, |
|
| 1685 | + $exe_id.'-'.$question_id, |
|
| 1688 | 1686 | null, |
| 1689 | 1687 | null, |
| 1690 | 1688 | $courseId, |
@@ -1720,7 +1718,7 @@ discard block |
||
| 1720 | 1718 | Event::addEvent( |
| 1721 | 1719 | LOG_QUESTION_RESULT_DELETE, |
| 1722 | 1720 | LOG_EXERCISE_ATTEMPT_QUESTION_ID, |
| 1723 | - $exe_id . '-' . $question_id, |
|
| 1721 | + $exe_id.'-'.$question_id, |
|
| 1724 | 1722 | null, |
| 1725 | 1723 | null, |
| 1726 | 1724 | $courseId, |
@@ -333,8 +333,12 @@ discard block |
||
| 333 | 333 | ) { |
| 334 | 334 | global $debug; |
| 335 | 335 | |
| 336 | - if ($debug) error_log('Called to update_event_exercice'); |
|
| 337 | - if ($debug) error_log('duration:' . $duration); |
|
| 336 | + if ($debug) { |
|
| 337 | + error_log('Called to update_event_exercice'); |
|
| 338 | + } |
|
| 339 | + if ($debug) { |
|
| 340 | + error_log('duration:' . $duration); |
|
| 341 | + } |
|
| 338 | 342 | |
| 339 | 343 | if ($exeid != '') { |
| 340 | 344 | /* |
@@ -386,8 +390,12 @@ discard block |
||
| 386 | 390 | WHERE exe_id = '".Database::escape_string($exeid)."'"; |
| 387 | 391 | $res = Database::query($sql); |
| 388 | 392 | |
| 389 | - if ($debug) error_log('update_event_exercice called'); |
|
| 390 | - if ($debug) error_log("$sql"); |
|
| 393 | + if ($debug) { |
|
| 394 | + error_log('update_event_exercice called'); |
|
| 395 | + } |
|
| 396 | + if ($debug) { |
|
| 397 | + error_log("$sql"); |
|
| 398 | + } |
|
| 391 | 399 | |
| 392 | 400 | //Deleting control time session track |
| 393 | 401 | //ExerciseLib::exercise_time_control_delete($exo_id); |
@@ -1255,6 +1255,7 @@ discard block |
||
| 1255 | 1255 | |
| 1256 | 1256 | /** |
| 1257 | 1257 | * Validates the time control key |
| 1258 | + * @param integer $exercise_id |
|
| 1258 | 1259 | */ |
| 1259 | 1260 | public static function exercise_time_control_is_valid( |
| 1260 | 1261 | $exercise_id, |
@@ -1388,7 +1389,7 @@ discard block |
||
| 1388 | 1389 | * @param int $in_direction |
| 1389 | 1390 | * @param string $in_hotpot_path |
| 1390 | 1391 | * @param bool $in_get_count |
| 1391 | - * @param null $where_condition |
|
| 1392 | + * @param string $where_condition |
|
| 1392 | 1393 | * @return array|int |
| 1393 | 1394 | */ |
| 1394 | 1395 | public static function get_exam_results_hotpotatoes_data( |
@@ -2179,7 +2180,7 @@ discard block |
||
| 2179 | 2180 | /** |
| 2180 | 2181 | * Return true if pass_pourcentage activated (we use the pass pourcentage feature |
| 2181 | 2182 | * return false if pass_percentage = 0 (we don't use the pass pourcentage feature |
| 2182 | - * @param $in_pass_pourcentage |
|
| 2183 | + * @param string $in_pass_pourcentage |
|
| 2183 | 2184 | * @return boolean |
| 2184 | 2185 | * In this version, pass_percentage and show_success_message are disabled if |
| 2185 | 2186 | * pass_percentage is set to 0 |
@@ -2192,7 +2193,7 @@ discard block |
||
| 2192 | 2193 | /** |
| 2193 | 2194 | * Converts a numeric value in a percentage example 0.66666 to 66.67 % |
| 2194 | 2195 | * @param $value |
| 2195 | - * @return float Converted number |
|
| 2196 | + * @return string Converted number |
|
| 2196 | 2197 | */ |
| 2197 | 2198 | public static function convert_to_percentage($value) |
| 2198 | 2199 | { |
@@ -2208,7 +2209,7 @@ discard block |
||
| 2208 | 2209 | * @param float $score |
| 2209 | 2210 | * @param float $weight |
| 2210 | 2211 | * @deprecated seem not to be used |
| 2211 | - * @return float the score rounded converted to the new range |
|
| 2212 | + * @return string|null the score rounded converted to the new range |
|
| 2212 | 2213 | */ |
| 2213 | 2214 | public static function convert_score($score, $weight) |
| 2214 | 2215 | { |
@@ -2759,6 +2760,7 @@ discard block |
||
| 2759 | 2760 | * @param int exercise id |
| 2760 | 2761 | * @param int $courseId |
| 2761 | 2762 | * @param int session id |
| 2763 | + * @param integer $user_count |
|
| 2762 | 2764 | * @return float Best average score |
| 2763 | 2765 | */ |
| 2764 | 2766 | public static function get_best_average_score_by_exercise( |
@@ -3198,8 +3200,9 @@ discard block |
||
| 3198 | 3200 | } |
| 3199 | 3201 | |
| 3200 | 3202 | /** |
| 3201 | - * @param array $answer |
|
| 3203 | + * @param string|null $answer |
|
| 3202 | 3204 | * @param string $user_answer |
| 3205 | + * @param string|null $current_answer |
|
| 3203 | 3206 | * @return array |
| 3204 | 3207 | */ |
| 3205 | 3208 | public static function check_fill_in_blanks($answer, $user_answer, $current_answer) |
@@ -3805,7 +3808,7 @@ discard block |
||
| 3805 | 3808 | |
| 3806 | 3809 | /** |
| 3807 | 3810 | * @param int $countLetter |
| 3808 | - * @return mixed |
|
| 3811 | + * @return string |
|
| 3809 | 3812 | */ |
| 3810 | 3813 | public static function detectInputAppropriateClass($countLetter) |
| 3811 | 3814 | { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | if ($show_title) { |
| 66 | 66 | TestCategory::displayCategoryAndTitle($objQuestionTmp->id); |
| 67 | 67 | echo Display::div( |
| 68 | - $current_item . '. ' . $objQuestionTmp->selectTitle(), |
|
| 68 | + $current_item.'. '.$objQuestionTmp->selectTitle(), |
|
| 69 | 69 | array('class' => 'question_title') |
| 70 | 70 | ); |
| 71 | 71 | } |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | $config = array( |
| 162 | 162 | 'ToolbarSet' => 'TestFreeAnswer' |
| 163 | 163 | ); |
| 164 | - $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config); |
|
| 165 | - $form->setDefaults(array("choice[" . $questionId . "]" => $fck_content)); |
|
| 164 | + $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config); |
|
| 165 | + $form->setDefaults(array("choice[".$questionId."]" => $fck_content)); |
|
| 166 | 166 | $s .= $form->returnForm(); |
| 167 | 167 | } elseif ($answerType == ORAL_EXPRESSION) { |
| 168 | 168 | // Add nanog |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $config = array( |
| 192 | 192 | 'ToolbarSet' => 'TestFreeAnswer' |
| 193 | 193 | ); |
| 194 | - $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config); |
|
| 194 | + $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config); |
|
| 195 | 195 | //$form->setDefaults(array("choice[" . $questionId . "]" => $fck_content)); |
| 196 | 196 | $s .= $form->returnForm(); |
| 197 | 197 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | // Unique answer |
| 274 | 274 | if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) { |
| 275 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
| 275 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
| 276 | 276 | if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) { |
| 277 | 277 | $attributes = array( |
| 278 | 278 | 'id' => $input_id, |
@@ -297,14 +297,14 @@ discard block |
||
| 297 | 297 | if ($answerType == UNIQUE_ANSWER_IMAGE) { |
| 298 | 298 | if ($show_comment) { |
| 299 | 299 | if (empty($comment)) { |
| 300 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
| 300 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
| 301 | 301 | . 'class="exercise-unique-answer-image" style="text-align: center">'; |
| 302 | 302 | } else { |
| 303 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
| 303 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
| 304 | 304 | . 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">'; |
| 305 | 305 | } |
| 306 | 306 | } else { |
| 307 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
| 307 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
| 308 | 308 | . 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">'; |
| 309 | 309 | } |
| 310 | 310 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $answer = Security::remove_XSS($answer, STUDENT); |
| 313 | 313 | $s .= Display::input( |
| 314 | 314 | 'hidden', |
| 315 | - 'choice2[' . $questionId . ']', |
|
| 315 | + 'choice2['.$questionId.']', |
|
| 316 | 316 | '0' |
| 317 | 317 | ); |
| 318 | 318 | |
@@ -320,13 +320,13 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | if ($answerType == UNIQUE_ANSWER_IMAGE) { |
| 322 | 322 | $attributes['style'] = 'display: none;'; |
| 323 | - $answer = '<div class="thumbnail">' . $answer . '</div>'; |
|
| 323 | + $answer = '<div class="thumbnail">'.$answer.'</div>'; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | $answer_input .= '<label class="radio">'; |
| 327 | 327 | $answer_input .= Display::input( |
| 328 | 328 | 'radio', |
| 329 | - 'choice[' . $questionId . ']', |
|
| 329 | + 'choice['.$questionId.']', |
|
| 330 | 330 | $numAnswer, |
| 331 | 331 | $attributes |
| 332 | 332 | ); |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $answerType == MULTIPLE_ANSWER_TRUE_FALSE || |
| 354 | 354 | $answerType == GLOBAL_MULTIPLE_ANSWER |
| 355 | 355 | ) { |
| 356 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
| 356 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
| 357 | 357 | $answer = Security::remove_XSS($answer, STUDENT); |
| 358 | 358 | |
| 359 | 359 | if (in_array($numAnswer, $user_choice_array)) { |
@@ -374,12 +374,12 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) { |
| 377 | - $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
| 377 | + $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
| 378 | 378 | |
| 379 | 379 | $answer_input = '<label class="checkbox">'; |
| 380 | 380 | $answer_input .= Display::input( |
| 381 | 381 | 'checkbox', |
| 382 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 382 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
| 383 | 383 | $numAnswer, |
| 384 | 384 | $attributes |
| 385 | 385 | ); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | 'td', |
| 433 | 433 | Display::input( |
| 434 | 434 | 'radio', |
| 435 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 435 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
| 436 | 436 | $id, |
| 437 | 437 | $attributes |
| 438 | 438 | ), |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | } |
| 451 | 451 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { |
| 452 | 452 | // multiple answers |
| 453 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
| 453 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
| 454 | 454 | |
| 455 | 455 | if (in_array($numAnswer, $user_choice_array)) { |
| 456 | 456 | $attributes = array( |
@@ -470,11 +470,11 @@ discard block |
||
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | $answer = Security::remove_XSS($answer, STUDENT); |
| 473 | - $answer_input = '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
| 473 | + $answer_input = '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
| 474 | 474 | $answer_input .= '<label class="checkbox">'; |
| 475 | 475 | $answer_input .= Display::input( |
| 476 | 476 | 'checkbox', |
| 477 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 477 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
| 478 | 478 | 1, |
| 479 | 479 | $attributes |
| 480 | 480 | ); |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
| 498 | - $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
| 498 | + $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
| 499 | 499 | |
| 500 | 500 | $my_choice = array(); |
| 501 | 501 | if (!empty($user_choice_array)) { |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | 'td', |
| 531 | 531 | Display::input( |
| 532 | 532 | 'radio', |
| 533 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 533 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
| 534 | 534 | $key, |
| 535 | 535 | $attributes |
| 536 | 536 | ) |
@@ -626,8 +626,8 @@ discard block |
||
| 626 | 626 | $trackAttempts = Database::get_main_table( |
| 627 | 627 | TABLE_STATISTIC_TRACK_E_ATTEMPT |
| 628 | 628 | ); |
| 629 | - $sql = 'SELECT answer FROM ' . $trackAttempts . ' |
|
| 630 | - WHERE exe_id=' . $exe_id . ' AND question_id=' . $questionId; |
|
| 629 | + $sql = 'SELECT answer FROM '.$trackAttempts.' |
|
| 630 | + WHERE exe_id=' . $exe_id.' AND question_id='.$questionId; |
|
| 631 | 631 | $rsLastAttempt = Database::query($sql); |
| 632 | 632 | $rowLastAttempt = Database::fetch_array($rsLastAttempt); |
| 633 | 633 | $answer = $rowLastAttempt['answer']; |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | '', |
| 683 | 683 | $answerCorrected |
| 684 | 684 | ); |
| 685 | - $answerCorrected = '[' . $answerCorrected . ']'; |
|
| 685 | + $answerCorrected = '['.$answerCorrected.']'; |
|
| 686 | 686 | $studentAnswerList[] = $answerCorrected; |
| 687 | 687 | } |
| 688 | 688 | } |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | */ |
| 702 | 702 | $tabComments = api_preg_split( |
| 703 | 703 | '/\[[^]]+\]/', |
| 704 | - ' ' . $answer . ' ' |
|
| 704 | + ' '.$answer.' ' |
|
| 705 | 705 | ); |
| 706 | 706 | if (!empty($correctAnswerList) && !empty($studentAnswerList)) { |
| 707 | 707 | $answer = ""; |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | $size |
| 719 | 719 | ); |
| 720 | 720 | |
| 721 | - $answer .= $tabComments[$i] . |
|
| 721 | + $answer .= $tabComments[$i]. |
|
| 722 | 722 | Display::input( |
| 723 | 723 | 'text', |
| 724 | 724 | "choice[$questionId][]", |
@@ -764,12 +764,12 @@ discard block |
||
| 764 | 764 | $s .= '<tr><td width="45%" valign="top">'; |
| 765 | 765 | $parsed_answer = $answer; |
| 766 | 766 | //left part questions |
| 767 | - $s .= '<p class="indent">' . $lines_count . '. ' . $parsed_answer . '</p></td>'; |
|
| 767 | + $s .= '<p class="indent">'.$lines_count.'. '.$parsed_answer.'</p></td>'; |
|
| 768 | 768 | //middle part (matches selects) |
| 769 | 769 | |
| 770 | 770 | $s .= '<td width="10%" valign="top" align="center" > |
| 771 | 771 | <div class="select-matching"> |
| 772 | - <select name="choice[' . $questionId . '][' . $numAnswer . ']">'; |
|
| 772 | + <select name="choice[' . $questionId.']['.$numAnswer.']">'; |
|
| 773 | 773 | |
| 774 | 774 | // fills the list-box |
| 775 | 775 | foreach ($select_items as $key => $val) { |
@@ -785,14 +785,14 @@ discard block |
||
| 785 | 785 | if (isset($user_choice_array_position[$numAnswer]) && $val['id'] == $user_choice_array_position[$numAnswer]) { |
| 786 | 786 | $selected = 'selected="selected"'; |
| 787 | 787 | } |
| 788 | - $s .= '<option value="' . $val['id'] . '" ' . $selected . '>' . $val['letter'] . '</option>'; |
|
| 788 | + $s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>'; |
|
| 789 | 789 | |
| 790 | 790 | } // end foreach() |
| 791 | 791 | |
| 792 | 792 | $s .= '</select></div></td><td width="5%" class="separate"> </td>'; |
| 793 | 793 | $s .= '<td width="40%" valign="top" >'; |
| 794 | 794 | if (isset($select_items[$lines_count])) { |
| 795 | - $s .= '<div class="text-right"><p class="indent">' . $select_items[$lines_count]['letter'].'. '. $select_items[$lines_count]['answer'].'</p></div>'; |
|
| 795 | + $s .= '<div class="text-right"><p class="indent">'.$select_items[$lines_count]['letter'].'. '.$select_items[$lines_count]['answer'].'</p></div>'; |
|
| 796 | 796 | } else { |
| 797 | 797 | $s .= ' '; |
| 798 | 798 | } |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | $s .= '<tr> |
| 808 | 808 | <td colspan="2"></td> |
| 809 | 809 | <td valign="top">'; |
| 810 | - $s .= '<b>' . $select_items[$lines_count]['letter'] . '.</b> ' . $select_items[$lines_count]['answer']; |
|
| 810 | + $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer']; |
|
| 811 | 811 | $s .= "</td> |
| 812 | 812 | </tr>"; |
| 813 | 813 | $lines_count++; |
@@ -823,9 +823,9 @@ discard block |
||
| 823 | 823 | $data = $objAnswerTmp->getAnswerByAutoId($data['correct']); |
| 824 | 824 | $lines_count = $data['answer'];*/ |
| 825 | 825 | |
| 826 | - $windowId = $questionId . '_' . $lines_count; |
|
| 826 | + $windowId = $questionId.'_'.$lines_count; |
|
| 827 | 827 | |
| 828 | - $s .= '<li class="touch-items" id="' . $windowId . '">'; |
|
| 828 | + $s .= '<li class="touch-items" id="'.$windowId.'">'; |
|
| 829 | 829 | $s .= Display::div( |
| 830 | 830 | $parsed_answer, |
| 831 | 831 | [ |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | Display::tag( |
| 884 | 884 | 'b', |
| 885 | 885 | $select_items[$lines_count]['letter'] |
| 886 | - ) . $select_items[$lines_count]['answer'], |
|
| 886 | + ).$select_items[$lines_count]['answer'], |
|
| 887 | 887 | [ |
| 888 | 888 | 'id' => "window_{$windowId}_answer", |
| 889 | 889 | 'style' => 'display: none;' |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | |
| 1028 | 1028 | if ($show_comment) { |
| 1029 | 1029 | $s .= '</table>'; |
| 1030 | - } elseif( |
|
| 1030 | + } elseif ( |
|
| 1031 | 1031 | in_array( |
| 1032 | 1032 | $answerType, |
| 1033 | 1033 | [ |
@@ -1052,7 +1052,7 @@ discard block |
||
| 1052 | 1052 | |
| 1053 | 1053 | for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { |
| 1054 | 1054 | $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
| 1055 | - $windowId = $questionId . '_' . $counterAnswer; |
|
| 1055 | + $windowId = $questionId.'_'.$counterAnswer; |
|
| 1056 | 1056 | |
| 1057 | 1057 | if ($answerCorrect) { |
| 1058 | 1058 | $s .= Display::div( |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | $course = api_get_course_info(); |
| 1098 | 1098 | $doc_id = DocumentManager::get_document_id( |
| 1099 | 1099 | $course, |
| 1100 | - '/images/' . $pictureName |
|
| 1100 | + '/images/'.$pictureName |
|
| 1101 | 1101 | ); |
| 1102 | 1102 | if (is_numeric($doc_id)) { |
| 1103 | 1103 | $images_folder_visibility = api_get_item_visibility( |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | echo " |
| 1123 | 1123 | <script> |
| 1124 | 1124 | $(document).on('ready', function () { |
| 1125 | - new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion" ) . "({ |
|
| 1125 | + new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion")."({ |
|
| 1126 | 1126 | questionId: $questionId, |
| 1127 | 1127 | exerciseId: $exerciseId, |
| 1128 | 1128 | selector: '#hotspot-preview-$questionId', |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | if ($answerType != HOT_SPOT_DELINEATION) { |
| 1157 | 1157 | $answerList = ' |
| 1158 | 1158 | <div class="well well-sm"> |
| 1159 | - <h5 class="page-header">' . get_lang('HotspotZones') . '</h5> |
|
| 1159 | + <h5 class="page-header">' . get_lang('HotspotZones').'</h5> |
|
| 1160 | 1160 | <ol> |
| 1161 | 1161 | '; |
| 1162 | 1162 | |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | if (!$only_questions) { |
| 1182 | 1182 | if ($show_title) { |
| 1183 | 1183 | TestCategory::displayCategoryAndTitle($objQuestionTmp->id); |
| 1184 | - echo '<div class="question_title">' . $current_item . '. ' . $questionName . '</div>'; |
|
| 1184 | + echo '<div class="question_title">'.$current_item.'. '.$questionName.'</div>'; |
|
| 1185 | 1185 | } |
| 1186 | 1186 | //@todo I need to the get the feedback type |
| 1187 | 1187 | echo <<<HOTSPOT |
@@ -1199,7 +1199,7 @@ discard block |
||
| 1199 | 1199 | <div class=\"hotspot-image\"></div> |
| 1200 | 1200 | <script> |
| 1201 | 1201 | $(document).on('ready', function () { |
| 1202 | - new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion') . "({ |
|
| 1202 | + new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion')."({ |
|
| 1203 | 1203 | questionId: $questionId, |
| 1204 | 1204 | exerciseId: $exe_id, |
| 1205 | 1205 | selector: '#question_div_' + $questionId + ' .hotspot-image', |
@@ -1318,11 +1318,11 @@ discard block |
||
| 1318 | 1318 | $lp_id = intval($lp_id); |
| 1319 | 1319 | $lp_item_id = intval($lp_item_id); |
| 1320 | 1320 | return |
| 1321 | - api_get_course_int_id() . '_' . |
|
| 1322 | - api_get_session_id() . '_' . |
|
| 1323 | - $exercise_id . '_' . |
|
| 1324 | - api_get_user_id() . '_' . |
|
| 1325 | - $lp_id . '_' . |
|
| 1321 | + api_get_course_int_id().'_'. |
|
| 1322 | + api_get_session_id().'_'. |
|
| 1323 | + $exercise_id.'_'. |
|
| 1324 | + api_get_user_id().'_'. |
|
| 1325 | + $lp_id.'_'. |
|
| 1326 | 1326 | $lp_item_id; |
| 1327 | 1327 | } |
| 1328 | 1328 | |
@@ -1434,14 +1434,14 @@ discard block |
||
| 1434 | 1434 | $res = Database::query($sql); |
| 1435 | 1435 | $result = array(); |
| 1436 | 1436 | $apiIsAllowedToEdit = api_is_allowed_to_edit(); |
| 1437 | - $urlBase = api_get_path(WEB_CODE_PATH) . |
|
| 1438 | - 'exercice/hotpotatoes_exercise_report.php?action=delete&' . |
|
| 1439 | - api_get_cidreq() . '&id='; |
|
| 1437 | + $urlBase = api_get_path(WEB_CODE_PATH). |
|
| 1438 | + 'exercice/hotpotatoes_exercise_report.php?action=delete&'. |
|
| 1439 | + api_get_cidreq().'&id='; |
|
| 1440 | 1440 | while ($data = Database::fetch_array($res)) { |
| 1441 | 1441 | $actions = null; |
| 1442 | 1442 | |
| 1443 | 1443 | if ($apiIsAllowedToEdit) { |
| 1444 | - $url = $urlBase . $data['id'] . '&path=' . $data['exe_name']; |
|
| 1444 | + $url = $urlBase.$data['id'].'&path='.$data['exe_name']; |
|
| 1445 | 1445 | $actions = Display::url( |
| 1446 | 1446 | Display::return_icon('delete.png', get_lang('Delete')), |
| 1447 | 1447 | $url |
@@ -1457,7 +1457,7 @@ discard block |
||
| 1457 | 1457 | GroupManager::get_user_group_name($data['user_id']) |
| 1458 | 1458 | ), |
| 1459 | 1459 | 'exe_date' => $data['exe_date'], |
| 1460 | - 'score' => $data['exe_result'] . ' / ' . $data['exe_weighting'], |
|
| 1460 | + 'score' => $data['exe_result'].' / '.$data['exe_weighting'], |
|
| 1461 | 1461 | 'actions' => $actions, |
| 1462 | 1462 | ); |
| 1463 | 1463 | } |
@@ -1540,18 +1540,18 @@ discard block |
||
| 1540 | 1540 | $TBL_TRACK_HOTPOTATOES = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
| 1541 | 1541 | $TBL_TRACK_ATTEMPT_RECORDING = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); |
| 1542 | 1542 | |
| 1543 | - $session_id_and = ' AND te.session_id = ' . $sessionId . ' '; |
|
| 1543 | + $session_id_and = ' AND te.session_id = '.$sessionId.' '; |
|
| 1544 | 1544 | $exercise_id = intval($exercise_id); |
| 1545 | 1545 | |
| 1546 | 1546 | $exercise_where = ''; |
| 1547 | 1547 | if (!empty($exercise_id)) { |
| 1548 | - $exercise_where .= ' AND te.exe_exo_id = ' . $exercise_id . ' '; |
|
| 1548 | + $exercise_where .= ' AND te.exe_exo_id = '.$exercise_id.' '; |
|
| 1549 | 1549 | } |
| 1550 | 1550 | |
| 1551 | 1551 | $hotpotatoe_where = ''; |
| 1552 | 1552 | if (!empty($_GET['path'])) { |
| 1553 | 1553 | $hotpotatoe_path = Database::escape_string($_GET['path']); |
| 1554 | - $hotpotatoe_where .= ' AND exe_name = "' . $hotpotatoe_path . '" '; |
|
| 1554 | + $hotpotatoe_where .= ' AND exe_name = "'.$hotpotatoe_path.'" '; |
|
| 1555 | 1555 | } |
| 1556 | 1556 | |
| 1557 | 1557 | // sql for chamilo-type tests for teacher / tutor view |
@@ -1563,7 +1563,7 @@ discard block |
||
| 1563 | 1563 | WHERE |
| 1564 | 1564 | c_id = $course_id AND |
| 1565 | 1565 | exe_exo_id = $exercise_id AND |
| 1566 | - ttte.session_id = " . $sessionId . " |
|
| 1566 | + ttte.session_id = ".$sessionId." |
|
| 1567 | 1567 | )"; |
| 1568 | 1568 | |
| 1569 | 1569 | if ($is_allowedToEdit) { |
@@ -1586,9 +1586,9 @@ discard block |
||
| 1586 | 1586 | g.id as group_id |
| 1587 | 1587 | FROM $TBL_USER u |
| 1588 | 1588 | INNER JOIN $TBL_GROUP_REL_USER gru |
| 1589 | - ON (gru.user_id = u.user_id AND gru.c_id=" . $course_id . ") |
|
| 1589 | + ON (gru.user_id = u.user_id AND gru.c_id=".$course_id.") |
|
| 1590 | 1590 | INNER JOIN $TBL_GROUP g |
| 1591 | - ON (gru.group_id = g.id AND g.c_id=" . $course_id . ") |
|
| 1591 | + ON (gru.group_id = g.id AND g.c_id=".$course_id.") |
|
| 1592 | 1592 | )"; |
| 1593 | 1593 | } |
| 1594 | 1594 | |
@@ -1650,9 +1650,9 @@ discard block |
||
| 1650 | 1650 | g.id as group_id |
| 1651 | 1651 | FROM $TBL_USER u |
| 1652 | 1652 | LEFT OUTER JOIN $TBL_GROUP_REL_USER gru |
| 1653 | - ON ( gru.user_id = u.user_id AND gru.c_id=" . $course_id . " ) |
|
| 1653 | + ON ( gru.user_id = u.user_id AND gru.c_id=".$course_id." ) |
|
| 1654 | 1654 | LEFT OUTER JOIN $TBL_GROUP g |
| 1655 | - ON (gru.group_id = g.id AND g.c_id = " . $course_id . ") |
|
| 1655 | + ON (gru.group_id = g.id AND g.c_id = ".$course_id.") |
|
| 1656 | 1656 | )"; |
| 1657 | 1657 | } |
| 1658 | 1658 | |
@@ -1665,12 +1665,12 @@ discard block |
||
| 1665 | 1665 | ( |
| 1666 | 1666 | SELECT u.user_id, firstname, lastname, email, username, ' ' as group_name, '' as group_id, official_code |
| 1667 | 1667 | FROM $TBL_USER u |
| 1668 | - WHERE u.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ") |
|
| 1668 | + WHERE u.status NOT IN(".api_get_users_status_ignored_in_reports('string').") |
|
| 1669 | 1669 | )"; |
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | 1672 | $sqlFromOption = " , $TBL_GROUP_REL_USER AS gru "; |
| 1673 | - $sqlWhereOption = " AND gru.c_id = " . $course_id ." AND gru.user_id = user.user_id "; |
|
| 1673 | + $sqlWhereOption = " AND gru.c_id = ".$course_id." AND gru.user_id = user.user_id "; |
|
| 1674 | 1674 | $first_and_last_name = api_is_western_name_order() ? "firstname, lastname" : "lastname, firstname"; |
| 1675 | 1675 | |
| 1676 | 1676 | if ($get_count) { |
@@ -1707,8 +1707,8 @@ discard block |
||
| 1707 | 1707 | ON (user.user_id = exe_user_id) |
| 1708 | 1708 | WHERE |
| 1709 | 1709 | te.status != 'incomplete' AND |
| 1710 | - te.c_id = " . $course_id . " $session_id_and AND |
|
| 1711 | - ce.active <>-1 AND ce.c_id = " . $course_id . " |
|
| 1710 | + te.c_id = ".$course_id." $session_id_and AND |
|
| 1711 | + ce.active <>-1 AND ce.c_id = ".$course_id." |
|
| 1712 | 1712 | $exercise_where |
| 1713 | 1713 | $extra_where_conditions |
| 1714 | 1714 | "; |
@@ -1735,12 +1735,12 @@ discard block |
||
| 1735 | 1735 | $sqlFromOption |
| 1736 | 1736 | WHERE |
| 1737 | 1737 | user.user_id=tth.exe_user_id |
| 1738 | - AND tth.c_id = " . $course_id . " |
|
| 1738 | + AND tth.c_id = ".$course_id." |
|
| 1739 | 1739 | $hotpotatoe_where |
| 1740 | 1740 | $sqlWhereOption |
| 1741 | - AND user.status NOT IN(" . api_get_users_status_ignored_in_reports( |
|
| 1741 | + AND user.status NOT IN(".api_get_users_status_ignored_in_reports( |
|
| 1742 | 1742 | 'string' |
| 1743 | - ) . ") |
|
| 1743 | + ).") |
|
| 1744 | 1744 | ORDER BY |
| 1745 | 1745 | tth.c_id ASC, |
| 1746 | 1746 | tth.exe_date DESC"; |
@@ -1813,12 +1813,12 @@ discard block |
||
| 1813 | 1813 | |
| 1814 | 1814 | if ($from_gradebook && ($is_allowedToEdit)) { |
| 1815 | 1815 | if (in_array( |
| 1816 | - $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'], |
|
| 1816 | + $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'], |
|
| 1817 | 1817 | $users_array_id |
| 1818 | 1818 | )) { |
| 1819 | 1819 | continue; |
| 1820 | 1820 | } |
| 1821 | - $users_array_id[] = $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname']; |
|
| 1821 | + $users_array_id[] = $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname']; |
|
| 1822 | 1822 | } |
| 1823 | 1823 | |
| 1824 | 1824 | $lp_obj = isset($results[$i]['orig_lp_id']) && isset($lp_list[$results[$i]['orig_lp_id']]) ? $lp_list[$results[$i]['orig_lp_id']] : null; |
@@ -1827,8 +1827,8 @@ discard block |
||
| 1827 | 1827 | if ($lp_obj) { |
| 1828 | 1828 | $url = api_get_path( |
| 1829 | 1829 | WEB_CODE_PATH |
| 1830 | - ) . 'newscorm/lp_controller.php?' . api_get_cidreq( |
|
| 1831 | - ) . '&action=view&lp_id=' . $results[$i]['orig_lp_id']; |
|
| 1830 | + ).'newscorm/lp_controller.php?'.api_get_cidreq( |
|
| 1831 | + ).'&action=view&lp_id='.$results[$i]['orig_lp_id']; |
|
| 1832 | 1832 | $lp_name = Display::url( |
| 1833 | 1833 | $lp_obj['lp_name'], |
| 1834 | 1834 | $url, |
@@ -1846,7 +1846,7 @@ discard block |
||
| 1846 | 1846 | ); |
| 1847 | 1847 | |
| 1848 | 1848 | foreach ($group_list as $id) { |
| 1849 | - $group_name_list .= $clean_group_list[$id] . '<br/>'; |
|
| 1849 | + $group_name_list .= $clean_group_list[$id].'<br/>'; |
|
| 1850 | 1850 | } |
| 1851 | 1851 | $results[$i]['group_name'] = $group_name_list; |
| 1852 | 1852 | } |
@@ -1902,8 +1902,8 @@ discard block |
||
| 1902 | 1902 | } |
| 1903 | 1903 | } |
| 1904 | 1904 | if ($revised) { |
| 1905 | - $actions .= "<a href='exercise_show.php?" . api_get_cidreq( |
|
| 1906 | - ) . "&action=edit&id=$id'>" . |
|
| 1905 | + $actions .= "<a href='exercise_show.php?".api_get_cidreq( |
|
| 1906 | + )."&action=edit&id=$id'>". |
|
| 1907 | 1907 | Display:: return_icon( |
| 1908 | 1908 | 'edit.png', |
| 1909 | 1909 | get_lang('Edit'), |
@@ -1912,8 +1912,8 @@ discard block |
||
| 1912 | 1912 | ); |
| 1913 | 1913 | $actions .= ' '; |
| 1914 | 1914 | } else { |
| 1915 | - $actions .= "<a href='exercise_show.php?" . api_get_cidreq( |
|
| 1916 | - ) . "&action=qualify&id=$id'>" . |
|
| 1915 | + $actions .= "<a href='exercise_show.php?".api_get_cidreq( |
|
| 1916 | + )."&action=qualify&id=$id'>". |
|
| 1917 | 1917 | Display:: return_icon( |
| 1918 | 1918 | 'quiz.gif', |
| 1919 | 1919 | get_lang('Qualify') |
@@ -1923,12 +1923,12 @@ discard block |
||
| 1923 | 1923 | $actions .= "</a>"; |
| 1924 | 1924 | |
| 1925 | 1925 | if ($filter == 2) { |
| 1926 | - $actions .= ' <a href="exercise_history.php?' . api_get_cidreq( |
|
| 1927 | - ) . '&exe_id=' . $id . '">' . |
|
| 1926 | + $actions .= ' <a href="exercise_history.php?'.api_get_cidreq( |
|
| 1927 | + ).'&exe_id='.$id.'">'. |
|
| 1928 | 1928 | Display:: return_icon( |
| 1929 | 1929 | 'history.gif', |
| 1930 | 1930 | get_lang('ViewHistoryChange') |
| 1931 | - ) . '</a>'; |
|
| 1931 | + ).'</a>'; |
|
| 1932 | 1932 | } |
| 1933 | 1933 | |
| 1934 | 1934 | //Admin can always delete the attempt |
@@ -1940,32 +1940,32 @@ discard block |
||
| 1940 | 1940 | date('Y-m-d h:i:s'), |
| 1941 | 1941 | false |
| 1942 | 1942 | ); |
| 1943 | - $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank"> |
|
| 1943 | + $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip='.$ip.'" target="_blank"> |
|
| 1944 | 1944 | '.Display::return_icon('info.png', $ip).' |
| 1945 | 1945 | </a>'; |
| 1946 | 1946 | |
| 1947 | - $delete_link = '<a href="exercise_report.php?' . api_get_cidreq() . '&filter_by_user=' . intval($_GET['filter_by_user']) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '" |
|
| 1947 | + $delete_link = '<a href="exercise_report.php?'.api_get_cidreq().'&filter_by_user='.intval($_GET['filter_by_user']).'&filter='.$filter.'&exerciseId='.$exercise_id.'&delete=delete&did='.$id.'" |
|
| 1948 | 1948 | onclick="javascript:if(!confirm(\'' . sprintf( |
| 1949 | 1949 | get_lang('DeleteAttempt'), |
| 1950 | 1950 | $results[$i]['username'], |
| 1951 | 1951 | $dt |
| 1952 | - ) . '\')) return false;">' . Display:: return_icon( |
|
| 1952 | + ).'\')) return false;">'.Display:: return_icon( |
|
| 1953 | 1953 | 'delete.png', |
| 1954 | 1954 | get_lang('Delete') |
| 1955 | - ) . '</a>'; |
|
| 1955 | + ).'</a>'; |
|
| 1956 | 1956 | $delete_link = utf8_encode($delete_link); |
| 1957 | 1957 | |
| 1958 | 1958 | if (api_is_drh() && !api_is_platform_admin()) { |
| 1959 | 1959 | $delete_link = null; |
| 1960 | 1960 | } |
| 1961 | - $actions .= $delete_link . ' '; |
|
| 1961 | + $actions .= $delete_link.' '; |
|
| 1962 | 1962 | } |
| 1963 | 1963 | |
| 1964 | 1964 | } else { |
| 1965 | 1965 | $attempt_url = api_get_path( |
| 1966 | 1966 | WEB_CODE_PATH |
| 1967 | - ) . 'exercice/result.php?' . api_get_cidreq( |
|
| 1968 | - ) . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId; |
|
| 1967 | + ).'exercice/result.php?'.api_get_cidreq( |
|
| 1968 | + ).'&id='.$results[$i]['exe_id'].'&id_session='.$sessionId; |
|
| 1969 | 1969 | $attempt_link = Display::url( |
| 1970 | 1970 | get_lang('Show'), |
| 1971 | 1971 | $attempt_url, |
@@ -2022,7 +2022,7 @@ discard block |
||
| 2022 | 2022 | $hp_result = round( |
| 2023 | 2023 | ($hpresults[$i][4] / ($hpresults[$i][5] != 0 ? $hpresults[$i][5] : 1)) * 100, |
| 2024 | 2024 | 2 |
| 2025 | - ) . '% (' . $hpresults[$i][4] . ' / ' . $hpresults[$i][5] . ')'; |
|
| 2025 | + ).'% ('.$hpresults[$i][4].' / '.$hpresults[$i][5].')'; |
|
| 2026 | 2026 | if ($is_allowedToEdit) { |
| 2027 | 2027 | $list_info[] = array( |
| 2028 | 2028 | $hpresults[$i][0], |
@@ -2095,13 +2095,13 @@ discard block |
||
| 2095 | 2095 | |
| 2096 | 2096 | $html = null; |
| 2097 | 2097 | if ($show_percentage) { |
| 2098 | - $parent = '(' . $score . ' / ' . $weight . ')'; |
|
| 2099 | - $html = $percentage . "% $parent"; |
|
| 2098 | + $parent = '('.$score.' / '.$weight.')'; |
|
| 2099 | + $html = $percentage."% $parent"; |
|
| 2100 | 2100 | if ($show_only_percentage) { |
| 2101 | - $html = $percentage . "% "; |
|
| 2101 | + $html = $percentage."% "; |
|
| 2102 | 2102 | } |
| 2103 | 2103 | } else { |
| 2104 | - $html = $score . ' / ' . $weight; |
|
| 2104 | + $html = $score.' / '.$weight; |
|
| 2105 | 2105 | } |
| 2106 | 2106 | $html = Display::span($html, array('class' => 'score_exercise')); |
| 2107 | 2107 | |
@@ -2195,7 +2195,7 @@ discard block |
||
| 2195 | 2195 | { |
| 2196 | 2196 | $return = '-'; |
| 2197 | 2197 | if ($value != '') { |
| 2198 | - $return = float_format($value * 100, 1) . ' %'; |
|
| 2198 | + $return = float_format($value * 100, 1).' %'; |
|
| 2199 | 2199 | } |
| 2200 | 2200 | return $return; |
| 2201 | 2201 | } |
@@ -2273,7 +2273,7 @@ discard block |
||
| 2273 | 2273 | } |
| 2274 | 2274 | |
| 2275 | 2275 | $needle_where = !empty($search) ? " AND title LIKE '?' " : ''; |
| 2276 | - $needle = !empty($search) ? "%" . $search . "%" : ''; |
|
| 2276 | + $needle = !empty($search) ? "%".$search."%" : ''; |
|
| 2277 | 2277 | |
| 2278 | 2278 | // Show courses by active status |
| 2279 | 2279 | $active_sql = ''; |
@@ -2288,7 +2288,7 @@ discard block |
||
| 2288 | 2288 | if ($search_all_sessions == true) { |
| 2289 | 2289 | $conditions = array( |
| 2290 | 2290 | 'where' => array( |
| 2291 | - $active_sql . ' c_id = ? ' . $needle_where . $time_conditions => array( |
|
| 2291 | + $active_sql.' c_id = ? '.$needle_where.$time_conditions => array( |
|
| 2292 | 2292 | $course_id, |
| 2293 | 2293 | $needle |
| 2294 | 2294 | ) |
@@ -2299,7 +2299,7 @@ discard block |
||
| 2299 | 2299 | if ($session_id == 0) { |
| 2300 | 2300 | $conditions = array( |
| 2301 | 2301 | 'where' => array( |
| 2302 | - $active_sql . ' session_id = ? AND c_id = ? ' . $needle_where . $time_conditions => array( |
|
| 2302 | + $active_sql.' session_id = ? AND c_id = ? '.$needle_where.$time_conditions => array( |
|
| 2303 | 2303 | $session_id, |
| 2304 | 2304 | $course_id, |
| 2305 | 2305 | $needle |
@@ -2310,7 +2310,7 @@ discard block |
||
| 2310 | 2310 | } else { |
| 2311 | 2311 | $conditions = array( |
| 2312 | 2312 | 'where' => array( |
| 2313 | - $active_sql . ' (session_id = 0 OR session_id = ? ) AND c_id = ? ' . $needle_where . $time_conditions => array( |
|
| 2313 | + $active_sql.' (session_id = 0 OR session_id = ? ) AND c_id = ? '.$needle_where.$time_conditions => array( |
|
| 2314 | 2314 | $session_id, |
| 2315 | 2315 | $course_id, |
| 2316 | 2316 | $needle |
@@ -2489,7 +2489,7 @@ discard block |
||
| 2489 | 2489 | |
| 2490 | 2490 | if ($return_string) { |
| 2491 | 2491 | if (!empty($position) && !empty($my_ranking)) { |
| 2492 | - $return_value = $position . '/' . count($my_ranking); |
|
| 2492 | + $return_value = $position.'/'.count($my_ranking); |
|
| 2493 | 2493 | } else { |
| 2494 | 2494 | $return_value = '-'; |
| 2495 | 2495 | } |
@@ -2569,7 +2569,7 @@ discard block |
||
| 2569 | 2569 | |
| 2570 | 2570 | if ($return_string) { |
| 2571 | 2571 | if (!empty($position) && !empty($my_ranking)) { |
| 2572 | - return $position . '/' . count($my_ranking); |
|
| 2572 | + return $position.'/'.count($my_ranking); |
|
| 2573 | 2573 | } |
| 2574 | 2574 | } |
| 2575 | 2575 | return $return_value; |
@@ -2969,7 +2969,7 @@ discard block |
||
| 2969 | 2969 | $courseCondition = " |
| 2970 | 2970 | INNER JOIN $courseUser cu |
| 2971 | 2971 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
| 2972 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
| 2972 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
| 2973 | 2973 | } else { |
| 2974 | 2974 | $courseCondition = " |
| 2975 | 2975 | INNER JOIN $courseUserSession cu |
@@ -3044,7 +3044,7 @@ discard block |
||
| 3044 | 3044 | $courseCondition = " |
| 3045 | 3045 | INNER JOIN $courseUser cu |
| 3046 | 3046 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
| 3047 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
| 3047 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
| 3048 | 3048 | } else { |
| 3049 | 3049 | $courseCondition = " |
| 3050 | 3050 | INNER JOIN $courseUserSession cu |
@@ -3136,7 +3136,7 @@ discard block |
||
| 3136 | 3136 | $courseCondition = " |
| 3137 | 3137 | INNER JOIN $courseUser cu |
| 3138 | 3138 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
| 3139 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
| 3139 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
| 3140 | 3140 | } else { |
| 3141 | 3141 | $courseCondition = " |
| 3142 | 3142 | INNER JOIN $courseUserSession cu |
@@ -3318,7 +3318,7 @@ discard block |
||
| 3318 | 3318 | } |
| 3319 | 3319 | } |
| 3320 | 3320 | // adds the correct word, followed by ] to close the blank |
| 3321 | - $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]'; |
|
| 3321 | + $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]'; |
|
| 3322 | 3322 | if (isset ($real_text[$i + 1])) { |
| 3323 | 3323 | $answer .= $real_text[$i + 1]; |
| 3324 | 3324 | } |
@@ -3377,13 +3377,13 @@ discard block |
||
| 3377 | 3377 | // check the default value of option |
| 3378 | 3378 | $tabSelected = array($in_default => " selected='selected' "); |
| 3379 | 3379 | $res = ""; |
| 3380 | - $res .= "<select name='$in_name' id='$in_name' onchange='" . $in_onchange . "' >"; |
|
| 3381 | - $res .= "<option value='-1'" . $tabSelected["-1"] . ">-- " . get_lang( |
|
| 3380 | + $res .= "<select name='$in_name' id='$in_name' onchange='".$in_onchange."' >"; |
|
| 3381 | + $res .= "<option value='-1'".$tabSelected["-1"].">-- ".get_lang( |
|
| 3382 | 3382 | 'AllGroups' |
| 3383 | - ) . " --</option>"; |
|
| 3384 | - $res .= "<option value='0'" . $tabSelected["0"] . ">- " . get_lang( |
|
| 3383 | + )." --</option>"; |
|
| 3384 | + $res .= "<option value='0'".$tabSelected["0"].">- ".get_lang( |
|
| 3385 | 3385 | 'NotInAGroup' |
| 3386 | - ) . " -</option>"; |
|
| 3386 | + )." -</option>"; |
|
| 3387 | 3387 | $tabGroups = GroupManager::get_group_list(); |
| 3388 | 3388 | $currentCatId = 0; |
| 3389 | 3389 | for ($i = 0; $i < count($tabGroups); $i++) { |
@@ -3391,10 +3391,10 @@ discard block |
||
| 3391 | 3391 | $tabGroups[$i]["id"] |
| 3392 | 3392 | ); |
| 3393 | 3393 | if ($tabCategory["id"] != $currentCatId) { |
| 3394 | - $res .= "<option value='-1' disabled='disabled'>" . $tabCategory["title"] . "</option>"; |
|
| 3394 | + $res .= "<option value='-1' disabled='disabled'>".$tabCategory["title"]."</option>"; |
|
| 3395 | 3395 | $currentCatId = $tabCategory["id"]; |
| 3396 | 3396 | } |
| 3397 | - $res .= "<option " . $tabSelected[$tabGroups[$i]["id"]] . "style='margin-left:40px' value='" . $tabGroups[$i]["id"] . "'>" . $tabGroups[$i]["name"] . "</option>"; |
|
| 3397 | + $res .= "<option ".$tabSelected[$tabGroups[$i]["id"]]."style='margin-left:40px' value='".$tabGroups[$i]["id"]."'>".$tabGroups[$i]["name"]."</option>"; |
|
| 3398 | 3398 | } |
| 3399 | 3399 | $res .= "</select>"; |
| 3400 | 3400 | return $res; |
@@ -3599,14 +3599,14 @@ discard block |
||
| 3599 | 3599 | if ($show_results) { |
| 3600 | 3600 | $comnt = Event::get_comments($exe_id, $questionId); |
| 3601 | 3601 | if (!empty($comnt)) { |
| 3602 | - echo '<b>' . get_lang('Feedback') . '</b>'; |
|
| 3603 | - echo '<div id="question_feedback">' . $comnt . '</div>'; |
|
| 3602 | + echo '<b>'.get_lang('Feedback').'</b>'; |
|
| 3603 | + echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
| 3604 | 3604 | } |
| 3605 | 3605 | } |
| 3606 | 3606 | |
| 3607 | 3607 | if ($show_results) { |
| 3608 | 3608 | $score = array( |
| 3609 | - 'result' => get_lang('Score') . " : " . self::show_score( |
|
| 3609 | + 'result' => get_lang('Score')." : ".self::show_score( |
|
| 3610 | 3610 | $my_total_score, |
| 3611 | 3611 | $my_total_weight, |
| 3612 | 3612 | false, |
@@ -3680,13 +3680,13 @@ discard block |
||
| 3680 | 3680 | } |
| 3681 | 3681 | |
| 3682 | 3682 | if ($show_all_but_expected_answer) { |
| 3683 | - $exercise_content .= "<div class='normal-message'>" . get_lang( |
|
| 3683 | + $exercise_content .= "<div class='normal-message'>".get_lang( |
|
| 3684 | 3684 | "ExerciseWithFeedbackWithoutCorrectionComment" |
| 3685 | - ) . "</div>"; |
|
| 3685 | + )."</div>"; |
|
| 3686 | 3686 | } |
| 3687 | 3687 | // Remove audio auto play from questions on results page - refs BT#7939 |
| 3688 | 3688 | $exercise_content = preg_replace( |
| 3689 | - ['/autoplay[\=\".+\"]+/','/autostart[\=\".+\"]+/'], |
|
| 3689 | + ['/autoplay[\=\".+\"]+/', '/autostart[\=\".+\"]+/'], |
|
| 3690 | 3690 | '', |
| 3691 | 3691 | $exercise_content |
| 3692 | 3692 | ); |
@@ -3780,11 +3780,11 @@ discard block |
||
| 3780 | 3780 | $ribbon_total_success_or_error = ' ribbon-total-error'; |
| 3781 | 3781 | } |
| 3782 | 3782 | } |
| 3783 | - $ribbon .= '<div class="total ' . $ribbon_total_success_or_error . '">'; |
|
| 3783 | + $ribbon .= '<div class="total '.$ribbon_total_success_or_error.'">'; |
|
| 3784 | 3784 | } else { |
| 3785 | 3785 | $ribbon .= '<div class="total">'; |
| 3786 | 3786 | } |
| 3787 | - $ribbon .= '<h3>' . get_lang('YourTotalScore') . ": "; |
|
| 3787 | + $ribbon .= '<h3>'.get_lang('YourTotalScore').": "; |
|
| 3788 | 3788 | $ribbon .= self::show_score($score, $weight, false, true); |
| 3789 | 3789 | $ribbon .= '</h3>'; |
| 3790 | 3790 | $ribbon .= '</div>'; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string Name of common tag to place each line in |
| 158 | 158 | * @param string Name of the root element. A root element should always be given. |
| 159 | 159 | * @param string Encoding in which the data is provided |
| 160 | - * @return void Prompts the user for a file download |
|
| 160 | + * @return boolean Prompts the user for a file download |
|
| 161 | 161 | */ |
| 162 | 162 | public static function export_complex_table_xml( |
| 163 | 163 | $data, |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | * @param string $name |
| 284 | 284 | * @param string $format |
| 285 | 285 | * |
| 286 | - * @return bool |
|
| 286 | + * @return false|null |
|
| 287 | 287 | */ |
| 288 | 288 | public static function htmlToOdt($html, $name, $format = 'odt') |
| 289 | 289 | { |
@@ -3,14 +3,8 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Ddeboer\DataImport\Writer\ExcelWriter; |
| 5 | 5 | use Ddeboer\DataImport\Writer\CsvWriter; |
| 6 | -use Ddeboer\DataImport\Workflow; |
|
| 7 | - |
|
| 8 | -use Ddeboer\DataImport\Reader\CsvReader; |
|
| 9 | -use Ddeboer\DataImport\Reader\ArrayReader; |
|
| 10 | -use Ddeboer\DataImport\Writer\ArrayWriter; |
|
| 11 | 6 | use Chamilo\CoreBundle\Component\Editor\Connector; |
| 12 | 7 | use Chamilo\CoreBundle\Component\Filesystem\Data; |
| 13 | -use ChamiloSession as Session; |
|
| 14 | 8 | use MediaAlchemyst\Alchemyst; |
| 15 | 9 | use MediaAlchemyst\DriversContainer; |
| 16 | 10 | use Neutron\TemporaryFilesystem\Manager; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | DocumentManager::file_send_for_download($filePath, true, $filename.'.csv'); |
| 58 | 58 | exit; |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * Export tabular data to XLS-file |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | DocumentManager::file_send_for_download($filePath, true, $filename.'.xlsx'); |
| 81 | 81 | exit; |
| 82 | - } |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Export tabular data to XLS-file (as html table) |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | - * Export tabular data to XML-file |
|
| 116 | - * @param array Simple array of data to put in XML |
|
| 117 | - * @param string Name of file to be given to the user |
|
| 118 | - * @param string Name of common tag to place each line in |
|
| 119 | - * @param string Name of the root element. A root element should always be given. |
|
| 120 | - * @param string Encoding in which the data is provided |
|
| 121 | - */ |
|
| 115 | + * Export tabular data to XML-file |
|
| 116 | + * @param array Simple array of data to put in XML |
|
| 117 | + * @param string Name of file to be given to the user |
|
| 118 | + * @param string Name of common tag to place each line in |
|
| 119 | + * @param string Name of the root element. A root element should always be given. |
|
| 120 | + * @param string Encoding in which the data is provided |
|
| 121 | + */ |
|
| 122 | 122 | public static function arrayToXml( |
| 123 | 123 | $data, |
| 124 | 124 | $filename = 'export', |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | fclose($handle); |
| 149 | 149 | DocumentManager :: file_send_for_download($file, true, $filename.'.xml'); |
| 150 | 150 | exit; |
| 151 | - } |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * Export hierarchical tabular data to XML-file |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | foreach ($data as $row) { |
| 198 | 198 | $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>'; |
| 199 | 199 | if (is_array($row['value'])) { |
| 200 | - $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
| 200 | + $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
| 201 | 201 | $string .= str_repeat("\t",$level).'</'.$row['name'].'>'; |
| 202 | 202 | } else { |
| 203 | 203 | $string .= $row['value']; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | foreach ($data as $row) { |
| 101 | 101 | $string = implode("</td><td>", $row); |
| 102 | - $string = '<tr><td>' . $string . '</td></tr>'; |
|
| 102 | + $string = '<tr><td>'.$string.'</td></tr>'; |
|
| 103 | 103 | if ($encoding != 'utf-8') { |
| 104 | 104 | $string = api_convert_encoding($string, $encoding, $systemEncoding); |
| 105 | 105 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | fwrite($handle, '<'.$wrapper_tagname.'>'); |
| 174 | 174 | } |
| 175 | 175 | $s = self::_export_complex_table_xml_helper($data); |
| 176 | - fwrite($handle,$s); |
|
| 176 | + fwrite($handle, $s); |
|
| 177 | 177 | if (!is_null($wrapper_tagname)) { |
| 178 | 178 | fwrite($handle, '</'.$wrapper_tagname.'>'."\n"); |
| 179 | 179 | } |
@@ -195,10 +195,10 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | $string = ''; |
| 197 | 197 | foreach ($data as $row) { |
| 198 | - $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>'; |
|
| 198 | + $string .= "\n".str_repeat("\t", $level).'<'.$row['name'].'>'; |
|
| 199 | 199 | if (is_array($row['value'])) { |
| 200 | - $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
| 201 | - $string .= str_repeat("\t",$level).'</'.$row['name'].'>'; |
|
| 200 | + $string .= self::_export_complex_table_xml_helper($row['value'], $level + 1)."\n"; |
|
| 201 | + $string .= str_repeat("\t", $level).'</'.$row['name'].'>'; |
|
| 202 | 202 | } else { |
| 203 | 203 | $string .= $row['value']; |
| 204 | 204 | $string .= '</'.$row['name'].'>'; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | - * @return array |
|
| 126 | + * @return string[] |
|
| 127 | 127 | */ |
| 128 | 128 | public static function getValidExtraFieldTypes() |
| 129 | 129 | { |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | /** |
| 201 | 201 | * @param array $conditions |
| 202 | - * @param null $order_field_options_by |
|
| 202 | + * @param string $order_field_options_by |
|
| 203 | 203 | * |
| 204 | 204 | * @return array |
| 205 | 205 | */ |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | /** |
| 238 | 238 | * @param string $variable |
| 239 | 239 | * |
| 240 | - * @return array|bool |
|
| 240 | + * @return integer |
|
| 241 | 241 | */ |
| 242 | 242 | public function get_handler_field_info_by_field_variable($variable) |
| 243 | 243 | { |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | /** |
| 320 | 320 | * @param string $handler |
| 321 | 321 | * |
| 322 | - * @return array |
|
| 322 | + * @return string[] |
|
| 323 | 323 | */ |
| 324 | 324 | public static function get_extra_fields_by_handler($handler) |
| 325 | 325 | { |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | /** |
| 499 | - * @return array |
|
| 499 | + * @return string[] |
|
| 500 | 500 | */ |
| 501 | 501 | public function get_field_types() |
| 502 | 502 | { |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | /** |
| 507 | 507 | * @param int $id |
| 508 | 508 | * |
| 509 | - * @return null |
|
| 509 | + * @return string|null |
|
| 510 | 510 | */ |
| 511 | 511 | public function get_field_type_by_id($id) |
| 512 | 512 | { |
@@ -691,7 +691,6 @@ discard block |
||
| 691 | 691 | * @param FormValidator $form |
| 692 | 692 | * @param array $extraData |
| 693 | 693 | * @param bool $admin_permissions |
| 694 | - * @param int $user_id |
|
| 695 | 694 | * @param array $extra |
| 696 | 695 | * @param int $itemId |
| 697 | 696 | * @param array $exclude variables of extra field to exclude |
@@ -1592,7 +1591,7 @@ discard block |
||
| 1592 | 1591 | } |
| 1593 | 1592 | |
| 1594 | 1593 | /** |
| 1595 | - * @return array |
|
| 1594 | + * @return string[] |
|
| 1596 | 1595 | */ |
| 1597 | 1596 | public function getJqgridColumnNames() |
| 1598 | 1597 | { |
@@ -1832,7 +1831,7 @@ discard block |
||
| 1832 | 1831 | } |
| 1833 | 1832 | |
| 1834 | 1833 | /** |
| 1835 | - * @param array $columns |
|
| 1834 | + * @param string[] $columns |
|
| 1836 | 1835 | * @param array $column_model |
| 1837 | 1836 | * @param array $extraFields |
| 1838 | 1837 | * @return array |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | 'changeable', |
| 20 | 20 | 'filter', |
| 21 | 21 | 'extra_field_type', |
| 22 | - /* Enable this when field_loggeable is introduced as a table field (2.0) |
|
| 22 | + /* Enable this when field_loggeable is introduced as a table field (2.0) |
|
| 23 | 23 | 'field_loggeable', |
| 24 | 24 | */ |
| 25 | 25 | 'created_at' |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | * France:Paris;Bretagne;Marseilles;Lyon|Belgique:Bruxelles;Namur;Liège;Bruges|Peru:Lima;Piura; |
| 524 | 524 | * into |
| 525 | 525 | * array( |
| 526 | - * 'France' => |
|
| 526 | + * 'France' => |
|
| 527 | 527 | * array('Paris', 'Bregtane', 'Marseilles'), |
| 528 | 528 | * 'Belgique' => |
| 529 | 529 | * array('Namur', 'Liège') |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | |
| 1185 | 1185 | if ($this->type == 'user') { |
| 1186 | 1186 | |
| 1187 | - /* //the magic should be here |
|
| 1187 | + /* //the magic should be here |
|
| 1188 | 1188 | $user_tags = UserManager::get_user_tags($user_id, $field_details[0]); |
| 1189 | 1189 | |
| 1190 | 1190 | $tag_list = ''; |
@@ -26,19 +26,19 @@ discard block |
||
| 26 | 26 | ); |
| 27 | 27 | |
| 28 | 28 | public $ops = array( |
| 29 | - 'eq' => '=', //equal |
|
| 30 | - 'ne' => '<>', //not equal |
|
| 31 | - 'lt' => '<', //less than |
|
| 32 | - 'le' => '<=', //less than or equal |
|
| 33 | - 'gt' => '>', //greater than |
|
| 34 | - 'ge' => '>=', //greater than or equal |
|
| 35 | - 'bw' => 'LIKE', //begins with |
|
| 29 | + 'eq' => '=', //equal |
|
| 30 | + 'ne' => '<>', //not equal |
|
| 31 | + 'lt' => '<', //less than |
|
| 32 | + 'le' => '<=', //less than or equal |
|
| 33 | + 'gt' => '>', //greater than |
|
| 34 | + 'ge' => '>=', //greater than or equal |
|
| 35 | + 'bw' => 'LIKE', //begins with |
|
| 36 | 36 | 'bn' => 'NOT LIKE', //doesn't begin with |
| 37 | - 'in' => 'LIKE', //is in |
|
| 37 | + 'in' => 'LIKE', //is in |
|
| 38 | 38 | 'ni' => 'NOT LIKE', //is not in |
| 39 | - 'ew' => 'LIKE', //ends with |
|
| 39 | + 'ew' => 'LIKE', //ends with |
|
| 40 | 40 | 'en' => 'NOT LIKE', //doesn't end with |
| 41 | - 'cn' => 'LIKE', //contains |
|
| 41 | + 'cn' => 'LIKE', //contains |
|
| 42 | 42 | 'nc' => 'NOT LIKE' //doesn't contain |
| 43 | 43 | ); |
| 44 | 44 | |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | public static function get_extra_fields_by_handler($handler) |
| 325 | 325 | { |
| 326 | - $types= array(); |
|
| 326 | + $types = array(); |
|
| 327 | 327 | $types[self::FIELD_TYPE_TEXT] = get_lang('FieldTypeText'); |
| 328 | 328 | $types[self::FIELD_TYPE_TEXTAREA] = get_lang('FieldTypeTextarea'); |
| 329 | 329 | $types[self::FIELD_TYPE_RADIO] = get_lang('FieldTypeRadio'); |
@@ -962,7 +962,7 @@ discard block |
||
| 962 | 962 | // chzn-select doesn't work for sessions?? |
| 963 | 963 | $form->addElement( |
| 964 | 964 | 'select', |
| 965 | - 'extra_' . $field_details['variable'], |
|
| 965 | + 'extra_'.$field_details['variable'], |
|
| 966 | 966 | $field_details['display_text'], |
| 967 | 967 | $options, |
| 968 | 968 | array('id' => 'extra_'.$field_details['variable']) |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | |
| 1022 | 1022 | if (!$admin_permissions) { |
| 1023 | 1023 | if ($field_details['visible'] == 0) { |
| 1024 | - $form->freeze('extra_' . $field_details['variable']); |
|
| 1024 | + $form->freeze('extra_'.$field_details['variable']); |
|
| 1025 | 1025 | } |
| 1026 | 1026 | } |
| 1027 | 1027 | break; |
@@ -1369,9 +1369,9 @@ discard block |
||
| 1369 | 1369 | |
| 1370 | 1370 | if (is_array($extraData) && array_key_exists($fieldVariable, $extraData)) { |
| 1371 | 1371 | |
| 1372 | - if (file_exists(api_get_path(SYS_UPLOAD_PATH) . $extraData[$fieldVariable])) { |
|
| 1372 | + if (file_exists(api_get_path(SYS_UPLOAD_PATH).$extraData[$fieldVariable])) { |
|
| 1373 | 1373 | $fieldTexts[] = Display::img( |
| 1374 | - api_get_path(WEB_UPLOAD_PATH) . $extraData[$fieldVariable], |
|
| 1374 | + api_get_path(WEB_UPLOAD_PATH).$extraData[$fieldVariable], |
|
| 1375 | 1375 | $field_details['display_text'], |
| 1376 | 1376 | array('width' => '300') |
| 1377 | 1377 | ); |
@@ -1388,10 +1388,10 @@ discard block |
||
| 1388 | 1388 | $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes'); |
| 1389 | 1389 | $form->applyFilter('extra_'.$field_details['variable'], 'trim'); |
| 1390 | 1390 | |
| 1391 | - $allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif'); |
|
| 1391 | + $allowed_picture_types = array('jpg', 'jpeg', 'png', 'gif'); |
|
| 1392 | 1392 | $form->addRule( |
| 1393 | 1393 | 'extra_'.$field_details['variable'], |
| 1394 | - get_lang('OnlyImagesAllowed') . ' ('.implode(',', $allowed_picture_types).')', |
|
| 1394 | + get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', |
|
| 1395 | 1395 | 'filetype', |
| 1396 | 1396 | $allowed_picture_types |
| 1397 | 1397 | ); |
@@ -1433,10 +1433,10 @@ discard block |
||
| 1433 | 1433 | if (is_array($extraData) && |
| 1434 | 1434 | array_key_exists($fieldVariable, $extraData) |
| 1435 | 1435 | ) { |
| 1436 | - if (file_exists(api_get_path(SYS_UPLOAD_PATH) . $extraData[$fieldVariable])) { |
|
| 1436 | + if (file_exists(api_get_path(SYS_UPLOAD_PATH).$extraData[$fieldVariable])) { |
|
| 1437 | 1437 | $fieldTexts[] = Display::url( |
| 1438 | - api_get_path(WEB_UPLOAD_PATH) . $extraData[$fieldVariable], |
|
| 1439 | - api_get_path(WEB_UPLOAD_PATH) . $extraData[$fieldVariable], |
|
| 1438 | + api_get_path(WEB_UPLOAD_PATH).$extraData[$fieldVariable], |
|
| 1439 | + api_get_path(WEB_UPLOAD_PATH).$extraData[$fieldVariable], |
|
| 1440 | 1440 | array( |
| 1441 | 1441 | 'title' => $field_details['display_text'], |
| 1442 | 1442 | 'target' => '_blank' |
@@ -1486,12 +1486,12 @@ discard block |
||
| 1486 | 1486 | "extra_{$field_details['variable']}", |
| 1487 | 1487 | $field_details['display_text'] |
| 1488 | 1488 | ); |
| 1489 | - $form->applyFilter('extra_' . $field_details['variable'], 'stripslashes'); |
|
| 1489 | + $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes'); |
|
| 1490 | 1490 | |
| 1491 | 1491 | if (!$admin_permissions) { |
| 1492 | 1492 | if ($field_details['visible'] == 0) { |
| 1493 | 1493 | $form->freeze( |
| 1494 | - 'extra_' . $field_details['variable'] |
|
| 1494 | + 'extra_'.$field_details['variable'] |
|
| 1495 | 1495 | ); |
| 1496 | 1496 | } |
| 1497 | 1497 | } |
@@ -1502,13 +1502,13 @@ discard block |
||
| 1502 | 1502 | $field_details['display_text'] |
| 1503 | 1503 | ); |
| 1504 | 1504 | $form->applyFilter( |
| 1505 | - 'extra_' . $field_details['variable'], |
|
| 1505 | + 'extra_'.$field_details['variable'], |
|
| 1506 | 1506 | 'stripslashes' |
| 1507 | 1507 | ); |
| 1508 | 1508 | if (!$admin_permissions) { |
| 1509 | 1509 | if ($field_details['visible'] == 0) { |
| 1510 | 1510 | $form->freeze( |
| 1511 | - 'extra_' . $field_details['variable'] |
|
| 1511 | + 'extra_'.$field_details['variable'] |
|
| 1512 | 1512 | ); |
| 1513 | 1513 | } |
| 1514 | 1514 | } |
@@ -1518,12 +1518,12 @@ discard block |
||
| 1518 | 1518 | "extra_{$field_details['variable']}", |
| 1519 | 1519 | $field_details['display_text'] |
| 1520 | 1520 | ); |
| 1521 | - $form->applyFilter('extra_' . $field_details['variable'], 'stripslashes'); |
|
| 1521 | + $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes'); |
|
| 1522 | 1522 | |
| 1523 | 1523 | if (!$admin_permissions) { |
| 1524 | 1524 | if ($field_details['visible'] == 0) { |
| 1525 | 1525 | $form->freeze( |
| 1526 | - 'extra_' . $field_details['variable'] |
|
| 1526 | + 'extra_'.$field_details['variable'] |
|
| 1527 | 1527 | ); |
| 1528 | 1528 | } |
| 1529 | 1529 | } |
@@ -1534,13 +1534,13 @@ discard block |
||
| 1534 | 1534 | $field_details['display_text'] |
| 1535 | 1535 | ); |
| 1536 | 1536 | $form->applyFilter( |
| 1537 | - 'extra_' . $field_details['variable'], |
|
| 1537 | + 'extra_'.$field_details['variable'], |
|
| 1538 | 1538 | 'stripslashes' |
| 1539 | 1539 | ); |
| 1540 | 1540 | if (!$admin_permissions) { |
| 1541 | 1541 | if ($field_details['visible'] == 0) { |
| 1542 | 1542 | $form->freeze( |
| 1543 | - 'extra_' . $field_details['variable'] |
|
| 1543 | + 'extra_'.$field_details['variable'] |
|
| 1544 | 1544 | ); |
| 1545 | 1545 | } |
| 1546 | 1546 | } |
@@ -2221,19 +2221,19 @@ discard block |
||
| 2221 | 2221 | break; |
| 2222 | 2222 | } |
| 2223 | 2223 | |
| 2224 | - if (!file_exists(api_get_path(SYS_UPLOAD_PATH) . $valueData['value'])) { |
|
| 2224 | + if (!file_exists(api_get_path(SYS_UPLOAD_PATH).$valueData['value'])) { |
|
| 2225 | 2225 | break; |
| 2226 | 2226 | } |
| 2227 | 2227 | |
| 2228 | 2228 | $image = Display::img( |
| 2229 | - api_get_path(WEB_UPLOAD_PATH) . $valueData['value'], |
|
| 2229 | + api_get_path(WEB_UPLOAD_PATH).$valueData['value'], |
|
| 2230 | 2230 | $field['display_text'], |
| 2231 | 2231 | array('width' => '300') |
| 2232 | 2232 | ); |
| 2233 | 2233 | |
| 2234 | 2234 | $displayedValue = Display::url( |
| 2235 | 2235 | $image, |
| 2236 | - api_get_path(WEB_UPLOAD_PATH) . $valueData['value'], |
|
| 2236 | + api_get_path(WEB_UPLOAD_PATH).$valueData['value'], |
|
| 2237 | 2237 | array('target' => '_blank') |
| 2238 | 2238 | ); |
| 2239 | 2239 | break; |
@@ -2242,13 +2242,13 @@ discard block |
||
| 2242 | 2242 | break; |
| 2243 | 2243 | } |
| 2244 | 2244 | |
| 2245 | - if (!file_exists(api_get_path(SYS_UPLOAD_PATH) . $valueData['value'])) { |
|
| 2245 | + if (!file_exists(api_get_path(SYS_UPLOAD_PATH).$valueData['value'])) { |
|
| 2246 | 2246 | break; |
| 2247 | 2247 | } |
| 2248 | 2248 | |
| 2249 | 2249 | $displayedValue = Display::url( |
| 2250 | 2250 | get_lang('Download'), |
| 2251 | - api_get_path(WEB_UPLOAD_PATH) . $valueData['value'], |
|
| 2251 | + api_get_path(WEB_UPLOAD_PATH).$valueData['value'], |
|
| 2252 | 2252 | array( |
| 2253 | 2253 | 'title' => $field['display_text'], |
| 2254 | 2254 | 'target' => '_blank' |