@@ -2259,7 +2259,9 @@ discard block |
||
2259 | 2259 | $debug = false; |
2260 | 2260 | } |
2261 | 2261 | |
2262 | - if ($debug) echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
2262 | + if ($debug) { |
|
2263 | + echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
2264 | + } |
|
2263 | 2265 | $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
2264 | 2266 | $tbl_stats_attempts = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
2265 | 2267 | |
@@ -2336,7 +2338,9 @@ discard block |
||
2336 | 2338 | $condition_user1 AND |
2337 | 2339 | session_id = $session_id |
2338 | 2340 | GROUP BY lp_id, user_id"; |
2339 | - if ($debug) echo $sql; |
|
2341 | + if ($debug) { |
|
2342 | + echo $sql; |
|
2343 | + } |
|
2340 | 2344 | |
2341 | 2345 | $rs_last_lp_view_id = Database::query($sql); |
2342 | 2346 | |
@@ -2352,7 +2356,9 @@ discard block |
||
2352 | 2356 | $lp_view_id = $row_lp_view['id']; |
2353 | 2357 | $lp_id = $row_lp_view['lp_id']; |
2354 | 2358 | $user_id = $row_lp_view['user_id']; |
2355 | - if ($debug) echo '<h2>LP id '.$lp_id.'</h2>'; |
|
2359 | + if ($debug) { |
|
2360 | + echo '<h2>LP id '.$lp_id.'</h2>'; |
|
2361 | + } |
|
2356 | 2362 | |
2357 | 2363 | if ($get_only_latest_attempt_results) { |
2358 | 2364 | //Getting lp_items done by the user |
@@ -2409,7 +2415,9 @@ discard block |
||
2409 | 2415 | lp_i.c_id = $course_id AND |
2410 | 2416 | (lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."') |
2411 | 2417 | WHERE lp_view_id = $lp_view_id "; |
2412 | - if ($debug) echo $sql.'<br />'; |
|
2418 | + if ($debug) { |
|
2419 | + echo $sql.'<br />'; |
|
2420 | + } |
|
2413 | 2421 | $res_max_score = Database::query($sql); |
2414 | 2422 | |
2415 | 2423 | while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
@@ -2428,7 +2436,9 @@ discard block |
||
2428 | 2436 | $max_score_item_view = $row_max_score['max_score_item_view']; |
2429 | 2437 | $score = $row_max_score['score']; |
2430 | 2438 | |
2431 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2439 | + if ($debug) { |
|
2440 | + echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2441 | + } |
|
2432 | 2442 | |
2433 | 2443 | if ($row_max_score['item_type'] == 'sco') { |
2434 | 2444 | /* Check if it is sco (easier to get max_score) |
@@ -2448,7 +2458,9 @@ discard block |
||
2448 | 2458 | if (!empty($max_score)) { |
2449 | 2459 | $lp_partial_total += $score/$max_score; |
2450 | 2460 | } |
2451 | - if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2461 | + if ($debug) { |
|
2462 | + echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2463 | + } |
|
2452 | 2464 | } else { |
2453 | 2465 | // Case of a TOOL_QUIZ element |
2454 | 2466 | $item_id = $row_max_score['iid']; |
@@ -2470,12 +2482,16 @@ discard block |
||
2470 | 2482 | ORDER BY exe_date DESC |
2471 | 2483 | LIMIT 1"; |
2472 | 2484 | |
2473 | - if ($debug) echo $sql .'<br />'; |
|
2485 | + if ($debug) { |
|
2486 | + echo $sql .'<br />'; |
|
2487 | + } |
|
2474 | 2488 | $result_last_attempt = Database::query($sql); |
2475 | 2489 | $num = Database :: num_rows($result_last_attempt); |
2476 | 2490 | if ($num > 0 ) { |
2477 | 2491 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
2478 | - if ($debug) echo $id_last_attempt.'<br />'; |
|
2492 | + if ($debug) { |
|
2493 | + echo $id_last_attempt.'<br />'; |
|
2494 | + } |
|
2479 | 2495 | |
2480 | 2496 | // Within the last attempt number tracking, get the sum of |
2481 | 2497 | // the max_scores of all questions that it was |
@@ -2494,7 +2510,9 @@ discard block |
||
2494 | 2510 | q.c_id = $course_id |
2495 | 2511 | ) |
2496 | 2512 | AS t"; |
2497 | - if ($debug) echo '$sql: '.$sql.' <br />'; |
|
2513 | + if ($debug) { |
|
2514 | + echo '$sql: '.$sql.' <br />'; |
|
2515 | + } |
|
2498 | 2516 | $res_max_score_bis = Database::query($sql); |
2499 | 2517 | $row_max_score_bis = Database::fetch_array($res_max_score_bis); |
2500 | 2518 | |
@@ -2504,7 +2522,9 @@ discard block |
||
2504 | 2522 | if (!empty($max_score) && floatval($max_score) > 0) { |
2505 | 2523 | $lp_partial_total += $score/$max_score; |
2506 | 2524 | } |
2507 | - if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2525 | + if ($debug) { |
|
2526 | + echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2527 | + } |
|
2508 | 2528 | } |
2509 | 2529 | } |
2510 | 2530 | |
@@ -2517,17 +2537,25 @@ discard block |
||
2517 | 2537 | $count_items++; |
2518 | 2538 | } |
2519 | 2539 | } |
2520 | - if ($debug) echo '$count_items: '.$count_items; |
|
2540 | + if ($debug) { |
|
2541 | + echo '$count_items: '.$count_items; |
|
2542 | + } |
|
2521 | 2543 | } |
2522 | 2544 | } //end for |
2523 | 2545 | |
2524 | 2546 | $score_of_scorm_calculate += $count_items ? (($lp_partial_total / $count_items) * 100) : 0; |
2525 | 2547 | |
2526 | - if ($debug) echo '<h3>$count_items '.$count_items.'</h3>'; |
|
2527 | - if ($debug) echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
2548 | + if ($debug) { |
|
2549 | + echo '<h3>$count_items '.$count_items.'</h3>'; |
|
2550 | + } |
|
2551 | + if ($debug) { |
|
2552 | + echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
2553 | + } |
|
2528 | 2554 | |
2529 | 2555 | $global_result += $score_of_scorm_calculate; |
2530 | - if ($debug) echo '<h3>$global_result '.$global_result.'</h3>'; |
|
2556 | + if ($debug) { |
|
2557 | + echo '<h3>$global_result '.$global_result.'</h3>'; |
|
2558 | + } |
|
2531 | 2559 | } // end while |
2532 | 2560 | } |
2533 | 2561 | |
@@ -2540,7 +2568,9 @@ discard block |
||
2540 | 2568 | c_id = $course_id AND |
2541 | 2569 | (item_type = 'quiz' OR item_type = 'sco') AND |
2542 | 2570 | lp_id = ".$lp_id; |
2543 | - if ($debug) echo $sql; |
|
2571 | + if ($debug) { |
|
2572 | + echo $sql; |
|
2573 | + } |
|
2544 | 2574 | $result_have_quiz = Database::query($sql); |
2545 | 2575 | |
2546 | 2576 | if (Database::num_rows($result_have_quiz) > 0 ) { |
@@ -2551,19 +2581,29 @@ discard block |
||
2551 | 2581 | } |
2552 | 2582 | } |
2553 | 2583 | |
2554 | - if ($debug) echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
2555 | - if ($debug) echo '<h3>Final return</h3>'; |
|
2584 | + if ($debug) { |
|
2585 | + echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
2586 | + } |
|
2587 | + if ($debug) { |
|
2588 | + echo '<h3>Final return</h3>'; |
|
2589 | + } |
|
2556 | 2590 | |
2557 | 2591 | if ($lp_with_quiz != 0) { |
2558 | 2592 | if (!$return_array) { |
2559 | 2593 | $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
2560 | - if ($debug) var_dump($score_of_scorm_calculate); |
|
2594 | + if ($debug) { |
|
2595 | + var_dump($score_of_scorm_calculate); |
|
2596 | + } |
|
2561 | 2597 | if (empty($lp_ids)) { |
2562 | - if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
2598 | + if ($debug) { |
|
2599 | + echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
2600 | + } |
|
2563 | 2601 | } |
2564 | 2602 | return $score_of_scorm_calculate; |
2565 | 2603 | } else { |
2566 | - if ($debug) var_dump($global_result, $lp_with_quiz); |
|
2604 | + if ($debug) { |
|
2605 | + var_dump($global_result, $lp_with_quiz); |
|
2606 | + } |
|
2567 | 2607 | return array($global_result, $lp_with_quiz); |
2568 | 2608 | } |
2569 | 2609 | } else { |
@@ -3050,11 +3090,13 @@ discard block |
||
3050 | 3090 | |
3051 | 3091 | if (!empty ($id_session)) { |
3052 | 3092 | $sql .= ' WHERE session_course.session_id=' . $id_session; |
3053 | - if (api_is_multiple_url_enabled()) |
|
3054 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
3055 | - } else { |
|
3056 | - if (api_is_multiple_url_enabled()) |
|
3057 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3093 | + if (api_is_multiple_url_enabled()) { |
|
3094 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
3095 | + } |
|
3096 | + } else { |
|
3097 | + if (api_is_multiple_url_enabled()) { |
|
3098 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3099 | + } |
|
3058 | 3100 | } |
3059 | 3101 | |
3060 | 3102 | $result = Database::query($sql); |
@@ -3162,8 +3204,7 @@ discard block |
||
3162 | 3204 | if ($session['access_start_date'] == '0000-00-00 00:00:00' || empty($session['access_start_date']) |
3163 | 3205 | ) { |
3164 | 3206 | $session['status'] = get_lang('SessionActive'); |
3165 | - } |
|
3166 | - else { |
|
3207 | + } else { |
|
3167 | 3208 | $time_start = api_strtotime($session['access_start_date'], 'UTC'); |
3168 | 3209 | $time_end = api_strtotime($session['access_end_date'], 'UTC'); |
3169 | 3210 | if ($time_start < time() && time() < $time_end) { |
@@ -6599,8 +6640,9 @@ discard block |
||
6599 | 6640 | if (is_array($hpresults)) { |
6600 | 6641 | for($i = 0; $i < sizeof($hpresults); $i++) { |
6601 | 6642 | $title = GetQuizName($hpresults[$i][0],''); |
6602 | - if ($title == '') |
|
6603 | - $title = basename($hpresults[$i][0]); |
|
6643 | + if ($title == '') { |
|
6644 | + $title = basename($hpresults[$i][0]); |
|
6645 | + } |
|
6604 | 6646 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
6605 | 6647 | ?> |
6606 | 6648 | <tr> |
@@ -6972,8 +7014,9 @@ discard block |
||
6972 | 7014 | for($i = 0; $i < sizeof($hpresults); $i++) { |
6973 | 7015 | $title = GetQuizName($hpresults[$i][0],''); |
6974 | 7016 | |
6975 | - if ($title == '') |
|
6976 | - $title = basename($hpresults[$i][0]); |
|
7017 | + if ($title == '') { |
|
7018 | + $title = basename($hpresults[$i][0]); |
|
7019 | + } |
|
6977 | 7020 | |
6978 | 7021 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
6979 | 7022 |
@@ -1333,6 +1333,8 @@ discard block |
||
1333 | 1333 | * @param string type of time filter: 'last_week' or 'custom' |
1334 | 1334 | * @param string start date date('Y-m-d H:i:s') |
1335 | 1335 | * @param string end date date('Y-m-d H:i:s') |
1336 | + * @param string $start_date |
|
1337 | + * @param string $end_date |
|
1336 | 1338 | * @return timestamp $nb_seconds |
1337 | 1339 | */ |
1338 | 1340 | public static function get_time_spent_on_the_platform( |
@@ -1435,7 +1437,7 @@ discard block |
||
1435 | 1437 | * Get first connection date for a student |
1436 | 1438 | * @param int $student_id |
1437 | 1439 | * |
1438 | - * @return string|bool Date format long without day or false if there are no connections |
|
1440 | + * @return string|false Date format long without day or false if there are no connections |
|
1439 | 1441 | */ |
1440 | 1442 | public static function get_first_connection_date($student_id) |
1441 | 1443 | { |
@@ -1465,7 +1467,7 @@ discard block |
||
1465 | 1467 | * @param int $student_id |
1466 | 1468 | * @param bool $warning_message Show a warning message (optional) |
1467 | 1469 | * @param bool $return_timestamp True for returning results in timestamp (optional) |
1468 | - * @return string|int|bool Date format long without day, false if there are no connections or |
|
1470 | + * @return string Date format long without day, false if there are no connections or |
|
1469 | 1471 | * timestamp if parameter $return_timestamp is true |
1470 | 1472 | */ |
1471 | 1473 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
@@ -2762,6 +2764,9 @@ discard block |
||
2762 | 2764 | * @param array Limit average to listed lp ids |
2763 | 2765 | * @param int Session id (optional), if param $session_id is |
2764 | 2766 | * null(default) it'll return results including sessions, 0 = session is not filtered |
2767 | + * @param integer $student_id |
|
2768 | + * @param string $course_code |
|
2769 | + * @param integer $session_id |
|
2765 | 2770 | * @return int Total time |
2766 | 2771 | */ |
2767 | 2772 | public static function get_time_spent_in_lp($student_id, $course_code, $lp_ids = array(), $session_id = null) |
@@ -2831,6 +2836,8 @@ discard block |
||
2831 | 2836 | * @param int|array Student id(s) |
2832 | 2837 | * @param string Course code |
2833 | 2838 | * @param int Learning path id |
2839 | + * @param integer $student_id |
|
2840 | + * @param string $course_code |
|
2834 | 2841 | * @return int Total time |
2835 | 2842 | */ |
2836 | 2843 | public static function get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id = 0) |
@@ -5504,7 +5511,7 @@ discard block |
||
5504 | 5511 | |
5505 | 5512 | /** |
5506 | 5513 | * @param FormValidator $form |
5507 | - * @return mixed |
|
5514 | + * @return FormValidator |
|
5508 | 5515 | */ |
5509 | 5516 | public static function setUserSearchForm($form) |
5510 | 5517 | { |
@@ -6985,7 +6992,7 @@ discard block |
||
6985 | 6992 | * @param int $user_id |
6986 | 6993 | * @param int $course_id |
6987 | 6994 | * @param int $session_id |
6988 | - * @return array |
|
6995 | + * @return string[] |
|
6989 | 6996 | */ |
6990 | 6997 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6991 | 6998 | { |
@@ -7031,9 +7038,9 @@ discard block |
||
7031 | 7038 | /** |
7032 | 7039 | * Displays the exercise results for a specific user in a specific course. |
7033 | 7040 | * @param string $view |
7034 | - * @param int $user_id User ID |
|
7041 | + * @param int $userId User ID |
|
7035 | 7042 | * @param string $courseCode Course code |
7036 | - * @return array |
|
7043 | + * @return string[] |
|
7037 | 7044 | * @todo remove globals |
7038 | 7045 | */ |
7039 | 7046 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
@@ -314,8 +314,8 @@ discard block |
||
314 | 314 | $extend_link = ''; |
315 | 315 | if (!empty($inter_num)) { |
316 | 316 | $extend_link = Display::url( |
317 | - Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
318 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
317 | + Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
318 | + api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
319 | 319 | ); |
320 | 320 | } |
321 | 321 | $title = $row['mytitle']; |
@@ -1370,7 +1370,7 @@ discard block |
||
1370 | 1370 | $newDate = new DateTime('-30 days', new DateTimeZone('UTC')); |
1371 | 1371 | $condition_time = " AND (login_date >= '{$newDate->format('Y-m-d H:i:s')}'"; |
1372 | 1372 | $condition_time .= "AND logout_date <= '{$today->format('Y-m-d H:i:s')}') "; |
1373 | - break; |
|
1373 | + break; |
|
1374 | 1374 | case 'custom': |
1375 | 1375 | if (!empty($start_date) && !empty($end_date)) { |
1376 | 1376 | $start_date = Database::escape_string($start_date); |
@@ -1380,10 +1380,10 @@ discard block |
||
1380 | 1380 | break; |
1381 | 1381 | } |
1382 | 1382 | |
1383 | - $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
1383 | + $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
1384 | 1384 | FROM '.$tbl_track_login.' |
1385 | 1385 | WHERE '.$userCondition.$condition_time; |
1386 | - $rs = Database::query($sql); |
|
1386 | + $rs = Database::query($sql); |
|
1387 | 1387 | $row = Database::fetch_array($rs, 'ASSOC'); |
1388 | 1388 | $diff = $row['diff']; |
1389 | 1389 | |
@@ -1405,18 +1405,18 @@ discard block |
||
1405 | 1405 | public static function get_time_spent_on_the_course($user_id, $courseId, $session_id = 0) |
1406 | 1406 | { |
1407 | 1407 | $courseId = intval($courseId); |
1408 | - $session_id = intval($session_id); |
|
1409 | - |
|
1410 | - $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1411 | - if (is_array($user_id)) { |
|
1412 | - $user_id = array_map('intval', $user_id); |
|
1413 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1414 | - } else { |
|
1415 | - $user_id = intval($user_id); |
|
1416 | - $condition_user = " AND user_id = $user_id "; |
|
1417 | - } |
|
1418 | - |
|
1419 | - $sql = "SELECT |
|
1408 | + $session_id = intval($session_id); |
|
1409 | + |
|
1410 | + $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1411 | + if (is_array($user_id)) { |
|
1412 | + $user_id = array_map('intval', $user_id); |
|
1413 | + $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1414 | + } else { |
|
1415 | + $user_id = intval($user_id); |
|
1416 | + $condition_user = " AND user_id = $user_id "; |
|
1417 | + } |
|
1418 | + |
|
1419 | + $sql = "SELECT |
|
1420 | 1420 | SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds |
1421 | 1421 | FROM $tbl_track_course |
1422 | 1422 | WHERE UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) "; |
@@ -1431,9 +1431,9 @@ discard block |
||
1431 | 1431 | |
1432 | 1432 | $sql .= $condition_user; |
1433 | 1433 | $rs = Database::query($sql); |
1434 | - $row = Database::fetch_array($rs); |
|
1434 | + $row = Database::fetch_array($rs); |
|
1435 | 1435 | |
1436 | - return $row['nb_seconds']; |
|
1436 | + return $row['nb_seconds']; |
|
1437 | 1437 | } |
1438 | 1438 | |
1439 | 1439 | /** |
@@ -1444,25 +1444,25 @@ discard block |
||
1444 | 1444 | */ |
1445 | 1445 | public static function get_first_connection_date($student_id) |
1446 | 1446 | { |
1447 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1448 | - $sql = 'SELECT login_date |
|
1447 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1448 | + $sql = 'SELECT login_date |
|
1449 | 1449 | FROM ' . $tbl_track_login . ' |
1450 | 1450 | WHERE login_user_id = ' . intval($student_id) . ' |
1451 | 1451 | ORDER BY login_date ASC |
1452 | 1452 | LIMIT 0,1'; |
1453 | 1453 | |
1454 | - $rs = Database::query($sql); |
|
1455 | - if (Database::num_rows($rs)>0) { |
|
1456 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1454 | + $rs = Database::query($sql); |
|
1455 | + if (Database::num_rows($rs)>0) { |
|
1456 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1457 | 1457 | return api_convert_and_format_date( |
1458 | 1458 | $first_login_date, |
1459 | 1459 | DATE_FORMAT_SHORT, |
1460 | 1460 | date_default_timezone_get() |
1461 | 1461 | ); |
1462 | - } |
|
1463 | - } |
|
1462 | + } |
|
1463 | + } |
|
1464 | 1464 | |
1465 | - return false; |
|
1465 | + return false; |
|
1466 | 1466 | } |
1467 | 1467 | |
1468 | 1468 | /** |
@@ -1475,38 +1475,38 @@ discard block |
||
1475 | 1475 | */ |
1476 | 1476 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
1477 | 1477 | { |
1478 | - $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1479 | - $sql = 'SELECT login_date |
|
1478 | + $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1479 | + $sql = 'SELECT login_date |
|
1480 | 1480 | FROM ' . $table . ' |
1481 | 1481 | WHERE login_user_id = ' . intval($student_id) . ' |
1482 | 1482 | ORDER BY login_date |
1483 | 1483 | DESC LIMIT 0,1'; |
1484 | 1484 | |
1485 | - $rs = Database::query($sql); |
|
1486 | - if (Database::num_rows($rs) > 0) { |
|
1487 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1488 | - $last_login_date = api_get_local_time($last_login_date); |
|
1489 | - if ($return_timestamp) { |
|
1490 | - return api_strtotime($last_login_date,'UTC'); |
|
1491 | - } else { |
|
1492 | - if (!$warning_message) { |
|
1493 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1494 | - } else { |
|
1495 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1496 | - $currentTimestamp = time(); |
|
1497 | - |
|
1498 | - //If the last connection is > than 7 days, the text is red |
|
1499 | - //345600 = 7 days in seconds |
|
1500 | - if ($currentTimestamp - $timestamp > 604800) { |
|
1501 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1502 | - } else { |
|
1503 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1504 | - } |
|
1505 | - } |
|
1506 | - } |
|
1507 | - } |
|
1508 | - } |
|
1509 | - return false; |
|
1485 | + $rs = Database::query($sql); |
|
1486 | + if (Database::num_rows($rs) > 0) { |
|
1487 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1488 | + $last_login_date = api_get_local_time($last_login_date); |
|
1489 | + if ($return_timestamp) { |
|
1490 | + return api_strtotime($last_login_date,'UTC'); |
|
1491 | + } else { |
|
1492 | + if (!$warning_message) { |
|
1493 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1494 | + } else { |
|
1495 | + $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1496 | + $currentTimestamp = time(); |
|
1497 | + |
|
1498 | + //If the last connection is > than 7 days, the text is red |
|
1499 | + //345600 = 7 days in seconds |
|
1500 | + if ($currentTimestamp - $timestamp > 604800) { |
|
1501 | + return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1502 | + } else { |
|
1503 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1504 | + } |
|
1505 | + } |
|
1506 | + } |
|
1507 | + } |
|
1508 | + } |
|
1509 | + return false; |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | /** |
@@ -1560,30 +1560,30 @@ discard block |
||
1560 | 1560 | $session_id = 0, |
1561 | 1561 | $convert_date = true |
1562 | 1562 | ) { |
1563 | - $student_id = intval($student_id); |
|
1563 | + $student_id = intval($student_id); |
|
1564 | 1564 | $courseId = intval($courseId); |
1565 | - $session_id = intval($session_id); |
|
1565 | + $session_id = intval($session_id); |
|
1566 | 1566 | |
1567 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1568 | - $sql = 'SELECT login_course_date |
|
1567 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1568 | + $sql = 'SELECT login_course_date |
|
1569 | 1569 | FROM '.$tbl_track_login.' |
1570 | 1570 | WHERE |
1571 | 1571 | user_id = '.$student_id.' AND |
1572 | 1572 | c_id = '.$courseId.' AND |
1573 | 1573 | session_id = '.$session_id.' |
1574 | 1574 | ORDER BY login_course_date ASC LIMIT 0,1'; |
1575 | - $rs = Database::query($sql); |
|
1576 | - if (Database::num_rows($rs) > 0) { |
|
1577 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1578 | - if ($convert_date) { |
|
1579 | - return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
1580 | - } else { |
|
1581 | - return $first_login_date; |
|
1582 | - } |
|
1583 | - } |
|
1584 | - } |
|
1585 | - |
|
1586 | - return false; |
|
1575 | + $rs = Database::query($sql); |
|
1576 | + if (Database::num_rows($rs) > 0) { |
|
1577 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1578 | + if ($convert_date) { |
|
1579 | + return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
1580 | + } else { |
|
1581 | + return $first_login_date; |
|
1582 | + } |
|
1583 | + } |
|
1584 | + } |
|
1585 | + |
|
1586 | + return false; |
|
1587 | 1587 | } |
1588 | 1588 | |
1589 | 1589 | /** |
@@ -1599,13 +1599,13 @@ discard block |
||
1599 | 1599 | $session_id = 0, |
1600 | 1600 | $convert_date = true |
1601 | 1601 | ) { |
1602 | - // protect data |
|
1603 | - $student_id = intval($student_id); |
|
1602 | + // protect data |
|
1603 | + $student_id = intval($student_id); |
|
1604 | 1604 | $courseId = $courseInfo['real_id']; |
1605 | - $session_id = intval($session_id); |
|
1605 | + $session_id = intval($session_id); |
|
1606 | 1606 | |
1607 | - $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
1608 | - $sql = 'SELECT access_date |
|
1607 | + $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
1608 | + $sql = 'SELECT access_date |
|
1609 | 1609 | FROM '.$tbl_track_e_access.' |
1610 | 1610 | WHERE access_user_id = '.$student_id.' AND |
1611 | 1611 | c_id = "'.$courseId.'" AND |
@@ -1613,39 +1613,39 @@ discard block |
||
1613 | 1613 | ORDER BY access_date DESC |
1614 | 1614 | LIMIT 0,1'; |
1615 | 1615 | |
1616 | - $rs = Database::query($sql); |
|
1617 | - if (Database::num_rows($rs) > 0) { |
|
1618 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1616 | + $rs = Database::query($sql); |
|
1617 | + if (Database::num_rows($rs) > 0) { |
|
1618 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1619 | 1619 | if (empty($last_login_date)) { |
1620 | 1620 | return false; |
1621 | 1621 | } |
1622 | 1622 | //see #5736 |
1623 | 1623 | $last_login_date_timestamp = api_strtotime($last_login_date); |
1624 | - $now = time(); |
|
1625 | - //If the last connection is > than 7 days, the text is red |
|
1626 | - //345600 = 7 days in seconds |
|
1627 | - if ($now - $last_login_date_timestamp > 604800) { |
|
1628 | - if ($convert_date) { |
|
1624 | + $now = time(); |
|
1625 | + //If the last connection is > than 7 days, the text is red |
|
1626 | + //345600 = 7 days in seconds |
|
1627 | + if ($now - $last_login_date_timestamp > 604800) { |
|
1628 | + if ($convert_date) { |
|
1629 | 1629 | $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
1630 | 1630 | $icon = api_is_allowed_to_edit() ? |
1631 | 1631 | '<a href="'.api_get_path(WEB_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang('RemindInactiveUser').'"> |
1632 | 1632 | '.Display::return_icon('messagebox_warning.gif').' |
1633 | 1633 | </a>' |
1634 | 1634 | : null; |
1635 | - return $icon. Display::label($last_login_date, 'warning'); |
|
1636 | - } else { |
|
1637 | - return $last_login_date; |
|
1638 | - } |
|
1639 | - } else { |
|
1640 | - if ($convert_date) { |
|
1641 | - return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1642 | - } else { |
|
1643 | - return $last_login_date; |
|
1644 | - } |
|
1645 | - } |
|
1646 | - } |
|
1647 | - } |
|
1648 | - return false; |
|
1635 | + return $icon. Display::label($last_login_date, 'warning'); |
|
1636 | + } else { |
|
1637 | + return $last_login_date; |
|
1638 | + } |
|
1639 | + } else { |
|
1640 | + if ($convert_date) { |
|
1641 | + return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1642 | + } else { |
|
1643 | + return $last_login_date; |
|
1644 | + } |
|
1645 | + } |
|
1646 | + } |
|
1647 | + } |
|
1648 | + return false; |
|
1649 | 1649 | } |
1650 | 1650 | |
1651 | 1651 | /** |
@@ -1659,11 +1659,11 @@ discard block |
||
1659 | 1659 | public static function get_course_connections_count($courseId, $session_id = 0, $start = 0, $stop = null) |
1660 | 1660 | { |
1661 | 1661 | if ($start < 0) { |
1662 | - $start = 0; |
|
1663 | - } |
|
1664 | - if (!isset($stop) or ($stop < 0)) { |
|
1665 | - $stop = api_get_utc_datetime(); |
|
1666 | - } |
|
1662 | + $start = 0; |
|
1663 | + } |
|
1664 | + if (!isset($stop) or ($stop < 0)) { |
|
1665 | + $stop = api_get_utc_datetime(); |
|
1666 | + } |
|
1667 | 1667 | |
1668 | 1668 | // Given we're storing in cache, round the start and end times |
1669 | 1669 | // to the lower minute |
@@ -1672,11 +1672,11 @@ discard block |
||
1672 | 1672 | $roundedStart = Database::escape_string($roundedStart); |
1673 | 1673 | $roundedStop = Database::escape_string($roundedStop); |
1674 | 1674 | |
1675 | - $month_filter = " AND login_course_date > '$roundedStart' AND login_course_date < '$roundedStop' "; |
|
1675 | + $month_filter = " AND login_course_date > '$roundedStart' AND login_course_date < '$roundedStop' "; |
|
1676 | 1676 | |
1677 | 1677 | $courseId = intval($courseId); |
1678 | - $session_id = intval($session_id); |
|
1679 | - $count = 0; |
|
1678 | + $session_id = intval($session_id); |
|
1679 | + $count = 0; |
|
1680 | 1680 | $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
1681 | 1681 | $sql = "SELECT count(*) as count_connections |
1682 | 1682 | FROM $tbl_track_e_course_access |
@@ -1715,7 +1715,7 @@ discard block |
||
1715 | 1715 | } |
1716 | 1716 | } |
1717 | 1717 | |
1718 | - return $count; |
|
1718 | + return $count; |
|
1719 | 1719 | } |
1720 | 1720 | |
1721 | 1721 | /** |
@@ -1726,25 +1726,25 @@ discard block |
||
1726 | 1726 | */ |
1727 | 1727 | public static function count_course_per_student($user_id, $include_sessions = true) |
1728 | 1728 | { |
1729 | - $user_id = intval($user_id); |
|
1730 | - $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
1731 | - $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
1729 | + $user_id = intval($user_id); |
|
1730 | + $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
1731 | + $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
1732 | 1732 | |
1733 | - $sql = 'SELECT DISTINCT c_id |
|
1733 | + $sql = 'SELECT DISTINCT c_id |
|
1734 | 1734 | FROM ' . $tbl_course_rel_user . ' |
1735 | 1735 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
1736 | - $rs = Database::query($sql); |
|
1737 | - $nb_courses = Database::num_rows($rs); |
|
1736 | + $rs = Database::query($sql); |
|
1737 | + $nb_courses = Database::num_rows($rs); |
|
1738 | 1738 | |
1739 | - if ($include_sessions) { |
|
1740 | - $sql = 'SELECT DISTINCT c_id |
|
1739 | + if ($include_sessions) { |
|
1740 | + $sql = 'SELECT DISTINCT c_id |
|
1741 | 1741 | FROM ' . $tbl_session_course_rel_user . ' |
1742 | 1742 | WHERE user_id = ' . $user_id; |
1743 | - $rs = Database::query($sql); |
|
1744 | - $nb_courses += Database::num_rows($rs); |
|
1745 | - } |
|
1743 | + $rs = Database::query($sql); |
|
1744 | + $nb_courses += Database::num_rows($rs); |
|
1745 | + } |
|
1746 | 1746 | |
1747 | - return $nb_courses; |
|
1747 | + return $nb_courses; |
|
1748 | 1748 | } |
1749 | 1749 | |
1750 | 1750 | /** |
@@ -1775,25 +1775,25 @@ discard block |
||
1775 | 1775 | $into_lp = 0 |
1776 | 1776 | ) { |
1777 | 1777 | $course_code = Database::escape_string($course_code); |
1778 | - $course_info = api_get_course_info($course_code); |
|
1779 | - if (!empty($course_info)) { |
|
1780 | - // table definition |
|
1781 | - $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1782 | - $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1783 | - |
|
1784 | - // Compose a filter based on optional exercise given |
|
1785 | - $condition_quiz = ""; |
|
1786 | - if (!empty($exercise_id)) { |
|
1787 | - $exercise_id = intval($exercise_id); |
|
1788 | - $condition_quiz =" AND id = $exercise_id "; |
|
1789 | - } |
|
1790 | - |
|
1791 | - // Compose a filter based on optional session id given |
|
1792 | - $condition_session = ""; |
|
1793 | - if (isset($session_id)) { |
|
1794 | - $session_id = intval($session_id); |
|
1795 | - $condition_session = " AND session_id = $session_id "; |
|
1796 | - } |
|
1778 | + $course_info = api_get_course_info($course_code); |
|
1779 | + if (!empty($course_info)) { |
|
1780 | + // table definition |
|
1781 | + $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1782 | + $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1783 | + |
|
1784 | + // Compose a filter based on optional exercise given |
|
1785 | + $condition_quiz = ""; |
|
1786 | + if (!empty($exercise_id)) { |
|
1787 | + $exercise_id = intval($exercise_id); |
|
1788 | + $condition_quiz =" AND id = $exercise_id "; |
|
1789 | + } |
|
1790 | + |
|
1791 | + // Compose a filter based on optional session id given |
|
1792 | + $condition_session = ""; |
|
1793 | + if (isset($session_id)) { |
|
1794 | + $session_id = intval($session_id); |
|
1795 | + $condition_session = " AND session_id = $session_id "; |
|
1796 | + } |
|
1797 | 1797 | if ($active_filter == 1) { |
1798 | 1798 | $condition_active = 'AND active <> -1'; |
1799 | 1799 | } elseif ($active_filter == 0) { |
@@ -1809,7 +1809,7 @@ discard block |
||
1809 | 1809 | $select_lp_id = ', orig_lp_id as lp_id '; |
1810 | 1810 | } |
1811 | 1811 | |
1812 | - $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
1812 | + $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
1813 | 1813 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz "; |
1814 | 1814 | $count_quiz = 0; |
1815 | 1815 | $countQuizResult = Database::query($sql); |
@@ -1817,21 +1817,21 @@ discard block |
||
1817 | 1817 | $count_quiz = Database::fetch_row($countQuizResult); |
1818 | 1818 | } |
1819 | 1819 | |
1820 | - if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
1821 | - if (is_array($student_id)) { |
|
1820 | + if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
1821 | + if (is_array($student_id)) { |
|
1822 | 1822 | $student_id = array_map('intval', $student_id); |
1823 | - $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
1824 | - } else { |
|
1823 | + $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
1824 | + } else { |
|
1825 | 1825 | $student_id = intval($student_id); |
1826 | - $condition_user = " AND exe_user_id = '$student_id' "; |
|
1827 | - } |
|
1826 | + $condition_user = " AND exe_user_id = '$student_id' "; |
|
1827 | + } |
|
1828 | 1828 | |
1829 | - if (empty($exercise_id)) { |
|
1830 | - $sql = "SELECT id FROM $tbl_course_quiz |
|
1829 | + if (empty($exercise_id)) { |
|
1830 | + $sql = "SELECT id FROM $tbl_course_quiz |
|
1831 | 1831 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz"; |
1832 | 1832 | $result = Database::query($sql); |
1833 | 1833 | $exercise_list = array(); |
1834 | - $exercise_id = null; |
|
1834 | + $exercise_id = null; |
|
1835 | 1835 | if (!empty($result) && Database::num_rows($result)) { |
1836 | 1836 | while ($row = Database::fetch_array($result)) { |
1837 | 1837 | $exercise_list[] = $row['id']; |
@@ -1840,11 +1840,11 @@ discard block |
||
1840 | 1840 | if (!empty($exercise_list)) { |
1841 | 1841 | $exercise_id = implode("','",$exercise_list); |
1842 | 1842 | } |
1843 | - } |
|
1843 | + } |
|
1844 | 1844 | |
1845 | - $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1845 | + $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1846 | 1846 | |
1847 | - $sql = "SELECT |
|
1847 | + $sql = "SELECT |
|
1848 | 1848 | SUM(exe_result/exe_weighting*100) as avg_score, |
1849 | 1849 | COUNT(*) as num_attempts |
1850 | 1850 | $select_lp_id |
@@ -1858,20 +1858,20 @@ discard block |
||
1858 | 1858 | $condition_into_lp |
1859 | 1859 | ORDER BY exe_date DESC"; |
1860 | 1860 | |
1861 | - $res = Database::query($sql); |
|
1862 | - $row = Database::fetch_array($res); |
|
1863 | - $quiz_avg_score = null; |
|
1861 | + $res = Database::query($sql); |
|
1862 | + $row = Database::fetch_array($res); |
|
1863 | + $quiz_avg_score = null; |
|
1864 | 1864 | |
1865 | - if (!empty($row['avg_score'])) { |
|
1866 | - $quiz_avg_score = round($row['avg_score'],2); |
|
1867 | - } |
|
1865 | + if (!empty($row['avg_score'])) { |
|
1866 | + $quiz_avg_score = round($row['avg_score'],2); |
|
1867 | + } |
|
1868 | 1868 | |
1869 | - if(!empty($row['num_attempts'])) { |
|
1870 | - $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
1871 | - } |
|
1872 | - if (is_array($student_id)) { |
|
1873 | - $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
1874 | - } |
|
1869 | + if(!empty($row['num_attempts'])) { |
|
1870 | + $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
1871 | + } |
|
1872 | + if (is_array($student_id)) { |
|
1873 | + $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
1874 | + } |
|
1875 | 1875 | if ($into_lp == 0) { |
1876 | 1876 | return $quiz_avg_score; |
1877 | 1877 | } else { |
@@ -1894,9 +1894,9 @@ discard block |
||
1894 | 1894 | return array($quiz_avg_score, null); |
1895 | 1895 | } |
1896 | 1896 | } |
1897 | - } |
|
1898 | - } |
|
1899 | - return null; |
|
1897 | + } |
|
1898 | + } |
|
1899 | + return null; |
|
1900 | 1900 | } |
1901 | 1901 | |
1902 | 1902 | /** |
@@ -1929,15 +1929,15 @@ discard block |
||
1929 | 1929 | $find_all_lp = 0 |
1930 | 1930 | ) { |
1931 | 1931 | $courseId = intval($courseId); |
1932 | - $student_id = intval($student_id); |
|
1933 | - $exercise_id = intval($exercise_id); |
|
1934 | - $session_id = intval($session_id); |
|
1932 | + $student_id = intval($student_id); |
|
1933 | + $exercise_id = intval($exercise_id); |
|
1934 | + $session_id = intval($session_id); |
|
1935 | 1935 | |
1936 | - $lp_id = intval($lp_id); |
|
1936 | + $lp_id = intval($lp_id); |
|
1937 | 1937 | $lp_item_id = intval($lp_item_id); |
1938 | - $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1938 | + $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1939 | 1939 | |
1940 | - $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
1940 | + $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
1941 | 1941 | WHERE ex.c_id = $courseId |
1942 | 1942 | AND ex.exe_exo_id = $exercise_id |
1943 | 1943 | AND status = '' |
@@ -1952,11 +1952,11 @@ discard block |
||
1952 | 1952 | AND orig_lp_item_id = $lp_item_id"; |
1953 | 1953 | } |
1954 | 1954 | |
1955 | - $rs = Database::query($sql); |
|
1956 | - $row = Database::fetch_row($rs); |
|
1957 | - $count_attempts = $row[0]; |
|
1955 | + $rs = Database::query($sql); |
|
1956 | + $row = Database::fetch_row($rs); |
|
1957 | + $count_attempts = $row[0]; |
|
1958 | 1958 | |
1959 | - return $count_attempts; |
|
1959 | + return $count_attempts; |
|
1960 | 1960 | } |
1961 | 1961 | |
1962 | 1962 | /** |
@@ -1966,7 +1966,7 @@ discard block |
||
1966 | 1966 | * @param int $user_id |
1967 | 1967 | * @param int $courseId |
1968 | 1968 | * @param int $session_id |
1969 | - */ |
|
1969 | + */ |
|
1970 | 1970 | public static function get_exercise_student_progress($exercise_list, $user_id, $courseId, $session_id) |
1971 | 1971 | { |
1972 | 1972 | $courseId = intval($courseId); |
@@ -3634,8 +3634,8 @@ discard block |
||
3634 | 3634 | |
3635 | 3635 | $condition_session = ''; |
3636 | 3636 | if (isset($session_id)) { |
3637 | - $session_id = intval($session_id); |
|
3638 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3637 | + $session_id = intval($session_id); |
|
3638 | + $condition_session = ' AND f.session_id = '. $session_id; |
|
3639 | 3639 | } |
3640 | 3640 | |
3641 | 3641 | $groupId = intval($groupId); |
@@ -5564,9 +5564,9 @@ discard block |
||
5564 | 5564 | } |
5565 | 5565 | |
5566 | 5566 | /** |
5567 | - * @param FormValidator $form |
|
5568 | - * @return mixed |
|
5569 | - */ |
|
5567 | + * @param FormValidator $form |
|
5568 | + * @return mixed |
|
5569 | + */ |
|
5570 | 5570 | public static function setUserSearchForm($form) |
5571 | 5571 | { |
5572 | 5572 | global $_configuration; |
@@ -5961,26 +5961,26 @@ discard block |
||
5961 | 5961 | $session_id = api_get_session_id(); |
5962 | 5962 | $course_id = api_get_course_int_id(); |
5963 | 5963 | |
5964 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5965 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5964 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5965 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5966 | 5966 | |
5967 | - $sql = "SELECT count(tool) AS total_number_of_items |
|
5967 | + $sql = "SELECT count(tool) AS total_number_of_items |
|
5968 | 5968 | FROM $table_item_property track_resource, $table_user user |
5969 | 5969 | WHERE |
5970 | 5970 | track_resource.c_id = $course_id AND |
5971 | 5971 | track_resource.insert_user_id = user.user_id AND |
5972 | 5972 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
5973 | 5973 | |
5974 | - if (isset($_GET['keyword'])) { |
|
5975 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5976 | - $sql .= " AND ( |
|
5974 | + if (isset($_GET['keyword'])) { |
|
5975 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5976 | + $sql .= " AND ( |
|
5977 | 5977 | user.username LIKE '%".$keyword."%' OR |
5978 | 5978 | lastedit_type LIKE '%".$keyword."%' OR |
5979 | 5979 | tool LIKE '%".$keyword."%' |
5980 | 5980 | )"; |
5981 | - } |
|
5981 | + } |
|
5982 | 5982 | |
5983 | - $sql .= " AND tool IN ( |
|
5983 | + $sql .= " AND tool IN ( |
|
5984 | 5984 | 'document', |
5985 | 5985 | 'learnpath', |
5986 | 5986 | 'quiz', |
@@ -5992,10 +5992,10 @@ discard block |
||
5992 | 5992 | 'thematic_advance', |
5993 | 5993 | 'thematic_plan' |
5994 | 5994 | )"; |
5995 | - $res = Database::query($sql); |
|
5996 | - $obj = Database::fetch_object($res); |
|
5995 | + $res = Database::query($sql); |
|
5996 | + $obj = Database::fetch_object($res); |
|
5997 | 5997 | |
5998 | - return $obj->total_number_of_items; |
|
5998 | + return $obj->total_number_of_items; |
|
5999 | 5999 | } |
6000 | 6000 | |
6001 | 6001 | /** |
@@ -6010,12 +6010,12 @@ discard block |
||
6010 | 6010 | $session_id = api_get_session_id(); |
6011 | 6011 | $course_id = api_get_course_int_id(); |
6012 | 6012 | |
6013 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
6014 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
6015 | - $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
6016 | - $session_id = intval($session_id); |
|
6013 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
6014 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
6015 | + $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
6016 | + $session_id = intval($session_id); |
|
6017 | 6017 | |
6018 | - $sql = "SELECT |
|
6018 | + $sql = "SELECT |
|
6019 | 6019 | tool as col0, |
6020 | 6020 | lastedit_type as col1, |
6021 | 6021 | ref as ref, |
@@ -6029,16 +6029,16 @@ discard block |
||
6029 | 6029 | track_resource.insert_user_id = user.user_id AND |
6030 | 6030 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
6031 | 6031 | |
6032 | - if (isset($_GET['keyword'])) { |
|
6033 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
6034 | - $sql .= " AND ( |
|
6032 | + if (isset($_GET['keyword'])) { |
|
6033 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
6034 | + $sql .= " AND ( |
|
6035 | 6035 | user.username LIKE '%".$keyword."%' OR |
6036 | 6036 | lastedit_type LIKE '%".$keyword."%' OR |
6037 | 6037 | tool LIKE '%".$keyword."%' |
6038 | 6038 | ) "; |
6039 | - } |
|
6039 | + } |
|
6040 | 6040 | |
6041 | - $sql .= " AND tool IN ( |
|
6041 | + $sql .= " AND tool IN ( |
|
6042 | 6042 | 'document', |
6043 | 6043 | 'learnpath', |
6044 | 6044 | 'quiz', |
@@ -6051,41 +6051,41 @@ discard block |
||
6051 | 6051 | 'thematic_plan' |
6052 | 6052 | )"; |
6053 | 6053 | |
6054 | - if ($column == 0) { |
|
6055 | - $column = '0'; |
|
6056 | - } |
|
6057 | - if ($column != '' && $direction != '') { |
|
6058 | - if ($column != 2 && $column != 4) { |
|
6059 | - $sql .= " ORDER BY col$column $direction"; |
|
6060 | - } |
|
6061 | - } else { |
|
6062 | - $sql .= " ORDER BY col5 DESC "; |
|
6063 | - } |
|
6054 | + if ($column == 0) { |
|
6055 | + $column = '0'; |
|
6056 | + } |
|
6057 | + if ($column != '' && $direction != '') { |
|
6058 | + if ($column != 2 && $column != 4) { |
|
6059 | + $sql .= " ORDER BY col$column $direction"; |
|
6060 | + } |
|
6061 | + } else { |
|
6062 | + $sql .= " ORDER BY col5 DESC "; |
|
6063 | + } |
|
6064 | 6064 | |
6065 | 6065 | $from = intval($from); |
6066 | 6066 | $number_of_items = intval($number_of_items); |
6067 | 6067 | |
6068 | - $sql .= " LIMIT $from, $number_of_items "; |
|
6069 | - |
|
6070 | - $res = Database::query($sql); |
|
6071 | - $resources = array(); |
|
6072 | - $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
6073 | - while ($row = Database::fetch_array($res)) { |
|
6074 | - $ref = $row['ref']; |
|
6075 | - $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
6076 | - $table_tool = Database :: get_course_table($table_name['table_name']); |
|
6068 | + $sql .= " LIMIT $from, $number_of_items "; |
|
6077 | 6069 | |
6078 | - $id = $table_name['id_tool']; |
|
6079 | - $recorset = false; |
|
6080 | - |
|
6081 | - if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
6082 | - $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
6083 | - $sql = "SELECT thematic_id FROM $table_tool |
|
6070 | + $res = Database::query($sql); |
|
6071 | + $resources = array(); |
|
6072 | + $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
6073 | + while ($row = Database::fetch_array($res)) { |
|
6074 | + $ref = $row['ref']; |
|
6075 | + $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
6076 | + $table_tool = Database :: get_course_table($table_name['table_name']); |
|
6077 | + |
|
6078 | + $id = $table_name['id_tool']; |
|
6079 | + $recorset = false; |
|
6080 | + |
|
6081 | + if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
6082 | + $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
6083 | + $sql = "SELECT thematic_id FROM $table_tool |
|
6084 | 6084 | WHERE c_id = $course_id AND id = $ref"; |
6085 | - $rs_thematic = Database::query($sql); |
|
6086 | - if (Database::num_rows($rs_thematic)) { |
|
6087 | - $row_thematic = Database::fetch_array($rs_thematic); |
|
6088 | - $thematic_id = $row_thematic['thematic_id']; |
|
6085 | + $rs_thematic = Database::query($sql); |
|
6086 | + if (Database::num_rows($rs_thematic)) { |
|
6087 | + $row_thematic = Database::fetch_array($rs_thematic); |
|
6088 | + $thematic_id = $row_thematic['thematic_id']; |
|
6089 | 6089 | |
6090 | 6090 | $sql = "SELECT session.id, session.name, user.username |
6091 | 6091 | FROM $tbl_thematic t, $table_session session, $table_user user |
@@ -6094,9 +6094,9 @@ discard block |
||
6094 | 6094 | t.session_id = session.id AND |
6095 | 6095 | session.id_coach = user.user_id AND |
6096 | 6096 | t.id = $thematic_id"; |
6097 | - $recorset = Database::query($sql); |
|
6098 | - } |
|
6099 | - } else { |
|
6097 | + $recorset = Database::query($sql); |
|
6098 | + } |
|
6099 | + } else { |
|
6100 | 6100 | $sql = "SELECT session.id, session.name, user.username |
6101 | 6101 | FROM $table_tool tool, $table_session session, $table_user user |
6102 | 6102 | WHERE |
@@ -6104,134 +6104,134 @@ discard block |
||
6104 | 6104 | tool.session_id = session.id AND |
6105 | 6105 | session.id_coach = user.user_id AND |
6106 | 6106 | tool.$id = $ref"; |
6107 | - $recorset = Database::query($sql); |
|
6108 | - } |
|
6109 | - |
|
6110 | - if (!empty($recorset)) { |
|
6111 | - $obj = Database::fetch_object($recorset); |
|
6112 | - |
|
6113 | - $name_session = ''; |
|
6114 | - $coach_name = ''; |
|
6115 | - if (!empty($obj)) { |
|
6116 | - $name_session = $obj->name; |
|
6117 | - $coach_name = $obj->username; |
|
6118 | - } |
|
6119 | - |
|
6120 | - $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
6121 | - $row[0] = ''; |
|
6122 | - if ($row['col6'] != 2) { |
|
6123 | - if (in_array($row['col0'], $thematic_tools)) { |
|
6124 | - |
|
6125 | - $exp_thematic_tool = explode('_', $row['col0']); |
|
6126 | - $thematic_tool_title = ''; |
|
6127 | - if (is_array($exp_thematic_tool)) { |
|
6128 | - foreach ($exp_thematic_tool as $exp) { |
|
6129 | - $thematic_tool_title .= api_ucfirst($exp); |
|
6130 | - } |
|
6131 | - } else { |
|
6132 | - $thematic_tool_title = api_ucfirst($row['col0']); |
|
6133 | - } |
|
6134 | - |
|
6135 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
6136 | - } else { |
|
6137 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
6138 | - } |
|
6139 | - } else { |
|
6140 | - $row[0] = api_ucfirst($row['col0']); |
|
6141 | - } |
|
6142 | - $row[1] = get_lang($row[1]); |
|
6143 | - $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
6144 | - $row[5] = ''; |
|
6145 | - //@todo Improve this code please |
|
6146 | - switch ($table_name['table_name']) { |
|
6147 | - case 'document': |
|
6148 | - $sql = "SELECT tool.title as title FROM $table_tool tool |
|
6107 | + $recorset = Database::query($sql); |
|
6108 | + } |
|
6109 | + |
|
6110 | + if (!empty($recorset)) { |
|
6111 | + $obj = Database::fetch_object($recorset); |
|
6112 | + |
|
6113 | + $name_session = ''; |
|
6114 | + $coach_name = ''; |
|
6115 | + if (!empty($obj)) { |
|
6116 | + $name_session = $obj->name; |
|
6117 | + $coach_name = $obj->username; |
|
6118 | + } |
|
6119 | + |
|
6120 | + $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
6121 | + $row[0] = ''; |
|
6122 | + if ($row['col6'] != 2) { |
|
6123 | + if (in_array($row['col0'], $thematic_tools)) { |
|
6124 | + |
|
6125 | + $exp_thematic_tool = explode('_', $row['col0']); |
|
6126 | + $thematic_tool_title = ''; |
|
6127 | + if (is_array($exp_thematic_tool)) { |
|
6128 | + foreach ($exp_thematic_tool as $exp) { |
|
6129 | + $thematic_tool_title .= api_ucfirst($exp); |
|
6130 | + } |
|
6131 | + } else { |
|
6132 | + $thematic_tool_title = api_ucfirst($row['col0']); |
|
6133 | + } |
|
6134 | + |
|
6135 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
6136 | + } else { |
|
6137 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
6138 | + } |
|
6139 | + } else { |
|
6140 | + $row[0] = api_ucfirst($row['col0']); |
|
6141 | + } |
|
6142 | + $row[1] = get_lang($row[1]); |
|
6143 | + $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
6144 | + $row[5] = ''; |
|
6145 | + //@todo Improve this code please |
|
6146 | + switch ($table_name['table_name']) { |
|
6147 | + case 'document': |
|
6148 | + $sql = "SELECT tool.title as title FROM $table_tool tool |
|
6149 | 6149 | WHERE c_id = $course_id AND id = $ref"; |
6150 | - $rs_document = Database::query($sql); |
|
6151 | - $obj_document = Database::fetch_object($rs_document); |
|
6150 | + $rs_document = Database::query($sql); |
|
6151 | + $obj_document = Database::fetch_object($rs_document); |
|
6152 | 6152 | if ($obj_document) { |
6153 | 6153 | $row[5] = $obj_document->title; |
6154 | 6154 | } |
6155 | - break; |
|
6156 | - case 'announcement': |
|
6155 | + break; |
|
6156 | + case 'announcement': |
|
6157 | 6157 | $sql = "SELECT title FROM $table_tool |
6158 | 6158 | WHERE c_id = $course_id AND id = $ref"; |
6159 | - $rs_document = Database::query($sql); |
|
6160 | - $obj_document = Database::fetch_object($rs_document); |
|
6159 | + $rs_document = Database::query($sql); |
|
6160 | + $obj_document = Database::fetch_object($rs_document); |
|
6161 | 6161 | if ($obj_document) { |
6162 | 6162 | $row[5] = $obj_document->title; |
6163 | 6163 | } |
6164 | - break; |
|
6165 | - case 'glossary': |
|
6164 | + break; |
|
6165 | + case 'glossary': |
|
6166 | 6166 | $sql = "SELECT name FROM $table_tool |
6167 | 6167 | WHERE c_id = $course_id AND glossary_id = $ref"; |
6168 | - $rs_document = Database::query($sql); |
|
6169 | - $obj_document = Database::fetch_object($rs_document); |
|
6168 | + $rs_document = Database::query($sql); |
|
6169 | + $obj_document = Database::fetch_object($rs_document); |
|
6170 | 6170 | if ($obj_document) { |
6171 | 6171 | $row[5] = $obj_document->name; |
6172 | 6172 | } |
6173 | - break; |
|
6174 | - case 'lp': |
|
6173 | + break; |
|
6174 | + case 'lp': |
|
6175 | 6175 | $sql = "SELECT name |
6176 | 6176 | FROM $table_tool WHERE c_id = $course_id AND id = $ref"; |
6177 | - $rs_document = Database::query($sql); |
|
6178 | - $obj_document = Database::fetch_object($rs_document); |
|
6179 | - $row[5] = $obj_document->name; |
|
6180 | - break; |
|
6181 | - case 'quiz': |
|
6177 | + $rs_document = Database::query($sql); |
|
6178 | + $obj_document = Database::fetch_object($rs_document); |
|
6179 | + $row[5] = $obj_document->name; |
|
6180 | + break; |
|
6181 | + case 'quiz': |
|
6182 | 6182 | $sql = "SELECT title FROM $table_tool |
6183 | 6183 | WHERE c_id = $course_id AND id = $ref"; |
6184 | - $rs_document = Database::query($sql); |
|
6185 | - $obj_document = Database::fetch_object($rs_document); |
|
6184 | + $rs_document = Database::query($sql); |
|
6185 | + $obj_document = Database::fetch_object($rs_document); |
|
6186 | 6186 | if ($obj_document) { |
6187 | 6187 | $row[5] = $obj_document->title; |
6188 | 6188 | } |
6189 | - break; |
|
6190 | - case 'course_description': |
|
6189 | + break; |
|
6190 | + case 'course_description': |
|
6191 | 6191 | $sql = "SELECT title FROM $table_tool |
6192 | 6192 | WHERE c_id = $course_id AND id = $ref"; |
6193 | - $rs_document = Database::query($sql); |
|
6194 | - $obj_document = Database::fetch_object($rs_document); |
|
6193 | + $rs_document = Database::query($sql); |
|
6194 | + $obj_document = Database::fetch_object($rs_document); |
|
6195 | 6195 | if ($obj_document) { |
6196 | 6196 | $row[5] = $obj_document->title; |
6197 | 6197 | } |
6198 | - break; |
|
6199 | - case 'thematic': |
|
6200 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6201 | - if (Database::num_rows($rs) > 0) { |
|
6202 | - $obj = Database::fetch_object($rs); |
|
6198 | + break; |
|
6199 | + case 'thematic': |
|
6200 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6201 | + if (Database::num_rows($rs) > 0) { |
|
6202 | + $obj = Database::fetch_object($rs); |
|
6203 | 6203 | if ($obj) { |
6204 | 6204 | $row[5] = $obj->title; |
6205 | 6205 | } |
6206 | - } |
|
6207 | - break; |
|
6208 | - case 'thematic_advance': |
|
6209 | - $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6210 | - if (Database::num_rows($rs) > 0) { |
|
6211 | - $obj = Database::fetch_object($rs); |
|
6206 | + } |
|
6207 | + break; |
|
6208 | + case 'thematic_advance': |
|
6209 | + $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6210 | + if (Database::num_rows($rs) > 0) { |
|
6211 | + $obj = Database::fetch_object($rs); |
|
6212 | 6212 | if ($obj) { |
6213 | 6213 | $row[5] = $obj->content; |
6214 | 6214 | } |
6215 | - } |
|
6216 | - break; |
|
6217 | - case 'thematic_plan': |
|
6218 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6219 | - if (Database::num_rows($rs) > 0) { |
|
6220 | - $obj = Database::fetch_object($rs); |
|
6215 | + } |
|
6216 | + break; |
|
6217 | + case 'thematic_plan': |
|
6218 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6219 | + if (Database::num_rows($rs) > 0) { |
|
6220 | + $obj = Database::fetch_object($rs); |
|
6221 | 6221 | if ($obj) { |
6222 | 6222 | $row[5] = $obj->title; |
6223 | 6223 | } |
6224 | - } |
|
6225 | - break; |
|
6226 | - default: |
|
6227 | - break; |
|
6228 | - } |
|
6229 | - |
|
6230 | - $row2 = $name_session; |
|
6231 | - if (!empty($coach_name)) { |
|
6232 | - $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
6233 | - } |
|
6234 | - $row[2] = $row2; |
|
6224 | + } |
|
6225 | + break; |
|
6226 | + default: |
|
6227 | + break; |
|
6228 | + } |
|
6229 | + |
|
6230 | + $row2 = $name_session; |
|
6231 | + if (!empty($coach_name)) { |
|
6232 | + $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
6233 | + } |
|
6234 | + $row[2] = $row2; |
|
6235 | 6235 | if (!empty($row['col3'])) { |
6236 | 6236 | $userInfo = api_get_user_info($row['user_id']); |
6237 | 6237 | $row['col3'] = Display::url( |
@@ -6247,11 +6247,11 @@ discard block |
||
6247 | 6247 | $row[4] = $ip; |
6248 | 6248 | } |
6249 | 6249 | |
6250 | - $resources[] = $row; |
|
6251 | - } |
|
6252 | - } |
|
6250 | + $resources[] = $row; |
|
6251 | + } |
|
6252 | + } |
|
6253 | 6253 | |
6254 | - return $resources; |
|
6254 | + return $resources; |
|
6255 | 6255 | } |
6256 | 6256 | |
6257 | 6257 | /** |
@@ -6261,63 +6261,63 @@ discard block |
||
6261 | 6261 | */ |
6262 | 6262 | public static function get_tool_name_table($tool) |
6263 | 6263 | { |
6264 | - switch ($tool) { |
|
6265 | - case 'document': |
|
6266 | - $table_name = TABLE_DOCUMENT; |
|
6267 | - $link_tool = 'document/document.php'; |
|
6268 | - $id_tool = 'id'; |
|
6269 | - break; |
|
6270 | - case 'learnpath': |
|
6271 | - $table_name = TABLE_LP_MAIN; |
|
6272 | - $link_tool = 'lp/lp_controller.php'; |
|
6273 | - $id_tool = 'id'; |
|
6274 | - break; |
|
6275 | - case 'quiz': |
|
6276 | - $table_name = TABLE_QUIZ_TEST; |
|
6277 | - $link_tool = 'exercise/exercise.php'; |
|
6278 | - $id_tool = 'id'; |
|
6279 | - break; |
|
6280 | - case 'glossary': |
|
6281 | - $table_name = TABLE_GLOSSARY; |
|
6282 | - $link_tool = 'glossary/index.php'; |
|
6283 | - $id_tool = 'glossary_id'; |
|
6284 | - break; |
|
6285 | - case 'link': |
|
6286 | - $table_name = TABLE_LINK; |
|
6287 | - $link_tool = 'link/link.php'; |
|
6288 | - $id_tool = 'id'; |
|
6289 | - break; |
|
6290 | - case 'course_description': |
|
6291 | - $table_name = TABLE_COURSE_DESCRIPTION; |
|
6292 | - $link_tool = 'course_description/'; |
|
6293 | - $id_tool = 'id'; |
|
6294 | - break; |
|
6295 | - case 'announcement': |
|
6296 | - $table_name = TABLE_ANNOUNCEMENT; |
|
6297 | - $link_tool = 'announcements/announcements.php'; |
|
6298 | - $id_tool = 'id'; |
|
6299 | - break; |
|
6300 | - case 'thematic': |
|
6301 | - $table_name = TABLE_THEMATIC; |
|
6302 | - $link_tool = 'course_progress/index.php'; |
|
6303 | - $id_tool = 'id'; |
|
6304 | - break; |
|
6305 | - case 'thematic_advance': |
|
6306 | - $table_name = TABLE_THEMATIC_ADVANCE; |
|
6307 | - $link_tool = 'course_progress/index.php'; |
|
6308 | - $id_tool = 'id'; |
|
6309 | - break; |
|
6310 | - case 'thematic_plan': |
|
6311 | - $table_name = TABLE_THEMATIC_PLAN; |
|
6312 | - $link_tool = 'course_progress/index.php'; |
|
6313 | - $id_tool = 'id'; |
|
6314 | - break; |
|
6315 | - default: |
|
6316 | - $table_name = $tool; |
|
6317 | - break; |
|
6318 | - } |
|
6319 | - |
|
6320 | - return array( |
|
6264 | + switch ($tool) { |
|
6265 | + case 'document': |
|
6266 | + $table_name = TABLE_DOCUMENT; |
|
6267 | + $link_tool = 'document/document.php'; |
|
6268 | + $id_tool = 'id'; |
|
6269 | + break; |
|
6270 | + case 'learnpath': |
|
6271 | + $table_name = TABLE_LP_MAIN; |
|
6272 | + $link_tool = 'lp/lp_controller.php'; |
|
6273 | + $id_tool = 'id'; |
|
6274 | + break; |
|
6275 | + case 'quiz': |
|
6276 | + $table_name = TABLE_QUIZ_TEST; |
|
6277 | + $link_tool = 'exercise/exercise.php'; |
|
6278 | + $id_tool = 'id'; |
|
6279 | + break; |
|
6280 | + case 'glossary': |
|
6281 | + $table_name = TABLE_GLOSSARY; |
|
6282 | + $link_tool = 'glossary/index.php'; |
|
6283 | + $id_tool = 'glossary_id'; |
|
6284 | + break; |
|
6285 | + case 'link': |
|
6286 | + $table_name = TABLE_LINK; |
|
6287 | + $link_tool = 'link/link.php'; |
|
6288 | + $id_tool = 'id'; |
|
6289 | + break; |
|
6290 | + case 'course_description': |
|
6291 | + $table_name = TABLE_COURSE_DESCRIPTION; |
|
6292 | + $link_tool = 'course_description/'; |
|
6293 | + $id_tool = 'id'; |
|
6294 | + break; |
|
6295 | + case 'announcement': |
|
6296 | + $table_name = TABLE_ANNOUNCEMENT; |
|
6297 | + $link_tool = 'announcements/announcements.php'; |
|
6298 | + $id_tool = 'id'; |
|
6299 | + break; |
|
6300 | + case 'thematic': |
|
6301 | + $table_name = TABLE_THEMATIC; |
|
6302 | + $link_tool = 'course_progress/index.php'; |
|
6303 | + $id_tool = 'id'; |
|
6304 | + break; |
|
6305 | + case 'thematic_advance': |
|
6306 | + $table_name = TABLE_THEMATIC_ADVANCE; |
|
6307 | + $link_tool = 'course_progress/index.php'; |
|
6308 | + $id_tool = 'id'; |
|
6309 | + break; |
|
6310 | + case 'thematic_plan': |
|
6311 | + $table_name = TABLE_THEMATIC_PLAN; |
|
6312 | + $link_tool = 'course_progress/index.php'; |
|
6313 | + $id_tool = 'id'; |
|
6314 | + break; |
|
6315 | + default: |
|
6316 | + $table_name = $tool; |
|
6317 | + break; |
|
6318 | + } |
|
6319 | + |
|
6320 | + return array( |
|
6321 | 6321 | 'table_name' => $table_name, |
6322 | 6322 | 'link_tool' => $link_tool, |
6323 | 6323 | 'id_tool' => $id_tool |
@@ -6326,45 +6326,45 @@ discard block |
||
6326 | 6326 | |
6327 | 6327 | public static function display_additional_profile_fields() |
6328 | 6328 | { |
6329 | - // getting all the extra profile fields that are defined by the platform administrator |
|
6330 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6331 | - |
|
6332 | - // creating the form |
|
6333 | - $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
6334 | - |
|
6335 | - // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
6336 | - // the information the users have entered or selected. |
|
6337 | - $return .= '<select name="additional_profile_field">'; |
|
6338 | - $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
6339 | - $extra_fields_to_show = 0; |
|
6340 | - foreach ($extra_fields as $key=>$field) { |
|
6341 | - // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
6342 | - if ($field[6]==1 && $field[8] == 1) { |
|
6343 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6344 | - $selected = 'selected="selected"'; |
|
6345 | - } else { |
|
6346 | - $selected = ''; |
|
6347 | - } |
|
6348 | - $extra_fields_to_show++; |
|
6349 | - $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
6350 | - } |
|
6351 | - } |
|
6352 | - $return .= '</select>'; |
|
6353 | - |
|
6354 | - // the form elements for the $_GET parameters (because the form is passed through GET |
|
6355 | - foreach ($_GET as $key=>$value){ |
|
6356 | - if ($key <> 'additional_profile_field') { |
|
6357 | - $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
6358 | - } |
|
6359 | - } |
|
6360 | - // the submit button |
|
6361 | - $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
6362 | - $return .= '</form>'; |
|
6363 | - if ($extra_fields_to_show > 0) { |
|
6364 | - return $return; |
|
6365 | - } else { |
|
6366 | - return ''; |
|
6367 | - } |
|
6329 | + // getting all the extra profile fields that are defined by the platform administrator |
|
6330 | + $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6331 | + |
|
6332 | + // creating the form |
|
6333 | + $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
6334 | + |
|
6335 | + // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
6336 | + // the information the users have entered or selected. |
|
6337 | + $return .= '<select name="additional_profile_field">'; |
|
6338 | + $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
6339 | + $extra_fields_to_show = 0; |
|
6340 | + foreach ($extra_fields as $key=>$field) { |
|
6341 | + // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
6342 | + if ($field[6]==1 && $field[8] == 1) { |
|
6343 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6344 | + $selected = 'selected="selected"'; |
|
6345 | + } else { |
|
6346 | + $selected = ''; |
|
6347 | + } |
|
6348 | + $extra_fields_to_show++; |
|
6349 | + $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
6350 | + } |
|
6351 | + } |
|
6352 | + $return .= '</select>'; |
|
6353 | + |
|
6354 | + // the form elements for the $_GET parameters (because the form is passed through GET |
|
6355 | + foreach ($_GET as $key=>$value){ |
|
6356 | + if ($key <> 'additional_profile_field') { |
|
6357 | + $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
6358 | + } |
|
6359 | + } |
|
6360 | + // the submit button |
|
6361 | + $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
6362 | + $return .= '</form>'; |
|
6363 | + if ($extra_fields_to_show > 0) { |
|
6364 | + return $return; |
|
6365 | + } else { |
|
6366 | + return ''; |
|
6367 | + } |
|
6368 | 6368 | } |
6369 | 6369 | |
6370 | 6370 | /** |
@@ -6383,31 +6383,31 @@ discard block |
||
6383 | 6383 | */ |
6384 | 6384 | public static function get_addtional_profile_information_of_field_by_user($field_id, $users) |
6385 | 6385 | { |
6386 | - // Database table definition |
|
6387 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6388 | - $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
6386 | + // Database table definition |
|
6387 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6388 | + $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
6389 | 6389 | $extraField = Database::get_main_table(TABLE_EXTRA_FIELD); |
6390 | - $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
6391 | - |
|
6392 | - if (!empty($users)) { |
|
6393 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6394 | - foreach($users as $user_id) { |
|
6395 | - $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
6396 | - $tag_list = array(); |
|
6397 | - foreach($user_result as $item) { |
|
6398 | - $tag_list[] = $item['tag']; |
|
6399 | - } |
|
6400 | - $return[$user_id][] = implode(', ',$tag_list); |
|
6401 | - } |
|
6402 | - } else { |
|
6403 | - $new_user_array = array(); |
|
6404 | - foreach ($users as $user_id) { |
|
6405 | - $new_user_array[]= "'".$user_id."'"; |
|
6406 | - } |
|
6407 | - $users = implode(',',$new_user_array); |
|
6390 | + $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
6391 | + |
|
6392 | + if (!empty($users)) { |
|
6393 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6394 | + foreach($users as $user_id) { |
|
6395 | + $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
6396 | + $tag_list = array(); |
|
6397 | + foreach($user_result as $item) { |
|
6398 | + $tag_list[] = $item['tag']; |
|
6399 | + } |
|
6400 | + $return[$user_id][] = implode(', ',$tag_list); |
|
6401 | + } |
|
6402 | + } else { |
|
6403 | + $new_user_array = array(); |
|
6404 | + foreach ($users as $user_id) { |
|
6405 | + $new_user_array[]= "'".$user_id."'"; |
|
6406 | + } |
|
6407 | + $users = implode(',',$new_user_array); |
|
6408 | 6408 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
6409 | - // Selecting only the necessary information NOT ALL the user list |
|
6410 | - $sql = "SELECT user.user_id, v.value |
|
6409 | + // Selecting only the necessary information NOT ALL the user list |
|
6410 | + $sql = "SELECT user.user_id, v.value |
|
6411 | 6411 | FROM $table_user user |
6412 | 6412 | INNER JOIN $table_user_field_values v |
6413 | 6413 | ON (user.user_id = v.item_id) |
@@ -6418,27 +6418,27 @@ discard block |
||
6418 | 6418 | v.field_id=".intval($field_id)." AND |
6419 | 6419 | user.user_id IN ($users)"; |
6420 | 6420 | |
6421 | - $result = Database::query($sql); |
|
6422 | - while($row = Database::fetch_array($result)) { |
|
6423 | - // get option value for field type double select by id |
|
6424 | - if (!empty($row['value'])) { |
|
6425 | - if ($result_extra_field['field_type'] == |
|
6421 | + $result = Database::query($sql); |
|
6422 | + while($row = Database::fetch_array($result)) { |
|
6423 | + // get option value for field type double select by id |
|
6424 | + if (!empty($row['value'])) { |
|
6425 | + if ($result_extra_field['field_type'] == |
|
6426 | 6426 | ExtraField::FIELD_TYPE_DOUBLE_SELECT |
6427 | 6427 | ) { |
6428 | - $id_double_select = explode(';', $row['value']); |
|
6429 | - if (is_array($id_double_select)) { |
|
6430 | - $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
6431 | - $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
6432 | - $row['value'] = ($value1.';'.$value2); |
|
6433 | - } |
|
6434 | - } |
|
6435 | - } |
|
6436 | - // get other value from extra field |
|
6437 | - $return[$row['user_id']][] = $row['value']; |
|
6438 | - } |
|
6439 | - } |
|
6440 | - } |
|
6441 | - return $return; |
|
6428 | + $id_double_select = explode(';', $row['value']); |
|
6429 | + if (is_array($id_double_select)) { |
|
6430 | + $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
6431 | + $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
6432 | + $row['value'] = ($value1.';'.$value2); |
|
6433 | + } |
|
6434 | + } |
|
6435 | + } |
|
6436 | + // get other value from extra field |
|
6437 | + $return[$row['user_id']][] = $row['value']; |
|
6438 | + } |
|
6439 | + } |
|
6440 | + } |
|
6441 | + return $return; |
|
6442 | 6442 | } |
6443 | 6443 | |
6444 | 6444 | /** |
@@ -6447,18 +6447,18 @@ discard block |
||
6447 | 6447 | */ |
6448 | 6448 | public function count_student_in_course() |
6449 | 6449 | { |
6450 | - global $nbStudents; |
|
6451 | - return $nbStudents; |
|
6450 | + global $nbStudents; |
|
6451 | + return $nbStudents; |
|
6452 | 6452 | } |
6453 | 6453 | |
6454 | 6454 | public function sort_users($a, $b) |
6455 | 6455 | { |
6456 | - return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
6456 | + return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
6457 | 6457 | } |
6458 | 6458 | |
6459 | 6459 | public function sort_users_desc($a, $b) |
6460 | 6460 | { |
6461 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6461 | + return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6462 | 6462 | } |
6463 | 6463 | |
6464 | 6464 | /** |
@@ -6467,8 +6467,8 @@ discard block |
||
6467 | 6467 | */ |
6468 | 6468 | public static function get_number_of_users() |
6469 | 6469 | { |
6470 | - global $user_ids; |
|
6471 | - return count($user_ids); |
|
6470 | + global $user_ids; |
|
6471 | + return count($user_ids); |
|
6472 | 6472 | } |
6473 | 6473 | |
6474 | 6474 | /** |
@@ -6484,37 +6484,37 @@ discard block |
||
6484 | 6484 | { |
6485 | 6485 | global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order, $csv_content, $session_id; |
6486 | 6486 | |
6487 | - $course_code = Database::escape_string($course_code); |
|
6488 | - $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6489 | - $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
6487 | + $course_code = Database::escape_string($course_code); |
|
6488 | + $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6489 | + $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
6490 | 6490 | |
6491 | - $access_url_id = api_get_current_access_url_id(); |
|
6491 | + $access_url_id = api_get_current_access_url_id(); |
|
6492 | 6492 | |
6493 | - // get all users data from a course for sortable with limit |
|
6494 | - if (is_array($user_ids)) { |
|
6495 | - $user_ids = array_map('intval', $user_ids); |
|
6496 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6497 | - } else { |
|
6498 | - $user_ids = intval($user_ids); |
|
6499 | - $condition_user = " WHERE user.user_id = $user_ids "; |
|
6500 | - } |
|
6493 | + // get all users data from a course for sortable with limit |
|
6494 | + if (is_array($user_ids)) { |
|
6495 | + $user_ids = array_map('intval', $user_ids); |
|
6496 | + $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6497 | + } else { |
|
6498 | + $user_ids = intval($user_ids); |
|
6499 | + $condition_user = " WHERE user.user_id = $user_ids "; |
|
6500 | + } |
|
6501 | 6501 | |
6502 | - if (!empty($_GET['user_keyword'])) { |
|
6503 | - $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
6504 | - $condition_user .= " AND ( |
|
6502 | + if (!empty($_GET['user_keyword'])) { |
|
6503 | + $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
6504 | + $condition_user .= " AND ( |
|
6505 | 6505 | user.firstname LIKE '%".$keyword."%' OR |
6506 | 6506 | user.lastname LIKE '%".$keyword."%' OR |
6507 | 6507 | user.username LIKE '%".$keyword."%' OR |
6508 | 6508 | user.email LIKE '%".$keyword."%' |
6509 | 6509 | ) "; |
6510 | - } |
|
6510 | + } |
|
6511 | 6511 | |
6512 | 6512 | $url_table = null; |
6513 | 6513 | $url_condition = null; |
6514 | - if (api_is_multiple_url_enabled()) { |
|
6515 | - $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
6516 | - $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
6517 | - } |
|
6514 | + if (api_is_multiple_url_enabled()) { |
|
6515 | + $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
6516 | + $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
6517 | + } |
|
6518 | 6518 | |
6519 | 6519 | $invitedUsersCondition = ''; |
6520 | 6520 | |
@@ -6522,7 +6522,7 @@ discard block |
||
6522 | 6522 | $invitedUsersCondition = " AND user.status != " . INVITEE; |
6523 | 6523 | } |
6524 | 6524 | |
6525 | - $sql = "SELECT user.user_id as user_id, |
|
6525 | + $sql = "SELECT user.user_id as user_id, |
|
6526 | 6526 | user.official_code as col0, |
6527 | 6527 | user.lastname as col1, |
6528 | 6528 | user.firstname as col2, |
@@ -6530,16 +6530,16 @@ discard block |
||
6530 | 6530 | FROM $tbl_user as user $url_table |
6531 | 6531 | $condition_user $url_condition $invitedUsersCondition"; |
6532 | 6532 | |
6533 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
6534 | - $direction = 'ASC'; |
|
6535 | - } |
|
6533 | + if (!in_array($direction, array('ASC','DESC'))) { |
|
6534 | + $direction = 'ASC'; |
|
6535 | + } |
|
6536 | 6536 | |
6537 | - $column = intval($column); |
|
6538 | - $from = intval($from); |
|
6539 | - $number_of_items = intval($number_of_items); |
|
6537 | + $column = intval($column); |
|
6538 | + $from = intval($from); |
|
6539 | + $number_of_items = intval($number_of_items); |
|
6540 | 6540 | |
6541 | - $sql .= " ORDER BY col$column $direction "; |
|
6542 | - $sql .= " LIMIT $from,$number_of_items"; |
|
6541 | + $sql .= " ORDER BY col$column $direction "; |
|
6542 | + $sql .= " LIMIT $from,$number_of_items"; |
|
6543 | 6543 | |
6544 | 6544 | $res = Database::query($sql); |
6545 | 6545 | $users = array(); |
@@ -6573,7 +6573,7 @@ discard block |
||
6573 | 6573 | } |
6574 | 6574 | } |
6575 | 6575 | |
6576 | - while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
6576 | + while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
6577 | 6577 | $courseInfo = api_get_course_info($course_code); |
6578 | 6578 | $courseId = $courseInfo['real_id']; |
6579 | 6579 | |
@@ -6604,10 +6604,10 @@ discard block |
||
6604 | 6604 | $session_id |
6605 | 6605 | ); |
6606 | 6606 | |
6607 | - if (empty($avg_student_progress)) { |
|
6607 | + if (empty($avg_student_progress)) { |
|
6608 | 6608 | $avg_student_progress = 0; |
6609 | - } |
|
6610 | - $user['average_progress'] = $avg_student_progress.'%'; |
|
6609 | + } |
|
6610 | + $user['average_progress'] = $avg_student_progress.'%'; |
|
6611 | 6611 | |
6612 | 6612 | $total_user_exercise = Tracking::get_exercise_student_progress( |
6613 | 6613 | $total_exercises, |
@@ -6627,11 +6627,11 @@ discard block |
||
6627 | 6627 | |
6628 | 6628 | $user['exercise_average_best_attempt'] = $total_user_exercise; |
6629 | 6629 | |
6630 | - if (is_numeric($avg_student_score)) { |
|
6631 | - $user['student_score'] = $avg_student_score.'%'; |
|
6632 | - } else { |
|
6633 | - $user['student_score'] = $avg_student_score; |
|
6634 | - } |
|
6630 | + if (is_numeric($avg_student_score)) { |
|
6631 | + $user['student_score'] = $avg_student_score.'%'; |
|
6632 | + } else { |
|
6633 | + $user['student_score'] = $avg_student_score; |
|
6634 | + } |
|
6635 | 6635 | |
6636 | 6636 | $user['count_assignments'] = Tracking::count_student_assignments( |
6637 | 6637 | $user['user_id'], |
@@ -6654,29 +6654,29 @@ discard block |
||
6654 | 6654 | $session_id |
6655 | 6655 | ); |
6656 | 6656 | |
6657 | - // we need to display an additional profile field |
|
6658 | - $user['additional'] = ''; |
|
6657 | + // we need to display an additional profile field |
|
6658 | + $user['additional'] = ''; |
|
6659 | 6659 | |
6660 | - if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
6661 | - if (isset($additional_user_profile_info[$user['user_id']]) && |
|
6660 | + if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
6661 | + if (isset($additional_user_profile_info[$user['user_id']]) && |
|
6662 | 6662 | is_array($additional_user_profile_info[$user['user_id']]) |
6663 | 6663 | ) { |
6664 | - $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
6665 | - } |
|
6666 | - } |
|
6664 | + $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
6665 | + } |
|
6666 | + } |
|
6667 | 6667 | |
6668 | 6668 | if (empty($session_id)) { |
6669 | 6669 | $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
6670 | 6670 | } |
6671 | 6671 | |
6672 | - $user['link'] = '<center> |
|
6672 | + $user['link'] = '<center> |
|
6673 | 6673 | <a href="../mySpace/myStudents.php?student='.$user['user_id'].'&details=true&course='.$course_code.'&origin=tracking_course&id_session='.$session_id.'"> |
6674 | 6674 | '.Display::return_icon('2rightarrow.png').' |
6675 | 6675 | </a> |
6676 | 6676 | </center>'; |
6677 | 6677 | |
6678 | - // store columns in array $users |
|
6679 | - $is_western_name_order = api_is_western_name_order(); |
|
6678 | + // store columns in array $users |
|
6679 | + $is_western_name_order = api_is_western_name_order(); |
|
6680 | 6680 | $user_row = array(); |
6681 | 6681 | $user_row[]= $user['official_code']; //0 |
6682 | 6682 | if ($is_western_name_order) { |
@@ -6712,21 +6712,21 @@ discard block |
||
6712 | 6712 | |
6713 | 6713 | $users[] = $user_row; |
6714 | 6714 | |
6715 | - if ($export_csv) { |
|
6716 | - if (empty($session_id)) { |
|
6715 | + if ($export_csv) { |
|
6716 | + if (empty($session_id)) { |
|
6717 | 6717 | $user_row = array_map('strip_tags', $user_row); |
6718 | - unset($user_row[14]); |
|
6719 | - unset($user_row[15]); |
|
6718 | + unset($user_row[14]); |
|
6719 | + unset($user_row[15]); |
|
6720 | 6720 | } else { |
6721 | 6721 | $user_row = array_map('strip_tags', $user_row); |
6722 | 6722 | unset($user_row[13]); |
6723 | 6723 | unset($user_row[14]); |
6724 | 6724 | } |
6725 | 6725 | |
6726 | - $csv_content[] = $user_row; |
|
6727 | - } |
|
6728 | - } |
|
6729 | - return $users; |
|
6726 | + $csv_content[] = $user_row; |
|
6727 | + } |
|
6728 | + } |
|
6729 | + return $users; |
|
6730 | 6730 | } |
6731 | 6731 | } |
6732 | 6732 | |
@@ -6744,18 +6744,18 @@ discard block |
||
6744 | 6744 | */ |
6745 | 6745 | public static function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6746 | 6746 | { |
6747 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
6748 | - |
|
6749 | - // protected data |
|
6750 | - $user_id = intval($user_id); |
|
6751 | - $session_id = intval($session_id); |
|
6752 | - $course_id = Database::escape_string($course_id); |
|
6753 | - |
|
6754 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6755 | - $tempView = $view; |
|
6756 | - if(substr($view,0,1) == '1') { |
|
6757 | - $new_view = substr_replace($view,'0',0,1); |
|
6758 | - echo " |
|
6747 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
6748 | + |
|
6749 | + // protected data |
|
6750 | + $user_id = intval($user_id); |
|
6751 | + $session_id = intval($session_id); |
|
6752 | + $course_id = Database::escape_string($course_id); |
|
6753 | + |
|
6754 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6755 | + $tempView = $view; |
|
6756 | + if(substr($view,0,1) == '1') { |
|
6757 | + $new_view = substr_replace($view,'0',0,1); |
|
6758 | + echo " |
|
6759 | 6759 | <tr> |
6760 | 6760 | <td valign='top'> |
6761 | 6761 | <font color='#0000FF'>- </font>" . |
@@ -6763,9 +6763,9 @@ discard block |
||
6763 | 6763 | </td> |
6764 | 6764 | </tr> |
6765 | 6765 | "; |
6766 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
6766 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
6767 | 6767 | |
6768 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6768 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6769 | 6769 | FROM $track_access_table |
6770 | 6770 | WHERE access_user_id = $user_id |
6771 | 6771 | AND c_id = $course_id |
@@ -6773,11 +6773,11 @@ discard block |
||
6773 | 6773 | GROUP BY YEAR(access_date),MONTH(access_date) |
6774 | 6774 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
6775 | 6775 | |
6776 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6777 | - $results = getManyResults3Col($sql); |
|
6776 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6777 | + $results = getManyResults3Col($sql); |
|
6778 | 6778 | |
6779 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6780 | - echo "<tr> |
|
6779 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6780 | + echo "<tr> |
|
6781 | 6781 | <td class='secLine'> |
6782 | 6782 | ".get_lang('LoginsTitleMonthColumn')." |
6783 | 6783 | </td> |
@@ -6785,36 +6785,36 @@ discard block |
||
6785 | 6785 | ".get_lang('LoginsTitleCountColumn')." |
6786 | 6786 | </td> |
6787 | 6787 | </tr>"; |
6788 | - $total = 0; |
|
6789 | - if (is_array($results)) { |
|
6790 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6791 | - echo "<tr>"; |
|
6792 | - echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6793 | - echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
6794 | - echo"</tr>"; |
|
6795 | - $total = $total + $results[$j][1]; |
|
6796 | - } |
|
6797 | - echo "<tr>"; |
|
6798 | - echo "<td>".get_lang('Total')."</td>"; |
|
6799 | - echo "<td align='right' class='content'>".$total."</td>"; |
|
6800 | - echo"</tr>"; |
|
6801 | - } else { |
|
6802 | - echo "<tr>"; |
|
6803 | - echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
6804 | - echo"</tr>"; |
|
6805 | - } |
|
6806 | - echo "</table>"; |
|
6807 | - echo "</td></tr>"; |
|
6808 | - } else { |
|
6809 | - $new_view = substr_replace($view,'1',0,1); |
|
6810 | - echo " |
|
6788 | + $total = 0; |
|
6789 | + if (is_array($results)) { |
|
6790 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6791 | + echo "<tr>"; |
|
6792 | + echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6793 | + echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
6794 | + echo"</tr>"; |
|
6795 | + $total = $total + $results[$j][1]; |
|
6796 | + } |
|
6797 | + echo "<tr>"; |
|
6798 | + echo "<td>".get_lang('Total')."</td>"; |
|
6799 | + echo "<td align='right' class='content'>".$total."</td>"; |
|
6800 | + echo"</tr>"; |
|
6801 | + } else { |
|
6802 | + echo "<tr>"; |
|
6803 | + echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
6804 | + echo"</tr>"; |
|
6805 | + } |
|
6806 | + echo "</table>"; |
|
6807 | + echo "</td></tr>"; |
|
6808 | + } else { |
|
6809 | + $new_view = substr_replace($view,'1',0,1); |
|
6810 | + echo " |
|
6811 | 6811 | <tr> |
6812 | 6812 | <td valign='top'> |
6813 | 6813 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".$user_id."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LoginsAndAccessTools')."</a> |
6814 | 6814 | </td> |
6815 | 6815 | </tr> |
6816 | 6816 | "; |
6817 | - } |
|
6817 | + } |
|
6818 | 6818 | } |
6819 | 6819 | |
6820 | 6820 | /** |
@@ -6827,38 +6827,38 @@ discard block |
||
6827 | 6827 | */ |
6828 | 6828 | public static function display_exercise_tracking_info($view, $user_id, $courseCode) |
6829 | 6829 | { |
6830 | - global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
6830 | + global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
6831 | 6831 | $courseId = api_get_course_int_id($courseCode); |
6832 | - if(substr($view,1,1) == '1') { |
|
6833 | - $new_view = substr_replace($view,'0',1,1); |
|
6834 | - echo "<tr> |
|
6832 | + if(substr($view,1,1) == '1') { |
|
6833 | + $new_view = substr_replace($view,'0',1,1); |
|
6834 | + echo "<tr> |
|
6835 | 6835 | <td valign='top'> |
6836 | 6836 | <font color='#0000FF'>- </font><b>".get_lang('ExercicesResults')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>] |
6837 | 6837 | </td> |
6838 | 6838 | </tr>"; |
6839 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
6839 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
6840 | 6840 | |
6841 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6841 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6842 | 6842 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
6843 | 6843 | WHERE te.c_id = $courseId |
6844 | 6844 | AND te.exe_user_id = ".intval($user_id)." |
6845 | 6845 | AND te.exe_exo_id = ce.id |
6846 | 6846 | ORDER BY ce.title ASC, te.exe_date ASC"; |
6847 | 6847 | |
6848 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6848 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6849 | 6849 | FROM $TBL_TRACK_HOTPOTATOES AS te |
6850 | 6850 | WHERE te.exe_user_id = '".intval($user_id)."' AND te.c_id = $courseId |
6851 | 6851 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
6852 | 6852 | |
6853 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6853 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6854 | 6854 | |
6855 | - $NoTestRes = 0; |
|
6856 | - $NoHPTestRes = 0; |
|
6855 | + $NoTestRes = 0; |
|
6856 | + $NoHPTestRes = 0; |
|
6857 | 6857 | |
6858 | - echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
6859 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6860 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
6861 | - echo " |
|
6858 | + echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
6859 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6860 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
6861 | + echo " |
|
6862 | 6862 | <tr bgcolor='#E6E6E6'> |
6863 | 6863 | <td> |
6864 | 6864 | ".get_lang('ExercicesTitleExerciceColumn')." |
@@ -6871,28 +6871,28 @@ discard block |
||
6871 | 6871 | </td> |
6872 | 6872 | </tr>"; |
6873 | 6873 | |
6874 | - if (is_array($results)) { |
|
6875 | - for($i = 0; $i < sizeof($results); $i++) { |
|
6876 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6877 | - echo "<tr>\n"; |
|
6878 | - echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
6879 | - echo "<td class='content'>".$display_date."</td>\n"; |
|
6880 | - echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
6881 | - echo "</tr>\n"; |
|
6882 | - } |
|
6883 | - } else { |
|
6884 | - // istvan begin |
|
6885 | - $NoTestRes = 1; |
|
6886 | - } |
|
6887 | - |
|
6888 | - // The Result of Tests |
|
6889 | - if (is_array($hpresults)) { |
|
6890 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6891 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6892 | - if ($title == '') |
|
6893 | - $title = basename($hpresults[$i][0]); |
|
6894 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6895 | - ?> |
|
6874 | + if (is_array($results)) { |
|
6875 | + for($i = 0; $i < sizeof($results); $i++) { |
|
6876 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6877 | + echo "<tr>\n"; |
|
6878 | + echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
6879 | + echo "<td class='content'>".$display_date."</td>\n"; |
|
6880 | + echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
6881 | + echo "</tr>\n"; |
|
6882 | + } |
|
6883 | + } else { |
|
6884 | + // istvan begin |
|
6885 | + $NoTestRes = 1; |
|
6886 | + } |
|
6887 | + |
|
6888 | + // The Result of Tests |
|
6889 | + if (is_array($hpresults)) { |
|
6890 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6891 | + $title = GetQuizName($hpresults[$i][0],''); |
|
6892 | + if ($title == '') |
|
6893 | + $title = basename($hpresults[$i][0]); |
|
6894 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6895 | + ?> |
|
6896 | 6896 | <tr> |
6897 | 6897 | <td class="content"><?php echo $title; ?></td> |
6898 | 6898 | <td class="content" align="center"><?php echo $display_date; ?></td> |
@@ -6902,26 +6902,26 @@ discard block |
||
6902 | 6902 | |
6903 | 6903 | <?php |
6904 | 6904 | } |
6905 | - } else { |
|
6906 | - $NoHPTestRes = 1; |
|
6907 | - } |
|
6908 | - |
|
6909 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6910 | - echo "<tr>\n"; |
|
6911 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
6912 | - echo "</tr>\n"; |
|
6913 | - } |
|
6914 | - echo "</table>"; |
|
6915 | - echo "</td>\n</tr>\n"; |
|
6916 | - } else { |
|
6917 | - $new_view = substr_replace($view,'1',1,1); |
|
6918 | - echo " |
|
6905 | + } else { |
|
6906 | + $NoHPTestRes = 1; |
|
6907 | + } |
|
6908 | + |
|
6909 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6910 | + echo "<tr>\n"; |
|
6911 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
6912 | + echo "</tr>\n"; |
|
6913 | + } |
|
6914 | + echo "</table>"; |
|
6915 | + echo "</td>\n</tr>\n"; |
|
6916 | + } else { |
|
6917 | + $new_view = substr_replace($view,'1',1,1); |
|
6918 | + echo " |
|
6919 | 6919 | <tr> |
6920 | 6920 | <td valign='top'> |
6921 | 6921 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=$user_id&view=".$new_view."' class='specialLink'>".get_lang('ExercicesResults')."</a> |
6922 | 6922 | </td> |
6923 | 6923 | </tr>"; |
6924 | - } |
|
6924 | + } |
|
6925 | 6925 | } |
6926 | 6926 | |
6927 | 6927 | /** |
@@ -6930,27 +6930,27 @@ discard block |
||
6930 | 6930 | */ |
6931 | 6931 | public static function display_student_publications_tracking_info($view, $user_id, $course_id) |
6932 | 6932 | { |
6933 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
6933 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
6934 | 6934 | $_course = api_get_course_info_by_id($course_id); |
6935 | 6935 | |
6936 | - if (substr($view,2,1) == '1') { |
|
6937 | - $new_view = substr_replace($view,'0',2,1); |
|
6938 | - echo "<tr> |
|
6936 | + if (substr($view,2,1) == '1') { |
|
6937 | + $new_view = substr_replace($view,'0',2,1); |
|
6938 | + echo "<tr> |
|
6939 | 6939 | <td valign='top'> |
6940 | 6940 | <font color='#0000FF'>- </font><b>".get_lang('WorkUploads')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>] |
6941 | 6941 | </td> |
6942 | 6942 | </tr>"; |
6943 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
6944 | - $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
6943 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
6944 | + $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
6945 | 6945 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
6946 | 6946 | WHERE u.upload_work_id = w.id |
6947 | 6947 | AND u.upload_user_id = '".intval($user_id)."' |
6948 | 6948 | AND u.c_id = '".intval($course_id)."' |
6949 | 6949 | ORDER BY u.upload_date DESC"; |
6950 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6951 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6952 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6953 | - echo "<tr> |
|
6950 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6951 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6952 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6953 | + echo "<tr> |
|
6954 | 6954 | <td class='secLine' width='40%'> |
6955 | 6955 | ".get_lang('WorkTitle')." |
6956 | 6956 | </td> |
@@ -6961,35 +6961,35 @@ discard block |
||
6961 | 6961 | ".get_lang('Date')." |
6962 | 6962 | </td> |
6963 | 6963 | </tr>"; |
6964 | - if (is_array($results)) { |
|
6965 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6966 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
6967 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
6968 | - echo "<tr>"; |
|
6969 | - echo "<td class='content'>" |
|
6970 | - ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
6971 | - ."</td>"; |
|
6972 | - echo "<td class='content'>".$results[$j][2]."</td>"; |
|
6973 | - echo "<td class='content'>".$beautifulDate."</td>"; |
|
6974 | - echo"</tr>"; |
|
6975 | - } |
|
6976 | - } else { |
|
6977 | - echo "<tr>"; |
|
6978 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
6979 | - echo"</tr>"; |
|
6980 | - } |
|
6981 | - echo "</table>"; |
|
6982 | - echo "</td></tr>"; |
|
6983 | - } else { |
|
6984 | - $new_view = substr_replace($view,'1',2,1); |
|
6985 | - echo " |
|
6964 | + if (is_array($results)) { |
|
6965 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6966 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
6967 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
6968 | + echo "<tr>"; |
|
6969 | + echo "<td class='content'>" |
|
6970 | + ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
6971 | + ."</td>"; |
|
6972 | + echo "<td class='content'>".$results[$j][2]."</td>"; |
|
6973 | + echo "<td class='content'>".$beautifulDate."</td>"; |
|
6974 | + echo"</tr>"; |
|
6975 | + } |
|
6976 | + } else { |
|
6977 | + echo "<tr>"; |
|
6978 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
6979 | + echo"</tr>"; |
|
6980 | + } |
|
6981 | + echo "</table>"; |
|
6982 | + echo "</td></tr>"; |
|
6983 | + } else { |
|
6984 | + $new_view = substr_replace($view,'1',2,1); |
|
6985 | + echo " |
|
6986 | 6986 | <tr> |
6987 | 6987 | <td valign='top'> |
6988 | 6988 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('WorkUploads')."</a> |
6989 | 6989 | </td> |
6990 | 6990 | </tr> |
6991 | 6991 | "; |
6992 | - } |
|
6992 | + } |
|
6993 | 6993 | } |
6994 | 6994 | |
6995 | 6995 | /** |
@@ -6998,55 +6998,55 @@ discard block |
||
6998 | 6998 | */ |
6999 | 6999 | public static function display_links_tracking_info($view, $user_id, $courseCode) |
7000 | 7000 | { |
7001 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7001 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7002 | 7002 | $courseId = api_get_course_int_id($courseCode); |
7003 | - if (substr($view,3,1) == '1') { |
|
7004 | - $new_view = substr_replace($view,'0',3,1); |
|
7005 | - echo " |
|
7003 | + if (substr($view,3,1) == '1') { |
|
7004 | + $new_view = substr_replace($view,'0',3,1); |
|
7005 | + echo " |
|
7006 | 7006 | <tr> |
7007 | 7007 | <td valign='top'> |
7008 | 7008 | <font color='#0000FF'>- </font><b>".get_lang('LinksAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00010'>".get_lang('ExportAsCSV')."</a>] |
7009 | 7009 | </td> |
7010 | 7010 | </tr> |
7011 | 7011 | "; |
7012 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
7013 | - $sql = "SELECT cl.title, cl.url |
|
7012 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
7013 | + $sql = "SELECT cl.title, cl.url |
|
7014 | 7014 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7015 | 7015 | WHERE sl.links_link_id = cl.id |
7016 | 7016 | AND sl.c_id = $courseId |
7017 | 7017 | AND sl.links_user_id = ".intval($user_id)." |
7018 | 7018 | GROUP BY cl.title, cl.url"; |
7019 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
7020 | - $results = StatsUtils::getManyResults2Col($sql); |
|
7021 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
7022 | - echo "<tr> |
|
7019 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
7020 | + $results = StatsUtils::getManyResults2Col($sql); |
|
7021 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
7022 | + echo "<tr> |
|
7023 | 7023 | <td class='secLine'> |
7024 | 7024 | ".get_lang('LinksTitleLinkColumn')." |
7025 | 7025 | </td> |
7026 | 7026 | </tr>"; |
7027 | - if (is_array($results)) { |
|
7028 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7029 | - echo "<tr>"; |
|
7030 | - echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
7031 | - echo"</tr>"; |
|
7032 | - } |
|
7033 | - } else { |
|
7034 | - echo "<tr>"; |
|
7035 | - echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
7036 | - echo"</tr>"; |
|
7037 | - } |
|
7038 | - echo "</table>"; |
|
7039 | - echo "</td></tr>"; |
|
7040 | - } else { |
|
7041 | - $new_view = substr_replace($view,'1',3,1); |
|
7042 | - echo " |
|
7027 | + if (is_array($results)) { |
|
7028 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7029 | + echo "<tr>"; |
|
7030 | + echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
7031 | + echo"</tr>"; |
|
7032 | + } |
|
7033 | + } else { |
|
7034 | + echo "<tr>"; |
|
7035 | + echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
7036 | + echo"</tr>"; |
|
7037 | + } |
|
7038 | + echo "</table>"; |
|
7039 | + echo "</td></tr>"; |
|
7040 | + } else { |
|
7041 | + $new_view = substr_replace($view,'1',3,1); |
|
7042 | + echo " |
|
7043 | 7043 | <tr> |
7044 | 7044 | <td valign='top'> |
7045 | 7045 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LinksAccess')."</a> |
7046 | 7046 | </td> |
7047 | 7047 | </tr> |
7048 | 7048 | "; |
7049 | - } |
|
7049 | + } |
|
7050 | 7050 | } |
7051 | 7051 | |
7052 | 7052 | /** |
@@ -7059,61 +7059,61 @@ discard block |
||
7059 | 7059 | */ |
7060 | 7060 | public static function display_document_tracking_info($view, $user_id, $course_code, $session_id = 0) |
7061 | 7061 | { |
7062 | - // protect data |
|
7062 | + // protect data |
|
7063 | 7063 | $user_id = intval($user_id); |
7064 | 7064 | $courseId = api_get_course_int_id($course_code); |
7065 | - $session_id = intval($session_id); |
|
7065 | + $session_id = intval($session_id); |
|
7066 | 7066 | |
7067 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7068 | - if(substr($view,4,1) == '1') { |
|
7069 | - $new_view = substr_replace($view,'0',4,1); |
|
7070 | - echo " |
|
7067 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7068 | + if(substr($view,4,1) == '1') { |
|
7069 | + $new_view = substr_replace($view,'0',4,1); |
|
7070 | + echo " |
|
7071 | 7071 | <tr> |
7072 | 7072 | <td valign='top'> |
7073 | 7073 | <font color='#0000FF'>- </font><b>".get_lang('DocumentsAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00001'>".get_lang('ExportAsCSV')."</a>] |
7074 | 7074 | </td> |
7075 | 7075 | </tr> |
7076 | 7076 | "; |
7077 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
7077 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
7078 | 7078 | |
7079 | - $sql = "SELECT down_doc_path |
|
7079 | + $sql = "SELECT down_doc_path |
|
7080 | 7080 | FROM $downloads_table |
7081 | 7081 | WHERE c_id = $courseId |
7082 | 7082 | AND down_user_id = $user_id |
7083 | 7083 | AND down_session_id = $session_id |
7084 | 7084 | GROUP BY down_doc_path"; |
7085 | 7085 | |
7086 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
7087 | - $results = StatsUtils::getManyResults1Col($sql); |
|
7088 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
7089 | - echo "<tr> |
|
7086 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
7087 | + $results = StatsUtils::getManyResults1Col($sql); |
|
7088 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
7089 | + echo "<tr> |
|
7090 | 7090 | <td class='secLine'> |
7091 | 7091 | ".get_lang('DocumentsTitleDocumentColumn')." |
7092 | 7092 | </td> |
7093 | 7093 | </tr>"; |
7094 | - if (is_array($results)) { |
|
7095 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7096 | - echo "<tr>"; |
|
7097 | - echo "<td class='content'>".$results[$j]."</td>"; |
|
7098 | - echo"</tr>"; |
|
7099 | - } |
|
7100 | - } else { |
|
7101 | - echo "<tr>"; |
|
7102 | - echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
7103 | - echo"</tr>"; |
|
7104 | - } |
|
7105 | - echo "</table>"; |
|
7106 | - echo "</td></tr>"; |
|
7107 | - } else { |
|
7108 | - $new_view = substr_replace($view,'1',4,1); |
|
7109 | - echo " |
|
7094 | + if (is_array($results)) { |
|
7095 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7096 | + echo "<tr>"; |
|
7097 | + echo "<td class='content'>".$results[$j]."</td>"; |
|
7098 | + echo"</tr>"; |
|
7099 | + } |
|
7100 | + } else { |
|
7101 | + echo "<tr>"; |
|
7102 | + echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
7103 | + echo"</tr>"; |
|
7104 | + } |
|
7105 | + echo "</table>"; |
|
7106 | + echo "</td></tr>"; |
|
7107 | + } else { |
|
7108 | + $new_view = substr_replace($view,'1',4,1); |
|
7109 | + echo " |
|
7110 | 7110 | <tr> |
7111 | 7111 | <td valign='top'> |
7112 | 7112 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('DocumentsAccess')."</a> |
7113 | 7113 | </td> |
7114 | 7114 | </tr> |
7115 | 7115 | "; |
7116 | - } |
|
7116 | + } |
|
7117 | 7117 | } |
7118 | 7118 | |
7119 | 7119 | /** |
@@ -7170,43 +7170,43 @@ discard block |
||
7170 | 7170 | */ |
7171 | 7171 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
7172 | 7172 | { |
7173 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
7174 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
7175 | - |
|
7176 | - // protected data |
|
7177 | - $user_id = intval($user_id); |
|
7178 | - $session_id = intval($session_id); |
|
7179 | - $course_id = intval($course_id); |
|
7180 | - |
|
7181 | - $tempView = $view; |
|
7182 | - if (substr($view,0,1) == '1') { |
|
7183 | - $new_view = substr_replace($view,'0',0,1); |
|
7184 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7185 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
7173 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
7174 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
7175 | + |
|
7176 | + // protected data |
|
7177 | + $user_id = intval($user_id); |
|
7178 | + $session_id = intval($session_id); |
|
7179 | + $course_id = intval($course_id); |
|
7180 | + |
|
7181 | + $tempView = $view; |
|
7182 | + if (substr($view,0,1) == '1') { |
|
7183 | + $new_view = substr_replace($view,'0',0,1); |
|
7184 | + $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7185 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
7186 | 7186 | FROM $track_access_table |
7187 | 7187 | WHERE access_user_id = $user_id |
7188 | 7188 | AND c_id = $course_id |
7189 | 7189 | AND access_session_id = $session_id |
7190 | 7190 | GROUP BY YEAR(access_date),MONTH(access_date) |
7191 | 7191 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
7192 | - //$results = getManyResults2Col($sql); |
|
7193 | - $results = getManyResults3Col($sql); |
|
7194 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7195 | - $line=''; |
|
7196 | - $total = 0; |
|
7197 | - if (is_array($results)) { |
|
7198 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7199 | - $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
7200 | - $total = $total + $results[$j][1]; |
|
7201 | - } |
|
7202 | - $line .= get_lang('Total').";".$total."\n"; |
|
7203 | - } else { |
|
7204 | - $line= get_lang('NoResult')."</center></td>"; |
|
7205 | - } |
|
7206 | - } else { |
|
7207 | - $new_view = substr_replace($view,'1',0,1); |
|
7208 | - } |
|
7209 | - return array($title_line, $line); |
|
7192 | + //$results = getManyResults2Col($sql); |
|
7193 | + $results = getManyResults3Col($sql); |
|
7194 | + $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7195 | + $line=''; |
|
7196 | + $total = 0; |
|
7197 | + if (is_array($results)) { |
|
7198 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7199 | + $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
7200 | + $total = $total + $results[$j][1]; |
|
7201 | + } |
|
7202 | + $line .= get_lang('Total').";".$total."\n"; |
|
7203 | + } else { |
|
7204 | + $line= get_lang('NoResult')."</center></td>"; |
|
7205 | + } |
|
7206 | + } else { |
|
7207 | + $new_view = substr_replace($view,'1',0,1); |
|
7208 | + } |
|
7209 | + return array($title_line, $line); |
|
7210 | 7210 | } |
7211 | 7211 | |
7212 | 7212 | /** |
@@ -7219,67 +7219,67 @@ discard block |
||
7219 | 7219 | */ |
7220 | 7220 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
7221 | 7221 | { |
7222 | - global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
7222 | + global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
7223 | 7223 | $courseId = api_get_course_int_id($courseCode); |
7224 | 7224 | $userId = intval($userId); |
7225 | - if (substr($view,1,1) == '1') { |
|
7226 | - $new_view = substr_replace($view,'0',1,1); |
|
7227 | - $title[1] = get_lang('ExercicesDetails'); |
|
7228 | - $line = ''; |
|
7229 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7225 | + if (substr($view,1,1) == '1') { |
|
7226 | + $new_view = substr_replace($view,'0',1,1); |
|
7227 | + $title[1] = get_lang('ExercicesDetails'); |
|
7228 | + $line = ''; |
|
7229 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7230 | 7230 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
7231 | 7231 | WHERE te.c_id = $courseId |
7232 | 7232 | AND te.exe_user_id = $userId |
7233 | 7233 | AND te.exe_exo_id = ce.id |
7234 | 7234 | ORDER BY ce.title ASC, te.exe_date ASC"; |
7235 | 7235 | |
7236 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7236 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7237 | 7237 | FROM $TABLETRACK_HOTPOTATOES AS te |
7238 | 7238 | WHERE te.exe_user_id = '$userId' AND te.c_id = $courseId |
7239 | 7239 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
7240 | 7240 | |
7241 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
7241 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
7242 | 7242 | |
7243 | - $NoTestRes = 0; |
|
7244 | - $NoHPTestRes = 0; |
|
7243 | + $NoTestRes = 0; |
|
7244 | + $NoHPTestRes = 0; |
|
7245 | 7245 | |
7246 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7247 | - $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
7246 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7247 | + $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
7248 | 7248 | |
7249 | - if (is_array($results)) { |
|
7250 | - for($i = 0; $i < sizeof($results); $i++) |
|
7251 | - { |
|
7252 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
7253 | - $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
7254 | - } |
|
7255 | - } else { |
|
7249 | + if (is_array($results)) { |
|
7250 | + for($i = 0; $i < sizeof($results); $i++) |
|
7251 | + { |
|
7252 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
7253 | + $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
7254 | + } |
|
7255 | + } else { |
|
7256 | 7256 | // istvan begin |
7257 | - $NoTestRes = 1; |
|
7258 | - } |
|
7259 | - |
|
7260 | - // The Result of Tests |
|
7261 | - if (is_array($hpresults)) { |
|
7262 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7263 | - $title = GetQuizName($hpresults[$i][0],''); |
|
7264 | - |
|
7265 | - if ($title == '') |
|
7266 | - $title = basename($hpresults[$i][0]); |
|
7267 | - |
|
7268 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
7269 | - |
|
7270 | - $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
7271 | - } |
|
7272 | - } else { |
|
7273 | - $NoHPTestRes = 1; |
|
7274 | - } |
|
7275 | - |
|
7276 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
7277 | - $line=get_lang('NoResult'); |
|
7278 | - } |
|
7279 | - } else { |
|
7280 | - $new_view = substr_replace($view,'1',1,1); |
|
7281 | - } |
|
7282 | - return array($title_line, $line); |
|
7257 | + $NoTestRes = 1; |
|
7258 | + } |
|
7259 | + |
|
7260 | + // The Result of Tests |
|
7261 | + if (is_array($hpresults)) { |
|
7262 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7263 | + $title = GetQuizName($hpresults[$i][0],''); |
|
7264 | + |
|
7265 | + if ($title == '') |
|
7266 | + $title = basename($hpresults[$i][0]); |
|
7267 | + |
|
7268 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
7269 | + |
|
7270 | + $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
7271 | + } |
|
7272 | + } else { |
|
7273 | + $NoHPTestRes = 1; |
|
7274 | + } |
|
7275 | + |
|
7276 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
7277 | + $line=get_lang('NoResult'); |
|
7278 | + } |
|
7279 | + } else { |
|
7280 | + $new_view = substr_replace($view,'1',1,1); |
|
7281 | + } |
|
7282 | + return array($title_line, $line); |
|
7283 | 7283 | } |
7284 | 7284 | |
7285 | 7285 | /** |
@@ -7288,37 +7288,37 @@ discard block |
||
7288 | 7288 | */ |
7289 | 7289 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
7290 | 7290 | { |
7291 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
7291 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
7292 | 7292 | $_course = api_get_course_info(); |
7293 | 7293 | $user_id = intval($user_id); |
7294 | 7294 | $course_id = intval($course_id); |
7295 | 7295 | |
7296 | - if (substr($view,2,1) == '1') { |
|
7297 | - $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
7296 | + if (substr($view,2,1) == '1') { |
|
7297 | + $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
7298 | 7298 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
7299 | 7299 | WHERE |
7300 | 7300 | u.upload_work_id = w.id AND |
7301 | 7301 | u.upload_user_id = '$user_id' AND |
7302 | 7302 | u.c_id = '$course_id' |
7303 | 7303 | ORDER BY u.upload_date DESC"; |
7304 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7305 | - |
|
7306 | - $title[1]=get_lang('WorksDetails'); |
|
7307 | - $line=''; |
|
7308 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7309 | - |
|
7310 | - if (is_array($results)) { |
|
7311 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7312 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
7313 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
7314 | - $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
7315 | - } |
|
7316 | - |
|
7317 | - } else { |
|
7318 | - $line= get_lang('NoResult'); |
|
7319 | - } |
|
7320 | - } |
|
7321 | - return array($title_line, $line); |
|
7304 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7305 | + |
|
7306 | + $title[1]=get_lang('WorksDetails'); |
|
7307 | + $line=''; |
|
7308 | + $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7309 | + |
|
7310 | + if (is_array($results)) { |
|
7311 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7312 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
7313 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
7314 | + $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
7315 | + } |
|
7316 | + |
|
7317 | + } else { |
|
7318 | + $line= get_lang('NoResult'); |
|
7319 | + } |
|
7320 | + } |
|
7321 | + return array($title_line, $line); |
|
7322 | 7322 | } |
7323 | 7323 | |
7324 | 7324 | /** |
@@ -7327,32 +7327,32 @@ discard block |
||
7327 | 7327 | */ |
7328 | 7328 | public function display_links_tracking_info($view, $userId, $courseCode) |
7329 | 7329 | { |
7330 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7330 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7331 | 7331 | $courseId = api_get_course_int_id($courseCode); |
7332 | 7332 | $userId = intval($userId); |
7333 | 7333 | $line = null; |
7334 | - if (substr($view,3,1) == '1') { |
|
7335 | - $new_view = substr_replace($view,'0',3,1); |
|
7336 | - $title[1]=get_lang('LinksDetails'); |
|
7337 | - $sql = "SELECT cl.title, cl.url |
|
7334 | + if (substr($view,3,1) == '1') { |
|
7335 | + $new_view = substr_replace($view,'0',3,1); |
|
7336 | + $title[1]=get_lang('LinksDetails'); |
|
7337 | + $sql = "SELECT cl.title, cl.url |
|
7338 | 7338 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7339 | 7339 | WHERE sl.links_link_id = cl.id |
7340 | 7340 | AND sl.c_id = $courseId |
7341 | 7341 | AND sl.links_user_id = $userId |
7342 | 7342 | GROUP BY cl.title, cl.url"; |
7343 | - $results = StatsUtils::getManyResults2Col($sql); |
|
7344 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7345 | - if (is_array($results)) { |
|
7346 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7347 | - $line .= $results[$j][0]."\n"; |
|
7348 | - } |
|
7349 | - } else { |
|
7350 | - $line=get_lang('NoResult'); |
|
7351 | - } |
|
7352 | - } else { |
|
7353 | - $new_view = substr_replace($view,'1',3,1); |
|
7354 | - } |
|
7355 | - return array($title_line, $line); |
|
7343 | + $results = StatsUtils::getManyResults2Col($sql); |
|
7344 | + $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7345 | + if (is_array($results)) { |
|
7346 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
7347 | + $line .= $results[$j][0]."\n"; |
|
7348 | + } |
|
7349 | + } else { |
|
7350 | + $line=get_lang('NoResult'); |
|
7351 | + } |
|
7352 | + } else { |
|
7353 | + $new_view = substr_replace($view,'1',3,1); |
|
7354 | + } |
|
7355 | + return array($title_line, $line); |
|
7356 | 7356 | } |
7357 | 7357 | |
7358 | 7358 | /** |
@@ -7365,38 +7365,38 @@ discard block |
||
7365 | 7365 | */ |
7366 | 7366 | public function display_document_tracking_info($view, $user_id, $courseCode, $session_id = 0) |
7367 | 7367 | { |
7368 | - // protect data |
|
7369 | - $user_id = intval($user_id); |
|
7368 | + // protect data |
|
7369 | + $user_id = intval($user_id); |
|
7370 | 7370 | $courseId = api_get_course_int_id($courseCode); |
7371 | - $session_id = intval($session_id); |
|
7371 | + $session_id = intval($session_id); |
|
7372 | 7372 | |
7373 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7373 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7374 | 7374 | |
7375 | - if (substr($view,4,1) == '1') { |
|
7376 | - $new_view = substr_replace($view,'0',4,1); |
|
7377 | - $title[1]= get_lang('DocumentsDetails'); |
|
7375 | + if (substr($view,4,1) == '1') { |
|
7376 | + $new_view = substr_replace($view,'0',4,1); |
|
7377 | + $title[1]= get_lang('DocumentsDetails'); |
|
7378 | 7378 | |
7379 | - $sql = "SELECT down_doc_path |
|
7379 | + $sql = "SELECT down_doc_path |
|
7380 | 7380 | FROM $downloads_table |
7381 | 7381 | WHERE c_id = $courseId |
7382 | 7382 | AND down_user_id = $user_id |
7383 | 7383 | AND down_session_id = $session_id |
7384 | 7384 | GROUP BY down_doc_path"; |
7385 | 7385 | |
7386 | - $results = StatsUtils::getManyResults1Col($sql); |
|
7387 | - $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
7386 | + $results = StatsUtils::getManyResults1Col($sql); |
|
7387 | + $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
7388 | 7388 | $line = null; |
7389 | - if (is_array($results)) { |
|
7390 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7391 | - $line .= $results[$j]."\n"; |
|
7392 | - } |
|
7393 | - } else { |
|
7394 | - $line = get_lang('NoResult'); |
|
7395 | - } |
|
7396 | - } else { |
|
7397 | - $new_view = substr_replace($view,'1',4,1); |
|
7398 | - } |
|
7399 | - return array($title_line, $line); |
|
7389 | + if (is_array($results)) { |
|
7390 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
7391 | + $line .= $results[$j]."\n"; |
|
7392 | + } |
|
7393 | + } else { |
|
7394 | + $line = get_lang('NoResult'); |
|
7395 | + } |
|
7396 | + } else { |
|
7397 | + $new_view = substr_replace($view,'1',4,1); |
|
7398 | + } |
|
7399 | + return array($title_line, $line); |
|
7400 | 7400 | } |
7401 | 7401 | |
7402 | 7402 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $extendedAttempt = null, |
115 | 115 | $extendedAll = null, |
116 | 116 | $type = 'classic', |
117 | - $allowExtend = true |
|
117 | + $allowExtend = true |
|
118 | 118 | ) { |
119 | 119 | if (empty($courseInfo) || empty($lp_id)) { |
120 | 120 | return null; |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | $extend_all = 0; |
139 | 139 | |
140 | 140 | if ($origin == 'tracking') { |
141 | - $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin; |
|
141 | + $url_suffix = '&session_id='.$session_id.'&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.$lp_id.'&origin='.$origin; |
|
142 | 142 | } else { |
143 | - $url_suffix = '&lp_id=' . $lp_id; |
|
143 | + $url_suffix = '&lp_id='.$lp_id; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | if (!empty($extendedAll)) { |
147 | 147 | $extend_all_link = Display::url( |
148 | 148 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
149 | - api_get_self() . '?action=stats' . $url_suffix |
|
149 | + api_get_self().'?action=stats'.$url_suffix |
|
150 | 150 | ); |
151 | 151 | |
152 | 152 | $extend_all = 1; |
153 | 153 | } else { |
154 | 154 | $extend_all_link = Display::url( |
155 | 155 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')), |
156 | - api_get_self() . '?action=stats&extend_all=1' . $url_suffix |
|
156 | + api_get_self().'?action=stats&extend_all=1'.$url_suffix |
|
157 | 157 | ); |
158 | 158 | } |
159 | 159 | |
@@ -165,24 +165,24 @@ discard block |
||
165 | 165 | |
166 | 166 | $actionColumn = null; |
167 | 167 | if ($type == 'classic') { |
168 | - $actionColumn = ' <th>' . get_lang('Actions') . '</th>'; |
|
168 | + $actionColumn = ' <th>'.get_lang('Actions').'</th>'; |
|
169 | 169 | } |
170 | 170 | $output .= '<div class="table-responsive">'; |
171 | 171 | $output .= '<table class="table tracking"> |
172 | 172 | <thead> |
173 | 173 | <tr class="table-header"> |
174 | - <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ') . '</th> |
|
174 | + <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ').'</th> |
|
175 | 175 | <th colspan="4"> |
176 | - ' . get_lang('ScormLessonTitle') .' |
|
176 | + ' . get_lang('ScormLessonTitle').' |
|
177 | 177 | </th> |
178 | 178 | <th colspan="2"> |
179 | - ' . get_lang('ScormStatus') . ' |
|
179 | + ' . get_lang('ScormStatus').' |
|
180 | 180 | </th> |
181 | 181 | <th colspan="2"> |
182 | - ' . get_lang('ScormScore') . ' |
|
182 | + ' . get_lang('ScormScore').' |
|
183 | 183 | </th> |
184 | 184 | <th colspan="2"> |
185 | - ' . get_lang('ScormTime') . ' |
|
185 | + ' . get_lang('ScormTime').' |
|
186 | 186 | </th> |
187 | 187 | '.$actionColumn.' |
188 | 188 | </tr> |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | // Prepare statement to go through each attempt. |
246 | 246 | $viewCondition = null; |
247 | 247 | if (!empty($view)) { |
248 | - $viewCondition = " AND v.view_count = $view "; |
|
248 | + $viewCondition = " AND v.view_count = $view "; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | $sql = "SELECT |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | FROM $TBL_QUIZ |
294 | 294 | WHERE |
295 | 295 | c_id = $course_id AND |
296 | - id ='" . $my_path . "'"; |
|
296 | + id ='".$my_path."'"; |
|
297 | 297 | $res_result_disabled = Database::query($sql); |
298 | 298 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
299 | 299 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | if (!empty($inter_num)) { |
316 | 316 | $extend_link = Display::url( |
317 | 317 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
318 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
318 | + api_get_self().'?action=stats&fold_id='.$my_item_id.$url_suffix |
|
319 | 319 | ); |
320 | 320 | } |
321 | 321 | $title = $row['mytitle']; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | $action = null; |
335 | 335 | if ($type == 'classic') { |
336 | - $action = '<td></td>'; |
|
336 | + $action = '<td></td>'; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | if (in_array($row['item_type'], $chapterTypes)) { |
@@ -377,13 +377,13 @@ discard block |
||
377 | 377 | $extend_this_attempt = 1; |
378 | 378 | $extend_attempt_link = Display::url( |
379 | 379 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
380 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
380 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
381 | 381 | ); |
382 | 382 | } else { // Same case if fold_attempt_id is set, so not implemented explicitly. |
383 | 383 | // The extend button for this attempt has not been clicked. |
384 | 384 | $extend_attempt_link = Display::url( |
385 | 385 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
386 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
386 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
387 | 387 | ); |
388 | 388 | } |
389 | 389 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | } |
417 | 417 | |
418 | 418 | // Remove "NaN" if any (@todo: locate the source of these NaN) |
419 | - $time = str_replace('NaN', '00' . $h . '00\'00"', $time); |
|
419 | + $time = str_replace('NaN', '00'.$h.'00\'00"', $time); |
|
420 | 420 | |
421 | 421 | if ($row['item_type'] != 'dir') { |
422 | 422 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
@@ -444,13 +444,13 @@ discard block |
||
444 | 444 | $action = '<td></td>'; |
445 | 445 | } |
446 | 446 | |
447 | - $output .= '<tr class="' . $oddclass . '"> |
|
447 | + $output .= '<tr class="'.$oddclass.'"> |
|
448 | 448 | <td></td> |
449 | - <td>' . $extend_attempt_link . '</td> |
|
450 | - <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td> |
|
451 | - <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td> |
|
452 | - <td colspan="2">' . $view_score . '</td> |
|
453 | - <td colspan="2">' . $time . '</td> |
|
449 | + <td>' . $extend_attempt_link.'</td> |
|
450 | + <td colspan="3">' . get_lang('Attempt').' '.$attemptCount.'</td> |
|
451 | + <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type).'</td> |
|
452 | + <td colspan="2">' . $view_score.'</td> |
|
453 | + <td colspan="2">' . $time.'</td> |
|
454 | 454 | '.$action.' |
455 | 455 | </tr>'; |
456 | 456 | $attemptCount++; |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
464 | 464 | $temp[] = '/'; |
465 | 465 | } else { |
466 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
466 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
467 | 467 | } |
468 | 468 | } else { |
469 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
469 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
470 | 470 | } |
471 | 471 | $temp[] = $time; |
472 | 472 | $csv_content[] = $temp; |
@@ -503,13 +503,13 @@ discard block |
||
503 | 503 | <td></td> |
504 | 504 | <td></td> |
505 | 505 | <td></td> |
506 | - <td>'.$interaction['order_id'] . '</td> |
|
507 | - <td>'.$interaction['id'] . '</td> |
|
506 | + <td>'.$interaction['order_id'].'</td> |
|
507 | + <td>'.$interaction['id'].'</td> |
|
508 | 508 | <td colspan="2">' . $interaction['type'].'</td> |
509 | - <td>'.$student_response . '</td> |
|
510 | - <td>'.$interaction['result'] . '</td> |
|
511 | - <td>'.$interaction['latency'] . '</td> |
|
512 | - <td>'.$interaction['time'] . '</td> |
|
509 | + <td>'.$student_response.'</td> |
|
510 | + <td>'.$interaction['result'].'</td> |
|
511 | + <td>'.$interaction['latency'].'</td> |
|
512 | + <td>'.$interaction['time'].'</td> |
|
513 | 513 | '.$action.' |
514 | 514 | </tr>'; |
515 | 515 | $counter++; |
@@ -526,12 +526,12 @@ discard block |
||
526 | 526 | <td></td> |
527 | 527 | <td></td> |
528 | 528 | <td></td> |
529 | - <td>' . $interaction['order_id'] . '</td> |
|
530 | - <td colspan="2">' . $interaction['objective_id'] . '</td> |
|
531 | - <td colspan="2">' . $interaction['status'] .'</td> |
|
532 | - <td>' . $interaction['score_raw'] . '</td> |
|
533 | - <td>' . $interaction['score_max'] . '</td> |
|
534 | - <td>' . $interaction['score_min'] . '</td> |
|
529 | + <td>' . $interaction['order_id'].'</td> |
|
530 | + <td colspan="2">' . $interaction['objective_id'].'</td> |
|
531 | + <td colspan="2">' . $interaction['status'].'</td> |
|
532 | + <td>' . $interaction['score_raw'].'</td> |
|
533 | + <td>' . $interaction['score_max'].'</td> |
|
534 | + <td>' . $interaction['score_min'].'</td> |
|
535 | 535 | '.$action.' |
536 | 536 | </tr>'; |
537 | 537 | $counter++; |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $my_path = Database::escape_string($my_path); |
555 | 555 | $sql = "SELECT results_disabled |
556 | 556 | FROM $TBL_QUIZ |
557 | - WHERE c_id = $course_id AND id ='" . $my_path . "'"; |
|
557 | + WHERE c_id = $course_id AND id ='".$my_path."'"; |
|
558 | 558 | $res_result_disabled = Database::query($sql); |
559 | 559 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
560 | 560 | |
@@ -578,14 +578,14 @@ discard block |
||
578 | 578 | $extend_this_attempt = 1; |
579 | 579 | $extend_attempt_link = Display::url( |
580 | 580 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
581 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
581 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
582 | 582 | ); |
583 | 583 | } else { |
584 | 584 | // Same case if fold_attempt_id is set, so not implemented explicitly. |
585 | 585 | // The extend button for this attempt has not been clicked. |
586 | 586 | $extend_attempt_link = Display::url( |
587 | 587 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
588 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
588 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
589 | 589 | ); |
590 | 590 | } |
591 | 591 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | if ($inter_num > 1) { |
601 | 601 | $extend_link = Display::url( |
602 | 602 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
603 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
603 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
604 | 604 | ); |
605 | 605 | } |
606 | 606 | |
@@ -616,15 +616,15 @@ discard block |
||
616 | 616 | |
617 | 617 | // Selecting the exe_id from stats attempts tables in order to look the max score value. |
618 | 618 | |
619 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
619 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
620 | 620 | WHERE |
621 | - exe_exo_id="' . $row['path'] . '" AND |
|
622 | - exe_user_id="' . $user_id . '" AND |
|
623 | - orig_lp_id = "' . $lp_id . '" AND |
|
624 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
625 | - c_id = ' . $course_id . ' AND |
|
621 | + exe_exo_id="' . $row['path'].'" AND |
|
622 | + exe_user_id="' . $user_id.'" AND |
|
623 | + orig_lp_id = "' . $lp_id.'" AND |
|
624 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
625 | + c_id = ' . $course_id.' AND |
|
626 | 626 | status <> "incomplete" AND |
627 | - session_id = ' . $session_id . ' |
|
627 | + session_id = ' . $session_id.' |
|
628 | 628 | ORDER BY exe_date DESC |
629 | 629 | LIMIT 1'; |
630 | 630 | |
@@ -655,8 +655,8 @@ discard block |
||
655 | 655 | FROM $TBL_LP_ITEM_VIEW |
656 | 656 | WHERE |
657 | 657 | c_id = $course_id AND |
658 | - lp_item_id = '" . (int) $my_id . "' AND |
|
659 | - lp_view_id = '" . (int) $my_lp_view_id . "' |
|
658 | + lp_item_id = '".(int) $my_id."' AND |
|
659 | + lp_view_id = '" . (int) $my_lp_view_id."' |
|
660 | 660 | ORDER BY view_count DESC limit 1"; |
661 | 661 | $res_score = Database::query($sql); |
662 | 662 | $row_score = Database::fetch_array($res_score); |
@@ -665,8 +665,8 @@ discard block |
||
665 | 665 | FROM $TBL_LP_ITEM_VIEW |
666 | 666 | WHERE |
667 | 667 | c_id = $course_id AND |
668 | - lp_item_id = '" . (int) $my_id . "' AND |
|
669 | - lp_view_id = '" . (int) $my_lp_view_id . "'"; |
|
668 | + lp_item_id = '".(int) $my_id."' AND |
|
669 | + lp_view_id = '" . (int) $my_lp_view_id."'"; |
|
670 | 670 | $res_time = Database::query($sql); |
671 | 671 | $row_time = Database::fetch_array($res_time); |
672 | 672 | |
@@ -725,16 +725,16 @@ discard block |
||
725 | 725 | } else { |
726 | 726 | $correct_test_link = '-'; |
727 | 727 | if ($row['item_type'] == 'quiz') { |
728 | - $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin; |
|
729 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
728 | + $my_url_suffix = '&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.intval($row['mylpid']).'&origin='.$origin; |
|
729 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
730 | 730 | WHERE |
731 | - exe_exo_id="' . $row['path'] . '" AND |
|
732 | - exe_user_id="' . $user_id . '" AND |
|
733 | - orig_lp_id = "' . $lp_id . '" AND |
|
734 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
735 | - c_id = ' . $course_id . ' AND |
|
731 | + exe_exo_id="' . $row['path'].'" AND |
|
732 | + exe_user_id="' . $user_id.'" AND |
|
733 | + orig_lp_id = "' . $lp_id.'" AND |
|
734 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
735 | + c_id = ' . $course_id.' AND |
|
736 | 736 | status <> "incomplete" AND |
737 | - session_id = ' . $session_id . ' |
|
737 | + session_id = ' . $session_id.' |
|
738 | 738 | ORDER BY exe_date DESC '; |
739 | 739 | |
740 | 740 | $resultLastAttempt = Database::query($sql); |
@@ -746,12 +746,12 @@ discard block |
||
746 | 746 | ) { |
747 | 747 | $correct_test_link = Display::url( |
748 | 748 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
749 | - api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
749 | + api_get_self().'?action=stats'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
750 | 750 | ); |
751 | 751 | } else { |
752 | 752 | $correct_test_link = Display::url( |
753 | 753 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')), |
754 | - api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
754 | + api_get_self().'?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
755 | 755 | ); |
756 | 756 | } |
757 | 757 | } |
@@ -761,14 +761,14 @@ discard block |
||
761 | 761 | |
762 | 762 | $action = null; |
763 | 763 | if ($type == 'classic') { |
764 | - $action = '<td>' . $correct_test_link . '</td>'; |
|
764 | + $action = '<td>'.$correct_test_link.'</td>'; |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | if ($lp_id == $my_lp_id && false) { |
768 | 768 | |
769 | - $output .= '<tr class =' . $oddclass . '> |
|
770 | - <td>' . $extend_link . '</td> |
|
771 | - <td colspan="4">' . $title . '</td> |
|
769 | + $output .= '<tr class ='.$oddclass.'> |
|
770 | + <td>' . $extend_link.'</td> |
|
771 | + <td colspan="4">' . $title.'</td> |
|
772 | 772 | <td colspan="2"> </td> |
773 | 773 | <td colspan="2"> </td> |
774 | 774 | <td colspan="2"> </td> |
@@ -793,13 +793,13 @@ discard block |
||
793 | 793 | $scoreItem .= ExerciseLib::show_score($score, $maxscore, false); |
794 | 794 | } |
795 | 795 | } else { |
796 | - $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore); |
|
796 | + $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.$maxscore); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | $output .= ' |
800 | 800 | <td>'.$extend_link.'</td> |
801 | - <td colspan="4">' . $title . '</td> |
|
802 | - <td colspan="2">' . learnpathitem::humanize_status($lesson_status) .'</td> |
|
801 | + <td colspan="4">' . $title.'</td> |
|
802 | + <td colspan="2">' . learnpathitem::humanize_status($lesson_status).'</td> |
|
803 | 803 | <td colspan="2">'.$scoreItem.'</td> |
804 | 804 | <td colspan="2">'.$time.'</td> |
805 | 805 | '.$action.' |
@@ -816,10 +816,10 @@ discard block |
||
816 | 816 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
817 | 817 | $temp[] = '/'; |
818 | 818 | } else { |
819 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
819 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
820 | 820 | } |
821 | 821 | } else { |
822 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
822 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
823 | 823 | } |
824 | 824 | $temp[] = $time; |
825 | 825 | $csv_content[] = $temp; |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | |
831 | 831 | $action = null; |
832 | 832 | if ($type == 'classic') { |
833 | - $action = '<td></td>'; |
|
833 | + $action = '<td></td>'; |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | if ($extend_this_attempt || $extend_all) { |
@@ -867,11 +867,11 @@ discard block |
||
867 | 867 | <td></td> |
868 | 868 | <td></td> |
869 | 869 | <td></td> |
870 | - <td>' . $interaction['order_id'] . '</td> |
|
871 | - <td colspan="2">'.$interaction['objective_id'] . '</td> |
|
872 | - <td colspan="2">' . $interaction['status'] . '</td> |
|
870 | + <td>' . $interaction['order_id'].'</td> |
|
871 | + <td colspan="2">'.$interaction['objective_id'].'</td> |
|
872 | + <td colspan="2">' . $interaction['status'].'</td> |
|
873 | 873 | <td>' . $interaction['score_raw'].'</td> |
874 | - <td>' . $interaction['score_max'] .'</td> |
|
874 | + <td>' . $interaction['score_max'].'</td> |
|
875 | 875 | <td>' . $interaction['score_min'].'</td> |
876 | 876 | '.$action.' |
877 | 877 | </tr>'; |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } |
881 | 881 | |
882 | 882 | // Attempts listing by exercise. |
883 | - if ($lp_id == $my_lp_id && $lp_item_id== $my_id && $extendedAttempt) { |
|
883 | + if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) { |
|
884 | 884 | // Get attempts of a exercise. |
885 | 885 | if (!empty($lp_id) && |
886 | 886 | !empty($lp_item_id) && |
@@ -895,15 +895,15 @@ discard block |
||
895 | 895 | $row_path = Database::fetch_array($res_path); |
896 | 896 | |
897 | 897 | if (Database::num_rows($res_path) > 0) { |
898 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
898 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
899 | 899 | WHERE |
900 | - exe_exo_id="' . (int) $row_path['path'] . '" AND |
|
900 | + exe_exo_id="' . (int) $row_path['path'].'" AND |
|
901 | 901 | status <> "incomplete" AND |
902 | - exe_user_id="' . $user_id . '" AND |
|
903 | - orig_lp_id = "' . (int) $lp_id . '" AND |
|
904 | - orig_lp_item_id = "' . (int) $lp_item_id . '" AND |
|
905 | - c_id = ' . $course_id . ' AND |
|
906 | - session_id = ' . $session_id . ' |
|
902 | + exe_user_id="' . $user_id.'" AND |
|
903 | + orig_lp_id = "' . (int) $lp_id.'" AND |
|
904 | + orig_lp_item_id = "' . (int) $lp_item_id.'" AND |
|
905 | + c_id = ' . $course_id.' AND |
|
906 | + session_id = ' . $session_id.' |
|
907 | 907 | ORDER BY exe_date'; |
908 | 908 | $res_attempts = Database::query($sql); |
909 | 909 | $num_attempts = Database::num_rows($res_attempts); |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | if ($mktime_start_date && $mktime_exe_date) { |
922 | 922 | $mytime = ((int) $mktime_exe_date - (int) $mktime_start_date); |
923 | 923 | $time_attemp = learnpathItem :: getScormTimeFromParameter('js', $mytime); |
924 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
924 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
925 | 925 | } else { |
926 | 926 | $time_attemp = ' - '; |
927 | 927 | } |
@@ -947,33 +947,33 @@ discard block |
||
947 | 947 | $my_lesson_status = learnpathitem::humanize_status('incomplete'); |
948 | 948 | } |
949 | 949 | |
950 | - $output .= '<tr class="' . $oddclass . '" > |
|
950 | + $output .= '<tr class="'.$oddclass.'" > |
|
951 | 951 | <td></td> |
952 | - <td>' . $extend_attempt_link . '</td> |
|
953 | - <td colspan="3">' . get_lang('Attempt').' '. $n.'</td> |
|
954 | - <td colspan="2">' . $my_lesson_status . '</td> |
|
955 | - <td colspan="2">'.$view_score . '</td> |
|
956 | - <td colspan="2">'.$time_attemp . '</td>'; |
|
952 | + <td>' . $extend_attempt_link.'</td> |
|
953 | + <td colspan="3">' . get_lang('Attempt').' '.$n.'</td> |
|
954 | + <td colspan="2">' . $my_lesson_status.'</td> |
|
955 | + <td colspan="2">'.$view_score.'</td> |
|
956 | + <td colspan="2">'.$time_attemp.'</td>'; |
|
957 | 957 | if ($action == 'classic') { |
958 | 958 | if ($origin != 'tracking') { |
959 | 959 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
960 | 960 | $output .= '<td> |
961 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
961 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
962 | 962 | </td>'; |
963 | 963 | } else { |
964 | 964 | $output .= '<td> |
965 | - <a href="../exercise/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent"> |
|
966 | - <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
965 | + <a href="../exercise/exercise_show.php?origin=' . $origin.'&id='.$my_exe_id.'&cidReq='.$courseCode.'" target="_parent"> |
|
966 | + <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
967 | 967 | </a></td>'; |
968 | 968 | } |
969 | 969 | } else { |
970 | 970 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
971 | 971 | $output .= '<td> |
972 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>'; |
|
972 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></td>'; |
|
973 | 973 | } else { |
974 | 974 | $output .= '<td> |
975 | - <a href="../exercise/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent"> |
|
976 | - <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>'; |
|
975 | + <a href="../exercise/exercise_show.php?cidReq=' . $courseCode.'&origin=correct_exercise_in_lp&id='.$my_exe_id.'" target="_parent"> |
|
976 | + <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>'; |
|
977 | 977 | } |
978 | 978 | } |
979 | 979 | } |
@@ -1032,13 +1032,13 @@ discard block |
||
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time); |
1035 | - $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time); |
|
1035 | + $total_time = str_replace('NaN', '00'.$h.'00\'00"', $total_time); |
|
1036 | 1036 | |
1037 | 1037 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
1038 | 1038 | $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); |
1039 | 1039 | } else { |
1040 | 1040 | if (is_numeric($total_score)) { |
1041 | - $final_score = $total_score . '%'; |
|
1041 | + $final_score = $total_score.'%'; |
|
1042 | 1042 | } else { |
1043 | 1043 | $final_score = $total_score; |
1044 | 1044 | } |
@@ -1054,19 +1054,19 @@ discard block |
||
1054 | 1054 | |
1055 | 1055 | $action = null; |
1056 | 1056 | if ($type == 'classic') { |
1057 | - $action = '<td></td>'; |
|
1057 | + $action = '<td></td>'; |
|
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | $output .= '<tr class="'.$oddclass.'"> |
1061 | 1061 | <td></td> |
1062 | 1062 | <td colspan="4"> |
1063 | - <i>' . get_lang('AccomplishedStepsTotal') .'</i> |
|
1063 | + <i>' . get_lang('AccomplishedStepsTotal').'</i> |
|
1064 | 1064 | </td> |
1065 | 1065 | <td colspan="2">'.$progress.'%</td> |
1066 | 1066 | <td colspan="2"> |
1067 | 1067 | ' . $final_score.' |
1068 | 1068 | </td> |
1069 | - <td colspan="2">' . $total_time . '</div> |
|
1069 | + <td colspan="2">' . $total_time.'</div> |
|
1070 | 1070 | '.$action.' |
1071 | 1071 | </tr>'; |
1072 | 1072 | |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
1411 | 1411 | if (is_array($user_id)) { |
1412 | 1412 | $user_id = array_map('intval', $user_id); |
1413 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1413 | + $condition_user = " AND user_id IN (".implode(',', $user_id).") "; |
|
1414 | 1414 | } else { |
1415 | 1415 | $user_id = intval($user_id); |
1416 | 1416 | $condition_user = " AND user_id = $user_id "; |
@@ -1446,13 +1446,13 @@ discard block |
||
1446 | 1446 | { |
1447 | 1447 | $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
1448 | 1448 | $sql = 'SELECT login_date |
1449 | - FROM ' . $tbl_track_login . ' |
|
1450 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
1449 | + FROM ' . $tbl_track_login.' |
|
1450 | + WHERE login_user_id = ' . intval($student_id).' |
|
1451 | 1451 | ORDER BY login_date ASC |
1452 | 1452 | LIMIT 0,1'; |
1453 | 1453 | |
1454 | 1454 | $rs = Database::query($sql); |
1455 | - if (Database::num_rows($rs)>0) { |
|
1455 | + if (Database::num_rows($rs) > 0) { |
|
1456 | 1456 | if ($first_login_date = Database::result($rs, 0, 0)) { |
1457 | 1457 | return api_convert_and_format_date( |
1458 | 1458 | $first_login_date, |
@@ -1477,8 +1477,8 @@ discard block |
||
1477 | 1477 | { |
1478 | 1478 | $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
1479 | 1479 | $sql = 'SELECT login_date |
1480 | - FROM ' . $table . ' |
|
1481 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
1480 | + FROM ' . $table.' |
|
1481 | + WHERE login_user_id = ' . intval($student_id).' |
|
1482 | 1482 | ORDER BY login_date |
1483 | 1483 | DESC LIMIT 0,1'; |
1484 | 1484 | |
@@ -1487,18 +1487,18 @@ discard block |
||
1487 | 1487 | if ($last_login_date = Database::result($rs, 0, 0)) { |
1488 | 1488 | $last_login_date = api_get_local_time($last_login_date); |
1489 | 1489 | if ($return_timestamp) { |
1490 | - return api_strtotime($last_login_date,'UTC'); |
|
1490 | + return api_strtotime($last_login_date, 'UTC'); |
|
1491 | 1491 | } else { |
1492 | 1492 | if (!$warning_message) { |
1493 | 1493 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
1494 | 1494 | } else { |
1495 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1495 | + $timestamp = api_strtotime($last_login_date, 'UTC'); |
|
1496 | 1496 | $currentTimestamp = time(); |
1497 | 1497 | |
1498 | 1498 | //If the last connection is > than 7 days, the text is red |
1499 | 1499 | //345600 = 7 days in seconds |
1500 | 1500 | if ($currentTimestamp - $timestamp > 604800) { |
1501 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1501 | + return '<span style="color: #F00;">'.api_format_date($last_login_date, DATE_FORMAT_SHORT).'</span>'; |
|
1502 | 1502 | } else { |
1503 | 1503 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
1504 | 1504 | } |
@@ -1533,7 +1533,7 @@ discard block |
||
1533 | 1533 | $sql = "$select |
1534 | 1534 | FROM $tbl_track_login |
1535 | 1535 | WHERE |
1536 | - login_user_id IN (' ". implode("','", $studentList) . "' ) AND |
|
1536 | + login_user_id IN (' ".implode("','", $studentList)."' ) AND |
|
1537 | 1537 | login_date < '$date' |
1538 | 1538 | "; |
1539 | 1539 | $rs = Database::query($sql); |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | '.Display::return_icon('messagebox_warning.gif').' |
1633 | 1633 | </a>' |
1634 | 1634 | : null; |
1635 | - return $icon. Display::label($last_login_date, 'warning'); |
|
1635 | + return $icon.Display::label($last_login_date, 'warning'); |
|
1636 | 1636 | } else { |
1637 | 1637 | return $last_login_date; |
1638 | 1638 | } |
@@ -1667,8 +1667,8 @@ discard block |
||
1667 | 1667 | |
1668 | 1668 | // Given we're storing in cache, round the start and end times |
1669 | 1669 | // to the lower minute |
1670 | - $roundedStart = substr($start, 0, -2) . '00'; |
|
1671 | - $roundedStop = substr($stop, 0, -2) . '00'; |
|
1670 | + $roundedStart = substr($start, 0, -2).'00'; |
|
1671 | + $roundedStop = substr($stop, 0, -2).'00'; |
|
1672 | 1672 | $roundedStart = Database::escape_string($roundedStart); |
1673 | 1673 | $roundedStop = Database::escape_string($roundedStop); |
1674 | 1674 | |
@@ -1678,7 +1678,7 @@ discard block |
||
1678 | 1678 | $session_id = intval($session_id); |
1679 | 1679 | $count = 0; |
1680 | 1680 | $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
1681 | - $sql = "SELECT count(*) as count_connections |
|
1681 | + $sql = "SELECT count(*) as count_connections |
|
1682 | 1682 | FROM $tbl_track_e_course_access |
1683 | 1683 | WHERE |
1684 | 1684 | c_id = $courseId AND |
@@ -1700,7 +1700,7 @@ discard block |
||
1700 | 1700 | $count = apcu_fetch($apc_var); |
1701 | 1701 | } else { |
1702 | 1702 | $rs = Database::query($sql); |
1703 | - if (Database::num_rows($rs)>0) { |
|
1703 | + if (Database::num_rows($rs) > 0) { |
|
1704 | 1704 | $row = Database::fetch_object($rs); |
1705 | 1705 | $count = $row->count_connections; |
1706 | 1706 | } |
@@ -1709,7 +1709,7 @@ discard block |
||
1709 | 1709 | } |
1710 | 1710 | } else { |
1711 | 1711 | $rs = Database::query($sql); |
1712 | - if (Database::num_rows($rs)>0) { |
|
1712 | + if (Database::num_rows($rs) > 0) { |
|
1713 | 1713 | $row = Database::fetch_object($rs); |
1714 | 1714 | $count = $row->count_connections; |
1715 | 1715 | } |
@@ -1731,14 +1731,14 @@ discard block |
||
1731 | 1731 | $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
1732 | 1732 | |
1733 | 1733 | $sql = 'SELECT DISTINCT c_id |
1734 | - FROM ' . $tbl_course_rel_user . ' |
|
1734 | + FROM ' . $tbl_course_rel_user.' |
|
1735 | 1735 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
1736 | 1736 | $rs = Database::query($sql); |
1737 | 1737 | $nb_courses = Database::num_rows($rs); |
1738 | 1738 | |
1739 | 1739 | if ($include_sessions) { |
1740 | 1740 | $sql = 'SELECT DISTINCT c_id |
1741 | - FROM ' . $tbl_session_course_rel_user . ' |
|
1741 | + FROM ' . $tbl_session_course_rel_user.' |
|
1742 | 1742 | WHERE user_id = ' . $user_id; |
1743 | 1743 | $rs = Database::query($sql); |
1744 | 1744 | $nb_courses += Database::num_rows($rs); |
@@ -1785,7 +1785,7 @@ discard block |
||
1785 | 1785 | $condition_quiz = ""; |
1786 | 1786 | if (!empty($exercise_id)) { |
1787 | 1787 | $exercise_id = intval($exercise_id); |
1788 | - $condition_quiz =" AND id = $exercise_id "; |
|
1788 | + $condition_quiz = " AND id = $exercise_id "; |
|
1789 | 1789 | } |
1790 | 1790 | |
1791 | 1791 | // Compose a filter based on optional session id given |
@@ -1838,7 +1838,7 @@ discard block |
||
1838 | 1838 | } |
1839 | 1839 | } |
1840 | 1840 | if (!empty($exercise_list)) { |
1841 | - $exercise_id = implode("','",$exercise_list); |
|
1841 | + $exercise_id = implode("','", $exercise_list); |
|
1842 | 1842 | } |
1843 | 1843 | } |
1844 | 1844 | |
@@ -1863,10 +1863,10 @@ discard block |
||
1863 | 1863 | $quiz_avg_score = null; |
1864 | 1864 | |
1865 | 1865 | if (!empty($row['avg_score'])) { |
1866 | - $quiz_avg_score = round($row['avg_score'],2); |
|
1866 | + $quiz_avg_score = round($row['avg_score'], 2); |
|
1867 | 1867 | } |
1868 | 1868 | |
1869 | - if(!empty($row['num_attempts'])) { |
|
1869 | + if (!empty($row['num_attempts'])) { |
|
1870 | 1870 | $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
1871 | 1871 | } |
1872 | 1872 | if (is_array($student_id)) { |
@@ -1996,7 +1996,7 @@ discard block |
||
1996 | 1996 | $row = Database::fetch_row($rs); |
1997 | 1997 | $count = $row[0]; |
1998 | 1998 | } |
1999 | - $count = ($count != 0 ) ? 100*round(intval($count)/count($exercise_list), 2) .'%' : '0%'; |
|
1999 | + $count = ($count != 0) ? 100 * round(intval($count) / count($exercise_list), 2).'%' : '0%'; |
|
2000 | 2000 | return $count; |
2001 | 2001 | } |
2002 | 2002 | |
@@ -2021,7 +2021,7 @@ discard block |
||
2021 | 2021 | ); |
2022 | 2022 | |
2023 | 2023 | if (!empty($best_attempt) && !empty($best_attempt['exe_weighting'])) { |
2024 | - $result += $best_attempt['exe_result']/$best_attempt['exe_weighting']; |
|
2024 | + $result += $best_attempt['exe_result'] / $best_attempt['exe_weighting']; |
|
2025 | 2025 | } |
2026 | 2026 | } |
2027 | 2027 | $result = $result / count($exercise_list); |
@@ -2058,7 +2058,7 @@ discard block |
||
2058 | 2058 | $query = sprintf($sql, intval($courseId), $sessionId); |
2059 | 2059 | $rs = Database::query($query); |
2060 | 2060 | $teachers = array(); |
2061 | - while ($teacher = Database::fetch_array($rs,'ASSOC')) { |
|
2061 | + while ($teacher = Database::fetch_array($rs, 'ASSOC')) { |
|
2062 | 2062 | $teachers[] = $teacher; |
2063 | 2063 | } |
2064 | 2064 | $data = array(); |
@@ -2182,7 +2182,7 @@ discard block |
||
2182 | 2182 | $data[] = array( |
2183 | 2183 | 'course' => $course['title'], |
2184 | 2184 | 'session' => $teacher['name'], |
2185 | - 'tutor' => $tutor['username'] . ' - ' . $tutor['lastname'] . ' ' . $tutor['firstname'], |
|
2185 | + 'tutor' => $tutor['username'].' - '.$tutor['lastname'].' '.$tutor['firstname'], |
|
2186 | 2186 | 'documents' => $totalDocuments, |
2187 | 2187 | 'links' => $totalLinks, |
2188 | 2188 | 'forums' => $totalForums, |
@@ -2245,7 +2245,7 @@ discard block |
||
2245 | 2245 | for ($i = 0; $i < count($lpIdList); $i++) { |
2246 | 2246 | $placeHolders[] = '?'; |
2247 | 2247 | } |
2248 | - $lpConditions['AND id IN(' . implode(', ', $placeHolders) . ') '] = $lpIdList; |
|
2248 | + $lpConditions['AND id IN('.implode(', ', $placeHolders).') '] = $lpIdList; |
|
2249 | 2249 | } |
2250 | 2250 | |
2251 | 2251 | if ($onlySeriousGame) { |
@@ -2265,14 +2265,14 @@ discard block |
||
2265 | 2265 | |
2266 | 2266 | $conditions = [ |
2267 | 2267 | " c_id = {$courseInfo['real_id']} ", |
2268 | - " lp_view.lp_id IN(" . implode(', ', $filteredLP) . ") " |
|
2268 | + " lp_view.lp_id IN(".implode(', ', $filteredLP).") " |
|
2269 | 2269 | ]; |
2270 | 2270 | |
2271 | 2271 | $groupBy = 'GROUP BY lp_id'; |
2272 | 2272 | |
2273 | 2273 | if (is_array($studentId)) { |
2274 | 2274 | $studentId = array_map('intval', $studentId); |
2275 | - $conditions[] = " lp_view.user_id IN (" . implode(',', $studentId) . ") "; |
|
2275 | + $conditions[] = " lp_view.user_id IN (".implode(',', $studentId).") "; |
|
2276 | 2276 | |
2277 | 2277 | |
2278 | 2278 | } else { |
@@ -2407,7 +2407,7 @@ discard block |
||
2407 | 2407 | // Compose a filter based on optional learning paths list given |
2408 | 2408 | $condition_lp = ""; |
2409 | 2409 | if (count($lp_ids) > 0) { |
2410 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
2410 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
2411 | 2411 | } |
2412 | 2412 | |
2413 | 2413 | // Compose a filter based on optional session id |
@@ -2447,9 +2447,9 @@ discard block |
||
2447 | 2447 | // prepare filter on users |
2448 | 2448 | if (is_array($student_id)) { |
2449 | 2449 | array_walk($student_id, 'intval'); |
2450 | - $condition_user1 =" AND user_id IN (".implode(',', $student_id).") "; |
|
2450 | + $condition_user1 = " AND user_id IN (".implode(',', $student_id).") "; |
|
2451 | 2451 | } else { |
2452 | - $condition_user1 =" AND user_id = $student_id "; |
|
2452 | + $condition_user1 = " AND user_id = $student_id "; |
|
2453 | 2453 | } |
2454 | 2454 | |
2455 | 2455 | if ($count_row_lp > 0 && !empty($student_id)) { |
@@ -2492,7 +2492,7 @@ discard block |
||
2492 | 2492 | ORDER BY lp_item_id"; |
2493 | 2493 | $res_lp_item = Database::query($sql); |
2494 | 2494 | |
2495 | - while ($row_lp_item = Database::fetch_array($res_lp_item,'ASSOC')) { |
|
2495 | + while ($row_lp_item = Database::fetch_array($res_lp_item, 'ASSOC')) { |
|
2496 | 2496 | $my_lp_item_id = $row_lp_item['lp_item_id']; |
2497 | 2497 | |
2498 | 2498 | // Getting the most recent attempt |
@@ -2515,8 +2515,8 @@ discard block |
||
2515 | 2515 | ORDER BY view_count DESC |
2516 | 2516 | LIMIT 1"; |
2517 | 2517 | $res_lp_item_result = Database::query($sql); |
2518 | - while ($row_max_score = Database::fetch_array($res_lp_item_result,'ASSOC')) { |
|
2519 | - $list[]= $row_max_score; |
|
2518 | + while ($row_max_score = Database::fetch_array($res_lp_item_result, 'ASSOC')) { |
|
2519 | + $list[] = $row_max_score; |
|
2520 | 2520 | } |
2521 | 2521 | } |
2522 | 2522 | } else { |
@@ -2540,8 +2540,8 @@ discard block |
||
2540 | 2540 | if ($debug) echo $sql.'<br />'; |
2541 | 2541 | $res_max_score = Database::query($sql); |
2542 | 2542 | |
2543 | - while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
|
2544 | - $list[]= $row_max_score; |
|
2543 | + while ($row_max_score = Database::fetch_array($res_max_score, 'ASSOC')) { |
|
2544 | + $list[] = $row_max_score; |
|
2545 | 2545 | } |
2546 | 2546 | } |
2547 | 2547 | |
@@ -2556,7 +2556,7 @@ discard block |
||
2556 | 2556 | $max_score_item_view = $row_max_score['max_score_item_view']; |
2557 | 2557 | $score = $row_max_score['score']; |
2558 | 2558 | |
2559 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2559 | + if ($debug) echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>'; |
|
2560 | 2560 | |
2561 | 2561 | if ($row_max_score['item_type'] == 'sco') { |
2562 | 2562 | /* Check if it is sco (easier to get max_score) |
@@ -2574,7 +2574,7 @@ discard block |
||
2574 | 2574 | } |
2575 | 2575 | // Avoid division by zero errors |
2576 | 2576 | if (!empty($max_score)) { |
2577 | - $lp_partial_total += $score/$max_score; |
|
2577 | + $lp_partial_total += $score / $max_score; |
|
2578 | 2578 | } |
2579 | 2579 | if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
2580 | 2580 | } else { |
@@ -2598,10 +2598,10 @@ discard block |
||
2598 | 2598 | ORDER BY exe_date DESC |
2599 | 2599 | LIMIT 1"; |
2600 | 2600 | |
2601 | - if ($debug) echo $sql .'<br />'; |
|
2601 | + if ($debug) echo $sql.'<br />'; |
|
2602 | 2602 | $result_last_attempt = Database::query($sql); |
2603 | 2603 | $num = Database :: num_rows($result_last_attempt); |
2604 | - if ($num > 0 ) { |
|
2604 | + if ($num > 0) { |
|
2605 | 2605 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
2606 | 2606 | if ($debug) echo $id_last_attempt.'<br />'; |
2607 | 2607 | |
@@ -2630,13 +2630,13 @@ discard block |
||
2630 | 2630 | $max_score = $row_max_score_bis['maxscore']; |
2631 | 2631 | } |
2632 | 2632 | if (!empty($max_score) && floatval($max_score) > 0) { |
2633 | - $lp_partial_total += $score/$max_score; |
|
2633 | + $lp_partial_total += $score / $max_score; |
|
2634 | 2634 | } |
2635 | 2635 | if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
2636 | 2636 | } |
2637 | 2637 | } |
2638 | 2638 | |
2639 | - if (in_array($row_max_score['item_type'], array('quiz','sco'))) { |
|
2639 | + if (in_array($row_max_score['item_type'], array('quiz', 'sco'))) { |
|
2640 | 2640 | // Normal way |
2641 | 2641 | if ($use_max_score[$lp_id]) { |
2642 | 2642 | $count_items++; |
@@ -2671,8 +2671,8 @@ discard block |
||
2671 | 2671 | if ($debug) echo $sql; |
2672 | 2672 | $result_have_quiz = Database::query($sql); |
2673 | 2673 | |
2674 | - if (Database::num_rows($result_have_quiz) > 0 ) { |
|
2675 | - $row = Database::fetch_array($result_have_quiz,'ASSOC'); |
|
2674 | + if (Database::num_rows($result_have_quiz) > 0) { |
|
2675 | + $row = Database::fetch_array($result_have_quiz, 'ASSOC'); |
|
2676 | 2676 | if (is_numeric($row['count']) && $row['count'] != 0) { |
2677 | 2677 | $lp_with_quiz++; |
2678 | 2678 | } |
@@ -2684,7 +2684,7 @@ discard block |
||
2684 | 2684 | |
2685 | 2685 | if ($lp_with_quiz != 0) { |
2686 | 2686 | if (!$return_array) { |
2687 | - $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
|
2687 | + $score_of_scorm_calculate = round(($global_result / $lp_with_quiz), 2); |
|
2688 | 2688 | if ($debug) var_dump($score_of_scorm_calculate); |
2689 | 2689 | if (empty($lp_ids)) { |
2690 | 2690 | if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
@@ -2758,9 +2758,9 @@ discard block |
||
2758 | 2758 | |
2759 | 2759 | if (is_array($student_id)) { |
2760 | 2760 | array_walk($student_id, 'intval'); |
2761 | - $conditions[] =" lp_view.user_id IN (".implode(',', $student_id).") "; |
|
2761 | + $conditions[] = " lp_view.user_id IN (".implode(',', $student_id).") "; |
|
2762 | 2762 | } else { |
2763 | - $conditions[] =" lp_view.user_id = $student_id "; |
|
2763 | + $conditions[] = " lp_view.user_id = $student_id "; |
|
2764 | 2764 | } |
2765 | 2765 | |
2766 | 2766 | $conditionsToString = implode('AND ', $conditions); |
@@ -2814,7 +2814,7 @@ discard block |
||
2814 | 2814 | // Compose a filter based on optional learning paths list given |
2815 | 2815 | $condition_lp = ""; |
2816 | 2816 | if (count($lp_ids) > 0) { |
2817 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
2817 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
2818 | 2818 | } |
2819 | 2819 | |
2820 | 2820 | // Compose a filter based on optional session id |
@@ -2876,7 +2876,7 @@ discard block |
||
2876 | 2876 | |
2877 | 2877 | if (!empty($course)) { |
2878 | 2878 | |
2879 | - $course_id = $course['real_id']; |
|
2879 | + $course_id = $course['real_id']; |
|
2880 | 2880 | |
2881 | 2881 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
2882 | 2882 | $t_lpv = Database :: get_course_table(TABLE_LP_VIEW); |
@@ -2890,8 +2890,8 @@ discard block |
||
2890 | 2890 | // calculates last connection time |
2891 | 2891 | if ($count_row_lp > 0) { |
2892 | 2892 | $sql = 'SELECT MAX(start_time) |
2893 | - FROM ' . $t_lpiv . ' AS item_view |
|
2894 | - INNER JOIN ' . $t_lpv . ' AS view |
|
2893 | + FROM ' . $t_lpiv.' AS item_view |
|
2894 | + INNER JOIN ' . $t_lpv.' AS view |
|
2895 | 2895 | ON item_view.lp_view_id = view.id |
2896 | 2896 | WHERE |
2897 | 2897 | item_view.c_id = '.$course_id.' AND |
@@ -2927,15 +2927,15 @@ discard block |
||
2927 | 2927 | |
2928 | 2928 | // At first, courses where $coach_id is coach of the course // |
2929 | 2929 | $sql = 'SELECT session_id, c_id |
2930 | - FROM ' . $tbl_session_course_user . ' |
|
2930 | + FROM ' . $tbl_session_course_user.' |
|
2931 | 2931 | WHERE user_id=' . $coach_id.' AND status=2'; |
2932 | 2932 | |
2933 | 2933 | if (api_is_multiple_url_enabled()) { |
2934 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2934 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2935 | 2935 | $access_url_id = api_get_current_access_url_id(); |
2936 | 2936 | if ($access_url_id != -1) { |
2937 | 2937 | $sql = 'SELECT scu.session_id, scu.c_id |
2938 | - FROM ' . $tbl_session_course_user . ' scu |
|
2938 | + FROM ' . $tbl_session_course_user.' scu |
|
2939 | 2939 | INNER JOIN '.$tbl_session_rel_access_url.' sru |
2940 | 2940 | ON (scu.session_id=sru.session_id) |
2941 | 2941 | WHERE |
@@ -2969,28 +2969,28 @@ discard block |
||
2969 | 2969 | |
2970 | 2970 | // Then, courses where $coach_id is coach of the session // |
2971 | 2971 | $sql = 'SELECT session_course_user.user_id |
2972 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2972 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2973 | 2973 | INNER JOIN '.$tbl_session_user.' sru |
2974 | 2974 | ON session_course_user.user_id = sru.user_id AND session_course_user.session_id = sru.session_id |
2975 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2975 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2976 | 2976 | ON session_course.c_id = session_course_user.c_id |
2977 | 2977 | AND session_course_user.session_id = session_course.session_id |
2978 | - INNER JOIN ' . $tbl_session . ' as session |
|
2978 | + INNER JOIN ' . $tbl_session.' as session |
|
2979 | 2979 | ON session.id = session_course.session_id |
2980 | 2980 | AND session.id_coach = ' . $coach_id; |
2981 | 2981 | if (api_is_multiple_url_enabled()) { |
2982 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2982 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2983 | 2983 | $access_url_id = api_get_current_access_url_id(); |
2984 | - if ($access_url_id != -1){ |
|
2984 | + if ($access_url_id != -1) { |
|
2985 | 2985 | $sql = 'SELECT session_course_user.user_id |
2986 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2986 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2987 | 2987 | INNER JOIN '.$tbl_session_user.' sru |
2988 | 2988 | ON session_course_user.user_id = sru.user_id AND |
2989 | 2989 | session_course_user.session_id = sru.session_id |
2990 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2990 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2991 | 2991 | ON session_course.c_id = session_course_user.c_id AND |
2992 | 2992 | session_course_user.session_id = session_course.session_id |
2993 | - INNER JOIN ' . $tbl_session . ' as session |
|
2993 | + INNER JOIN ' . $tbl_session.' as session |
|
2994 | 2994 | ON session.id = session_course.session_id AND |
2995 | 2995 | session.id_coach = ' . $coach_id.' |
2996 | 2996 | INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url |
@@ -3020,8 +3020,8 @@ discard block |
||
3020 | 3020 | |
3021 | 3021 | $students = []; |
3022 | 3022 | // At first, courses where $coach_id is coach of the course // |
3023 | - $sql = 'SELECT c_id FROM ' . $tbl_session_course_user . ' |
|
3024 | - WHERE session_id="' . $id_session . '" AND user_id=' . $coach_id.' AND status=2'; |
|
3023 | + $sql = 'SELECT c_id FROM '.$tbl_session_course_user.' |
|
3024 | + WHERE session_id="' . $id_session.'" AND user_id='.$coach_id.' AND status=2'; |
|
3025 | 3025 | $result = Database::query($sql); |
3026 | 3026 | |
3027 | 3027 | while ($a_courses = Database::fetch_array($result)) { |
@@ -3031,7 +3031,7 @@ discard block |
||
3031 | 3031 | FROM $tbl_session_course_user AS srcru |
3032 | 3032 | WHERE |
3033 | 3033 | c_id = '$courseId' AND |
3034 | - session_id = '" . $id_session . "'"; |
|
3034 | + session_id = '".$id_session."'"; |
|
3035 | 3035 | $rs = Database::query($sql); |
3036 | 3036 | while ($row = Database::fetch_array($rs)) { |
3037 | 3037 | $students[$row['user_id']] = $row['user_id']; |
@@ -3039,15 +3039,15 @@ discard block |
||
3039 | 3039 | } |
3040 | 3040 | |
3041 | 3041 | // Then, courses where $coach_id is coach of the session |
3042 | - $sql = 'SELECT id_coach FROM ' . $tbl_session . ' |
|
3043 | - WHERE id="' . $id_session.'" AND id_coach="' . $coach_id . '"'; |
|
3042 | + $sql = 'SELECT id_coach FROM '.$tbl_session.' |
|
3043 | + WHERE id="' . $id_session.'" AND id_coach="'.$coach_id.'"'; |
|
3044 | 3044 | $result = Database::query($sql); |
3045 | 3045 | |
3046 | 3046 | //He is the session_coach so we select all the users in the session |
3047 | 3047 | if (Database::num_rows($result) > 0) { |
3048 | 3048 | $sql = 'SELECT DISTINCT srcru.user_id |
3049 | - FROM ' . $tbl_session_course_user . ' AS srcru |
|
3050 | - WHERE session_id="' . $id_session . '"'; |
|
3049 | + FROM ' . $tbl_session_course_user.' AS srcru |
|
3050 | + WHERE session_id="' . $id_session.'"'; |
|
3051 | 3051 | $result = Database::query($sql); |
3052 | 3052 | while ($row = Database::fetch_array($result)) { |
3053 | 3053 | $students[$row['user_id']] = $row['user_id']; |
@@ -3074,8 +3074,8 @@ discard block |
||
3074 | 3074 | |
3075 | 3075 | // At first, courses where $coach_id is coach of the course // |
3076 | 3076 | |
3077 | - $sql = 'SELECT 1 FROM ' . $tbl_session_course_user . ' |
|
3078 | - WHERE user_id=' . $coach_id .' AND status=2'; |
|
3077 | + $sql = 'SELECT 1 FROM '.$tbl_session_course_user.' |
|
3078 | + WHERE user_id=' . $coach_id.' AND status=2'; |
|
3079 | 3079 | $result = Database::query($sql); |
3080 | 3080 | if (Database::num_rows($result) > 0) { |
3081 | 3081 | return true; |
@@ -3083,12 +3083,12 @@ discard block |
||
3083 | 3083 | |
3084 | 3084 | // Then, courses where $coach_id is coach of the session |
3085 | 3085 | $sql = 'SELECT session_course_user.user_id |
3086 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
3087 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
3086 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
3087 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
3088 | 3088 | ON session_course.c_id = session_course_user.c_id |
3089 | - INNER JOIN ' . $tbl_session . ' as session |
|
3089 | + INNER JOIN ' . $tbl_session.' as session |
|
3090 | 3090 | ON session.id = session_course.session_id |
3091 | - AND session.id_coach = ' . $coach_id . ' |
|
3091 | + AND session.id_coach = ' . $coach_id.' |
|
3092 | 3092 | WHERE user_id = ' . $student_id; |
3093 | 3093 | $result = Database::query($sql); |
3094 | 3094 | if (Database::num_rows($result) > 0) { |
@@ -3120,16 +3120,16 @@ discard block |
||
3120 | 3120 | // At first, courses where $coach_id is coach of the course. |
3121 | 3121 | |
3122 | 3122 | $sql = 'SELECT DISTINCT c.code |
3123 | - FROM ' . $tbl_session_course_user . ' sc |
|
3123 | + FROM ' . $tbl_session_course_user.' sc |
|
3124 | 3124 | INNER JOIN '.$tbl_course.' c |
3125 | 3125 | ON (c.id = sc.c_id) |
3126 | 3126 | WHERE user_id = ' . $coach_id.' AND status = 2'; |
3127 | 3127 | |
3128 | 3128 | if (api_is_multiple_url_enabled()) { |
3129 | 3129 | $access_url_id = api_get_current_access_url_id(); |
3130 | - if ($access_url_id != -1){ |
|
3130 | + if ($access_url_id != -1) { |
|
3131 | 3131 | $sql = 'SELECT DISTINCT c.code |
3132 | - FROM ' . $tbl_session_course_user . ' scu |
|
3132 | + FROM ' . $tbl_session_course_user.' scu |
|
3133 | 3133 | INNER JOIN '.$tbl_course.' c |
3134 | 3134 | ON (c.code = scu.c_id) |
3135 | 3135 | INNER JOIN '.$tbl_course_rel_access_url.' cru |
@@ -3142,7 +3142,7 @@ discard block |
||
3142 | 3142 | } |
3143 | 3143 | |
3144 | 3144 | if (!empty($id_session)) { |
3145 | - $sql .= ' AND session_id=' . $id_session; |
|
3145 | + $sql .= ' AND session_id='.$id_session; |
|
3146 | 3146 | } |
3147 | 3147 | |
3148 | 3148 | $courseList = array(); |
@@ -3154,25 +3154,25 @@ discard block |
||
3154 | 3154 | // Then, courses where $coach_id is coach of the session |
3155 | 3155 | |
3156 | 3156 | $sql = 'SELECT DISTINCT course.code |
3157 | - FROM ' . $tbl_session_course . ' as session_course |
|
3158 | - INNER JOIN ' . $tbl_session . ' as session |
|
3157 | + FROM ' . $tbl_session_course.' as session_course |
|
3158 | + INNER JOIN ' . $tbl_session.' as session |
|
3159 | 3159 | ON session.id = session_course.session_id |
3160 | - AND session.id_coach = ' . $coach_id . ' |
|
3161 | - INNER JOIN ' . $tbl_course . ' as course |
|
3160 | + AND session.id_coach = ' . $coach_id.' |
|
3161 | + INNER JOIN ' . $tbl_course.' as course |
|
3162 | 3162 | ON course.id = session_course.c_id'; |
3163 | 3163 | |
3164 | 3164 | if (api_is_multiple_url_enabled()) { |
3165 | 3165 | $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
3166 | 3166 | $access_url_id = api_get_current_access_url_id(); |
3167 | - if ($access_url_id != -1){ |
|
3167 | + if ($access_url_id != -1) { |
|
3168 | 3168 | $sql = 'SELECT DISTINCT c.code |
3169 | - FROM ' . $tbl_session_course . ' as session_course |
|
3169 | + FROM ' . $tbl_session_course.' as session_course |
|
3170 | 3170 | INNER JOIN '.$tbl_course.' c |
3171 | 3171 | ON (c.id = session_course.c_id) |
3172 | - INNER JOIN ' . $tbl_session . ' as session |
|
3172 | + INNER JOIN ' . $tbl_session.' as session |
|
3173 | 3173 | ON session.id = session_course.session_id |
3174 | - AND session.id_coach = ' . $coach_id . ' |
|
3175 | - INNER JOIN ' . $tbl_course . ' as course |
|
3174 | + AND session.id_coach = ' . $coach_id.' |
|
3175 | + INNER JOIN ' . $tbl_course.' as course |
|
3176 | 3176 | ON course.id = session_course.c_id |
3177 | 3177 | INNER JOIN '.$tbl_course_rel_access_url.' course_rel_url |
3178 | 3178 | ON (course_rel_url.c_id = c.id)'; |
@@ -3180,12 +3180,12 @@ discard block |
||
3180 | 3180 | } |
3181 | 3181 | |
3182 | 3182 | if (!empty ($id_session)) { |
3183 | - $sql .= ' WHERE session_course.session_id=' . $id_session; |
|
3183 | + $sql .= ' WHERE session_course.session_id='.$id_session; |
|
3184 | 3184 | if (api_is_multiple_url_enabled()) |
3185 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
3186 | - } else { |
|
3185 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
3186 | + } else { |
|
3187 | 3187 | if (api_is_multiple_url_enabled()) |
3188 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3188 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3189 | 3189 | } |
3190 | 3190 | |
3191 | 3191 | $result = Database::query($sql); |
@@ -3241,7 +3241,7 @@ discard block |
||
3241 | 3241 | } |
3242 | 3242 | } |
3243 | 3243 | |
3244 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
3244 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
3245 | 3245 | $access_url_id = api_get_current_access_url_id(); |
3246 | 3246 | |
3247 | 3247 | $sql = " |
@@ -3365,7 +3365,7 @@ discard block |
||
3365 | 3365 | // table definition |
3366 | 3366 | $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
3367 | 3367 | $tbl_document = Database :: get_course_table(TABLE_DOCUMENT); |
3368 | - $course_id = $a_course['real_id']; |
|
3368 | + $course_id = $a_course['real_id']; |
|
3369 | 3369 | if (is_array($student_id)) { |
3370 | 3370 | $studentList = array_map('intval', $student_id); |
3371 | 3371 | $condition_user = " AND ip.insert_user_id IN ('".implode(',', $studentList)."') "; |
@@ -3418,7 +3418,7 @@ discard block |
||
3418 | 3418 | $a_course = CourseManager::get_course_information($course_code); |
3419 | 3419 | if (!empty($a_course)) { |
3420 | 3420 | $course_id = $a_course['real_id']; |
3421 | - $conditions[]= " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
3421 | + $conditions[] = " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
3422 | 3422 | } |
3423 | 3423 | |
3424 | 3424 | // table definition |
@@ -3427,14 +3427,14 @@ discard block |
||
3427 | 3427 | |
3428 | 3428 | if (is_array($student_id)) { |
3429 | 3429 | $studentList = array_map('intval', $student_id); |
3430 | - $conditions[]= " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
3430 | + $conditions[] = " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
3431 | 3431 | } else { |
3432 | 3432 | $student_id = intval($student_id); |
3433 | - $conditions[]= " ip.insert_user_id = '$student_id' "; |
|
3433 | + $conditions[] = " ip.insert_user_id = '$student_id' "; |
|
3434 | 3434 | } |
3435 | 3435 | if (isset($session_id)) { |
3436 | 3436 | $session_id = intval($session_id); |
3437 | - $conditions[]= " pub.session_id = $session_id "; |
|
3437 | + $conditions[] = " pub.session_id = $session_id "; |
|
3438 | 3438 | } |
3439 | 3439 | $conditionToString = implode('AND', $conditions); |
3440 | 3440 | |
@@ -3471,10 +3471,10 @@ discard block |
||
3471 | 3471 | $conditions = array(); |
3472 | 3472 | if (is_array($student_id)) { |
3473 | 3473 | $studentList = array_map('intval', $student_id); |
3474 | - $conditions[]= " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
3474 | + $conditions[] = " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
3475 | 3475 | } else { |
3476 | 3476 | $student_id = intval($student_id); |
3477 | - $conditions[]= " post.poster_id = '$student_id' "; |
|
3477 | + $conditions[] = " post.poster_id = '$student_id' "; |
|
3478 | 3478 | } |
3479 | 3479 | |
3480 | 3480 | $conditionsToString = implode('AND ', $conditions); |
@@ -3499,13 +3499,13 @@ discard block |
||
3499 | 3499 | if (!empty($courseInfo)) { |
3500 | 3500 | $forums = get_forums('', $courseCode, true, $session_id); |
3501 | 3501 | $course_id = $courseInfo['real_id']; |
3502 | - $conditions[]= " post.c_id = $course_id "; |
|
3502 | + $conditions[] = " post.c_id = $course_id "; |
|
3503 | 3503 | } |
3504 | 3504 | |
3505 | 3505 | if (!empty($forums)) { |
3506 | 3506 | $idList = array_column($forums, 'forum_id'); |
3507 | 3507 | $idListToString = implode("', '", $idList); |
3508 | - $conditions[]= " post.forum_id IN ('$idListToString')"; |
|
3508 | + $conditions[] = " post.forum_id IN ('$idListToString')"; |
|
3509 | 3509 | } |
3510 | 3510 | |
3511 | 3511 | $conditionsToString = implode('AND ', $conditions); |
@@ -3540,7 +3540,7 @@ discard block |
||
3540 | 3540 | $condition_session = ''; |
3541 | 3541 | if (isset($session_id)) { |
3542 | 3542 | $session_id = intval($session_id); |
3543 | - $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
3543 | + $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
3544 | 3544 | } |
3545 | 3545 | |
3546 | 3546 | $course_id = $courseInfo['real_id']; |
@@ -3596,7 +3596,7 @@ discard block |
||
3596 | 3596 | $condition_session = ''; |
3597 | 3597 | if (isset($session_id)) { |
3598 | 3598 | $session_id = intval($session_id); |
3599 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3599 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
3600 | 3600 | } |
3601 | 3601 | |
3602 | 3602 | $groupId = intval($groupId); |
@@ -3657,7 +3657,7 @@ discard block |
||
3657 | 3657 | $condition_session = ''; |
3658 | 3658 | if (isset($session_id)) { |
3659 | 3659 | $session_id = intval($session_id); |
3660 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3660 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
3661 | 3661 | } |
3662 | 3662 | |
3663 | 3663 | $groupId = intval($groupId); |
@@ -3736,7 +3736,7 @@ discard block |
||
3736 | 3736 | { |
3737 | 3737 | $student_id = intval($student_id); |
3738 | 3738 | $courseId = intval($courseId); |
3739 | - $session_id = intval($session_id); |
|
3739 | + $session_id = intval($session_id); |
|
3740 | 3740 | $date_time = ''; |
3741 | 3741 | |
3742 | 3742 | // table definition |
@@ -3805,7 +3805,7 @@ discard block |
||
3805 | 3805 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
3806 | 3806 | |
3807 | 3807 | $sql = 'SELECT 1 |
3808 | - FROM ' . $table . ' |
|
3808 | + FROM ' . $table.' |
|
3809 | 3809 | WHERE down_user_id = '.$student_id.' |
3810 | 3810 | AND c_id = "'.$courseId.'" |
3811 | 3811 | AND down_session_id = '.$session_id.' '; |
@@ -3883,30 +3883,30 @@ discard block |
||
3883 | 3883 | '.$inner.' |
3884 | 3884 | WHERE c.id = '.$courseId.' |
3885 | 3885 | GROUP BY stats_login.user_id |
3886 | - HAVING DATE_SUB( "' . $now . '", INTERVAL '.$since.' DAY) > max_date '; |
|
3886 | + HAVING DATE_SUB( "' . $now.'", INTERVAL '.$since.' DAY) > max_date '; |
|
3887 | 3887 | |
3888 | 3888 | if ($since == 'never') { |
3889 | 3889 | if (empty($session_id)) { |
3890 | 3890 | $sql = 'SELECT course_user.user_id |
3891 | - FROM ' . $table_course_rel_user . ' course_user |
|
3892 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
3891 | + FROM ' . $table_course_rel_user.' course_user |
|
3892 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
3893 | 3893 | ON course_user.user_id = stats_login.user_id AND |
3894 | - relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' |
|
3895 | - INNER JOIN ' . $tableCourse . ' c |
|
3894 | + relation_type<>' . COURSE_RELATION_TYPE_RRHH.' |
|
3895 | + INNER JOIN ' . $tableCourse.' c |
|
3896 | 3896 | ON (c.id = course_user.c_id) |
3897 | 3897 | WHERE |
3898 | - course_user.c_id = ' . $courseId . ' AND |
|
3898 | + course_user.c_id = ' . $courseId.' AND |
|
3899 | 3899 | stats_login.login_course_date IS NULL |
3900 | 3900 | GROUP BY course_user.user_id'; |
3901 | 3901 | } else { |
3902 | 3902 | $sql = 'SELECT session_course_user.user_id |
3903 | 3903 | FROM '.$tbl_session_course_user.' session_course_user |
3904 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
3904 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
3905 | 3905 | ON session_course_user.user_id = stats_login.user_id |
3906 | - INNER JOIN ' . $tableCourse . ' c |
|
3906 | + INNER JOIN ' . $tableCourse.' c |
|
3907 | 3907 | ON (c.id = session_course_user.c_id) |
3908 | 3908 | WHERE |
3909 | - session_course_user.c_id = ' . $courseId . ' AND |
|
3909 | + session_course_user.c_id = ' . $courseId.' AND |
|
3910 | 3910 | stats_login.login_course_date IS NULL |
3911 | 3911 | GROUP BY session_course_user.user_id'; |
3912 | 3912 | } |
@@ -3914,7 +3914,7 @@ discard block |
||
3914 | 3914 | |
3915 | 3915 | $rs = Database::query($sql); |
3916 | 3916 | $inactive_users = array(); |
3917 | - while($user = Database::fetch_array($rs)) { |
|
3917 | + while ($user = Database::fetch_array($rs)) { |
|
3918 | 3918 | $inactive_users[] = $user['user_id']; |
3919 | 3919 | } |
3920 | 3920 | |
@@ -3936,10 +3936,10 @@ discard block |
||
3936 | 3936 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
3937 | 3937 | |
3938 | 3938 | $sql = 'SELECT '.$student_id.' |
3939 | - FROM ' . $table . ' |
|
3939 | + FROM ' . $table.' |
|
3940 | 3940 | WHERE |
3941 | - access_user_id=' . $student_id . ' AND |
|
3942 | - c_id="' . $courseId . '" AND |
|
3941 | + access_user_id=' . $student_id.' AND |
|
3942 | + c_id="' . $courseId.'" AND |
|
3943 | 3943 | access_session_id = "'.$session_id.'" '; |
3944 | 3944 | |
3945 | 3945 | $rs = Database::query($sql); |
@@ -3957,13 +3957,13 @@ discard block |
||
3957 | 3957 | { |
3958 | 3958 | $hr_dept_id = intval($hr_dept_id); |
3959 | 3959 | $a_students = array(); |
3960 | - $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
3960 | + $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
3961 | 3961 | |
3962 | 3962 | $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user |
3963 | 3963 | WHERE hr_dept_id='.$hr_dept_id; |
3964 | 3964 | $rs = Database::query($sql); |
3965 | 3965 | |
3966 | - while($user = Database :: fetch_array($rs)) { |
|
3966 | + while ($user = Database :: fetch_array($rs)) { |
|
3967 | 3967 | $a_students[$user['user_id']] = $user['user_id']; |
3968 | 3968 | } |
3969 | 3969 | |
@@ -3988,7 +3988,7 @@ discard block |
||
3988 | 3988 | $condition_session = ''; |
3989 | 3989 | if (isset($session_id)) { |
3990 | 3990 | $session_id = intval($session_id); |
3991 | - $condition_session = ' AND access_session_id = '. $session_id; |
|
3991 | + $condition_session = ' AND access_session_id = '.$session_id; |
|
3992 | 3992 | } |
3993 | 3993 | $sql = "SELECT |
3994 | 3994 | access_tool, |
@@ -4100,7 +4100,7 @@ discard block |
||
4100 | 4100 | if (!empty($date_from) && !empty($date_to)) { |
4101 | 4101 | $fieldStartDate = $fields['start_date']; |
4102 | 4102 | if (!isset($fields['end_date'])) { |
4103 | - $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to) ; |
|
4103 | + $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to); |
|
4104 | 4104 | } else { |
4105 | 4105 | $fieldEndDate = $fields['end_date']; |
4106 | 4106 | $where .= sprintf(" AND fieldStartDate >= '%s' |
@@ -4116,12 +4116,12 @@ discard block |
||
4116 | 4116 | $where |
4117 | 4117 | GROUP BY %s"; |
4118 | 4118 | $sql = sprintf($sql, |
4119 | - $fields['user'], //user field |
|
4120 | - $tableName, //FROM |
|
4121 | - $fields['course'], //course condition |
|
4122 | - $course['real_id'], //course condition |
|
4123 | - $fields['user'], //user condition |
|
4124 | - $userId, //user condition |
|
4119 | + $fields['user'], //user field |
|
4120 | + $tableName, //FROM |
|
4121 | + $fields['course'], //course condition |
|
4122 | + $course['real_id'], //course condition |
|
4123 | + $fields['user'], //user condition |
|
4124 | + $userId, //user condition |
|
4125 | 4125 | $fields['user'] //GROUP BY |
4126 | 4126 | ); |
4127 | 4127 | $rs = Database::query($sql); |
@@ -4129,7 +4129,7 @@ discard block |
||
4129 | 4129 | //iterate query |
4130 | 4130 | if (Database::num_rows($rs) > 0) { |
4131 | 4131 | while ($row = Database::fetch_array($rs)) { |
4132 | - $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total]: $row['total']; |
|
4132 | + $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total] : $row['total']; |
|
4133 | 4133 | } |
4134 | 4134 | } |
4135 | 4135 | } |
@@ -4152,11 +4152,11 @@ discard block |
||
4152 | 4152 | $courseId = api_get_course_int_id($course_code); |
4153 | 4153 | $data = array(); |
4154 | 4154 | |
4155 | - $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
4155 | + $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
4156 | 4156 | $condition_session = ''; |
4157 | 4157 | $session_id = intval($session_id); |
4158 | 4158 | if (!empty($session_id)) { |
4159 | - $condition_session = ' AND down_session_id = '. $session_id; |
|
4159 | + $condition_session = ' AND down_session_id = '.$session_id; |
|
4160 | 4160 | } |
4161 | 4161 | $sql = "SELECT |
4162 | 4162 | down_doc_path, |
@@ -4344,7 +4344,7 @@ discard block |
||
4344 | 4344 | |
4345 | 4345 | $final_course_data = array(); |
4346 | 4346 | |
4347 | - foreach($my_course_data as $course_id => $value) { |
|
4347 | + foreach ($my_course_data as $course_id => $value) { |
|
4348 | 4348 | $final_course_data[$course_id] = $course_list[$course_id]; |
4349 | 4349 | } |
4350 | 4350 | $course_in_session[$my_session_id]['course_list'] = $final_course_data; |
@@ -4367,7 +4367,7 @@ discard block |
||
4367 | 4367 | '.Display::tag('th', get_lang('Course'), array('width'=>'300px')).' |
4368 | 4368 | '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
4369 | 4369 | '.Display::tag('th', get_lang('Progress'), array('class'=>'head')).' |
4370 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')),array('class'=>'head')).' |
|
4370 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4371 | 4371 | '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
4372 | 4372 | '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
4373 | 4373 | </tr>'; |
@@ -4456,7 +4456,7 @@ discard block |
||
4456 | 4456 | $all_exercise_start_time = array(); |
4457 | 4457 | |
4458 | 4458 | foreach ($course_in_session as $my_session_id => $session_data) { |
4459 | - $course_list = $session_data['course_list']; |
|
4459 | + $course_list = $session_data['course_list']; |
|
4460 | 4460 | $user_count = count(SessionManager::get_users_by_session($my_session_id)); |
4461 | 4461 | $exercise_graph_name_list = array(); |
4462 | 4462 | //$user_results = array(); |
@@ -4501,20 +4501,20 @@ discard block |
||
4501 | 4501 | |
4502 | 4502 | $score = 0; |
4503 | 4503 | if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) { |
4504 | - $score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100); |
|
4504 | + $score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100); |
|
4505 | 4505 | } |
4506 | 4506 | $time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0; |
4507 | 4507 | $all_exercise_start_time[] = $time; |
4508 | 4508 | $my_results[] = $score; |
4509 | - if (count($exercise_list)<=10) { |
|
4509 | + if (count($exercise_list) <= 10) { |
|
4510 | 4510 | $title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30); |
4511 | - $exercise_graph_name_list[]= $title; |
|
4511 | + $exercise_graph_name_list[] = $title; |
|
4512 | 4512 | $all_exercise_graph_name_list[] = $title; |
4513 | 4513 | } else { |
4514 | 4514 | // if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool |
4515 | 4515 | $title = cut($exercise_data['title'], 30); |
4516 | - $exercise_graph_name_list[]= $title; |
|
4517 | - $all_exercise_graph_name_list[]= $title; |
|
4516 | + $exercise_graph_name_list[] = $title; |
|
4517 | + $all_exercise_graph_name_list[] = $title; |
|
4518 | 4518 | } |
4519 | 4519 | } |
4520 | 4520 | } |
@@ -4547,7 +4547,7 @@ discard block |
||
4547 | 4547 | } |
4548 | 4548 | |
4549 | 4549 | $html .= Display::page_subheader( |
4550 | - Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('Sessions') |
|
4550 | + Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions') |
|
4551 | 4551 | ); |
4552 | 4552 | |
4553 | 4553 | $html .= '<div class="table-responsive">'; |
@@ -4601,7 +4601,7 @@ discard block |
||
4601 | 4601 | $courseInfo['real_id'], |
4602 | 4602 | $my_session_id |
4603 | 4603 | ); |
4604 | - if ($attempts > 1) { |
|
4604 | + if ($attempts > 1) { |
|
4605 | 4605 | $answered_exercises++; |
4606 | 4606 | } |
4607 | 4607 | } |
@@ -4614,7 +4614,7 @@ discard block |
||
4614 | 4614 | $all_average += $average; |
4615 | 4615 | } |
4616 | 4616 | |
4617 | - $all_average = $all_average / count($course_list); |
|
4617 | + $all_average = $all_average / count($course_list); |
|
4618 | 4618 | |
4619 | 4619 | if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) { |
4620 | 4620 | $html .= '<tr style="background-color:#FBF09D">'; |
@@ -4640,16 +4640,16 @@ discard block |
||
4640 | 4640 | } |
4641 | 4641 | $html .= '</tbody>'; |
4642 | 4642 | $html .= '</table></div><br />'; |
4643 | - $html .= Display::div($main_session_graph, array('id'=>'session_graph','class'=>'chart-session', 'style'=>'position:relative; text-align: center;') ); |
|
4643 | + $html .= Display::div($main_session_graph, array('id'=>'session_graph', 'class'=>'chart-session', 'style'=>'position:relative; text-align: center;')); |
|
4644 | 4644 | |
4645 | 4645 | // Checking selected session. |
4646 | 4646 | |
4647 | 4647 | if (isset($_GET['session_id'])) { |
4648 | 4648 | $session_id_from_get = intval($_GET['session_id']); |
4649 | - $session_data = $course_in_session[$session_id_from_get]; |
|
4650 | - $course_list = $session_data['course_list']; |
|
4649 | + $session_data = $course_in_session[$session_id_from_get]; |
|
4650 | + $course_list = $session_data['course_list']; |
|
4651 | 4651 | |
4652 | - $html .= Display::tag('h3',$session_data['name'].' - '.get_lang('CourseList')); |
|
4652 | + $html .= Display::tag('h3', $session_data['name'].' - '.get_lang('CourseList')); |
|
4653 | 4653 | |
4654 | 4654 | $html .= '<div class="table-responsive">'; |
4655 | 4655 | $html .= '<table class="table table-hover table-striped">'; |
@@ -4658,15 +4658,15 @@ discard block |
||
4658 | 4658 | <thead> |
4659 | 4659 | <tr> |
4660 | 4660 | <th width="300px">'.get_lang('Course').'</th> |
4661 | - '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
4662 | - '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
4663 | - '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
4664 | - '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
4665 | - '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
4666 | - '.Display::tag('th', get_lang('LPProgress') , array('class'=>'head')).' |
|
4667 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4668 | - '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
4669 | - '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
4661 | + '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
4662 | + '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
4663 | + '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
4664 | + '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
4665 | + '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
4666 | + '.Display::tag('th', get_lang('LPProgress'), array('class'=>'head')).' |
|
4667 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4668 | + '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
4669 | + '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
4670 | 4670 | </tr> |
4671 | 4671 | </thead> |
4672 | 4672 | <tbody> |
@@ -4685,14 +4685,14 @@ discard block |
||
4685 | 4685 | $count_exercises = count($exercises); |
4686 | 4686 | } |
4687 | 4687 | $answered_exercises = 0; |
4688 | - foreach($exercises as $exercise_item) { |
|
4688 | + foreach ($exercises as $exercise_item) { |
|
4689 | 4689 | $attempts = Event::count_exercise_attempts_by_user( |
4690 | 4690 | api_get_user_id(), |
4691 | 4691 | $exercise_item['id'], |
4692 | 4692 | $courseId, |
4693 | 4693 | $session_id_from_get |
4694 | 4694 | ); |
4695 | - if ($attempts > 1) { |
|
4695 | + if ($attempts > 1) { |
|
4696 | 4696 | $answered_exercises++; |
4697 | 4697 | } |
4698 | 4698 | } |
@@ -4701,7 +4701,7 @@ discard block |
||
4701 | 4701 | |
4702 | 4702 | // Average |
4703 | 4703 | $average = ExerciseLib::get_average_score_by_course($courseId, $session_id_from_get); |
4704 | - $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
4704 | + $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
4705 | 4705 | |
4706 | 4706 | $stats_array[$course_code] = array( |
4707 | 4707 | 'exercises' => $count_exercises, |
@@ -4778,7 +4778,7 @@ discard block |
||
4778 | 4778 | |
4779 | 4779 | if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) { |
4780 | 4780 | $details = '<a href="#">'; |
4781 | - $details .=Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
4781 | + $details .= Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
4782 | 4782 | } else { |
4783 | 4783 | $details = '<a href="'.api_get_self().'?course='.$course_code.'&session_id='.$session_id_from_get.$extra_params.'">'; |
4784 | 4784 | $details .= Display::return_icon('2rightarrow.png', get_lang('Details')); |
@@ -4878,7 +4878,7 @@ discard block |
||
4878 | 4878 | ); |
4879 | 4879 | |
4880 | 4880 | $html .= '<tr class="row_even">'; |
4881 | - $url = api_get_path(WEB_CODE_PATH) . "exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}"; |
|
4881 | + $url = api_get_path(WEB_CODE_PATH)."exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}"; |
|
4882 | 4882 | |
4883 | 4883 | if ($visible_return['value'] == true) { |
4884 | 4884 | $exercices['title'] = Display::url( |
@@ -4907,7 +4907,7 @@ discard block |
||
4907 | 4907 | ); |
4908 | 4908 | |
4909 | 4909 | $latest_attempt_url = ''; |
4910 | - $best_score = $position = $percentage_score_result = '-'; |
|
4910 | + $best_score = $position = $percentage_score_result = '-'; |
|
4911 | 4911 | $graph = $normal_graph = null; |
4912 | 4912 | |
4913 | 4913 | // Getting best results |
@@ -4939,11 +4939,11 @@ discard block |
||
4939 | 4939 | $weighting = $exercise_stat['exe_weighting']; |
4940 | 4940 | $exe_id = $exercise_stat['exe_id']; |
4941 | 4941 | |
4942 | - $latest_attempt_url .= api_get_path(WEB_CODE_PATH) . 'exercise/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id; |
|
4942 | + $latest_attempt_url .= api_get_path(WEB_CODE_PATH).'exercise/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id; |
|
4943 | 4943 | $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url); |
4944 | 4944 | $my_score = 0; |
4945 | 4945 | if (!empty($weighting) && intval($weighting) != 0) { |
4946 | - $my_score = $score/$weighting; |
|
4946 | + $my_score = $score / $weighting; |
|
4947 | 4947 | } |
4948 | 4948 | //@todo this function slows the page |
4949 | 4949 | if (is_int($user_list)) { |
@@ -4957,14 +4957,14 @@ discard block |
||
4957 | 4957 | } |
4958 | 4958 | $html .= Display::div( |
4959 | 4959 | $normal_graph, |
4960 | - array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none') |
|
4960 | + array('id'=>'main_graph_'.$exercices['id'], 'class'=>'dialog', 'style'=>'display:none') |
|
4961 | 4961 | ); |
4962 | 4962 | |
4963 | 4963 | if (empty($graph)) { |
4964 | 4964 | $graph = '-'; |
4965 | 4965 | } else { |
4966 | 4966 | $graph = Display::url( |
4967 | - '<img src="' . $graph . '" >', |
|
4967 | + '<img src="'.$graph.'" >', |
|
4968 | 4968 | $normal_graph, |
4969 | 4969 | array( |
4970 | 4970 | 'id' => $exercices['id'], |
@@ -4998,7 +4998,7 @@ discard block |
||
4998 | 4998 | |
4999 | 4999 | // LP table results |
5000 | 5000 | $html .= '<div class="table-responsive">'; |
5001 | - $html .='<table class="table table-striped table-hover">'; |
|
5001 | + $html .= '<table class="table table-striped table-hover">'; |
|
5002 | 5002 | $html .= '<thead><tr>'; |
5003 | 5003 | $html .= Display::tag('th', get_lang('Learnpaths'), array('class'=>'head', 'style'=>'color:#000')); |
5004 | 5004 | $html .= Display::tag('th', get_lang('LatencyTimeSpent'), array('class'=>'head', 'style'=>'color:#000')); |
@@ -5034,7 +5034,7 @@ discard block |
||
5034 | 5034 | $time_spent_in_lp = api_time_to_hms($time_spent_in_lp); |
5035 | 5035 | |
5036 | 5036 | $html .= '<tr class="row_even">'; |
5037 | - $url = api_get_path(WEB_CODE_PATH) . "lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view"; |
|
5037 | + $url = api_get_path(WEB_CODE_PATH)."lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view"; |
|
5038 | 5038 | |
5039 | 5039 | if ($learnpath['lp_visibility'] == 0) { |
5040 | 5040 | $html .= Display::tag('td', $learnpath['lp_name']); |
@@ -5053,7 +5053,7 @@ discard block |
||
5053 | 5053 | if (!empty($last_connection_in_lp)) { |
5054 | 5054 | $last_connection = api_convert_and_format_date($last_connection_in_lp, DATE_TIME_FORMAT_LONG); |
5055 | 5055 | } |
5056 | - $html .= Display::tag('td', $last_connection, array('align'=>'center','width'=>'180px')); |
|
5056 | + $html .= Display::tag('td', $last_connection, array('align'=>'center', 'width'=>'180px')); |
|
5057 | 5057 | $html .= "</tr>"; |
5058 | 5058 | } |
5059 | 5059 | } else { |
@@ -5063,7 +5063,7 @@ discard block |
||
5063 | 5063 | </td> |
5064 | 5064 | </tr>'; |
5065 | 5065 | } |
5066 | - $html .='</tbody></table></div>'; |
|
5066 | + $html .= '</tbody></table></div>'; |
|
5067 | 5067 | |
5068 | 5068 | $html .= self::displayUserSkills($user_id, $course_info['id'], $session_id); |
5069 | 5069 | } |
@@ -5092,7 +5092,7 @@ discard block |
||
5092 | 5092 | $myData->setSerieDescription('Serie1', get_lang('MyResults')); |
5093 | 5093 | $myData->setSerieDescription('Serie2', get_lang('AverageScore')); |
5094 | 5094 | $myData->setAxisUnit(0, '%'); |
5095 | - $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5095 | + $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5096 | 5096 | // Cache definition |
5097 | 5097 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
5098 | 5098 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
@@ -5100,9 +5100,9 @@ discard block |
||
5100 | 5100 | |
5101 | 5101 | if ($myCache->isInCache($chartHash)) { |
5102 | 5102 | //if we already created the img |
5103 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5103 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5104 | 5104 | $myCache->saveFromCache($chartHash, $imgPath); |
5105 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5105 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5106 | 5106 | } else { |
5107 | 5107 | /* Define width, height and angle */ |
5108 | 5108 | $mainWidth = 860; |
@@ -5131,7 +5131,7 @@ discard block |
||
5131 | 5131 | /* Set the default font */ |
5132 | 5132 | $myPicture->setFontProperties( |
5133 | 5133 | array( |
5134 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5134 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5135 | 5135 | 'FontSize' => 10) |
5136 | 5136 | ); |
5137 | 5137 | /* Write the chart title */ |
@@ -5148,7 +5148,7 @@ discard block |
||
5148 | 5148 | /* Set the default font */ |
5149 | 5149 | $myPicture->setFontProperties( |
5150 | 5150 | array( |
5151 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5151 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5152 | 5152 | 'FontSize' => 6 |
5153 | 5153 | ) |
5154 | 5154 | ); |
@@ -5190,7 +5190,7 @@ discard block |
||
5190 | 5190 | /* Draw the line chart */ |
5191 | 5191 | $myPicture->setFontProperties( |
5192 | 5192 | array( |
5193 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5193 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5194 | 5194 | 'FontSize' => 10 |
5195 | 5195 | ) |
5196 | 5196 | ); |
@@ -5223,12 +5223,12 @@ discard block |
||
5223 | 5223 | ); |
5224 | 5224 | |
5225 | 5225 | $myCache->writeToCache($chartHash, $myPicture); |
5226 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5226 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5227 | 5227 | $myCache->saveFromCache($chartHash, $imgPath); |
5228 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5228 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5229 | 5229 | } |
5230 | 5230 | |
5231 | - $html = '<img src="' . $imgPath . '">'; |
|
5231 | + $html = '<img src="'.$imgPath.'">'; |
|
5232 | 5232 | |
5233 | 5233 | return $html; |
5234 | 5234 | } |
@@ -5249,12 +5249,12 @@ discard block |
||
5249 | 5249 | |
5250 | 5250 | foreach ($attempts as $attempt) { |
5251 | 5251 | if (api_get_user_id() == $attempt['exe_user_id']) { |
5252 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5253 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5252 | + if ($attempt['exe_weighting'] != 0) { |
|
5253 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5254 | 5254 | } |
5255 | 5255 | } else { |
5256 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5257 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5256 | + if ($attempt['exe_weighting'] != 0) { |
|
5257 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5258 | 5258 | } |
5259 | 5259 | } |
5260 | 5260 | } |
@@ -5263,27 +5263,27 @@ discard block |
||
5263 | 5263 | rsort($my_exercise_result_array); |
5264 | 5264 | $my_exercise_result = 0; |
5265 | 5265 | if (isset($my_exercise_result_array[0])) { |
5266 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
5266 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
5267 | 5267 | } |
5268 | 5268 | |
5269 | 5269 | $max = 100; |
5270 | - $pieces = 5 ; |
|
5270 | + $pieces = 5; |
|
5271 | 5271 | $part = round($max / $pieces); |
5272 | 5272 | $x_axis = array(); |
5273 | 5273 | $final_array = array(); |
5274 | 5274 | $my_final_array = array(); |
5275 | 5275 | |
5276 | - for ($i=1; $i <=$pieces; $i++) { |
|
5276 | + for ($i = 1; $i <= $pieces; $i++) { |
|
5277 | 5277 | $sum = 1; |
5278 | 5278 | if ($i == 1) { |
5279 | 5279 | $sum = 0; |
5280 | 5280 | } |
5281 | - $min = ($i-1)*$part + $sum; |
|
5282 | - $max = ($i)*$part; |
|
5283 | - $x_axis[]= $min." - ".$max; |
|
5281 | + $min = ($i - 1) * $part + $sum; |
|
5282 | + $max = ($i) * $part; |
|
5283 | + $x_axis[] = $min." - ".$max; |
|
5284 | 5284 | $count = 0; |
5285 | - foreach($exercise_result as $result) { |
|
5286 | - $percentage = $result*100; |
|
5285 | + foreach ($exercise_result as $result) { |
|
5286 | + $percentage = $result * 100; |
|
5287 | 5287 | //echo $percentage.' - '.$min.' - '.$max."<br />"; |
5288 | 5288 | if ($percentage >= $min && $percentage <= $max) { |
5289 | 5289 | //echo ' is > '; |
@@ -5291,7 +5291,7 @@ discard block |
||
5291 | 5291 | } |
5292 | 5292 | } |
5293 | 5293 | //echo '<br />'; |
5294 | - $final_array[]= $count; |
|
5294 | + $final_array[] = $count; |
|
5295 | 5295 | |
5296 | 5296 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
5297 | 5297 | $my_final_array[] = 1; |
@@ -5301,9 +5301,9 @@ discard block |
||
5301 | 5301 | } |
5302 | 5302 | |
5303 | 5303 | //Fix to remove the data of the user with my data |
5304 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
5304 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
5305 | 5305 | if (!empty($my_final_array[$i])) { |
5306 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5306 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5307 | 5307 | $final_array[$i] = 0; |
5308 | 5308 | } |
5309 | 5309 | } |
@@ -5313,16 +5313,16 @@ discard block |
||
5313 | 5313 | $dataSet->addPoints($final_array, 'Serie1'); |
5314 | 5314 | $dataSet->addPoints($my_final_array, 'Serie2'); |
5315 | 5315 | $dataSet->normalize(100, "%"); |
5316 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5316 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5317 | 5317 | |
5318 | 5318 | // Cache definition |
5319 | 5319 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
5320 | 5320 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
5321 | 5321 | $chartHash = $myCache->getHash($dataSet); |
5322 | 5322 | if ($myCache->isInCache($chartHash)) { |
5323 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5323 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5324 | 5324 | $myCache->saveFromCache($chartHash, $imgPath); |
5325 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5325 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5326 | 5326 | } else { |
5327 | 5327 | /* Create the pChart object */ |
5328 | 5328 | $widthSize = 80; |
@@ -5338,7 +5338,7 @@ discard block |
||
5338 | 5338 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
5339 | 5339 | |
5340 | 5340 | /* Set the default font */ |
5341 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
5341 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
5342 | 5342 | |
5343 | 5343 | /* Do not write the chart title */ |
5344 | 5344 | |
@@ -5402,9 +5402,9 @@ discard block |
||
5402 | 5402 | |
5403 | 5403 | /* Save and write in cache */ |
5404 | 5404 | $myCache->writeToCache($chartHash, $myPicture); |
5405 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5405 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5406 | 5406 | $myCache->saveFromCache($chartHash, $imgPath); |
5407 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5407 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5408 | 5408 | } |
5409 | 5409 | |
5410 | 5410 | return $imgPath; |
@@ -5424,12 +5424,12 @@ discard block |
||
5424 | 5424 | } |
5425 | 5425 | foreach ($attempts as $attempt) { |
5426 | 5426 | if (api_get_user_id() == $attempt['exe_user_id']) { |
5427 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5428 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5427 | + if ($attempt['exe_weighting'] != 0) { |
|
5428 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5429 | 5429 | } |
5430 | 5430 | } else { |
5431 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5432 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5431 | + if ($attempt['exe_weighting'] != 0) { |
|
5432 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5433 | 5433 | } |
5434 | 5434 | } |
5435 | 5435 | } |
@@ -5438,32 +5438,32 @@ discard block |
||
5438 | 5438 | rsort($my_exercise_result_array); |
5439 | 5439 | $my_exercise_result = 0; |
5440 | 5440 | if (isset($my_exercise_result_array[0])) { |
5441 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
5441 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
5442 | 5442 | } |
5443 | 5443 | |
5444 | 5444 | $max = 100; |
5445 | - $pieces = 5 ; |
|
5445 | + $pieces = 5; |
|
5446 | 5446 | $part = round($max / $pieces); |
5447 | 5447 | $x_axis = array(); |
5448 | 5448 | $final_array = array(); |
5449 | 5449 | $my_final_array = array(); |
5450 | 5450 | |
5451 | - for ($i=1; $i <=$pieces; $i++) { |
|
5451 | + for ($i = 1; $i <= $pieces; $i++) { |
|
5452 | 5452 | $sum = 1; |
5453 | 5453 | if ($i == 1) { |
5454 | 5454 | $sum = 0; |
5455 | 5455 | } |
5456 | - $min = ($i-1)*$part + $sum; |
|
5457 | - $max = ($i)*$part; |
|
5458 | - $x_axis[]= $min." - ".$max; |
|
5456 | + $min = ($i - 1) * $part + $sum; |
|
5457 | + $max = ($i) * $part; |
|
5458 | + $x_axis[] = $min." - ".$max; |
|
5459 | 5459 | $count = 0; |
5460 | - foreach($exercise_result as $result) { |
|
5461 | - $percentage = $result*100; |
|
5460 | + foreach ($exercise_result as $result) { |
|
5461 | + $percentage = $result * 100; |
|
5462 | 5462 | if ($percentage >= $min && $percentage <= $max) { |
5463 | 5463 | $count++; |
5464 | 5464 | } |
5465 | 5465 | } |
5466 | - $final_array[]= $count; |
|
5466 | + $final_array[] = $count; |
|
5467 | 5467 | |
5468 | 5468 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
5469 | 5469 | $my_final_array[] = 1; |
@@ -5474,9 +5474,9 @@ discard block |
||
5474 | 5474 | |
5475 | 5475 | //Fix to remove the data of the user with my data |
5476 | 5476 | |
5477 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
5477 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
5478 | 5478 | if (!empty($my_final_array[$i])) { |
5479 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5479 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5480 | 5480 | $final_array[$i] = 0; |
5481 | 5481 | } |
5482 | 5482 | } |
@@ -5494,7 +5494,7 @@ discard block |
||
5494 | 5494 | $dataSet->setXAxisName(get_lang('Score')); |
5495 | 5495 | $dataSet->normalize(100, "%"); |
5496 | 5496 | |
5497 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5497 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5498 | 5498 | |
5499 | 5499 | // Cache definition |
5500 | 5500 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
@@ -5502,9 +5502,9 @@ discard block |
||
5502 | 5502 | $chartHash = $myCache->getHash($dataSet); |
5503 | 5503 | |
5504 | 5504 | if ($myCache->isInCache($chartHash)) { |
5505 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5505 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5506 | 5506 | $myCache->saveFromCache($chartHash, $imgPath); |
5507 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5507 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5508 | 5508 | } else { |
5509 | 5509 | /* Create the pChart object */ |
5510 | 5510 | $widthSize = 480; |
@@ -5520,7 +5520,7 @@ discard block |
||
5520 | 5520 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
5521 | 5521 | |
5522 | 5522 | /* Set the default font */ |
5523 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
5523 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
5524 | 5524 | |
5525 | 5525 | /* Write the chart title */ |
5526 | 5526 | $myPicture->drawText( |
@@ -5579,9 +5579,9 @@ discard block |
||
5579 | 5579 | |
5580 | 5580 | /* Write and save into cache */ |
5581 | 5581 | $myCache->writeToCache($chartHash, $myPicture); |
5582 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5582 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5583 | 5583 | $myCache->saveFromCache($chartHash, $imgPath); |
5584 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5584 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5585 | 5585 | } |
5586 | 5586 | |
5587 | 5587 | return $imgPath; |
@@ -5656,7 +5656,7 @@ discard block |
||
5656 | 5656 | $tquiz_answer = Database::get_course_table(TABLE_QUIZ_ANSWER); |
5657 | 5657 | $tquiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION); |
5658 | 5658 | $tquiz_rel_question = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
5659 | - $ttrack_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
5659 | + $ttrack_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
5660 | 5660 | $ttrack_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
5661 | 5661 | |
5662 | 5662 | $sessions = array(); |
@@ -5708,7 +5708,7 @@ discard block |
||
5708 | 5708 | $whereSessionParams .= $sessionIdx.','; |
5709 | 5709 | } |
5710 | 5710 | } |
5711 | - $whereSessionParams = substr($whereSessionParams,0,-1); |
|
5711 | + $whereSessionParams = substr($whereSessionParams, 0, -1); |
|
5712 | 5712 | } |
5713 | 5713 | |
5714 | 5714 | if (!empty($exerciseId)) { |
@@ -5772,7 +5772,7 @@ discard block |
||
5772 | 5772 | qq.position = rq.question_order AND |
5773 | 5773 | ta.question_id = rq.question_id |
5774 | 5774 | WHERE |
5775 | - te.c_id = $courseIdx ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")." |
|
5775 | + te.c_id = $courseIdx ".(empty($whereSessionParams) ? '' : "AND te.session_id IN ($whereSessionParams)")." |
|
5776 | 5776 | AND q.c_id = $courseIdx |
5777 | 5777 | $where $order $limit"; |
5778 | 5778 | $sql_query = vsprintf($sql, $whereParams); |
@@ -5820,7 +5820,7 @@ discard block |
||
5820 | 5820 | // Now fill users data |
5821 | 5821 | $sqlUsers = "SELECT user_id, username, lastname, firstname |
5822 | 5822 | FROM $tuser |
5823 | - WHERE user_id IN (".implode(',',$userIds).")"; |
|
5823 | + WHERE user_id IN (".implode(',', $userIds).")"; |
|
5824 | 5824 | $resUsers = Database::query($sqlUsers); |
5825 | 5825 | while ($rowUser = Database::fetch_assoc($resUsers)) { |
5826 | 5826 | $users[$rowUser['user_id']] = $rowUser; |
@@ -5924,7 +5924,7 @@ discard block |
||
5924 | 5924 | <table class="table" id="skillList"> |
5925 | 5925 | <thead> |
5926 | 5926 | <tr> |
5927 | - <th>' . get_lang('AchievedSkills') . '</th> |
|
5927 | + <th>' . get_lang('AchievedSkills').'</th> |
|
5928 | 5928 | </tr> |
5929 | 5929 | </thead> |
5930 | 5930 | <tbody> |
@@ -5943,10 +5943,10 @@ discard block |
||
5943 | 5943 | |
5944 | 5944 | $html .= ' |
5945 | 5945 | <li class="thumbnail"> |
5946 | - <a href="' . api_get_path(WEB_PATH) . 'badge/' . $userSkill->getId() . '/user/' . $userId . '" target="_blank"> |
|
5947 | - <img class="img-responsive" title="' . $skill->getName() . '" src="' . $skill->getWebIconPath() . '" width="64" height="64"> |
|
5946 | + <a href="' . api_get_path(WEB_PATH).'badge/'.$userSkill->getId().'/user/'.$userId.'" target="_blank"> |
|
5947 | + <img class="img-responsive" title="' . $skill->getName().'" src="'.$skill->getWebIconPath().'" width="64" height="64"> |
|
5948 | 5948 | <div class="caption"> |
5949 | - <p class="text-center">' . $skill->getName() . '</p> |
|
5949 | + <p class="text-center">' . $skill->getName().'</p> |
|
5950 | 5950 | </div> |
5951 | 5951 | </a> |
5952 | 5952 | </li> |
@@ -5996,7 +5996,7 @@ discard block |
||
5996 | 5996 | WHERE |
5997 | 5997 | track_resource.c_id = $course_id AND |
5998 | 5998 | track_resource.insert_user_id = user.user_id AND |
5999 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5999 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
6000 | 6000 | |
6001 | 6001 | if (isset($_GET['keyword'])) { |
6002 | 6002 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -6054,7 +6054,7 @@ discard block |
||
6054 | 6054 | WHERE |
6055 | 6055 | track_resource.c_id = $course_id AND |
6056 | 6056 | track_resource.insert_user_id = user.user_id AND |
6057 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
6057 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
6058 | 6058 | |
6059 | 6059 | if (isset($_GET['keyword'])) { |
6060 | 6060 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -6354,7 +6354,7 @@ discard block |
||
6354 | 6354 | public static function display_additional_profile_fields() |
6355 | 6355 | { |
6356 | 6356 | // getting all the extra profile fields that are defined by the platform administrator |
6357 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6357 | + $extra_fields = UserManager :: get_extra_fields(0, 50, 5, 'ASC'); |
|
6358 | 6358 | |
6359 | 6359 | // creating the form |
6360 | 6360 | $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
@@ -6366,8 +6366,8 @@ discard block |
||
6366 | 6366 | $extra_fields_to_show = 0; |
6367 | 6367 | foreach ($extra_fields as $key=>$field) { |
6368 | 6368 | // show only extra fields that are visible + and can be filtered, added by J.Montoya |
6369 | - if ($field[6]==1 && $field[8] == 1) { |
|
6370 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6369 | + if ($field[6] == 1 && $field[8] == 1) { |
|
6370 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field']) { |
|
6371 | 6371 | $selected = 'selected="selected"'; |
6372 | 6372 | } else { |
6373 | 6373 | $selected = ''; |
@@ -6379,8 +6379,8 @@ discard block |
||
6379 | 6379 | $return .= '</select>'; |
6380 | 6380 | |
6381 | 6381 | // the form elements for the $_GET parameters (because the form is passed through GET |
6382 | - foreach ($_GET as $key=>$value){ |
|
6383 | - if ($key <> 'additional_profile_field') { |
|
6382 | + foreach ($_GET as $key=>$value) { |
|
6383 | + if ($key <> 'additional_profile_field') { |
|
6384 | 6384 | $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
6385 | 6385 | } |
6386 | 6386 | } |
@@ -6417,21 +6417,21 @@ discard block |
||
6417 | 6417 | $result_extra_field = UserManager::get_extra_field_information($field_id); |
6418 | 6418 | |
6419 | 6419 | if (!empty($users)) { |
6420 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6421 | - foreach($users as $user_id) { |
|
6420 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG) { |
|
6421 | + foreach ($users as $user_id) { |
|
6422 | 6422 | $user_result = UserManager::get_user_tags($user_id, $field_id); |
6423 | 6423 | $tag_list = array(); |
6424 | - foreach($user_result as $item) { |
|
6424 | + foreach ($user_result as $item) { |
|
6425 | 6425 | $tag_list[] = $item['tag']; |
6426 | 6426 | } |
6427 | - $return[$user_id][] = implode(', ',$tag_list); |
|
6427 | + $return[$user_id][] = implode(', ', $tag_list); |
|
6428 | 6428 | } |
6429 | 6429 | } else { |
6430 | 6430 | $new_user_array = array(); |
6431 | 6431 | foreach ($users as $user_id) { |
6432 | - $new_user_array[]= "'".$user_id."'"; |
|
6432 | + $new_user_array[] = "'".$user_id."'"; |
|
6433 | 6433 | } |
6434 | - $users = implode(',',$new_user_array); |
|
6434 | + $users = implode(',', $new_user_array); |
|
6435 | 6435 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
6436 | 6436 | // Selecting only the necessary information NOT ALL the user list |
6437 | 6437 | $sql = "SELECT user.user_id, v.value |
@@ -6446,7 +6446,7 @@ discard block |
||
6446 | 6446 | user.user_id IN ($users)"; |
6447 | 6447 | |
6448 | 6448 | $result = Database::query($sql); |
6449 | - while($row = Database::fetch_array($result)) { |
|
6449 | + while ($row = Database::fetch_array($result)) { |
|
6450 | 6450 | // get option value for field type double select by id |
6451 | 6451 | if (!empty($row['value'])) { |
6452 | 6452 | if ($result_extra_field['field_type'] == |
@@ -6485,7 +6485,7 @@ discard block |
||
6485 | 6485 | |
6486 | 6486 | public function sort_users_desc($a, $b) |
6487 | 6487 | { |
6488 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6488 | + return strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6489 | 6489 | } |
6490 | 6490 | |
6491 | 6491 | /** |
@@ -6520,7 +6520,7 @@ discard block |
||
6520 | 6520 | // get all users data from a course for sortable with limit |
6521 | 6521 | if (is_array($user_ids)) { |
6522 | 6522 | $user_ids = array_map('intval', $user_ids); |
6523 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6523 | + $condition_user = " WHERE user.user_id IN (".implode(',', $user_ids).") "; |
|
6524 | 6524 | } else { |
6525 | 6525 | $user_ids = intval($user_ids); |
6526 | 6526 | $condition_user = " WHERE user.user_id = $user_ids "; |
@@ -6528,7 +6528,7 @@ discard block |
||
6528 | 6528 | |
6529 | 6529 | if (!empty($_GET['user_keyword'])) { |
6530 | 6530 | $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
6531 | - $condition_user .= " AND ( |
|
6531 | + $condition_user .= " AND ( |
|
6532 | 6532 | user.firstname LIKE '%".$keyword."%' OR |
6533 | 6533 | user.lastname LIKE '%".$keyword."%' OR |
6534 | 6534 | user.username LIKE '%".$keyword."%' OR |
@@ -6546,7 +6546,7 @@ discard block |
||
6546 | 6546 | $invitedUsersCondition = ''; |
6547 | 6547 | |
6548 | 6548 | if (!$includeInvitedUsers) { |
6549 | - $invitedUsersCondition = " AND user.status != " . INVITEE; |
|
6549 | + $invitedUsersCondition = " AND user.status != ".INVITEE; |
|
6550 | 6550 | } |
6551 | 6551 | |
6552 | 6552 | $sql = "SELECT user.user_id as user_id, |
@@ -6557,7 +6557,7 @@ discard block |
||
6557 | 6557 | FROM $tbl_user as user $url_table |
6558 | 6558 | $condition_user $url_condition $invitedUsersCondition"; |
6559 | 6559 | |
6560 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
6560 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
6561 | 6561 | $direction = 'ASC'; |
6562 | 6562 | } |
6563 | 6563 | |
@@ -6693,7 +6693,7 @@ discard block |
||
6693 | 6693 | } |
6694 | 6694 | |
6695 | 6695 | if (empty($session_id)) { |
6696 | - $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
|
6696 | + $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0).' / '.$total_surveys; |
|
6697 | 6697 | } |
6698 | 6698 | |
6699 | 6699 | $user['link'] = '<center> |
@@ -6705,37 +6705,37 @@ discard block |
||
6705 | 6705 | // store columns in array $users |
6706 | 6706 | $is_western_name_order = api_is_western_name_order(); |
6707 | 6707 | $user_row = array(); |
6708 | - $user_row[]= $user['official_code']; //0 |
|
6708 | + $user_row[] = $user['official_code']; //0 |
|
6709 | 6709 | if ($is_western_name_order) { |
6710 | - $user_row[]= $user['firstname']; |
|
6711 | - $user_row[]= $user['lastname']; |
|
6710 | + $user_row[] = $user['firstname']; |
|
6711 | + $user_row[] = $user['lastname']; |
|
6712 | 6712 | } else { |
6713 | - $user_row[]= $user['lastname']; |
|
6714 | - $user_row[]= $user['firstname']; |
|
6713 | + $user_row[] = $user['lastname']; |
|
6714 | + $user_row[] = $user['firstname']; |
|
6715 | 6715 | } |
6716 | - $user_row[]= $user['username']; |
|
6717 | - $user_row[]= $user['time']; |
|
6718 | - $user_row[]= $user['average_progress']; |
|
6719 | - $user_row[]= $user['exercise_progress']; |
|
6720 | - $user_row[]= $user['exercise_average_best_attempt']; |
|
6721 | - $user_row[]= $user['student_score']; |
|
6722 | - $user_row[]= $user['count_assignments']; |
|
6723 | - $user_row[]= $user['count_messages']; |
|
6716 | + $user_row[] = $user['username']; |
|
6717 | + $user_row[] = $user['time']; |
|
6718 | + $user_row[] = $user['average_progress']; |
|
6719 | + $user_row[] = $user['exercise_progress']; |
|
6720 | + $user_row[] = $user['exercise_average_best_attempt']; |
|
6721 | + $user_row[] = $user['student_score']; |
|
6722 | + $user_row[] = $user['count_assignments']; |
|
6723 | + $user_row[] = $user['count_messages']; |
|
6724 | 6724 | |
6725 | 6725 | $userGroupManager = new UserGroup(); |
6726 | 6726 | $user_row[] = $userGroupManager->getLabelsFromNameList($user['user_id'], UserGroup::NORMAL_CLASS); |
6727 | 6727 | |
6728 | 6728 | if (empty($session_id)) { |
6729 | - $user_row[]= $user['survey']; |
|
6729 | + $user_row[] = $user['survey']; |
|
6730 | 6730 | } |
6731 | 6731 | |
6732 | - $user_row[]= $user['first_connection']; |
|
6733 | - $user_row[]= $user['last_connection']; |
|
6732 | + $user_row[] = $user['first_connection']; |
|
6733 | + $user_row[] = $user['last_connection']; |
|
6734 | 6734 | if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
6735 | - $user_row[]= $user['additional']; |
|
6735 | + $user_row[] = $user['additional']; |
|
6736 | 6736 | } |
6737 | 6737 | |
6738 | - $user_row[]= $user['link']; |
|
6738 | + $user_row[] = $user['link']; |
|
6739 | 6739 | |
6740 | 6740 | $users[] = $user_row; |
6741 | 6741 | |
@@ -6780,8 +6780,8 @@ discard block |
||
6780 | 6780 | |
6781 | 6781 | $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
6782 | 6782 | $tempView = $view; |
6783 | - if(substr($view,0,1) == '1') { |
|
6784 | - $new_view = substr_replace($view,'0',0,1); |
|
6783 | + if (substr($view, 0, 1) == '1') { |
|
6784 | + $new_view = substr_replace($view, '0', 0, 1); |
|
6785 | 6785 | echo " |
6786 | 6786 | <tr> |
6787 | 6787 | <td valign='top'> |
@@ -6814,9 +6814,9 @@ discard block |
||
6814 | 6814 | </tr>"; |
6815 | 6815 | $total = 0; |
6816 | 6816 | if (is_array($results)) { |
6817 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6817 | + for ($j = 0; $j < count($results); $j++) { |
|
6818 | 6818 | echo "<tr>"; |
6819 | - echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6819 | + echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0]) - 1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6820 | 6820 | echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
6821 | 6821 | echo"</tr>"; |
6822 | 6822 | $total = $total + $results[$j][1]; |
@@ -6833,7 +6833,7 @@ discard block |
||
6833 | 6833 | echo "</table>"; |
6834 | 6834 | echo "</td></tr>"; |
6835 | 6835 | } else { |
6836 | - $new_view = substr_replace($view,'1',0,1); |
|
6836 | + $new_view = substr_replace($view, '1', 0, 1); |
|
6837 | 6837 | echo " |
6838 | 6838 | <tr> |
6839 | 6839 | <td valign='top'> |
@@ -6856,8 +6856,8 @@ discard block |
||
6856 | 6856 | { |
6857 | 6857 | global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
6858 | 6858 | $courseId = api_get_course_int_id($courseCode); |
6859 | - if(substr($view,1,1) == '1') { |
|
6860 | - $new_view = substr_replace($view,'0',1,1); |
|
6859 | + if (substr($view, 1, 1) == '1') { |
|
6860 | + $new_view = substr_replace($view, '0', 1, 1); |
|
6861 | 6861 | echo "<tr> |
6862 | 6862 | <td valign='top'> |
6863 | 6863 | <font color='#0000FF'>- </font><b>".get_lang('ExercicesResults')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>] |
@@ -6899,7 +6899,7 @@ discard block |
||
6899 | 6899 | </tr>"; |
6900 | 6900 | |
6901 | 6901 | if (is_array($results)) { |
6902 | - for($i = 0; $i < sizeof($results); $i++) { |
|
6902 | + for ($i = 0; $i < sizeof($results); $i++) { |
|
6903 | 6903 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
6904 | 6904 | echo "<tr>\n"; |
6905 | 6905 | echo "<td class='content'>".$results[$i][0]."</td>\n"; |
@@ -6914,8 +6914,8 @@ discard block |
||
6914 | 6914 | |
6915 | 6915 | // The Result of Tests |
6916 | 6916 | if (is_array($hpresults)) { |
6917 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6918 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6917 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
6918 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
6919 | 6919 | if ($title == '') |
6920 | 6920 | $title = basename($hpresults[$i][0]); |
6921 | 6921 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
@@ -6941,7 +6941,7 @@ discard block |
||
6941 | 6941 | echo "</table>"; |
6942 | 6942 | echo "</td>\n</tr>\n"; |
6943 | 6943 | } else { |
6944 | - $new_view = substr_replace($view,'1',1,1); |
|
6944 | + $new_view = substr_replace($view, '1', 1, 1); |
|
6945 | 6945 | echo " |
6946 | 6946 | <tr> |
6947 | 6947 | <td valign='top'> |
@@ -6960,8 +6960,8 @@ discard block |
||
6960 | 6960 | global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
6961 | 6961 | $_course = api_get_course_info_by_id($course_id); |
6962 | 6962 | |
6963 | - if (substr($view,2,1) == '1') { |
|
6964 | - $new_view = substr_replace($view,'0',2,1); |
|
6963 | + if (substr($view, 2, 1) == '1') { |
|
6964 | + $new_view = substr_replace($view, '0', 2, 1); |
|
6965 | 6965 | echo "<tr> |
6966 | 6966 | <td valign='top'> |
6967 | 6967 | <font color='#0000FF'>- </font><b>".get_lang('WorkUploads')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>] |
@@ -6975,7 +6975,7 @@ discard block |
||
6975 | 6975 | AND u.c_id = '".intval($course_id)."' |
6976 | 6976 | ORDER BY u.upload_date DESC"; |
6977 | 6977 | echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
6978 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6978 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6979 | 6979 | echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
6980 | 6980 | echo "<tr> |
6981 | 6981 | <td class='secLine' width='40%'> |
@@ -6989,7 +6989,7 @@ discard block |
||
6989 | 6989 | </td> |
6990 | 6990 | </tr>"; |
6991 | 6991 | if (is_array($results)) { |
6992 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6992 | + for ($j = 0; $j < count($results); $j++) { |
|
6993 | 6993 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
6994 | 6994 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
6995 | 6995 | echo "<tr>"; |
@@ -7008,7 +7008,7 @@ discard block |
||
7008 | 7008 | echo "</table>"; |
7009 | 7009 | echo "</td></tr>"; |
7010 | 7010 | } else { |
7011 | - $new_view = substr_replace($view,'1',2,1); |
|
7011 | + $new_view = substr_replace($view, '1', 2, 1); |
|
7012 | 7012 | echo " |
7013 | 7013 | <tr> |
7014 | 7014 | <td valign='top'> |
@@ -7027,8 +7027,8 @@ discard block |
||
7027 | 7027 | { |
7028 | 7028 | global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
7029 | 7029 | $courseId = api_get_course_int_id($courseCode); |
7030 | - if (substr($view,3,1) == '1') { |
|
7031 | - $new_view = substr_replace($view,'0',3,1); |
|
7030 | + if (substr($view, 3, 1) == '1') { |
|
7031 | + $new_view = substr_replace($view, '0', 3, 1); |
|
7032 | 7032 | echo " |
7033 | 7033 | <tr> |
7034 | 7034 | <td valign='top'> |
@@ -7052,7 +7052,7 @@ discard block |
||
7052 | 7052 | </td> |
7053 | 7053 | </tr>"; |
7054 | 7054 | if (is_array($results)) { |
7055 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7055 | + for ($j = 0; $j < count($results); $j++) { |
|
7056 | 7056 | echo "<tr>"; |
7057 | 7057 | echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
7058 | 7058 | echo"</tr>"; |
@@ -7065,7 +7065,7 @@ discard block |
||
7065 | 7065 | echo "</table>"; |
7066 | 7066 | echo "</td></tr>"; |
7067 | 7067 | } else { |
7068 | - $new_view = substr_replace($view,'1',3,1); |
|
7068 | + $new_view = substr_replace($view, '1', 3, 1); |
|
7069 | 7069 | echo " |
7070 | 7070 | <tr> |
7071 | 7071 | <td valign='top'> |
@@ -7092,8 +7092,8 @@ discard block |
||
7092 | 7092 | $session_id = intval($session_id); |
7093 | 7093 | |
7094 | 7094 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
7095 | - if(substr($view,4,1) == '1') { |
|
7096 | - $new_view = substr_replace($view,'0',4,1); |
|
7095 | + if (substr($view, 4, 1) == '1') { |
|
7096 | + $new_view = substr_replace($view, '0', 4, 1); |
|
7097 | 7097 | echo " |
7098 | 7098 | <tr> |
7099 | 7099 | <td valign='top'> |
@@ -7119,7 +7119,7 @@ discard block |
||
7119 | 7119 | </td> |
7120 | 7120 | </tr>"; |
7121 | 7121 | if (is_array($results)) { |
7122 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7122 | + for ($j = 0; $j < count($results); $j++) { |
|
7123 | 7123 | echo "<tr>"; |
7124 | 7124 | echo "<td class='content'>".$results[$j]."</td>"; |
7125 | 7125 | echo"</tr>"; |
@@ -7132,7 +7132,7 @@ discard block |
||
7132 | 7132 | echo "</table>"; |
7133 | 7133 | echo "</td></tr>"; |
7134 | 7134 | } else { |
7135 | - $new_view = substr_replace($view,'1',4,1); |
|
7135 | + $new_view = substr_replace($view, '1', 4, 1); |
|
7136 | 7136 | echo " |
7137 | 7137 | <tr> |
7138 | 7138 | <td valign='top'> |
@@ -7166,11 +7166,11 @@ discard block |
||
7166 | 7166 | ORDER BY login_date DESC LIMIT 1"; |
7167 | 7167 | $ip = ''; |
7168 | 7168 | $res_ip = Database::query($sql_ip); |
7169 | - if ($res_ip !== false && Database::num_rows($res_ip)>0) { |
|
7169 | + if ($res_ip !== false && Database::num_rows($res_ip) > 0) { |
|
7170 | 7170 | $row_ip = Database::fetch_row($res_ip); |
7171 | 7171 | if ($return_as_link) { |
7172 | 7172 | $ip = Display::url( |
7173 | - (empty($body_replace)?$row_ip[1]:$body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
7173 | + (empty($body_replace) ? $row_ip[1] : $body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
7174 | 7174 | array('title'=>get_lang('TraceIP'), 'target'=>'_blank') |
7175 | 7175 | ); |
7176 | 7176 | } else { |
@@ -7206,9 +7206,9 @@ discard block |
||
7206 | 7206 | $course_id = intval($course_id); |
7207 | 7207 | |
7208 | 7208 | $tempView = $view; |
7209 | - if (substr($view,0,1) == '1') { |
|
7210 | - $new_view = substr_replace($view,'0',0,1); |
|
7211 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7209 | + if (substr($view, 0, 1) == '1') { |
|
7210 | + $new_view = substr_replace($view, '0', 0, 1); |
|
7211 | + $title[1] = get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7212 | 7212 | $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
7213 | 7213 | FROM $track_access_table |
7214 | 7214 | WHERE access_user_id = $user_id |
@@ -7218,20 +7218,20 @@ discard block |
||
7218 | 7218 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
7219 | 7219 | //$results = getManyResults2Col($sql); |
7220 | 7220 | $results = getManyResults3Col($sql); |
7221 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7222 | - $line=''; |
|
7221 | + $title_line = get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7222 | + $line = ''; |
|
7223 | 7223 | $total = 0; |
7224 | 7224 | if (is_array($results)) { |
7225 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7225 | + for ($j = 0; $j < count($results); $j++) { |
|
7226 | 7226 | $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
7227 | 7227 | $total = $total + $results[$j][1]; |
7228 | 7228 | } |
7229 | 7229 | $line .= get_lang('Total').";".$total."\n"; |
7230 | 7230 | } else { |
7231 | - $line= get_lang('NoResult')."</center></td>"; |
|
7231 | + $line = get_lang('NoResult')."</center></td>"; |
|
7232 | 7232 | } |
7233 | 7233 | } else { |
7234 | - $new_view = substr_replace($view,'1',0,1); |
|
7234 | + $new_view = substr_replace($view, '1', 0, 1); |
|
7235 | 7235 | } |
7236 | 7236 | return array($title_line, $line); |
7237 | 7237 | } |
@@ -7249,8 +7249,8 @@ discard block |
||
7249 | 7249 | global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
7250 | 7250 | $courseId = api_get_course_int_id($courseCode); |
7251 | 7251 | $userId = intval($userId); |
7252 | - if (substr($view,1,1) == '1') { |
|
7253 | - $new_view = substr_replace($view,'0',1,1); |
|
7252 | + if (substr($view, 1, 1) == '1') { |
|
7253 | + $new_view = substr_replace($view, '0', 1, 1); |
|
7254 | 7254 | $title[1] = get_lang('ExercicesDetails'); |
7255 | 7255 | $line = ''; |
7256 | 7256 | $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
@@ -7274,7 +7274,7 @@ discard block |
||
7274 | 7274 | $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
7275 | 7275 | |
7276 | 7276 | if (is_array($results)) { |
7277 | - for($i = 0; $i < sizeof($results); $i++) |
|
7277 | + for ($i = 0; $i < sizeof($results); $i++) |
|
7278 | 7278 | { |
7279 | 7279 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
7280 | 7280 | $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
@@ -7286,8 +7286,8 @@ discard block |
||
7286 | 7286 | |
7287 | 7287 | // The Result of Tests |
7288 | 7288 | if (is_array($hpresults)) { |
7289 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7290 | - $title = GetQuizName($hpresults[$i][0],''); |
|
7289 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
7290 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
7291 | 7291 | |
7292 | 7292 | if ($title == '') |
7293 | 7293 | $title = basename($hpresults[$i][0]); |
@@ -7301,10 +7301,10 @@ discard block |
||
7301 | 7301 | } |
7302 | 7302 | |
7303 | 7303 | if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
7304 | - $line=get_lang('NoResult'); |
|
7304 | + $line = get_lang('NoResult'); |
|
7305 | 7305 | } |
7306 | 7306 | } else { |
7307 | - $new_view = substr_replace($view,'1',1,1); |
|
7307 | + $new_view = substr_replace($view, '1', 1, 1); |
|
7308 | 7308 | } |
7309 | 7309 | return array($title_line, $line); |
7310 | 7310 | } |
@@ -7320,7 +7320,7 @@ discard block |
||
7320 | 7320 | $user_id = intval($user_id); |
7321 | 7321 | $course_id = intval($course_id); |
7322 | 7322 | |
7323 | - if (substr($view,2,1) == '1') { |
|
7323 | + if (substr($view, 2, 1) == '1') { |
|
7324 | 7324 | $sql = "SELECT u.upload_date, w.title, w.author, w.url |
7325 | 7325 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
7326 | 7326 | WHERE |
@@ -7328,21 +7328,21 @@ discard block |
||
7328 | 7328 | u.upload_user_id = '$user_id' AND |
7329 | 7329 | u.c_id = '$course_id' |
7330 | 7330 | ORDER BY u.upload_date DESC"; |
7331 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7331 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7332 | 7332 | |
7333 | - $title[1]=get_lang('WorksDetails'); |
|
7334 | - $line=''; |
|
7335 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7333 | + $title[1] = get_lang('WorksDetails'); |
|
7334 | + $line = ''; |
|
7335 | + $title_line = get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7336 | 7336 | |
7337 | 7337 | if (is_array($results)) { |
7338 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7338 | + for ($j = 0; $j < count($results); $j++) { |
|
7339 | 7339 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
7340 | 7340 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
7341 | 7341 | $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
7342 | 7342 | } |
7343 | 7343 | |
7344 | 7344 | } else { |
7345 | - $line= get_lang('NoResult'); |
|
7345 | + $line = get_lang('NoResult'); |
|
7346 | 7346 | } |
7347 | 7347 | } |
7348 | 7348 | return array($title_line, $line); |
@@ -7358,9 +7358,9 @@ discard block |
||
7358 | 7358 | $courseId = api_get_course_int_id($courseCode); |
7359 | 7359 | $userId = intval($userId); |
7360 | 7360 | $line = null; |
7361 | - if (substr($view,3,1) == '1') { |
|
7362 | - $new_view = substr_replace($view,'0',3,1); |
|
7363 | - $title[1]=get_lang('LinksDetails'); |
|
7361 | + if (substr($view, 3, 1) == '1') { |
|
7362 | + $new_view = substr_replace($view, '0', 3, 1); |
|
7363 | + $title[1] = get_lang('LinksDetails'); |
|
7364 | 7364 | $sql = "SELECT cl.title, cl.url |
7365 | 7365 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7366 | 7366 | WHERE sl.links_link_id = cl.id |
@@ -7368,16 +7368,16 @@ discard block |
||
7368 | 7368 | AND sl.links_user_id = $userId |
7369 | 7369 | GROUP BY cl.title, cl.url"; |
7370 | 7370 | $results = StatsUtils::getManyResults2Col($sql); |
7371 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7371 | + $title_line = get_lang('LinksTitleLinkColumn')."\n"; |
|
7372 | 7372 | if (is_array($results)) { |
7373 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7373 | + for ($j = 0; $j < count($results); $j++) { |
|
7374 | 7374 | $line .= $results[$j][0]."\n"; |
7375 | 7375 | } |
7376 | 7376 | } else { |
7377 | - $line=get_lang('NoResult'); |
|
7377 | + $line = get_lang('NoResult'); |
|
7378 | 7378 | } |
7379 | 7379 | } else { |
7380 | - $new_view = substr_replace($view,'1',3,1); |
|
7380 | + $new_view = substr_replace($view, '1', 3, 1); |
|
7381 | 7381 | } |
7382 | 7382 | return array($title_line, $line); |
7383 | 7383 | } |
@@ -7399,9 +7399,9 @@ discard block |
||
7399 | 7399 | |
7400 | 7400 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
7401 | 7401 | |
7402 | - if (substr($view,4,1) == '1') { |
|
7403 | - $new_view = substr_replace($view,'0',4,1); |
|
7404 | - $title[1]= get_lang('DocumentsDetails'); |
|
7402 | + if (substr($view, 4, 1) == '1') { |
|
7403 | + $new_view = substr_replace($view, '0', 4, 1); |
|
7404 | + $title[1] = get_lang('DocumentsDetails'); |
|
7405 | 7405 | |
7406 | 7406 | $sql = "SELECT down_doc_path |
7407 | 7407 | FROM $downloads_table |
@@ -7414,14 +7414,14 @@ discard block |
||
7414 | 7414 | $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
7415 | 7415 | $line = null; |
7416 | 7416 | if (is_array($results)) { |
7417 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7417 | + for ($j = 0; $j < count($results); $j++) { |
|
7418 | 7418 | $line .= $results[$j]."\n"; |
7419 | 7419 | } |
7420 | 7420 | } else { |
7421 | 7421 | $line = get_lang('NoResult'); |
7422 | 7422 | } |
7423 | 7423 | } else { |
7424 | - $new_view = substr_replace($view,'1',4,1); |
|
7424 | + $new_view = substr_replace($view, '1', 4, 1); |
|
7425 | 7425 | } |
7426 | 7426 | return array($title_line, $line); |
7427 | 7427 | } |
@@ -993,7 +993,9 @@ |
||
993 | 993 | if ($file != '.' && $file != '..') { |
994 | 994 | |
995 | 995 | $filetype = 'file'; |
996 | - if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder'; |
|
996 | + if (is_dir($base_work_dir.$upload_path.'/'.$file)) { |
|
997 | + $filetype = 'folder'; |
|
998 | + } |
|
997 | 999 | |
998 | 1000 | $safe_file = api_replace_dangerous_char($file, 'strict'); |
999 | 1001 | @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * Returns the name without extension, used for the title |
54 | 54 | * |
55 | 55 | * @param string $name |
56 | - * @return name without the extension |
|
56 | + * @return string without the extension |
|
57 | 57 | */ |
58 | 58 | function get_document_title($name) |
59 | 59 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * This function checks if the upload succeeded |
68 | 68 | * |
69 | 69 | * @param array $uploaded_file ($_FILES) |
70 | - * @return true if upload succeeded |
|
70 | + * @return boolean if upload succeeded |
|
71 | 71 | */ |
72 | 72 | function process_uploaded_file($uploaded_file, $show_output = true) |
73 | 73 | { |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | * @param array $courseInfo |
1026 | 1026 | * @param array $userInfo |
1027 | 1027 | * @param array $uploaded_file - follows the $_FILES Structure |
1028 | - * @param string $upload_path - destination of the upload. |
|
1028 | + * @param string $uploadPath - destination of the upload. |
|
1029 | 1029 | * This path is to append to $base_work_dir |
1030 | 1030 | * @param string $base_work_dir - base working directory of the module |
1031 | 1031 | * @param int $maxFilledSpace - amount of bytes to not exceed in the base |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | * @param int $session_id Session ID, if any |
1213 | 1213 | * @param int $userId creator id |
1214 | 1214 | * |
1215 | - * @return int id if inserted document |
|
1215 | + * @return string|false id if inserted document |
|
1216 | 1216 | */ |
1217 | 1217 | function add_document( |
1218 | 1218 | $_course, |
@@ -1346,7 +1346,7 @@ discard block |
||
1346 | 1346 | * |
1347 | 1347 | * @author Olivier Cauberghe <[email protected]> |
1348 | 1348 | * @param path+filename eg: /main/document/document.php |
1349 | - * @return The directory depth |
|
1349 | + * @return integer directory depth |
|
1350 | 1350 | */ |
1351 | 1351 | function get_levels($filename) { |
1352 | 1352 | $levels = explode('/', $filename); |
@@ -1363,6 +1363,8 @@ discard block |
||
1363 | 1363 | * @author Olivier Cauberghe <[email protected]> |
1364 | 1364 | * @param path,filename |
1365 | 1365 | * action: Adds an entry to the document table with the default settings. |
1366 | + * @param string $upload_path |
|
1367 | + * @param string $filename |
|
1366 | 1368 | */ |
1367 | 1369 | function set_default_settings($upload_path, $filename, $filetype = 'file') |
1368 | 1370 | { |
@@ -1818,7 +1820,6 @@ discard block |
||
1818 | 1820 | * @param int $groupId |
1819 | 1821 | * @param bool $output |
1820 | 1822 | * @param array $parent |
1821 | - * @param string $uploadPath |
|
1822 | 1823 | * |
1823 | 1824 | */ |
1824 | 1825 | function add_all_documents_in_folder_to_database( |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | // (e.g. image upload in html editor). |
90 | 90 | $max_file_size = intval($_POST['MAX_FILE_SIZE']); |
91 | 91 | if ($show_output) { |
92 | - Display::display_error_message(get_lang('UplExceedMaxPostSize'). format_file_size($max_file_size)); |
|
92 | + Display::display_error_message(get_lang('UplExceedMaxPostSize').format_file_size($max_file_size)); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return false; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | case 4: |
104 | 104 | // No file was uploaded. |
105 | 105 | if ($show_output) { |
106 | - Display::display_error_message(get_lang('UplNoFileUploaded').' '. get_lang('UplSelectFileFirst')); |
|
106 | + Display::display_error_message(get_lang('UplNoFileUploaded').' '.get_lang('UplSelectFileFirst')); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | return false; |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | if ($output) { |
448 | 448 | Display::addFlash( |
449 | 449 | Display::return_message( |
450 | - get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle . ' ' . get_lang('UplFileOverwritten'), |
|
450 | + get_lang('UplUploadSucceeded').'<br /> '.$documentTitle.' '.get_lang('UplFileOverwritten'), |
|
451 | 451 | 'confirmation', |
452 | 452 | false |
453 | 453 | ) |
@@ -586,14 +586,14 @@ discard block |
||
586 | 586 | if (isset($_POST['moodle_import'])) { |
587 | 587 | Display::addFlash( |
588 | 588 | Display::display_confirmation_message( |
589 | - get_lang('UplUploadSucceeded') . '<br />' . get_lang('UplFileSavedAs') . ' ' . $documentTitle, |
|
589 | + get_lang('UplUploadSucceeded').'<br />'.get_lang('UplFileSavedAs').' '.$documentTitle, |
|
590 | 590 | false, |
591 | 591 | true |
592 | 592 | ) |
593 | 593 | ); |
594 | 594 | } else { |
595 | 595 | Display::display_confirmation_message( |
596 | - get_lang('UplUploadSucceeded') . '<br />' . get_lang('UplFileSavedAs') . ' ' . $documentTitle, |
|
596 | + get_lang('UplUploadSucceeded').'<br />'.get_lang('UplFileSavedAs').' '.$documentTitle, |
|
597 | 597 | false |
598 | 598 | ); |
599 | 599 | } |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | if (isset($_POST['moodle_import'])) { |
671 | 671 | Display::addFlash( |
672 | 672 | Display::display_confirmation_message( |
673 | - get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle, |
|
673 | + get_lang('UplUploadSucceeded').'<br /> '.$documentTitle, |
|
674 | 674 | false, |
675 | 675 | true |
676 | 676 | ) |
@@ -765,12 +765,12 @@ discard block |
||
765 | 765 | function dir_total_space($dir_path) |
766 | 766 | { |
767 | 767 | $save_dir = getcwd(); |
768 | - chdir($dir_path) ; |
|
768 | + chdir($dir_path); |
|
769 | 769 | $handle = opendir($dir_path); |
770 | 770 | $sumSize = 0; |
771 | 771 | $dirList = array(); |
772 | 772 | while ($element = readdir($handle)) { |
773 | - if ( $element == '.' || $element == '..') { |
|
773 | + if ($element == '.' || $element == '..') { |
|
774 | 774 | continue; // Skip the current and parent directories |
775 | 775 | } |
776 | 776 | if (is_file($element)) { |
@@ -781,11 +781,11 @@ discard block |
||
781 | 781 | } |
782 | 782 | } |
783 | 783 | |
784 | - closedir($handle) ; |
|
784 | + closedir($handle); |
|
785 | 785 | |
786 | 786 | if (sizeof($dirList) > 0) { |
787 | 787 | foreach ($dirList as $j) { |
788 | - $sizeDir = dir_total_space($j); // Recursivity |
|
788 | + $sizeDir = dir_total_space($j); // Recursivity |
|
789 | 789 | $sumSize += $sizeDir; |
790 | 790 | } |
791 | 791 | } |
@@ -819,63 +819,63 @@ discard block |
||
819 | 819 | |
820 | 820 | static $mime_type = array(); |
821 | 821 | |
822 | - $mime_type[] = 'application/msword'; $extension[] = '.doc'; |
|
823 | - $mime_type[] = 'application/rtf'; $extension[] = '.rtf'; |
|
824 | - $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt'; |
|
825 | - $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls'; |
|
826 | - $mime_type[] = 'application/pdf'; $extension[] = '.pdf'; |
|
827 | - $mime_type[] = 'application/postscript'; $extension[] = '.ps'; |
|
828 | - $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx'; |
|
829 | - $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz'; |
|
830 | - $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf'; |
|
831 | - $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit'; |
|
832 | - $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
833 | - $mime_type[] = 'application/zip'; $extension[] = '.zip'; |
|
834 | - $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
835 | - $mime_type[] = 'text/html'; $extension[] = '.html'; |
|
836 | - $mime_type[] = 'text/plain'; $extension[] = '.txt'; |
|
837 | - $mime_type[] = 'text/rtf'; $extension[] = '.rtf'; |
|
838 | - $mime_type[] = 'img/gif'; $extension[] = '.gif'; |
|
839 | - $mime_type[] = 'img/jpeg'; $extension[] = '.jpg'; |
|
840 | - $mime_type[] = 'img/png'; $extension[] = '.png'; |
|
841 | - $mime_type[] = 'audio/midi'; $extension[] = '.mid'; |
|
842 | - $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3'; |
|
843 | - $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif'; |
|
844 | - $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm'; |
|
845 | - $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm'; |
|
846 | - $mime_type[] = 'audio/x-wav'; $extension[] = '.wav'; |
|
847 | - $mime_type[] = 'video/mpeg'; $extension[] = '.mpg'; |
|
848 | - $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4'; |
|
849 | - $mime_type[] = 'video/quicktime'; $extension[] = '.mov'; |
|
850 | - $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi'; |
|
851 | - |
|
852 | - $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv'; |
|
853 | - $mime_type[] = 'video/x-flv'; $extension[] = '.flv'; |
|
854 | - $mime_type[] = 'image/svg+xml'; $extension[] = '.svg'; |
|
855 | - $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz'; |
|
856 | - $mime_type[] = 'video/ogg'; $extension[] = '.ogv'; |
|
857 | - $mime_type[] = 'audio/ogg'; $extension[] = '.oga'; |
|
858 | - $mime_type[] = 'application/ogg'; $extension[] = '.ogg'; |
|
859 | - $mime_type[] = 'application/ogg'; $extension[] = '.ogx'; |
|
860 | - $mime_type[] = 'application/x-freemind'; $extension[] = '.mm'; |
|
861 | - |
|
862 | - $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm'; |
|
863 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx'; |
|
864 | - $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm'; |
|
865 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx'; |
|
866 | - $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm'; |
|
867 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx'; |
|
868 | - $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam'; |
|
869 | - $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm'; |
|
870 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx'; |
|
871 | - $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm'; |
|
872 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx'; |
|
873 | - $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam'; |
|
874 | - $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb'; |
|
875 | - $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm'; |
|
876 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx'; |
|
877 | - $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm'; |
|
878 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx'; |
|
822 | + $mime_type[] = 'application/msword'; $extension[] = '.doc'; |
|
823 | + $mime_type[] = 'application/rtf'; $extension[] = '.rtf'; |
|
824 | + $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt'; |
|
825 | + $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls'; |
|
826 | + $mime_type[] = 'application/pdf'; $extension[] = '.pdf'; |
|
827 | + $mime_type[] = 'application/postscript'; $extension[] = '.ps'; |
|
828 | + $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx'; |
|
829 | + $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz'; |
|
830 | + $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf'; |
|
831 | + $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit'; |
|
832 | + $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
833 | + $mime_type[] = 'application/zip'; $extension[] = '.zip'; |
|
834 | + $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
835 | + $mime_type[] = 'text/html'; $extension[] = '.html'; |
|
836 | + $mime_type[] = 'text/plain'; $extension[] = '.txt'; |
|
837 | + $mime_type[] = 'text/rtf'; $extension[] = '.rtf'; |
|
838 | + $mime_type[] = 'img/gif'; $extension[] = '.gif'; |
|
839 | + $mime_type[] = 'img/jpeg'; $extension[] = '.jpg'; |
|
840 | + $mime_type[] = 'img/png'; $extension[] = '.png'; |
|
841 | + $mime_type[] = 'audio/midi'; $extension[] = '.mid'; |
|
842 | + $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3'; |
|
843 | + $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif'; |
|
844 | + $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm'; |
|
845 | + $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm'; |
|
846 | + $mime_type[] = 'audio/x-wav'; $extension[] = '.wav'; |
|
847 | + $mime_type[] = 'video/mpeg'; $extension[] = '.mpg'; |
|
848 | + $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4'; |
|
849 | + $mime_type[] = 'video/quicktime'; $extension[] = '.mov'; |
|
850 | + $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi'; |
|
851 | + |
|
852 | + $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv'; |
|
853 | + $mime_type[] = 'video/x-flv'; $extension[] = '.flv'; |
|
854 | + $mime_type[] = 'image/svg+xml'; $extension[] = '.svg'; |
|
855 | + $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz'; |
|
856 | + $mime_type[] = 'video/ogg'; $extension[] = '.ogv'; |
|
857 | + $mime_type[] = 'audio/ogg'; $extension[] = '.oga'; |
|
858 | + $mime_type[] = 'application/ogg'; $extension[] = '.ogg'; |
|
859 | + $mime_type[] = 'application/ogg'; $extension[] = '.ogx'; |
|
860 | + $mime_type[] = 'application/x-freemind'; $extension[] = '.mm'; |
|
861 | + |
|
862 | + $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm'; |
|
863 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx'; |
|
864 | + $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm'; |
|
865 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx'; |
|
866 | + $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm'; |
|
867 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx'; |
|
868 | + $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam'; |
|
869 | + $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm'; |
|
870 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx'; |
|
871 | + $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm'; |
|
872 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx'; |
|
873 | + $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam'; |
|
874 | + $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb'; |
|
875 | + $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm'; |
|
876 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx'; |
|
877 | + $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm'; |
|
878 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx'; |
|
879 | 879 | |
880 | 880 | // Test on PC (files with no extension get application/octet-stream) |
881 | 881 | //$mime_type[] = 'application/octet-stream'; $extension[] = '.ext'; |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | |
885 | 885 | foreach ($mime_type as $key => & $type) { |
886 | 886 | if ($type == $file_type) { |
887 | - $file_name .= $extension[$key]; |
|
887 | + $file_name .= $extension[$key]; |
|
888 | 888 | break; |
889 | 889 | } |
890 | 890 | } |
@@ -960,12 +960,12 @@ discard block |
||
960 | 960 | } |
961 | 961 | |
962 | 962 | // It happens on Linux that $upload_path sometimes doesn't start with '/' |
963 | - if ($upload_path[0] != '/' && substr($base_work_dir,-1,1) != '/') { |
|
963 | + if ($upload_path[0] != '/' && substr($base_work_dir, -1, 1) != '/') { |
|
964 | 964 | $upload_path = '/'.$upload_path; |
965 | 965 | } |
966 | 966 | |
967 | 967 | if ($upload_path[strlen($upload_path) - 1] == '/') { |
968 | - $upload_path=substr($upload_path, 0, -1); |
|
968 | + $upload_path = substr($upload_path, 0, -1); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | /* Uncompressing phase */ |
@@ -977,15 +977,15 @@ discard block |
||
977 | 977 | - add it to the database |
978 | 978 | - parse & change relative html links |
979 | 979 | */ |
980 | - if (PHP_OS == 'Linux' && ! get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** |
|
980 | + if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** |
|
981 | 981 | // Shell Method - if this is possible, it gains some speed |
982 | - exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." " .$uploaded_file['tmp_name']); |
|
982 | + exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." ".$uploaded_file['tmp_name']); |
|
983 | 983 | } else { |
984 | 984 | // PHP method - slower... |
985 | 985 | $save_dir = getcwd(); |
986 | 986 | chdir($base_work_dir.$upload_path); |
987 | 987 | $unzippingState = $zip_file->extract(); |
988 | - for ($j=0; $j < count($unzippingState); $j++) { |
|
988 | + for ($j = 0; $j < count($unzippingState); $j++) { |
|
989 | 989 | $state = $unzippingState[$j]; |
990 | 990 | |
991 | 991 | // Fix relative links in html files |
@@ -999,8 +999,8 @@ discard block |
||
999 | 999 | if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder'; |
1000 | 1000 | |
1001 | 1001 | $safe_file = api_replace_dangerous_char($file); |
1002 | - @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file); |
|
1003 | - set_default_settings($upload_path, $safe_file,$filetype); |
|
1002 | + @rename($base_work_dir.$upload_path.'/'.$file, $base_work_dir.$upload_path.'/'.$safe_file); |
|
1003 | + set_default_settings($upload_path, $safe_file, $filetype); |
|
1004 | 1004 | } |
1005 | 1005 | } |
1006 | 1006 | |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | $zip = new PclZip($uploaded_file['tmp_name']); |
1051 | 1051 | |
1052 | 1052 | // Check the zip content (real size and file extension) |
1053 | - $zip_content_array = (array)$zip->listContent(); |
|
1053 | + $zip_content_array = (array) $zip->listContent(); |
|
1054 | 1054 | |
1055 | 1055 | $realSize = 0; |
1056 | 1056 | foreach ($zip_content_array as & $this_content) { |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | function filter_extension(&$filename) |
1153 | 1153 | { |
1154 | 1154 | if (substr($filename, -1) == '/') { |
1155 | - return 1; // Authorize directories |
|
1155 | + return 1; // Authorize directories |
|
1156 | 1156 | } |
1157 | 1157 | $blacklist = api_get_setting('upload_extensions_list_type'); |
1158 | 1158 | if ($blacklist != 'whitelist') { // if = blacklist |
@@ -1378,9 +1378,9 @@ discard block |
||
1378 | 1378 | $upload_path = str_replace('//', '/', $upload_path); |
1379 | 1379 | |
1380 | 1380 | if ($upload_path == '/') { |
1381 | - $upload_path=''; |
|
1381 | + $upload_path = ''; |
|
1382 | 1382 | } elseif (!empty($upload_path) && $upload_path[0] != '/') { |
1383 | - $upload_path="/$upload_path"; |
|
1383 | + $upload_path = "/$upload_path"; |
|
1384 | 1384 | } |
1385 | 1385 | |
1386 | 1386 | $endchar = substr($filename, strlen($filename) - 1, 1); |
@@ -1418,7 +1418,7 @@ discard block |
||
1418 | 1418 | $img_path_list = array(); |
1419 | 1419 | |
1420 | 1420 | if (!$fp = fopen($html_file, 'r')) { |
1421 | - return ; |
|
1421 | + return; |
|
1422 | 1422 | } |
1423 | 1423 | |
1424 | 1424 | // Aearch and store occurences of the <img> tag in an array |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | $img_tag_list = $matches[0]; |
1439 | 1439 | } |
1440 | 1440 | |
1441 | - fclose ($fp); |
|
1441 | + fclose($fp); |
|
1442 | 1442 | unset($buffer); |
1443 | 1443 | |
1444 | 1444 | // Search the image file path from all the <IMG> tag detected |
@@ -1537,7 +1537,7 @@ discard block |
||
1537 | 1537 | |
1538 | 1538 | if (!is_dir($base_work_dir.$systemFolderName)) { |
1539 | 1539 | $result = mkdir( |
1540 | - $base_work_dir . $systemFolderName, |
|
1540 | + $base_work_dir.$systemFolderName, |
|
1541 | 1541 | api_get_permissions_for_new_directories(), |
1542 | 1542 | true |
1543 | 1543 | ); |
@@ -1550,7 +1550,7 @@ discard block |
||
1550 | 1550 | WHERE |
1551 | 1551 | c_id = $course_id AND |
1552 | 1552 | ( |
1553 | - path = '" . Database::escape_string($systemFolderName). "' |
|
1553 | + path = '".Database::escape_string($systemFolderName)."' |
|
1554 | 1554 | ) |
1555 | 1555 | "; |
1556 | 1556 | |
@@ -1701,7 +1701,7 @@ discard block |
||
1701 | 1701 | |
1702 | 1702 | // Fix the image tags |
1703 | 1703 | |
1704 | - for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb ; $i++) { |
|
1704 | + for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb; $i++) { |
|
1705 | 1705 | $replace_what = $original_img_path[$i]; |
1706 | 1706 | // We only need the directory and the filename /path/to/file_html_files/missing_file.gif -> file_html_files/missing_file.gif |
1707 | 1707 | $exploded_file_path = explode('/', $new_img_path[$i]); |
@@ -1742,7 +1742,7 @@ discard block |
||
1742 | 1742 | .'</body>' |
1743 | 1743 | .'</html>'; |
1744 | 1744 | if (file_exists($file_path)) { |
1745 | - if (!($fp = fopen ($file_path, 'w'))) { |
|
1745 | + if (!($fp = fopen($file_path, 'w'))) { |
|
1746 | 1746 | return false; |
1747 | 1747 | } |
1748 | 1748 | return fwrite($fp, $file_content); |
@@ -1779,7 +1779,7 @@ discard block |
||
1779 | 1779 | { |
1780 | 1780 | // Do we need a / or not? |
1781 | 1781 | $added_slash = ($upload_path == '/') ? '' : '/'; |
1782 | - $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path); |
|
1782 | + $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path); |
|
1783 | 1783 | // Build the form |
1784 | 1784 | $form = "<p><strong>".get_lang('MissingImagesDetected')."</strong></p>" |
1785 | 1785 | ."<form method=\"post\" action=\"".api_get_self()."\" enctype=\"multipart/form-data\">" |
@@ -3122,8 +3122,9 @@ |
||
3122 | 3122 | global $DaysShort, $course_path; |
3123 | 3123 | //Handle leap year |
3124 | 3124 | $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
3125 | - if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
|
3126 | - $numberofdays[2] = 29; |
|
3125 | + if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) { |
|
3126 | + $numberofdays[2] = 29; |
|
3127 | + } |
|
3127 | 3128 | //Get the first day of the month |
3128 | 3129 | $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); |
3129 | 3130 | //Start the week on monday |
@@ -573,14 +573,14 @@ |
||
573 | 573 | * @param int $allDay is all day 'true' or 'false' |
574 | 574 | * @param string $title |
575 | 575 | * @param string $content |
576 | - * @param array $usersToSend |
|
576 | + * @param string[] $usersToSend |
|
577 | 577 | * @param array $attachmentArray |
578 | 578 | * @param array $attachmentCommentList |
579 | 579 | * @param string $comment |
580 | 580 | * @param string $color |
581 | 581 | * @param bool $addAnnouncement |
582 | 582 | * |
583 | - * @return null|false |
|
583 | + * @return null|boolean |
|
584 | 584 | */ |
585 | 585 | public function editEvent( |
586 | 586 | $id, |
@@ -1536,12 +1536,12 @@ discard block |
||
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | if (empty($session_id)) { |
1539 | - $sessionCondition = " |
|
1539 | + $sessionCondition = " |
|
1540 | 1540 | ( |
1541 | 1541 | agenda.session_id = 0 AND (ip.session_id IS NULL OR ip.session_id = 0) |
1542 | 1542 | ) "; |
1543 | 1543 | } else { |
1544 | - $sessionCondition = " |
|
1544 | + $sessionCondition = " |
|
1545 | 1545 | ( |
1546 | 1546 | agenda.session_id = $session_id AND |
1547 | 1547 | ip.session_id = $session_id |
@@ -1584,13 +1584,13 @@ discard block |
||
1584 | 1584 | } |
1585 | 1585 | |
1586 | 1586 | if (empty($session_id)) { |
1587 | - $sessionCondition = " |
|
1587 | + $sessionCondition = " |
|
1588 | 1588 | ( |
1589 | 1589 | agenda.session_id = 0 AND |
1590 | 1590 | (ip.session_id IS NULL OR ip.session_id = 0) |
1591 | 1591 | ) "; |
1592 | 1592 | } else { |
1593 | - $sessionCondition = " |
|
1593 | + $sessionCondition = " |
|
1594 | 1594 | ( |
1595 | 1595 | agenda.session_id = $session_id AND |
1596 | 1596 | ip.session_id = $session_id |
@@ -1642,7 +1642,7 @@ discard block |
||
1642 | 1642 | while ($row = Database::fetch_array($result, 'ASSOC')) { |
1643 | 1643 | $event = array(); |
1644 | 1644 | $event['id'] = 'course_'.$row['id']; |
1645 | - $event['unique_id'] = $row['iid']; |
|
1645 | + $event['unique_id'] = $row['iid']; |
|
1646 | 1646 | // To avoid doubles |
1647 | 1647 | if (in_array($event['unique_id'], $eventsAdded)) { |
1648 | 1648 | continue; |
@@ -2144,7 +2144,7 @@ discard block |
||
2144 | 2144 | '<span id="link-more-attach"> |
2145 | 2145 | <a href="javascript://" onclick="return add_image_form()">'. |
2146 | 2146 | get_lang('AddOneMoreFile').'</a> |
2147 | - </span> ('.sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize'))).')' |
|
2147 | + </span> ('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).')' |
|
2148 | 2148 | ); |
2149 | 2149 | |
2150 | 2150 | if (isset($params['attachment']) && !empty($params['attachment'])) { |
@@ -2740,8 +2740,8 @@ discard block |
||
2740 | 2740 | $currentTimeZone, |
2741 | 2741 | $end->format('e') |
2742 | 2742 | ); |
2743 | - $title = api_convert_encoding((string)$event->summary, $charset, 'UTF-8'); |
|
2744 | - $description = api_convert_encoding((string)$event->description, $charset, 'UTF-8'); |
|
2743 | + $title = api_convert_encoding((string) $event->summary, $charset, 'UTF-8'); |
|
2744 | + $description = api_convert_encoding((string) $event->description, $charset, 'UTF-8'); |
|
2745 | 2745 | |
2746 | 2746 | $id = $this->addEvent( |
2747 | 2747 | $startDateTime, |
@@ -2882,7 +2882,7 @@ discard block |
||
2882 | 2882 | ORDER BY start_date "; |
2883 | 2883 | } else { |
2884 | 2884 | // if the user is not an administrator of that course |
2885 | - if (is_array($group_memberships) && count($group_memberships)>0) { |
|
2885 | + if (is_array($group_memberships) && count($group_memberships) > 0) { |
|
2886 | 2886 | $sqlquery = "SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref |
2887 | 2887 | FROM ".$TABLEAGENDA." agenda, |
2888 | 2888 | ".$TABLE_ITEMPROPERTY." ip |
@@ -2912,14 +2912,14 @@ discard block |
||
2912 | 2912 | $agendaday = -1; |
2913 | 2913 | if (!empty($item['start_date'])) { |
2914 | 2914 | $item['start_date'] = api_get_local_time($item['start_date']); |
2915 | - $item['start_date_tms'] = api_strtotime($item['start_date']); |
|
2915 | + $item['start_date_tms'] = api_strtotime($item['start_date']); |
|
2916 | 2916 | $agendaday = date("j", $item['start_date_tms']); |
2917 | 2917 | } |
2918 | 2918 | if (!empty($item['end_date'])) { |
2919 | 2919 | $item['end_date'] = api_get_local_time($item['end_date']); |
2920 | 2920 | } |
2921 | 2921 | |
2922 | - $url = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday"; |
|
2922 | + $url = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday"; |
|
2923 | 2923 | |
2924 | 2924 | $item['url'] = $url; |
2925 | 2925 | $item['course_name'] = $array_course_info['title']; |
@@ -2931,9 +2931,9 @@ discard block |
||
2931 | 2931 | } |
2932 | 2932 | |
2933 | 2933 | // sorting by hour for every day |
2934 | - $agendaitems = array (); |
|
2934 | + $agendaitems = array(); |
|
2935 | 2935 | while (list ($agendaday, $tmpitems) = each($items)) { |
2936 | - if(!isset($agendaitems[$agendaday])) { |
|
2936 | + if (!isset($agendaitems[$agendaday])) { |
|
2937 | 2937 | $agendaitems[$agendaday] = ''; |
2938 | 2938 | } |
2939 | 2939 | sort($tmpitems); |
@@ -3107,9 +3107,9 @@ discard block |
||
3107 | 3107 | $end_year = $start_end_day_of_week['end']['year']; |
3108 | 3108 | // in sql statements you have to use year-month-day for date calculations |
3109 | 3109 | $start_filter = $start_year."-".$start_month."-".$start_day." 00:00:00"; |
3110 | - $start_filter = api_get_utc_datetime($start_filter); |
|
3110 | + $start_filter = api_get_utc_datetime($start_filter); |
|
3111 | 3111 | $end_filter = $end_year."-".$end_month."-".$end_day." 23:59:59"; |
3112 | - $end_filter = api_get_utc_datetime($end_filter); |
|
3112 | + $end_filter = api_get_utc_datetime($end_filter); |
|
3113 | 3113 | $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'"; |
3114 | 3114 | } |
3115 | 3115 | // 3. creating the SQL statement for getting the personal agenda items in DAY view |
@@ -3117,18 +3117,18 @@ discard block |
||
3117 | 3117 | // we are in day view |
3118 | 3118 | // we could use mysql date() function but this is only available from 4.1 and higher |
3119 | 3119 | $start_filter = $year."-".$month."-".$day." 00:00:00"; |
3120 | - $start_filter = api_get_utc_datetime($start_filter); |
|
3120 | + $start_filter = api_get_utc_datetime($start_filter); |
|
3121 | 3121 | $end_filter = $year."-".$month."-".$day." 23:59:59"; |
3122 | - $end_filter = api_get_utc_datetime($end_filter); |
|
3122 | + $end_filter = api_get_utc_datetime($end_filter); |
|
3123 | 3123 | $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'"; |
3124 | 3124 | } |
3125 | 3125 | |
3126 | 3126 | $result = Database::query($sql); |
3127 | 3127 | while ($item = Database::fetch_array($result, 'ASSOC')) { |
3128 | 3128 | |
3129 | - $time_minute = api_convert_and_format_date($item['date'], TIME_NO_SEC_FORMAT); |
|
3130 | - $item['date'] = api_get_local_time($item['date']); |
|
3131 | - $item['start_date_tms'] = api_strtotime($item['date']); |
|
3129 | + $time_minute = api_convert_and_format_date($item['date'], TIME_NO_SEC_FORMAT); |
|
3130 | + $item['date'] = api_get_local_time($item['date']); |
|
3131 | + $item['start_date_tms'] = api_strtotime($item['date']); |
|
3132 | 3132 | $item['content'] = $item['text']; |
3133 | 3133 | |
3134 | 3134 | // we break the date field in the database into a date and a time part |
@@ -3148,7 +3148,7 @@ discard block |
||
3148 | 3148 | $second = $agendatime[2]; |
3149 | 3149 | |
3150 | 3150 | if ($type == 'month_view') { |
3151 | - $item['calendar_type'] = 'personal'; |
|
3151 | + $item['calendar_type'] = 'personal'; |
|
3152 | 3152 | $item['start_date'] = $item['date']; |
3153 | 3153 | $agendaitems[$day][] = $item; |
3154 | 3154 | continue; |
@@ -3173,7 +3173,7 @@ discard block |
||
3173 | 3173 | // this is the array construction for the DAY view |
3174 | 3174 | $halfhour = 2 * $agendatime['0']; |
3175 | 3175 | if ($agendatime['1'] >= '30') { |
3176 | - $halfhour = $halfhour +1; |
|
3176 | + $halfhour = $halfhour + 1; |
|
3177 | 3177 | } |
3178 | 3178 | |
3179 | 3179 | //Display events by list |
@@ -3197,22 +3197,22 @@ discard block |
||
3197 | 3197 | { |
3198 | 3198 | global $DaysShort, $course_path; |
3199 | 3199 | //Handle leap year |
3200 | - $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
3200 | + $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
3201 | 3201 | if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
3202 | 3202 | $numberofdays[2] = 29; |
3203 | 3203 | //Get the first day of the month |
3204 | 3204 | $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); |
3205 | 3205 | //Start the week on monday |
3206 | 3206 | $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6; |
3207 | - $g_cc = (isset($_GET['courseCode'])?$_GET['courseCode']:''); |
|
3207 | + $g_cc = (isset($_GET['courseCode']) ? $_GET['courseCode'] : ''); |
|
3208 | 3208 | |
3209 | - $next_month = ($month == 1 ? 12 : $month -1); |
|
3210 | - $prev_month = ($month == 12 ? 1 : $month +1); |
|
3209 | + $next_month = ($month == 1 ? 12 : $month - 1); |
|
3210 | + $prev_month = ($month == 12 ? 1 : $month + 1); |
|
3211 | 3211 | |
3212 | - $next_year = ($month == 1 ? $year -1 : $year); |
|
3213 | - $prev_year = ($month == 12 ? $year +1 : $year); |
|
3212 | + $next_year = ($month == 1 ? $year - 1 : $year); |
|
3213 | + $prev_year = ($month == 12 ? $year + 1 : $year); |
|
3214 | 3214 | |
3215 | - if ($show_content) { |
|
3215 | + if ($show_content) { |
|
3216 | 3216 | $back_url = Display::url(get_lang('Previous'), api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=".$next_month."&year=".$next_year); |
3217 | 3217 | $next_url = Display::url(get_lang('Next'), api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=".$prev_month."&year=".$prev_year); |
3218 | 3218 | } else { |
@@ -3229,7 +3229,7 @@ discard block |
||
3229 | 3229 | $html .= '</div>'; |
3230 | 3230 | $html .= '<table id="agenda_list2" class="table table-bordered">'; |
3231 | 3231 | $html .= '<tr>'; |
3232 | - for ($ii = 1; $ii < 8; $ii ++) { |
|
3232 | + for ($ii = 1; $ii < 8; $ii++) { |
|
3233 | 3233 | $html .= '<td class="weekdays">'.$DaysShort[$ii % 7].'</td>'; |
3234 | 3234 | } |
3235 | 3235 | $html .= '</tr>'; |
@@ -3238,7 +3238,7 @@ discard block |
||
3238 | 3238 | $today = getdate(); |
3239 | 3239 | while ($curday <= $numberofdays[$month]) { |
3240 | 3240 | $html .= "<tr>"; |
3241 | - for ($ii = 0; $ii < 7; $ii ++) { |
|
3241 | + for ($ii = 0; $ii < 7; $ii++) { |
|
3242 | 3242 | if (($curday == -1) && ($ii == $startdayofweek)) { |
3243 | 3243 | $curday = 1; |
3244 | 3244 | } |
@@ -3252,21 +3252,21 @@ discard block |
||
3252 | 3252 | $html .= "<td ".$class.">".$dayheader; |
3253 | 3253 | |
3254 | 3254 | if (!empty($agendaitems[$curday])) { |
3255 | - $items = $agendaitems[$curday]; |
|
3256 | - $items = msort($items, 'start_date_tms'); |
|
3255 | + $items = $agendaitems[$curday]; |
|
3256 | + $items = msort($items, 'start_date_tms'); |
|
3257 | 3257 | |
3258 | - foreach($items as $value) { |
|
3258 | + foreach ($items as $value) { |
|
3259 | 3259 | $value['title'] = Security::remove_XSS($value['title']); |
3260 | 3260 | $start_time = api_format_date($value['start_date'], TIME_NO_SEC_FORMAT); |
3261 | 3261 | $end_time = ''; |
3262 | 3262 | |
3263 | 3263 | if (!empty($value['end_date'])) { |
3264 | - $end_time = '- <i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>'; |
|
3264 | + $end_time = '- <i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>'; |
|
3265 | 3265 | } |
3266 | 3266 | $complete_time = '<i>'.api_format_date($value['start_date'], DATE_TIME_FORMAT_LONG).'</i> '.$end_time; |
3267 | 3267 | $time = '<i>'.$start_time.'</i>'; |
3268 | 3268 | |
3269 | - switch($value['calendar_type']) { |
|
3269 | + switch ($value['calendar_type']) { |
|
3270 | 3270 | case 'personal': |
3271 | 3271 | $bg_color = '#D0E7F4'; |
3272 | 3272 | $icon = Display::return_icon('user.png', get_lang('MyAgenda'), array(), ICON_SIZE_SMALL); |
@@ -3318,7 +3318,7 @@ discard block |
||
3318 | 3318 | } |
3319 | 3319 | } |
3320 | 3320 | $html .= "</td>"; |
3321 | - $curday ++; |
|
3321 | + $curday++; |
|
3322 | 3322 | } else { |
3323 | 3323 | $html .= "<td></td>"; |
3324 | 3324 | } |
@@ -3340,18 +3340,18 @@ discard block |
||
3340 | 3340 | * where datestart and dateend are in yyyyMMddhhmmss format. |
3341 | 3341 | * @TODO Implement really personal events (from user DB) and global events (from main DB) |
3342 | 3342 | */ |
3343 | - public static function get_personal_agenda_items_between_dates($user_id, $date_start='', $date_end='') |
|
3343 | + public static function get_personal_agenda_items_between_dates($user_id, $date_start = '', $date_end = '') |
|
3344 | 3344 | { |
3345 | - $items = array (); |
|
3345 | + $items = array(); |
|
3346 | 3346 | if ($user_id != strval(intval($user_id))) { return $items; } |
3347 | - if (empty($date_start)) { $date_start = date('Y-m-d H:i:s');} |
|
3348 | - if (empty($date_end)) { $date_end = date('Y-m-d H:i:s',mktime(0, 0, 0, date("m"), date("d"), date("Y")+1));} |
|
3347 | + if (empty($date_start)) { $date_start = date('Y-m-d H:i:s'); } |
|
3348 | + if (empty($date_end)) { $date_end = date('Y-m-d H:i:s', mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1)); } |
|
3349 | 3349 | $expr = '/\d{4}-\d{2}-\d{2}\ \d{2}:\d{2}:\d{2}/'; |
3350 | - if(!preg_match($expr,$date_start)) { return $items; } |
|
3351 | - if(!preg_match($expr,$date_end)) { return $items; } |
|
3350 | + if (!preg_match($expr, $date_start)) { return $items; } |
|
3351 | + if (!preg_match($expr, $date_end)) { return $items; } |
|
3352 | 3352 | |
3353 | 3353 | // get agenda-items for every course |
3354 | - $courses = api_get_user_courses($user_id,false); |
|
3354 | + $courses = api_get_user_courses($user_id, false); |
|
3355 | 3355 | foreach ($courses as $id => $course) { |
3356 | 3356 | $c = api_get_course_info_by_id($course['real_id']); |
3357 | 3357 | //databases of the courses |
@@ -3375,9 +3375,9 @@ discard block |
||
3375 | 3375 | " ORDER BY start_date "; |
3376 | 3376 | } else { |
3377 | 3377 | // if the user is not an administrator of that course, then... |
3378 | - if (is_array($group_memberships) && count($group_memberships)>0) |
|
3378 | + if (is_array($group_memberships) && count($group_memberships) > 0) |
|
3379 | 3379 | { |
3380 | - $sqlquery = "SELECT " . |
|
3380 | + $sqlquery = "SELECT ". |
|
3381 | 3381 | "DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref ". |
3382 | 3382 | " FROM ".$t_a." agenda, ". |
3383 | 3383 | $t_ip." ip ". |
@@ -3405,13 +3405,13 @@ discard block |
||
3405 | 3405 | |
3406 | 3406 | $result = Database::query($sqlquery); |
3407 | 3407 | while ($item = Database::fetch_array($result)) { |
3408 | - $agendaday = date("j",strtotime($item['start_date'])); |
|
3409 | - $month = date("n",strtotime($item['start_date'])); |
|
3410 | - $year = date("Y",strtotime($item['start_date'])); |
|
3408 | + $agendaday = date("j", strtotime($item['start_date'])); |
|
3409 | + $month = date("n", strtotime($item['start_date'])); |
|
3410 | + $year = date("Y", strtotime($item['start_date'])); |
|
3411 | 3411 | $URL = api_get_path(WEB_PATH)."main/calendar/agenda.php?cidReq=".urlencode($course["code"])."&day=$agendaday&month=$month&year=$year#$agendaday"; |
3412 | - list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['start_date']); |
|
3412 | + list($year, $month, $day, $hour, $min, $sec) = split('[-: ]', $item['start_date']); |
|
3413 | 3413 | $start_date = $year.$month.$day.$hour.$min; |
3414 | - list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['end_date']); |
|
3414 | + list($year, $month, $day, $hour, $min, $sec) = split('[-: ]', $item['end_date']); |
|
3415 | 3415 | $end_date = $year.$month.$day.$hour.$min; |
3416 | 3416 | |
3417 | 3417 | $items[] = array( |
@@ -3439,7 +3439,7 @@ discard block |
||
3439 | 3439 | $user = api_get_user_id(); |
3440 | 3440 | $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE id=".$id." AND user = ".$user; |
3441 | 3441 | $result = Database::query($sql); |
3442 | - if(Database::num_rows($result)==1) { |
|
3442 | + if (Database::num_rows($result) == 1) { |
|
3443 | 3443 | $item = Database::fetch_array($result); |
3444 | 3444 | } else { |
3445 | 3445 | $item = null; |
@@ -3460,9 +3460,9 @@ discard block |
||
3460 | 3460 | // step 2: we which day this is (0=sunday, 1=monday, ...) |
3461 | 3461 | $number_day_in_week = date('w', $random_day_in_week); |
3462 | 3462 | // step 3: we calculate the timestamp of the monday of the week we are in |
3463 | - $start_timestamp = $random_day_in_week - (($number_day_in_week -1) * 24 * 60 * 60); |
|
3463 | + $start_timestamp = $random_day_in_week - (($number_day_in_week - 1) * 24 * 60 * 60); |
|
3464 | 3464 | // step 4: we calculate the timestamp of the sunday of the week we are in |
3465 | - $end_timestamp = $random_day_in_week + ((7 - $number_day_in_week +1) * 24 * 60 * 60) - 3600; |
|
3465 | + $end_timestamp = $random_day_in_week + ((7 - $number_day_in_week + 1) * 24 * 60 * 60) - 3600; |
|
3466 | 3466 | // step 5: calculating the start_day, end_day, start_month, end_month, start_year, end_year |
3467 | 3467 | $start_day = date('j', $start_timestamp); |
3468 | 3468 | $start_month = date('n', $start_timestamp); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $count = intval($count); |
80 | 80 | $from = intval($from); |
81 | 81 | |
82 | - $sql .= " ORDER BY $column $direction"; |
|
82 | + $sql .= " ORDER BY $column $direction"; |
|
83 | 83 | $sql .= " LIMIT $count, $from "; |
84 | 84 | |
85 | 85 | $result = Database::query($sql); |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | static function deactivate_zombies($ceiling) |
94 | 94 | { |
95 | 95 | $zombies = self::list_zombies($ceiling); |
96 | - $ids = array(); |
|
97 | - foreach($zombies as $zombie) { |
|
96 | + $ids = array(); |
|
97 | + foreach ($zombies as $zombie) { |
|
98 | 98 | $ids[] = $zombie['user_id']; |
99 | 99 | } |
100 | 100 | UserManager::deactivate_users($ids); |
@@ -248,17 +248,17 @@ discard block |
||
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
251 | - if (trim($home_top_temp) == '' && api_is_platform_admin()) { |
|
252 | - $home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>'; |
|
253 | - } else { |
|
254 | - $home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>'; |
|
255 | - } |
|
256 | - $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp); |
|
257 | - $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
|
258 | - } |
|
259 | - |
|
260 | - return $html; |
|
261 | - } |
|
251 | + if (trim($home_top_temp) == '' && api_is_platform_admin()) { |
|
252 | + $home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>'; |
|
253 | + } else { |
|
254 | + $home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>'; |
|
255 | + } |
|
256 | + $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp); |
|
257 | + $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
|
258 | + } |
|
259 | + |
|
260 | + return $html; |
|
261 | + } |
|
262 | 262 | |
263 | 263 | function return_notice() |
264 | 264 | { |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | $thereIsSubCat = true; |
510 | 510 | } elseif (api_get_setting('show_empty_course_categories') == 'true') { |
511 | 511 | /* End changed code to eliminate the (0 courses) after empty categories. */ |
512 | - $htmlListCat .= '<li>'; |
|
512 | + $htmlListCat .= '<li>'; |
|
513 | 513 | $htmlListCat .= $catLine['name']; |
514 | 514 | $htmlListCat .= "</li>"; |
515 | 515 | $thereIsSubCat = true; |
@@ -639,11 +639,11 @@ discard block |
||
639 | 639 | } |
640 | 640 | |
641 | 641 | /** |
642 | - * retrieves all the courses that the user has already subscribed to |
|
643 | - * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
|
644 | - * @param int $user_id: the id of the user |
|
645 | - * @return array an array containing all the information of the courses of the given user |
|
646 | - */ |
|
642 | + * retrieves all the courses that the user has already subscribed to |
|
643 | + * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
|
644 | + * @param int $user_id: the id of the user |
|
645 | + * @return array an array containing all the information of the courses of the given user |
|
646 | + */ |
|
647 | 647 | public function get_courses_of_user($user_id) |
648 | 648 | { |
649 | 649 | $table_course = Database::get_main_table(TABLE_MAIN_COURSE); |
@@ -682,6 +682,7 @@ discard block |
||
682 | 682 | * retrieves all the courses that the user has already subscribed to |
683 | 683 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
684 | 684 | * @param int $user_id: the id of the user |
685 | + * @param integer $user_id |
|
685 | 686 | * @return array an array containing all the information of the courses of the given user |
686 | 687 | */ |
687 | 688 | public function get_courses_of_user($user_id) |
@@ -732,8 +733,8 @@ discard block |
||
732 | 733 | |
733 | 734 | /** |
734 | 735 | * @todo use the template system |
735 | - * @param $title |
|
736 | - * @param $content |
|
736 | + * @param string|null $title |
|
737 | + * @param string $content |
|
737 | 738 | * @param string $id |
738 | 739 | * @param array $params |
739 | 740 | * @param string $idAccordion |
@@ -1704,8 +1705,8 @@ discard block |
||
1704 | 1705 | |
1705 | 1706 | /** |
1706 | 1707 | * Return HTML code for personal user course category |
1707 | - * @param $id |
|
1708 | - * @param $title |
|
1708 | + * @param integer $id |
|
1709 | + * @param string $title |
|
1709 | 1710 | * @return string |
1710 | 1711 | */ |
1711 | 1712 | private static function getHtmlForUserCategory($id, $title) |
@@ -1726,7 +1727,7 @@ discard block |
||
1726 | 1727 | /** |
1727 | 1728 | * return HTML code for course display in session view |
1728 | 1729 | * @param array $courseInfo |
1729 | - * @param $userCategoryId |
|
1730 | + * @param integer $userCategoryId |
|
1730 | 1731 | * @param bool $displayButton |
1731 | 1732 | * @param $loadDirs |
1732 | 1733 | * @return string |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | ); |
73 | 73 | |
74 | 74 | foreach ($exercises as $exercise_item) { |
75 | - $exercise_item['course_code'] = $course_code; |
|
76 | - $exercise_item['session_id'] = $session_id; |
|
77 | - $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC'); |
|
75 | + $exercise_item['course_code'] = $course_code; |
|
76 | + $exercise_item['session_id'] = $session_id; |
|
77 | + $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC'); |
|
78 | 78 | |
79 | 79 | $exercise_list[] = $exercise_item; |
80 | 80 | } |
@@ -214,16 +214,16 @@ discard block |
||
214 | 214 | if ($show_menu) { |
215 | 215 | $html .= '<ul class="nav nav-pills nav-stacked">'; |
216 | 216 | if ($show_create_link) { |
217 | - $html .= '<li class="add-course"><a href="' . api_get_path(WEB_CODE_PATH) . 'create_course/add_course.php">'. |
|
218 | - Display::return_icon('new-course.png', get_lang('CourseCreate')).(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>'; |
|
217 | + $html .= '<li class="add-course"><a href="'.api_get_path(WEB_CODE_PATH).'create_course/add_course.php">'. |
|
218 | + Display::return_icon('new-course.png', get_lang('CourseCreate')).(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>'; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | if ($show_course_link) { |
222 | 222 | if (!api_is_drh() && !api_is_session_admin()) { |
223 | - $html .= '<li class="list-course"><a href="'. api_get_path(WEB_CODE_PATH) . 'auth/courses.php">'. |
|
224 | - Display::return_icon('catalog-course.png', get_lang('CourseCatalog')) .get_lang('CourseCatalog').'</a></li>'; |
|
223 | + $html .= '<li class="list-course"><a href="'.api_get_path(WEB_CODE_PATH).'auth/courses.php">'. |
|
224 | + Display::return_icon('catalog-course.png', get_lang('CourseCatalog')).get_lang('CourseCatalog').'</a></li>'; |
|
225 | 225 | } else { |
226 | - $html .= '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'dashboard/index.php">'.get_lang('Dashboard').'</a></li>'; |
|
226 | + $html .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'dashboard/index.php">'.get_lang('Dashboard').'</a></li>'; |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | $html .= '</ul>'; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | // Including the page for the news |
254 | 254 | $html = ''; |
255 | 255 | if (!empty($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/', $_GET['include'])) { |
256 | - $open = @(string)file_get_contents($this->home.$_GET['include']); |
|
256 | + $open = @(string) file_get_contents($this->home.$_GET['include']); |
|
257 | 257 | $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
258 | 258 | } else { |
259 | 259 | // Hiding home top when user not connected. |
@@ -283,15 +283,15 @@ discard block |
||
283 | 283 | $home_top_temp = file_get_contents($this->home.'home_top.html'); |
284 | 284 | } else { |
285 | 285 | if (file_exists($this->default_home.'home_top.html')) { |
286 | - $home_top_temp = file_get_contents($this->default_home . 'home_top.html'); |
|
286 | + $home_top_temp = file_get_contents($this->default_home.'home_top.html'); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | } |
290 | 290 | |
291 | 291 | if (trim($home_top_temp) == '' && api_is_platform_admin()) { |
292 | - $home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>'; |
|
292 | + $home_top_temp = '<div class="welcome-mascot">'.get_lang('PortalHomepageDefaultIntroduction').'</div>'; |
|
293 | 293 | } else { |
294 | - $home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>'; |
|
294 | + $home_top_temp = '<div class="welcome-home-top-temp">'.$home_top_temp.'</div>'; |
|
295 | 295 | } |
296 | 296 | $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp); |
297 | 297 | $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | |
310 | 310 | $html = ''; |
311 | 311 | // Notice |
312 | - $home_notice = @(string)file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html'); |
|
312 | + $home_notice = @(string) file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html'); |
|
313 | 313 | if (empty($home_notice)) { |
314 | - $home_notice = @(string)file_get_contents($this->home.'home_notice.html'); |
|
314 | + $home_notice = @(string) file_get_contents($this->home.'home_notice.html'); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | if (!empty($home_notice)) { |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | $html = ''; |
347 | - $home_menu = @(string)file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html'); |
|
347 | + $home_menu = @(string) file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html'); |
|
348 | 348 | if (!empty($home_menu)) { |
349 | 349 | $home_menu_content = '<ul class="nav nav-pills nav-stacked">'; |
350 | 350 | $home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu))); |
@@ -395,9 +395,9 @@ discard block |
||
395 | 395 | if (api_get_setting('allow_public_certificates') == 'true') { |
396 | 396 | $searchItem = Display::tag( |
397 | 397 | 'li', |
398 | - Display::url(Display::return_icon('search_graduation.png',get_lang('Search'),null,ICON_SIZE_SMALL). |
|
398 | + Display::url(Display::return_icon('search_graduation.png', get_lang('Search'), null, ICON_SIZE_SMALL). |
|
399 | 399 | get_lang('Search'), |
400 | - api_get_path(WEB_CODE_PATH) . "gradebook/search.php" |
|
400 | + api_get_path(WEB_CODE_PATH)."gradebook/search.php" |
|
401 | 401 | ) |
402 | 402 | ); |
403 | 403 | } |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $content .= Display::tag( |
414 | 414 | 'li', |
415 | 415 | Display::url( |
416 | - Display::return_icon('skill-badges.png',get_lang('MySkills'),null,ICON_SIZE_SMALL).get_lang('MySkills'), |
|
416 | + Display::return_icon('skill-badges.png', get_lang('MySkills'), null, ICON_SIZE_SMALL).get_lang('MySkills'), |
|
417 | 417 | api_get_path(WEB_CODE_PATH).'social/my_skills_report.php' |
418 | 418 | ) |
419 | 419 | ); |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | if (($allowSkillsManagement && api_is_drh()) || api_is_platform_admin()) { |
422 | 422 | $content .= Display::tag('li', |
423 | 423 | Display::url(Display::return_icon('edit-skill.png', get_lang('MySkills'), null, |
424 | - ICON_SIZE_SMALL) . get_lang('ManageSkills'), |
|
425 | - api_get_path(WEB_CODE_PATH) . 'admin/skills_wheel.php')); |
|
424 | + ICON_SIZE_SMALL).get_lang('ManageSkills'), |
|
425 | + api_get_path(WEB_CODE_PATH).'admin/skills_wheel.php')); |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | |
476 | 476 | // Get list of courses in category $category. |
477 | 477 | $sql = "SELECT * FROM $main_course_table cours |
478 | - WHERE category_code = '" . $category . "' |
|
478 | + WHERE category_code = '".$category."' |
|
479 | 479 | ORDER BY title, UPPER(visual_code)"; |
480 | 480 | |
481 | 481 | // Showing only the courses of the current access_url_id. |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | FROM $main_category_table t1 |
522 | 522 | LEFT JOIN $main_category_table t2 ON t1.code=t2.parent_id |
523 | 523 | LEFT JOIN $main_course_table t3 ON (t3.category_code = t1.code $platform_visible_courses) |
524 | - WHERE t1.parent_id ". (empty($category) ? "IS NULL" : "='$category'")." |
|
524 | + WHERE t1.parent_id ".(empty($category) ? "IS NULL" : "='$category'")." |
|
525 | 525 | GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count |
526 | 526 | ORDER BY t1.tree_pos, t1.name"; |
527 | 527 | |
@@ -596,10 +596,10 @@ discard block |
||
596 | 596 | } |
597 | 597 | $result .= $htmlTitre; |
598 | 598 | if ($thereIsSubCat) { |
599 | - $result .= $htmlListCat; |
|
599 | + $result .= $htmlListCat; |
|
600 | 600 | } |
601 | 601 | while ($categoryName = Database::fetch_array($resCats)) { |
602 | - $result .= '<h3>' . $categoryName['name'] . "</h3>\n"; |
|
602 | + $result .= '<h3>'.$categoryName['name']."</h3>\n"; |
|
603 | 603 | } |
604 | 604 | $numrows = Database::num_rows($sql_result_courses); |
605 | 605 | $courses_list_string = ''; |
@@ -697,12 +697,12 @@ discard block |
||
697 | 697 | if ($courses_shown > 0) { |
698 | 698 | // Only display the list of courses and categories if there was more than |
699 | 699 | // 0 courses visible to the world (we're in the anonymous list here). |
700 | - $result .= $courses_list_string; |
|
700 | + $result .= $courses_list_string; |
|
701 | 701 | } |
702 | 702 | if ($category != '') { |
703 | - $result .= '<p><a href="'.api_get_self().'"> ' . |
|
703 | + $result .= '<p><a href="'.api_get_self().'"> '. |
|
704 | 704 | Display :: return_icon('back.png', get_lang('BackToHomePage')). |
705 | - get_lang('BackToHomePage') . '</a></p>'; |
|
705 | + get_lang('BackToHomePage').'</a></p>'; |
|
706 | 706 | } |
707 | 707 | return $result; |
708 | 708 | } |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | if (!empty($title)) { |
798 | 798 | $html .= '<div class="panel-heading">'.$title.'</div>'; |
799 | 799 | } |
800 | - $html.= '<div class="panel-body">'.$content.'</div>'; |
|
800 | + $html .= '<div class="panel-body">'.$content.'</div>'; |
|
801 | 801 | $html = Display::div($html, $params); |
802 | 802 | } |
803 | 803 | |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | $usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id()); |
845 | 845 | $classes = ''; |
846 | 846 | if (!empty($usergroup_list)) { |
847 | - foreach($usergroup_list as $group_id) { |
|
847 | + foreach ($usergroup_list as $group_id) { |
|
848 | 848 | $data = $usergroup->get($group_id); |
849 | 849 | $data['name'] = Display::url($data['name'], api_get_path(WEB_CODE_PATH).'user/classes.php?id='.$data['id']); |
850 | 850 | $classes .= Display::tag('li', $data['name']); |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | if (api_is_platform_admin()) { |
854 | 854 | $classes .= Display::tag( |
855 | 855 | 'li', |
856 | - Display::url(get_lang('AddClasses') ,api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add') |
|
856 | + Display::url(get_lang('AddClasses'), api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add') |
|
857 | 857 | ); |
858 | 858 | } |
859 | 859 | if (!empty($classes)) { |
@@ -875,11 +875,11 @@ discard block |
||
875 | 875 | $content = null; |
876 | 876 | |
877 | 877 | if (api_get_setting('allow_social_tool') == 'true') { |
878 | - $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/social/home.php"> |
|
879 | - <img class="img-circle" src="' . $userPicture . '" ></a>'; |
|
878 | + $content .= '<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/social/home.php"> |
|
879 | + <img class="img-circle" src="' . $userPicture.'" ></a>'; |
|
880 | 880 | } else { |
881 | - $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/auth/profile.php"> |
|
882 | - <img class="img-circle" title="' . get_lang('EditProfile') . '" src="' . $userPicture. '" ></a>'; |
|
881 | + $content .= '<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/auth/profile.php"> |
|
882 | + <img class="img-circle" title="' . get_lang('EditProfile').'" src="'.$userPicture.'" ></a>'; |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | $html = self::show_right_block( |
@@ -932,18 +932,18 @@ discard block |
||
932 | 932 | $link = '?f=social'; |
933 | 933 | } |
934 | 934 | $profile_content .= '<li class="inbox-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'. |
935 | - Display::return_icon('inbox.png',get_lang('Inbox'),null,ICON_SIZE_SMALL).get_lang('Inbox').$cant_msg.' </a></li>'; |
|
935 | + Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_SMALL).get_lang('Inbox').$cant_msg.' </a></li>'; |
|
936 | 936 | $profile_content .= '<li class="new-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'. |
937 | - Display::return_icon('new-message.png',get_lang('Compose'),null,ICON_SIZE_SMALL).get_lang('Compose').' </a></li>'; |
|
937 | + Display::return_icon('new-message.png', get_lang('Compose'), null, ICON_SIZE_SMALL).get_lang('Compose').' </a></li>'; |
|
938 | 938 | |
939 | 939 | if (api_get_setting('allow_social_tool') == 'true') { |
940 | 940 | $total_invitations = Display::badge($total_invitations); |
941 | - $profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitations.png',get_lang('PendingInvitations'),null,ICON_SIZE_SMALL).get_lang('PendingInvitations').$total_invitations.'</a></li>'; |
|
941 | + $profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitations.png', get_lang('PendingInvitations'), null, ICON_SIZE_SMALL).get_lang('PendingInvitations').$total_invitations.'</a></li>'; |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) { |
945 | 945 | $myFiles = '<li class="myfiles-social"><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'. |
946 | - Display::return_icon('sn-files.png',get_lang('Files'),null,ICON_SIZE_SMALL).get_lang('MyFiles').'</a></li>'; |
|
946 | + Display::return_icon('sn-files.png', get_lang('Files'), null, ICON_SIZE_SMALL).get_lang('MyFiles').'</a></li>'; |
|
947 | 947 | |
948 | 948 | if (api_get_setting('allow_my_files') === 'false') { |
949 | 949 | $myFiles = ''; |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | |
956 | 956 | $editProfileUrl = Display::getProfileEditionLink($user_id); |
957 | 957 | |
958 | - $profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">'. |
|
958 | + $profile_content .= '<li class="profile-social"><a href="'.$editProfileUrl.'">'. |
|
959 | 959 | Display::return_icon( |
960 | 960 | 'edit-profile.png', |
961 | 961 | get_lang('EditProfile'), |
@@ -1045,17 +1045,17 @@ discard block |
||
1045 | 1045 | if ($show_create_link) { |
1046 | 1046 | $my_account_content .= '<li class="add-course"><a href="main/create_course/add_course.php">'; |
1047 | 1047 | if (api_get_setting('course_validation') == 'true' && !api_is_platform_admin()) { |
1048 | - $my_account_content .= Display::return_icon('new-course.png',get_lang('CreateCourseRequest'),null,ICON_SIZE_SMALL); |
|
1048 | + $my_account_content .= Display::return_icon('new-course.png', get_lang('CreateCourseRequest'), null, ICON_SIZE_SMALL); |
|
1049 | 1049 | $my_account_content .= get_lang('CreateCourseRequest'); |
1050 | 1050 | } else { |
1051 | - $my_account_content .= Display::return_icon('new-course.png',get_lang('CourseCreate'),null,ICON_SIZE_SMALL); |
|
1051 | + $my_account_content .= Display::return_icon('new-course.png', get_lang('CourseCreate'), null, ICON_SIZE_SMALL); |
|
1052 | 1052 | $my_account_content .= get_lang('CourseCreate'); |
1053 | 1053 | } |
1054 | 1054 | $my_account_content .= '</a></li>'; |
1055 | 1055 | |
1056 | 1056 | if (SessionManager::allowToManageSessions()) { |
1057 | 1057 | $my_account_content .= '<li class="add-course"><a href="main/session/session_add.php">'; |
1058 | - $my_account_content .= Display::return_icon('session.png',get_lang('AddSession'),null,ICON_SIZE_SMALL); |
|
1058 | + $my_account_content .= Display::return_icon('session.png', get_lang('AddSession'), null, ICON_SIZE_SMALL); |
|
1059 | 1059 | $my_account_content .= get_lang('AddSession'); |
1060 | 1060 | $my_account_content .= '</a></li>'; |
1061 | 1061 | } |
@@ -1063,20 +1063,20 @@ discard block |
||
1063 | 1063 | |
1064 | 1064 | //Sort courses |
1065 | 1065 | $url = api_get_path(WEB_CODE_PATH).'auth/courses.php?action=sortmycourses'; |
1066 | - $img_order= Display::return_icon('order-course.png',get_lang('SortMyCourses'),null,ICON_SIZE_SMALL); |
|
1066 | + $img_order = Display::return_icon('order-course.png', get_lang('SortMyCourses'), null, ICON_SIZE_SMALL); |
|
1067 | 1067 | $my_account_content .= '<li class="order-course">'.Display::url($img_order.get_lang('SortMyCourses'), $url, array('class' => 'sort course')).'</li>'; |
1068 | 1068 | |
1069 | 1069 | // Session history |
1070 | 1070 | if (isset($_GET['history']) && intval($_GET['history']) == 1) { |
1071 | - $my_account_content .= '<li class="history-course"><a href="user_portal.php">'.Display::return_icon('history-course.png',get_lang('DisplayTrainingList'),null,ICON_SIZE_SMALL).get_lang('DisplayTrainingList').'</a></li>'; |
|
1071 | + $my_account_content .= '<li class="history-course"><a href="user_portal.php">'.Display::return_icon('history-course.png', get_lang('DisplayTrainingList'), null, ICON_SIZE_SMALL).get_lang('DisplayTrainingList').'</a></li>'; |
|
1072 | 1072 | } else { |
1073 | - $my_account_content .= '<li class="history-course"><a href="user_portal.php?history=1" >'.Display::return_icon('history-course.png',get_lang('HistoryTrainingSessions'),null,ICON_SIZE_SMALL).get_lang('HistoryTrainingSessions').'</a></li>'; |
|
1073 | + $my_account_content .= '<li class="history-course"><a href="user_portal.php?history=1" >'.Display::return_icon('history-course.png', get_lang('HistoryTrainingSessions'), null, ICON_SIZE_SMALL).get_lang('HistoryTrainingSessions').'</a></li>'; |
|
1074 | 1074 | } |
1075 | 1075 | |
1076 | 1076 | // Course catalog |
1077 | 1077 | if ($show_course_link) { |
1078 | 1078 | if (!api_is_drh()) { |
1079 | - $my_account_content .= '<li class="list-course"><a href="main/auth/courses.php" >'.Display::return_icon('catalog-course.png',get_lang('CourseCatalog'),null,ICON_SIZE_SMALL).get_lang('CourseCatalog').'</a></li>'; |
|
1079 | + $my_account_content .= '<li class="list-course"><a href="main/auth/courses.php" >'.Display::return_icon('catalog-course.png', get_lang('CourseCatalog'), null, ICON_SIZE_SMALL).get_lang('CourseCatalog').'</a></li>'; |
|
1080 | 1080 | } else { |
1081 | 1081 | $my_account_content .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>'; |
1082 | 1082 | } |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | |
1276 | 1276 | $actions = null; |
1277 | 1277 | if (api_is_platform_admin()) { |
1278 | - $actions = api_get_path(WEB_CODE_PATH) .'session/resume_session.php?id_session='.$session_id; |
|
1278 | + $actions = api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$session_id; |
|
1279 | 1279 | } |
1280 | 1280 | |
1281 | 1281 | $coachId = $session_box['id_coach']; |
@@ -1285,12 +1285,12 @@ discard block |
||
1285 | 1285 | $params['category_id'] = $session_box['category_id']; |
1286 | 1286 | $params['title'] = $session_box['title']; |
1287 | 1287 | $params['id_coach'] = $coachId; |
1288 | - $params['coach_url'] = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $coachId; |
|
1288 | + $params['coach_url'] = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$coachId; |
|
1289 | 1289 | $params['coach_name'] = !empty($session_box['coach']) ? $session_box['coach'] : null; |
1290 | 1290 | $params['coach_avatar'] = UserManager::getUserPicture($coachId, USER_IMAGE_SIZE_SMALL); |
1291 | 1291 | $params['date'] = $session_box['dates']; |
1292 | 1292 | $params['image'] = isset($imageField['value']) ? $imageField['value'] : null; |
1293 | - $params['duration'] = isset($session_box['duration']) ? ' ' . $session_box['duration'] : null; |
|
1293 | + $params['duration'] = isset($session_box['duration']) ? ' '.$session_box['duration'] : null; |
|
1294 | 1294 | $params['edit_actions'] = $actions; |
1295 | 1295 | $params['show_description'] = $session_box['show_description']; |
1296 | 1296 | $params['description'] = $session_box['description']; |
@@ -1386,7 +1386,7 @@ discard block |
||
1386 | 1386 | $sessionParams[0]['date'] = $session_box['dates']; |
1387 | 1387 | $sessionParams[0]['course_list_session_style'] = $coursesListSessionStyle; |
1388 | 1388 | $sessionParams[0]['title'] = $session_box['title']; |
1389 | - $sessionParams[0]['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'] . ' | ': '') . $session_box['dates']; |
|
1389 | + $sessionParams[0]['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'].' | ' : '').$session_box['dates']; |
|
1390 | 1390 | $sessionParams[0]['show_actions'] = api_is_platform_admin(); |
1391 | 1391 | $sessionParams[0]['courses'] = $html_courses_session; |
1392 | 1392 | $sessionParams[0]['show_simple_session_info'] = false; |
@@ -1430,13 +1430,13 @@ discard block |
||
1430 | 1430 | if ( |
1431 | 1431 | !empty($session_category_start_date) |
1432 | 1432 | ) { |
1433 | - $categoryParams['subtitle'] = get_lang('From') . ' ' . $session_category_start_date; |
|
1433 | + $categoryParams['subtitle'] = get_lang('From').' '.$session_category_start_date; |
|
1434 | 1434 | } |
1435 | 1435 | |
1436 | 1436 | if ( |
1437 | 1437 | !empty($session_category_end_date) |
1438 | 1438 | ) { |
1439 | - $categoryParams['subtitle'] = get_lang('Until') . ' ' . $session_category_end_date; |
|
1439 | + $categoryParams['subtitle'] = get_lang('Until').' '.$session_category_end_date; |
|
1440 | 1440 | } |
1441 | 1441 | } |
1442 | 1442 | |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | |
1462 | 1462 | $this->tpl->assign('all_courses', $allCoursesInSessions); |
1463 | 1463 | $this->tpl->assign('session', $listSession); |
1464 | - $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false)); |
|
1464 | + $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); |
|
1465 | 1465 | $this->tpl->assign('gamification_mode', $gamificationModeIsActive); |
1466 | 1466 | |
1467 | 1467 | if (api_get_configuration_value('view_grid_courses')) { |
@@ -1476,7 +1476,7 @@ discard block |
||
1476 | 1476 | } |
1477 | 1477 | |
1478 | 1478 | return [ |
1479 | - 'html' => $specialCourseList . $sessions_with_category.$sessions_with_no_category.$listCourse, |
|
1479 | + 'html' => $specialCourseList.$sessions_with_category.$sessions_with_no_category.$listCourse, |
|
1480 | 1480 | 'session_count' => $sessionCount, |
1481 | 1481 | 'course_count' => $courseCount |
1482 | 1482 | ]; |
@@ -1623,7 +1623,7 @@ discard block |
||
1623 | 1623 | $htmlCategory .= '<div class="panel panel-default">'; |
1624 | 1624 | } |
1625 | 1625 | $htmlCategory .= '<div class="panel-body">'; |
1626 | - $coursesInfo = $listCourse['course']; |
|
1626 | + $coursesInfo = $listCourse['course']; |
|
1627 | 1627 | |
1628 | 1628 | $htmlCategory .= self::getHtmlForCourse( |
1629 | 1629 | $coursesInfo, |
@@ -1640,7 +1640,7 @@ discard block |
||
1640 | 1640 | $listCategorySession['catSessionName'] |
1641 | 1641 | ); |
1642 | 1642 | // list of session |
1643 | - $htmlSession = ''; // start |
|
1643 | + $htmlSession = ''; // start |
|
1644 | 1644 | foreach ($listCategorySession['sessionList'] as $k => $listSession) { |
1645 | 1645 | // add session |
1646 | 1646 | $htmlSession .= '<div class="session-view-row">'; |
@@ -1657,8 +1657,8 @@ discard block |
||
1657 | 1657 | $htmlSessionCategory .= $htmlSession; |
1658 | 1658 | } |
1659 | 1659 | $htmlSessionCategory .= '</div>'; // end session cat block |
1660 | - $htmlCategory .= $htmlSessionCategory .'</div></div>' ; |
|
1661 | - $htmlCategory .= ''; // end course block |
|
1660 | + $htmlCategory .= $htmlSessionCategory.'</div></div>'; |
|
1661 | + $htmlCategory .= ''; // end course block |
|
1662 | 1662 | } |
1663 | 1663 | $userCategoryHtml .= $htmlCategory; |
1664 | 1664 | } |
@@ -1685,11 +1685,11 @@ discard block |
||
1685 | 1685 | } |
1686 | 1686 | } |
1687 | 1687 | $htmlCategory .= ''; |
1688 | - $userCategoryHtml .= $htmlCategory; // end user cat block |
|
1688 | + $userCategoryHtml .= $htmlCategory; // end user cat block |
|
1689 | 1689 | if ($userCategoryId != 0) { |
1690 | 1690 | $userCategoryHtml .= '</div>'; |
1691 | 1691 | } |
1692 | - $html .= $userCategoryHtml; // |
|
1692 | + $html .= $userCategoryHtml; // |
|
1693 | 1693 | } |
1694 | 1694 | $html .= '</div>'; |
1695 | 1695 | |
@@ -1830,11 +1830,11 @@ discard block |
||
1830 | 1830 | $html = ''; |
1831 | 1831 | |
1832 | 1832 | if ($categorySessionId == 0) { |
1833 | - $class1 = 'session-view-lvl-2'; // session |
|
1834 | - $class2 = 'session-view-lvl-4'; // got to course in session link |
|
1833 | + $class1 = 'session-view-lvl-2'; // session |
|
1834 | + $class2 = 'session-view-lvl-4'; // got to course in session link |
|
1835 | 1835 | } else { |
1836 | - $class1 = 'session-view-lvl-3'; // session |
|
1837 | - $class2 = 'session-view-lvl-5'; // got to course in session link |
|
1836 | + $class1 = 'session-view-lvl-3'; // session |
|
1837 | + $class2 = 'session-view-lvl-5'; // got to course in session link |
|
1838 | 1838 | } |
1839 | 1839 | |
1840 | 1840 | $icon = Display::return_icon( |
@@ -1862,7 +1862,7 @@ discard block |
||
1862 | 1862 | if ($listA['userCatTitle'] == $listB['userCatTitle']) { |
1863 | 1863 | if ($listA['title'] == $listB['title']) { |
1864 | 1864 | return 0; |
1865 | - } else if($listA['title'] > $listB['title']) { |
|
1865 | + } else if ($listA['title'] > $listB['title']) { |
|
1866 | 1866 | return 1; |
1867 | 1867 | } else { |
1868 | 1868 | return -1; |
@@ -1883,7 +1883,7 @@ discard block |
||
1883 | 1883 | { |
1884 | 1884 | if ($listA['title'] == $listB['title']) { |
1885 | 1885 | return 0; |
1886 | - } else if($listA['title'] > $listB['title']) { |
|
1886 | + } else if ($listA['title'] > $listB['title']) { |
|
1887 | 1887 | return 1; |
1888 | 1888 | } else { |
1889 | 1889 | return -1; |
@@ -73,8 +73,9 @@ |
||
73 | 73 | //$form->addElement('submit','submit',get_lang('Filter')); |
74 | 74 | $form->addButtonFilter(get_lang('Filter')); |
75 | 75 | |
76 | -if (!empty($_REQUEST['course_code'])) |
|
76 | +if (!empty($_REQUEST['course_code'])) { |
|
77 | 77 | $selected_course = $_REQUEST['course_code']; |
78 | +} |
|
78 | 79 | if (!empty($selected_course)) { |
79 | 80 | $selected_course = api_get_course_info($selected_course); |
80 | 81 | $course_list = array($selected_course); |
@@ -16,34 +16,34 @@ discard block |
||
16 | 16 | $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin; |
17 | 17 | |
18 | 18 | if (!$is_allowedToTrack) { |
19 | - Display :: display_header(null); |
|
20 | - api_not_allowed(); |
|
21 | - Display :: display_footer(); |
|
19 | + Display :: display_header(null); |
|
20 | + api_not_allowed(); |
|
21 | + Display :: display_footer(); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | $export_to_csv = false; |
25 | 25 | if (isset($_GET['export'])) { |
26 | - $export_to_csv = true; |
|
26 | + $export_to_csv = true; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | if (api_is_platform_admin() ) { |
30 | - $global = true; |
|
30 | + $global = true; |
|
31 | 31 | } else { |
32 | - $global = false; |
|
32 | + $global = false; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | if ($global) { |
36 | - $temp_course_list = CourseManager :: get_courses_list(); |
|
37 | - foreach($temp_course_list as $temp_course_item) { |
|
38 | - $course_item = CourseManager ::get_course_information($temp_course_item['code']); |
|
36 | + $temp_course_list = CourseManager :: get_courses_list(); |
|
37 | + foreach($temp_course_list as $temp_course_item) { |
|
38 | + $course_item = CourseManager ::get_course_information($temp_course_item['code']); |
|
39 | 39 | $course_list[] = array( |
40 | 40 | 'code' => $course_item['code'], |
41 | 41 | 'title' => $course_item['title'], |
42 | 42 | ); |
43 | - } |
|
43 | + } |
|
44 | 44 | } else { |
45 | 45 | $current_course['code'] = $_course['id']; |
46 | - $course_list = array($current_course); |
|
46 | + $course_list = array($current_course); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $new_course_select = array(); |
@@ -54,20 +54,20 @@ discard block |
||
54 | 54 | $form = new FormValidator('search_simple', 'POST', '', '', null, false); |
55 | 55 | $form->addElement('select','course_code',get_lang('Course'), $new_course_select); |
56 | 56 | if ($global) { |
57 | - $form->addElement('hidden','view','admin'); |
|
57 | + $form->addElement('hidden','view','admin'); |
|
58 | 58 | } else { |
59 | - //Get exam lists |
|
59 | + //Get exam lists |
|
60 | 60 | $course_id = api_get_course_int_id(); |
61 | - $t_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
62 | - $sqlExercices = "SELECT quiz.title,id FROM ".$t_quiz." AS quiz |
|
61 | + $t_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
62 | + $sqlExercices = "SELECT quiz.title,id FROM ".$t_quiz." AS quiz |
|
63 | 63 | WHERE c_id = $course_id AND active='1' |
64 | 64 | ORDER BY quiz.title ASC"; |
65 | - $resultExercices = Database::query($sqlExercices); |
|
66 | - $exercise_list[0] = get_lang('All'); |
|
67 | - while($a_exercices = Database::fetch_array($resultExercices)) { |
|
68 | - $exercise_list[$a_exercices['id']] = $a_exercices['title']; |
|
69 | - } |
|
70 | - $form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list); |
|
65 | + $resultExercices = Database::query($sqlExercices); |
|
66 | + $exercise_list[0] = get_lang('All'); |
|
67 | + while($a_exercices = Database::fetch_array($resultExercices)) { |
|
68 | + $exercise_list[$a_exercices['id']] = $a_exercices['title']; |
|
69 | + } |
|
70 | + $form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | //$form->addElement('submit','submit',get_lang('Filter')); |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | if (!$export_to_csv) { |
84 | - Display :: display_header(get_lang('Reporting')); |
|
85 | - echo '<div class="actions" style ="font-size:10pt;">'; |
|
86 | - if ($global) { |
|
84 | + Display :: display_header(get_lang('Reporting')); |
|
85 | + echo '<div class="actions" style ="font-size:10pt;">'; |
|
86 | + if ($global) { |
|
87 | 87 | |
88 | 88 | echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'"> |
89 | 89 | '.Display::return_icon('csv.gif').' |
@@ -93,81 +93,81 @@ discard block |
||
93 | 93 | '.get_lang('Print').'</a> |
94 | 94 | </div>'; |
95 | 95 | |
96 | - $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>'; |
|
96 | + $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>'; |
|
97 | 97 | if (api_is_platform_admin()) { |
98 | - $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>'; |
|
98 | + $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>'; |
|
99 | 99 | } else { |
100 | 100 | $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=coach">'.get_lang('AdminInterface').'</a>'; |
101 | 101 | } |
102 | - $menu_items[] = get_lang('ExamTracking'); |
|
103 | - $nb_menu_items = count($menu_items); |
|
104 | - if($nb_menu_items>1) { |
|
105 | - foreach($menu_items as $key=> $item) { |
|
106 | - echo $item; |
|
107 | - if($key!=$nb_menu_items-1) { |
|
108 | - echo ' | '; |
|
109 | - } |
|
110 | - } |
|
111 | - echo '<br />'; |
|
112 | - } |
|
113 | - } else { |
|
114 | - echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a> | |
|
102 | + $menu_items[] = get_lang('ExamTracking'); |
|
103 | + $nb_menu_items = count($menu_items); |
|
104 | + if($nb_menu_items>1) { |
|
105 | + foreach($menu_items as $key=> $item) { |
|
106 | + echo $item; |
|
107 | + if($key!=$nb_menu_items-1) { |
|
108 | + echo ' | '; |
|
109 | + } |
|
110 | + } |
|
111 | + echo '<br />'; |
|
112 | + } |
|
113 | + } else { |
|
114 | + echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a> | |
|
115 | 115 | <a href="courseLog.php?'.api_get_cidreq().'&studentlist=false">'.get_lang('CourseTracking').'</a> | '; |
116 | 116 | echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=resources">'.get_lang('ResourcesTracking').'</a>'; |
117 | - echo ' | '.get_lang('ExamTracking').''; |
|
117 | + echo ' | '.get_lang('ExamTracking').''; |
|
118 | 118 | echo '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'"> |
119 | 119 | '.Display::return_icon('excel.gif').' |
120 | 120 | '.get_lang('ExportAsXLS').'</a><br /><br />'; |
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | echo '</div>'; |
124 | - echo '<br /><br />'; |
|
125 | - $form->display(); |
|
124 | + echo '<br /><br />'; |
|
125 | + $form->display(); |
|
126 | 126 | } |
127 | 127 | $main_result = array(); |
128 | 128 | $session_id = 0; |
129 | 129 | $user_list = array(); |
130 | 130 | // Getting course list |
131 | 131 | foreach ($course_list as $current_course ) { |
132 | - $course_info = api_get_course_info($current_course['code']); |
|
133 | - $_course = $course_info; |
|
134 | - |
|
135 | - // Getting LP list |
|
136 | - $list = new LearnpathList('', $current_course['code'], $session_id); |
|
137 | - $lp_list = $list->get_flat_list(); |
|
138 | - |
|
139 | - // Looping LPs |
|
140 | - $lps = array(); |
|
141 | - foreach ($lp_list as $lp_id =>$lp) { |
|
142 | - $exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']); |
|
143 | - $attempt_result = array(); |
|
144 | - // Looping Chamilo Exercises in LP |
|
145 | - foreach ($exercise_list as $exercise) { |
|
146 | - $exercise_stats = Event::get_all_exercise_event_from_lp( |
|
147 | - $exercise['path'], |
|
148 | - $course_info['real_id'], |
|
149 | - $session_id |
|
150 | - ); |
|
151 | - // Looping Exercise Attempts |
|
152 | - foreach ($exercise_stats as $stats) { |
|
153 | - $attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats; |
|
154 | - $user_list[$stats['exe_user_id']] = $stats['exe_user_id']; |
|
155 | - } |
|
156 | - $exercise_list_name[$exercise['id']] = $exercise['title']; |
|
157 | - } |
|
158 | - $lps[$lp_id] = array('lp_name' =>$lp['lp_name'], 'exercises' =>$attempt_result); |
|
159 | - $lp_list_name[$lp_id] = $lp['lp_name']; |
|
160 | - } |
|
161 | - $main_result[$current_course['code']] = $lps; |
|
132 | + $course_info = api_get_course_info($current_course['code']); |
|
133 | + $_course = $course_info; |
|
134 | + |
|
135 | + // Getting LP list |
|
136 | + $list = new LearnpathList('', $current_course['code'], $session_id); |
|
137 | + $lp_list = $list->get_flat_list(); |
|
138 | + |
|
139 | + // Looping LPs |
|
140 | + $lps = array(); |
|
141 | + foreach ($lp_list as $lp_id =>$lp) { |
|
142 | + $exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']); |
|
143 | + $attempt_result = array(); |
|
144 | + // Looping Chamilo Exercises in LP |
|
145 | + foreach ($exercise_list as $exercise) { |
|
146 | + $exercise_stats = Event::get_all_exercise_event_from_lp( |
|
147 | + $exercise['path'], |
|
148 | + $course_info['real_id'], |
|
149 | + $session_id |
|
150 | + ); |
|
151 | + // Looping Exercise Attempts |
|
152 | + foreach ($exercise_stats as $stats) { |
|
153 | + $attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats; |
|
154 | + $user_list[$stats['exe_user_id']] = $stats['exe_user_id']; |
|
155 | + } |
|
156 | + $exercise_list_name[$exercise['id']] = $exercise['title']; |
|
157 | + } |
|
158 | + $lps[$lp_id] = array('lp_name' =>$lp['lp_name'], 'exercises' =>$attempt_result); |
|
159 | + $lp_list_name[$lp_id] = $lp['lp_name']; |
|
160 | + } |
|
161 | + $main_result[$current_course['code']] = $lps; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | if (!empty($user_list)) { |
165 | 165 | foreach($user_list as $user_id) { |
166 | 166 | $user_data = api_get_user_info($user_id); |
167 | - $user_list_name[$user_id] = api_get_person_name( |
|
168 | - $user_data['firstname'], |
|
169 | - $user_data['lastname'] |
|
170 | - ); |
|
167 | + $user_list_name[$user_id] = api_get_person_name( |
|
168 | + $user_data['firstname'], |
|
169 | + $user_data['lastname'] |
|
170 | + ); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | $export_array = array(); |
@@ -207,15 +207,15 @@ discard block |
||
207 | 207 | $html_result .= Display::tag('td', $result); |
208 | 208 | |
209 | 209 | $html_result .= '</tr>'; |
210 | - $export_array[] = array( |
|
211 | - $course_code, |
|
212 | - $lp_list_name[$lp_id], |
|
213 | - $exercise_list_name[$exercise_id], |
|
214 | - $user_list_name[$user_id], |
|
215 | - $attempt, |
|
216 | - api_get_local_time($attempt_data['exe_date']), |
|
217 | - $result, |
|
218 | - ); |
|
210 | + $export_array[] = array( |
|
211 | + $course_code, |
|
212 | + $lp_list_name[$lp_id], |
|
213 | + $exercise_list_name[$exercise_id], |
|
214 | + $user_list_name[$user_id], |
|
215 | + $attempt, |
|
216 | + api_get_local_time($attempt_data['exe_date']), |
|
217 | + $result, |
|
218 | + ); |
|
219 | 219 | $attempt++; |
220 | 220 | } |
221 | 221 | } |
@@ -226,30 +226,30 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | if (!$export_to_csv) { |
229 | - echo $html_result; |
|
229 | + echo $html_result; |
|
230 | 230 | } |
231 | 231 | $filename = 'learning_path_results-'.date('Y-m-d-h:i:s').'.xls'; |
232 | 232 | if ($export_to_csv) { |
233 | 233 | export_complete_report_csv($filename, $export_array); |
234 | - exit; |
|
234 | + exit; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | function export_complete_report_csv($filename, $array) |
238 | 238 | { |
239 | - $header[] = array( |
|
240 | - get_lang('Course'), |
|
241 | - get_lang('LearningPath'), |
|
242 | - get_lang('Exercise'), |
|
243 | - get_lang('User'), |
|
244 | - get_lang('Attempt'), |
|
245 | - get_lang('Date'), |
|
246 | - get_lang('Results'), |
|
247 | - ); |
|
248 | - if (!empty($array)) { |
|
249 | - $array = array_merge($header, $array); |
|
250 | - Export :: arrayToCsv($array, $filename); |
|
251 | - } |
|
252 | - exit; |
|
239 | + $header[] = array( |
|
240 | + get_lang('Course'), |
|
241 | + get_lang('LearningPath'), |
|
242 | + get_lang('Exercise'), |
|
243 | + get_lang('User'), |
|
244 | + get_lang('Attempt'), |
|
245 | + get_lang('Date'), |
|
246 | + get_lang('Results'), |
|
247 | + ); |
|
248 | + if (!empty($array)) { |
|
249 | + $array = array_merge($header, $array); |
|
250 | + Export :: arrayToCsv($array, $filename); |
|
251 | + } |
|
252 | + exit; |
|
253 | 253 | |
254 | 254 | } |
255 | 255 | Display :: display_footer(); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $export_to_csv = true; |
27 | 27 | } |
28 | 28 | |
29 | -if (api_is_platform_admin() ) { |
|
29 | +if (api_is_platform_admin()) { |
|
30 | 30 | $global = true; |
31 | 31 | } else { |
32 | 32 | $global = false; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | if ($global) { |
36 | 36 | $temp_course_list = CourseManager :: get_courses_list(); |
37 | - foreach($temp_course_list as $temp_course_item) { |
|
37 | + foreach ($temp_course_list as $temp_course_item) { |
|
38 | 38 | $course_item = CourseManager ::get_course_information($temp_course_item['code']); |
39 | 39 | $course_list[] = array( |
40 | 40 | 'code' => $course_item['code'], |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | $new_course_select = array(); |
50 | -foreach($course_list as $data) { |
|
50 | +foreach ($course_list as $data) { |
|
51 | 51 | $new_course_select[$data['code']] = $data['title']; |
52 | 52 | } |
53 | 53 | |
54 | 54 | $form = new FormValidator('search_simple', 'POST', '', '', null, false); |
55 | -$form->addElement('select','course_code',get_lang('Course'), $new_course_select); |
|
55 | +$form->addElement('select', 'course_code', get_lang('Course'), $new_course_select); |
|
56 | 56 | if ($global) { |
57 | - $form->addElement('hidden','view','admin'); |
|
57 | + $form->addElement('hidden', 'view', 'admin'); |
|
58 | 58 | } else { |
59 | 59 | //Get exam lists |
60 | 60 | $course_id = api_get_course_int_id(); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | ORDER BY quiz.title ASC"; |
65 | 65 | $resultExercices = Database::query($sqlExercices); |
66 | 66 | $exercise_list[0] = get_lang('All'); |
67 | - while($a_exercices = Database::fetch_array($resultExercices)) { |
|
67 | + while ($a_exercices = Database::fetch_array($resultExercices)) { |
|
68 | 68 | $exercise_list[$a_exercices['id']] = $a_exercices['title']; |
69 | 69 | } |
70 | 70 | $form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'"> |
89 | 89 | '.Display::return_icon('csv.gif').' |
90 | - '.get_lang('ExportAsCSV').'</a>' . |
|
90 | + '.get_lang('ExportAsCSV').'</a>'. |
|
91 | 91 | '<a href="javascript: void(0);" onclick="javascript: window.print()"> |
92 | 92 | '.Display::return_icon('printmgr.gif').' |
93 | 93 | '.get_lang('Print').'</a> |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | } |
102 | 102 | $menu_items[] = get_lang('ExamTracking'); |
103 | 103 | $nb_menu_items = count($menu_items); |
104 | - if($nb_menu_items>1) { |
|
105 | - foreach($menu_items as $key=> $item) { |
|
104 | + if ($nb_menu_items > 1) { |
|
105 | + foreach ($menu_items as $key=> $item) { |
|
106 | 106 | echo $item; |
107 | - if($key!=$nb_menu_items-1) { |
|
107 | + if ($key != $nb_menu_items - 1) { |
|
108 | 108 | echo ' | '; |
109 | 109 | } |
110 | 110 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $session_id = 0; |
129 | 129 | $user_list = array(); |
130 | 130 | // Getting course list |
131 | -foreach ($course_list as $current_course ) { |
|
131 | +foreach ($course_list as $current_course) { |
|
132 | 132 | $course_info = api_get_course_info($current_course['code']); |
133 | 133 | $_course = $course_info; |
134 | 134 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | if (!empty($user_list)) { |
165 | - foreach($user_list as $user_id) { |
|
165 | + foreach ($user_list as $user_id) { |
|
166 | 166 | $user_data = api_get_user_info($user_id); |
167 | 167 | $user_list_name[$user_id] = api_get_person_name( |
168 | 168 | $user_data['firstname'], |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | ); |
171 | 171 | } |
172 | 172 | } |
173 | -$export_array = array(); |
|
173 | +$export_array = array(); |
|
174 | 174 | if (!empty($main_result)) { |
175 | 175 | |
176 | 176 | $html_result .= '<table class="data_table">'; |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | |
194 | 194 | foreach ($exercises as $exercise_id => $exercise_data) { |
195 | 195 | $users = $exercise_data['users']; |
196 | - foreach($users as $user_id => $attempts) { |
|
196 | + foreach ($users as $user_id => $attempts) { |
|
197 | 197 | $attempt = 1; |
198 | - foreach($attempts as $exe_id => $attempt_data) { |
|
198 | + foreach ($attempts as $exe_id => $attempt_data) { |
|
199 | 199 | $html_result .= '<tr colspan="">'; |
200 | 200 | $html_result .= Display::tag('td', $course_code); |
201 | 201 | $html_result .= Display::tag('td', $lp_list_name[$lp_id]); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | } |
224 | 224 | } |
225 | - $html_result .='</table>'; |
|
225 | + $html_result .= '</table>'; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | if (!$export_to_csv) { |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | // check if uid is tutor of this group |
76 | 76 | $courseId = api_get_course_int_id(); |
77 | 77 | |
78 | - if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) { |
|
78 | + if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) { |
|
79 | 79 | if ($is_allowedToTrackEverybodyInCourse) { |
80 | 80 | $sql = "SELECT u.firstname,u.lastname, u.email |
81 | 81 | FROM $TABLECOURSUSER cu , $TABLEUSER u |
82 | 82 | WHERE |
83 | 83 | cu.user_id = u.user_id AND |
84 | - cu.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND |
|
84 | + cu.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND |
|
85 | 85 | cu.c_id = '$courseId' AND |
86 | 86 | u.user_id = '$uInfo'"; |
87 | 87 | } else { |
@@ -97,21 +97,21 @@ discard block |
||
97 | 97 | $res[2] == "" ? $res2 = get_lang('NoEmail') : $res2 = Display::encrypted_mailto_link($res[2]); |
98 | 98 | |
99 | 99 | echo "<tr><td>"; |
100 | - echo $informationsAbout . " : <br>"; |
|
100 | + echo $informationsAbout." : <br>"; |
|
101 | 101 | echo "<ul>\n" |
102 | - . "<li>" . get_lang('FirstName') . " : " . $res[0] . "</li>\n" |
|
103 | - . "<li>" . get_lang('LastName') . " : " . $res[1] . "</li>\n" |
|
104 | - . "<li>" . get_lang('Email') . " : " . $res2 . "</li>\n" |
|
102 | + . "<li>".get_lang('FirstName')." : ".$res[0]."</li>\n" |
|
103 | + . "<li>".get_lang('LastName')." : ".$res[1]."</li>\n" |
|
104 | + . "<li>".get_lang('Email')." : ".$res2."</li>\n" |
|
105 | 105 | . "</ul>"; |
106 | 106 | echo "</td></tr>"; |
107 | 107 | /* * ***** MENU ******* */ |
108 | 108 | echo "<tr> |
109 | 109 | <td> |
110 | - [<a href='userLog.php?uInfo=$uInfo&view=$view'>" . get_lang('Back') . "</a>] |
|
110 | + [<a href='userLog.php?uInfo=$uInfo&view=$view'>".get_lang('Back')."</a>] |
|
111 | 111 | "; |
112 | 112 | echo " || |
113 | - [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$reqdate' class='specialLink'>" . get_lang('PeriodWeek') . "</a>] |
|
114 | - [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$reqdate' class='specialLink'>" . get_lang('PeriodMonth') . "</a>] |
|
113 | + [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodWeek')."</a>] |
|
114 | + [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodMonth')."</a>] |
|
115 | 115 | || |
116 | 116 | "; |
117 | 117 | switch ($period) { |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | $previousReqDate = $reqdate - 7 * 86400; |
121 | 121 | $nextReqDate = $reqdate + 7 * 86400; |
122 | 122 | echo " |
123 | - [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$previousReqDate' class='specialLink'>" . get_lang('PreviousWeek') . "</a>] |
|
124 | - [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$nextReqDate' class='specialLink'>" . get_lang('NextWeek') . "</a>] |
|
123 | + [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$previousReqDate' class='specialLink'>".get_lang('PreviousWeek')."</a>] |
|
124 | + [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$nextReqDate' class='specialLink'>".get_lang('NextWeek')."</a>] |
|
125 | 125 | "; |
126 | 126 | break; |
127 | 127 | default : |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | $previousReqDate = mktime(1, 1, 1, date("m", $reqdate) - 1, 1, date("Y", $reqdate)); |
133 | 133 | $nextReqDate = mktime(1, 1, 1, date("m", $reqdate) + 1, 1, date("Y", $reqdate)); |
134 | 134 | echo " |
135 | - [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$previousReqDate' class='specialLink'>" . get_lang('PreviousMonth') . "</a>] |
|
136 | - [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$nextReqDate' class='specialLink'>" . get_lang('NextMonth') . "</a>] |
|
135 | + [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$previousReqDate' class='specialLink'>".get_lang('PreviousMonth')."</a>] |
|
136 | + [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$nextReqDate' class='specialLink'>".get_lang('NextMonth')."</a>] |
|
137 | 137 | "; |
138 | 138 | break; |
139 | 139 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate')) |
154 | 154 | GROUP BY DAYOFMONTH(access_date) |
155 | 155 | ORDER BY access_date ASC"; |
156 | - $displayedDate = $MonthsLong[date("n", $reqdate) - 1] . date(" Y", $reqdate); |
|
156 | + $displayedDate = $MonthsLong[date("n", $reqdate) - 1].date(" Y", $reqdate); |
|
157 | 157 | break; |
158 | 158 | case "week" : |
159 | 159 | $sql = "SELECT access_date |
@@ -165,24 +165,24 @@ discard block |
||
165 | 165 | GROUP BY DAYOFMONTH(access_date) |
166 | 166 | ORDER BY access_date ASC"; |
167 | 167 | $weeklowreqdate = ($reqdate - (86400 * date("w", $reqdate))); |
168 | - $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate)) )); |
|
169 | - $displayedDate = get_lang('From') . " " . date("d ", $weeklowreqdate) . $MonthsLong[date("n", $weeklowreqdate) - 1] . date(" Y", $weeklowreqdate) |
|
170 | - . " " . get_lang('To') . " " . date("d ", $weekhighreqdate) . $MonthsLong[date("n", $weekhighreqdate) - 1] . date(" Y", $weekhighreqdate); |
|
168 | + $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate)))); |
|
169 | + $displayedDate = get_lang('From')." ".date("d ", $weeklowreqdate).$MonthsLong[date("n", $weeklowreqdate) - 1].date(" Y", $weeklowreqdate) |
|
170 | + . " ".get_lang('To')." ".date("d ", $weekhighreqdate).$MonthsLong[date("n", $weekhighreqdate) - 1].date(" Y", $weekhighreqdate); |
|
171 | 171 | break; |
172 | 172 | } |
173 | 173 | echo "<tr><td>"; |
174 | 174 | $results = StatsUtils::getManyResults1Col($sql); |
175 | 175 | /* * * display of the displayed period ** */ |
176 | 176 | echo "<table width='100%' cellpadding='2' cellspacing='1' border='0' align=center>"; |
177 | - echo "<td bgcolor='#E6E6E6'>" . $displayedDate . "</td>"; |
|
177 | + echo "<td bgcolor='#E6E6E6'>".$displayedDate."</td>"; |
|
178 | 178 | if (is_array($results)) { |
179 | 179 | for ($j = 0; $j < sizeof($results); $j++) { |
180 | 180 | $beautifulDateTime = api_convert_and_format_date($results[$j], null, date_default_timezone_get()); |
181 | 181 | echo "<tr>"; |
182 | - echo "<td style='padding-left : 40px;' valign='top'>" . $beautifulDateTime . "</td>"; |
|
182 | + echo "<td style='padding-left : 40px;' valign='top'>".$beautifulDateTime."</td>"; |
|
183 | 183 | echo"</tr>"; |
184 | 184 | // $limit is used to select only results between $results[$j] (current login) and next one |
185 | - if ($j == ( sizeof($results) - 1 )) |
|
185 | + if ($j == (sizeof($results) - 1)) |
|
186 | 186 | $limit = date("Y-m-d H:i:s", $nextReqDate); |
187 | 187 | else |
188 | 188 | $limit = $results[$j + 1]; |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | FROM $TABLETRACK_ACCESS |
193 | 193 | WHERE access_user_id = $uInfo |
194 | 194 | AND access_tool IS NOT NULL |
195 | - AND access_date > '" . $results[$j] . "' |
|
196 | - AND access_date < '" . $limit . "' |
|
195 | + AND access_date > '".$results[$j]."' |
|
196 | + AND access_date < '" . $limit."' |
|
197 | 197 | AND c_id = $courseId |
198 | 198 | GROUP BY access_tool |
199 | 199 | ORDER BY access_tool ASC"; |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | echo "<table width='50%' cellpadding='0' cellspacing='0' border='0'>\n"; |
205 | 205 | for ($k = 0; $k < count($results2); $k++) { |
206 | 206 | echo "<tr>\n"; |
207 | - echo "<td width='70%' style='padding-left : 60px;'>" . get_lang($results2[$k][0]) . "</td>\n"; |
|
208 | - echo "<td width='30%' align='right' style='padding-right : 40px'>" . $results2[$k][1] . " " . get_lang('Visits') . "</td>\n"; |
|
207 | + echo "<td width='70%' style='padding-left : 60px;'>".get_lang($results2[$k][0])."</td>\n"; |
|
208 | + echo "<td width='30%' align='right' style='padding-right : 40px'>".$results2[$k][1]." ".get_lang('Visits')."</td>\n"; |
|
209 | 209 | echo "</tr>"; |
210 | 210 | } |
211 | 211 | echo "</table>\n"; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | } else { |
217 | 217 | echo "<tr>"; |
218 | - echo "<td colspan='2' bgcolor='#eeeeee'>" . get_lang('NoResult') . "</td>"; |
|
218 | + echo "<td colspan='2' bgcolor='#eeeeee'>".get_lang('NoResult')."</td>"; |
|
219 | 219 | echo "</tr>"; |
220 | 220 | } |
221 | 221 | echo "</table>"; |
@@ -182,10 +182,11 @@ |
||
182 | 182 | echo "<td style='padding-left : 40px;' valign='top'>" . $beautifulDateTime . "</td>"; |
183 | 183 | echo"</tr>"; |
184 | 184 | // $limit is used to select only results between $results[$j] (current login) and next one |
185 | - if ($j == ( sizeof($results) - 1 )) |
|
186 | - $limit = date("Y-m-d H:i:s", $nextReqDate); |
|
187 | - else |
|
188 | - $limit = $results[$j + 1]; |
|
185 | + if ($j == ( sizeof($results) - 1 )) { |
|
186 | + $limit = date("Y-m-d H:i:s", $nextReqDate); |
|
187 | + } else { |
|
188 | + $limit = $results[$j + 1]; |
|
189 | + } |
|
189 | 190 | // select all access to tool between displayed date and next displayed date or now() if |
190 | 191 | // displayed date is the last login date |
191 | 192 | $sql = "SELECT access_tool, count(access_tool) |
@@ -16,7 +16,6 @@ |
||
16 | 16 | * @author Patrick Cool |
17 | 17 | * @author René Haentjens, added CSV file import (October 2004) |
18 | 18 | * @package chamilo.link |
19 | - |
|
20 | 19 | */ |
21 | 20 | |
22 | 21 | // Including libraries |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $action_links = ' |
100 | 100 | function action_formatter(cellvalue, options, rowObject) { |
101 | - return \'<a href="course_log_tools.php?id_session=0&cidReq='.$course_code.'&gidReq=\'+options.rowId+\'">'.Display::return_icon('2rightarrow.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'. |
|
101 | + return \'<a href="course_log_tools.php?id_session=0&cidReq='.$course_code.'&gidReq=\'+options.rowId+\'">'.Display::return_icon('2rightarrow.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'. |
|
102 | 102 | '\'; |
103 | 103 | }'; |
104 | 104 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $htmlHeadXtra[] = ' |
109 | 109 | <script> |
110 | 110 | $(function() { |
111 | - '.Display::grid_js('group_users',$url, $columns, $column_model, $extra_params, array(), $action_links, true).' |
|
111 | + '.Display::grid_js('group_users', $url, $columns, $column_model, $extra_params, array(), $action_links, true).' |
|
112 | 112 | }); |
113 | 113 | </script>'; |
114 | 114 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | // getting all the students of the course |
80 | 80 | if (empty($session_id)) { |
81 | - // Registered students in a course outside session. |
|
81 | + // Registered students in a course outside session. |
|
82 | 82 | $a_students = CourseManager:: get_student_list_from_course_code( |
83 | 83 | api_get_course_id(), |
84 | 84 | false, |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | api_get_group_id() |
90 | 90 | ); |
91 | 91 | } else { |
92 | - // Registered students in session. |
|
92 | + // Registered students in session. |
|
93 | 93 | $a_students = CourseManager:: get_student_list_from_course_code( |
94 | 94 | api_get_course_id(), |
95 | 95 | true, |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | |
66 | 66 | // Breadcrumbs. |
67 | 67 | if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') { |
68 | - $interbreadcrumb[] = array('url' => '../admin/index.php','name' => get_lang('PlatformAdmin')); |
|
69 | - $interbreadcrumb[] = array('url' => '../session/session_list.php','name' => get_lang('SessionList')); |
|
68 | + $interbreadcrumb[] = array('url' => '../admin/index.php', 'name' => get_lang('PlatformAdmin')); |
|
69 | + $interbreadcrumb[] = array('url' => '../session/session_list.php', 'name' => get_lang('SessionList')); |
|
70 | 70 | $interbreadcrumb[] = array('url' => '../session/resume_session.php?id_session='.api_get_session_id(), 'name' => get_lang('SessionOverview')); |
71 | 71 | } |
72 | 72 | |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | |
135 | 135 | echo '<span style="float:right; padding-top:0px;">'; |
136 | 136 | echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'. |
137 | - Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
137 | + Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
138 | 138 | |
139 | 139 | echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&id_session='.api_get_session_id().'&export=csv"> |
140 | - '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
140 | + '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
141 | 141 | |
142 | 142 | echo '</span>'; |
143 | 143 | echo '</div>'; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $quiz_avg_score = round(($quiz_avg_score / $studentCount), 2).'%'; |
251 | 251 | $url = api_get_path( |
252 | 252 | WEB_CODE_PATH |
253 | - ) . 'exercise/overview.php?exerciseId='.$quiz['id'].$course_path_params; |
|
253 | + ).'exercise/overview.php?exerciseId='.$quiz['id'].$course_path_params; |
|
254 | 254 | |
255 | 255 | echo '<tr><td>'.Display::url( |
256 | 256 | $quiz['title'], |