diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index f565f954f8..23ae197c95 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -1,6 +1,9 @@ twig: debug: '%kernel.debug%' - paths: ['%kernel.project_dir%/var/templates', '%kernel.project_dir%/public/main/template/', '%kernel.project_dir%/public/plugin/'] + paths: + - '%kernel.project_dir%/var/templates' + - '%kernel.project_dir%/public/main/template' + - '%kernel.project_dir%/public/plugin' form_themes: - 'bootstrap_4_layout.html.twig' - '@SonataFormatter/Form/formatter.html.twig' diff --git a/public/main/group/group_creation.php b/public/main/group/group_creation.php index 2ab361edf8..92cf1dd1f0 100644 --- a/public/main/group/group_creation.php +++ b/public/main/group/group_creation.php @@ -245,7 +245,7 @@ EOT; $create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq()); $create_groups_form->addElement('header', $nameTools); $create_groups_form->addText('number_of_groups', get_lang('Number of groups to create'), null, ['value' => '1']); - $create_groups_form->addButton('submit', get_lang('ProceedToCreate group(s)'), 'plus', 'primary'); + $create_groups_form->addButton('submit', get_lang('Proceed to create group(s)'), 'plus', 'primary'); $defaults = []; $defaults['number_of_groups'] = 1; $create_groups_form->setDefaults($defaults); diff --git a/public/main/inc/lib/link.lib.php b/public/main/inc/lib/link.lib.php index 18d31efcc6..dc91ab990e 100644 --- a/public/main/inc/lib/link.lib.php +++ b/public/main/inc/lib/link.lib.php @@ -1,4 +1,5 @@ $max_display_order, 'on_homepage' => $values['on_homepage'], 'target' => $values['target'], - 'category_id' => $values['category_id'], ]; Database::update( @@ -747,7 +745,7 @@ class Link extends Model { $table = Database::get_course_table(TABLE_LINK_CATEGORY); $course_id = api_get_course_int_id(); - $id = intval($id); + $id = (int) $id; // This is used to put the modified info of the category-form into the database. $params = [ @@ -1623,7 +1621,7 @@ Do you really want to delete this category and its links ?')."')) return false;\ $form->addText('url', 'URL'); $form->addRule('url', get_lang('Please give the link URL, it should be valid.'), 'url'); $form->addText('title', get_lang('LinksName')); - $form->addHtmlEditor('description', get_lang('Description'), true, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']); + $form->addHtmlEditor('description', get_lang('Description'), false, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']); $resultcategories = self::getLinkCategories($course_id, $session_id); $options = ['0' => '--']; diff --git a/public/main/link/link.php b/public/main/link/link.php index 64514305f0..abfe7e47ff 100644 --- a/public/main/link/link.php +++ b/public/main/link/link.php @@ -45,9 +45,7 @@ $id = !empty($_REQUEST['id']) ? $_REQUEST['id'] : ''; $action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : ''; $nameTools = get_lang('Links'); - $course_id = api_get_course_int_id(); -// Condition for the session $session_id = api_get_session_id(); if ('addlink' === $action) { diff --git a/public/main/work/edit_work.php b/public/main/work/edit_work.php index 277194b5a5..b84510a69e 100644 --- a/public/main/work/edit_work.php +++ b/public/main/work/edit_work.php @@ -116,14 +116,8 @@ if ($form->validate()) { } $workId = $params['work_id']; - $editCheck = false; $workData = get_work_data_by_id($workId); - - if (!empty($workData)) { - $editCheck = true; - } else { - $editCheck = true; - } + $editCheck = true; if ($editCheck) { updateWork($workData['iid'], $params, $courseInfo, $sessionId); diff --git a/public/main/work/work.lib.php b/public/main/work/work.lib.php index 448d7f40bb..08e88725b7 100644 --- a/public/main/work/work.lib.php +++ b/public/main/work/work.lib.php @@ -136,6 +136,10 @@ function get_work_data_by_id($id, $courseId = 0, $sessionId = 0) if ($studentPublication) { $workId = $studentPublication->getIid(); $work['id'] = $workId; + $work['iid'] = $workId; + + $work['description'] = $studentPublication->getDescription(); + $work['url'] = $studentPublication->getUrl(); $work['active'] = $studentPublication->getActive(); $work['allow_text_assignment'] = $studentPublication->getAllowTextAssignment(); $work['c_id'] = $studentPublication->getCId(); @@ -143,7 +147,6 @@ function get_work_data_by_id($id, $courseId = 0, $sessionId = 0) $work['parent_id'] = $studentPublication->getParentId(); $work['qualification'] = $studentPublication->getQualification(); $work['contains_file'] = $studentPublication->getContainsFile(); - $work['title'] = $studentPublication->getTitle(); if (empty($studentPublication->getTitle())) { $work['title'] = basename($studentPublication->getUrl()); @@ -4353,7 +4356,7 @@ function updateWork($workId, $params, $courseInfo, $sessionId = 0) $filteredParams = [ 'description' => $params['description'], 'qualification' => $params['qualification'], - 'weight' => $params['weight'], + 'weight' => (float) $params['weight'], 'allow_text_assignment' => $params['allow_text_assignment'], ]; diff --git a/tests/behat/features/toolWork.feature b/tests/behat/features/toolWork.feature index c2daacd2a3..c6fcfc7e8a 100644 --- a/tests/behat/features/toolWork.feature +++ b/tests/behat/features/toolWork.feature @@ -34,8 +34,8 @@ Feature: Work tool Then I follow "Upload my assignment" Then I should see "Upload a document" Then I follow "Upload (Simple)" - Then I should see "File extension" - Then I attach the file "/public/favicon.ico" to "file" + #Then I should see "File extension" + Then I attach the file "/public/favicon.ico" to "file_upload" And I press "Upload" And wait for the page to be loaded Then I should see "The file has been added to the list of publications"