Browse Source

Calculate stars and points when gamification is active - refs BT#9886 #TMI

Angel Fernando Quiroz Campos 9 years ago
parent
commit
95d977931a
1 changed files with 15 additions and 11 deletions
  1. 15 11
      main/newscorm/lp_view.php

+ 15 - 11
main/newscorm/lp_view.php

@@ -397,6 +397,8 @@ if ($_SESSION['oLP']->get_preview_image()) {
     $lpPreviewImagePath = $_SESSION['oLP']->get_preview_image_path();
 }
 
+$gamificationMode = api_get_setting('gamification_mode');
+
 $template = new Template('title', false, false, true, true, false);
 $template->assign('glossary_extra_tools', api_get_setting('show_glossary_in_extra_tools'));
 $template->assign(
@@ -408,10 +410,8 @@ $template->assign('jquery_web_path', api_get_jquery_web_path());
 $template->assign('jquery_ui_js_web_path', api_get_jquery_ui_js_web_path());
 $template->assign('jquery_ui_css_web_path', api_get_jquery_ui_css_web_path());
 $template->assign('is_allowed_to_edit', $is_allowed_to_edit);
-$template->assign('gamification_mode', api_get_setting('gamification_mode'));
-
+$template->assign('gamification_mode', $gamificationMode);
 $template->assign('breadcrumb', $breadcrumb);
-
 $template->assign('button_home_url', $buttonHomeUrl);
 $template->assign('button_home_text', $buttonHomeText);
 $template->assign('navigation_bar', $navigation_bar);
@@ -421,14 +421,18 @@ $template->assign('media_player', $mediaplayer);
 $template->assign('toc_list', $get_toc_list);
 $template->assign('iframe_src', $src);
 $template->assign('navigation_bar_bottom', $navigation_bar_bottom);
-$template->assign(
-    'gamification_stars',
-    $_SESSION['oLP']->getCalculateStars($sessionId)
-);
-$template->assign(
-    'gamification_points',
-    $_SESSION['oLP']->getCalculateScore($sessionId)
-);
+
+if ($gamificationMode == 1) {
+    $template->assign(
+        'gamification_stars',
+        $_SESSION['oLP']->getCalculateStars($sessionId)
+    );
+    $template->assign(
+        'gamification_points',
+        $_SESSION['oLP']->getCalculateScore($sessionId)
+    );
+}
+
 $template->assign(
     'lp_preview_image',
     Display::return_icon(