Fix glossary glossary plugin loading #7638

1.10.x
Julio Montoya 11 years ago
parent 2bb3b7d2c7
commit 36071b3dfd
  1. 45
      main/exercice/answer.class.php
  2. 2
      main/exercice/calculated_answer.class.php
  3. 42
      main/exercice/question.class.php
  4. 8
      main/exercice/tests_category.php
  5. 6
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php
  6. 33
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestAnswerFeedback.php
  7. 35
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestProposedAnswer.php
  8. 26
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php

@ -184,9 +184,9 @@ class Answer
$result_question = Database::query($sql);
$question_type = Database::fetch_array($result_question);
$sql = "SELECT answer,correct,comment,ponderation,position, hotspot_coordinates, hotspot_type, destination, id_auto " .
"FROM $TBL_ANSWER WHERE c_id = {$this->course_id} AND question_id='".$questionId."' " .
"ORDER BY $field $order";
$sql = "SELECT answer,correct,comment,ponderation,position, hotspot_coordinates, hotspot_type, destination, id_auto
FROM $TBL_ANSWER WHERE c_id = {$this->course_id} AND question_id='".$questionId."'
ORDER BY $field $order";
$result=Database::query($sql);
$i = 1;
@ -326,8 +326,8 @@ class Answer
public function getAnswersList($decode = false)
{
$list = array();
for($i = 1; $i<=$this->nbrAnswers;$i++){
if(!empty($this->answer[$i])){
for ($i = 1; $i <= $this->nbrAnswers; $i++) {
if (!empty($this->answer[$i])) {
//Avoid problems when parsing elements with accents
if ($decode) {
@ -336,16 +336,16 @@ class Answer
}
$list[] = array(
'id' => $i,
'answer' => $this->answer[$i],
'comment' => $this->comment[$i],
'grade' => $this->weighting[$i],
'id' => $i,
'answer' => $this->answer[$i],
'comment' => $this->comment[$i],
'grade' => $this->weighting[$i],
'hotspot_coord' => $this->hotspot_coordinates[$i],
'hotspot_type' => $this->hotspot_type[$i],
'correct' => $this->correct[$i],
'destination' => $this->destination[$i]
'hotspot_type' => $this->hotspot_type[$i],
'correct' => $this->correct[$i],
'destination' => $this->destination[$i]
);
}
}
}
return $list;
@ -672,20 +672,20 @@ class Answer
$TBL_REPONSES = Database :: get_course_table(TABLE_QUIZ_ANSWER);
$fixed_list = array();
if (self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE || self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE) {
//Selecting origin options
if (self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE ||
self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE
) {
// Selecting origin options
$origin_options = Question::readQuestionOption($this->selectQuestionId(), $this->course['real_id']);
if (!empty($origin_options)) {
foreach($origin_options as $item) {
$new_option_list[]=$item['id'];
foreach ($origin_options as $item) {
$new_option_list[] = $item['id'];
}
}
$destination_options = Question::readQuestionOption($newQuestionId, $course_info['real_id']);
$i=0;
$i = 0;
if (!empty($destination_options)) {
foreach($destination_options as $item) {
$fixed_list[$new_option_list[$i]] = $item['id'];
@ -716,7 +716,9 @@ class Answer
$answer = $this->answer[$i];
$correct = $this->correct[$i];
if (self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE || self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE ) {
if (self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE ||
self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE
) {
$correct = $fixed_list[intval($correct)];
}
@ -740,6 +742,7 @@ class Answer
'destination' => $destination
];
$id = Database::insert($TBL_REPONSES, $params);
if ($id) {
$sql = "UPDATE $TBL_REPONSES SET id = id_auto WHERE id_auto = $id";
Database::query($sql);

@ -128,7 +128,7 @@ class CalculatedAnswer extends Question
'id' => 'answer',
'onkeyup' => 'javascript: updateBlanks(this);'
),
array('ToolbarSet' => 'Test_Question_Description', 'Width' => '100%', 'Height' => '350'));
array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '350'));
$form->addRule('answer', get_lang('GiveText'),'required');
$form->addRule('answer', get_lang('DefineBlanks'),'regex','/\[.*\]/');

@ -1249,25 +1249,24 @@ abstract class Question
* A subclass can redefine this function to add fields...
* @param FormValidator $form
*/
public function createForm(&$form, $fck_config=0)
public function createForm(&$form)
{
echo '<style>
.media { display:none;}
</style>';
echo '<script>
// hack to hide http://cksource.com/forums/viewtopic.php?f=6&t=8700
function FCKeditor_OnComplete( editorInstance ) {
if (document.getElementById ( \'HiddenFCK\' + editorInstance.Name )) {
HideFCKEditorByInstanceName (editorInstance.Name);
}
}
function HideFCKEditorByInstanceName ( editorInstanceName ) {
if (document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className == "HideFCKEditor" ) {
document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className = "media";
}
}
}
// hack to hide http://cksource.com/forums/viewtopic.php?f=6&t=8700
function FCKeditor_OnComplete( editorInstance ) {
if (document.getElementById ( \'HiddenFCK\' + editorInstance.Name)) {
HideFCKEditorByInstanceName (editorInstance.Name);
}
}
function HideFCKEditorByInstanceName ( editorInstanceName ) {
if (document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className == "HideFCKEditor" ) {
document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className = "media";
}
}
</script>';
@ -1283,19 +1282,19 @@ abstract class Question
$form->addElement('hidden','answerType', $answerType);
// html editor
$editor_config = array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '150');
if (is_array($fck_config)){
$editor_config = array_merge($editor_config, $fck_config);
}
$editorConfig = array(
'ToolbarSet' => 'TestQuestionDescription',
'Height' => '150'
);
if (!api_is_allowed_to_edit(null,true)) {
$editor_config['UserStatus'] = 'student';
$editorConfig['UserStatus'] = 'student';
}
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
$form->addHtmlEditor('questionDescription', get_lang('QuestionDescription'), false, false, $editor_config);
$form->addHtmlEditor('questionDescription', get_lang('QuestionDescription'), false, false, $editorConfig);
// hidden values
$my_id = isset($_REQUEST['myid']) ? intval($_REQUEST['myid']) : null;
@ -1322,7 +1321,7 @@ abstract class Question
//$form->addElement('select', 'parent_id', get_lang('AttachToMedia'), $course_medias);
}
$form->addElement('html','</div>');
$form->addElement('html', '</div>');
if (!isset($_GET['fromExercise'])) {
switch ($answerType) {
@ -1347,7 +1346,6 @@ abstract class Question
}
}
// default values
$defaults = array();
$defaults['questionName'] = $this->question;

@ -71,7 +71,13 @@ function edit_category_form($in_action) {
$form->addElement('header', get_lang('EditCategory'));
$form->addElement('hidden', 'category_id');
$form->addElement('text', 'category_name', get_lang('CategoryName'), array('size' => '95'));
$form->addHtmlEditor('category_description', get_lang('CategoryDescription'), false, false, array('ToolbarSet' => 'test_category', 'Height' => '200'));
$form->addHtmlEditor(
'category_description',
get_lang('CategoryDescription'),
false,
false,
array('ToolbarSet' => 'test_category', 'Height' => '200')
);
$form->addButtonSave(get_lang('ModifyCategory'), 'SubmitNote');
// setting the defaults

@ -10,8 +10,7 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
*/
class Documents extends Basic
{
public $plugins = array(
);
public $plugins = array();
/**
* @return mixed
@ -51,9 +50,10 @@ class Documents extends Basic
{
$plugins = array();
if (api_get_setting('show_glossary_in_documents') != 'none') {
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
$plugins[] = 'glossary';
}
return $plugins;
}
}

@ -5,9 +5,42 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Class TestAnswerFeedback
*
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class TestAnswerFeedback extends Basic
{
/**
* @return mixed
*/
public function getConfig()
{
$config['toolbarGroups'] = array(
array('name' => 'document'),
array(
'name' => 'clipboard',
'groups' => array('clipboard', 'undo',)
),
array(
'name' => 'basicstyles',
'groups' => array('basicstyles', 'cleanup',)
),
array(
'name' => 'paragraph',
'groups' => array('list', 'indent', 'blocks', 'align')
),
array('name' => 'links'),
array('name' => 'insert'),
'/',
array('name' => 'styles'),
array('name' => 'colors'),
array('name' => 'mode')
);
$config['toolbarCanCollapse'] = true;
$config['toolbarStartupExpanded'] = false;
//$config['width'] = '100';
//$config['height'] = '200';
return $config;
}
}

@ -5,6 +5,7 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Class TestProposedAnswer
*
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class TestProposedAnswer extends Basic
@ -15,22 +16,46 @@ class TestProposedAnswer extends Basic
public function getConfig()
{
$config['toolbarGroups'] = array(
//array('name' => 'document'),
array('name' => 'clipboard', 'groups' =>array('clipboard', 'undo', )),
array('name' => 'basicstyles', 'groups' =>array('basicstyles', 'cleanup', )),
array('name' => 'paragraph', 'groups' =>array('list', 'indent', 'blocks', 'align' )),
array('name' => 'document'),
array(
'name' => 'clipboard',
'groups' => array('clipboard', 'undo',)
),
array(
'name' => 'basicstyles',
'groups' => array('basicstyles', 'cleanup',)
),
array(
'name' => 'paragraph',
'groups' => array('list', 'indent', 'blocks', 'align')
),
array('name' => 'links'),
array('name' => 'insert'),
'/',
array('name' => 'styles'),
array('name' => 'colors'),
array('name' => 'mode')
array('name' => 'mode'),
array('name' => 'others')
);
$config['toolbarCanCollapse'] = true;
$config['toolbarStartupExpanded'] = false;
$config['extraPlugins'] = $this->getPluginsToString();
//$config['width'] = '100';
//$config['height'] = '200';
return $config;
}
/**
* @return array
*/
public function getConditionalPlugins()
{
$plugins = array();
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
$plugins[] = 'glossary';
}
return $plugins;
}
}

@ -5,6 +5,7 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
/**
* Class TestQuestionDescription
*
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
*/
class TestQuestionDescription extends Basic
@ -16,12 +17,12 @@ class TestQuestionDescription extends Basic
{
$config['toolbarGroups'] = array(
array('name' => 'document', 'groups' =>array('document', 'doctools')),
array('name' => 'clipboard', 'groups' =>array('clipboard', 'undo', )),
array('name' => 'editing', 'groups' =>array('clipboard', 'undo', )),
array('name' => 'clipboard', 'groups' =>array('clipboard', 'undo')),
array('name' => 'editing', 'groups' =>array('clipboard', 'undo')),
//array('name' => 'forms', 'groups' =>array('clipboard', 'undo', )),
'/',
array('name' => 'basicstyles', 'groups' =>array('basicstyles', 'cleanup', )),
array('name' => 'paragraph', 'groups' =>array('list', 'indent', 'blocks', 'align' )),
array('name' => 'basicstyles', 'groups' =>array('basicstyles', 'cleanup')),
array('name' => 'paragraph', 'groups' =>array('list', 'indent', 'blocks', 'align')),
array('name' => 'links'),
array('name' => 'insert'),
'/',
@ -30,11 +31,26 @@ class TestQuestionDescription extends Basic
array('name' => 'tools'),
array('name' => 'others'),
array('name' => 'mode')
//array('name' => 'about')
);
$config['extraPlugins'] = $this->getPluginsToString();
//$config['width'] = '100';
//$config['height'] = '200';
return $config;
}
/**
* @return array
*/
public function getConditionalPlugins()
{
$plugins = array();
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
$plugins[] = 'glossary';
}
return $plugins;
}
}

Loading…
Cancel
Save