diff --git a/main/inc/ajax/lp.ajax.php b/main/inc/ajax/lp.ajax.php index 69392ba119..d2d073bf97 100755 --- a/main/inc/ajax/lp.ajax.php +++ b/main/inc/ajax/lp.ajax.php @@ -324,8 +324,9 @@ switch ($action) { if ($result) { echo '1'; } else { - echo '0'; + echo $lp->error; } + $lp->error = ''; exit; break; diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php index 14bada38ba..ed739ce063 100644 --- a/main/lang/english/trad4all.inc.php +++ b/main/lang/english/trad4all.inc.php @@ -8119,4 +8119,6 @@ $PendingSurveys = "Pending surveys"; $NoPendingSurveys = "No pending surveys"; $HottestSessions = "Most popular sessions"; $LPItemCanBeAccessed = "Item can be viewed - Prerequisites completed"; +$ItemXBlocksThisElement = "Item %s blocks this step"; +$YourResultAtXBlocksThisElement = "Your result at %s blocks this step"; ?> \ No newline at end of file diff --git a/main/lang/french/trad4all.inc.php b/main/lang/french/trad4all.inc.php index 4a201a2b3d..d3c0598e87 100644 --- a/main/lang/french/trad4all.inc.php +++ b/main/lang/french/trad4all.inc.php @@ -8055,5 +8055,7 @@ $DocumentXHasBeenAddedToDocumentInYourCourseXByUserX = "Un nouveau document %s a $PendingSurveys = "Enquêtes en attente"; $NoPendingSurveys = "Pas d'enquête en attente"; $HottestSessions = "Sessions les plus populaires"; -$LPItemCanBeAccessed = "Item accessible - prérequis complété"; +$LPItemCanBeAccessed = "Etape accessible"; +$ItemXBlocksThisElement = "L'absence de consultation de l'étape \"%s\" ne vous permet pas d'accéder à celle-ci"; +$YourResultAtXBlocksThisElement = "Votre score à l'étape \"%s\" ne vous permet d'accéder à celle-ci"; ?> \ No newline at end of file diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index 8772438c69..d02f767f39 100644 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -8143,4 +8143,6 @@ $PendingSurveys = "Encuestas pendientes"; $NoPendingSurveys = "Sin encuestas pendientes"; $HottestSessions = "Sesiones más populares"; $LPItemCanBeAccessed = "Item accesible - prerequisitos completados."; +$ItemXBlocksThisElement = "El item \"%s\" bloquea este paso"; +$YourResultAtXBlocksThisElement = "El resultado en el item \"%s\" bloquea esta etapa."; ?> \ No newline at end of file diff --git a/main/lp/learnpathItem.class.php b/main/lp/learnpathItem.class.php index 8f9de46f42..a1865a5513 100755 --- a/main/lp/learnpathItem.class.php +++ b/main/lp/learnpathItem.class.php @@ -2111,6 +2111,7 @@ class learnpathItem return false; } + while (strpos($prereqs_string, '(') !== false) { // Remove any () set and replace with its value. $matches = []; @@ -2435,7 +2436,7 @@ class learnpathItem } } else { // Nothing found there either. Now return the - // value of the corresponding resource completion status. + // value of the corresponding resource completion status. if (self::DEBUG > 1) { error_log( 'New LP - Didnt find any group, returning value for '.$prereqs_string, @@ -2446,12 +2447,19 @@ class learnpathItem if (isset($refs_list[$prereqs_string]) && isset($items[$refs_list[$prereqs_string]]) ) { - if ($items[$refs_list[$prereqs_string]]->type == 'quiz') { + /** @var learnpathItem $itemToCheck */ + $itemToCheck = $items[$refs_list[$prereqs_string]]; + if ($itemToCheck->type == 'quiz') { // 1. Checking the status in current items. - $status = $items[$refs_list[$prereqs_string]]->get_status(true); + $status = $itemToCheck->get_status(true); $returnstatus = $status == $this->possible_status[2] || $status == $this->possible_status[3]; if (!$returnstatus) { + $explanation = sprintf( + get_lang('ItemXBlocksThisElement'), + $itemToCheck->get_title() + ); + $this->prereq_alert = $explanation; if (self::DEBUG > 1) { error_log( 'New LP - Prerequisite '.$prereqs_string.' not complete', @@ -2494,7 +2502,11 @@ class learnpathItem ) { $returnstatus = true; } else { - $this->prereq_alert = get_lang('LearnpathPrereqNotCompleted'); + $explanation = sprintf( + get_lang('YourResultAtXBlocksThisElement'), + $itemToCheck->get_title() + ); + $this->prereq_alert = $explanation; $returnstatus = false; } } else { @@ -2504,14 +2516,16 @@ class learnpathItem ) { $returnstatus = true; } else { - $this->prereq_alert = get_lang('LearnpathPrereqNotCompleted'); + $explanation = sprintf( + get_lang('YourResultAtXBlocksThisElement'), + $itemToCheck->get_title() + ); + $this->prereq_alert = $explanation; $returnstatus = false; } } } else { - $this->prereq_alert = get_lang( - 'LearnpathPrereqNotCompleted' - ); + $this->prereq_alert = get_lang('LearnpathPrereqNotCompleted'); $returnstatus = false; } } @@ -2538,7 +2552,11 @@ class learnpathItem $returnstatus = true; break; } else { - $this->prereq_alert = get_lang('LearnpathPrereqNotCompleted'); + $explanation = sprintf( + get_lang('YourResultAtXBlocksThisElement'), + $itemToCheck->get_title() + ); + $this->prereq_alert = $explanation; $returnstatus = false; } } else { @@ -2546,26 +2564,27 @@ class learnpathItem $returnstatus = true; break; } else { - $this->prereq_alert = get_lang( - 'LearnpathPrereqNotCompleted' - ); + $this->prereq_alert = get_lang('LearnpathPrereqNotCompleted'); $returnstatus = false; } } } } else { - $this->prereq_alert = get_lang( - 'LearnpathPrereqNotCompleted' - ); + $this->prereq_alert = get_lang('LearnpathPrereqNotCompleted'); $returnstatus = false; } } return $returnstatus; } else { - $status = $items[$refs_list[$prereqs_string]]->get_status(false); + $status = $itemToCheck->get_status(false); $returnstatus = $status == $this->possible_status[2] || $status == $this->possible_status[3]; if (!$returnstatus) { + $explanation = sprintf( + get_lang('ItemXBlocksThisElement'), + $itemToCheck->get_title() + ); + $this->prereq_alert = $explanation; if (self::DEBUG > 1) { error_log( 'New LP - Prerequisite '.$prereqs_string.' not complete', @@ -2689,16 +2708,13 @@ class learnpathItem $status = $items[$refs_list[$list[0]]]->get_status(true); $returnstatus = $status == 'completed' || $status == 'passed'; if (!$returnstatus && empty($this->prereq_alert)) { - $this->prereq_alert = get_lang( - 'LearnpathPrereqNotCompleted' - ); + $this->prereq_alert = get_lang('LearnpathPrereqNotCompleted'); } return $returnstatus; } } } - if (empty($this->prereq_alert)) { $this->prereq_alert = get_lang('LearnpathPrereqNotCompleted'); } diff --git a/main/lp/lp_view.php b/main/lp/lp_view.php index e32e0e6780..18252f4d27 100755 --- a/main/lp/lp_view.php +++ b/main/lp/lp_view.php @@ -131,7 +131,7 @@ $(document).ready(function() { $("div#log_content").empty(); }); - $(".scorm_item_normal").qtip({ + $(".scorm_item_normal").qtip({ content: { text: function(event, api) { var item = $(this); @@ -144,13 +144,14 @@ $(document).ready(function() { async: false }) .then(function(content) { - if (content == 0) { - textToShow = "'.addslashes(get_lang('LearnpathPrereqNotCompleted')).'"; - } else { + if (content == 1) { textToShow = "'.addslashes(get_lang('LPItemCanBeAccessed')).'"; - } - // Set the tooltip content upon successful retrieval - //api.set(\'content.text\', "content"); + api.set("style.classes", "qtip-green qtip-shadow"); + } else { + textToShow = content; + api.set("style.classes", "qtip-red qtip-shadow"); + } + return textToShow; }); return textToShow;