Преглед изворни кода

LP: Indicate that exercise is hidden when addin LP item #2777

Angel Fernando Quiroz Campos пре 6 година
родитељ
комит
098fd63f6f
1 измењених фајлова са 18 додато и 17 уклоњено
  1. 18 17
      main/lp/learnpath.class.php

+ 18 - 17
main/lp/learnpath.class.php

@@ -10730,6 +10730,8 @@ class learnpath
             'preview_view.png',
             get_lang('Preview')
         );
+        $quizIcon = Display::return_icon('quiz.png', '', [], ICON_SIZE_TINY);
+        $moveIcon = Display::return_icon('move_everywhere.png', get_lang('Move'), [], ICON_SIZE_TINY);
         $exerciseUrl = api_get_path(WEB_CODE_PATH).'exercise/showinframes.php?'.api_get_cidreq();
 
         // Display hotpotatoes
@@ -10760,33 +10762,32 @@ class learnpath
                 api_html_entity_decode($row_quiz['title'])
             );
 
+            $visibility = api_get_item_visibility(
+                ['real_id' => $course_id],
+                TOOL_QUIZ,
+                $row_quiz['iid'],
+                $session_id
+            );
+
             $link = Display::url(
                 $previewIcon,
                 $exerciseUrl.'&exerciseId='.$row_quiz['id'],
                 ['target' => '_blank']
             );
             $return .= '<li class="lp_resource_element" data_id="'.$row_quiz['id'].'" data_type="quiz" title="'.$title.'" >';
-            $return .= '<a class="moved" href="#">';
-            $return .= Display::return_icon(
-                'move_everywhere.png',
-                get_lang('Move'),
-                [],
-                ICON_SIZE_TINY
-            );
-            $return .= '</a> ';
-            $return .= Display::return_icon(
-                'quiz.png',
-                '',
-                [],
-                ICON_SIZE_TINY
-            );
+            $return .= Display::url($moveIcon, '#', ['class' => 'moved']);
+            $return .= $quizIcon;
             $sessionStar = api_get_session_image(
                 $row_quiz['session_id'],
                 $userInfo['status']
             );
-            $return .= '<a class="moved" href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
-                Security::remove_XSS(cut($title, 80)).$link.$sessionStar.
-                '</a>';
+            $return .= Display::url(
+                Security::remove_XSS(cut($title, 80)).$link.$sessionStar,
+                api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id,
+                [
+                    'class' => $visibility == 0 ? 'moved text-muted' : 'moved',
+                ]
+            );
 
             $return .= '</li>';
         }