From ab182329ce7f90617d6b3df6a986b55dff705792 Mon Sep 17 00:00:00 2001 From: Arthur Portugal Date: Thu, 29 Oct 2009 18:08:18 -0500 Subject: [PATCH 01/13] Added a width to the menu actions --- main/admin/user_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/admin/user_list.php b/main/admin/user_list.php index ffc8eeeaaa..cf01b291c6 100644 --- a/main/admin/user_list.php +++ b/main/admin/user_list.php @@ -761,7 +761,7 @@ else $table->set_header(5, get_lang('Email')); $table->set_header(6, get_lang('Status')); $table->set_header(7, get_lang('Active')); - $table->set_header(8, get_lang('Action'), false); + $table->set_header(8, get_lang('Action'), false,'width="170px"'); $table->set_column_filter(5, 'email_filter'); $table->set_column_filter(6, 'status_filter'); $table->set_column_filter(7, 'active_filter'); From eb4655e17e029b7105976e7532fe872968229194 Mon Sep 17 00:00:00 2001 From: Arthur Portugal Date: Thu, 29 Oct 2009 18:20:40 -0500 Subject: [PATCH 02/13] Added a link into training list the tool backup DT#4757 --- main/admin/course_list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/admin/course_list.php b/main/admin/course_list.php index fbb4f1516a..bccd369431 100644 --- a/main/admin/course_list.php +++ b/main/admin/course_list.php @@ -125,15 +125,15 @@ function get_course_data($from, $number_of_items, $column, $direction) function modify_filter($code) { global $charset; - return + return ''.Display::return_icon('synthese_view.gif', get_lang('Info')).' '. - //''.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).' '. // This is not the preferable way to go to the homepage. ''.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).' '. - + ''.Display::return_icon('backup.gif', get_lang('CreateBackup')).' '. ''.Display::return_icon('statistics.gif', get_lang('Tracking')).' '. ''.Display::return_icon('edit.gif', get_lang('Edit')).' '. ''.Display::return_icon('delete.gif', get_lang('Delete')).''; + } /** * Return an icon representing the visibility of the course @@ -286,7 +286,7 @@ else $table->set_header(6, get_lang('UnsubscriptionAllowed')); $table->set_header(7, get_lang('IsVirtualCourse')); $table->set_header(8, get_lang('Teacher')); - $table->set_header(9, get_lang('Action'), false,'width="120px"'); + $table->set_header(9, get_lang('Action'), false,'width="125px"'); $table->set_column_filter(9,'modify_filter'); $table->set_form_actions(array ('delete_courses' => get_lang('DeleteCourse')),'course'); $table->display(); From 2b9f9a28d0dfacd720dfffdd44cc565a948bef00 Mon Sep 17 00:00:00 2001 From: Arthur Portugal Date: Fri, 30 Oct 2009 10:52:29 -0500 Subject: [PATCH 03/13] Added - Survey language not stored into DT#5498 --- main/survey/create_new_survey.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/survey/create_new_survey.php b/main/survey/create_new_survey.php index 2d79c48470..6d11df0daf 100644 --- a/main/survey/create_new_survey.php +++ b/main/survey/create_new_survey.php @@ -163,6 +163,8 @@ foreach ($lang_array['name'] as $key=>$value) { } $form->addElement('select', 'survey_language', get_lang('Language'), $languages); */ +// Pass the language of the survey in the form +$form->addElement('hidden', 'survey_language'); $form->addElement('datepickerdate', 'start_date', get_lang('StartDate'), array('form_name'=>'survey')); $form->addElement('datepickerdate', 'end_date', get_lang('EndDate'), array('form_name'=>'survey')); From ade915359e3d80a8b859afd294f2c55f7d48f814 Mon Sep 17 00:00:00 2001 From: Arthur Portugal Date: Fri, 30 Oct 2009 12:19:45 -0500 Subject: [PATCH 04/13] Removed the field virtual course DT#4097 --- main/admin/course_list.php | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/main/admin/course_list.php b/main/admin/course_list.php index bccd369431..30a192da9a 100644 --- a/main/admin/course_list.php +++ b/main/admin/course_list.php @@ -71,9 +71,8 @@ function get_course_data($from, $number_of_items, $column, $direction) $course_table = Database :: get_main_table(TABLE_MAIN_COURSE); $users_table = Database :: get_main_table(TABLE_MAIN_USER); $course_users_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER); - - $sql = "SELECT code AS col0, visual_code AS col1, title AS col2, course_language AS col3, category_code AS col4, subscribe AS col5, unsubscribe AS col6, code AS col7, tutor_name as col8, code AS col9, visibility AS col10,directory as col11 FROM $course_table"; - + $sql = "SELECT code AS col0, visual_code AS col1, title AS col2, course_language AS col3, category_code AS col4, subscribe AS col5, unsubscribe AS col6, tutor_name as col7, code AS col8, visibility AS col9,directory as col10 FROM $course_table"; + //$sql = "SELECT code AS col0, visual_code AS col1, title AS col2, course_language AS col3, category_code AS col4, subscribe AS col5, unsubscribe AS col6, code AS col7, tutor_name as col8, code AS col9, visibility AS col10,directory as col11 FROM $course_table"; global $_configuration; if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls']==true && api_get_current_access_url_id()!=-1) { $access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); @@ -109,12 +108,12 @@ function get_course_data($from, $number_of_items, $column, $direction) while ($course = Database::fetch_row($res)) { //place colour icons in front of courses - $course[1] = get_course_visibility_icon($course[10]).''.$course[1].''; - + $course[1] = get_course_visibility_icon($course[9]).''.$course[1].''; $course[5] = $course[5] == SUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No'); $course[6] = $course[6] == UNSUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No'); - $course[7] = CourseManager :: is_virtual_course_from_system_code($course[7]) ? get_lang('Yes') : get_lang('No'); - $course_rem = array($course[0],$course[1],$course[2],$course[3],$course[4],$course[5],$course[6],$course[7],$course[8],$course[9]); + //$course[7] = CourseManager :: is_virtual_course_from_system_code($course[7]) ? get_lang('Yes') : get_lang('No'); + //$course_rem = array($course[0],$course[1],$course[2],$course[3],$course[4],$course[5],$course[6],$course[7],$course[8],$course[9]); + $course_rem = array($course[0],$course[1],$course[2],$course[3],$course[4],$course[5],$course[6],$course[7],$course[8]); $courses[] = $course_rem; } return $courses; @@ -283,11 +282,11 @@ else $table->set_header(3, get_lang('Language')); $table->set_header(4, get_lang('Category')); $table->set_header(5, get_lang('SubscriptionAllowed')); - $table->set_header(6, get_lang('UnsubscriptionAllowed')); - $table->set_header(7, get_lang('IsVirtualCourse')); - $table->set_header(8, get_lang('Teacher')); - $table->set_header(9, get_lang('Action'), false,'width="125px"'); - $table->set_column_filter(9,'modify_filter'); + $table->set_header(6, get_lang('UnsubscriptionAllowed'),false,'width="50px"'); + //$table->set_header(7, get_lang('IsVirtualCourse')); + $table->set_header(7, get_lang('Teacher')); + $table->set_header(8, get_lang('Action'), false,'width="125px"'); + $table->set_column_filter(8,'modify_filter'); $table->set_form_actions(array ('delete_courses' => get_lang('DeleteCourse')),'course'); $table->display(); } From a0af068cf83784b190d23b7236f6c2435664c35c Mon Sep 17 00:00:00 2001 From: Arthur Portugal Date: Fri, 30 Oct 2009 13:02:32 -0500 Subject: [PATCH 05/13] Changed old button into list courses DT#5496 --- main/admin/course_edit.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/admin/course_edit.php b/main/admin/course_edit.php index b2c23b28c1..baad59ccc8 100644 --- a/main/admin/course_edit.php +++ b/main/admin/course_edit.php @@ -137,7 +137,9 @@ EOT; $renderer = $form->defaultRenderer(); $renderer -> setElementTemplate($element_template, 'group'); -$form -> addGroup($group,'group',get_lang('CourseTeachers'),'

'); +$form -> addGroup($group,'group',get_lang('CourseTeachers'),'' . + '

' . + ''); $categories_select = $form->addElement('select', 'category_code', get_lang('CourseFaculty'), $categories); From 3675e31fe22e91bc27b5a598ac389a2ae0ab7eb4 Mon Sep 17 00:00:00 2001 From: Arthur Portugal Date: Fri, 30 Oct 2009 13:14:33 -0500 Subject: [PATCH 06/13] Fixed the width and height for the button DT#5496 --- main/admin/course_edit.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/admin/course_edit.php b/main/admin/course_edit.php index baad59ccc8..e2f54478f3 100644 --- a/main/admin/course_edit.php +++ b/main/admin/course_edit.php @@ -137,9 +137,9 @@ EOT; $renderer = $form->defaultRenderer(); $renderer -> setElementTemplate($element_template, 'group'); -$form -> addGroup($group,'group',get_lang('CourseTeachers'),'' . - '

' . - ''); +$form -> addGroup($group,'group',get_lang('CourseTeachers'),''. + '

' . + ''); $categories_select = $form->addElement('select', 'category_code', get_lang('CourseFaculty'), $categories); From 286146f8a61d6d6838d78532ce3de822fdcfbf52 Mon Sep 17 00:00:00 2001 From: Isaac Flores Date: Fri, 30 Oct 2009 14:43:43 -0500 Subject: [PATCH 07/13] improvements of glossary in documents tool --- .../glossary/fck_glossary_automatic.js | 48 +++++++++++++------ main/inc/lib/fckeditor/fcktemplates.xml.php | 1 + 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js b/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js index 33e6274908..7dc350ca6b 100755 --- a/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js +++ b/main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js @@ -1,9 +1,10 @@ $(document).ready(function() { $(window).load(function () { - var my_text=$("body").html(); + my_protocol = location.protocol; my_pathname=location.pathname; work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/')); + $.ajax({ contentType: "application/x-www-form-urlencoded", beforeSend: function(content_object) { @@ -11,19 +12,43 @@ $(document).ready(function() { type: "POST", url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php", data: "glossary_data=true", - success: function(datos) { - if (datos.length==0) { + success: function(datas) { + if (datas.length==0) { return false; } data_terms=datas.split("[|.|_|.|-|.|]"); + var complex_array = new Array(); + var cp_complex_array = new Array(); for(i=0;i])'+specific_terms[1]+'[\ .,]{0,1}',"gi"); - new_html=my_text.replace(my_specific_terms,function(m){return replace_complete_char(m)}); - $("body").html(new_html); - my_text=$("body").html(); + var real_code = specific_terms[0]; + complex_array[real_code] = real_term; + cp_complex_array[real_code] = real_term; } + + complex_array.reverse(); + + for (var my_index in complex_array) { + n = complex_array[my_index]; + if (n == null) { + n = ''; + } else { + for (var cp_my_index in cp_complex_array) { + cp_data = cp_complex_array[cp_my_index]; + if (cp_data == null) { + cp_data = ''; + } else { + if (cp_data == n) { + my_index = cp_my_index; + } + } + } + $('body').removeHighlight().highlight(n,my_index) + } + } + + var complex_array = new Array(); //mouse over event $("body .glossary-ajax").mouseover(function(){ @@ -56,14 +81,7 @@ $(document).ready(function() { div_show_id=current_element.find("div").attr("id"); $("div#"+div_show_id).remove(); }); - - //Callback Helper - function replace_complete_char(m) { - var complete_term_pattern = new RegExp(real_term,"i"); - var tag = m.replace(complete_term_pattern," $&"); - return tag; - } - + } }); diff --git a/main/inc/lib/fckeditor/fcktemplates.xml.php b/main/inc/lib/fckeditor/fcktemplates.xml.php index d139b2d09e..2d7b6660f9 100644 --- a/main/inc/lib/fckeditor/fcktemplates.xml.php +++ b/main/inc/lib/fckeditor/fcktemplates.xml.php @@ -25,6 +25,7 @@ if (api_get_setting('show_glossary_in_documents') != 'none') { if (api_get_setting('show_glossary_in_documents') == 'ismanual') { $js .= ''; //jQuery +if (api_get_setting('show_glossary_in_extra_tools') == 'true') { + $htmlHeadXtra[] = ''; //Glossary + $htmlHeadXtra[] = ''; + } + $htmlHeadXtra[] = ''; +/* ------------ ACCESS RIGHTS ------------ */ +// notice for unauthorized people. +api_protect_course_script(true); + +require_once api_get_path(LIBRARY_PATH) . 'text.lib.php'; + +$is_allowedToEdit = api_is_allowed_to_edit(null,true); + +$_configuration['live_exercise_tracking'] = true; +$stat_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); +$exercice_attemp_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); + +$TBL_EXERCICE_QUESTION = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION); +$TBL_EXERCICES = Database :: get_course_table(TABLE_QUIZ_TEST); +$TBL_QUESTIONS = Database :: get_course_table(TABLE_QUIZ_QUESTION); +$TBL_REPONSES = Database :: get_course_table(TABLE_QUIZ_ANSWER); + +// general parameters passed via POST/GET + +if (empty ($origin)) { + $origin = $_REQUEST['origin']; +} +if (empty ($learnpath_id)) { + $learnpath_id = Security::remove_XSS($_REQUEST['learnpath_id']); +} +if (empty ($learnpath_item_id)) { + $learnpath_item_id = Security::remove_XSS($_REQUEST['learnpath_item_id']); +} +if (empty ($formSent)) { + $formSent = $_REQUEST['formSent']; +} +if (empty ($exerciseResult)) { + $exerciseResult = $_REQUEST['exerciseResult']; +} +if (empty ($exerciseResultCoordinates)) { + $exerciseResultCoordinates = $_REQUEST['exerciseResultCoordinates']; +} +if (empty ($exerciseType)) { + $exerciseType = $_REQUEST['exerciseType']; +} +if (empty ($exerciseId)) { + $exerciseId = Database::escape_string(intval($_REQUEST['exerciseId'])); +} +if (empty ($choice)) { + $choice = $_REQUEST['choice']; +} +if (empty ($_REQUEST['choice'])) { + $choice = $_REQUEST['choice2']; +} +if (empty ($questionNum)) { + $questionNum = Database :: escape_string($_REQUEST['questionNum']); +} +if (empty ($nbrQuestions)) { + $nbrQuestions = Database :: escape_string($_REQUEST['nbrQuestions']); +} +if (empty ($buttonCancel)) { + $buttonCancel = $_REQUEST['buttonCancel']; +} +$error = ''; +if (!isset ($exerciseType)) { + $exe_start_date = time(); + $_SESSION['exercice_start_date'] = $exe_start_date; +} +// if the user has clicked on the "Cancel" button +if ($buttonCancel) { + // returns to the exercise list + header("Location: exercice.php?origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"); + exit (); +} + +if ($origin == 'learnpath' && isset ($_GET['not_multiple_attempt']) && $_GET['not_multiple_attempt'] == strval(intval($_GET['not_multiple_attempt']))) { + $not_multiple_attempt = (int) $_GET['not_multiple_attempt']; + if ($not_multiple_attempt === 1) { + require_once '../inc/reduced_header.inc.php'; + echo '
 
'; + Display :: display_warning_message(get_lang('ReachedOneAttempt')); + exit; + } +} + +if ($origin == 'builder') { + /*******************************/ + /* Clears the exercise session */ + /*******************************/ + if (isset ($_SESSION['objExercise'])) { + api_session_unregister('objExercise'); + unset ($objExercise); + } + if (isset ($_SESSION['objQuestion'])) { + api_session_unregister('objQuestion'); + unset ($objQuestion); + } + if (isset ($_SESSION['objAnswer'])) { + api_session_unregister('objAnswer'); + unset ($objAnswer); + } + if (isset ($_SESSION['questionList'])) { + api_session_unregister('questionList'); + unset ($questionList); + } + if (isset ($_SESSION['newquestionList'])) { + api_session_unregister('newquestionList'); + unset ($newquestionList); + } + if (isset ($_SESSION['exerciseResult'])) { + api_session_unregister('exerciseResult'); + unset ($exerciseResult); + } + if (isset ($_SESSION['exerciseResultCoordinates'])) { + api_session_unregister('exerciseResultCoordinates'); + unset ($exerciseResultCoordinates); + } +} + +$safe_lp_id = ($learnpath_id == '') ? 0 : (int) $learnpath_id; +$safe_lp_item_id = ($learnpath_item_id == '') ? 0 : (int) $learnpath_item_id; +$condition = ' WHERE ' . + 'exe_exo_id = ' . "'" . $exerciseId . "'" . ' AND ' . + 'exe_user_id = ' . "'" . api_get_user_id() . "'" . ' AND ' . + 'exe_cours_id = ' . "'" . $_course['id'] . "'" . ' AND ' . + 'status = ' . "'incomplete'" . ' AND ' . + 'orig_lp_id = ' . "'" . $safe_lp_id . "'" . ' AND ' . + 'orig_lp_item_id = ' . "'" . $safe_lp_item_id . "'" . ' AND ' . + 'session_id = ' . "'" . (int) $_SESSION['id_session'] . "'"; + +$TBL_EXERCICES = Database :: get_course_table(TABLE_QUIZ_TEST); +$result = Database::query("SELECT type,feedback_type FROM $TBL_EXERCICES WHERE id=$exerciseId", __FILE__, __LINE__); +$exercise_row = Database :: fetch_array($result); +$exerciseType = $exercise_row['type']; +$exerciseFeedbackType = $exercise_row['feedback_type']; + +if ($_configuration['live_exercise_tracking'] == true && $exerciseType == 2 && $exerciseFeedbackType != 1) { + $query = 'SELECT * FROM ' . $stat_table . $condition; + $result_select = Database::query($query, __FILE__, __LINE__); + if (Database :: num_rows($result_select) > 0) { + $getIncomplete = Database :: fetch_array($result_select); + $exe_id = $getIncomplete['exe_id']; + if ($_SERVER['REQUEST_METHOD'] != 'POST') { + define('QUESTION_LIST_ALREADY_LOGGED', 1); + $recorded['questionList'] = explode(',', $getIncomplete['data_tracking']); + $query = 'SELECT * FROM ' . $exercice_attemp_table . ' WHERE exe_id = ' . $getIncomplete['exe_id'] . ' ORDER BY tms ASC'; + $result = Database::query($query, __FILE__, __LINE__); + while ($row = Database :: fetch_array($result)) { + $recorded['exerciseResult'][$row['question_id']] = 1; + } + $exerciseResult = $_SESSION['exerciseResult'] = $recorded['exerciseResult']; + $exerciseType = 2; + $questionNum = count($recorded['exerciseResult']); + $questionNum++; + $questionList = $_SESSION['questionList'] = $recorded['questionList']; + } + } else { + $table_recorded_not_exist = true; + } +} + +// if the user has submitted the form +if ($formSent) { + if ($debug > 0) { + echo str_repeat(' ', 0) . '$formSent was set' . "
\n"; + } + + // initializing + if (!is_array($exerciseResult)) { + $exerciseResult = array (); + $exerciseResultCoordinates = array (); + } + + // if the user has answered at least one question + if (is_array($choice)) { + if ($debug > 0) { + echo str_repeat(' ', 0) . '$choice is an array' . "
\n"; + } + + if ($exerciseType == 1) + { + // $exerciseResult receives the content of the form. + // Each choice of the student is stored into the array $choice + $exerciseResult = $choice; + + // Also store hotspot spots in the session ($exerciseResultCoordinates + // will be stored in the session at the end of this script) + // The results will be stored by exercise_result.php if we are in + // an exercise of type 1 (=all on one page) + if (isset ($_POST['hotspot'])) { + $exerciseResultCoordinates = $_POST['hotspot']; + } + + } else { + // gets the question ID from $choice. It is the key of the array + list ($key) = array_keys($choice); + + // if the user didn't already answer this question + if (!isset ($exerciseResult[$key])) { + // stores the user answer into the array + $exerciseResult[$key] = $choice[$key]; + + //saving each question + if ($_configuration['live_exercise_tracking'] == true && $exerciseType == 2 && $exerciseFeedbackType != 1) { + + $nro_question = $questionNum; // - 1; + + //START of saving and qualifying each question submitted + //------------------------------------------------------------------------------------------ + // + define('ENABLED_LIVE_EXERCISE_TRACKING', 1); + require_once 'question.class.php'; + require_once 'answer.class.php'; + $counter = 0; + $main_course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER); + $table_ans = Database :: get_course_table(TABLE_QUIZ_ANSWER); + //foreach($questionList as $questionId) + if (true) { + $exeId = $exe_id; + $questionId = $key; + $counter++; + // gets the student choice for this question + $choice = $exerciseResult[$questionId]; + + // creates a temporary Question object + $objQuestionTmp = Question :: read($questionId); + + $questionName = $objQuestionTmp->selectTitle(); + $questionDescription = $objQuestionTmp->selectDescription(); + $questionWeighting = $objQuestionTmp->selectWeighting(); + $answerType = $objQuestionTmp->selectType(); + $quesId = $objQuestionTmp->selectId(); //added by priya saini + + // destruction of the Question object + unset ($objQuestionTmp); + + if (isset ($_POST['hotspot']) && isset($_POST['hotspot'][$key])) { + $exerciseResultCoordinates[$key] = $_POST['hotspot'][$key]; + } + + // construction of the Answer object + $objAnswerTmp = new Answer($questionId); + $nbrAnswers = $objAnswerTmp->selectNbrAnswers(); + $questionScore = 0; + if ($answerType == FREE_ANSWER) { + $nbrAnswers = 1; + } + + for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { + $answer = $objAnswerTmp->selectAnswer($answerId); + $answerComment = $objAnswerTmp->selectComment($answerId); + $answerCorrect = $objAnswerTmp->isCorrect($answerId); + $answerWeighting = $objAnswerTmp->selectWeighting($answerId); + + switch ($answerType) { + // for unique answer + case UNIQUE_ANSWER : + $studentChoice = ($choice == $answerId) ? 1 : 0; + + if ($studentChoice) { + $questionScore += $answerWeighting; + $totalScore += $answerWeighting; + } + + break; + // for multiple answers + case MULTIPLE_ANSWER : + + $studentChoice = $choice[$answerId]; + + if ($studentChoice) { + $questionScore += $answerWeighting; + $totalScore += $answerWeighting; + } + + break; + // for fill in the blanks + case FILL_IN_BLANKS : + + // the question is encoded like this + // [A] B [C] D [E] F::10,10,10@1 + // number 1 before the "@" means that is a switchable fill in blank question + // [A] B [C] D [E] F::10,10,10@ or [A] B [C] D [E] F::10,10,10 + // means that is a normal fill blank question + + // first we explode the "::" + $pre_array = explode('::', $answer); + + // is switchable fill blank or not + $last = count($pre_array) - 1; + $is_set_switchable = explode('@', $pre_array[$last]); + + $switchable_answer_set = false; + if (isset ($is_set_switchable[1]) && $is_set_switchable[1] == 1) { + $switchable_answer_set = true; + } + + $answer = ''; + for ($k = 0; $k < $last; $k++) { + $answer .= $pre_array[$k]; + } + + // splits weightings that are joined with a comma + $answerWeighting = explode(',', $is_set_switchable[0]); + + // we save the answer because it will be modified + $temp = $answer; + + // TeX parsing + // 1. find everything between the [tex] and [/tex] tags + $startlocations = strpos($temp, '[tex]'); + $endlocations = strpos($temp, '[/tex]'); + + if ($startlocations !== false && $endlocations !== false) { + $texstring = substr($temp, $startlocations, $endlocations - $startlocations +6); + // 2. replace this by {texcode} + $temp = str_replace($texstring, '{texcode}', $temp); + } + + $answer = ''; + $j = 0; + + //initialise answer tags + $user_tags = array (); + $correct_tags = array (); + $real_text = array (); + // the loop will stop at the end of the text + while (1) { + // quits the loop if there are no more blanks (detect '[') + if (($pos = strpos($temp, '[')) === false) { + // adds the end of the text + $answer = $temp; + // TeX parsing - replacement of texcode tags + $texstring = api_parse_tex($texstring); + $answer = str_replace("{texcode}", $texstring, $answer); + $real_text[] = $answer; + break; //no more "blanks", quit the loop + } + // adds the piece of text that is before the blank + //and ends with '[' into a general storage array + $real_text[] = substr($temp, 0, $pos +1); + $answer .= substr($temp, 0, $pos +1); + //take the string remaining (after the last "[" we found) + $temp = substr($temp, $pos +1); + // quit the loop if there are no more blanks, and update $pos to the position of next ']' + if (($pos = strpos($temp, ']')) === false) { + // adds the end of the text + $answer .= $temp; + break; + } + $choice[$j] = trim($choice[$j]); + $user_tags[] = strtolower($choice[$j]); + //put the contents of the [] answer tag into correct_tags[] + $correct_tags[] = strtolower(substr($temp, 0, $pos)); + $j++; + $temp = substr($temp, $pos +1); + //$answer .= ']'; + } + + $answer = ''; + $real_correct_tags = $correct_tags; + $chosen_list = array (); + + for ($i = 0; $i < count($real_correct_tags); $i++) { + if ($i == 0) { + $answer .= $real_text[0]; + } + + if (!$switchable_answer_set) { + if ($correct_tags[$i] == $user_tags[$i]) { + // gives the related weighting to the student + $questionScore += $answerWeighting[$i]; + // increments total score + $totalScore += $answerWeighting[$i]; + // adds the word in green at the end of the string + $answer .= $correct_tags[$i]; + } + // else if the word entered by the student IS NOT the same as the one defined by the professor + elseif (!empty ($user_tags[$i])) { + // adds the word in red at the end of the string, and strikes it + $answer .= '' . $user_tags[$i] . ''; + } else { + // adds a tabulation if no word has been typed by the student + $answer .= '   '; + } + } else { + // switchable fill in the blanks + if (in_array($user_tags[$i], $correct_tags)) { + $chosen_list[] = $user_tags[$i]; + $correct_tags = array_diff($correct_tags, $chosen_list); + + // gives the related weighting to the student + $questionScore += $answerWeighting[$i]; + // increments total score + $totalScore += $answerWeighting[$i]; + // adds the word in green at the end of the string + $answer .= $user_tags[$i]; + } + elseif (!empty ($user_tags[$i])) { + // else if the word entered by the student IS NOT the same as the one defined by the professor + // adds the word in red at the end of the string, and strikes it + $answer .= '' . $user_tags[$i] . ''; + } else { + // adds a tabulation if no word has been typed by the student + $answer .= '   '; + } + } + // adds the correct word, followed by ] to close the blank + $answer .= ' / ' . $real_correct_tags[$i] . ']'; + if (isset ($real_text[$i +1])) { + $answer .= $real_text[$i +1]; + } + } + + break; + // for free answer + case FREE_ANSWER : + $studentChoice = $choice; + + if ($studentChoice) { + //Score is at -1 because the question has'nt been corected + $questionScore = -1; + $totalScore += 0; + } + break; + // for matching + case MATCHING : + if ($answerCorrect) { + if ($answerCorrect == $choice[$answerId]) { + $questionScore += $answerWeighting; + $totalScore += $answerWeighting; + $choice[$answerId] = $matching[$choice[$answerId]]; + } + elseif (!$choice[$answerId]) { + $choice[$answerId] = '   '; + } else { + $choice[$answerId] = '' . $matching[$choice[$answerId]] . ''; + } + } else { + $matching[$answerId] = $answer; + } + break; + // for hotspot with no order + case HOT_SPOT : + $studentChoice = $choice[$answerId]; + + if ($studentChoice) { + $questionScore += $answerWeighting; + $totalScore += $answerWeighting; + } + break; + // for hotspot with fixed order + case HOT_SPOT_ORDER : + $studentChoice = $choice['order'][$answerId]; + + if ($studentChoice == $answerId) { + $questionScore += $answerWeighting; + $totalScore += $answerWeighting; + $studentChoice = true; + } else { + $studentChoice = false; + } + break; + } // end switch Answertype + } // end for that loops over all answers of the current question + // destruction of Answer + unset ($objAnswerTmp); + + $i++; + + $totalWeighting += $questionWeighting; + //added by priya saini + // Store results directly in the database + // For all in one page exercises, the results will be + // stored by exercise_results.php (using the session) + if ($_configuration['tracking_enabled']) { + if (empty ($choice)) { + $choice = 0; + } + if ($answerType == MULTIPLE_ANSWER) { + if ($choice != 0) { + $reply = array_keys($choice); + + for ($i = 0; $i < sizeof($reply); $i++) { + $ans = $reply[$i]; + + exercise_attempt($questionScore, $ans, $quesId, $exeId, $i); + } + } else { + exercise_attempt($questionScore, 0, $quesId, $exeId, 0); + } + } + elseif ($answerType == MATCHING) { + $j = sizeof($matching) + 1; + + for ($i = 0; $i < sizeof($choice); $i++, $j++) { + $val = $choice[$j]; + if (preg_match_all('#([0-9a-z ]*)#', $val, $arr1)) { + $val = $arr1[1][0]; + } + $val = $val; + $val = strip_tags($val); + $sql = "select position from $table_ans where question_id='" . Database :: escape_string($questionId) . "' and answer='" . Database :: escape_string($val) . "' AND correct=0"; + $res = Database::query($sql, __FILE__, __LINE__); + if (Database :: num_rows($res) > 0) { + $answer = Database :: result($res, 0, "position"); + } else { + $answer = ''; + } + exercise_attempt($questionScore, $answer, $quesId, $exeId, $j); + + } + } elseif ($answerType == FREE_ANSWER) { + $answer = $choice; + exercise_attempt($questionScore, $answer, $quesId, $exeId, 0); + } elseif ($answerType == UNIQUE_ANSWER) { + $answer = $choice; + exercise_attempt($questionScore, $answer, $quesId, $exeId, 0); + } elseif ($answerType == HOT_SPOT) { + exercise_attempt($questionScore, $answer, $quesId, $exeId, 0); + if (is_array($exerciseResultCoordinates[$key])) { + foreach($exerciseResultCoordinates[$key] as $idx => $val) { + exercise_attempt_hotspot($exeId,$quesId,$idx,$choice[$idx],$val); + } + } + } else { + exercise_attempt($questionScore, $answer, $quesId, $exeId, 0); + } + } + } + // end huge foreach() block that loops over all questions + + //at loops over all questions + if (isset($exe_id)) { + $sql_update = 'UPDATE ' . $stat_table . ' SET exe_result = exe_result + ' . (int) $totalScore . ',exe_weighting = exe_weighting + ' . (int) $totalWeighting . ' WHERE exe_id = ' . Database::escape_string($exe_id); + Database::query($sql_update, __FILE__, __LINE__); + } + //END of saving and qualifying + //------------------------------------------------------------------------------------------ + // + } + } + } + if ($debug > 0) { + echo str_repeat(' ', 0) . '$choice is an array - end' . "
\n"; + } + } + + // the script "exercise_result.php" will take the variable $exerciseResult from the session + api_session_register('exerciseResult'); + api_session_register('exerciseResultCoordinates'); + define('ALL_ON_ONE_PAGE',1); + define('ONE_PER_PAGE',2); + // if all questions on one page OR if it is the last question (only for an exercise with one question per page) + if ($exerciseType == ALL_ON_ONE_PAGE || $questionNum >= $nbrQuestions) { + if ($debug > 0) { + echo str_repeat(' ', 0) . 'Redirecting to exercise_result.php - Remove debug option to let this happen' . "
\n"; + } + if ( api_is_allowed_to_session_edit() ) { + // goes to the script that will show the result of the exercise + if ($exerciseType == ALL_ON_ONE_PAGE) { + header("Location: exercise_result.php?id=$exe_id&exerciseType=$exerciseType&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"); + } else { + if ($exe_id != '') { + //clean incomplete + $update_query = 'UPDATE ' . $stat_table . ' SET ' . "status = '', data_tracking='', exe_date = '" . date('Y-m-d H:i:s') . "'" . ' WHERE exe_id = ' . Database::escape_string($exe_id); + Database::query($update_query, __FILE__, __LINE__); + } + header("Location: exercise_show.php?id=$exe_id&exerciseType=$exerciseType&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id"); + } + exit (); + } else { + header("Location: exercice_submit.php?exerciseId=$exerciseId"); + exit; + } + } + if ($debug > 0) { + echo str_repeat(' ', 0) . '$formSent was set - end' . "
\n"; + } +} + +// if the object is not in the session + +//why destroying the exercise when a LP is loaded ? +//if (!isset($_SESSION['objExercise']) || $origin == 'learnpath' || $_SESSION['objExercise']->id != $_REQUEST['exerciseId']) { +if (!isset ($_SESSION['objExercise']) || $_SESSION['objExercise']->id != $_REQUEST['exerciseId']) { + if ($debug > 0) { + echo str_repeat(' ', 0) . '$_SESSION[objExercise] was unset' . "
\n"; + } + // construction of Exercise + $objExercise = new Exercise(); + unset ($_SESSION['questionList']); + + // if the specified exercise doesn't exist or is disabled + if (!$objExercise->read($exerciseId) || (!$objExercise->selectStatus() && !$is_allowedToEdit && ($origin != 'learnpath'))) { + unset ($objExercise); + $error = get_lang('ExerciseNotFound'); + //die(get_lang('ExerciseNotFound')); + } else { + // saves the object into the session + api_session_register('objExercise'); + if ($debug > 0) { + echo str_repeat(' ', 0) . '$_SESSION[objExercise] was unset - set now - end' . "
\n"; + } + } +} + +if (!isset ($objExcercise) && isset ($_SESSION['objExercise'])) { + $objExercise = $_SESSION['objExercise']; +} +if (!is_object($objExercise)) { + header('Location: exercice.php'); + exit (); +} +$Exe_starttime = $objExercise->start_time; +$Exe_endtime = $objExercise->end_time; +$quizID = $objExercise->selectId(); +$exerciseAttempts = $objExercise->selectAttempts(); +$exerciseTitle = $objExercise->selectTitle(); +$exerciseDescription = $objExercise->selectDescription(); +$exerciseDescription = $exerciseDescription; +$exerciseSound = $objExercise->selectSound(); +$randomQuestions = $objExercise->isRandom(); +$exerciseType = $objExercise->selectType(); +$table_quiz_test = Database :: get_course_table(TABLE_QUIZ_TEST); +//if (!isset($_SESSION['questionList']) || $origin == 'learnpath') { +//in LP's is enabled the "remember question" feature? +$my_exe_id = Security :: remove_XSS($_GET['exerciseId']); +if (!isset ($_SESSION['questionList'])) { + if ($debug > 0) { + echo str_repeat(' ', 0) . '$_SESSION[questionList] was unset' . "
\n"; + } + // selects the list of question ID + $my_question_list = array (); + $questionList = ($randomQuestions ? $objExercise->selectRandomList() : $objExercise->selectQuestionList()); + // saves the question list into the session + $sql = 'SELECT random FROM ' . $table_quiz_test . ' WHERE id="' . Database :: escape_string($my_exe_id) . '";'; + $rs = Database::query($sql, __FILE__, __LINE__); + $row_number = Database :: fetch_array($rs); + $z = 0; + + if ($row_number['random'] <> 0) { + foreach ($questionList as $infoquestionList) { + if ($z < $row_number['random']) { + $my_question_list[$z] = $infoquestionList; + } else { + break; + } + $z++; + } + // $questionList=array(); + $questionList = $my_question_list; + } + api_session_register('questionList'); + if ($debug > 0) { + echo str_repeat(' ', 0) . '$_SESSION[questionList] was unset - set now - end' . "
\n"; + } +} +if (!isset ($objExcercise) && isset ($_SESSION['objExercise'])) { + $questionList = $_SESSION['questionList']; +} + +$quizStartTime = time(); +api_session_register('quizStartTime'); +$nbrQuestions = sizeof($questionList); +// if questionNum comes from POST and not from GET +if (!$questionNum || $_POST['questionNum']) { + // only used for sequential exercises (see $exerciseType) + if (!$questionNum) { + $questionNum = 1; + } else { + $questionNum++; + } +} + +if (!empty ($_GET['gradebook']) && $_GET['gradebook'] == 'view') { + $_SESSION['gradebook'] = Security :: remove_XSS($_GET['gradebook']); + $gradebook = $_SESSION['gradebook']; +} +elseif (empty ($_GET['gradebook'])) { + unset ($_SESSION['gradebook']); + $gradebook = ''; +} + +if (!empty ($gradebook) && $gradebook == 'view') { + $interbreadcrumb[] = array ( + 'url' => '../gradebook/' . $_SESSION['gradebook_dest'], + 'name' => get_lang('Gradebook') + ); +} +//$nameTools=get_lang('Exercice'); + +$interbreadcrumb[] = array ( + "url" => "exercice.php?gradebook=$gradebook", + "name" => get_lang('Exercices') +); +$interbreadcrumb[] = array ( + "url" => api_get_self()."?gradebook=$gradebook", + "name" => $exerciseTitle +); + +if ($origin != 'learnpath') { //so we are not in learnpath tool + + $htmlHeadXtra[] = " + + + + + "; + Display :: display_header($nameTools, "Exercise"); + if (!api_is_allowed_to_session_edit() ) { + Display :: display_warning_message(get_lang('SessionIsReadOnly')); + } +} else { + if (empty ($charset)) { + $charset = 'ISO-8859-15'; + } + /* + * HTML HEADER + */ + Display::display_reduced_header(); + echo '
 
'; +} + +// I'm in a preview mode +if (api_is_course_admin() && $origin != 'learnpath') { + echo '
'; + echo Display :: return_icon('quiz.gif', get_lang('GoBackToEx')) . '' . get_lang('GoBackToEx') . ''; + echo Display :: return_icon('edit.gif', get_lang('ModifyExercise')) . '' . get_lang('ModifyExercise') . ''; + echo '
'; +} + +echo '
'; +$exerciseTitle = api_parse_tex($exerciseTitle); +echo "

" . $exerciseTitle . "

"; + +if ($exerciseAttempts > 0) { + $user_id = api_get_user_id(); + $course_code = api_get_course_id(); + $sql = "SELECT count(*) FROM $stat_table WHERE exe_exo_id = '$quizID' + AND exe_user_id = '$user_id' + AND status != 'incomplete' + AND orig_lp_id = $safe_lp_id + AND orig_lp_item_id = $safe_lp_item_id + AND exe_cours_id = '$course_code' AND session_id = '" . (int) $_SESSION['id_session'] . "'"; + + $aquery = Database::query($sql, __FILE__, __LINE__); + $attempt = Database :: fetch_array($aquery); + + if ($attempt[0] >= $exerciseAttempts) { + if (!api_is_allowed_to_edit(null,true)) { + Display :: display_warning_message(sprintf(get_lang('ReachedMaxAttempts'), $exerciseTitle, $exerciseAttempts), false); + if ($origin != 'learnpath') + Display :: display_footer(); + exit; + } else { + Display :: display_warning_message(sprintf(get_lang('ReachedMaxAttemptsAdmin'), $exerciseTitle, $exerciseAttempts), false); + } + } +} + +if (!function_exists('convert_date_to_number')) { + function convert_date_to_number($default) { + // 2008-10-12 00:00:00 ---to--> 12345672218 (timestamp) + $parts = split(' ', $default); + list ($d_year, $d_month, $d_day) = split('-', $parts[0]); + list ($d_hour, $d_minute, $d_second) = split(':', $parts[1]); + return mktime($d_hour, $d_minute, $d_second, $d_month, $d_day, $d_year); + } +} + +$limit_time_exists = (($Exe_starttime != '0000-00-00 00:00:00') || ($Exe_endtime != '0000-00-00 00:00:00')) ? true : false; +if ($limit_time_exists) { + $exercise_start_time = convert_date_to_number($Exe_starttime); + $exercise_end_time = convert_date_to_number($Exe_endtime); + $time_now = convert_date_to_number(date('Y-m-d H:i:s')); + $permission_to_start = (($time_now - $exercise_start_time) > 0) ? true : false; + if ($_SERVER['REQUEST_METHOD'] != 'POST') + $exercise_timeover = (($time_now - $exercise_end_time) > 0) ? true : false; + if ($permission_to_start == false || $exercise_timeover == true) { // + if (!api_is_allowed_to_edit(null,true)) { + $message_warning = ($permission_to_start == false) ? get_lang('ExerciseNoStartedYet') : get_lang('ReachedTimeLimit'); + Display :: display_warning_message(sprintf($message_warning, $exerciseTitle, $exerciseAttempts)); + Display :: display_footer(); + exit; + } else { + $message_warning = ($permission_to_start == false) ? get_lang('ExerciseNoStartedAdmin') : get_lang('ReachedTimeLimitAdmin'); + Display :: display_warning_message(sprintf($message_warning, $exerciseTitle, $exerciseAttempts)); + } + } +} + +if (!empty ($error)) { + Display :: display_error_message($error, false); +} else { + if (!empty ($exerciseSound)) { + echo "", ", get_lang('Sound') .
+		"; + } + + // Get number of hotspot questions for javascript validation + $number_of_hotspot_questions = 0; + $onsubmit = ''; + $i = 0; + //i have a doubt in this line cvargas + //var_dump($questionList); + if (!strcmp($questionList[0], '') === 0) { + foreach ($questionList as $questionId) { + $i++; + $objQuestionTmp = Question :: read($questionId); + // for sequential exercises + if ($exerciseType == 2) { + // if it is not the right question, goes to the next loop iteration + if ($questionNum != $i) { + continue; + } else { + if ($objQuestionTmp->selectType() == HOT_SPOT) { + $number_of_hotspot_questions++; + } + + break; + } + } else { + if ($objQuestionTmp->selectType() == HOT_SPOT) { + $number_of_hotspot_questions++; + } + } + } + } + if ($number_of_hotspot_questions > 0) { + $onsubmit = "onsubmit=\"return validateFlashVar('" . $number_of_hotspot_questions . "', '" . get_lang('HotspotValidateError1') . "', '" . get_lang('HotspotValidateError2') . "');\""; + } + $s = "

$exerciseDescription

"; + + if ($exerciseType == 2) + { + $s2 = "&exerciseId=" . $exerciseId; + } + + $s .= "
+ + + + + + + + + + + + +
+ "; + echo $s; + $i = 1; + foreach ($questionList as $questionId) { + // for sequential exercises + if ($exerciseType == 2) { + // if it is not the right question, goes to the next loop iteration + if ($questionNum != $i) { + $i++; + continue; + } else { + if ($exerciseFeedbackType != 1) { + // if the user has already answered this question + if (isset ($exerciseResult[$questionId])) { + // construction of the Question object + $objQuestionTmp = Question :: read($questionId); + $questionName = $objQuestionTmp->selectTitle(); + // destruction of the Question object + unset ($objQuestionTmp); + Display :: display_normal_message(get_lang('AlreadyAnswered')); + $i++; + //echo ''; + break; + } + } + } + } + // shows the question and its answers + showQuestion($questionId, false, $origin, $i, $nbrQuestions); + $i++; + // for sequential exercises + if ($exerciseType == 2) { + // quits the loop + break; + } + } + // end foreach() + echo "
"; + echo '
'; + $submit_btn = ""; + echo $submit_btn; + } + + } + + + echo "
'.get_lang('AlreadyAnswered').' "'.$questionName.'"
+
"; + $b = 2; +} +echo '
'; +if ($_configuration['live_exercise_tracking'] == true && $exerciseFeedbackType != 1) { + //if($questionNum < 2){ + if ($table_recorded_not_exist) { + if ($exerciseType == 2) { + Database::query("INSERT INTO $stat_table(exe_exo_id,exe_user_id,exe_cours_id,status,session_id,data_tracking,start_date,orig_lp_id,orig_lp_item_id) + VALUES('$exerciseId','" . api_get_user_id() . "','" . $_course['id'] . "','incomplete','" . api_get_session_id() . "','" . implode(',', $questionList) . "','" . date('Y-m-d H:i:s') . "',$safe_lp_id,$safe_lp_item_id)", __FILE__, __LINE__); + } else { + Database::query("INSERT INTO $stat_table (exe_exo_id,exe_user_id,exe_cours_id,status,session_id,start_date,orig_lp_id,orig_lp_item_id) + VALUES('$exerciseId','" . api_get_user_id() . "','" . $_course['id'] . "','incomplete','" . api_get_session_id() . "','" . date('Y-m-d H:i:s') . "',$safe_lp_id,$safe_lp_item_id)", __FILE__, __LINE__); + } + } +} + +if ($origin != 'learnpath') { + //so we are not in learnpath tool + echo ''; //End glossary div + Display :: display_footer(); +} else { + echo ''; +} From a298c512659f38d8f16eb13a6c410c86a0a881d3 Mon Sep 17 00:00:00 2001 From: iflores Date: Fri, 30 Oct 2009 15:27:59 -0500 Subject: [PATCH 10/13] merge --- main/newscorm/scorm_api.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/newscorm/scorm_api.php b/main/newscorm/scorm_api.php index 43f5dcb1f5..8bdf5652bd 100755 --- a/main/newscorm/scorm_api.php +++ b/main/newscorm/scorm_api.php @@ -180,6 +180,7 @@ $(document).ready( function() { $(document).ready( function() { + $("iframe").contents().find('head').append(''); $("iframe#content_id").load( function(){ //alert("Document title: " + $("iframe#content_id").attr('src')); info_lms_item[0]=info_lms_item[1]; @@ -1592,7 +1593,6 @@ if(lms_lp_type==1 || lms_item_type=='asset'){ */ function attach_glossary_into_scorm() { var f = $('#content_id')[0]; - var doc = f.contentWindow ? f.contentWindow.document : f.contentDocument ? f.contentDocument : f.document; @@ -1614,11 +1614,12 @@ function attach_glossary_into_scorm() { if (datos.length==0) { return false; } + data_terms=datos.split("[|.|_|.|-|.|]"); for(i=0;i])'+specific_terms[1]+'[\ .,]{0,1}',"gi"); + var my_specific_terms = new RegExp(specific_terms[1],"gi"); new_html=my_text.replace(my_specific_terms,function(m){return replace_complete_char(m)}); $frame_content.html(new_html); my_text=$frame_content.html(); From a29419c14ef573f25c3299e62fa7d6589f092d4f Mon Sep 17 00:00:00 2001 From: Isaac Flores Date: Fri, 30 Oct 2009 15:47:20 -0500 Subject: [PATCH 11/13] Improvements in glossary with scorm --- main/inc/lib/javascript/jquery.highlight.js | 1 + main/newscorm/scorm_api.php | 53 ++++++++++++++------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/main/inc/lib/javascript/jquery.highlight.js b/main/inc/lib/javascript/jquery.highlight.js index 74e14766c0..a05b6870c2 100644 --- a/main/inc/lib/javascript/jquery.highlight.js +++ b/main/inc/lib/javascript/jquery.highlight.js @@ -23,6 +23,7 @@ jQuery.fn.highlight = function(pat,real_code) { var spannode = document.createElement('a'); spannode.className = 'glossary-ajax'; spannode.style.color = 'blue'; + spannode.style.textDecoration = 'none'; spannode.name = 'link'+real_code; spannode.href = '#'; var SearchRegExp = new RegExp("(" + pat +")","gi"); diff --git a/main/newscorm/scorm_api.php b/main/newscorm/scorm_api.php index 8bdf5652bd..0b695bbf0a 100755 --- a/main/newscorm/scorm_api.php +++ b/main/newscorm/scorm_api.php @@ -1605,25 +1605,49 @@ function attach_glossary_into_scorm() { $.ajax({ contentType: "application/x-www-form-urlencoded", - beforeSend: function(objeto) { + beforeSend: function(content_object) { }, type: "POST", url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php", data: "glossary_data=true", - success: function(datos) { - if (datos.length==0) { + success: function(datas) { + if (datas.length==0) { return false; } - data_terms=datos.split("[|.|_|.|-|.|]"); + data_terms=datas.split("[|.|_|.|-|.|]"); + var complex_array = new Array(); + var cp_complex_array = new Array(); for(i=0;i"); }, type: "POST", url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php", data: "glossary_id="+my_glossary_id, - success: function(datos) { - $("iframe").contents().find('body').find("div#"+div_content_id).html(datos); + success: function(datas) { + $("iframe").contents().find('body').find("div#"+div_content_id).html(datas); } }); }); @@ -1654,13 +1678,6 @@ function attach_glossary_into_scorm() { div_show_id=current_element.find("div").attr("id"); $("iframe").contents().find('body').find("div#"+div_show_id).remove(); }); - - //Callback Helper - function replace_complete_char(m) { - var complete_term_pattern = new RegExp(real_term,"i"); - var tag = m.replace(complete_term_pattern," $&"); - return tag; - } } From e607de20d71cf90a6877fdea479048b005303c1a Mon Sep 17 00:00:00 2001 From: Arthur Portugal Date: Fri, 30 Oct 2009 15:57:57 -0500 Subject: [PATCH 12/13] Removed void from special features DT#4318 --- main/inc/lib/blog.lib.php | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/main/inc/lib/blog.lib.php b/main/inc/lib/blog.lib.php index 0dff4577b1..3d90188018 100644 --- a/main/inc/lib/blog.lib.php +++ b/main/inc/lib/blog.lib.php @@ -119,12 +119,9 @@ class Blog { /** * Creates a new blog in the given course * @author Toon Keppens - * * @param Integer $course_id Id * @param String $title * @param Text $description - * - * @return void */ public static function create_blog ($title, $subtitle) { global $_user; @@ -170,12 +167,9 @@ class Blog { /** * Update title and subtitle of a blog in the given course * @author Toon Keppens - * * @param Integer $course_id Id * @param String $title * @param Text $description - * - * @return void */ public static function edit_blog ($blog_id, $title, $subtitle) { global $_user; @@ -200,10 +194,7 @@ class Blog { /** * Deletes a blog and it's posts from the course database * @author Toon Keppens - * * @param Integer $blog_id - * - * @return void */ public static function delete_blog ($blog_id) { // Init @@ -249,12 +240,9 @@ class Blog { /** * Creates a new post in a given blog * @author Toon Keppens - * * @param String $title * @param String $full_text * @param Integer $blog_id - * - * @return void */ public static function create_post ($title, $full_text, $file_comment, $blog_id) { global $_user; @@ -327,13 +315,10 @@ class Blog { /** * Edits a post in a given blog * @author Toon Keppens - * * @param Integer $blog_id * @param String $title * @param String $full_text * @param Integer $blog_id - * - * @return void */ public static function edit_post ($post_id, $title, $full_text, $blog_id) { // Init @@ -347,11 +332,8 @@ class Blog { /** * Deletes an article and it's comments * @author Toon Keppens - * * @param Integer $blog_id * @param Integer $post_id - * - * @return void */ public static function delete_post($blog_id, $post_id) { // Init @@ -378,14 +360,11 @@ class Blog { /** * Creates a comment on a post in a given blog * @author Toon Keppens - * * @param String $title * @param String $full_text * @param Integer $blog_id * @param Integer $post_id * @param Integer $parent_id - * - * @return void */ public static function create_comment($title, $full_text, $file_comment,$blog_id, $post_id, $parent_id, $task_id = 'NULL') { global $_user; @@ -458,11 +437,8 @@ class Blog { /** * Deletes a comment from a blogpost * @author Toon Keppens - * * @param Integer $blog_id * @param Integer $comment_id - * - * @return void */ public static function delete_comment ($blog_id, $post_id, $comment_id) { // Init @@ -496,13 +472,10 @@ class Blog { /** * Creates a new task in a blog * @author Toon Keppens - * * @param Integer $blog_id * @param String $title * @param String $description * @param String $color - * - * @return void */ public static function create_task ($blog_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color) { // Init @@ -569,13 +542,10 @@ class Blog { /** * Edit a task in a blog * @author Toon Keppens - * * @param Integer $task_id * @param String $title * @param String $description * @param String $color - * - * @return void */ public static function edit_task($blog_id, $task_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color) { // Init @@ -649,11 +619,8 @@ class Blog { /** * Deletes a task from a blog - * * @param Integer $blog_id * @param Integer $task_id - * - * @return void */ public static function delete_task ($blog_id, $task_id) { // Init @@ -666,11 +633,8 @@ class Blog { /** * Deletes an assigned task from a blog - * * @param Integer $blog_id * @param Integer $assignment_id - * - * @return void */ public static function delete_assigned_task ($blog_id, $task_id,$user_id) { // Init @@ -727,10 +691,7 @@ class Blog { /** * Changes the visibility of a blog * @author Toon Keppens - * * @param Integer $blog_id - * - * @return void */ public static function change_blog_visibility ($blog_id) { // Init From c50f12b3ed5029cf03ac35dd17805f396a4bc620 Mon Sep 17 00:00:00 2001 From: Isaac Flores Date: Fri, 30 Oct 2009 16:11:34 -0500 Subject: [PATCH 13/13] Minor - changed div position --- main/exercice/exercice_submit.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main/exercice/exercice_submit.php b/main/exercice/exercice_submit.php index 338063147a..5f30ef5039 100644 --- a/main/exercice/exercice_submit.php +++ b/main/exercice/exercice_submit.php @@ -68,12 +68,12 @@ $language_file = 'exercice'; require_once '../inc/global.inc.php'; $this_section = SECTION_COURSES; - $htmlHeadXtra[] = ''; //jQuery +$htmlHeadXtra[] = ''; //jQuery +$htmlHeadXtra[] = ''; if (api_get_setting('show_glossary_in_extra_tools') == 'true') { $htmlHeadXtra[] = ''; //Glossary $htmlHeadXtra[] = ''; - } - $htmlHeadXtra[] = ''; +} /* ------------ ACCESS RIGHTS ------------ */ // notice for unauthorized people. api_protect_course_script(true); @@ -907,7 +907,7 @@ if (api_is_course_admin() && $origin != 'learnpath') { echo ''; } -echo '
'; + $exerciseTitle = api_parse_tex($exerciseTitle); echo "

" . $exerciseTitle . "

"; @@ -1027,6 +1027,7 @@ if (!empty ($error)) { "; + echo '
'; echo $s; $i = 1; foreach ($questionList as $questionId) {