Index: temp_moodle_dev/moodle/mod/choice/view.php =================================================================== RCS file: /usr/local/cvsroot/temp_moodle_dev/moodle/mod/choice/view.php,v diff -u -r1.3 -r1.4 --- temp_moodle_dev/moodle/mod/choice/view.php 27 Nov 2008 02:12:41 -0000 1.3 +++ temp_moodle_dev/moodle/mod/choice/view.php 28 Oct 2009 07:32:04 -0000 1.4 @@ -1,7 +1,7 @@ libdir.'/weblib.php'); $id = required_param('id', PARAM_INT); // Course Module ID @@ -10,7 +10,7 @@ $returnurl = optional_param('returnUrl', '', PARAM_TEXT); // lams url to proceed to next in sequence $editing = optional_param('editing', 0, PARAM_INT); // 1 if editing in Lams $lamsupdateurl = optional_param('lamsUpdateURL', PARAM_TEXT); //get lamsupdateurl variable if coming from a Lams activity - + if (! $cm = get_coursemodule_from_id('choice', $id)) { error("Course Module ID was incorrect"); } @@ -38,9 +38,17 @@ delete_records('choice_answers', 'id', $answer->id); } } + $navigation = build_navigation('', $cm); -/// Submit any new data if there is any + $isteacher = has_capability('mod/choice:preview', get_context_instance(CONTEXT_MODULE, $cm->id)); // indicates if is a teacher, useful in lams + if($isteacher&&$editing==0&&$cm->is_lams==1){//lams: if the teachers view the choice as a learner, display the next activity button so he hasn't to attempt the choice if he don't want to + include('showlamsnext.php'); + } + print_header_simple(format_string($choice->name), "", $navigation, "", "", true, + update_module_button($cm->id, $course->id, $strchoice), navmenu($course, $cm),false,'',false,$cm->is_lams); + +/// Submit any new data if there is any if ($form = data_submitted() && has_capability('mod/choice:choose', $context)) { $timenow = time(); if (has_capability('mod/choice:deleteresponses', $context)) { @@ -56,24 +64,11 @@ } else { choice_user_submit_response($answer, $choice, $USER->id, $course->id, $cm); } - redirect("view.php?id=$cm->id"); - exit; + notify(get_string('choicesaved','choice'),'notifysuccess'); } /// Display the choice and possibly results - $navigation = build_navigation('', $cm); - - - - $isteacher = has_capability('mod/choice:preview', get_context_instance(CONTEXT_MODULE, $cm->id)); // indicates if is a teacher, useful in lams - if($isteacher&&$editing==0&&$cm->is_lams==1){//lams: if the teachers view the choice as a learner, display the next activity button so he hasn't to attempt the choice if he don't want to - include('showlamsnext.php'); - } - //we pass a new parameter to the function so it won't we printed if is_lams=1 - print_header_simple(format_string($choice->name), "", $navigation, "", "", true, - update_module_button($cm->id, $course->id, $strchoice), navmenu($course, $cm),false,'',false,$cm->is_lams); - add_to_log($course->id, "choice", "view", "view.php?id=$cm->id", $choice->id, $cm->id); /// Check to see if groups are being used in this choice @@ -100,10 +95,10 @@ //if user has already made a selection, and they are not allowed to update it, show their selected answer. if (!empty($USER->id) && ($current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $USER->id)) && empty($choice->allowupdate) ) { - // lams: if you have submited an option then you can go to next activity (shows button) - if($cm->is_lams==1&&$editing==0){ - include('showlamsnext.php'); - } + // lams: if you have submited an option then you can go to next activity (shows button) + if($cm->is_lams==1&&$editing==0){ + include('showlamsnext.php'); + } print_simple_box(get_string("yourselection", "choice", userdate($choice->timeopen)).": ".format_string(choice_get_option_text($choice, $current->optionid)), "center"); } @@ -113,9 +108,7 @@ if ($choice->timeclose !=0) { if ($choice->timeopen > $timenow ) { print_simple_box(get_string("notopenyet", "choice", userdate($choice->timeopen)), "center"); - - //we pass a new parameter to the function so it won't we printed if is_lams=1 - print_footer($course,null, false,$choice->is_lams); + print_footer($course,null, false,$choice->is_lams); exit; } else if ($timenow > $choice->timeclose) { print_simple_box(get_string("expired", "choice", userdate($choice->timeclose)), "center"); @@ -125,7 +118,7 @@ if ( (!$current or $choice->allowupdate) and $choiceopen and has_capability('mod/choice:choose', $context) ) { - // They haven't made their choice yet or updates allowed and choice is open + // They haven't made their choice yet or updates allowed and choice is open echo '
'; @@ -179,15 +172,14 @@ print_simple_box(get_string('noresultsviewable', 'choice'), 'center'); } if ($choice->is_lams) { - //print buttons to return to lams if you are editing - if($editing==1){ - include('showlamsfinish.php'); - } - + //print buttons to return to lams if you are editing + if($editing==1){ + include('showlamsfinish.php'); + } } - //we pass a new parameter to the function so it won't we printed if is_lams=1 - print_footer($course,null, false,$choice->is_lams); + print_footer($course,null, false,$choice->is_lams); + ?>