Ver código fonte

Merge remote-tracking branch 'upstream/ofaj_dev' into ofajpreprod

Nicolas Ducoulombier 7 anos atrás
pai
commit
b7b2589718

+ 19 - 1
app/Resources/public/css/themes/rainbow/learnpath.css

@@ -67,7 +67,8 @@
     padding-left: 20px;
     padding-top: 10px;
 }
-.title-learnpath h4{
+.title-learnpath h4,
+.title-learnpath .h5 {
     color: #162a83;
     font-weight: bold;
 }
@@ -462,3 +463,20 @@ table.lp_overview img {
     background: url(images/completed-active.png) no-repeat  #772583 55px center;
 }
 /* nuevo css */
+
+#learning_path_right_zone .lp-view-tabs .tab-content {
+    bottom: 5px;
+    left: 5px;
+    position: absolute;
+    right: 5px;
+    top: 84px;
+}
+
+/* Small devices (tablets, 768px and up) */
+@media (min-width: 768px) {
+    #learning_path_right_zone .lp-view-tabs .tab-content {
+        bottom: 10px;
+        right: 10px;
+        top: 100px;
+    }
+}

+ 14 - 0
main/inc/ajax/lp.ajax.php

@@ -284,6 +284,20 @@ switch ($action) {
 
         echo json_encode($position);
 
+        break;
+    case 'get_parent_names':
+        /** @var \learnpath $lp */
+        $lp = Session::read('oLP');
+        $parentNames = $lp->getCurrentItemParentNames();
+
+        $response = '';
+
+        foreach ($parentNames as $parentName) {
+            $response .= '<p class="h5 hidden-xs hidden-md">'.$parentName.'</p>';
+        }
+
+        echo $response;
+
         break;
     default:
         echo '';

+ 19 - 0
main/lp/learnpath.class.php

@@ -12570,6 +12570,25 @@ EOD;
 
         return stripslashes($output);
     }
+
+    /**
+     * Get the parent names for the current item
+     * @return array
+     */
+    public function getCurrentItemParentNames()
+    {
+        $return = [];
+        $item = $this->getItem($this->get_current_item_id());
+        $parent = $this->getItem($item->get_parent());
+
+        while ($parent) {
+            $return[] = $parent->get_title();
+
+            $parent = $this->getItem($parent->get_parent());
+        }
+
+        return array_reverse($return);
+    }
 }
 
 if (!function_exists('trim_value')) {

+ 1 - 0
main/lp/lp_ajax_switch_item.php

@@ -217,6 +217,7 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
         "update_toc('$mylesson_status','".$new_item_id."');".
         "update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
     $return .= 'updateGamificationValues(); ';
+    $return .= "$('#item-parent-names').load('".api_get_path(WEB_AJAX_PATH)."lp.ajax.php?a=get_parent_names');";
 
     $mylp->set_error_msg('');
     $mylp->prerequisites_match(); // Check the prerequisites are all complete.

+ 1 - 0
main/lp/lp_view.php

@@ -547,6 +547,7 @@ $template->assign('lp_author', $_SESSION['oLP']->get_author());
 $template->assign('lp_mode', $_SESSION['oLP']->mode);
 $template->assign('title_course', $_SESSION['oLP']->course_info['title']);
 $template->assign('lp_title_scorm', $_SESSION['oLP']->name);
+$template->assign('lp_item_parents', $_SESSION['oLP']->getCurrentItemParentNames());
 $template->assign('lp_id', $_SESSION['oLP']->lp_id);
 $template->assign('lp_current_item_id', $_SESSION['oLP']->get_current_item_id());
 

+ 61 - 41
main/template/rainbow/learnpath/view.tpl

@@ -87,6 +87,11 @@
         <div class="lp-view-zone-container">
             <div class="title-learnpath pull-left">
                 <h4>{{ lp_title_scorm }}</h4>
+                <div id="item-parent-names">
+                    {% for parent_title in lp_item_parents %}
+                        <p class="h5 hidden-xs hidden-md">{{ parent_title }}</p>
+                    {% endfor %}
+                </div>
             </div>
             <div id="lp_navigation_elem" class="navegation-bar pull-right text-right">
                 <a href="#" id="lp-view-expand-toggle" class="icon-toolbar expand" role="button">
@@ -106,7 +111,7 @@
             </div>
 
             <div class="lp-view-tabs">
-                <ul id="navTabs" class="nav nav-tabs" role="tablist">
+                <ul id="navTabs" class="nav nav-tabs pull-left" style="margin-top: 75px;" role="tablist">
                     <li role="presentation" class="active">
                         <a href="#lp-view-content" aria-controls="lp-view-content" role="tab" data-toggle="tab">
                             <span class="fa fa-book fa-2x fa-fw" aria-hidden="true"></span><span
@@ -203,33 +208,32 @@
             {% endif %}
 
             if (/iPhone|iPod|iPad/.test(navigator.userAgent)) {
-              $('#wrapper-iframe').css({
-                'overflow' : 'auto',
-                'position' : 'relative',
-                '-webkit-overflow-scrolling': 'touch'
-              });
+                $('#wrapper-iframe').css({
+                    'overflow': 'auto',
+                    'position': 'relative',
+                    '-webkit-overflow-scrolling': 'touch'
+                });
             }
 
             {% if lp_mode == 'embedframe' %}
                 //$('#learning_path_main').addClass('lp-view-collapsed');
                 $('#lp-view-expand-button, #lp-view-expand-toggle').on('click', function (e) {
-                e.preventDefault();
+                    e.preventDefault();
 
-                $('#learning_path_main').toggleClass('lp-view-collapsed');
+                    $('#learning_path_main').toggleClass('lp-view-collapsed');
 
-                $('#lp-view-expand-toggle span.fa').toggleClass('fa-compress');
-                $('#lp-view-expand-toggle span.fa').toggleClass('fa-expand');
-            });
+                    $('#lp-view-expand-toggle span.fa').toggleClass('fa-compress');
+                    $('#lp-view-expand-toggle span.fa').toggleClass('fa-expand');
+                });
             {% else %}
-            $('#lp-view-expand-button, #lp-view-expand-toggle').on('click', function (e) {
-                e.preventDefault();
+                $('#lp-view-expand-button, #lp-view-expand-toggle').on('click', function (e) {
+                    e.preventDefault();
 
-                $('#learning_path_main').toggleClass('lp-view-collapsed');
-
-                $('#lp-view-expand-toggle span.fa').toggleClass('fa-expand');
-                $('#lp-view-expand-toggle span.fa').toggleClass('fa-compress');
-            });
+                    $('#learning_path_main').toggleClass('lp-view-collapsed');
 
+                    $('#lp-view-expand-toggle span.fa').toggleClass('fa-expand');
+                    $('#lp-view-expand-toggle span.fa').toggleClass('fa-compress');
+                });
             {% endif %}
 
             $('.lp-view-tabs').on('click', '.disabled', function (e) {
@@ -270,47 +274,47 @@
                 (function () {
                     {% if show_glossary_in_documents == 'ismanual' %}
                         $.frameReady(
-                            function(){
+                            function () {
                                 //  $("<div>I am a div courses</div>").prependTo("body");
                             },
                             "top.content_name",
                             {
                                 load: [
-                                    { type:"script", id:"_fr1", src:"{{ jquery_web_path }}"},
-                                    { type:"script", id:"_fr4", src:"{{ jquery_ui_js_web_path }}"},
-                                    { type:"stylesheet", id:"_fr5", src:"{{ jquery_ui_css_web_path }}"},
-                                    { type:"script", id:"_fr2", src:"{{ _p.web_lib }}javascript/jquery.highlight.js"},
+                                    {type: "script", id: "_fr1", src: "{{ jquery_web_path }}"},
+                                    {type: "script", id: "_fr4", src: "{{ jquery_ui_js_web_path }}"},
+                                    {type: "stylesheet", id: "_fr5", src: "{{ jquery_ui_css_web_path }}"},
+                                    {type: "script", id: "_fr2", src: "{{ _p.web_lib }}javascript/jquery.highlight.js"},
                                     {{ fix_link }}
                                 ]
                             }
                         );
                     {% elseif show_glossary_in_documents == 'isautomatic' %}
                         $.frameReady(
-                            function(){
+                            function () {
                                 //  $("<div>I am a div courses</div>").prependTo("body");
                             },
                             "top.content_name",
                             {
                                 load: [
-                                    { type:"script", id:"_fr1", src:"{{ jquery_web_path }}"},
-                                    { type:"script", id:"_fr4", src:"{{ jquery_ui_js_web_path }}"},
-                                    { type:"stylesheet", id:"_fr5", src:"{{ jquery_ui_css_web_path }}"},
-                                    { type:"script", id:"_fr2", src:"{{ _p.web_lib }}javascript/jquery.highlight.js"},
+                                    {type: "script", id: "_fr1", src: "{{ jquery_web_path }}"},
+                                    {type: "script", id: "_fr4", src: "{{ jquery_ui_js_web_path }}"},
+                                    {type: "stylesheet", id: "_fr5", src: "{{ jquery_ui_css_web_path }}"},
+                                    {type: "script", id: "_fr2", src: "{{ _p.web_lib }}javascript/jquery.highlight.js"},
                                     {{ fix_link }}
                                 ]
                             }
                         );
                     {% elseif fix_link != '' %}
                         $.frameReady(
-                            function(){
+                            function () {
                                 //  $("<div>I am a div courses</div>").prependTo("body");
                             },
                             "top.content_name",
                             {
                                 load: [
-                                    { type:"script", id:"_fr1", src:"{{ jquery_web_path }}"},
-                                    { type:"script", id:"_fr4", src:"{{ jquery_ui_js_web_path }}"},
-                                    { type:"stylesheet", id:"_fr5", src:"{{ jquery_ui_css_web_path }}"},
+                                    {type: "script", id: "_fr1", src: "{{ jquery_web_path }}"},
+                                    {type: "script", id: "_fr4", src: "{{ jquery_ui_js_web_path }}"},
+                                    {type: "stylesheet", id: "_fr5", src: "{{ jquery_ui_css_web_path }}"},
                                     {{ fix_link }}
                                 ]
                             }
@@ -319,21 +323,37 @@
                 })();
             {% endif %}
 
-            $('iframe#content_id')
-                .on('load', function () {
-                    $.frameReady(function () {
-                    }, 'top.content_name', {
+            $('iframe#content_id').on('load', function () {
+                $.frameReady(
+                    function () {
+
+                    },
+                    'top.content_name',
+                    {
                         load: [
                             {type: 'script', id: '_fr1', src: '{{ _p.web }}web/assets/jquery/dist/jquery.min.js'},
-                            {type: 'script', id: '_fr7', src: '{{ _p.web }}web/assets/MathJax/MathJax.js?config=AM_HTMLorMML'},
+                            {
+                                type: 'script',
+                                id: '_fr7',
+                                src: '{{ _p.web }}web/assets/MathJax/MathJax.js?config=AM_HTMLorMML'
+                            },
                             {type: 'script', id: '_fr4', src: '{{ _p.web }}web/assets/jquery-ui/jquery-ui.min.js'},
-                            {type: 'stylesheet', id: '_fr5', src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/jquery-ui.min.css'},
-                            {type: 'stylesheet', id: '_fr6', src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/theme.css'},
+                            {
+                                type: 'stylesheet',
+                                id: '_fr5',
+                                src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/jquery-ui.min.css'
+                            },
+                            {
+                                type: 'stylesheet',
+                                id: '_fr6',
+                                src: '{{ _p.web }}web/assets/jquery-ui/themes/smoothness/theme.css'
+                            },
                             {type: 'script', id: '_fr2', src: '{{ _p.web_lib }}javascript/jquery.highlight.js'},
                             {type: 'script', id: '_fr3', src: '{{ _p.web_main }}glossary/glossary.js.php'}
                         ]
-                    });
-                });
+                    }
+                );
+            });
         });
 
         $(window).on('resize', function () {