diff --git a/app/Resources/public/css/scorm.css b/app/Resources/public/css/scorm.css index e5ad4fa613..940958edf9 100644 --- a/app/Resources/public/css/scorm.css +++ b/app/Resources/public/css/scorm.css @@ -7,17 +7,14 @@ See https://support.chamilo.org/issues/6976 /* Default LP left column values */ #learning_path_left_zone { - float:left; - height:100%; - padding-left: 8px; - padding-right: 4px; + } #learning_path_left_zone #header { - font-size:14px; + } #scorm-info.panel-default{ - margin: 0px; + } #author_image { @@ -38,31 +35,11 @@ See https://support.chamilo.org/issues/6976 margin-top: 2px; } -#lp_media_file { - float: left; - text-align:center; - width: 94%; -} - #learning_path_toc { font-size:9pt; margin:0; } -#learning_path_left_zone .image-avatar{ - text-align: center; - padding: 10px; - border:1px solid #dddddd; - border-radius: 4px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - margin-bottom: 5px; - margin-top: 5px; -} #learning_path_left_zone #scorm-gamification{ - padding: 10px; - border: 1px solid #DDD; - border-radius: 5px; - margin-bottom: 5px; } #scorm-gamification .fa-star{ font-size: 20px; @@ -72,20 +49,11 @@ See https://support.chamilo.org/issues/6976 color: #D9534F; } #learning_path_left_zone .navegation-bar .buttons{ - text-align: center; padding-top: 5px; padding-bottom: 5px; - margin-bottom: 5px; } #learning_path_left_zone .description-autor{ - color: #666666; - font-size: 12px; - text-align: left; - line-height: 20px; -} -.inner_lp_toc { - overflow: auto; } .inner_lp_toc .scorm_item a { @@ -197,19 +165,10 @@ See https://support.chamilo.org/issues/6976 } #learning_path_right_zone{ - border-left: 1px solid #CCCCCC; - padding-left: 10px; - box-sizing: border-box; + } #learning_path_breadcrumb_zone .breadcrumb{ - background: #2b3d53; /* Old browsers */ - background: -moz-linear-gradient(top, #2b3d53 0%, #2c3d4d 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#2b3d53), color-stop(100%,#2c3d4d)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #2b3d53 0%,#2c3d4d 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #2b3d53 0%,#2c3d4d 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #2b3d53 0%,#2c3d4d 100%); /* IE10+ */ - background: linear-gradient(to bottom, #2b3d53 0%,#2c3d4d 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2b3d53', endColorstr='#2c3d4d',GradientType=0 ); /* IE6-9 */ + background-color: #2b3d53; border-radius: 0; -moz-border-radius: 0; -webkit-border-radius: 0; @@ -227,34 +186,12 @@ See https://support.chamilo.org/issues/6976 margin-top: 5px; margin-right: 10px; } -#learning_path_left_zone #accordion .panel-heading{ - text-align: center; -} #learning_path_left_zone #ui-option{ - width: 100%; - display: block; - text-align: center; - cursor: pointer; -} -#learning_path_left_zone #ui-option #icon-up, -#learning_path_left_zone #ui-option #icon-down{ - width: 100%; - display: block; -} -.hidden{ - visibility: hidden; - display: none; -} -.sidebar-scorm, -.content-scorm{ - position: relative; - min-height: 1px; - padding-left: 15px; - padding-right: 15px; + } .sidebar-scorm, .content-scorm{ - float: left; + } .total{ width: 100%; @@ -273,9 +210,6 @@ See https://support.chamilo.org/issues/6976 z-index: 2 } -.inner_lp_toc{ - overflow-y:scroll; -} .scorm-heading{ font-size: 14px; padding-top: 5px; @@ -300,8 +234,7 @@ See https://support.chamilo.org/issues/6976 font-size: 12px; } #lp_navigation_elem .buttons { - margin-bottom: .5em; - text-align: center; + } #learning_path_left_zone .scorm_title{ @@ -362,21 +295,6 @@ See https://support.chamilo.org/issues/6976 .scorm_item_normal a:hover{ text-decoration: none; } -#scorm-info .panel-heading{ - padding: 5px; -} -#scorm-info #progress_bar .progress{ - margin-bottom: 5px; -} -.scorm-body .scorm-title{ - font-size: 18px; - margin-top: 5px; - margin-bottom: 5px; - color: #666; -} -.scorm-body .scorm-title .fa-book{ - color: #00829C; -} .scorm_item_normal.scorm_completed { background:url("../../main/img/scorm/scorm_completed.png") no-repeat left center; } @@ -402,4 +320,151 @@ See https://support.chamilo.org/issues/6976 color: #009AB8 !important; } -/* END SCORM CSS BASE*/ \ No newline at end of file +/* END SCORM CSS BASE*/ + + +#scorm-info .panel-heading{ + padding: 2px; +} +#scorm-info .panel-body { + padding: 10px; +} +#scorm-info .image-avatar { + padding: 5px 0; +} +#scorm-info .image-avatar .description-autor { + font-size: 13px; + line-height: 1.2em; +} +#scorm-info .image-avatar .description-autor p { + margin-bottom: 5px; +} +#scorm-info hr { + background-color: #DDD; + width: 100%; +} +#scorm-info #progress_bar .progress{ + margin-bottom: 5px; +} + +.scorm-title{ + color: #666; + font-size: 20px; + font-weight: bold; + line-height: 1.5em; + margin: 0 0 10px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +#lp_navigation_elem a { + color: black; +} + +#learning_path_right_zone .lp-view-tabs li a { + padding: 5px 10px; +} + + + +/* Extra small devices (mobiles, 767px and down) */ + + +/* Small devices (tablets, 768px and up) */ +@media (min-width: 768px) { + +} + +/* Medium devices (desktops, 992px and up) */ +@media (min-width: 992px) { + #learning_path_main { + height: 100%; + margin: 0; + position: relative; + } + + #learning_path_left_zone { + bottom: 0; + box-sizing: content-box; + left: 0; + margin: 0; + padding: 0; + position: absolute; + right: 0; + top: 0; + width: 350px; + } + + #learning_path_right_zone { + bottom: 0; + box-sizing: content-box; + left: 350px; + margin: 0; + padding: 0; + position: absolute; + right: 0; + top: 0; + width: calc(100% - 350px); + } + + #learning_path_main.lp-view-include-breadcrumb #learning_path_left_zone, + #learning_path_main.lp-view-include-breadcrumb #learning_path_right_zone { + top: 40px; + } + + #learning_path_left_zone .lp-view-zone-container, + #learning_path_right_zone .lp-view-zone-container { + bottom: 0; + left: 0; + padding: 10px; + position: absolute; + right: 0; + top: 0; + } + #learning_path_left_zone .lp-view-zone-container { + padding-right: 5px; + } + #learning_path_right_zone .lp-view-zone-container { + padding-left: 5px; + } + + #learning_path_toc { + bottom: 10px; + left: 10px; + overflow: auto; + position: absolute; + right: 5px; + top: 100%; + transition-property: top; + transition-duration: 0.1s; + } + + #lp_navigation_elem { + position: absolute; + right: 10px; + top: 45px; + width: 75%; + } + #learning_path_right_zone .lp-view-tabs .tab-content { + bottom: 10px; + left: 5px; + position: absolute; + right: 10px; + top: 100px; + } + #learning_path_right_zone .tab-pane{ + height: 100%; + position: relative; + } + #learning_path_right_zone .tab-pane iframe { + border: 0 none; + height: 100%; + width: 100%; + } +} + +/* Large devices (large desktops, 1200px and up) */ +@media (min-width: 1200px) { + +} diff --git a/main/inc/ajax/lp.ajax.php b/main/inc/ajax/lp.ajax.php index a9bb93d8eb..c8ae0f6817 100755 --- a/main/inc/ajax/lp.ajax.php +++ b/main/inc/ajax/lp.ajax.php @@ -171,6 +171,96 @@ switch ($action) { } } + break; + case 'get_forum_thread': + $lpId = isset($_GET['lp']) ? intval($_GET['lp']) : 0; + $lpItemId = isset($_GET['lp_item']) ? intval($_GET['lp_item']) : 0; + $sessionId = api_get_session_id(); + + if (empty($lpId) || empty($lpItemId)) { + echo json_encode([ + 'error' => true, + ]); + + break; + } + + $learningPath = new learnpath( + api_get_course_id(), + $lpId, + api_get_user_id() + ); + + $lpItem = $learningPath->getItem($lpItemId); + + if (empty($lpItem)) { + echo json_encode([ + 'error' => true, + ]); + break; + } + + $lpHasForum = $learningPath->lpHasForum(); + + if (!$lpHasForum) { + echo json_encode([ + 'error' => true + ]); + break; + } + + $forum = $learningPath->getForum($sessionId); + + if (empty($forum)) { + require_once '../../forum/forumfunction.inc.php'; + $forumCategory = getForumCategoryByTitle( + get_lang('LearningPaths'), + $course_id, + $sessionId + ); + + if (empty($forumCategory)) { + $forumCategoryId = store_forumcategory( + [ + 'lp_id' => 0, + 'forum_category_title' => get_lang('LearningPaths'), + 'forum_category_comment' => null + ], + [], + false + ); + } else { + $forumCategoryId = $forumCategory['cat_id']; + } + + $forumId = $learningPath->createForum($forumCategoryId); + } else { + $forumId = $forum['forum_id']; + } + + $lpItemHasThread = $lpItem->lpItemHasThread($course_id); + + if (!$lpItemHasThread) { + echo json_encode([ + 'error' => true + ]); + break; + } + + $forumThread = $lpItem->getForumThread($course_id, $sessionId); + + if (empty($forumThread)) { + $lpItem->createForumTthread($forumId); + $forumThread = $lpItem->getForumThread($course_id, $sessionId); + } + + $forumThreadId = $forumThread['thread_id']; + + echo json_encode([ + 'error' => false, + 'forumId' => intval($forum['forum_id']), + 'threadId' => intval($forumThreadId) + ]); break; case 'update_gamification': $lp = isset($_SESSION['oLP']) ? $_SESSION['oLP'] : null; diff --git a/main/inc/lib/javascript/jquery.lp_minipanel.js b/main/inc/lib/javascript/jquery.lp_minipanel.js index 2f22d5898e..1bd69c9171 100755 --- a/main/inc/lib/javascript/jquery.lp_minipanel.js +++ b/main/inc/lib/javascript/jquery.lp_minipanel.js @@ -17,8 +17,6 @@ $(document).ready(function() { $('#learning_path_right_zone').toggleClass('total'); $(function(){ $('#learning_path_right_zone').slideToggle(300); - $('#control-bottom').toggle("slow"); - }); }); diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 644eeacbc1..7227303ab6 100755 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -1924,19 +1924,25 @@ class learnpath if ($this->mode == 'fullscreen') { $navbar = '
- - - . + + + .
'; } else { $navbar = ' -
- - - -
'; + + + ' . get_lang('Reporting') . ' + + + ' . get_lang('ScormPrevious') . ' + + + ' . get_lang('ScormNext') . ' + + '; } return $navbar; @@ -3189,7 +3195,7 @@ class learnpath $html .= '
'; } else { $html .= '
'; - $html .= ''; + $html .= ''; } if (in_array($item['type'], $dirTypes)) { @@ -3198,7 +3204,7 @@ class learnpath $html .= stripslashes($title); } else { $this->get_link('http', $item['id'], $toc_list); - $html .= '' . stripslashes($title) . ''; + $html .= '' . stripslashes($title) . ''; } $html .= "
"; @@ -3230,7 +3236,7 @@ class learnpath $gradebook = Security:: remove_XSS($_GET['gradebook']); } if ($this->get_lp_session_id() == api_get_session_id()) { - $html .= '
'; + $html .= '

'; $html .= '
'; $html .= "" . Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . ""; @@ -5650,7 +5656,7 @@ class learnpath } } - $delete_icon .= ' '; + $delete_icon .= ' '; $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY); $delete_icon .= ''; @@ -10476,6 +10482,42 @@ EOD; return $src; } + /** + * Check if this LP has a created forum in the basis course + * @return boolean + */ + public function lpHasForum() + { + $forumTable = Database::get_course_table(TABLE_FORUM); + $itemProperty = Database::get_course_table(TABLE_ITEM_PROPERTY); + + $fakeFrom = " + $forumTable f + INNER JOIN $itemProperty ip + ON (f.forum_id = ip.ref AND f.c_id = ip.c_id) + "; + + $resultData = Database::select( + 'COUNT(f.iid) AS qty', + $fakeFrom, + [ + 'where' => [ + 'ip.visibility != ? AND ' => 2, + 'ip.tool = ? AND ' => TOOL_FORUM, + 'f.c_id = ? AND ' => intval($this->course_int_id), + 'f.lp_id = ?' => intval($this->lp_id) + ] + ], + 'first' + ); + + if ($resultData['qty'] > 0) { + return true; + } + + return false; + } + /** * Get the forum for this learning path * @return boolean diff --git a/main/newscorm/learnpathItem.class.php b/main/newscorm/learnpathItem.class.php index 494a935033..8845cfee44 100755 --- a/main/newscorm/learnpathItem.class.php +++ b/main/newscorm/learnpathItem.class.php @@ -4413,6 +4413,43 @@ class learnpathItem $this->prerequisiteMinScore = $prerequisiteMinScore; } + /** + * Check if this LP item has a created thread in the basis course from the forum of its LP + * @param int $lpCourseId The course ID + * @return boolean + */ + public function lpItemHasThread($lpCourseId) + { + $forumThreadTable = Database::get_course_table(TABLE_FORUM_THREAD); + $itemProperty = Database::get_course_table(TABLE_ITEM_PROPERTY); + + $fakeFrom = " + $forumThreadTable ft + INNER JOIN $itemProperty ip + ON (ft.thread_id = ip.ref AND ft.c_id = ip.c_id) + "; + + $resultData = Database::select( + 'COUNT(ft.iid) AS qty', + $fakeFrom, + [ + 'where' => [ + 'ip.visibility != ? AND ' => 2, + 'ip.tool = ? AND ' => TOOL_FORUM_THREAD, + 'ft.c_id = ? AND ' => intval($lpCourseId), + 'ft.lp_item_id = ?' => intval($this->db_id) + ] + ], + 'first' + ); + + if ($resultData['qty'] > 0) { + return true; + } + + return false; + } + /** * Get the forum thread info * @param int $lpCourseId The course ID from the learning path diff --git a/main/newscorm/lp_view.php b/main/newscorm/lp_view.php index b156d65c59..d3617568c1 100755 --- a/main/newscorm/lp_view.php +++ b/main/newscorm/lp_view.php @@ -80,7 +80,7 @@ $my_style = $platform_theme; $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; @@ -513,7 +513,7 @@ $template->assign( Display::img( $lpPreviewImagePath, $_SESSION['oLP']->name, - array('class' => 'img-circle'), + [], ICON_SIZE_BIG ) ); diff --git a/main/newscorm/scorm_api.php b/main/newscorm/scorm_api.php index c43dfe3fc6..e3a7ef28bf 100755 --- a/main/newscorm/scorm_api.php +++ b/main/newscorm/scorm_api.php @@ -1663,9 +1663,58 @@ function switch_item(current_item, next_item){ }); olms.switch_finished = 0; //only changed back once LMSInitialize() happens + loadForumThead(olms.lms_lp_id, next_item); + return true; } +/** + * Get a forum info when the learning path item has a associated forum + */ +var loadForumThead = function(lpId, lpItemId) { + var loadForum = $.getJSON('lp.ajax.php', { + a: 'get_forum_thread', + lp: lpId, + lp_item: lpItemId + } + ); + + $.when(loadForum).done(function(forumThreadData) { + var tabForumLink = $('.lp-view-tabs a[href="#lp-view-forum"]'), + tabForum = tabForumLink.parent(); + + if (forumThreadData.error) { + tabForumLink.removeAttr('data-toggle'); + tabForum.addClass('disabled'); + + $('#lp-view-forum').html(''); + + return; + } + + tabForumLink.attr('data-toggle', 'tab'); + tabForum.removeClass('disabled'); + + var forumIframe = $(' - {% else %} - - {% endif %} +
+
+ + +

{{ lp_title_scorm }}

+ +
+ + +
+
+ {% if lp_mode == 'fullscreen' %} + + {% else %} + + {% endif %} +
+
+ +
+
+
+
{# end right Zone #} - - {{ navigation_bar_bottom }} -
-