Internal: Fix LP edition

pull/3466/head
Julio Montoya 4 years ago
parent 7e3b7b250d
commit b3fea89f2a
  1. 15
      public/main/inc/lib/pear/HTML/QuickForm.php
  2. 21
      public/main/lp/lp_list.php
  3. 2
      public/main/lp/lp_view.php
  4. 1
      src/CoreBundle/Entity/Listener/CourseListener.php
  5. 1
      src/CoreBundle/EventListener/TwigListener.php
  6. 2
      src/CoreBundle/Resources/views/Course/home.html.twig
  7. 8
      src/CoreBundle/Resources/views/Layout/blank.html.twig
  8. 8
      src/CoreBundle/Resources/views/Layout/blank_no_header.html.twig
  9. 2
      src/CoreBundle/Resources/views/Layout/head.html.twig
  10. 10
      src/CoreBundle/Resources/views/LearnPath/scorm_list.html.twig
  11. 12
      src/CoreBundle/Resources/views/LearnPath/view.html.twig
  12. 2
      src/CoreBundle/ToolChain.php

@ -387,6 +387,21 @@ class HTML_QuickForm extends HTML_Common
}
}
/**
* @param string $elementName
* @param string $defaultValue
*/
public function setDefault($elementName, $defaultValue)
{
if (!$this->elementExists($elementName)) {
throw new \Exception('Element does not exists');
}
$element = $this->getElement($elementName);
$this->_defaultValues[$elementName] = $defaultValue;
$element->onQuickFormEvent('updateValue', null, $this);
}
/**
* Initializes constant form values.
* These values won't get overridden by POST or GET vars

@ -68,6 +68,15 @@ $introduction = Display::return_introduction_section(
$message = '';
$actions = '';
$allowCategory = true;
if (!empty($sessionId)) {
$allowCategory = false;
if (api_get_configuration_value('allow_session_lp_category')) {
$allowCategory = true;
}
}
if ($is_allowed_to_edit) {
$actionLeft = '';
$actionLeft .= Display::url(
@ -101,7 +110,7 @@ if ($is_allowed_to_edit) {
);
}
if (!$sessionId) {
if ($allowCategory) {
$actionLeft .= Display::url(
Display::return_icon(
'new_folder.png',
@ -130,14 +139,14 @@ if ($allowCategory) {
}
}
$categoriesTempList = learnpath::getCategories($courseId);
$categoriesTempList = $newCategoryFiltered;
}
$categoryTest = new CLpCategory();
$categoryTest->setId(0);
$categoryTest->setName(get_lang('Without category'));
$categoryTest->setName(get_lang('WithOutCategory'));
$categoryTest->setPosition(0);
$categories = [
$categoryTest,
];
$categories = [$categoryTest];
if (!empty($categoriesTempList)) {
$categories = array_merge($categories, $categoriesTempList);

@ -568,7 +568,9 @@ $template->assign('lp_mode', $lp->mode);
$template->assign('lp_title_scorm', $lp->get_name());
if (api_get_configuration_value('lp_view_accordion') === true && $lpType == 1) {
$template->assign('data_panel', $lp->getTOCTree());
$template->assign('data_list', null);
} else {
$template->assign('data_panel', null);
$template->assign('data_list', $lp->getListArrayToc($get_toc_list));
}
$template->assign('lp_id', $lp->lp_id);

@ -10,7 +10,6 @@ use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Manager\SettingsManager;
use Chamilo\CoreBundle\Repository\CourseRepository;
use Chamilo\CoreBundle\ToolChain;
use Chamilo\CourseBundle\Repository\CToolRepository;
use Doctrine\ORM\Event\LifecycleEventArgs;
/**

@ -42,6 +42,7 @@ class TwigListener
}
}
$this->twig->addGlobal('text_direction', api_get_text_direction());
$this->twig->addGlobal('from_vue', $request->request->get('from_vue') ? 1 : 0);
$this->twig->addGlobal('is_authenticated', json_encode($isAuth));
$this->twig->addGlobal('user_json', $data ?? json_encode($data));

@ -99,7 +99,7 @@
url('chamilo_core_resource_view_file', {
'id': shortcut.shortCutNode.id,
'cid': course.id,
'sid': session.id,
'sid': session ? session.id : 0,
'type' : shortcut.shortCutNode.resourceType,
'tool' : shortcut.shortCutNode.resourceType.tool,
})

@ -1,8 +1,8 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="{{document_language}}" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="{{document_language}}" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="{{document_language}}" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--><html lang="{{document_language}}" class="no-js"> <!--<![endif]-->
<!--[if lt IE 7]> <html lang="{{app.request.locale}}" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="{{app.request.locale}}" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="{{app.request.locale}}" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--><html lang="{{app.request.locale}}" class="no-js"> <!--<![endif]-->
<head>
{% include "@ChamiloCore/Layout/head.html.twig" %}
</head>

@ -1,8 +1,8 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="{{document_language}}" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="{{document_language}}" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="{{document_language}}" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--><html lang="{{document_language}}" class="no-js"> <!--<![endif]-->
<!--[if lt IE 7]> <html lang="{{app.request.locale}}" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="{{app.request.locale}}" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="{{app.request.locale}}" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--><html lang="{{app.request.locale}}" class="no-js"> <!--<![endif]-->
<head>
</head>
{% autoescape false %}

@ -29,7 +29,7 @@
{# Files app.css is generated from "assets/css/app.scss" file using the file webpack.config.js #}
<link rel="stylesheet" href="{{ url('home') ~ 'build/css/app.css' }}"/>
{# {{ encore_entry_link_tags('app') }}#}
{% if theme %}
{% if theme is defined %}
<link rel="stylesheet" href="{{ url('home') ~ 'build/css/themes/'~ theme ~'/default.css' }}"/>
{% endif %}
<link rel="stylesheet" media="print" href="{{ url('home') ~ 'build/css/print.css' }}"/>

@ -38,12 +38,12 @@
{% macro tree(item) %}
{% import _self as self %}
<div id="item_{{ item.id }}"
<div id="toc_{{ item.id }}"
class="panel panel-default
{{ item.parent_id ? 'child_item':'root_item' }}
lp_item_type_{{ item.type|replace({' ': '_'}) }}
{{ item.status_css_class_name }}
{{ item.is_current ? 'current_item' : '' }}
{{ item.is_current ? 'current_item scorm_highlight' : '' }}
{{ item.is_parent_of_current ? 'parent_of_current_item' : '' }}
{{ item.is_chapter ? 'chapter' : '' }}
"
@ -55,7 +55,7 @@
<a class="item-header" role="button"
data-toggle="collapse" data-parent="#toc_{{ item.parent_id }}"
href="#toc_{{ item.id }}"
aria-expanded="true" aria-controls="toc_{{ item.id }}">
aria-expanded="true" aria-controls="tocchildren_{{ item.id }}">
{{ item.title }}
</a>
{% else %}
@ -68,7 +68,7 @@
</div>
</div>
{% if item.children|length %}
<div id="toc_{{ item.id }}"
<div id="tocchildren_{{ item.id }}"
class="panel-collapse collapse {{ item.is_parent_of_current ? 'in' : '' }}"
role="tabpanel"
aria-labelledby="heading_item_{{item.id}}">
@ -83,7 +83,7 @@
{% endmacro %}
{% from _self import tree %}
<div id="toc_" class="panel-group" role="tablist" aria-multiselectable="true">
<div id="tocchildren_" class="panel-group" role="tablist" aria-multiselectable="true">
{% for item in data_panel %}
{{ tree(item) }}
{% endfor %}

@ -142,6 +142,8 @@
</div>
{# TOC layout #}
<div id="toc_id" class="scorm-body" name="toc_name">
{# div#flab-mobile is to know when the user is on mobile view. Don't delete. #}
<div id="flag-mobile" class="visible-xs-block" aria-hidden="true"></div>
{% include '@ChamiloCore/LearnPath/scorm_list.html.twig' %}
</div>
{# end TOC layout #}
@ -302,6 +304,16 @@
$('.lp-view-tabs').animate({opacity: 1}, 500);
});
{% if lp_mode == 'embedded' %}
$('.scorm_item_normal a, #scorm-previous, #scorm-next').on('click', function () {
$('.lp-view-tabs').animate({opacity: 0}, 500);
if ($('#flag-mobile').is(':visible') && !$('#learning_path_main').is('.lp-view-collapsed')) {
$('#lp-view-expand-toggle').trigger('click');
}
});
{% endif %}
loadForumThread({{ lp_id }}, {{ lp_current_item_id }});
checkCurrentItemPosition({{ lp_current_item_id }});

@ -5,7 +5,6 @@
namespace Chamilo\CoreBundle;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\ResourceLink;
use Chamilo\CoreBundle\Entity\ResourceType;
use Chamilo\CoreBundle\Entity\Tool;
use Chamilo\CoreBundle\Entity\ToolResourceRight;
@ -13,7 +12,6 @@ use Chamilo\CoreBundle\Manager\SettingsManager;
use Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter;
use Chamilo\CoreBundle\Tool\AbstractTool;
use Chamilo\CourseBundle\Entity\CTool;
use Chamilo\CourseBundle\Repository\CToolRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
use Symfony\Component\Security\Core\Security;

Loading…
Cancel
Save