Minor - fix tpls

pull/3890/head
Julio Montoya 4 years ago
parent 6b3fc8af1b
commit 47fa42613f
  1. 106
      public/main/inc/lib/auth.lib.php
  2. 4
      public/main/inc/lib/template.lib.php
  3. 5
      src/CoreBundle/Resources/views/Admin/Settings/default.html.twig
  4. 13
      src/CoreBundle/Resources/views/Layout/base-layout.html.twig
  5. 3
      src/CoreBundle/Resources/views/Layout/layout_one_col.html.twig
  6. 4
      src/CoreBundle/Resources/views/Layout/vue_setup.html.twig

@ -57,112 +57,6 @@ class Auth
return $data;
}
/**
* stores the changes in a course category
* (moving a course to a different course category).
*
* @param int $courseId
* @param int Category id
*
* @return bool True if it success
*/
public function updateCourseCategory($courseId, $newcategory)
{
$courseId = (int) $courseId;
$newcategory = (int) $newcategory;
$current_user = api_get_user_id();
$table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$max_sort_value = api_max_sort_value($newcategory, $current_user);
$sql = "UPDATE $table SET
user_course_cat='".$newcategory."',
sort='".($max_sort_value + 1)."'
WHERE
c_id ='".$courseId."' AND
user_id='".$current_user."' AND
relation_type<>".COURSE_RELATION_TYPE_RRHH;
$resultQuery = Database::query($sql);
$result = false;
if (Database::affected_rows($resultQuery)) {
$result = true;
}
return $result;
}
/**
* moves the course one place up or down.
*
* @param string Direction (up/down)
* @param string Course code
* @param int Category id
*
* @return bool True if it success
*/
public function move_course($direction, $course2move, $category)
{
$table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$current_user_id = api_get_user_id();
$all_user_courses = CourseManager::getCoursesByUserCourseCategory($current_user_id);
// we need only the courses of the category we are moving in
$user_courses = [];
foreach ($all_user_courses as $key => $course) {
if ($course['user_course_category'] == $category) {
$user_courses[] = $course;
}
}
$target_course = [];
foreach ($user_courses as $count => $course) {
if ($course2move == $course['code']) {
// source_course is the course where we clicked the up or down icon
$source_course = $course;
// target_course is the course before/after the source_course (depending on the up/down icon)
if ('up' == $direction) {
$target_course = $user_courses[$count - 1];
} else {
$target_course = $user_courses[$count + 1];
}
break;
}
}
$result = false;
if (count($target_course) > 0 && count($source_course) > 0) {
$courseInfo = api_get_course_info($source_course['code']);
$courseId = $courseInfo['real_id'];
$targetCourseInfo = api_get_course_info($target_course['code']);
$targetCourseId = $targetCourseInfo['real_id'];
$sql = "UPDATE $table
SET sort='".$target_course['sort']."'
WHERE
c_id = '".$courseId."' AND
user_id = '".$current_user_id."' AND
relation_type<>".COURSE_RELATION_TYPE_RRHH;
$result1 = Database::query($sql);
$sql = "UPDATE $table SET sort='".$source_course['sort']."'
WHERE
c_id ='".$targetCourseId."' AND
user_id='".$current_user_id."' AND
relation_type<>".COURSE_RELATION_TYPE_RRHH;
$result2 = Database::query($sql);
if (Database::affected_rows($result1) && Database::affected_rows($result2)) {
$result = true;
}
}
return $result;
}
/**
* unsubscribe the user from a given course.
*

@ -616,10 +616,6 @@ class Template
}
}
if (CHAMILO_LOAD_WYSIWYG === true) {
$bowerJsFiles[] = 'ckeditor/ckeditor.js';
}
if ('true' === api_get_setting('include_asciimathml_script')) {
$bowerJsFiles[] = 'MathJax/MathJax.js?config=TeX-MML-AM_HTMLorMML';
}

@ -3,13 +3,14 @@
{% set namespace = app.request.get('namespace') %}
{% block content %}
<div class="flex ">
<div class="flex">
<div class="w-1/5">
{% include '@ChamiloCore/Admin/Settings/menu.html.twig' %}
</div>
<div class="w-4/5">
<div class="q-card p-4">
<form class="w-full "
<form class="w-full form-horizontal"
action="{{ path('chamilo_platform_settings_search', {'keyword': keyword}) }}"
method="post"
>

@ -13,20 +13,17 @@
{%- include "@ChamiloCore/Layout/head.html.twig" %}
</head>
{% endblock %}
<body
class="font-sans antialiased {{ section_name }}"
data-course-id="{{ course ? course.id : 0 }}"
data-course-code="{{ course ? course.code : '' }}"
data-session-id="{{ session ? session.id : 0 }}"
>
<noscript>{{ "Your browser does not support Javascript" | trans }}</noscript>
<body class="font-sans antialiased {{ section_name }}">
{# data-course-id="{{ course ? course.id : 0 }}"#}
{# data-course-code="{{ course ? course.code : '' }}"#}
{# data-session-id="{{ session ? session.id : 0 }}"#}
<noscript>{{ "Your browser does not support Javascript" | trans }}</noscript>
{%- block chamilo_wrap -%}
{%- block page_content %}
{% endblock %}
{% endblock -%}
{%- block chamilo_footer -%}
{% endblock -%}
{#<script src="{{ url('home') ~ 'build/vue.js' }}"></script>#}
</body>
</html>
{% else %}

@ -1,7 +1,6 @@
{% extends '@ChamiloCore/Layout/base-layout.html.twig' %}
{%- block page_content %}
{% if from_vue %}
{# <script src="{{ url('home') ~ 'build/libs/ckeditor/ckeditor.js' }}"></script>#}
<script src="{{ url('home') ~ 'build/runtime.js' }}"></script>
<script src="{{ url('home') ~ 'build/app.js' }}"></script>
<link rel="stylesheet" href="{{ url('home') ~ 'build/css/app.css' }}"/>
@ -43,7 +42,7 @@
{%- autoescape %}
{% if not from_vue %}
{% include '@ChamiloCore/Layout/vue_setup.html.twig' %}
{%- include '@ChamiloCore/Layout/vue_setup.html.twig' %}
{% endif %}
{% endautoescape -%}

@ -1,6 +1,6 @@
<script>
window.user = {{ user_json | raw }};
window.userAvatar = '{{ user_avatar }}';
window.user = {{ user_json | raw }};
window.userAvatar = '{{ user_avatar }}';
</script>
<div
id="app"

Loading…
Cancel
Save