Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

1.10.x
aragonc 9 years ago
commit 431dbe857f
  1. 18
      app/Resources/public/css/base.css
  2. 308
      app/Resources/public/css/scorm.css
  3. 6
      main/forum/forumfunction.inc.php
  4. 8
      main/gradebook/lib/be/category.class.php
  5. 90
      main/inc/ajax/lp.ajax.php
  6. 53
      main/inc/lib/javascript/jquery.lp_minipanel.js
  7. 66
      main/newscorm/learnpath.class.php
  8. 37
      main/newscorm/learnpathItem.class.php
  9. 5
      main/newscorm/lp_view.php
  10. 49
      main/newscorm/scorm_api.php
  11. 404
      main/template/default/learnpath/view.tpl

@ -5758,9 +5758,6 @@ a.sessionView {
.sidebar-scorm{
width: 16.66666667%;
}
.content-scorm{
width: 83.33333333%;
}
#learning_path_right_zone{
width: 68%;
}
@ -5769,9 +5766,6 @@ a.sessionView {
.sidebar-scorm{
width: 25.66666667%;
}
.content-scorm{
width: 76.33333333%;
}
.total{
width: 100%;
}
@ -5806,8 +5800,6 @@ a.sessionView {
/* Landscape phones and down */
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
#learning_path_breadcrumb_zone {
display: none;
visibility: hidden;
}
#learning_path_main{
margin-top: 5px;
@ -5818,9 +5810,6 @@ a.sessionView {
.sidebar-scorm{
width: 100%;
}
.content-scorm{
visibility: hidden;
}
.total{
width: 100%;
visibility: visible;
@ -5886,19 +5875,12 @@ a.sessionView {
}
}
@media (min-width : 480px) and (max-width: 767px) {
#learning_path_breadcrumb_zone {
display: none;
visibility: hidden;
}
#touch-button{
top: 5px;
}
.sidebar-scorm{
width: 100%;
}
.content-scorm{
visibility: hidden;
}
#control-bottom.well{
padding: 10px;
}

@ -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%;
@ -266,16 +203,6 @@ See https://support.chamilo.org/issues/6976
top: 30%;
}
#touch-button{
position: fixed;
top: 40px;
left: -5px;
z-index: 2
}
.inner_lp_toc{
overflow-y:scroll;
}
.scorm-heading{
font-size: 14px;
padding-top: 5px;
@ -300,8 +227,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 +288,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 +313,205 @@ See https://support.chamilo.org/issues/6976
color: #009AB8 !important;
}
/* END SCORM CSS BASE*/
/* END SCORM CSS BASE*/
#scorm-info{
padding: 5px;
margin-bottom: 5px;
}
#scorm-info .description-autor p {
font-size: 14px;
line-height: 1.2em;
}
#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) */
#learning_path_main {
height: 100%;
margin: 0;
overflow: hidden;
position: relative;
}
#learning_path_left_zone,
#learning_path_right_zone {
bottom: 0;
box-sizing: content-box;
left: 0;
margin: 0;
padding: 0;
position: absolute;
right: 0;
top: 0;
transition-property: left width;
transition-duration: 0.5s;
}
#learning_path_left_zone .lp-view-zone-container,
#learning_path_right_zone .lp-view-zone-container {
bottom: 0;
left: 0;
padding: 5px;
position: absolute;
right: 0;
top: 0;
}
#learning_path_toc {
bottom: 5px;
left: 5px;
overflow: auto;
position: absolute;
right: 5px;
top: 100%;
transition-property: top;
transition-duration: 0.1s;
}
#learning_path_right_zone {
left: 100%;
width: 100%;
}
#lp_navigation_elem {
position: absolute;
right: 5px;
top: 40px;
width: 70%;
}
#learning_path_right_zone .lp-view-tabs .tab-content {
bottom: 5px;
left: 5px;
position: absolute;
right: 5px;
top: 95px;
}
#learning_path_right_zone .tab-pane{
height: 100%;
position: relative;
}
#learning_path_right_zone .tab-pane iframe {
border: 0 none;
height: 100%;
width: 100%;
}
#learning_path_main.lp-view-collapsed #learning_path_left_zone {
left: -100%;
}
#learning_path_main.lp-view-collapsed #learning_path_right_zone {
left: 0;
width: 100%;
}
/* Small devices (tablets, 768px and up) */
@media (min-width: 768px) {
#scorm-info{
padding: 10px;
margin-bottom: 10px;
}
#learning_path_main {
}
#learning_path_left_zone {
width: 250px;
}
#learning_path_right_zone {
left: 250px;
width: calc(100% - 250px);
}
#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 {
padding: 10px;
}
#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;
right: 5px;
}
#lp_navigation_elem {
right: 10px;
top: 45px;
width: 75%;
}
#learning_path_right_zone .lp-view-tabs .tab-content {
bottom: 10px;
right: 10px;
top: 100px;
}
#learning_path_right_zone .tab-pane{
}
#learning_path_right_zone .tab-pane iframe {
}
}
/* Medium devices (desktops, 992px and up) */
@media (min-width: 992px) {
#learning_path_left_zone {
width: 300px;
}
#learning_path_right_zone {
left: 300px;
width: calc(100% - 300px);
}
}
/* Large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
#learning_path_left_zone {
width: 350px;
}
#learning_path_right_zone {
left: 350px;
width: calc(100% - 350px);
}
}

@ -714,7 +714,7 @@ function store_forum($values, $courseInfo = array(), $returnId = false)
'forum_group_public_private'=> isset($values['public_private_group_forum_group']['public_private_group_forum']) ? $values['public_private_group_forum_group']['public_private_group_forum'] : null,
'forum_order'=> isset($new_max) ? $new_max : null,
'session_id'=> $session_id,
'lp_id' => isset($values['lp_id']) ? intval($values['lp_id']) : null
'lp_id' => isset($values['lp_id']) ? intval($values['lp_id']) : 0
];
Database::update(
@ -754,7 +754,7 @@ function store_forum($values, $courseInfo = array(), $returnId = false)
'forum_group_public_private'=> isset($values['public_private_group_forum_group']['public_private_group_forum']) ? $values['public_private_group_forum_group']['public_private_group_forum'] : null,
'forum_order'=> isset($new_max) ? $new_max : null,
'session_id'=> $session_id,
'lp_id' => isset($values['lp_id']) ? intval($values['lp_id']) : null
'lp_id' => isset($values['lp_id']) ? intval($values['lp_id']) : 0
];
$last_id = Database::insert($table_forums, $params);
if ($last_id > 0) {
@ -2376,7 +2376,7 @@ function store_thread($current_forum, $values, $courseInfo = array(), $showMessa
'thread_weight' => isset($values['weight_calification']) ? $values['weight_calification'] : '',
'thread_peer_qualify' => isset($values['thread_peer_qualify']) ? $values['thread_peer_qualify'] : '',
'session_id' => api_get_session_id(),
'lp_item_id' => isset($values['lp_item_id']) ? intval($values['lp_item_id']) : null
'lp_item_id' => isset($values['lp_item_id']) ? intval($values['lp_item_id']) : 0
]
);

@ -244,13 +244,19 @@ class Category implements GradebookItem
}
/**
* @return int
* @return null
*/
public function get_grade_model_id()
{
if ($this->grade_model_id < 0) {
return null;
}
return $this->grade_model_id;
}
/**
* @return string
*/
public function get_type()
{
return 'category';

@ -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;

@ -1,53 +0,0 @@
/* For licensing terms, see /license.txt */
/**
Learning Path minipanel - Chamilo 1.8.8
Adding mini panel to browse Learning Paths
Requirements: JQuery 1.4.4, JQuery UI 1.8.7
@author Alberto Torreblanca @albert1t0
@author Julio Montoya Cleaning/fixing code
@author Alex Aragon Cleaning/fixing code update
**/
$(document).ready(function() {
$('#touch-button').click(function() {
$('#learning_path_left_zone').toggle("slow", function(){
$('#learning_path_right_zone').toggleClass('total');
$(function(){
$('#learning_path_right_zone').slideToggle(300);
$('#control-bottom').toggle("slow");
});
});
$('#learning_path_right_zone').slideToggle(300);
var self = $(this);
self.toggleClass('show-touch');
var icon = self.children('span.fa');
if (icon.is('.fa-chevron-left')) {
icon.removeClass('fa-chevron-left').addClass('fa-chevron-right');
} else {
icon.removeClass('fa-chevron-right').addClass('fa-chevron-left');
}
});
// effects items scorm content
$('.scorm_item_normal, .scorm-previous, .scorm-next').on('click', function () {
$('#learning_path_right_zone').fadeOut('slow');
var loadLearningPathRigthZone = function () {
$('#learning_path_right_zone').fadeIn(100);
$('#learning_path_right_zone iframe').off('load', loadLearningPathRigthZone);
};
$('#learning_path_right_zone iframe').on('load', loadLearningPathRigthZone);
});
});

@ -1924,19 +1924,25 @@ class learnpath
if ($this->mode == 'fullscreen') {
$navbar = '
<div id="'.$idBar.'" class="buttons well" style="'.$display.'">
<a 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_blank" title="stats" id="stats_link"><img border="0" src="../img/btn_stats.png" title="' . get_lang('Reporting') . '"></a>
<a id="scorm-previous" href="" onClick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"><img border="0" src="../img/btn_previous.png" title="' . get_lang('ScormPrevious') . '"></a>
<a id="scorm-next" href="" onClick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next" ><img border="0" src="../img/btn_next.png" title="' . get_lang('ScormNext') . '"></a>.
<a 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_blank" title="stats" id="stats_link"><img border="0" src="../img/btn_stats.png" title="' . get_lang('Reporting') . '"></a>
<a id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"><img border="0" src="../img/btn_previous.png" title="' . get_lang('ScormPrevious') . '"></a>
<a id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next" ><img border="0" src="../img/btn_next.png" title="' . get_lang('ScormNext') . '"></a>.
<a href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode"><img border="0" src="../img/view_choose.gif" title="'.get_lang('ScormExitFullScreen').'"></a>
</div>';
} else {
$navbar = '
<div id="'.$idBar.'" class="buttons well" style="'.$display.'">
<a 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="stats" id="stats_link"><img border="0" src="../img/btn_stats.png" title="' . get_lang('Reporting') . '"></a>
<a id="scorm-previous" href="" onClick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"><img border="0" src="../img/btn_previous.png" title="' . get_lang('ScormPrevious') . '"></a>
<a id="scorm-next" href="" onClick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next" ><img border="0" src="../img/btn_next.png" title="' . get_lang('ScormNext') . '"></a>
</div>';
<span id="'.$idBar.'" class="buttons text-right">
<a class="btn btn-xs btn-link" 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="stats" id="stats_link">
<span class="fa fa-info-circle fa-3x"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
</a>
<a class="btn btn-xs btn-link" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
<span class="fa fa-chevron-circle-left fa-3x"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
</a>
<a class="btn btn-xs btn-link" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
<span class="fa fa-chevron-circle-right fa-3x"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
</a>
</span>';
}
return $navbar;
@ -3189,7 +3195,7 @@ class learnpath
$html .= '<div class="'.$style_item.' scorm_section_level_'.$item['level'].'" title="'.$description.'" >';
} else {
$html .= '<div class="'.$style_item.' scorm_item_level_'.$item['level'].' scorm_type_'.learnpath::format_scorm_type_item($item['type']).'" title="'.$description.'" >';
$html .= '<a name="atoc_'.$item['id'].'" />';
$html .= '<a name="atoc_'.$item['id'].'"></a>';
}
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 .= '<a class="items-list" href="" onClick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
$html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
}
$html .= "</div>";
@ -3230,7 +3236,7 @@ class learnpath
$gradebook = Security:: remove_XSS($_GET['gradebook']);
}
if ($this->get_lp_session_id() == api_get_session_id()) {
$html .= '<div id="actions_lp" class="actions_lp">';
$html .= '<div id="actions_lp" class="actions_lp"><hr>';
$html .= '<div class="btn-group">';
$html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=" . $this->lp_id . "' target='_parent'>" .
Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>";
@ -5650,7 +5656,7 @@ class learnpath
}
}
$delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '" onClick="return confirmation(\'' . addslashes($title) . '\');" class="btn btn-default">';
$delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '" onclick="return confirmation(\'' . addslashes($title) . '\');" class="btn btn-default">';
$delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
$delete_icon .= '</a>';
@ -10464,6 +10470,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

@ -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

@ -80,11 +80,10 @@ $my_style = $platform_theme;
$htmlHeadXtra[] = '<script type="text/javascript">
<!--
var jQueryFrameReadyConfigPath = \''.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js\';
var jQueryFrameReadyConfigPath = \''.api_get_jquery_web_path().'\';
-->
</script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js"></script>';
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) .'javascript/jquery.lp_minipanel.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$("div#log_content_cleaner").bind("click", function() {
@ -513,7 +512,7 @@ $template->assign(
Display::img(
$lpPreviewImagePath,
$_SESSION['oLP']->name,
array('class' => 'img-circle'),
[],
ICON_SIZE_BIG
)
);

@ -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('<?php echo api_get_path(WEB_AJAX_PATH) ?>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 = $('<iframe>').attr({
width:'100%',
frameborder:'0',
scrolling:'no',
tabindex:'0',
id:'chamilo-disqus',
src: '<?php echo api_get_path(WEB_CODE_PATH) ?>forum/viewthread.php?<?php echo api_get_cidreq() ?>&' + $.param({
gradebook: 0,
origin: 'learnpath',
forum: forumThreadData.forumId,
thread: forumThreadData.threadId,
posts_order: 'desc'
})
});
$('#lp-view-forum').html(forumIframe);
});
};
/**
* Save a specific item (with its interactions, if any) into the LMS through
* an AJAX call to lp_ajax_save_item.php.

@ -1,239 +1,255 @@
<div id="learning_path_main" style="width:100%; height: 100%;">
<div id="learning_path_main" class="{{ is_allowed_to_edit ? 'lp-view-include-breadcrumb' }}">
{% if is_allowed_to_edit %}
<div class="row">
<div id="learning_path_breadcrumb_zone" class="col-md-12">
{{ breadcrumb }}
</div>
<div id="learning_path_breadcrumb_zone" class="hidden-xs">
{{ breadcrumb }}
</div>
{% endif %}
<button id="touch-button" class="btn btn-default btn-lg btn-touch">
<span class="fa fa-chevron-left fa-2x" aria-hidden="true"></span><span class="sr-only">{{ 'Hide'|get_lang }}</span>
</button>
<div class="container-fluid">
<div class="row">
<div id="learning_path_left_zone" class="sidebar-scorm">
<div id="scorm-info" class="panel panel-default">
<div class="panel-heading">
<a id="ui-option">
<em id="icon-down" class="fa fa-chevron-down hidden"></em>
<em id="icon-up" class="fa fa-chevron-up"></em>
</a>
</div>
{# Author image preview #}
<div id="panel-scorm" class="panel-body">
<a href="{{ button_home_url }}" class="btn btn-primary btn-block" target="_self" onclick="javascript: window.parent.API.save_asset();">
<em class="fa fa-home"></em> {{ button_home_text }}
</a>
<div class="lp-view-zone-container">
<div id="scorm-info" class="jumbotron">
<div id="panel-scorm" class="panel-bsody">
<div class="image-avatar">
<div class="row">
{% if lp_author == '' %}
<div class="col-md-12">
<div class="text-center">
{{ lp_preview_image }}
</div>
{% else %}
<div class="col-md-4">
{{ lp_preview_image }}
</div>
<div class="col-md-8">
<div class="description-autor"> {{ lp_author }} </div>
<div class="media">
<div class="media-left">
{{ lp_preview_image }}
</div>
<div class="media-body">
<div class="description-autor"> {{ lp_author }} </div>
</div>
</div>
{% endif %}
</div>
</div>
<div id="lp_navigation_elem" class="navegation-bar">
{{ navigation_bar }}
</div>
{% if gamification_mode == 1 %}
<!--- gamification -->
<div id="scorm-gamification">
<div class="row">
<div class="col-xs-8">
{% if gamification_stars > 0 %}
{% for i in 1..gamification_stars %}
<em class="fa fa-star level"></em>
{% endfor %}
{% endif %}
{% if gamification_stars < 4 %}
{% for i in 1..4 - gamification_stars %}
<em class="fa fa-star"></em>
{% endfor %}
{% endif %}
</div>
<div class="col-xs-4 text-right">
{{ "XPoints"|get_lang|format(gamification_points) }}
</div>
{% if show_audio_player %}
<div id="lp_media_file">
{{ media_player }}
</div>
<div class="row">
<div class="col-xs-12 navegation-bar" id="lp_navigation_elem">
<div id="progress_bar">
{{ progress_bar }}
{% endif %}
{% if gamification_mode == 1 %}
<hr>
<!--- gamification -->
<div id="scorm-gamification">
<div class="row">
<div class="col-xs-6">
{% if gamification_stars > 0 %}
{% for i in 1..gamification_stars %}
<em class="fa fa-star level"></em>
{% endfor %}
{% endif %}
{% if gamification_stars < 4 %}
{% for i in 1..4 - gamification_stars %}
<em class="fa fa-star"></em>
{% endfor %}
{% endif %}
</div>
<div class="col-xs-6 text-right">
{{ "XPoints"|get_lang|format(gamification_points) }}
</div>
</div>
<div class="row">
<div class="col-xs-12 navegation-bar">
<div id="progress_bar">
{{ progress_bar }}
</div>
</div>
</div>
</div>
</div>
<!--- end gamification -->
{% else %}
<div id="progress_bar">
{{ progress_bar }}
</div>
{% endif %}
{% if show_audio_player %}
<div id="lp_media_file">
{{ media_player }}
</div>
{% endif %}
{{ teacher_toc_buttons }}
</div>
<!--- end gamification -->
{% else %}
<div id="progress_bar">
{{ progress_bar }}
</div>
{% endif %}
{{ teacher_toc_buttons }}
<hr class="visible-xs-block">
<button type="button" id="lp-view-expand-button" class="btn btn-link btn-block visible-xs-block">
<span class="fa fa-expand" aria-hidden="true"></span> {{ 'SeeContent'|get_lang }}
</button>
</div>
</div>
{# TOC layout #}
<div id="toc_id" class="scorm-body" name="toc_name">
<div class="scorm-title"> <em class="fa fa-book"></em> {{ lp_title_scorm }}</div>
<div id="learning_path_toc" class="scorm-list">
<h1 class="scorm-title">{{ lp_title_scorm }}</h1>
{{ lp_html_toc }}
</div>
</div>
{# end TOC layout #}
</div>
</div>
{# end left zone #}
{# <div id="hide_bar" class="scorm-toggle" style="display:inline-block; width: 25px; height: 1000px;"></div> #}
{# right zone #}
<div id="learning_path_right_zone" style="height:100%" class="content-scorm">
{% if lp_mode == 'fullscreen' %}
<iframe id="content_id_blank" name="content_name_blank" src="blank.php" border="0" frameborder="0" style="width: 100%; height: 100%" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
{% else %}
<iframe id="content_id" name="content_name" src="{{ iframe_src }}" border="0" frameborder="0" style="display: block; width: 100%; height: 100%" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
{% endif %}
<div id="learning_path_right_zone" class="content-scorm">
<div class="lp-view-zone-container">
<div id="lp_navigation_elem" class="navegation-bar pull-right text-right">
<a href="{{ button_home_url }}" class="btn btn-link" target="_self" onclick="javascript: window.parent.API.save_asset();">
<em class="fa fa-home fa-2x"></em> <span class="hidden-xs hidden-sm">{{ button_home_text }}</span>
</a>
<a href="#" id="lp-view-expand-toggle" class="btn btn-link" role="button">
<span class="fa fa-expand" aria-hidden="true"></span>
<span class="sr-only">{{ 'Expand'|get_lang }}</span>
</a>
{{ navigation_bar }}
</div>
<h1 class="scorm-title">{{ lp_title_scorm }}</h1>
<div class="lp-view-tabs">
<ul class="nav nav-tabs" 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 class="sr-only">{{ 'Lesson'|get_lang }}</span>
</a>
</li>
<li role="presentation">
<a href="#lp-view-forum" aria-controls="lp-view-forum" role="tab" data-toggle="tab">
<span class="fa fa-commenting-o fa-2x fa-fw" aria-hidden="true"></span><span class="sr-only">{{ 'Forum'|get_lang }}</span>
</a>
</li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="lp-view-content">
{% if lp_mode == 'fullscreen' %}
<iframe id="content_id_blank" name="content_name_blank" src="blank.php" border="0" frameborder="0" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
{% else %}
<iframe id="content_id" name="content_name" src="{{ iframe_src }}" border="0" frameborder="0" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
{% endif %}
</div>
<div role="tabpanel" class="tab-pane" id="lp-view-forum">
</div>
</div>
</div>
</div>
</div>
{# end right Zone #}
{{ navigation_bar_bottom }}
</div>
</div>
</div>
<script>
// Resize right and left pane to full height (HUB 20-05-2010).
var updateContentHeight = function () {
document.body.style.overflow = 'hidden';
var IE = window.navigator.appName.match(/microsoft/i);
/* Identified new height */
var heightControl = $('#control-bottom').height();
var heightBreadcrumb = ($('#learning_path_breadcrumb_zone').height()) ? $('#learning_path_breadcrumb_zone').height() : 0;
var heightScormInfo = $('#scorm-info').height();
var heightTop = heightScormInfo + 100;
jQuery('.scrollbar-light').scrollbar();
//heightTop = (heightTop > 300)? heightTop : 300;
var innerHeight = $(window).height();
if (innerHeight <= 640) {
$('.scrollbar-light').css('height', innerHeight - heightTop - 5 + "px");
$('#content_id').css('height', innerHeight - heightControl + "px");
} else {
$('.scrollbar-light').css('height', innerHeight - heightBreadcrumb - heightTop - 5 + "px");
$('#content_id').css('height', innerHeight - heightControl + "px");
}
//var innerHeight = (IE) ? document.body.clientHeight : window.innerHeight ;
// Loads the glossary library.
{% if glossary_extra_tools in glossary_tool_availables %}
{% if show_glossary_in_documents == 'ismanual' %}
$.frameReady(
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"},
{{ fix_link }}
]
}
);
{% elseif show_glossary_in_documents == 'isautomatic' %}
$.frameReady(
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"},
{{ fix_link }}
]
}
);
{% elseif fix_link != '' %}
$.frameReady(
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 }}"},
{{ fix_link }}
]
}
);
{% endif %}
{% endif %}
};
$(document).ready(function() {
updateContentHeight();
$('#touch-button').children().click(function(){
updateContentHeight();
});
(function () {
var LPViewUtils = {
setHeightLPToc: function () {
var scormInfoHeight = $('#scorm-info').outerHeight(true);
$(window).resize(function() {
updateContentHeight();
});
});
$('#learning_path_toc').css({
top: scormInfoHeight
});
}
};
window.onload = updateContentHeight();
window.onresize = updateContentHeight();
$(document).on('ready', function () {
$('#lp-view-expand-button, #lp-view-expand-toggle').on('click', function (e) {
e.preventDefault();
$(document).ready(function(){
$("#icon-down").click(function(){
$("#icon-up").removeClass("hidden");
$(this).addClass("hidden");
$('#learning_path_main').toggleClass('lp-view-collapsed');
$('#panel-scorm').slideDown("slow",function(){
updateContentHeight();
$('#lp-view-expand-toggle span.fa').toggleClass('fa-expand');
$('#lp-view-expand-toggle span.fa').toggleClass('fa-compress');
});
});
$("#icon-up").click(function(){
$("#icon-down").removeClass("hidden");
$(this).addClass("hidden");
$('#panel-scorm').slideUp("slow",function(){
updateContentHeight();
$('.lp-view-tabs').on('click', '.disabled', function (e) {
e.preventDefault();
});
$('a#ui-option').on('click', function (e) {
e.preventDefault();
var icon = $(this).children('.fa');
if (icon.is('.fa-chevron-up')) {
icon.removeClass('fa-chevron-up').addClass('fa-chevron-down');
return;
}
icon.removeClass('fa-chevron-down').addClass('fa-chevron-up');
});
LPViewUtils.setHeightLPToc();
$('.scorm_item_normal a, #scorm-previous, #scorm-next').on('click', function () {
$('.lp-view-tabs').fadeOut();
});
$('#learning_path_right_zone #lp-view-content iframe').on('load', function () {
$('.lp-view-tabs a[href="#lp-view-content"]').tab('show');
$('.lp-view-tabs').fadeIn();
});
loadForumThead({{ lp_id }}, {{ lp_current_item_id }});
{% if glossary_extra_tools in glossary_tool_availables %}
// Loads the glossary library.
(function () {
{% if show_glossary_in_documents == 'ismanual' %}
$.frameReady(
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"},
{{ fix_link }}
]
}
);
{% elseif show_glossary_in_documents == 'isautomatic' %}
$.frameReady(
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"},
{{ fix_link }}
]
}
);
{% elseif fix_link != '' %}
$.frameReady(
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 }}"},
{{ fix_link }}
]
}
);
{% endif %}
})();
{% endif %}
});
$(window).on('resize', function () {
LPViewUtils.setHeightLPToc();
});
});
})();
</script>

Loading…
Cancel
Save