Просмотр исходного кода

Add "lp_view_settings" to hide reporting icon in lp view BT#13794

jmontoyaa 7 лет назад
Родитель
Сommit
01c864bfab
2 измененных файлов с 46 добавлено и 22 удалено
  1. 5 0
      main/install/configuration.dist.php
  2. 41 22
      main/lp/learnpath.class.php

+ 5 - 0
main/install/configuration.dist.php

@@ -751,6 +751,11 @@ $_configuration['gradebook_badge_sidebar'] = [
 // Send two emails when creating a user. One with the username other with the password.
 //$_configuration['send_two_inscription_confirmation_mail'] = false;
 
+// LP view custom settings
+// $_configuration['lp_view_settings'] = ['display' => ['show_reporting_icon' => true]];
+
+
+
 // ------ Custom DB changes
 // Add user activation by confirmation email
 // This option prevents the new user to login in the platform if your account is not confirmed via email

+ 41 - 22
main/lp/learnpath.class.php

@@ -1970,8 +1970,8 @@ class learnpath
             $idBar = 'control-top';
         }
 
-        $navbar = null;
-        $lp_id = $this->lp_id;
+        $navbar = '';
+        $lpId = $this->lp_id;
         $mycurrentitemid = $this->get_current_item_id();
 
         $reportingText = get_lang('Reporting');
@@ -1979,34 +1979,53 @@ class learnpath
         $nextText = get_lang('ScormNext');
         $fullScreenText = get_lang('ScormExitFullScreen');
 
+        $settings = api_get_configuration_value('lp_view_settings');
+        $display = isset($settings['display']) ? $settings['display'] : false;
+        $reportingIcon = '
+            <a class="icon-toolbar" 
+                id="stats_link"
+                href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lpId.'" 
+                onclick="window.parent.API.save_asset(); return true;" 
+                target="content_name" title="'.$reportingText.'">
+                <span class="fa fa-info"></span><span class="sr-only">'.$reportingText.'</span>
+            </a>';
+
+        if (!empty($display)) {
+            $showReporting = isset($display['show_reporting_icon']) ? $display['show_reporting_icon'] : true;
+            if ($showReporting == false) {
+                $reportingIcon = '';
+            }
+        }
+
+        $previousIcon = '
+            <a class="icon-toolbar" id="scorm-previous" href="#" 
+                onclick="switch_item('.$mycurrentitemid.',\'previous\');return false;" title="'.$previousText.'">
+                <span class="fa fa-chevron-left"></span><span class="sr-only">'.$previousText.'</span>
+            </a>';
+
+        $nextIcon = '
+            <a class="icon-toolbar" id="scorm-next" href="#" 
+                onclick="switch_item('.$mycurrentitemid.',\'next\');return false;" title="'.$nextText.'">
+                <span class="fa fa-chevron-right"></span><span class="sr-only">' . $nextText.'</span>
+            </a>';
+
         if ($this->mode == 'fullscreen') {
             $navbar = '
                   <span id="'.$idBar.'" class="buttons">
-                    <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="'.$reportingText.'" id="stats_link">
-                        <span class="fa fa-info"></span><span class="sr-only">' . $reportingText.'</span>
-                    </a>
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="'.$previousText.'">
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . $previousText.'</span>
-                    </a>
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="'.$nextText.'">
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . $nextText.'</span>
-                    </a>
-                    <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="'.$fullScreenText.'">
-                        <span class="fa fa-columns"></span><span class="sr-only">' . $fullScreenText.'</span>
+                    '.$reportingIcon.'
+                    '.$previousIcon.'                    
+                    '.$nextIcon.'
+                    <a class="icon-toolbar" id="view-embedded" 
+                        href="lp_controller.php?action=mode&mode=embedded" target="_top" title="'.$fullScreenText.'">
+                        <span class="fa fa-columns"></span><span class="sr-only">'.$fullScreenText.'</span>
                     </a>
                   </span>';
         } else {
             $navbar = '
             <span id="'.$idBar.'" class="buttons text-right">
-                <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="'.$reportingText.'" id="stats_link">
-                    <span class="fa fa-info"></span><span class="sr-only">' . $reportingText.'</span>
-                </a>
-                <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="'.$previousText.'">
-                    <span class="fa fa-chevron-left"></span><span class="sr-only">' . $previousText.'</span>
-                </a>
-                <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="'.$nextText.'">
-                    <span class="fa fa-chevron-right"></span><span class="sr-only">' . $nextText.'</span>
-                </a>
+                '.$reportingIcon.'
+                '.$previousIcon.'
+                '.$nextIcon.'               
             </span>';
         }