Browse Source

Hiding actions column when lp_show_reduced_report = true see BT#8902

Julio Montoya 10 years ago
parent
commit
a94432663b
1 changed files with 85 additions and 34 deletions
  1. 85 34
      main/inc/lib/tracking.lib.php

+ 85 - 34
main/inc/lib/tracking.lib.php

@@ -86,6 +86,11 @@ class Tracking
             $output .= Display::page_header(get_lang('ScormMystatus'));
         }
 
+        $actionColumn = null;
+        if ($type == 'classic') {
+            $actionColumn = ' <th>' . get_lang('Actions') . '</th>';
+        }
+
         $output .= '<table class="data_table">
             <tr>
                 <th width="16">' . $extend_all_link . '</th>
@@ -101,9 +106,7 @@ class Tracking
                 <th colspan="2">
                     ' . get_lang('ScormTime') . '
                 </th>
-                <th>
-                    ' . get_lang('Actions') . '
-                </th>
+                '.$actionColumn.'
            </tr>';
 
         // Going through the items using the $items[] array instead of the database order ensures
@@ -247,6 +250,11 @@ class Tracking
                     $title = Security::remove_XSS($title);
                     $counter++;
 
+                    $action = null;
+                    if ($type == 'classic') {
+                        $action =  '<td></td>';
+                    }
+
                     if (in_array($row['item_type'], $chapterTypes)) {
                         $output .= '<tr class="'.$oddclass.'">
                                 <td>'.$extend_link.'</td>
@@ -256,7 +264,7 @@ class Tracking
                                 <td colspan="2">'.learnpathItem::humanize_status($lesson_status, true, $type).'</td>
                                 <td colspan="2"></td>
                                 <td colspan="2"></td>
-                                <td></td>
+                                '.$action.'
                             </tr>';
                         continue;
                     } else {
@@ -268,7 +276,7 @@ class Tracking
                                 <td colspan="2"></td>
                                 <td colspan="2"></td>
                                 <td colspan="2"></td>
-                                <td></td>
+                                '.$action.'
                             </tr>';
                     }
 
@@ -350,6 +358,11 @@ class Tracking
                                 }
                             }
 
+                            $action = null;
+                            if ($type == 'classic') {
+                                $action = '<td></td>';
+                            }
+
                             $output .= '<tr class="' . $oddclass . '">
                                     <td></td>
                                     <td>' . $extend_attempt_link . '</td>
@@ -357,7 +370,7 @@ class Tracking
                                     <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td>
                                     <td colspan="2">' . $view_score . '</td>
                                     <td colspan="2">' . $time . '</td>
-                                    <td></td>
+                                    '.$action.'
                                 </tr>';
                             $attemptCount++;
                             if (!empty($export_csv)) {
@@ -381,6 +394,11 @@ class Tracking
 
                         $counter++;
 
+                        $action = null;
+                        if ($type == 'classic') {
+                            $action = '<td></td>';
+                        }
+
                         if ($extend_this_attempt OR $extend_all) {
                             $list1 = learnpath :: get_iv_interactions_array($row['iv_id']);
                             foreach ($list1 as $id => $interaction) {
@@ -399,6 +417,7 @@ class Tracking
                                     }
                                     $student_response = implode(',', $content_student_response);
                                 }
+
                                 $output .= '<tr class="'.$oddclass.'">
                                         <td></td>
                                         <td></td>
@@ -410,7 +429,7 @@ class Tracking
                                         <td>'.$interaction['result'] . '</td>
                                         <td>'.$interaction['latency'] . '</td>
                                         <td>'.$interaction['time'] . '</td>
-                                        <td></td>
+                                        '.$action.'
                                     </tr>';
                                 $counter++;
                             }
@@ -432,7 +451,7 @@ class Tracking
                                         <td>' . $interaction['score_raw'] . '</td>
                                         <td>' . $interaction['score_max'] . '</td>
                                         <td>' . $interaction['score_min'] . '</td>
-                                        <td></td>
+                                        '.$action.'
                                      </tr>';
                                 $counter++;
                             }
@@ -525,7 +544,8 @@ class Tracking
                                 exe_cours_id="' . $courseCode . '" AND
                                 status <> "incomplete" AND
                                 session_id = ' . $session_id . '
-                             ORDER BY exe_date DESC limit 1';
+                             ORDER BY exe_date DESC
+                             LIMIT 1';
 
                     $resultLastAttempt = Database::query($sql);
                     $num = Database :: num_rows($resultLastAttempt);
@@ -581,11 +601,13 @@ class Tracking
                                 // Selecting the max score from an attempt.
                                 $sql = "SELECT SUM(t.ponderation) as maxscore
                                         FROM (
-                                            SELECT distinct question_id, marks, ponderation
-                                            FROM $tbl_stats_attempts as at INNER JOIN  $tbl_quiz_questions as q
-                                            ON (q.id = at.question_id AND q.c_id = $course_id
-                                            )
-                                WHERE exe_id ='$id_last_attempt' ) as t";
+                                            SELECT DISTINCT
+                                                question_id, marks, ponderation
+                                            FROM $tbl_stats_attempts as at
+                                            INNER JOIN  $tbl_quiz_questions as q
+                                            ON (q.id = at.question_id AND q.c_id = $course_id)
+                                            WHERE exe_id ='$id_last_attempt'
+                                        ) as t";
 
                                 $result = Database::query($sql);
                                 $row_max_score = Database :: fetch_array($result);
@@ -597,11 +619,16 @@ class Tracking
                     }
 
                     $time_for_total = $subtotal_time;
-                    $time = learnpathItem :: getScormTimeFromParameter('js', $subtotal_time);
+                    $time = learnpathItem::getScormTimeFromParameter('js', $subtotal_time);
                     if (empty($title)) {
                         $title = rl_get_resource_name($courseInfo['code'], $lp_id, $row['myid']);
                     }
 
+                    $action = null;
+                    if ($type == 'classic') {
+                        $action = '<td></td>';
+                    }
+
                     if (in_array($row['item_type'], $chapterTypes)) {
                         $title = Security::remove_XSS($title);
                         $output .= '<tr class="'.$oddclass.'">
@@ -612,7 +639,7 @@ class Tracking
                                 <td colspan="2">'.learnpathitem::humanize_status($lesson_status).'</td>
                                 <td colspan="2"></td>
                                 <td colspan="2"></td>
-                                <td></td>
+                                '.$action.'
                             </tr>';
                     } else {
                         $correct_test_link = '-';
@@ -651,6 +678,11 @@ class Tracking
 
                         $title = Security::remove_XSS($title);
 
+                        $action = null;
+                        if ($type == 'classic') {
+                            $action =  '<td>' . $correct_test_link . '</td>';
+                        }
+
                         if ($lp_id == $my_lp_id && false) {
 
                             $output .= '<tr class =' . $oddclass . '>
@@ -659,7 +691,7 @@ class Tracking
                                     <td colspan="2">&nbsp;</td>
                                     <td colspan="2">&nbsp;</td>
                                     <td colspan="2">&nbsp;</td>
-                                    <td>' . $correct_test_link . '</td>
+                                    '.$action.'
                                 </tr>';
                             $output .= '</tr>';
                         } else {
@@ -691,12 +723,14 @@ class Tracking
                                 $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore);
                             }
 
-                            $output .= '<td>'.$extend_link.'</td>
+                            $output .= '
+                                <td>'.$extend_link.'</td>
                                 <td colspan="4">' . $title . '</td>
                                 <td colspan="2">' . learnpathitem::humanize_status($lesson_status) .'</td>
                                 <td colspan="2">'.$scoreItem.'</td>
                                 <td colspan="2">'.$time.'</td>
-                                 <td>'.$correct_test_link.'</td>';
+                                '.$action.'
+                             ';
                             $output .= '</tr>';
                         }
 
@@ -720,6 +754,12 @@ class Tracking
                     }
 
                     $counter++;
+
+                    $action = null;
+                    if ($type == 'classic') {
+                        $action =  '<td></td>';
+                    }
+
                     if ($extend_this_attempt OR $extend_all) {
                         $list1 = learnpath :: get_iv_interactions_array($row['iv_id']);
                         foreach ($list1 as $id => $interaction) {
@@ -739,7 +779,7 @@ class Tracking
                                     <td>'.$interaction['result'].'</td>
                                     <td>'.$interaction['latency'].'</td>
                                     <td>'.$interaction['time'].'</td>
-                                    <td></td>
+                                    '.$action.'
                                </tr>';
                             $counter++;
                         }
@@ -760,7 +800,7 @@ class Tracking
                                     <td>' . $interaction['score_raw'].'</td>
                                     <td>' . $interaction['score_max'] .'</td>
                                     <td>' . $interaction['score_min'].'</td>
-                                    <td></td>
+                                    '.$action.'
                                </tr>';
                             $counter++;
                         }
@@ -769,7 +809,10 @@ class Tracking
                     // Attempts listing by exercise.
                     if ($lp_id == $my_lp_id && $lp_item_id== $my_id && $extendedAttempt) {
                         // Get attempts of a exercise.
-                        if (!empty($lp_id) && !empty($lp_item_id) && $row['item_type'] === 'quiz') {
+                        if (!empty($lp_id) &&
+                            !empty($lp_item_id) &&
+                            $row['item_type'] === 'quiz'
+                        ) {
                             $sql = "SELECT path FROM $TBL_LP_ITEM
                                     WHERE
                                         c_id = $course_id AND
@@ -782,7 +825,7 @@ class Tracking
                                 $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
                                         WHERE
                                             exe_exo_id="' . (int) $row_path['path'] . '" AND
-                                            status <> "incomplete"  AND
+                                            status <> "incomplete" AND
                                             exe_user_id="' . $user_id . '" AND
                                             orig_lp_id = "' . (int) $lp_id . '" AND
                                             orig_lp_item_id = "' . (int) $lp_item_id . '" AND
@@ -838,19 +881,21 @@ class Tracking
                                         <td colspan="2">' . $my_lesson_status . '</td>
                                         <td colspan="2">'.$view_score . '</td>
                                         <td colspan="2">'.$time_attemp . '</td>';
-                                        if ($origin != 'tracking') {
-                                            if (!$is_allowed_to_edit && $result_disabled_ext_all) {
-                                                $output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"></td>';
-                                            } else {
-                                                $output .= '<td><a href="../exercice/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent">
+                                        if ($action == 'classic') {
+                                            if ($origin != 'tracking') {
+                                                if (!$is_allowed_to_edit && $result_disabled_ext_all) {
+                                                    $output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"></td>';
+                                                } else {
+                                                    $output .= '<td><a href="../exercice/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent">
                                                 <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"></a></td>';
-                                            }
-                                        } else {
-                                            if (!$is_allowed_to_edit && $result_disabled_ext_all) {
-                                                $output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>';
+                                                }
                                             } else {
-                                                $output .= '<td><a href="../exercice/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent">
+                                                if (!$is_allowed_to_edit && $result_disabled_ext_all) {
+                                                    $output .= '<td><img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>';
+                                                } else {
+                                                    $output .= '<td><a href="../exercice/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent">
                                                  <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>';
+                                                }
                                             }
                                         }
                                         $output .= '</tr>';
@@ -928,6 +973,11 @@ class Tracking
             $oddclass = 'row_even';
         }
 
+        $action = null;
+        if ($type == 'classic') {
+            $action =  '<td></td>';
+        }
+
         $output .= '<tr class="'.$oddclass.'">
                 <td></td>
                 <td colspan="4">
@@ -937,7 +987,8 @@ class Tracking
                 <td colspan="2">
                     ' . $final_score.'
                 </td>
-                <td colspan="2">' . $total_time . '</div><td></td>
+                <td colspan="2">' . $total_time . '</div>
+                '.$action.'
            </tr>';
 
         $output .= "</table>";