diff --git a/main/exercice/admin.php b/main/exercice/admin.php index 93325b4e85..855b31683e 100755 --- a/main/exercice/admin.php +++ b/main/exercice/admin.php @@ -477,7 +477,7 @@ if(!$newQuestion && !$modifyQuestion && !$editQuestion && !isset($_GET['hotspota Display::display_confirmation_message(get_lang('ExerciseEdited')); } if(api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { - Display::display_error_message(get_lang('SearchXapianModuleNotInstaled')); + Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); } $form -> display (); echo '
'; diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index ad5b57df93..84b3376274 100755 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -598,8 +598,8 @@ class Exercise { // insert into the item_property table api_item_property_update($_course, TOOL_QUIZ, $this->id,'QuizAdded',api_get_user_id()); - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { - $this -> search_engine_save(); + if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { + $this -> search_engine_save(); } } @@ -882,7 +882,9 @@ class Exercise { // feedback type $radios_feedback = array(); $radios_feedback[] = FormValidator :: createElement ('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'),'0',array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); - $radios_feedback[] = FormValidator :: createElement ('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'),'1',array('id' =>'exerciseType_1' , 'onclick' => 'check_direct_feedback()')); + if (api_get_setting('enable_quiz_scenario') == 'true') { + $radios_feedback[] = FormValidator :: createElement ('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'),'1',array('id' =>'exerciseType_1' , 'onclick' => 'check_direct_feedback()')); + } $radios_feedback[] = FormValidator :: createElement ('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2',array('id' =>'exerciseType_2')); @@ -1106,11 +1108,10 @@ class Exercise { $this -> setRandom($form -> getSubmitValue('randomQuestions')); $this -> updateRandomAnswers($form -> getSubmitValue('randomAnswers')); $this -> updateResultsDisabled($form -> getSubmitValue('results_disabled')); - $this -> updateExpiredTime($form -> getSubmitValue('enabletimercontroltotalminutes')); - + $this -> updateExpiredTime($form -> getSubmitValue('enabletimercontroltotalminutes')); $this -> updatePropagateNegative($form -> getSubmitValue('propagate_neg')); - if($form -> getSubmitValue('enabletimelimit')==1) { + if ($form -> getSubmitValue('enabletimelimit')==1) { $start_time = $form -> getSubmitValue('start_time'); $this->start_time = $start_time['Y'].'-'.$start_time['F'].'-'.$start_time['d'].' '.$start_time['H'].':'.$start_time['i'].':00'; $end_time = $form -> getSubmitValue('end_time'); @@ -1120,7 +1121,7 @@ class Exercise { $this->end_time = '0000-00-00 00:00:00'; } - if($form -> getSubmitValue('enabletimercontrol') == 1) { + if ($form -> getSubmitValue('enabletimercontrol') == 1) { $expired_total_time = $form -> getSubmitValue('enabletimercontroltotalminutes'); if ($this->expired_time == 0) { $this->expired_time = $expired_total_time; @@ -1129,7 +1130,7 @@ class Exercise { $this->expired_time = 0; } - if($form -> getSubmitValue('randomAnswers') == 1) { + if ($form -> getSubmitValue('randomAnswers') == 1) { $this->random_answers=1; } else { $this->random_answers=0; @@ -1139,15 +1140,16 @@ class Exercise { } function search_engine_save() { + if ($_POST['index_document'] != 1) { return; } $course_id = api_get_course_id(); - require_once(api_get_path(LIBRARY_PATH) . 'search/DokeosIndexer.class.php'); - require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'); - require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'); + require_once api_get_path(LIBRARY_PATH) . 'search/DokeosIndexer.class.php'; + require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'; + require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; $specific_fields = get_specific_field_list(); $ic_slide = new IndexableChunk(); @@ -1187,7 +1189,7 @@ class Exercise { $di->addChunk($ic_slide); //index and return search engine document id - $did = $di->index(); + $did = $di->index(); if ($did) { // save it to db $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); @@ -1196,7 +1198,6 @@ class Exercise { $sql = sprintf($sql, $tbl_se_ref, $course_id, TOOL_QUIZ, $this->id, $did); Database::query($sql); } - } function search_engine_edit() { @@ -1266,7 +1267,8 @@ class Exercise { $sql = sprintf($sql, $tbl_se_ref, $course_id, TOOL_QUIZ, $this->id, $did); Database::query($sql); } - + } else { + $this->search_engine_save(); } } diff --git a/main/exercice/exercise_admin.php b/main/exercice/exercise_admin.php index cac1c43236..fd42121dfd 100755 --- a/main/exercice/exercise_admin.php +++ b/main/exercice/exercise_admin.php @@ -154,15 +154,15 @@ $objExercise = new Exercise(); //INIT FORM if(isset($_GET['exerciseId'])) { - $form = new FormValidator('exercise_admin', 'post', api_get_self().'?'.api_get_cidreq().'&exerciseId='.$_GET['exerciseId']); - $objExercise -> read (intval($_GET['exerciseId'])); - $form -> addElement ('hidden','edit','true'); + $form = new FormValidator('exercise_admin', 'post', api_get_self().'?'.api_get_cidreq().'&exerciseId='.intval($_GET['exerciseId'])); + $objExercise->read($_GET['exerciseId']); + $form->addElement('hidden','edit','true'); } else { $form = new FormValidator('exercise_admin','post',api_get_self().'?'.api_get_cidreq()); - $form -> addElement ('hidden','edit','false'); + $form->addElement('hidden','edit','false'); } -$objExercise -> createForm ($form); +$objExercise->createForm ($form); // VALIDATE FORM if ($form->validate()) { @@ -199,8 +199,8 @@ if ($form->validate()) { if ($objExercise->feedbacktype==1) Display::display_normal_message(get_lang('DirectFeedbackCantModifyTypeQuestion')); - if(api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { - Display::display_error_message(get_lang('SearchXapianModuleNotInstaled')); + if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { + Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); } // to hide the exercise description diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 8be650c0b7..596390a966 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -343,7 +343,7 @@ class Display { * @param bool Filter (true) or not (false) * @return void */ - public static function display_normal_message ($message, $filter = true) { + public static function display_normal_message($message, $filter = true) { if ($filter) { // Filter message $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()); diff --git a/main/install/db_main.sql b/main/install/db_main.sql index 794ca2c9a9..8d2684a35b 100755 --- a/main/install/db_main.sql +++ b/main/install/db_main.sql @@ -742,7 +742,7 @@ VALUES ('show_glossary_in_documents', NULL, 'radio', 'Course', 'none', 'ShowGlossaryInDocumentsTitle', 'ShowGlossaryInDocumentsComment', NULL, NULL,1), ('allow_terms_conditions', NULL, 'radio', 'Platform', 'false', 'AllowTermsAndConditionsTitle', 'AllowTermsAndConditionsComment', NULL, NULL,0), ('course_create_active_tools','enable_search','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Search',0), -('search_enabled',NULL,'radio','Tools','false','EnableSearchTitle','EnableSearchComment',NULL,NULL,1), +('search_enabled',NULL,'radio','Search','false','EnableSearchTitle','EnableSearchComment',NULL,NULL,1), ('search_prefilter_prefix',NULL, NULL,'Search','','SearchPrefilterPrefix','SearchPrefilterPrefixComment',NULL,NULL,0), ('search_show_unlinked_results',NULL,'radio','Search','true','SearchShowUnlinkedResultsTitle','SearchShowUnlinkedResultsComment',NULL,NULL,1), ('show_courses_descriptions_in_catalog', NULL, 'radio', 'Course', 'true', 'ShowCoursesDescriptionsInCatalogTitle', 'ShowCoursesDescriptionsInCatalogComment', NULL, NULL, 1), @@ -789,7 +789,7 @@ VALUES ('exercise_min_score', NULL,'textfield', 'Course', '', 'ExerciseMinScoreTitle', 'ExerciseMinScoreComment','platform',NULL, 1), ('exercise_max_score', NULL,'textfield', 'Course', '', 'ExerciseMaxScoreTitle', 'ExerciseMaxScoreComment','platform',NULL, 1), ('show_users_folders', NULL,'radio', 'Tools', 'true', 'ShowUsersFoldersTitle','ShowUsersFoldersComment',NULL,NULL, 0), -('show_default_folders', NULL,'radio', 'Tools', 'true', 'ShowDefaultFoldersTitle','ShowDefaultFoldersComment',NULL,NULL, 0), +('show_default_folders', NULL,'radio', 'Tools', 'true', 'ShowDefaultFoldersTitle','ShowDefaultFoldersComment',NULL,NULL, 0), ('show_chat_folder', NULL,'radio', 'Tools', 'true', 'ShowChatFolderTitle','ShowChatFolderComment',NULL,NULL, 0), ('enabled_text2audio', NULL,'radio', 'Tools', 'false', 'Text2AudioTitle','Text2AudioComment',NULL,NULL, 0), ('course_hide_tools','course_description','checkbox','Tools','false','CourseHideToolsTitle','CourseHideToolsComment',NULL,'CourseDescription', 1), @@ -820,7 +820,8 @@ VALUES ('show_groups_to_users',NULL,'radio','Platform','true','ShowGroupsToUsersTitle','ShowGroupsToUsersComment',NULL,NULL, 0), ('accessibility_font_resize',NULL,'radio','Platform','false','EnableAccessibilityFontResizeTitle','EnableAccessibilityFontResizeComment',NULL,NULL, 1), ('hide_courses_in_sessions',NULL,'radio', 'Platform','false','HideCoursesInSessionsTitle', 'HideCoursesInSessionsComment','platform',NULL, 1), -('chamilo_database_version',NULL,'textfield',NULL, '1.8.8.13997','DokeosDatabaseVersion','', NULL, NULL, 0); +('enable_quiz_scenario', NULL,'radio','Course','false','EnableQuizScenarioTitle','EnableQuizScenarioComment',NULL,NULL, 1), +('chamilo_database_version',NULL,'textfield',NULL, '1.8.8.14082','DokeosDatabaseVersion','', NULL, NULL, 0); UNLOCK TABLES; /*!40000 ALTER TABLE settings_current ENABLE KEYS */; @@ -1081,7 +1082,9 @@ VALUES ('accessibility_font_resize', 'true', 'Yes'), ('accessibility_font_resize', 'false', 'No'), ('hide_courses_in_sessions','true','Yes'), -('hide_courses_in_sessions','false','No'); +('hide_courses_in_sessions','false','No'), +('enable_quiz_scenario', 'true', 'Yes'), +('enable_quiz_scenario', 'false', 'No'); UNLOCK TABLES; diff --git a/main/install/migrate-db-1.8.7-1.8.8-pre.sql b/main/install/migrate-db-1.8.7-1.8.8-pre.sql index d4d8676e4c..d5c8a43735 100755 --- a/main/install/migrate-db-1.8.7-1.8.8-pre.sql +++ b/main/install/migrate-db-1.8.7-1.8.8-pre.sql @@ -177,7 +177,13 @@ ALTER TABLE notification ADD index mail_notify_freq_index (sent_at, send_freq, c ALTER TABLE session_category ADD COLUMN access_url_id INT NOT NULL default 1; -UPDATE settings_current SET selected_value = '1.8.8.13997' WHERE variable = 'chamilo_database_version'; +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('enable_quiz_scenario', NULL,'radio','Course','false','EnableQuizScenarioTitle','EnableQuizScenarioComment',NULL,NULL, 1); +INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_quiz_scenario', 'true', 'Yes'); +INSERT INTO settings_options (variable, value, display_text) VALUES ('enable_quiz_scenario', 'false', 'No'); + +UPDATE settings_current SET category='Search' WHERE variable='search_enable'; + +UPDATE settings_current SET selected_value = '1.8.8.14082' WHERE variable = 'chamilo_database_version'; -- xxSTATSxx ALTER TABLE track_e_exercices ADD COLUMN orig_lp_item_view_id INT NOT NULL DEFAULT 0; diff --git a/main/newscorm/lp_controller.php b/main/newscorm/lp_controller.php index eda23f5e50..0c305df791 100755 --- a/main/newscorm/lp_controller.php +++ b/main/newscorm/lp_controller.php @@ -633,7 +633,7 @@ switch ($action) { $specific_fields = get_specific_field_list(); foreach ($specific_fields as $specific_field) { $_SESSION['oLP']->set_terms_by_prefix($_REQUEST[$specific_field['code']], $specific_field['code']); - $new_values = explode(',', trim($_REQUEST[$specific_field['code']])); + $new_values = explode(',', trim($_REQUEST[$specific_field['code']])); if (!empty($new_values)) { array_walk($new_values, 'trim'); delete_all_specific_field_value(api_get_course_id(), $specific_field['id'], TOOL_LEARNPATH, $_SESSION['oLP']->lp_id); @@ -644,9 +644,8 @@ switch ($action) { } } } - } + } } - require 'lp_list.php'; } break;