From 6f3ca31e9068fc88475ab42d76c9fbea01bcd092 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 11 Sep 2020 14:40:19 +0200 Subject: [PATCH] Internal: Flint fixes --- .../admin/teachers_time_by_session_report.php | 1 - public/main/course_home/redirect.php | 1 - .../main/exercise/oral_expression.class.php | 2 + public/main/forum/forumfunction.inc.php | 4 +- public/main/inc/lib/course.lib.php | 46 +++++++++---------- public/main/inc/lib/groupmanager.lib.php | 2 - public/main/work/upload_corrections.php | 1 - .../views/Layout/base-layout.html.twig | 10 ++-- 8 files changed, 31 insertions(+), 36 deletions(-) diff --git a/public/main/admin/teachers_time_by_session_report.php b/public/main/admin/teachers_time_by_session_report.php index 71a9595458..f1db4cf76e 100644 --- a/public/main/admin/teachers_time_by_session_report.php +++ b/public/main/admin/teachers_time_by_session_report.php @@ -3,7 +3,6 @@ use Chamilo\CoreBundle\Entity\Session; use Chamilo\CoreBundle\Framework\Container; -use Chamilo\CourseBundle\Repository\CStudentPublicationRepository; use Doctrine\Common\Collections\Criteria; /** diff --git a/public/main/course_home/redirect.php b/public/main/course_home/redirect.php index 41fcf6b41a..29bdeee944 100644 --- a/public/main/course_home/redirect.php +++ b/public/main/course_home/redirect.php @@ -29,5 +29,4 @@ if (!empty($courseCode)) { } } - api_not_allowed(true); diff --git a/public/main/exercise/oral_expression.class.php b/public/main/exercise/oral_expression.class.php index fe128ca402..72d71925df 100644 --- a/public/main/exercise/oral_expression.class.php +++ b/public/main/exercise/oral_expression.class.php @@ -183,7 +183,9 @@ class OralExpression extends Question /** * Get the URL for the audio file. Return null if the file doesn't exists. + * * @todo fix path + * * @param bool $loadFromDatabase * * @return string diff --git a/public/main/forum/forumfunction.inc.php b/public/main/forum/forumfunction.inc.php index 27a7694196..cba7a4a155 100644 --- a/public/main/forum/forumfunction.inc.php +++ b/public/main/forum/forumfunction.inc.php @@ -549,7 +549,6 @@ function forumForm(CForumForum $forum = null, $lp_id) function delete_forum_image($forum_id) { throw new Exception('delete_forum_image'); - /*$table_forums = Database::get_course_table(TABLE_FORUM); $course_id = api_get_course_int_id(); $forum_id = (int) $forum_id; @@ -795,7 +794,6 @@ function store_forum($values, $courseInfo = [], $returnId = false) if (isset($upload_ok)) { if ($has_attachment) { throw new Exception('$has_attachment'); - /*$course_dir = $courseInfo['path'].'/upload/forum/images'; $sys_course_path = api_get_path(SYS_COURSE_PATH); $updir = $sys_course_path.$course_dir; @@ -1109,7 +1107,7 @@ function delete_post($post_id) * @param int $thread_id id of the thread we want to know the last post of * * @return array an array or bool if there is a last post found, false if there is - * no post entry linked to that thread => thread will be deleted + * no post entry linked to that thread => thread will be deleted * * @author Patrick Cool , Ghent University * diff --git a/public/main/inc/lib/course.lib.php b/public/main/inc/lib/course.lib.php index 9ad8e8626d..e843ada7db 100644 --- a/public/main/inc/lib/course.lib.php +++ b/public/main/inc/lib/course.lib.php @@ -2468,29 +2468,29 @@ class CourseManager $groupList[$group['iid']] = $group; } - /* 0 != $session_id ? $session_condition = ' WHERE g.session_id IN(1,'.intval($session_id).')' : $session_condition = ' WHERE g.session_id = 0'; - if (0 == $in_get_empty_group) { - // get only groups that are not empty - $sql = "SELECT DISTINCT g.iid, g.name - FROM ".Database::get_course_table(TABLE_GROUP)." AS g - INNER JOIN ".Database::get_course_table(TABLE_GROUP_USER)." gu - ON (g.iid = gu.group_id) - $session_condition - ORDER BY g.name"; - } else { - // get all groups even if they are empty - $sql = "SELECT g.iid, g.name - FROM ".Database::get_course_table(TABLE_GROUP)." AS g - $session_condition - AND c_id = $course_id"; - } - - $result = Database::query($sql); - $groupList = []; - while ($groupData = Database::fetch_array($result)) { - $groupData['userNb'] = GroupManager::number_of_students($groupData['iid'], $course_id); - $groupList[$groupData['iid']] = $groupData; - }*/ + /* 0 != $session_id ? $session_condition = ' WHERE g.session_id IN(1,'.intval($session_id).')' : $session_condition = ' WHERE g.session_id = 0'; + if (0 == $in_get_empty_group) { + // get only groups that are not empty + $sql = "SELECT DISTINCT g.iid, g.name + FROM ".Database::get_course_table(TABLE_GROUP)." AS g + INNER JOIN ".Database::get_course_table(TABLE_GROUP_USER)." gu + ON (g.iid = gu.group_id) + $session_condition + ORDER BY g.name"; + } else { + // get all groups even if they are empty + $sql = "SELECT g.iid, g.name + FROM ".Database::get_course_table(TABLE_GROUP)." AS g + $session_condition + AND c_id = $course_id"; + } + + $result = Database::query($sql); + $groupList = []; + while ($groupData = Database::fetch_array($result)) { + $groupData['userNb'] = GroupManager::number_of_students($groupData['iid'], $course_id); + $groupList[$groupData['iid']] = $groupData; + }*/ return $groupList; } diff --git a/public/main/inc/lib/groupmanager.lib.php b/public/main/inc/lib/groupmanager.lib.php index e02638a300..65d05da01f 100644 --- a/public/main/inc/lib/groupmanager.lib.php +++ b/public/main/inc/lib/groupmanager.lib.php @@ -68,7 +68,6 @@ class GroupManager } /** - * * @param int $courseId * * @return array @@ -82,7 +81,6 @@ class GroupManager return $qb->getQuery()->getArrayResult(); - $table_group = Database::get_course_table(TABLE_GROUP); $courseId = !empty($courseId) ? (int) $courseId : api_get_course_int_id(); diff --git a/public/main/work/upload_corrections.php b/public/main/work/upload_corrections.php index 22a6a3dcd9..a60e0ad7df 100644 --- a/public/main/work/upload_corrections.php +++ b/public/main/work/upload_corrections.php @@ -103,7 +103,6 @@ if ($form->validate()) { } throw new Exception('upload corrections'); - /*$folder = api_get_unique_id(); $destinationDir = api_get_path(SYS_ARCHIVE_PATH).$folder; mkdir($destinationDir, api_get_permissions_for_new_directories(), true); diff --git a/src/CoreBundle/Resources/views/Layout/base-layout.html.twig b/src/CoreBundle/Resources/views/Layout/base-layout.html.twig index 2df50c8fb4..a371d4e47c 100644 --- a/src/CoreBundle/Resources/views/Layout/base-layout.html.twig +++ b/src/CoreBundle/Resources/views/Layout/base-layout.html.twig @@ -8,11 +8,11 @@ {% if not from_vue %} - {% block chamilo_head %} - - {% include "@ChamiloCore/Layout/head.html.twig" %} - - {% endblock %} +{% block chamilo_head %} + +{% include "@ChamiloCore/Layout/head.html.twig" %} + +{% endblock %}