Fix calculate stars and score on LP View - refs BT#9901 #TMI

Angel Fernando Quiroz Campos 10 years ago
parent 20e1524cba
commit a9cf94eb16
  1. 15
      main/newscorm/lp_view.php
  2. 13
      main/template/games/learnpath/view.tpl

@ -32,6 +32,7 @@ $show_learnpath = true;
api_protect_course_script();
$lp_id = intval($_GET['lp_id']);
$sessionId = api_get_session_id();
// Check if the learning path is visible for student - (LP requisites)
@ -51,7 +52,7 @@ $visibility = api_get_item_visibility(
$lp_id,
$action,
api_get_user_id(),
api_get_session_id()
$sessionId
);
if (!api_is_allowed_to_edit(false, true, false, false) && intval($visibility) == 0) {
api_not_allowed(true);
@ -401,7 +402,17 @@ $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'));
if (api_get_setting('gamification_mode') == '1') {
$template->assign(
'gamification_stars',
$_SESSION['oLP']->getCalculateStars($sessionId)
);
$template->assign(
'gamification_score',
$_SESSION['oLP']->getCalculateScore($sessionId)
);
}
$template->assign('breadcrumb', $breadcrumb);

@ -79,23 +79,22 @@
<div id="panel-scorm" class="panel-body">
<div id="lp_navigation_elem" class="navegation-bar">
<div class="ranking-scorm">
{% if gamification_mode == 1 %}
{% if gamification_stars and gamification_score %}
<div class="row">
<div class="col-md-7">
{% set lp_stars = oLP.getCalculateStars() %}
{% if lp_stars > 0%}
{% for i in 1..lp_stars %}
{% if gamification_stars > 0%}
{% for i in 1..gamification_stars %}
<i class="fa fa-star"></i>
{% endfor %}
{% endif %}
{% if lp_stars < 4 %}
{% for i in 1..4 - lp_stars %}
{% if gamification_stars < 4 %}
{% for i in 1..4 - gamification_stars %}
<i class="fa fa-star plomo"></i>
{% endfor %}
{% endif %}
</div>
<div class="col-md-5 text-points">
{{ "XPoints"|get_lang|format(oLP.getCalculateScore()) }}
{{ "XPoints"|get_lang|format(gamification_score) }}
</div>
</div>
{% endif %}

Loading…
Cancel
Save