Index: temp_moodle_dev/lamstwo/tooladapter_quiz.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/lamstwo/Attic/tooladapter_quiz.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ temp_moodle_dev/lamstwo/tooladapter_quiz.php 14 Nov 2008 06:16:59 -0000 1.1 @@ -0,0 +1,60 @@ +libdir.'/datalib.php'); + include_once('../quiz/lib.php'); + + $ts = optional_param('ts', '', PARAM_TEXT); + $username = optional_param('un', '', PARAM_TEXT); + $hs = optional_param('hs', '', PARAM_TEXT); + + + if ( ! isset($CFG->lamstwo_serverid) || ! isset($CFG->lamstwo_serverkey) ) { + header('HTTP/1.1 401 Unauthenticated'); + exit(1); + } + $plaintext = trim($ts).trim($username).trim($CFG->lamstwo_serverid).trim($CFG->lamstwo_serverkey); + $hash = sha1(strtolower($plaintext)); + // + if ( $hash != $hs ){ + header('HTTP/1.1 401 Unauthenticated'); + exit(1); + } + + + + $method = optional_param('method', '', PARAM_TEXT); + $cmid = optional_param('extToolContentID', 0, PARAM_INT); + $sectionid = optional_param('section', 1, PARAM_INT); + $courseid = optional_param('cs', 1, PARAM_INT); + $outputname = optional_param('oname', '', PARAM_TEXT); + + $user = get_record('user', 'username', $username); + + switch ($method) { + case 'clone': + $newcmid = quiz_clone_instance($cmid, $sectionid, $courseid); + echo $newcmid; + break; + case 'import': + $newcmid = quiz_import_instance($_FILES['upload_file']['tmp_name'], $user->id, $courseid, $sectionid); + echo $newcmid; + break; + case 'export': + quiz_export_instance($cmid); + break; + case 'export_portfolio': + $text = quiz_export_portfolio($cmid, $user->id); + echo $text; + break; + case 'output': + $output = quiz_get_tool_output($cmid, $user->id); + echo $output; + break; + default: + } + ?> \ No newline at end of file Index: temp_moodle_dev/moodle/course/lamsbuttons.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/course/lamsbuttons.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ temp_moodle_dev/moodle/course/lamsbuttons.php 14 Nov 2008 06:16:59 -0000 1.1 @@ -0,0 +1,57 @@ + + + LAMS frame + + + + + + +
+ '); + ?> +
+ + '; + ?> + + + + + Index: temp_moodle_dev/moodle/course/lamsframes.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/course/lamsframes.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ temp_moodle_dev/moodle/course/lamsframes.php 14 Nov 2008 06:16:59 -0000 1.1 @@ -0,0 +1,41 @@ + +lamsframes + + + + + + + Index: temp_moodle_dev/moodle/course/modedit-lams.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/course/modedit-lams.php,v diff -u -r1.2 -r1.3 --- temp_moodle_dev/moodle/course/modedit-lams.php 21 Aug 2008 00:19:55 -0000 1.2 +++ temp_moodle_dev/moodle/course/modedit-lams.php 14 Nov 2008 06:16:59 -0000 1.3 @@ -5,14 +5,16 @@ require_once("../config.php"); require_once("lib.php"); require_once($CFG->libdir.'/gradelib.php'); + require_login(); $add = optional_param('add', 0, PARAM_ALPHA); $update = optional_param('update', 0, PARAM_INT); $return = optional_param('return', 0, PARAM_BOOL); //return to course/view.php if false or mod/modname/view.php if true $type = optional_param('type', '', PARAM_ALPHANUM); - $lamsupdateurl = required_param('lamsUpdateURL', PARAM_TEXT); + $lamsupdateurl = optional_param('lamsUpdateURL', PARAM_TEXT); //get lamsupdateurl variable if coming from a Lams activity + $is_learner = optional_param('is_learner', 0, PARAM_INT); if (!empty($add)) { $section = required_param('section', PARAM_INT); @@ -29,7 +31,7 @@ if (! $module = get_record("modules", "name", $add)) { error("This module type doesn't exist"); } - + $cw = get_course_section($section, $course->id); if (!course_allowed_module($course, $module->id)) { @@ -39,7 +41,7 @@ $cm = null; $form->section = $section; // The section number itself - relative!!! (section column in course_sections) - $form->visible = $cw->visible; + $form->visible = 1;// We always mark as visible our Lams Courses because we have our is_lams variable to hide/unhide them if necessary old $cw->visible; $form->course = $course->id; $form->module = $module->id; $form->modulename = $module->name; @@ -101,7 +103,7 @@ $form->coursemodule = $cm->id; $form->section = $cw->section; // The section number itself - relative!!! (section column in course_sections) - $form->visible = $cm->visible; //?? $cw->visible ? $cm->visible : 0; // section hiding overrides + $form->visible = 1;// We always mark as visible our Lams Courses because we have our is_lams variable to hide/unhide them if necessary, old $cm->visible; //?? $cw->visible ? $cm->visible : 0; // section hiding overrides $form->cmidnumber = $cm->idnumber; // The cm IDnumber $form->groupmode = groups_get_activity_groupmode($cm); // locked later if forced $form->groupingid = $cm->groupingid; @@ -300,6 +302,7 @@ } if (! $sectionid = add_mod_to_section($fromform) ) { error("Could not add the new course module to that section"); + } if (! set_field("course_modules", "section", $sectionid, "id", $fromform->coursemodule)) { @@ -414,8 +417,14 @@ rebuild_course_cache($course->id); grade_regrade_final_grades($course->id); - - redirect("$lamsupdateurl&extToolContentID=$fromform->coursemodule"); + + //LAMS: one you submit if you are in a Quiz you continue editing the quiz, if you're finished then return to Lams + if (isset($fromform->submitbutton)) { + // If is a Lams activity we add editing variable to know in the sequence when to display Next activity button or back to Lams button, we also passes is_learner variable so we know if teacher is acting as a learner or as a teacher + redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$fromform->coursemodule&is_learner=$is_learner&editing=1"); + } else { + redirect("$lamsupdateurl&extToolContentID=$fromform->coursemodule"); + } exit; } else { @@ -428,31 +437,33 @@ $streditinga = get_string("editinga", "moodle", $fullmodulename); $strmodulenameplural = get_string("modulenameplural", $module->name); - - /* - $navlinks = array(); - $navlinks[] = array('name' => $strmodulenameplural, 'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id", 'type' => 'activity'); - if ($navlinksinstancename) { - $navlinks[] = $navlinksinstancename; - } - $navlinks[] = array('name' => $streditinga, 'link' => '', 'type' => 'title'); - */ - + /* + $navlinks = array(); + $navlinks[] = array('name' => $strmodulenameplural, 'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id", 'type' => 'activity'); + if ($navlinksinstancename) { + $navlinks[] = $navlinksinstancename; + } + $navlinks[] = array('name' => $streditinga, 'link' => '', 'type' => 'title'); + */ $navigation = ''; //build_navigation($navlinks); - - print_header_simple($streditinga, "LAMS", $navigation, $mform->focus(), "", false); - - if (!empty($cm->id)) { + + //We don't want to display Moodle navigation top menus in Lams + print_header(); + //old print_header_simple($streditinga, "LAMS", $navigation, $mform->focus(), "", false,$strupdatemodule); + + // In Lams we don't need horitzontal extra tabs while editing + /*if (!empty($cm->id)) { $context = get_context_instance(CONTEXT_MODULE, $cm->id); $overridableroles = get_overridable_roles($context); $assignableroles = get_assignable_roles($context); $currenttab = 'update'; include_once($CFG->dirroot.'/'.$CFG->admin.'/roles/tabs.php'); - } + }*/ $icon = ''; print_heading_with_help($pageheading, "mods", $module->name, $icon); $mform->display(); - //print_footer($course); + //We don't want to display Moodle navigation bottom menu in Lams + //print_footer($course); } ?> Index: temp_moodle_dev/moodle/lib/weblib.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/lib/weblib.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/lib/weblib.php 14 Nov 2008 05:57:17 -0000 1.1 +++ temp_moodle_dev/moodle/lib/weblib.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -2835,32 +2835,38 @@ * @param string $bodytags This text will be included verbatim in the tag (useful for onload() etc) * @param bool $return If true, return the visible elements of the header instead of echoing them. */ +//we pass a new parameter (is_lams) so it will be useful for lams navigation function print_header_simple($title='', $heading='', $navigation='', $focus='', $meta='', - $cache=true, $button=' ', $menu='', $usexml=false, $bodytags='', $return=false) { + $cache=true, $button=' ', $menu='', $usexml=false, $bodytags='', $return=false,$is_lams=null) { global $COURSE, $CFG; - - // if we have no navigation specified, build it - if( empty($navigation) ){ - $navigation = build_navigation(''); - } - - // If old style nav prepend course short name otherwise leave $navigation object alone - if (!is_newnav($navigation)) { - if ($COURSE->id != SITEID) { - $shortname = ''. $COURSE->shortname .' ->'; - $navigation = $shortname.' '.$navigation; - } - } - - $output = print_header($COURSE->shortname .': '. $title, $COURSE->fullname .' '. $heading, $navigation, $focus, $meta, - $cache, $button, $menu, $usexml, $bodytags, true); - - if ($return) { - return $output; - } else { - echo $output; - } + //If is lams don't print top navigation menu (just let the header be blank) + if($is_lams==1){ + print_header(); + }else{ // print the header normally + // if we have no navigation specified, build it + if( empty($navigation) ){ + $navigation = build_navigation(''); + } + + // If old style nav prepend course short name otherwise leave $navigation object alone + if (!is_newnav($navigation)) { + if ($COURSE->id != SITEID) { + $shortname = ''. $COURSE->shortname .' ->'; + $navigation = $shortname.' '.$navigation; + } + } + + $output = print_header($COURSE->shortname .': '. $title, $COURSE->fullname .' '. $heading, $navigation, $focus, $meta, + $cache, $button, $menu, $usexml, $bodytags, true); + + + if ($return) { + return $output; + } else { + echo $output; + } + } } @@ -2876,110 +2882,113 @@ * @param boolean $return output as string * @return mixed string or void */ -function print_footer($course=NULL, $usercourse=NULL, $return=false) { - global $USER, $CFG, $THEME, $COURSE; - - if (defined('ADMIN_EXT_HEADER_PRINTED') and !defined('ADMIN_EXT_FOOTER_PRINTED')) { - admin_externalpage_print_footer(); - return; - } - -/// Course links or special footer - if ($course) { - if ($course === 'empty') { - // special hack - sometimes we do not want even the docs link in footer - $output = ''; - if (!empty($THEME->open_header_containers)) { - for ($i=0; $i<$THEME->open_header_containers; $i++) { - $output .= print_container_end_all(); // containers opened from header - } - } else { - //1.8 theme compatibility - $output .= "\n"; // content div - } - $output .= "\n\n\n"; // close page div started in header - if ($return) { - return $output; - } else { - echo $output; - return; - } - - } else if ($course === 'none') { // Don't print any links etc - $homelink = ''; - $loggedinas = ''; - $home = false; - - } else if ($course === 'home') { // special case for site home page - please do not remove - $course = get_site(); - $homelink = ''; - $home = true; - - } else { - $homelink = ''; - $home = false; - } - - } else { - $course = get_site(); // Set course as site course by default - $homelink = ''; - $home = false; - } - -/// Set up some other navigation links (passed from print_header by ugly hack) - $menu = isset($THEME->menu) ? str_replace('navmenu', 'navmenufooter', $THEME->menu) : ''; - $title = isset($THEME->title) ? $THEME->title : ''; - $button = isset($THEME->button) ? $THEME->button : ''; - $heading = isset($THEME->heading) ? $THEME->heading : ''; - $navigation = isset($THEME->navigation) ? $THEME->navigation : ''; - $navmenulist = isset($THEME->navmenulist) ? $THEME->navmenulist : ''; - - -/// Set the user link if necessary - if (!$usercourse and is_object($course)) { - $usercourse = $course; - } - - if (!isset($loggedinas)) { - $loggedinas = user_login_string($usercourse, $USER); - } - - if ($loggedinas == $menu) { - $menu = ''; - } - -/// there should be exactly the same number of open containers as after the header - if ($THEME->open_header_containers != open_containers()) { - debugging('Unexpected number of open containers: '.open_containers().', expecting '.$THEME->open_header_containers, DEBUG_DEVELOPER); - } - -/// Provide some performance info if required - $performanceinfo = ''; - if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) { - $perf = get_performance_info(); - if (defined('MDL_PERFTOLOG') && !function_exists('register_shutdown_function')) { - error_log("PERF: " . $perf['txt']); - } - if (defined('MDL_PERFTOFOOT') || debugging() || $CFG->perfdebug > 7) { - $performanceinfo = $perf['html']; - } - } - -/// Include the actual footer file - - ob_start(); - include($CFG->footer); - $output = ob_get_contents(); - ob_end_clean(); - - if ($return) { - return $output; - } else { - echo $output; - } +//we pass a new parameter (is_lams) so it will be useful for lams navigation +function print_footer($course=NULL, $usercourse=NULL, $return=false,$is_lams=null) { +//If is lams don't print bottom navigation menu, else, print it normally + if($is_lams!=1){ + global $USER, $CFG, $THEME, $COURSE; + if (defined('ADMIN_EXT_HEADER_PRINTED') and !defined('ADMIN_EXT_FOOTER_PRINTED')) { + admin_externalpage_print_footer(); + return; + } + + /// Course links or special footer + if ($course) { + if ($course === 'empty') { + // special hack - sometimes we do not want even the docs link in footer + $output = ''; + if (!empty($THEME->open_header_containers)) { + for ($i=0; $i<$THEME->open_header_containers; $i++) { + $output .= print_container_end_all(); // containers opened from header + } + } else { + //1.8 theme compatibility + $output .= "\n"; // content div + } + $output .= "\n\n\n"; // close page div started in header + if ($return) { + return $output; + } else { + echo $output; + return; + } + + } else if ($course === 'none') { // Don't print any links etc + $homelink = ''; + $loggedinas = ''; + $home = false; + + } else if ($course === 'home') { // special case for site home page - please do not remove + $course = get_site(); + $homelink = ''; + $home = true; + + } else { + $homelink = ''; + $home = false; + } + + } else { + $course = get_site(); // Set course as site course by default + $homelink = ''; + $home = false; + } + + /// Set up some other navigation links (passed from print_header by ugly hack) + $menu = isset($THEME->menu) ? str_replace('navmenu', 'navmenufooter', $THEME->menu) : ''; + $title = isset($THEME->title) ? $THEME->title : ''; + $button = isset($THEME->button) ? $THEME->button : ''; + $heading = isset($THEME->heading) ? $THEME->heading : ''; + $navigation = isset($THEME->navigation) ? $THEME->navigation : ''; + $navmenulist = isset($THEME->navmenulist) ? $THEME->navmenulist : ''; + + + /// Set the user link if necessary + if (!$usercourse and is_object($course)) { + $usercourse = $course; + } + + if (!isset($loggedinas)) { + $loggedinas = user_login_string($usercourse, $USER); + } + + if ($loggedinas == $menu) { + $menu = ''; + } + + /// there should be exactly the same number of open containers as after the header + if ($THEME->open_header_containers != open_containers()) { + debugging('Unexpected number of open containers: '.open_containers().', expecting '.$THEME->open_header_containers, DEBUG_DEVELOPER); + } + + /// Provide some performance info if required + $performanceinfo = ''; + if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) { + $perf = get_performance_info(); + if (defined('MDL_PERFTOLOG') && !function_exists('register_shutdown_function')) { + error_log("PERF: " . $perf['txt']); + } + if (defined('MDL_PERFTOFOOT') || debugging() || $CFG->perfdebug > 7) { + $performanceinfo = $perf['html']; + } + } + + /// Include the actual footer file + + ob_start(); + include($CFG->footer); + $output = ob_get_contents(); + ob_end_clean(); + + if ($return) { + return $output; + } else { + echo $output; + } + } } /** @@ -4231,7 +4240,7 @@ $output .= '
'; if ($options) { foreach ($options as $name => $value) { - $output .= ''; + $output .= ''; } } if ($tooltip) { @@ -6618,7 +6627,7 @@ global $CFG, $SITE; $CFG->pagepath = "index.php"; - print_header(strip_tags($SITE->fullname), $SITE->fullname, 'home'); + print_er(strip_tags($SITE->fullname), $SITE->fullname, 'home'); print_box_start(); print_heading(get_string('sitemaintenance', 'admin')); @include($CFG->dataroot.'/1/maintenance.html'); @@ -6751,6 +6760,7 @@ $str .= ' '."\n"; } + $str .= ''."\n"; return $str; Index: temp_moodle_dev/moodle/mod/quiz/attempt.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/quiz/attempt.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/mod/quiz/attempt.php 14 Nov 2008 05:57:17 -0000 1.1 +++ temp_moodle_dev/moodle/mod/quiz/attempt.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -60,8 +60,8 @@ $ispreviewing = has_capability('mod/quiz:preview', $context); // if no questions have been set up yet redirect to edit.php - if (!$quiz->questions and has_capability('mod/quiz:manage', $context)) { - redirect($CFG->wwwroot . '/mod/quiz/edit.php?cmid=' . $cm->id); + if (!$quiz->questions and has_capability('mod/quiz:manage', $context)) { + redirect($CFG->wwwroot . '/mod/quiz/edit.php?cmid=' . $cm->id); } if (!$ispreviewing) { @@ -85,13 +85,14 @@ /// Check number of attempts $numberofpreviousattempts = count_records_select('quiz_attempts', "quiz = '{$quiz->id}' AND " . "userid = '{$USER->id}' AND timefinish > 0 AND preview != 1"); + if ($quiz->attempts and $numberofpreviousattempts >= $quiz->attempts) { - print_error('nomoreattempts', 'quiz', "view.php?id={$cm->id}"); + print_error('nomoreattempts', 'quiz', "view.php?id={$cm->id}"); } /// Check subnet access if (!$ispreviewing && $quiz->subnet && !address_in_subnet(getremoteaddr(), $quiz->subnet)) { - print_error("subneterror", "quiz", "view.php?id=$cm->id"); + print_error('subneterror', 'quiz', "view.php?id={$cm->id}"); } /// Check password access @@ -102,15 +103,13 @@ if ($quiz->password and empty($SESSION->passwordcheckedquizzes[$quiz->id])) { $enteredpassword = optional_param('quizpassword', '', PARAM_RAW); if (optional_param('cancelpassword', false)) { - // User clicked cancel in the password form. - redirect($CFG->wwwroot . '/mod/quiz/view.php?q=' . $quiz->id); + redirect($CFG->wwwroot . '/mod/quiz/view.php?q=' . $quiz->id); } else if (strcmp($quiz->password, $enteredpassword) === 0) { // User entered the correct password. $SESSION->passwordcheckedquizzes[$quiz->id] = true; } else { - // User entered the wrong password, or has not entered one yet. - $url = $CFG->wwwroot . '/mod/quiz/attempt.php?q=' . $quiz->id; - + + $url = $CFG->wwwroot . '/mod/quiz/attempt.php?q=' . $quiz->id; if (empty($popup)) { print_header('', '', '', 'quizpassword'); } @@ -123,6 +122,7 @@ if (!empty($enteredpassword)) { echo '

', get_string('passworderror', 'quiz'), '

'; } + ?>

@@ -136,7 +136,8 @@ is_lams); } exit; } @@ -156,11 +157,11 @@ } if ($numattempts == 1 && $quiz->delay1) { if ($timenow - $quiz->delay1 < $lastattempt) { - print_error('timedelay', 'quiz', 'view.php?q='.$quiz->id); + print_error('timedelay', 'quiz', 'view.php?q='.$quiz->id); } } else if($numattempts > 1 && $quiz->delay2) { if ($timenow - $quiz->delay2 < $lastattempt) { - print_error('timedelay', 'quiz', 'view.php?q='.$quiz->id); + print_error('timedelay', 'quiz', 'view.php?q='.$quiz->id); } } } @@ -197,19 +198,22 @@ } // make log entries if ($ispreviewing) { + add_to_log($course->id, 'quiz', 'preview', - "attempt.php?id=$cm->id", + 'attempt.php?id='.$cm->id, "$quiz->id", $cm->id); } else { + add_to_log($course->id, 'quiz', 'attempt', - "review.php?attempt=$attempt->id", + 'review.php?attempt='.$attempt->id, "$quiz->id", $cm->id); } } else { // log continuation of attempt only if some time has lapsed - if (($timestamp - $attempt->timemodified) > 600) { // 10 minutes have elapsed + if (($timestamp - $attempt->timemodified) > 600) { // 10 minutes have elapsed + $address5='review.php?attempt='.$attempt->id; add_to_log($course->id, 'quiz', 'continue attemp', // this action used to be called 'continue attempt' but the database field has only 15 characters - "review.php?attempt=$attempt->id", + $address5, "$quiz->id", $cm->id); } } @@ -235,7 +239,7 @@ } if (!$questionlist) { - print_error('noquestionsfound', 'quiz', 'view.php?q='.$quiz->id); + print_error('noquestionsfound', 'quiz', 'view.php?q='.$quiz->id); } $sql = "SELECT q.*, i.grade AS maxgrade, i.id AS instance". @@ -246,7 +250,7 @@ // Load the questions if (!$questions = get_records_sql($sql)) { - print_error('noquestionsfound', 'quiz', 'view.php?q='.$quiz->id); + print_error('noquestionsfound', 'quiz', 'view.php?q='.$quiz->id); } // Load the question type specific information @@ -322,8 +326,9 @@ if ($page) { $pagebit = '&page=' . $page; } + $address6=$CFG->wwwroot . '/mod/quiz/attempt.php?q=' . $quiz->id . $pagebit; print_error('errorprocessingresponses', 'question', - $CFG->wwwroot . '/mod/quiz/attempt.php?q=' . $quiz->id . $pagebit); + $address6); } $attempt->timemodified = $timestamp; @@ -379,9 +384,8 @@ print_error('errorprocessingresponses', 'question', $CFG->wwwroot . '/mod/quiz/attempt.php?q=' . $quiz->id . $pagebit); } - add_to_log($course->id, 'quiz', 'close attempt', - "review.php?attempt=$attempt->id", + 'review.php?attempt='.$attempt->id, "$quiz->id", $cm->id); } @@ -404,12 +408,12 @@ if (!empty($SESSION->passwordcheckedquizzes[$quiz->id])) { unset($SESSION->passwordcheckedquizzes[$quiz->id]); } - redirect($CFG->wwwroot . '/mod/quiz/review.php?attempt='.$attempt->id, 0); + redirect($CFG->wwwroot . '/mod/quiz/review.php?attempt='.$attempt->id, 0); } // Now is the right time to check the open and close times. if (!$ispreviewing && ($timestamp < $quiz->timeopen || ($quiz->timeclose && $timestamp > $quiz->timeclose))) { - print_error('notavailable', 'quiz', "view.php?id={$cm->id}"); + print_error('notavailable', 'quiz', "view.php?id={$cm->id}"); } /// Print the quiz page //////////////////////////////////////////////////////// @@ -427,7 +431,8 @@ ? update_module_button($cm->id, $course->id, get_string('modulename', 'quiz')) : ""; $navigation = build_navigation($strattemptnum, $cm); - print_header_simple(format_string($quiz->name), "", $navigation, "", $headtags, true, $strupdatemodule); + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_header_simple(format_string($quiz->name), "", $navigation, "", $headtags, true, $strupdatemodule,'',false,'',false,$quiz->is_lams); } echo ''; // for overlib @@ -463,8 +468,7 @@ } // Start the form - echo '', "\n"; if($quiz->timelimit > 0) { // Make sure javascript is enabled for time limited quizzes @@ -506,7 +510,7 @@ if ($quiz->optionflags & QUESTION_ADAPTIVE) { echo "\n"; } - echo "\n"; + echo "\n"; echo "
"; @@ -544,6 +548,7 @@ // Finish the page if (empty($popup)) { - 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,$cm->is_lams); } ?> Index: temp_moodle_dev/moodle/mod/quiz/attempt_close_js.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/quiz/attempt_close_js.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/mod/quiz/attempt_close_js.php 14 Nov 2008 05:57:17 -0000 1.1 +++ temp_moodle_dev/moodle/mod/quiz/attempt_close_js.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -15,13 +15,29 @@ $cm->id ), get_string('finishreview', 'quiz')); + ?> + + + + $cm->id ), get_string('finishreview', 'quiz')); } ?> + + + + Index: temp_moodle_dev/moodle/mod/quiz/comment.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/quiz/comment.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/mod/quiz/comment.php 14 Nov 2008 05:57:17 -0000 1.1 +++ temp_moodle_dev/moodle/mod/quiz/comment.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -74,14 +74,14 @@ notify(get_string('changessaved')); echo '
"; - - print_footer(); + //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; } } question_print_comment_box($question, $state, $attempt, $CFG->wwwroot.'/mod/quiz/comment.php'); + //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); - print_footer(); - ?> 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); ?> Index: temp_moodle_dev/moodle/mod/quiz/report.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/quiz/report.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/mod/quiz/report.php 14 Nov 2008 05:57:17 -0000 1.1 +++ temp_moodle_dev/moodle/mod/quiz/report.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -1,16 +1,13 @@ dirroot.'/mod/quiz/locallib.php'); require_once($CFG->dirroot.'/mod/quiz/report/reportlib.php'); - $id = optional_param('id',0,PARAM_INT); // Course Module ID, or $q = optional_param('q',0,PARAM_INT); // quiz ID - $mode = optional_param('mode', 'overview', PARAM_ALPHA); // Report mode - if ($id) { if (! $cm = get_coursemodule_from_id('quiz', $id)) { error("There is no coursemodule with id $id"); @@ -35,14 +32,13 @@ error("The course module for the quiz with id $q is missing"); } } - require_login($course, false, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); require_capability('mod/quiz:viewreports', $context); // if no questions have been set up yet redirect to edit.php if (!$quiz->questions and has_capability('mod/quiz:manage', $context)) { - redirect('edit.php?cmid='.$cm->id); + redirect('edit.php?cmid='.$cm->id); } // Upgrade any attempts that have not yet been upgraded to the @@ -54,9 +50,7 @@ quiz_upgrade_states($attempt); } } - - add_to_log($course->id, "quiz", "report", "report.php?id=$cm->id", "$quiz->id", "$cm->id"); - + add_to_log($course->id, "quiz", "report", 'report.php?id='.$cm->id, "$quiz->id", "$cm->id"); /// Open the selected quiz report and display it $mode = clean_param($mode, PARAM_SAFEDIR); @@ -75,7 +69,6 @@ } /// Print footer - - 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); ?> Index: temp_moodle_dev/moodle/mod/quiz/review.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/quiz/review.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/mod/quiz/review.php 14 Nov 2008 05:57:17 -0000 1.1 +++ temp_moodle_dev/moodle/mod/quiz/review.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -121,7 +121,10 @@ : ""; get_string('reviewofattempt', 'quiz', $attempt->attempt); $navigation = build_navigation($strreviewtitle, $cm); - print_header_simple(format_string($quiz->name), "", $navigation, "", $headtags, true, $strupdatemodule); + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_header_simple(format_string($quiz->name), "", $navigation, "", $headtags, true, $strupdatemodule,'',false,'',false,$quiz->is_lams); + //old print_header_simple(format_string($quiz->name), "", $navigation, "", $headtags, true, $strupdatemodule); + } echo ''; // for overlib @@ -150,9 +153,10 @@ print_heading($strreviewtitle); // print javascript button to close the window, if necessary - if (!$isteacher) { + //always include attempt_close_js.php so when we are doing a preview we can access to appearbutton() function in lams + //old if (!$isteacher) { include('attempt_close_js.php'); - } + //old } /// Work out some time-related things. $timelimit = (int)$quiz->timelimit * 60; @@ -291,12 +295,13 @@ print_paging_bar($numpages, $page, 1, 'review.php?attempt='.$attempt->id.'&'); } - // print javascript button to close the window, if necessary - if (!$isteacher) { + // print javascript button to close the window always, so we can access to the appearbutton function + //m if (!$isteacher) { include('attempt_close_js.php'); - } + //m} if (empty($popup)) { - 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); } ?> Index: temp_moodle_dev/moodle/mod/quiz/showlamsfinish.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/quiz/showlamsfinish.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ temp_moodle_dev/moodle/mod/quiz/showlamsfinish.php 14 Nov 2008 06:16:59 -0000 1.1 @@ -0,0 +1,14 @@ + + + + Untitled Document + + + + + \ No newline at end of file Index: temp_moodle_dev/moodle/mod/quiz/showlamsnext.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/quiz/showlamsnext.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ temp_moodle_dev/moodle/mod/quiz/showlamsnext.php 14 Nov 2008 06:16:59 -0000 1.1 @@ -0,0 +1,15 @@ + + + + Untitled Document + + + + + Index: temp_moodle_dev/moodle/mod/quiz/view.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/quiz/view.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/mod/quiz/view.php 14 Nov 2008 05:57:17 -0000 1.1 +++ temp_moodle_dev/moodle/mod/quiz/view.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -1,17 +1,21 @@ libdir.'/blocklib.php'); + //add new library so Lams can use their functions + require_once($CFG->libdir.'/weblib.php'); + // require_once($CFG->libdir.'/gradelib.php'); require_once($CFG->dirroot.'/mod/quiz/locallib.php'); require_once($CFG->dirroot.'/mod/quiz/pagelib.php'); - $id = optional_param('id', 0, PARAM_INT); // Course Module ID, or $q = optional_param('q', 0, PARAM_INT); // quiz ID $edit = optional_param('edit', -1, PARAM_BOOL); - + $is_learner = optional_param('is_learner',0, PARAM_INT); + $editing = optional_param('editing', 0, PARAM_INT); + $returnurl = optional_param('returnUrl', '', PARAM_TEXT); // lams url to proceed to next in sequence if ($id) { if (! $cm = get_coursemodule_from_id('quiz', $id)) { error("There is no coursemodule with id $id"); @@ -33,14 +37,21 @@ error("The course module for the quiz with id $q is missing"); } } - + //if is inside a Lams sequence we pass the Lams Update URL to be able to come back to Lams later + if($quiz->is_lams==1){ + $lamsupdateurl = urlencode(optional_param('lamsUpdateURL', PARAM_TEXT)); + } // Check login and get context. require_login($course->id, false, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); // if no questions have been set up yet redirect to edit.php if (!$quiz->questions and has_capability('mod/quiz:manage', $context)) { - redirect($CFG->wwwroot . '/mod/quiz/edit.php?cmid=' . $cm->id); + if($quiz->is_lams==1){ //if is inside a Lams sequence we pass the Lams Update URL to be able to come back to Lams later + redirect($CFG->wwwroot . '/mod/quiz/edit.php?cmid=' . $cm->id.'&lamsUpdateURL='.$lamsupdateurl); + }else{ + redirect($CFG->wwwroot . '/mod/quiz/edit.php?cmid=' . $cm->id.''); + } } add_to_log($course->id, "quiz", "view", "view.php?id=$cm->id", $quiz->id, $cm->id); @@ -54,11 +65,18 @@ if ($edit != -1 and $PAGE->user_allowed_editing()) { $USER->editing = $edit; } + //only check pop ups if the user is not a teacher, and popup is set - $bodytags = (has_capability('mod/quiz:attempt', $context) && $quiz->popup)?'onload="popupchecker(\'' . get_string('popupblockerwarning', 'quiz') . '\');"':''; - $PAGE->print_header($course->shortname.': %fullname%','',$bodytags); + $bodytags =(has_capability('mod/quiz:attempt', $context) && $quiz->popup)?'onload="popupchecker(\'' . get_string('popupblockerwarning', 'quiz') . '\');"':''; + //if is a Lams sequence activity don't print the top header + if($quiz->is_lams==1){ + print_header(); + }else{ + $PAGE->print_header($course->shortname.': %fullname%','',$bodytags); + } + echo ''; @@ -77,8 +95,9 @@ // Print heading and tabs (if there is more than one). $currenttab = 'info'; + include('tabs.php'); - + // Print quiz name print_heading(format_string($quiz->name)); @@ -100,6 +119,19 @@ if ($quiz->attempts != 1) { echo "

".get_string("grademethod", "quiz").": ".quiz_get_grading_option_name($quiz->grademethod)."

"; } + //if you are in lams and you've done more than one attempt display lams navigation buttons + if($quiz->is_lams==1){ + if ($quiz->attempts >= 1) { + if($editing == 1) { + //if you are editing, finish editing an go back to lams + include('showlamsfinish.php'); + }else{ + //if you a learner or a teacher that does the activity as a learner, go to the next activity + include('showlamsnext.php'); + } + + } + } // Print information about timings. $timenow = time(); @@ -127,7 +159,7 @@ // Show number of attempts summary to those who can view reports. if (has_capability('mod/quiz:viewreports', $context)) { if ($strattemptnum = quiz_num_attempt_summary($quiz, $cm)) { - echo '
' . $strattemptnum . '
'; } } @@ -141,14 +173,15 @@ notice_yesno('

' . get_string('guestsno', 'quiz') . "

\n\n

" . get_string('liketologin') . '

', $loginurl, get_referer(false)); - finish_page($course); + finish_page($course,$quiz);//we pass $quiz } if (!(has_capability('mod/quiz:attempt', $context) || has_capability('mod/quiz:preview', $context))) { - print_box('

' . get_string('youneedtoenrol', 'quiz') . '

' . + print_box('

' . get_string('youneedtoenrol', 'quiz') . '

' . print_continue($CFG->wwwroot . '/course/view.php?id=' . $course->id, true) . '

', 'generalbox', 'notice'); - finish_page($course); + finish_page($course,$quiz);// we pass $quiz so later we can check the is_lams variable + // old finish_page($course); } // Get this user's attempts. @@ -183,9 +216,25 @@ // Print table with existing attempts if ($attempts) { - + if($quiz->is_lams==1){ + if($editing==1){ + include('showlamsfinish.php'); + }else{ + //if($is_learner==1){ + include('showlamsnext.php'); + //} + } + } print_heading(get_string('summaryofattempts', 'quiz')); + // Get some strings. + $strattempt = get_string("attempt", "quiz"); + $strtimetaken = get_string("timetaken", "quiz"); + $strtimecompleted = get_string("timecompleted", "quiz"); + $strgrade = get_string("grade"); + $strmarks = get_string('marks', 'quiz'); + $strfeedback = get_string('feedback', 'quiz'); + // Work out which columns we need, taking account what data is available in each attempt. list($someoptions, $alloptions) = quiz_get_combined_reviewoptions($quiz, $attempts, $context); @@ -196,28 +245,28 @@ $feedbackcolumn = quiz_has_feedback($quiz->id); $overallfeedback = $feedbackcolumn && $alloptions->overallfeedback; - // Prepare table header + // prepare table header $table->class = 'generaltable quizattemptsummary'; - $table->head = array(get_string('attempt', 'quiz'), get_string('timecompleted', 'quiz')); - $table->align = array('center', 'left'); - $table->size = array('', ''); + $table->head = array($strattempt, $strtimecompleted); + $table->align = array("center", "left"); + $table->size = array("", ""); if ($markcolumn) { - $table->head[] = get_string('marks', 'quiz') . " / $quiz->sumgrades"; + $table->head[] = "$strmarks / $quiz->sumgrades"; $table->align[] = 'center'; $table->size[] = ''; } if ($gradecolumn) { - $table->head[] = get_string('grade') . " / $quiz->grade"; + $table->head[] = "$strgrade / $quiz->grade"; $table->align[] = 'center'; $table->size[] = ''; } if ($feedbackcolumn) { - $table->head[] = get_string('feedback', 'quiz'); + $table->head[] = $strfeedback; $table->align[] = 'left'; $table->size[] = ''; } if (isset($quiz->showtimetaken)) { - $table->head[] = get_string('timetaken', 'quiz'); + $table->head[] = $strtimetaken; $table->align[] = 'left'; $table->size[] = ''; } @@ -229,6 +278,7 @@ // Add the attempt number, making it a link, if appropriate. if ($attempt->preview) { + $row[] = make_review_link(get_string('preview', 'quiz'), $quiz, $attempt); } else { $row[] = make_review_link($attempt->attempt, $quiz, $attempt); @@ -339,6 +389,11 @@ // Print a button to start/continue an attempt, if appropriate. if (!$quiz->questions) { print_heading(get_string("noquestions", "quiz")); + + //print button "next activity" to continue + if($quiz->is_lams==1){ + include('showlamsnext.php'); + } } else if ($available && $moreattempts) { echo "
"; @@ -351,9 +406,30 @@ $buttontext = get_string('continueattemptquiz', 'quiz'); } } else { + + // print next button to continue next activity in lams + + if($quiz->is_lams==1){ + //m acabar + //if($is_learner==1){ + //finish is_learner + //include('showlamsnext.php'); + //}else{ + if($editing==1){ + include('showlamsfinish.php'); + } + //} + + } // Work out the appropriate button caption. if (has_capability('mod/quiz:preview', $context)) { + //lams: if you are a teacher and are doing a preview of the activity show next activity button + if($editing==1){ + include('showlamsfinish.php'); + }else{ + include('showlamsnext.php'); + } $buttontext = get_string('previewquiznow', 'quiz'); } else if ($numattempts == 0) { $buttontext = get_string('attemptquiznow', 'quiz'); @@ -400,8 +476,8 @@ $strconfirmstartattempt = ''; } // Determine the URL to use. - $attempturl = "attempt.php?id=$cm->id"; - + $attempturl = "attempt.php?id=$cm->id"; + // Prepare options depending on whether the quiz should be a popup. if (!empty($quiz->popup)) { $window = 'quizpopup'; @@ -420,7 +496,7 @@ } echo "window.open('$attempturl','$window','$windowoptions');", '" />'; } else { - print_single_button("attempt.php", array('id'=>$cm->id), $buttontext, 'get', '', false, '', false, $strconfirmstartattempt); + print_single_button("attempt.php", array('id'=>$cm->id), $buttontext, 'get', '', false, '', false, $strconfirmstartattempt); } @@ -440,15 +516,18 @@ // Should we not be seeing if we need to print right-hand-side blocks? - finish_page($course); + finish_page($course,$quiz);// we pass $quiz so later we can check the is_lams variable + // old finish_page($course); // Utility functions ================================================================= -function finish_page($course) { +function finish_page($course,$quiz=null) { // we pass $quiz so we can check the is_lams variable + //old function finish_page($course) { global $THEME; print_container_end(); 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); exit; } @@ -460,13 +539,13 @@ } // If the quiz is still open, are reviews allowed? - if ((!$quiz->timeclose or time() < $quiz->timeclose) and !($quiz->review & QUIZ_REVIEW_OPEN & QUIZ_REVIEW_RESPONSES)) { + if ((!$quiz->timeclose or time() < $quiz->timeclose) and !($quiz->review & QUIZ_REVIEW_OPEN)) { // If not, don't link. return $linktext; } // If the quiz is closed, are reviews allowed? - if (($quiz->timeclose and time() > $quiz->timeclose) and !($quiz->review & QUIZ_REVIEW_CLOSED & QUIZ_REVIEW_RESPONSES)) { + if (($quiz->timeclose and time() > $quiz->timeclose) and !($quiz->review & QUIZ_REVIEW_CLOSED)) { // If not, don't link. return $linktext; } Index: temp_moodle_dev/moodle/mod/quiz/report/default.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/quiz/report/default.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/mod/quiz/report/default.php 14 Nov 2008 06:06:06 -0000 1.1 +++ temp_moodle_dev/moodle/mod/quiz/report/default.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -14,7 +14,6 @@ //////////////////////////////////////////////////////////////////// // Included by ../report.php - class quiz_default_report { function display($cm, $course, $quiz) { /// This function just displays the report @@ -28,17 +27,24 @@ $strquiz = get_string("modulename", "quiz"); /// Print the page header $navigation = build_navigation('', $cm); - - print_header_simple(format_string($quiz->name), "", $navigation, - '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm)); - /// Print the tabs + //if Lams we include a parameter to the header function so it won't we displayed + print_header_simple(format_string($quiz->name), "", $navigation, + '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm),false,'',false,$cm->is_lams); + //old print_header_simple(format_string($quiz->name), "", $navigation, + // '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm)); + + /// Print the tabs + $currenttab = 'reports'; $mode = $reportmode; require($CFG->dirroot . '/mod/quiz/tabs.php'); $course_context = get_context_instance(CONTEXT_COURSE, $course->id); if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) { - echo '
' + //If is Lams we don't need to display 'see all course grades' + if($cm->is_lams!=1){ + echo '
' . get_string('seeallcoursegrades', 'grades') . '
'; + } } } Index: temp_moodle_dev/moodle/question/edit.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/question/edit.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/question/edit.php 14 Nov 2008 05:57:17 -0000 1.1 +++ temp_moodle_dev/moodle/question/edit.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -29,8 +29,8 @@ $navlinks[] = array('name' => format_string($module->name), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/view.php?id={$cm->id}", 'type' => 'title'); $navlinks[] = array('name' => $streditingquestions, 'link' => '', 'type' => 'title'); $navigation = build_navigation($navlinks); - print_header_simple($streditingquestions, '', $navigation, "", "", true, $strupdatemodule); - + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_header_simple($streditingquestions, '', $navigation, "", "", true, $strupdatemodule,'',false,'',false,$cm->is_lams); $currenttab = 'edit'; $mode = 'questions'; ${$cm->modname} = $module; @@ -40,9 +40,9 @@ $navlinks = array(); $navlinks[] = array('name' => $streditingquestions, 'link' => '', 'type' => 'title'); $navigation = build_navigation($navlinks); - - print_header_simple($streditingquestions, '', $navigation); - + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_header_simple($streditingquestions, '', $navigation, "", "", true, '','',false,'',false,$cm->is_lams); + // print tabs $currenttab = 'questions'; include('tabs.php'); @@ -52,11 +52,11 @@ echo ''; echo ''; echo '
'; - question_showbank('questions', $contexts, $thispageurl, $cm, $pagevars['qpage'], $pagevars['qperpage'], $pagevars['qsortorder'], $pagevars['qsortorderdecoded'], + question_showbank('questions', $conheadertexts, $thispageurl, $cm, $pagevars['qpage'], $pagevars['qperpage'], $pagevars['qsortorder'], $pagevars['qsortorderdecoded'], $pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'], $pagevars['showquestiontext']); 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,$cm->is_lams); ?> Index: temp_moodle_dev/moodle/question/export.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/question/export.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/question/export.php 14 Nov 2008 05:57:17 -0000 1.1 +++ temp_moodle_dev/moodle/question/export.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -41,8 +41,8 @@ $navlinks[] = array('name' => format_string($module->name), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/view.php?id={$cm->id}", 'type' => 'title'); $navlinks[] = array('name' => $strexportquestions, 'link' => '', 'type' => 'title'); $navigation = build_navigation($navlinks); - print_header_simple($strexportquestions, '', $navigation, "", "", true, $strupdatemodule); - + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_header_simple($strexportquestions, '', $navigation, "", "", true, $strupdatemodule,'',false,'',false,$cm->is_lams); $currenttab = 'edit'; $mode = 'export'; ${$cm->modname} = $module; @@ -52,8 +52,8 @@ $navlinks = array(); $navlinks[] = array('name' => $strexportquestions, 'link' => '', 'type' => 'title'); $navigation = build_navigation($navlinks); - - print_header_simple($strexportquestions, '', $navigation); + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_header_simple($strexportquestions, '', $navigation, "", "", true, '','',false,'',false,$cm->is_lams); // print tabs $currenttab = 'export'; include('tabs.php'); @@ -132,7 +132,8 @@ } print_continue('edit.php?' . $thispageurl->get_query_string()); - 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,$cm->is_lams); exit; } @@ -141,5 +142,6 @@ $export_form->display(); - 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,$cm->is_lams); ?> Index: temp_moodle_dev/moodle/question/import.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/question/import.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/question/import.php 14 Nov 2008 05:57:17 -0000 1.1 +++ temp_moodle_dev/moodle/question/import.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -62,8 +62,8 @@ $navlinks[] = array('name' => format_string($module->name), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/view.php?id={$cm->id}", 'type' => 'title'); $navlinks[] = array('name' => $txt->importquestions, 'link' => '', 'type' => 'title'); $navigation = build_navigation($navlinks); - print_header_simple($txt->importquestions, '', $navigation, "", "", true, $strupdatemodule); - + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_header_simple($txt->importquestions, '', $navigation, "", "", true, $strupdatemodule,'',false,'',false,$cm->is_lams); $currenttab = 'edit'; $mode = 'import'; ${$cm->modname} = $module; @@ -73,8 +73,8 @@ $navlinks = array(); $navlinks[] = array('name' => $txt->importquestions, 'link' => '', 'type' => 'title'); $navigation = build_navigation($navlinks); - - print_header_simple($txt->importquestions, '', $navigation); + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_header_simple($txt->importquestions, '', $navigation, "", "", true, $strupdatemodule,'',false,'',false,$cm->is_lams); // print tabs $currenttab = 'import'; include('tabs.php'); @@ -148,7 +148,8 @@ echo "
"; print_continue("edit.php?".($thispageurl->get_query_string(array('category'=>"{$qformat->category->id},{$qformat->category->contextid}")))); - 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,$cm->is_lams); exit; } } @@ -157,6 +158,7 @@ /// Print upload form $import_form->display(); - 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,$cm->is_lams); ?> Index: temp_moodle_dev/moodle/question/question.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/question/question.php,v diff -u -r1.1 -r1.2 --- temp_moodle_dev/moodle/question/question.php 14 Nov 2008 05:57:17 -0000 1.1 +++ temp_moodle_dev/moodle/question/question.php 14 Nov 2008 06:16:59 -0000 1.2 @@ -223,22 +223,26 @@ } $navlinks[] = array('name' => $streditingquestion, 'link' => '', 'type' => 'title'); $navigation = build_navigation($navlinks); - print_header_simple($streditingquestion, '', $navigation, "", "", true, $strupdatemodule); - + //m + print_header_simple($streditingquestion, '', $navigation, "", "", true, $strupdatemodule,'',false,'',false,$cm->is_lams); + } else { $navlinks = array(); $navlinks[] = array('name' => get_string('editquestions', "quiz"), 'link' => $returnurl, 'type' => 'title'); $navlinks[] = array('name' => $streditingquestion, 'link' => '', 'type' => 'title'); $strediting = ''. get_string("editquestions", "quiz").' -> '.$streditingquestion; $navigation = build_navigation($navlinks); - print_header_simple($streditingquestion, '', $navigation); + //we pass a new parameter to the function so it won't we printed if is_lams=1 + print_header_simple($streditingquestion, '', $navigation, "", "", true, $strupdatemodule,'',false,'',false,$cm->is_lams); + } // Display a heading, question editing form and possibly some extra content needed for // for this question type. $QTYPES[$question->qtype]->display_question_editing_page($mform, $question, $wizardnow); - 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,$cm->is_lams); } ?>