@@ -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) |
@@ -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>'; |
@@ -249,286 +249,286 @@ |
||
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); |
|
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 | 478 | |
479 | - if (isset($extra_user_data[$field_variable])) { |
|
479 | + if (isset($extra_user_data[$field_variable])) { |
|
480 | 480 | $extra_user_data = explode(';', $extra_user_data[$field_variable]); |
481 | 481 | } |
482 | 482 | |
483 | - $data = array(); |
|
484 | - foreach ($extra_user_data as $extra) { |
|
485 | - $split_extra = explode(':',$extra); |
|
486 | - if (!empty($split_extra)) { |
|
487 | - $block_id = $split_extra[0]; |
|
488 | - $column = isset($split_extra[1]) ? $split_extra[1] : null; |
|
489 | - $data[$block_id] = array('block_id' => $block_id, 'column' => $column); |
|
490 | - } |
|
491 | - } |
|
492 | - |
|
493 | - return $data; |
|
494 | - } |
|
495 | - |
|
496 | - /** |
|
497 | - * This function update extra user blocks data after closing a dashboard block |
|
498 | - * @param int User id |
|
499 | - * @param string plugin path |
|
500 | - * @return bool |
|
501 | - */ |
|
502 | - public static function close_user_block($user_id, $path) |
|
483 | + $data = array(); |
|
484 | + foreach ($extra_user_data as $extra) { |
|
485 | + $split_extra = explode(':',$extra); |
|
486 | + if (!empty($split_extra)) { |
|
487 | + $block_id = $split_extra[0]; |
|
488 | + $column = isset($split_extra[1]) ? $split_extra[1] : null; |
|
489 | + $data[$block_id] = array('block_id' => $block_id, 'column' => $column); |
|
490 | + } |
|
491 | + } |
|
492 | + |
|
493 | + return $data; |
|
494 | + } |
|
495 | + |
|
496 | + /** |
|
497 | + * This function update extra user blocks data after closing a dashboard block |
|
498 | + * @param int User id |
|
499 | + * @param string plugin path |
|
500 | + * @return bool |
|
501 | + */ |
|
502 | + public static function close_user_block($user_id, $path) |
|
503 | 503 | { |
504 | - $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path); |
|
505 | - $user_block_data = self::get_user_block_data($user_id); |
|
506 | - |
|
507 | - foreach ($enabled_dashboard_blocks as $enabled_block) { |
|
508 | - unset($user_block_data[$enabled_block['id']]); |
|
509 | - } |
|
510 | - |
|
511 | - // get columns and blocks id for updating extra user data |
|
512 | - $columns = array(); |
|
513 | - $user_blocks_id = array(); |
|
514 | - foreach ($user_block_data as $data) { |
|
515 | - $user_blocks_id[$data['block_id']] = true; |
|
516 | - $columns[$data['block_id']] = $data['column']; |
|
517 | - } |
|
518 | - |
|
519 | - // update extra user blocks data |
|
520 | - $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns); |
|
521 | - |
|
522 | - return $upd_extra_field; |
|
523 | - } |
|
524 | - |
|
525 | - /** |
|
526 | - * get links for styles from dashboard plugins |
|
527 | - * @return string links |
|
528 | - */ |
|
529 | - public static function get_links_for_styles_from_dashboard_plugins() { |
|
530 | - |
|
531 | - return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL; |
|
532 | - } |
|
504 | + $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path); |
|
505 | + $user_block_data = self::get_user_block_data($user_id); |
|
506 | + |
|
507 | + foreach ($enabled_dashboard_blocks as $enabled_block) { |
|
508 | + unset($user_block_data[$enabled_block['id']]); |
|
509 | + } |
|
510 | + |
|
511 | + // get columns and blocks id for updating extra user data |
|
512 | + $columns = array(); |
|
513 | + $user_blocks_id = array(); |
|
514 | + foreach ($user_block_data as $data) { |
|
515 | + $user_blocks_id[$data['block_id']] = true; |
|
516 | + $columns[$data['block_id']] = $data['column']; |
|
517 | + } |
|
518 | + |
|
519 | + // update extra user blocks data |
|
520 | + $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns); |
|
521 | + |
|
522 | + return $upd_extra_field; |
|
523 | + } |
|
524 | + |
|
525 | + /** |
|
526 | + * get links for styles from dashboard plugins |
|
527 | + * @return string links |
|
528 | + */ |
|
529 | + public static function get_links_for_styles_from_dashboard_plugins() { |
|
530 | + |
|
531 | + return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL; |
|
532 | + } |
|
533 | 533 | |
534 | 534 | } |
@@ -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 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | |
483 | 483 | $data = array(); |
484 | 484 | foreach ($extra_user_data as $extra) { |
485 | - $split_extra = explode(':',$extra); |
|
485 | + $split_extra = explode(':', $extra); |
|
486 | 486 | if (!empty($split_extra)) { |
487 | 487 | $block_id = $split_extra[0]; |
488 | 488 | $column = isset($split_extra[1]) ? $split_extra[1] : null; |
@@ -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 |
@@ -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; |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | break; |
369 | 369 | } |
370 | 370 | |
371 | - if (! $img_path) { |
|
371 | + if (!$img_path) { |
|
372 | 372 | $img_path = api_get_path(WEB_IMG_PATH); |
373 | 373 | } |
374 | 374 | $image = Display::return_icon($img, $status); |
@@ -379,9 +379,9 @@ discard block |
||
379 | 379 | $formatted_expected_value = $expected_value; |
380 | 380 | |
381 | 381 | if ($formatter) { |
382 | - if (method_exists($this, 'format_' . $formatter)) { |
|
383 | - $formatted_current_value = call_user_func(array($this, 'format_' . $formatter), $current_value); |
|
384 | - $formatted_expected_value = call_user_func(array($this, 'format_' . $formatter), $expected_value); |
|
382 | + if (method_exists($this, 'format_'.$formatter)) { |
|
383 | + $formatted_current_value = call_user_func(array($this, 'format_'.$formatter), $current_value); |
|
384 | + $formatted_expected_value = call_user_func(array($this, 'format_'.$formatter), $expected_value); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
@@ -396,13 +396,13 @@ discard block |
||
396 | 396 | */ |
397 | 397 | public function get_link($title, $url) |
398 | 398 | { |
399 | - return '<a href="' . $url . '" target="about:bank">' . $title . '</a>'; |
|
399 | + return '<a href="'.$url.'" target="about:bank">'.$title.'</a>'; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | public function format_yes_no_optional($value) |
403 | 403 | { |
404 | 404 | $return = ''; |
405 | - switch($value) { |
|
405 | + switch ($value) { |
|
406 | 406 | case 0: |
407 | 407 | $return = get_lang('No'); |
408 | 408 | break; |
@@ -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')); |
@@ -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]) && $user_choice[0]->getAnswer() == $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 | ) |
@@ -627,8 +627,8 @@ discard block |
||
627 | 627 | TABLE_STATISTIC_TRACK_E_ATTEMPT |
628 | 628 | ); |
629 | 629 | $sql = 'SELECT answer |
630 | - FROM ' . $trackAttempts . ' |
|
631 | - WHERE exe_id=' . $exe_id . ' AND question_id=' . $questionId; |
|
630 | + FROM ' . $trackAttempts.' |
|
631 | + WHERE exe_id=' . $exe_id.' AND question_id='.$questionId; |
|
632 | 632 | $rsLastAttempt = Database::query($sql); |
633 | 633 | $rowLastAttempt = Database::fetch_array($rsLastAttempt); |
634 | 634 | $answer = $rowLastAttempt['answer']; |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | '', |
688 | 688 | $answerCorrected |
689 | 689 | ); |
690 | - $answerCorrected = '[' . $answerCorrected . ']'; |
|
690 | + $answerCorrected = '['.$answerCorrected.']'; |
|
691 | 691 | $studentAnswerList[] = $answerCorrected; |
692 | 692 | } |
693 | 693 | } |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | */ |
707 | 707 | $tabComments = api_preg_split( |
708 | 708 | '/\[[^]]+\]/', |
709 | - ' ' . $answer . ' ' |
|
709 | + ' '.$answer.' ' |
|
710 | 710 | ); |
711 | 711 | if (!empty($correctAnswerList) && !empty($studentAnswerList)) { |
712 | 712 | $answer = ""; |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | $size |
724 | 724 | ); |
725 | 725 | |
726 | - $answer .= $tabComments[$i] . |
|
726 | + $answer .= $tabComments[$i]. |
|
727 | 727 | Display::input( |
728 | 728 | 'text', |
729 | 729 | "choice[$questionId][]", |
@@ -769,12 +769,12 @@ discard block |
||
769 | 769 | $s .= '<tr><td width="45%" valign="top">'; |
770 | 770 | $parsed_answer = $answer; |
771 | 771 | //left part questions |
772 | - $s .= '<p class="indent">' . $lines_count . '. ' . $parsed_answer . '</p></td>'; |
|
772 | + $s .= '<p class="indent">'.$lines_count.'. '.$parsed_answer.'</p></td>'; |
|
773 | 773 | //middle part (matches selects) |
774 | 774 | |
775 | 775 | $s .= '<td width="10%" valign="top" align="center" > |
776 | 776 | <div class="select-matching"> |
777 | - <select name="choice[' . $questionId . '][' . $numAnswer . ']">'; |
|
777 | + <select name="choice[' . $questionId.']['.$numAnswer.']">'; |
|
778 | 778 | |
779 | 779 | // fills the list-box |
780 | 780 | foreach ($select_items as $key => $val) { |
@@ -790,14 +790,14 @@ discard block |
||
790 | 790 | if (isset($user_choice_array_position[$numAnswer]) && $val['id'] == $user_choice_array_position[$numAnswer]) { |
791 | 791 | $selected = 'selected="selected"'; |
792 | 792 | } |
793 | - $s .= '<option value="' . $val['id'] . '" ' . $selected . '>' . $val['letter'] . '</option>'; |
|
793 | + $s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>'; |
|
794 | 794 | |
795 | 795 | } // end foreach() |
796 | 796 | |
797 | 797 | $s .= '</select></div></td><td width="5%" class="separate"> </td>'; |
798 | 798 | $s .= '<td width="40%" valign="top" >'; |
799 | 799 | if (isset($select_items[$lines_count])) { |
800 | - $s .= '<div class="text-right"><p class="indent">' . $select_items[$lines_count]['letter'].'. '. $select_items[$lines_count]['answer'].'</p></div>'; |
|
800 | + $s .= '<div class="text-right"><p class="indent">'.$select_items[$lines_count]['letter'].'. '.$select_items[$lines_count]['answer'].'</p></div>'; |
|
801 | 801 | } else { |
802 | 802 | $s .= ' '; |
803 | 803 | } |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | $s .= '<tr> |
813 | 813 | <td colspan="2"></td> |
814 | 814 | <td valign="top">'; |
815 | - $s .= '<b>' . $select_items[$lines_count]['letter'] . '.</b> ' . $select_items[$lines_count]['answer']; |
|
815 | + $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer']; |
|
816 | 816 | $s .= "</td> |
817 | 817 | </tr>"; |
818 | 818 | $lines_count++; |
@@ -828,9 +828,9 @@ discard block |
||
828 | 828 | $data = $objAnswerTmp->getAnswerByAutoId($data['correct']); |
829 | 829 | $lines_count = $data['answer'];*/ |
830 | 830 | |
831 | - $windowId = $questionId . '_' . $lines_count; |
|
831 | + $windowId = $questionId.'_'.$lines_count; |
|
832 | 832 | |
833 | - $s .= '<li class="touch-items" id="' . $windowId . '">'; |
|
833 | + $s .= '<li class="touch-items" id="'.$windowId.'">'; |
|
834 | 834 | $s .= Display::div( |
835 | 835 | $parsed_answer, |
836 | 836 | [ |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | Display::tag( |
889 | 889 | 'b', |
890 | 890 | $select_items[$lines_count]['letter'] |
891 | - ) . $select_items[$lines_count]['answer'], |
|
891 | + ).$select_items[$lines_count]['answer'], |
|
892 | 892 | [ |
893 | 893 | 'id' => "window_{$windowId}_answer", |
894 | 894 | 'style' => 'display: none;' |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | |
1033 | 1033 | if ($show_comment) { |
1034 | 1034 | $s .= '</table>'; |
1035 | - } elseif( |
|
1035 | + } elseif ( |
|
1036 | 1036 | in_array( |
1037 | 1037 | $answerType, |
1038 | 1038 | [ |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | |
1058 | 1058 | for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { |
1059 | 1059 | $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
1060 | - $windowId = $questionId . '_' . $counterAnswer; |
|
1060 | + $windowId = $questionId.'_'.$counterAnswer; |
|
1061 | 1061 | |
1062 | 1062 | if ($answerCorrect) { |
1063 | 1063 | $s .= Display::div( |
@@ -1102,7 +1102,7 @@ discard block |
||
1102 | 1102 | $course = api_get_course_info(); |
1103 | 1103 | $doc_id = DocumentManager::get_document_id( |
1104 | 1104 | $course, |
1105 | - '/images/' . $pictureName |
|
1105 | + '/images/'.$pictureName |
|
1106 | 1106 | ); |
1107 | 1107 | if (is_numeric($doc_id)) { |
1108 | 1108 | $images_folder_visibility = api_get_item_visibility( |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | echo " |
1128 | 1128 | <script> |
1129 | 1129 | $(document).on('ready', function () { |
1130 | - new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion" ) . "({ |
|
1130 | + new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion")."({ |
|
1131 | 1131 | questionId: $questionId, |
1132 | 1132 | exerciseId: $exerciseId, |
1133 | 1133 | selector: '#hotspot-preview-$questionId', |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | if ($answerType != HOT_SPOT_DELINEATION) { |
1162 | 1162 | $answerList = ' |
1163 | 1163 | <div class="well well-sm"> |
1164 | - <h5 class="page-header">' . get_lang('HotspotZones') . '</h5> |
|
1164 | + <h5 class="page-header">' . get_lang('HotspotZones').'</h5> |
|
1165 | 1165 | <ol> |
1166 | 1166 | '; |
1167 | 1167 | |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | if (!$only_questions) { |
1187 | 1187 | if ($show_title) { |
1188 | 1188 | TestCategory::displayCategoryAndTitle($objQuestionTmp->id); |
1189 | - echo '<div class="question_title">' . $current_item . '. ' . $questionName . '</div>'; |
|
1189 | + echo '<div class="question_title">'.$current_item.'. '.$questionName.'</div>'; |
|
1190 | 1190 | } |
1191 | 1191 | //@todo I need to the get the feedback type |
1192 | 1192 | echo <<<HOTSPOT |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | <div class=\"hotspot-image\"></div> |
1205 | 1205 | <script> |
1206 | 1206 | $(document).on('ready', function () { |
1207 | - new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion') . "({ |
|
1207 | + new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion')."({ |
|
1208 | 1208 | questionId: $questionId, |
1209 | 1209 | exerciseId: $exe_id, |
1210 | 1210 | selector: '#question_div_' + $questionId + ' .hotspot-image', |
@@ -1323,11 +1323,11 @@ discard block |
||
1323 | 1323 | $lp_id = intval($lp_id); |
1324 | 1324 | $lp_item_id = intval($lp_item_id); |
1325 | 1325 | return |
1326 | - api_get_course_int_id() . '_' . |
|
1327 | - api_get_session_id() . '_' . |
|
1328 | - $exercise_id . '_' . |
|
1329 | - api_get_user_id() . '_' . |
|
1330 | - $lp_id . '_' . |
|
1326 | + api_get_course_int_id().'_'. |
|
1327 | + api_get_session_id().'_'. |
|
1328 | + $exercise_id.'_'. |
|
1329 | + api_get_user_id().'_'. |
|
1330 | + $lp_id.'_'. |
|
1331 | 1331 | $lp_item_id; |
1332 | 1332 | } |
1333 | 1333 | |
@@ -1439,14 +1439,14 @@ discard block |
||
1439 | 1439 | $res = Database::query($sql); |
1440 | 1440 | $result = array(); |
1441 | 1441 | $apiIsAllowedToEdit = api_is_allowed_to_edit(); |
1442 | - $urlBase = api_get_path(WEB_CODE_PATH) . |
|
1443 | - 'exercice/hotpotatoes_exercise_report.php?action=delete&' . |
|
1444 | - api_get_cidreq() . '&id='; |
|
1442 | + $urlBase = api_get_path(WEB_CODE_PATH). |
|
1443 | + 'exercice/hotpotatoes_exercise_report.php?action=delete&'. |
|
1444 | + api_get_cidreq().'&id='; |
|
1445 | 1445 | while ($data = Database::fetch_array($res)) { |
1446 | 1446 | $actions = null; |
1447 | 1447 | |
1448 | 1448 | if ($apiIsAllowedToEdit) { |
1449 | - $url = $urlBase . $data['id'] . '&path=' . $data['exe_name']; |
|
1449 | + $url = $urlBase.$data['id'].'&path='.$data['exe_name']; |
|
1450 | 1450 | $actions = Display::url( |
1451 | 1451 | Display::return_icon('delete.png', get_lang('Delete')), |
1452 | 1452 | $url |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | GroupManager::get_user_group_name($data['user_id']) |
1463 | 1463 | ), |
1464 | 1464 | 'exe_date' => $data['exe_date'], |
1465 | - 'score' => $data['exe_result'] . ' / ' . $data['exe_weighting'], |
|
1465 | + 'score' => $data['exe_result'].' / '.$data['exe_weighting'], |
|
1466 | 1466 | 'actions' => $actions, |
1467 | 1467 | ); |
1468 | 1468 | } |
@@ -1545,18 +1545,18 @@ discard block |
||
1545 | 1545 | $TBL_TRACK_HOTPOTATOES = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
1546 | 1546 | $TBL_TRACK_ATTEMPT_RECORDING = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); |
1547 | 1547 | |
1548 | - $session_id_and = ' AND te.session_id = ' . $sessionId . ' '; |
|
1548 | + $session_id_and = ' AND te.session_id = '.$sessionId.' '; |
|
1549 | 1549 | $exercise_id = intval($exercise_id); |
1550 | 1550 | |
1551 | 1551 | $exercise_where = ''; |
1552 | 1552 | if (!empty($exercise_id)) { |
1553 | - $exercise_where .= ' AND te.exe_exo_id = ' . $exercise_id . ' '; |
|
1553 | + $exercise_where .= ' AND te.exe_exo_id = '.$exercise_id.' '; |
|
1554 | 1554 | } |
1555 | 1555 | |
1556 | 1556 | $hotpotatoe_where = ''; |
1557 | 1557 | if (!empty($_GET['path'])) { |
1558 | 1558 | $hotpotatoe_path = Database::escape_string($_GET['path']); |
1559 | - $hotpotatoe_where .= ' AND exe_name = "' . $hotpotatoe_path . '" '; |
|
1559 | + $hotpotatoe_where .= ' AND exe_name = "'.$hotpotatoe_path.'" '; |
|
1560 | 1560 | } |
1561 | 1561 | |
1562 | 1562 | // sql for chamilo-type tests for teacher / tutor view |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | WHERE |
1569 | 1569 | c_id = $course_id AND |
1570 | 1570 | exe_exo_id = $exercise_id AND |
1571 | - ttte.session_id = " . $sessionId . " |
|
1571 | + ttte.session_id = ".$sessionId." |
|
1572 | 1572 | )"; |
1573 | 1573 | |
1574 | 1574 | if ($is_allowedToEdit) { |
@@ -1591,9 +1591,9 @@ discard block |
||
1591 | 1591 | g.id as group_id |
1592 | 1592 | FROM $TBL_USER u |
1593 | 1593 | INNER JOIN $TBL_GROUP_REL_USER gru |
1594 | - ON (gru.user_id = u.user_id AND gru.c_id=" . $course_id . ") |
|
1594 | + ON (gru.user_id = u.user_id AND gru.c_id=".$course_id.") |
|
1595 | 1595 | INNER JOIN $TBL_GROUP g |
1596 | - ON (gru.group_id = g.id AND g.c_id=" . $course_id . ") |
|
1596 | + ON (gru.group_id = g.id AND g.c_id=".$course_id.") |
|
1597 | 1597 | )"; |
1598 | 1598 | } |
1599 | 1599 | |
@@ -1655,9 +1655,9 @@ discard block |
||
1655 | 1655 | g.id as group_id |
1656 | 1656 | FROM $TBL_USER u |
1657 | 1657 | LEFT OUTER JOIN $TBL_GROUP_REL_USER gru |
1658 | - ON ( gru.user_id = u.user_id AND gru.c_id=" . $course_id . " ) |
|
1658 | + ON ( gru.user_id = u.user_id AND gru.c_id=".$course_id." ) |
|
1659 | 1659 | LEFT OUTER JOIN $TBL_GROUP g |
1660 | - ON (gru.group_id = g.id AND g.c_id = " . $course_id . ") |
|
1660 | + ON (gru.group_id = g.id AND g.c_id = ".$course_id.") |
|
1661 | 1661 | )"; |
1662 | 1662 | } |
1663 | 1663 | |
@@ -1670,12 +1670,12 @@ discard block |
||
1670 | 1670 | ( |
1671 | 1671 | SELECT u.user_id, firstname, lastname, email, username, ' ' as group_name, '' as group_id, official_code |
1672 | 1672 | FROM $TBL_USER u |
1673 | - WHERE u.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ") |
|
1673 | + WHERE u.status NOT IN(".api_get_users_status_ignored_in_reports('string').") |
|
1674 | 1674 | )"; |
1675 | 1675 | } |
1676 | 1676 | |
1677 | 1677 | $sqlFromOption = " , $TBL_GROUP_REL_USER AS gru "; |
1678 | - $sqlWhereOption = " AND gru.c_id = " . $course_id ." AND gru.user_id = user.user_id "; |
|
1678 | + $sqlWhereOption = " AND gru.c_id = ".$course_id." AND gru.user_id = user.user_id "; |
|
1679 | 1679 | $first_and_last_name = api_is_western_name_order() ? "firstname, lastname" : "lastname, firstname"; |
1680 | 1680 | |
1681 | 1681 | if ($get_count) { |
@@ -1712,8 +1712,8 @@ discard block |
||
1712 | 1712 | ON (user.user_id = exe_user_id) |
1713 | 1713 | WHERE |
1714 | 1714 | te.status != 'incomplete' AND |
1715 | - te.c_id = " . $course_id . " $session_id_and AND |
|
1716 | - ce.active <>-1 AND ce.c_id = " . $course_id . " |
|
1715 | + te.c_id = ".$course_id." $session_id_and AND |
|
1716 | + ce.active <>-1 AND ce.c_id = ".$course_id." |
|
1717 | 1717 | $exercise_where |
1718 | 1718 | $extra_where_conditions |
1719 | 1719 | "; |
@@ -1740,12 +1740,12 @@ discard block |
||
1740 | 1740 | $sqlFromOption |
1741 | 1741 | WHERE |
1742 | 1742 | user.user_id=tth.exe_user_id |
1743 | - AND tth.c_id = " . $course_id . " |
|
1743 | + AND tth.c_id = ".$course_id." |
|
1744 | 1744 | $hotpotatoe_where |
1745 | 1745 | $sqlWhereOption |
1746 | - AND user.status NOT IN(" . api_get_users_status_ignored_in_reports( |
|
1746 | + AND user.status NOT IN(".api_get_users_status_ignored_in_reports( |
|
1747 | 1747 | 'string' |
1748 | - ) . ") |
|
1748 | + ).") |
|
1749 | 1749 | ORDER BY |
1750 | 1750 | tth.c_id ASC, |
1751 | 1751 | tth.exe_date DESC"; |
@@ -1821,12 +1821,12 @@ discard block |
||
1821 | 1821 | |
1822 | 1822 | if ($from_gradebook && ($is_allowedToEdit)) { |
1823 | 1823 | if (in_array( |
1824 | - $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'], |
|
1824 | + $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'], |
|
1825 | 1825 | $users_array_id |
1826 | 1826 | )) { |
1827 | 1827 | continue; |
1828 | 1828 | } |
1829 | - $users_array_id[] = $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname']; |
|
1829 | + $users_array_id[] = $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname']; |
|
1830 | 1830 | } |
1831 | 1831 | |
1832 | 1832 | $lp_obj = isset($results[$i]['orig_lp_id']) && isset($lp_list[$results[$i]['orig_lp_id']]) ? $lp_list[$results[$i]['orig_lp_id']] : null; |
@@ -1835,8 +1835,8 @@ discard block |
||
1835 | 1835 | if ($lp_obj) { |
1836 | 1836 | $url = api_get_path( |
1837 | 1837 | WEB_CODE_PATH |
1838 | - ) . 'newscorm/lp_controller.php?' . api_get_cidreq( |
|
1839 | - ) . '&action=view&lp_id=' . $results[$i]['orig_lp_id']; |
|
1838 | + ).'newscorm/lp_controller.php?'.api_get_cidreq( |
|
1839 | + ).'&action=view&lp_id='.$results[$i]['orig_lp_id']; |
|
1840 | 1840 | $lp_name = Display::url( |
1841 | 1841 | $lp_obj['lp_name'], |
1842 | 1842 | $url, |
@@ -1854,7 +1854,7 @@ discard block |
||
1854 | 1854 | ); |
1855 | 1855 | |
1856 | 1856 | foreach ($group_list as $id) { |
1857 | - $group_name_list .= $clean_group_list[$id] . '<br/>'; |
|
1857 | + $group_name_list .= $clean_group_list[$id].'<br/>'; |
|
1858 | 1858 | } |
1859 | 1859 | $results[$i]['group_name'] = $group_name_list; |
1860 | 1860 | } |
@@ -1910,8 +1910,8 @@ discard block |
||
1910 | 1910 | } |
1911 | 1911 | } |
1912 | 1912 | if ($revised) { |
1913 | - $actions .= "<a href='exercise_show.php?" . api_get_cidreq( |
|
1914 | - ) . "&action=edit&id=$id'>" . |
|
1913 | + $actions .= "<a href='exercise_show.php?".api_get_cidreq( |
|
1914 | + )."&action=edit&id=$id'>". |
|
1915 | 1915 | Display:: return_icon( |
1916 | 1916 | 'edit.png', |
1917 | 1917 | get_lang('Edit'), |
@@ -1920,8 +1920,8 @@ discard block |
||
1920 | 1920 | ); |
1921 | 1921 | $actions .= ' '; |
1922 | 1922 | } else { |
1923 | - $actions .= "<a href='exercise_show.php?" . api_get_cidreq( |
|
1924 | - ) . "&action=qualify&id=$id'>" . |
|
1923 | + $actions .= "<a href='exercise_show.php?".api_get_cidreq( |
|
1924 | + )."&action=qualify&id=$id'>". |
|
1925 | 1925 | Display:: return_icon( |
1926 | 1926 | 'quiz.gif', |
1927 | 1927 | get_lang('Qualify') |
@@ -1931,12 +1931,12 @@ discard block |
||
1931 | 1931 | $actions .= "</a>"; |
1932 | 1932 | |
1933 | 1933 | if ($filter == 2) { |
1934 | - $actions .= ' <a href="exercise_history.php?' . api_get_cidreq( |
|
1935 | - ) . '&exe_id=' . $id . '">' . |
|
1934 | + $actions .= ' <a href="exercise_history.php?'.api_get_cidreq( |
|
1935 | + ).'&exe_id='.$id.'">'. |
|
1936 | 1936 | Display:: return_icon( |
1937 | 1937 | 'history.gif', |
1938 | 1938 | get_lang('ViewHistoryChange') |
1939 | - ) . '</a>'; |
|
1939 | + ).'</a>'; |
|
1940 | 1940 | } |
1941 | 1941 | |
1942 | 1942 | //Admin can always delete the attempt |
@@ -1948,35 +1948,35 @@ discard block |
||
1948 | 1948 | date('Y-m-d h:i:s'), |
1949 | 1949 | false |
1950 | 1950 | ); |
1951 | - $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank">'; |
|
1951 | + $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip='.$ip.'" target="_blank">'; |
|
1952 | 1952 | $actions .= Display::return_icon('info.png', $ip, ['title' => $ip]); |
1953 | 1953 | $actions .= '</a>'; |
1954 | 1954 | |
1955 | - $delete_link = '<a href="exercise_report.php?' . api_get_cidreq( |
|
1956 | - ) . '&filter_by_user=' . intval( |
|
1955 | + $delete_link = '<a href="exercise_report.php?'.api_get_cidreq( |
|
1956 | + ).'&filter_by_user='.intval( |
|
1957 | 1957 | $_GET['filter_by_user'] |
1958 | - ) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '" |
|
1958 | + ).'&filter='.$filter.'&exerciseId='.$exercise_id.'&delete=delete&did='.$id.'" |
|
1959 | 1959 | onclick="javascript:if(!confirm(\'' . sprintf( |
1960 | 1960 | get_lang('DeleteAttempt'), |
1961 | 1961 | $results[$i]['username'], |
1962 | 1962 | $dt |
1963 | - ) . '\')) return false;">' . Display:: return_icon( |
|
1963 | + ).'\')) return false;">'.Display:: return_icon( |
|
1964 | 1964 | 'delete.png', |
1965 | 1965 | get_lang('Delete') |
1966 | - ) . '</a>'; |
|
1966 | + ).'</a>'; |
|
1967 | 1967 | $delete_link = utf8_encode($delete_link); |
1968 | 1968 | |
1969 | 1969 | if (api_is_drh() && !api_is_platform_admin()) { |
1970 | 1970 | $delete_link = null; |
1971 | 1971 | } |
1972 | - $actions .= $delete_link . ' '; |
|
1972 | + $actions .= $delete_link.' '; |
|
1973 | 1973 | } |
1974 | 1974 | |
1975 | 1975 | } else { |
1976 | 1976 | $attempt_url = api_get_path( |
1977 | 1977 | WEB_CODE_PATH |
1978 | - ) . 'exercice/result.php?' . api_get_cidreq( |
|
1979 | - ) . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId; |
|
1978 | + ).'exercice/result.php?'.api_get_cidreq( |
|
1979 | + ).'&id='.$results[$i]['exe_id'].'&id_session='.$sessionId; |
|
1980 | 1980 | $attempt_link = Display::url( |
1981 | 1981 | get_lang('Show'), |
1982 | 1982 | $attempt_url, |
@@ -2033,7 +2033,7 @@ discard block |
||
2033 | 2033 | $hp_result = round( |
2034 | 2034 | ($hpresults[$i][4] / ($hpresults[$i][5] != 0 ? $hpresults[$i][5] : 1)) * 100, |
2035 | 2035 | 2 |
2036 | - ) . '% (' . $hpresults[$i][4] . ' / ' . $hpresults[$i][5] . ')'; |
|
2036 | + ).'% ('.$hpresults[$i][4].' / '.$hpresults[$i][5].')'; |
|
2037 | 2037 | if ($is_allowedToEdit) { |
2038 | 2038 | $list_info[] = array( |
2039 | 2039 | $hpresults[$i][0], |
@@ -2106,13 +2106,13 @@ discard block |
||
2106 | 2106 | |
2107 | 2107 | $html = null; |
2108 | 2108 | if ($show_percentage) { |
2109 | - $parent = '(' . $score . ' / ' . $weight . ')'; |
|
2110 | - $html = $percentage . "% $parent"; |
|
2109 | + $parent = '('.$score.' / '.$weight.')'; |
|
2110 | + $html = $percentage."% $parent"; |
|
2111 | 2111 | if ($show_only_percentage) { |
2112 | - $html = $percentage . "% "; |
|
2112 | + $html = $percentage."% "; |
|
2113 | 2113 | } |
2114 | 2114 | } else { |
2115 | - $html = $score . ' / ' . $weight; |
|
2115 | + $html = $score.' / '.$weight; |
|
2116 | 2116 | } |
2117 | 2117 | $html = Display::span($html, array('class' => 'score_exercise')); |
2118 | 2118 | |
@@ -2206,7 +2206,7 @@ discard block |
||
2206 | 2206 | { |
2207 | 2207 | $return = '-'; |
2208 | 2208 | if ($value != '') { |
2209 | - $return = float_format($value * 100, 1) . ' %'; |
|
2209 | + $return = float_format($value * 100, 1).' %'; |
|
2210 | 2210 | } |
2211 | 2211 | return $return; |
2212 | 2212 | } |
@@ -2284,7 +2284,7 @@ discard block |
||
2284 | 2284 | } |
2285 | 2285 | |
2286 | 2286 | $needle_where = !empty($search) ? " AND title LIKE '?' " : ''; |
2287 | - $needle = !empty($search) ? "%" . $search . "%" : ''; |
|
2287 | + $needle = !empty($search) ? "%".$search."%" : ''; |
|
2288 | 2288 | |
2289 | 2289 | // Show courses by active status |
2290 | 2290 | $active_sql = ''; |
@@ -2299,7 +2299,7 @@ discard block |
||
2299 | 2299 | if ($search_all_sessions == true) { |
2300 | 2300 | $conditions = array( |
2301 | 2301 | 'where' => array( |
2302 | - $active_sql . ' c_id = ? ' . $needle_where . $time_conditions => array( |
|
2302 | + $active_sql.' c_id = ? '.$needle_where.$time_conditions => array( |
|
2303 | 2303 | $course_id, |
2304 | 2304 | $needle |
2305 | 2305 | ) |
@@ -2310,7 +2310,7 @@ discard block |
||
2310 | 2310 | if ($session_id == 0) { |
2311 | 2311 | $conditions = array( |
2312 | 2312 | 'where' => array( |
2313 | - $active_sql . ' session_id = ? AND c_id = ? ' . $needle_where . $time_conditions => array( |
|
2313 | + $active_sql.' session_id = ? AND c_id = ? '.$needle_where.$time_conditions => array( |
|
2314 | 2314 | $session_id, |
2315 | 2315 | $course_id, |
2316 | 2316 | $needle |
@@ -2321,7 +2321,7 @@ discard block |
||
2321 | 2321 | } else { |
2322 | 2322 | $conditions = array( |
2323 | 2323 | 'where' => array( |
2324 | - $active_sql . ' (session_id = 0 OR session_id = ? ) AND c_id = ? ' . $needle_where . $time_conditions => array( |
|
2324 | + $active_sql.' (session_id = 0 OR session_id = ? ) AND c_id = ? '.$needle_where.$time_conditions => array( |
|
2325 | 2325 | $session_id, |
2326 | 2326 | $course_id, |
2327 | 2327 | $needle |
@@ -2500,7 +2500,7 @@ discard block |
||
2500 | 2500 | |
2501 | 2501 | if ($return_string) { |
2502 | 2502 | if (!empty($position) && !empty($my_ranking)) { |
2503 | - $return_value = $position . '/' . count($my_ranking); |
|
2503 | + $return_value = $position.'/'.count($my_ranking); |
|
2504 | 2504 | } else { |
2505 | 2505 | $return_value = '-'; |
2506 | 2506 | } |
@@ -2580,7 +2580,7 @@ discard block |
||
2580 | 2580 | |
2581 | 2581 | if ($return_string) { |
2582 | 2582 | if (!empty($position) && !empty($my_ranking)) { |
2583 | - return $position . '/' . count($my_ranking); |
|
2583 | + return $position.'/'.count($my_ranking); |
|
2584 | 2584 | } |
2585 | 2585 | } |
2586 | 2586 | return $return_value; |
@@ -2980,7 +2980,7 @@ discard block |
||
2980 | 2980 | $courseCondition = " |
2981 | 2981 | INNER JOIN $courseUser cu |
2982 | 2982 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
2983 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
2983 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
2984 | 2984 | } else { |
2985 | 2985 | $courseCondition = " |
2986 | 2986 | INNER JOIN $courseUserSession cu |
@@ -3056,7 +3056,7 @@ discard block |
||
3056 | 3056 | $courseCondition = " |
3057 | 3057 | INNER JOIN $courseUser cu |
3058 | 3058 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
3059 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
3059 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
3060 | 3060 | } else { |
3061 | 3061 | $courseCondition = " |
3062 | 3062 | INNER JOIN $courseUserSession cu |
@@ -3148,7 +3148,7 @@ discard block |
||
3148 | 3148 | $courseCondition = " |
3149 | 3149 | INNER JOIN $courseUser cu |
3150 | 3150 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
3151 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
3151 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
3152 | 3152 | } else { |
3153 | 3153 | $courseCondition = " |
3154 | 3154 | INNER JOIN $courseUserSession cu |
@@ -3330,7 +3330,7 @@ discard block |
||
3330 | 3330 | } |
3331 | 3331 | } |
3332 | 3332 | // adds the correct word, followed by ] to close the blank |
3333 | - $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]'; |
|
3333 | + $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]'; |
|
3334 | 3334 | if (isset ($real_text[$i + 1])) { |
3335 | 3335 | $answer .= $real_text[$i + 1]; |
3336 | 3336 | } |
@@ -3390,13 +3390,13 @@ discard block |
||
3390 | 3390 | // check the default value of option |
3391 | 3391 | $tabSelected = array($in_default => " selected='selected' "); |
3392 | 3392 | $res = ""; |
3393 | - $res .= "<select name='$in_name' id='$in_name' onchange='" . $in_onchange . "' >"; |
|
3394 | - $res .= "<option value='-1'" . $tabSelected["-1"] . ">-- " . get_lang( |
|
3393 | + $res .= "<select name='$in_name' id='$in_name' onchange='".$in_onchange."' >"; |
|
3394 | + $res .= "<option value='-1'".$tabSelected["-1"].">-- ".get_lang( |
|
3395 | 3395 | 'AllGroups' |
3396 | - ) . " --</option>"; |
|
3397 | - $res .= "<option value='0'" . $tabSelected["0"] . ">- " . get_lang( |
|
3396 | + )." --</option>"; |
|
3397 | + $res .= "<option value='0'".$tabSelected["0"].">- ".get_lang( |
|
3398 | 3398 | 'NotInAGroup' |
3399 | - ) . " -</option>"; |
|
3399 | + )." -</option>"; |
|
3400 | 3400 | $tabGroups = GroupManager::get_group_list(); |
3401 | 3401 | $currentCatId = 0; |
3402 | 3402 | for ($i = 0; $i < count($tabGroups); $i++) { |
@@ -3404,10 +3404,10 @@ discard block |
||
3404 | 3404 | $tabGroups[$i]["id"] |
3405 | 3405 | ); |
3406 | 3406 | if ($tabCategory["id"] != $currentCatId) { |
3407 | - $res .= "<option value='-1' disabled='disabled'>" . $tabCategory["title"] . "</option>"; |
|
3407 | + $res .= "<option value='-1' disabled='disabled'>".$tabCategory["title"]."</option>"; |
|
3408 | 3408 | $currentCatId = $tabCategory["id"]; |
3409 | 3409 | } |
3410 | - $res .= "<option " . $tabSelected[$tabGroups[$i]["id"]] . "style='margin-left:40px' value='" . $tabGroups[$i]["id"] . "'>" . $tabGroups[$i]["name"] . "</option>"; |
|
3410 | + $res .= "<option ".$tabSelected[$tabGroups[$i]["id"]]."style='margin-left:40px' value='".$tabGroups[$i]["id"]."'>".$tabGroups[$i]["name"]."</option>"; |
|
3411 | 3411 | } |
3412 | 3412 | $res .= "</select>"; |
3413 | 3413 | return $res; |
@@ -3612,14 +3612,14 @@ discard block |
||
3612 | 3612 | if ($show_results) { |
3613 | 3613 | $comnt = Event::get_comments($exe_id, $questionId); |
3614 | 3614 | if (!empty($comnt)) { |
3615 | - echo '<b>' . get_lang('Feedback') . '</b>'; |
|
3616 | - echo '<div id="question_feedback">' . $comnt . '</div>'; |
|
3615 | + echo '<b>'.get_lang('Feedback').'</b>'; |
|
3616 | + echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
3617 | 3617 | } |
3618 | 3618 | } |
3619 | 3619 | |
3620 | 3620 | if ($show_results) { |
3621 | 3621 | $score = array( |
3622 | - 'result' => get_lang('Score') . " : " . self::show_score( |
|
3622 | + 'result' => get_lang('Score')." : ".self::show_score( |
|
3623 | 3623 | $my_total_score, |
3624 | 3624 | $my_total_weight, |
3625 | 3625 | false, |
@@ -3693,13 +3693,13 @@ discard block |
||
3693 | 3693 | } |
3694 | 3694 | |
3695 | 3695 | if ($show_all_but_expected_answer) { |
3696 | - $exercise_content .= "<div class='normal-message'>" . get_lang( |
|
3696 | + $exercise_content .= "<div class='normal-message'>".get_lang( |
|
3697 | 3697 | "ExerciseWithFeedbackWithoutCorrectionComment" |
3698 | - ) . "</div>"; |
|
3698 | + )."</div>"; |
|
3699 | 3699 | } |
3700 | 3700 | // Remove audio auto play from questions on results page - refs BT#7939 |
3701 | 3701 | $exercise_content = preg_replace( |
3702 | - ['/autoplay[\=\".+\"]+/','/autostart[\=\".+\"]+/'], |
|
3702 | + ['/autoplay[\=\".+\"]+/', '/autostart[\=\".+\"]+/'], |
|
3703 | 3703 | '', |
3704 | 3704 | $exercise_content |
3705 | 3705 | ); |
@@ -3793,11 +3793,11 @@ discard block |
||
3793 | 3793 | $ribbon_total_success_or_error = ' ribbon-total-error'; |
3794 | 3794 | } |
3795 | 3795 | } |
3796 | - $ribbon .= '<div class="total ' . $ribbon_total_success_or_error . '">'; |
|
3796 | + $ribbon .= '<div class="total '.$ribbon_total_success_or_error.'">'; |
|
3797 | 3797 | } else { |
3798 | 3798 | $ribbon .= '<div class="total">'; |
3799 | 3799 | } |
3800 | - $ribbon .= '<h3>' . get_lang('YourTotalScore') . ": "; |
|
3800 | + $ribbon .= '<h3>'.get_lang('YourTotalScore').": "; |
|
3801 | 3801 | $ribbon .= self::show_score($score, $weight, false, true); |
3802 | 3802 | |
3803 | 3803 | $ribbon .= '</h3>'; |
@@ -24,6 +24,10 @@ discard block |
||
24 | 24 | * @param int Question ID |
25 | 25 | * @param int $resultsDisabled |
26 | 26 | * @param string $originalStudentAnswer |
27 | + * @param integer $feedbackType |
|
28 | + * @param string $answer |
|
29 | + * @param integer $id |
|
30 | + * @param integer $questionId |
|
27 | 31 | * @return void |
28 | 32 | */ |
29 | 33 | public static function display_fill_in_blanks_answer($feedbackType, $answer, $id, $questionId, $resultsDisabled, $originalStudentAnswer = '') |
@@ -62,6 +66,10 @@ discard block |
||
62 | 66 | * @param string Answer text |
63 | 67 | * @param int Exercise ID |
64 | 68 | * @param int Question ID |
69 | + * @param integer $feedback_type |
|
70 | + * @param string $answer |
|
71 | + * @param integer $id |
|
72 | + * @param integer $questionId |
|
65 | 73 | * @return void |
66 | 74 | */ |
67 | 75 | static function display_calculated_answer($feedback_type, $answer, $id, $questionId) |
@@ -95,6 +103,9 @@ discard block |
||
95 | 103 | * @param string Answer text |
96 | 104 | * @param int Exercise ID |
97 | 105 | * @param int Question ID |
106 | + * @param integer $feedback_type |
|
107 | + * @param integer $exe_id |
|
108 | + * @param integer $questionId |
|
98 | 109 | * @return void |
99 | 110 | */ |
100 | 111 | static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null) |
@@ -117,6 +128,12 @@ discard block |
||
117 | 128 | } |
118 | 129 | } |
119 | 130 | |
131 | + /** |
|
132 | + * @param integer $feedback_type |
|
133 | + * @param integer $id |
|
134 | + * @param integer $questionId |
|
135 | + * @param Nanogong $nano |
|
136 | + */ |
|
120 | 137 | static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $nano = null) |
121 | 138 | { |
122 | 139 | if (isset($nano)) { |
@@ -158,6 +175,7 @@ discard block |
||
158 | 175 | * @param string $answer |
159 | 176 | * @param string $studentChoice |
160 | 177 | * @param string $answerComment |
178 | + * @param integer $feedback_type |
|
161 | 179 | */ |
162 | 180 | static function display_hotspot_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment, $in_results_disabled) |
163 | 181 | { |
@@ -224,6 +242,12 @@ discard block |
||
224 | 242 | * @param integer Exercise ID |
225 | 243 | * @param integer Question ID |
226 | 244 | * @param boolean Whether to show the answer comment or not |
245 | + * @param integer $answerType |
|
246 | + * @param string $answer |
|
247 | + * @param string $answerComment |
|
248 | + * @param integer $answerCorrect |
|
249 | + * @param integer $id |
|
250 | + * @param integer $questionId |
|
227 | 251 | * @return void |
228 | 252 | */ |
229 | 253 | static function display_unique_or_multiple_answer( |
@@ -308,6 +332,13 @@ discard block |
||
308 | 332 | * @param integer Exercise ID |
309 | 333 | * @param integer Question ID |
310 | 334 | * @param boolean Whether to show the answer comment or not |
335 | + * @param integer $feedback_type |
|
336 | + * @param integer $answerType |
|
337 | + * @param string $answer |
|
338 | + * @param string $answerComment |
|
339 | + * @param integer $answerCorrect |
|
340 | + * @param integer $id |
|
341 | + * @param integer $questionId |
|
311 | 342 | * @return void |
312 | 343 | */ |
313 | 344 | static function display_multiple_answer_true_false( |
@@ -398,6 +429,13 @@ discard block |
||
398 | 429 | * @param integer Exercise ID |
399 | 430 | * @param integer Question ID |
400 | 431 | * @param boolean Whether to show the answer comment or not |
432 | + * @param integer $feedback_type |
|
433 | + * @param integer $answerType |
|
434 | + * @param string $answer |
|
435 | + * @param string $answerComment |
|
436 | + * @param integer $answerCorrect |
|
437 | + * @param integer $id |
|
438 | + * @param integer $questionId |
|
401 | 439 | * @return void |
402 | 440 | */ |
403 | 441 | static function display_multiple_answer_combination_true_false( |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | </td> |
46 | 46 | |
47 | 47 | <?php |
48 | - if (!api_is_allowed_to_edit(null,true) && $feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
|
48 | + if (!api_is_allowed_to_edit(null, true) && $feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
|
49 | 49 | <td> |
50 | 50 | <?php |
51 | 51 | $comm = Event::get_comments($id, $questionId); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | static function display_calculated_answer($feedback_type, $answer, $id, $questionId) |
68 | 68 | { |
69 | 69 | if (empty($id)) { |
70 | - echo '<tr><td>'. (Security::remove_XSS($answer)).'</td></tr>'; |
|
70 | + echo '<tr><td>'.(Security::remove_XSS($answer)).'</td></tr>'; |
|
71 | 71 | } else { |
72 | 72 | ?> |
73 | 73 | <tr> |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | </td> |
79 | 79 | |
80 | 80 | <?php |
81 | - if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
|
81 | + if (!api_is_allowed_to_edit(null, true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
|
82 | 82 | <td> |
83 | 83 | <?php |
84 | - $comm = Event::get_comments($id,$questionId); |
|
84 | + $comm = Event::get_comments($id, $questionId); |
|
85 | 85 | ?> |
86 | 86 | </td> |
87 | 87 | <?php } ?> |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | echo '</tr>'; |
130 | 130 | if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { |
131 | 131 | echo '<tr>'; |
132 | - echo Display::tag('td',get_lang('notCorrectedYet'), array('width'=>'45%')); |
|
132 | + echo Display::tag('td', get_lang('notCorrectedYet'), array('width'=>'45%')); |
|
133 | 133 | echo '</tr>'; |
134 | 134 | } else { |
135 | 135 | echo '<tr><td> </td></tr>'; |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | } |
143 | 143 | echo '</td>'; |
144 | 144 | |
145 | - if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { |
|
145 | + if (!api_is_allowed_to_edit(null, true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { |
|
146 | 146 | echo '<td>'; |
147 | - $comm = Event::get_comments($id,$questionId); |
|
147 | + $comm = Event::get_comments($id, $questionId); |
|
148 | 148 | echo '</td>'; |
149 | 149 | } |
150 | 150 | echo '</tr>'; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | <td class="text-left" width="10%"> |
194 | 194 | <?php |
195 | 195 | if (!$hide_expected_answer) { |
196 | - $my_choice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); |
|
196 | + $my_choice = ($studentChoice) ? get_lang('Correct') : get_lang('Fault'); |
|
197 | 197 | echo $my_choice; |
198 | 198 | } |
199 | 199 | ?> |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | } |
285 | 285 | } |
286 | 286 | echo '</td>'; |
287 | - if ($ans==1) { |
|
288 | - $comm = Event::get_comments($id,$questionId); |
|
287 | + if ($ans == 1) { |
|
288 | + $comm = Event::get_comments($id, $questionId); |
|
289 | 289 | } |
290 | 290 | } else { |
291 | 291 | echo '<td> </td>'; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | <td width="5%"> |
328 | 328 | <?php |
329 | 329 | |
330 | - $question = new MultipleAnswerTrueFalse(); |
|
330 | + $question = new MultipleAnswerTrueFalse(); |
|
331 | 331 | $course_id = api_get_course_int_id(); |
332 | 332 | $new_options = Question::readQuestionOption($questionId, $course_id); |
333 | 333 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | ?> |
373 | 373 | </td> |
374 | 374 | <?php |
375 | - if ($ans==1) { |
|
375 | + if ($ans == 1) { |
|
376 | 376 | $comm = Event::get_comments($id, $questionId); |
377 | 377 | } |
378 | 378 | ?> |
@@ -470,8 +470,8 @@ discard block |
||
470 | 470 | ?> |
471 | 471 | </td> |
472 | 472 | <?php |
473 | - if ($ans==1) { |
|
474 | - $comm = Event::get_comments($id,$questionId); |
|
473 | + if ($ans == 1) { |
|
474 | + $comm = Event::get_comments($id, $questionId); |
|
475 | 475 | } |
476 | 476 | ?> |
477 | 477 | <?php } else { ?> |
@@ -434,8 +434,7 @@ |
||
434 | 434 | } else { |
435 | 435 | echo $question->options[2]; |
436 | 436 | } |
437 | - } |
|
438 | - else { |
|
437 | + } else { |
|
439 | 438 | echo '-'; |
440 | 439 | } |
441 | 440 | ?> |
@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | * @todo convert queries to use Database API |
13 | 13 | */ |
14 | 14 | /** |
15 | - * Class |
|
16 | - * @package chamilo.library |
|
17 | - */ |
|
15 | + * Class |
|
16 | + * @package chamilo.library |
|
17 | + */ |
|
18 | 18 | class ExerciseShowFunctions |
19 | 19 | { |
20 | - /** |
|
21 | - * Shows the answer to a fill-in-the-blanks question, as HTML |
|
22 | - * @param string Answer text |
|
23 | - * @param int Exercise ID |
|
24 | - * @param int Question ID |
|
20 | + /** |
|
21 | + * Shows the answer to a fill-in-the-blanks question, as HTML |
|
22 | + * @param string Answer text |
|
23 | + * @param int Exercise ID |
|
24 | + * @param int Question ID |
|
25 | 25 | * @param int $resultsDisabled |
26 | 26 | * @param string $originalStudentAnswer |
27 | - * @return void |
|
28 | - */ |
|
29 | - public static function display_fill_in_blanks_answer($feedbackType, $answer, $id, $questionId, $resultsDisabled, $originalStudentAnswer = '') |
|
27 | + * @return void |
|
28 | + */ |
|
29 | + public static function display_fill_in_blanks_answer($feedbackType, $answer, $id, $questionId, $resultsDisabled, $originalStudentAnswer = '') |
|
30 | 30 | { |
31 | 31 | $answerHTML = FillBlanks::getHtmlDisplayForAnswer($answer, $resultsDisabled); |
32 | 32 | if (strpos($originalStudentAnswer, 'font color') !== false) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | </tr> |
56 | 56 | <?php |
57 | 57 | } |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Shows the answer to a calculated question, as HTML |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | - /** |
|
94 | - * Shows the answer to a free-answer question, as HTML |
|
95 | - * @param string Answer text |
|
96 | - * @param int Exercise ID |
|
97 | - * @param int Question ID |
|
98 | - * @return void |
|
99 | - */ |
|
100 | - static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null) |
|
93 | + /** |
|
94 | + * Shows the answer to a free-answer question, as HTML |
|
95 | + * @param string Answer text |
|
96 | + * @param int Exercise ID |
|
97 | + * @param int Question ID |
|
98 | + * @return void |
|
99 | + */ |
|
100 | + static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null) |
|
101 | 101 | { |
102 | 102 | $comments = Event::get_comments($exe_id, $questionId); |
103 | 103 | |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | echo '</tr>'; |
116 | 116 | } |
117 | 117 | } |
118 | - } |
|
118 | + } |
|
119 | 119 | |
120 | - static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $nano = null) |
|
120 | + static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $nano = null) |
|
121 | 121 | { |
122 | 122 | if (isset($nano)) { |
123 | 123 | echo $nano->show_audio_file(); |
@@ -151,22 +151,22 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - /** |
|
155 | - * Displays the answer to a hotspot question |
|
156 | - * |
|
157 | - * @param int $answerId |
|
158 | - * @param string $answer |
|
159 | - * @param string $studentChoice |
|
160 | - * @param string $answerComment |
|
161 | - */ |
|
162 | - static function display_hotspot_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment, $in_results_disabled) |
|
163 | - { |
|
154 | + /** |
|
155 | + * Displays the answer to a hotspot question |
|
156 | + * |
|
157 | + * @param int $answerId |
|
158 | + * @param string $answer |
|
159 | + * @param string $studentChoice |
|
160 | + * @param string $answerComment |
|
161 | + */ |
|
162 | + static function display_hotspot_answer($feedback_type, $answerId, $answer, $studentChoice, $answerComment, $in_results_disabled) |
|
163 | + { |
|
164 | 164 | $hide_expected_answer = false; |
165 | 165 | if ($feedback_type == 0 && $in_results_disabled == 2) { |
166 | 166 | $hide_expected_answer = true; |
167 | 167 | } |
168 | 168 | |
169 | - $hotspot_colors = array( |
|
169 | + $hotspot_colors = array( |
|
170 | 170 | "", // $i starts from 1 on next loop (ugly fix) |
171 | 171 | "#4271B5", |
172 | 172 | "#FE8E16", |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | "#ED2024", |
182 | 182 | "#3B3B3B", |
183 | 183 | "#F7BDE2"); |
184 | - ?> |
|
184 | + ?> |
|
185 | 185 | <table class="data_table"> |
186 | 186 | <tr> |
187 | 187 | <td class="text-center" width="5%"> |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | <td class="text-left" width="10%"> |
194 | 194 | <?php |
195 | 195 | if (!$hide_expected_answer) { |
196 | - $my_choice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); |
|
197 | - echo $my_choice; |
|
196 | + $my_choice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); |
|
197 | + echo $my_choice; |
|
198 | 198 | } |
199 | - ?> |
|
199 | + ?> |
|
200 | 200 | </td> |
201 | 201 | <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
202 | 202 | <td class="text-left" width="60%"> |
@@ -204,29 +204,29 @@ discard block |
||
204 | 204 | if ($studentChoice) { |
205 | 205 | echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
206 | 206 | } |
207 | - ?> |
|
207 | + ?> |
|
208 | 208 | </td> |
209 | 209 | <?php } else { ?> |
210 | 210 | <td class="text-left" width="60%"> </td> |
211 | 211 | <?php } ?> |
212 | 212 | </tr> |
213 | 213 | <?php |
214 | - } |
|
214 | + } |
|
215 | 215 | |
216 | - /** |
|
217 | - * Display the answers to a multiple choice question |
|
218 | - * @param int $feedback_type Feedback type |
|
219 | - * @param integer Answer type |
|
220 | - * @param integer Student choice |
|
221 | - * @param string Textual answer |
|
222 | - * @param string Comment on answer |
|
223 | - * @param string Correct answer comment |
|
224 | - * @param integer Exercise ID |
|
225 | - * @param integer Question ID |
|
226 | - * @param boolean Whether to show the answer comment or not |
|
227 | - * @return void |
|
228 | - */ |
|
229 | - static function display_unique_or_multiple_answer( |
|
216 | + /** |
|
217 | + * Display the answers to a multiple choice question |
|
218 | + * @param int $feedback_type Feedback type |
|
219 | + * @param integer Answer type |
|
220 | + * @param integer Student choice |
|
221 | + * @param string Textual answer |
|
222 | + * @param string Comment on answer |
|
223 | + * @param string Correct answer comment |
|
224 | + * @param integer Exercise ID |
|
225 | + * @param integer Question ID |
|
226 | + * @param boolean Whether to show the answer comment or not |
|
227 | + * @return void |
|
228 | + */ |
|
229 | + static function display_unique_or_multiple_answer( |
|
230 | 230 | $feedback_type, |
231 | 231 | $answerType, |
232 | 232 | $studentChoice, |
@@ -259,39 +259,39 @@ discard block |
||
259 | 259 | } else { |
260 | 260 | echo "-"; |
261 | 261 | } |
262 | - echo '</td>'; |
|
263 | - echo '<td width="40%">'; |
|
262 | + echo '</td>'; |
|
263 | + echo '<td width="40%">'; |
|
264 | 264 | echo $answer; |
265 | - echo '</td>'; |
|
265 | + echo '</td>'; |
|
266 | 266 | |
267 | 267 | if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { |
268 | - echo '<td width="20%">'; |
|
268 | + echo '<td width="20%">'; |
|
269 | 269 | if ($studentChoice) { |
270 | - if ($answerCorrect) { |
|
270 | + if ($answerCorrect) { |
|
271 | 271 | $color = 'green'; |
272 | - //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
273 | - } else { |
|
272 | + //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
273 | + } else { |
|
274 | 274 | $color = 'black'; |
275 | 275 | //echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br($answerComment).'</span>'; |
276 | - } |
|
276 | + } |
|
277 | 277 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
278 | 278 | |
279 | - } else { |
|
280 | - if ($answerCorrect) { |
|
281 | - //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
282 | - } else { |
|
279 | + } else { |
|
280 | + if ($answerCorrect) { |
|
281 | + //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
282 | + } else { |
|
283 | 283 | //echo '<span style="font-weight: normal; color: #000;">'.nl2br($answerComment).'</span>'; |
284 | - } |
|
285 | - } |
|
286 | - echo '</td>'; |
|
287 | - if ($ans==1) { |
|
288 | - $comm = Event::get_comments($id,$questionId); |
|
289 | - } |
|
284 | + } |
|
285 | + } |
|
286 | + echo '</td>'; |
|
287 | + if ($ans==1) { |
|
288 | + $comm = Event::get_comments($id,$questionId); |
|
289 | + } |
|
290 | 290 | } else { |
291 | - echo '<td> </td>'; |
|
292 | - } |
|
293 | - echo '</tr>'; |
|
294 | - } |
|
291 | + echo '<td> </td>'; |
|
292 | + } |
|
293 | + echo '</tr>'; |
|
294 | + } |
|
295 | 295 | |
296 | 296 | /** |
297 | 297 | * Display the answers to a multiple choice question |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | if (isset($new_options[$studentChoice])) { |
336 | 336 | echo get_lang($new_options[$studentChoice]['name']); |
337 | 337 | } else { |
338 | - echo '-'; |
|
338 | + echo '-'; |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | ?> |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | <td width="5%"> |
344 | 344 | <?php |
345 | 345 | |
346 | - //Expected choice |
|
346 | + //Expected choice |
|
347 | 347 | if (!$hide_expected_answer) { |
348 | 348 | if (isset($new_options[$answerCorrect])) { |
349 | 349 | echo get_lang($new_options[$answerCorrect]['name']); |
@@ -383,19 +383,19 @@ discard block |
||
383 | 383 | <?php |
384 | 384 | } |
385 | 385 | |
386 | - /** |
|
387 | - * Display the answers to a multiple choice question |
|
388 | - * |
|
389 | - * @param integer Answer type |
|
390 | - * @param integer Student choice |
|
391 | - * @param string Textual answer |
|
392 | - * @param string Comment on answer |
|
393 | - * @param string Correct answer comment |
|
394 | - * @param integer Exercise ID |
|
395 | - * @param integer Question ID |
|
396 | - * @param boolean Whether to show the answer comment or not |
|
397 | - * @return void |
|
398 | - */ |
|
386 | + /** |
|
387 | + * Display the answers to a multiple choice question |
|
388 | + * |
|
389 | + * @param integer Answer type |
|
390 | + * @param integer Student choice |
|
391 | + * @param string Textual answer |
|
392 | + * @param string Comment on answer |
|
393 | + * @param string Correct answer comment |
|
394 | + * @param integer Exercise ID |
|
395 | + * @param integer Question ID |
|
396 | + * @param boolean Whether to show the answer comment or not |
|
397 | + * @return void |
|
398 | + */ |
|
399 | 399 | static function display_multiple_answer_combination_true_false( |
400 | 400 | $feedback_type, |
401 | 401 | $answerType, |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | <tr> |
417 | 417 | <td width="5%"> |
418 | 418 | <?php |
419 | - //Your choice |
|
419 | + //Your choice |
|
420 | 420 | $question = new MultipleAnswerCombinationTrueFalse(); |
421 | 421 | if (isset($question->options[$studentChoice])) { |
422 | 422 | echo $question->options[$studentChoice]; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | </td> |
428 | 428 | <td width="5%"> |
429 | 429 | <?php |
430 | - //Expected choice |
|
430 | + //Expected choice |
|
431 | 431 | if (!$hide_expected_answer) { |
432 | 432 | if (isset($question->options[$answerCorrect])) { |
433 | 433 | echo $question->options[$answerCorrect]; |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | <?php |
453 | 453 | //@todo replace this harcoded value |
454 | 454 | if ($studentChoice) { |
455 | - $color = "black"; |
|
455 | + $color = "black"; |
|
456 | 456 | if ($studentChoice == $answerCorrect) { |
457 | 457 | $color = "green"; |
458 | 458 | } |
459 | 459 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
460 | 460 | } |
461 | 461 | if ($studentChoice == 2 || $studentChoice == '') { |
462 | - //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
462 | + //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
463 | 463 | } else { |
464 | - if ($studentChoice == $answerCorrect) { |
|
465 | - //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
466 | - } else { |
|
464 | + if ($studentChoice == $answerCorrect) { |
|
465 | + //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
466 | + } else { |
|
467 | 467 | //echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br($answerComment).'</span>'; |
468 | - } |
|
468 | + } |
|
469 | 469 | } |
470 | 470 | ?> |
471 | 471 | </td> |
@@ -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']; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $writer->setStream(fopen($filePath, 'w')); |
51 | 51 | |
52 | 52 | foreach ($data as $item) { |
53 | - $item = is_array($item) ? $item : (array)$item; |
|
53 | + $item = is_array($item) ? $item : (array) $item; |
|
54 | 54 | $writer->writeItem($item); |
55 | 55 | } |
56 | 56 | $writer->finish(); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | foreach ($data as $row) { |
102 | 102 | $string = implode("</td><td>", $row); |
103 | - $string = '<tr><td>' . $string . '</td></tr>'; |
|
103 | + $string = '<tr><td>'.$string.'</td></tr>'; |
|
104 | 104 | if ($encoding != 'utf-8') { |
105 | 105 | $string = api_convert_encoding($string, $encoding, $systemEncoding); |
106 | 106 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | fwrite($handle, '<'.$wrapper_tagname.'>'); |
175 | 175 | } |
176 | 176 | $s = self::_export_complex_table_xml_helper($data); |
177 | - fwrite($handle,$s); |
|
177 | + fwrite($handle, $s); |
|
178 | 178 | if (!is_null($wrapper_tagname)) { |
179 | 179 | fwrite($handle, '</'.$wrapper_tagname.'>'."\n"); |
180 | 180 | } |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | } |
197 | 197 | $string = ''; |
198 | 198 | foreach ($data as $row) { |
199 | - $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>'; |
|
199 | + $string .= "\n".str_repeat("\t", $level).'<'.$row['name'].'>'; |
|
200 | 200 | if (is_array($row['value'])) { |
201 | - $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
202 | - $string .= str_repeat("\t",$level).'</'.$row['name'].'>'; |
|
201 | + $string .= self::_export_complex_table_xml_helper($row['value'], $level + 1)."\n"; |
|
202 | + $string .= str_repeat("\t", $level).'</'.$row['name'].'>'; |
|
203 | 203 | } else { |
204 | 204 | $string .= $row['value']; |
205 | 205 | $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' |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | - * @return ExtraField |
|
46 | + * @return string |
|
47 | 47 | */ |
48 | 48 | public function getExtraField() |
49 | 49 | { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * This function is used with $extraField->addElements() |
73 | 73 | * @param array $params array for the insertion into the *_field_values table |
74 | 74 | * |
75 | - * @return mixed false on empty params, void otherwise |
|
75 | + * @return false|null false on empty params, void otherwise |
|
76 | 76 | * @assert (array()) === false |
77 | 77 | */ |
78 | 78 | public function saveFieldValues($params) |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | * @param int $item_id Item ID (It could be a session_id, course_id or user_id) |
501 | 501 | * @param int $field_id Field ID (the ID from the *_field table) |
502 | 502 | * @param bool $transform Whether to transform the result to a human readable strings |
503 | - * @return mixed A structured array with the field_id and field_value, or false on error |
|
503 | + * @return string A structured array with the field_id and field_value, or false on error |
|
504 | 504 | * @assert (-1,-1) === false |
505 | 505 | */ |
506 | 506 | public function get_values_by_handler_and_field_id($item_id, $field_id, $transform = false) |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | * @param int $item_id Item ID from the original table |
594 | 594 | * @param string $field_variable The name of the field we are looking for |
595 | 595 | * @param bool $transform |
596 | - * @param bool $allVisibility |
|
596 | + * @param bool $visibility |
|
597 | 597 | * |
598 | 598 | * @return mixed Array of results, or false on error or not found |
599 | 599 | * @assert (-1,'') === false |
@@ -720,11 +720,11 @@ discard block |
||
720 | 720 | return false; |
721 | 721 | } |
722 | 722 | |
723 | - /** |
|
724 | - * @param int $itemId |
|
725 | - * @param int $fieldId |
|
726 | - * @return array |
|
727 | - */ |
|
723 | + /** |
|
724 | + * @param int $itemId |
|
725 | + * @param int $fieldId |
|
726 | + * @return array |
|
727 | + */ |
|
728 | 728 | public function getAllValuesByItemAndField($itemId, $fieldId) |
729 | 729 | { |
730 | 730 | $fieldId = intval($fieldId); |
@@ -847,7 +847,6 @@ discard block |
||
847 | 847 | /** |
848 | 848 | * Deletes all values from an item |
849 | 849 | * @param int $itemId (session id, course id, etc) |
850 | - |
|
851 | 850 | * @assert (-1,-1) == null |
852 | 851 | */ |
853 | 852 | public function deleteValuesByItem($itemId) |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | break; |
210 | 210 | } |
211 | 211 | |
212 | - $fileName = ExtraField::FIELD_TYPE_FILE_IMAGE . "_{$params['item_id']}.png"; |
|
212 | + $fileName = ExtraField::FIELD_TYPE_FILE_IMAGE."_{$params['item_id']}.png"; |
|
213 | 213 | |
214 | 214 | if (!file_exists($fileDir)) { |
215 | 215 | mkdir($fileDir, $dirPermissions, true); |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | |
218 | 218 | if ($value['error'] == 0) { |
219 | 219 | $imageExtraField = new Image($value['tmp_name']); |
220 | - $imageExtraField->send_image($fileDir . $fileName, -1, 'png'); |
|
220 | + $imageExtraField->send_image($fileDir.$fileName, -1, 'png'); |
|
221 | 221 | $newParams = array( |
222 | 222 | 'item_id' => $params['item_id'], |
223 | 223 | 'field_id' => $extraFieldInfo['id'], |
224 | - 'value' => $fileDirStored . $fileName, |
|
224 | + 'value' => $fileDirStored.$fileName, |
|
225 | 225 | 'comment' => $comment |
226 | 226 | ); |
227 | 227 | |
@@ -247,18 +247,18 @@ discard block |
||
247 | 247 | } |
248 | 248 | |
249 | 249 | $cleanedName = api_replace_dangerous_char($value['name']); |
250 | - $fileName = ExtraField::FIELD_TYPE_FILE . "_{$params['item_id']}_$cleanedName"; |
|
250 | + $fileName = ExtraField::FIELD_TYPE_FILE."_{$params['item_id']}_$cleanedName"; |
|
251 | 251 | if (!file_exists($fileDir)) { |
252 | 252 | mkdir($fileDir, $dirPermissions, true); |
253 | 253 | } |
254 | 254 | |
255 | 255 | if ($value['error'] == 0) { |
256 | - moveUploadedFile($value, $fileDir . $fileName); |
|
256 | + moveUploadedFile($value, $fileDir.$fileName); |
|
257 | 257 | |
258 | 258 | $new_params = array( |
259 | 259 | 'item_id' => $params['item_id'], |
260 | 260 | 'field_id' => $extraFieldInfo['id'], |
261 | - 'value' => $fileDirStored . $fileName |
|
261 | + 'value' => $fileDirStored.$fileName |
|
262 | 262 | ); |
263 | 263 | |
264 | 264 | if ($this->type !== 'session' && $this->type !== 'course') { |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | if (false) { |
382 | 382 | global $app; |
383 | - switch($this->type) { |
|
383 | + switch ($this->type) { |
|
384 | 384 | case 'question': |
385 | 385 | $extraFieldValue = new ChamiloLMS\Entity\QuestionFieldValues(); |
386 | 386 | $extraFieldValue->setUserId(api_get_user_id()); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | */ |
443 | 443 | if (false) { |
444 | 444 | global $app; |
445 | - switch($this->type) { |
|
445 | + switch ($this->type) { |
|
446 | 446 | case 'question': |
447 | 447 | $extraFieldValue = $app['orm.ems']['db_write']->getRepository('ChamiloLMS\Entity\QuestionFieldValues')->find($field_values['id']); |
448 | 448 | $extraFieldValue->setUserId(api_get_user_id()); |
@@ -145,6 +145,7 @@ |
||
145 | 145 | |
146 | 146 | /** |
147 | 147 | * @param array $dates result of parseDateRange() |
148 | + * @param string $format |
|
148 | 149 | * |
149 | 150 | * @return bool |
150 | 151 | */ |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | class DateRangePicker extends HTML_QuickForm_text |
8 | 8 | { |
9 | 9 | /** |
10 | - * Constructor |
|
11 | - */ |
|
10 | + * Constructor |
|
11 | + */ |
|
12 | 12 | public function __construct($elementName = null, $elementLabel = null, $attributes = null) |
13 | 13 | { |
14 | 14 | if (!isset($attributes['id'])) { |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | - * @param array $dates result of parseDateRange() |
|
148 | - * |
|
149 | - * @return bool |
|
150 | - */ |
|
147 | + * @param array $dates result of parseDateRange() |
|
148 | + * |
|
149 | + * @return bool |
|
150 | + */ |
|
151 | 151 | public function validateDates($dates, $format = null) |
152 | 152 | { |
153 | 153 | if (empty($dates['start']) || empty($dates['end'])) { |
@@ -88,7 +88,7 @@ |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | $timePicker = 'true'; |
91 | - $timePickerValue = $this->getAttribute('timePicker'); |
|
91 | + $timePickerValue = $this->getAttribute('timePicker'); |
|
92 | 92 | if (!empty($timePickerValue)) { |
93 | 93 | $timePicker = $timePickerValue; |
94 | 94 | } |