fix for outcomes service configuration on session courses

pull/4114/head
Juan Cortizas Ponte 4 years ago
parent 644b0fd259
commit 0a7d3f8c47
  1. 17
      plugin/ims_lti/admin.php
  2. 3
      plugin/ims_lti/gradebook/add_eval.php
  3. 26
      plugin/ims_lti/view/admin.tpl

@ -24,6 +24,22 @@ $criteria = Criteria::create()
$tools = $em->getRepository('ChamiloPluginBundle:ImsLti\ImsLtiTool')->matching($criteria); $tools = $em->getRepository('ChamiloPluginBundle:ImsLti\ImsLtiTool')->matching($criteria);
$categoriesGradeBook = array();
foreach($tools as $tool) {
foreach($tool->getChildren() as $childTool) {
$categories = [];
if($childTool->getSession() != null) {
$categories = Category::load(null, null, $childTool->getCourse()->getCode(), null, null, $childTool->getSession()->getId());
}
else {
$categories = Category::load(null, null, $childTool->getCourse()->getCode());
}
if ($categories != null){
array_push($categoriesGradeBook, $categories[0]);
}
}
}
$interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH).'admin/index.php', 'name' => get_lang('PlatformAdmin')]; $interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH).'admin/index.php', 'name' => get_lang('PlatformAdmin')];
$htmlHeadXtra[] = api_get_css( $htmlHeadXtra[] = api_get_css(
@ -32,6 +48,7 @@ $htmlHeadXtra[] = api_get_css(
$template = new Template($plugin->get_title()); $template = new Template($plugin->get_title());
$template->assign('tools', $tools); $template->assign('tools', $tools);
$template->assign('categories', $categoriesGradeBook);
$content = $template->fetch('ims_lti/view/admin.tpl'); $content = $template->fetch('ims_lti/view/admin.tpl');

@ -17,6 +17,7 @@ api_block_anonymous_users();
GradebookUtils::block_students(); GradebookUtils::block_students();
$select_cat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0; $select_cat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
$sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : null;
$is_allowedToEdit = $is_courseAdmin; $is_allowedToEdit = $is_courseAdmin;
$em = Database::getManager(); $em = Database::getManager();
@ -24,7 +25,7 @@ $em = Database::getManager();
$course = $em->find('ChamiloCoreBundle:Course', api_get_course_int_id()); $course = $em->find('ChamiloCoreBundle:Course', api_get_course_int_id());
$ltiToolRepo = $em->getRepository('ChamiloPluginBundle:ImsLti\ImsLtiTool'); $ltiToolRepo = $em->getRepository('ChamiloPluginBundle:ImsLti\ImsLtiTool');
$categories = Category::load(null, null, $course->getCode()); $categories = Category::load(null, null, $course->getCode(), null, null, $sessionId);
if (empty($categories)) { if (empty($categories)) {
$message = Display::return_message( $message = Display::return_message(

@ -1,6 +1,6 @@
{% import _self as table_tool %} {% import _self as table_tool %}
{% macro row_tool(tool, is_child, _p) %} {% macro row_tool(tool, is_child, categories, _p) %}
{% set url_params = {'id': tool.id}|url_encode() %} {% set url_params = {'id': tool.id}|url_encode() %}
<tr class="{{ is_child ? 'child' : '' }}"> <tr class="{{ is_child ? 'child' : '' }}">
<td {% if is_child %} colspan="2" {% endif %}> <td {% if is_child %} colspan="2" {% endif %}>
@ -40,6 +40,26 @@
</a> </a>
{% endif %} {% endif %}
{% if is_child %}
{% for category in categories %}
{% set url_eval_params = null %}
{% if tool.session is not empty %}
{% if category.get_course_code == tool.course.code and category.get_session_id == tool.session.id %}
{% set url_eval_params = {'selectcat': category.get_id, 'cidReq': tool.course.code, 'id_session': tool.session.id, 'gidReq': 0, 'gradebook': 0}|url_encode() %}
{% endif %}
{% else %}
{% if category.get_course_code == tool.course.code %}
{% set url_eval_params = {'selectcat': category.get_id, 'cidReq': tool.course.code, 'id_session': 0, 'gidReq': 0, 'gradebook': 0}|url_encode() %}
{% endif %}
{% endif %}
{% if url_eval_params is not null %}
<a href="{{ _p.web_plugin }}ims_lti/gradebook/add_eval.php?{{ url_eval_params }}">
{{ 'gradebook.png'|img(22, 'MakeQualifiable'|get_lang) }}
</a>
{% endif %}
{% endfor %}
{% endif %}
<a href="{{ _p.web_plugin }}ims_lti/edit.php?{{ url_params }}"> <a href="{{ _p.web_plugin }}ims_lti/edit.php?{{ url_params }}">
{{ 'edit.png'|img(22, 'Edit'|get_lang) }} {{ 'edit.png'|img(22, 'Edit'|get_lang) }}
</a> </a>
@ -73,9 +93,9 @@
</thead> </thead>
<tbody> <tbody>
{% for tool in tools %} {% for tool in tools %}
{{ table_tool.row_tool(tool, false, _p) }} {{ table_tool.row_tool(tool, false, categories, _p) }}
{% for child_tool in tool.getChildren %} {% for child_tool in tool.getChildren %}
{{ table_tool.row_tool(child_tool, true, _p) }} {{ table_tool.row_tool(child_tool, true, categories, _p) }}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
</tbody> </tbody>

Loading…
Cancel
Save