Index: temp_moodle_dev/moodle/mod/quiz/edit.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/quiz/edit.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/mod/quiz/edit.php 14 Nov 2008 05:57:17 -0000 1.1 +++ temp_moodle_dev/moodle/mod/quiz/edit.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -27,7 +27,8 @@ */ require_once("../../config.php"); require_once($CFG->dirroot.'/mod/quiz/editlib.php'); - + //Gets Lams update URL if the quiz was created in a sequence + $lamsupdateurl = optional_param('lamsUpdateURL', PARAM_TEXT);//lams update address to come back to Lams after editing the quiz /** * Callback function called from question_list() function (which is called from showbank()) * Displays action icon as first action for each question. @@ -42,7 +43,7 @@ $movearrow = 'moveleft.gif'; } $straddtoquiz = get_string("addtoquiz", "quiz"); - $out = "get_query_string()."&addquestion=$questionid&sesskey=".sesskey()."\">get_query_string()."&addquestion=$questionid&sesskey=".sesskey()."&hola\">pixpath/t/$movearrow\" alt=\"$straddtoquiz\" /> "; return $out; } else { @@ -165,7 +166,7 @@ } if (($addquestion = optional_param('addquestion', 0, PARAM_INT)) and confirm_sesskey()) { /// Add a single question to the current quiz - quiz_add_quiz_question($addquestion, $quiz); + quiz_add_quiz_question($addquestion, $quiz); $significantchangemade = true; } @@ -197,6 +198,8 @@ WHERE qtype = '" . RANDOM . "' AND category = $category->id AND " . sql_compare_text('questiontext') . " = '$recurse' + + AND NOT EXISTS (SELECT * FROM " . $CFG->prefix . "quiz_question_instances WHERE question = q.id) ORDER BY id")) { // Take as many of these as needed. @@ -299,6 +302,13 @@ error('Could not set a new maximum grade for the quiz'); } } + //If there is a Quiz inside a Lams sequence after saving changes from your question's list you are redirect back to the Lams page + if ($quiz->is_lams==1){ + // old redirect(urldecode($lamsupdateurl)."&extToolContentID=$quiz->id"); + //include the javascript code so we can call the button frame and change the button properties so it can be shown + include('showlamsfinish.php'); + + } $significantchangemade = true; } @@ -324,29 +334,30 @@ ? update_module_button($cm->id, $course->id, get_string('modulename', 'quiz')) : ""; $navigation = build_navigation($streditingquiz, $cm); - print_header_simple($streditingquiz, '', $navigation, "", "", - true, $strupdatemodule); - + + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_header_simple($streditingquiz, '', $navigation, "", "",true, $strupdatemodule,'',false,'',false,$cm->is_lams); + $currenttab = 'edit'; $mode = 'editq'; include('tabs.php'); print_box_start(); - echo "
\n"; - echo '' . + echo '' . quiz_num_attempt_summary($quiz, $cm) . '
' . get_string('cannoteditafterattempts', 'quiz'); echo "
\n"; - $sumgrades = quiz_print_question_list($quiz, $thispageurl, false, $quiz_showbreaks, $quiz_reordertool); + if (!set_field('quiz', 'sumgrades', $sumgrades, 'id', $quiz->instance)) { error('Failed to set sumgrades'); } print_box_end(); - print_footer($course); + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_footer(null,null, false,$quiz->is_lams); exit; } @@ -355,7 +366,9 @@ ? update_module_button($cm->id, $course->id, get_string('modulename', 'quiz')) : ""; $navigation = build_navigation($streditingquiz, $cm); - print_header_simple($streditingquiz, '', $navigation, "", "", true, $strupdatemodule); + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_header_simple($streditingquiz, '', $navigation, "", "", true, $strupdatemodule,'',false,'',false,$quiz->is_lams); + //old print_header_simple($streditingquiz, '', $navigation, "", "", true, $strupdatemodule); $currenttab = 'edit'; $mode = 'editq'; @@ -366,21 +379,20 @@ echo ''; print_box_start('generalbox quizquestions'); print_heading(get_string('questionsinthisquiz', 'quiz'), '', 2); - - $sumgrades = quiz_print_question_list($quiz, $thispageurl, true, $quiz_showbreaks, $quiz_reordertool); + $sumgrades = quiz_print_question_list($quiz, $thispageurl, true, $quiz_showbreaks, $quiz_reordertool); + if (!set_field('quiz', 'sumgrades', $sumgrades, 'id', $quiz->instance)) { error('Failed to set sumgrades'); } print_box_end(); echo ''; - - question_showbank('editq', $contexts, $thispageurl, $cm, $pagevars['qpage'], $pagevars['qperpage'], $pagevars['qsortorder'], $pagevars['qsortorderdecoded'], - $pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'], $pagevars['showquestiontext']); - + question_showbank('editq', $contexts, $thispageurl, $cm, $pagevars['qpage'], $pagevars['qperpage'], $pagevars['qsortorder'], $pagevars['qsortorderdecoded'], + $pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'], $pagevars['showquestiontext']); + echo ''; echo ''; - - print_footer($course); + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_footer($course,null, false,$quiz->is_lams); ?>