Survey: Enable translatable survey (for textarea contents only) - refs BT#16553

pull/3025/head
Yannick Warnier 6 years ago
parent ee93de104f
commit a067dbf5ad
  1. 2
      main/survey/create_new_survey.php
  2. 4
      main/survey/fillsurvey.php
  3. 2
      main/survey/preview.php
  4. 2
      main/survey/question.php
  5. 2
      main/survey/survey.php
  6. 2
      main/survey/survey_list.php
  7. 14
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Survey.php
  8. 66
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/SurveyQuestion.php

@ -48,7 +48,7 @@ $survey_data = SurveyManager::get_survey($survey_id);
$course_id = api_get_course_id();
$session_id = api_get_session_id();
$gradebook_link_type = 8;
$urlname = isset($survey_data['title']) ? strip_tags($survey_data['title']) : null;
$urlname = isset($survey_data['title']) ? strip_tags($survey_data['title'], '<span>') : null;
// Breadcrumbs
if ($action == 'add') {

@ -551,13 +551,15 @@ if ($survey_data['form_fields'] != '' &&
$form->setDefaults($user_data);
}
$htmlHeadXtra[] = '<script>'.api_get_language_translate_html().'</script>';
Display::display_header(get_lang('ToolSurvey'));
// Displaying the survey title and subtitle (appears on every page)
echo '<div class="survey-block">';
echo '<div class="page-header">';
echo '<h2>';
echo strip_tags($survey_data['survey_title']).'</h2></div>';
echo strip_tags($survey_data['survey_title'], '<span>').'</h2></div>';
if (!empty($survey_data['survey_subtitle'])) {
echo '<div class="survey_subtitle"><p>'.strip_tags($survey_data['survey_subtitle']).'</p></div>';
}

@ -47,6 +47,8 @@ $interbreadcrumb[] = [
'name' => strip_tags($survey_data['title']),
];
$htmlHeadXtra[] = '<script>'.api_get_language_translate_html().'</script>';
$show = 0;
Display::display_header(get_lang('SurveyPreview'));

@ -17,6 +17,8 @@ $(function() {
});
} ); </script>';
$htmlHeadXtra[] = '<script>'.api_get_language_translate_html().'</script>';
/** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
if (!api_is_allowed_to_edit(false, true)) {
api_not_allowed(true);

@ -101,6 +101,8 @@ if ($is_survey_type_1 && ($action == 'addgroup' || $action == 'deletegroup')) {
exit;
}
$htmlHeadXtra[] = '<script>'.api_get_language_translate_html().'</script>';
// Displaying the header
Display::display_header($tool_name, 'Survey');

@ -49,6 +49,8 @@ $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
$courseInfo
);
$htmlHeadXtra[] = '<script>'.api_get_language_translate_html().'</script>';
if ($isDrhOfCourse) {
Display::display_header(get_lang('SurveyList'));
// Tool introduction

@ -57,7 +57,19 @@ class Survey extends Basic
['Table', '-', 'CreateDiv'],
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
[
'Bold',
'Italic',
'Underline',
'Strike',
'-',
'Subscript',
'Superscript',
'-',
'TextColor',
'BGColor',
api_get_configuration_value('translate_html') ? 'Language' : '',
],
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
['Styles', 'Format', 'Font', 'FontSize'],
['PageBreak', 'ShowBlocks', 'Source'],

@ -10,4 +10,70 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class SurveyQuestion extends Basic
{
/**
* Get the toolbar config.
*
* @return array
*/
public function getConfig()
{
if (api_get_setting('more_buttons_maximized_mode') != 'true') {
$config['toolbar'] = $this->getNormalToolbar();
} else {
$config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
$config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
}
return $config;
}
/**
* Get the toolbar configuration when CKEditor is maximized.
*
* @return array
*/
protected function getMaximizedToolbar()
{
return [
$this->getNewPageBlock(),
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'],
['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
['Link', 'Unlink', 'Anchor', 'Glossary'],
[
'Image',
'Mapping',
'Video',
'Oembed',
'Flash',
'Youtube',
'Audio',
'leaflet',
'Smiley',
'SpecialChar',
'Asciimath',
'Asciisvg',
],
'/',
['Table', '-', 'CreateDiv'],
['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
[
'Bold',
'Italic',
'Underline',
'Strike',
'-',
'Subscript',
'Superscript',
'-',
'TextColor',
'BGColor',
api_get_configuration_value('translate_html') ? 'Language' : '',
],
[api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
['Styles', 'Format', 'Font', 'FontSize'],
['PageBreak', 'ShowBlocks'],
api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
['Toolbarswitch', 'Source'],
];
}
}

Loading…
Cancel
Save