Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions public/main/forum/editthread.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,13 @@ function setFocus() {

if ((api_is_course_admin() || api_is_session_general_coach() || api_is_course_tutor()) && $threadId) {
// Thread qualify
if (Gradebook::is_active()) {
// Loading gradebook select
GradebookUtils::load_gradebook_select_in_tool($form);
$form->addElement(
'checkbox',
'thread_qualify_gradebook',
'',
get_lang('Grade this thread')
);
} else {
$form->addElement('hidden', 'thread_qualify_gradebook', false);
}
GradebookUtils::load_gradebook_select_in_tool($form);
$form->addElement(
'checkbox',
'thread_qualify_gradebook',
'',
get_lang('Grade this thread')
);

$form->addElement('html', '<div id="options_field" style="'.($gradeThisThread ? '' : 'display:none;').'">');
$form->addElement('text', 'numeric_calification', get_lang('Maximum score'));
Expand Down
23 changes: 8 additions & 15 deletions public/main/forum/forumfunction.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2405,25 +2405,18 @@ function newThread(CForum $forum, $form_values = '', $showPreview = true)
[] // extra data);
);

if (Gradebook::is_active() &&
(api_is_course_admin() || api_is_session_general_coach() || api_is_course_tutor())
) {
if ((api_is_course_admin() || api_is_session_general_coach() || api_is_course_tutor())) {
$form->addElement('advanced_settings', 'advanced_params', get_lang('Advanced settings'));
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');

// Thread qualify
if (Gradebook::is_active()) {
//Loading gradebook select
GradebookUtils::load_gradebook_select_in_tool($form);
$form->addCheckBox(
'thread_qualify_gradebook',
'',
get_lang('Grade this thread'),
['onclick' => 'javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}']
);
} else {
$form->addElement('hidden', 'thread_qualify_gradebook', false);
}
GradebookUtils::load_gradebook_select_in_tool($form);
$form->addCheckBox(
'thread_qualify_gradebook',
'',
get_lang('Grade this thread'),
['onclick' => 'javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}']
);

$form->addElement('html', '<div id="options_field" style="display:none">');
$form->addElement('text', 'numeric_calification', get_lang('Maximum score'));
Expand Down
Loading