|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00025 require_once("../../config.php"); 00026 require_once("lib.php"); 00027 00028 $id = required_param('id', PARAM_INT); 00029 00030 $PAGE->set_url('/mod/feedback/print.php', array('id'=>$id)); 00031 00032 if (! $cm = get_coursemodule_from_id('feedback', $id)) { 00033 print_error('invalidcoursemodule'); 00034 } 00035 00036 if (! $course = $DB->get_record("course", array("id"=>$cm->course))) { 00037 print_error('coursemisconf'); 00038 } 00039 00040 if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) { 00041 print_error('invalidcoursemodule'); 00042 } 00043 00044 if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) { 00045 print_error('badcontext'); 00046 } 00047 00048 require_login($course->id, true, $cm); 00049 00050 require_capability('mod/feedback:view', $context); 00051 $PAGE->set_pagelayout('embedded'); 00052 00054 $strfeedbacks = get_string("modulenameplural", "feedback"); 00055 $strfeedback = get_string("modulename", "feedback"); 00056 00057 $feedback_url = new moodle_url('/mod/feedback/index.php', array('id'=>$course->id)); 00058 $PAGE->navbar->add($strfeedbacks, $feedback_url); 00059 $PAGE->navbar->add(format_string($feedback->name)); 00060 00061 $PAGE->set_title(format_string($feedback->name)); 00062 $PAGE->set_heading(format_string($course->fullname)); 00063 echo $OUTPUT->header(); 00064 00069 echo $OUTPUT->heading(format_text($feedback->name)); 00070 00071 $feedbackitems = $DB->get_records('feedback_item', array('feedback'=>$feedback->id), 'position'); 00072 echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide'); 00073 echo $OUTPUT->continue_button('view.php?id='.$id); 00074 if (is_array($feedbackitems)) { 00075 $itemnr = 0; 00076 $align = right_to_left() ? 'right' : 'left'; 00077 00078 echo $OUTPUT->box_start('feedback_items printview'); 00079 //check, if there exists required-elements 00080 $params = array('feedback'=>$feedback->id, 'required'=>1); 00081 $countreq = $DB->count_records('feedback_item', $params); 00082 if ($countreq > 0) { 00083 echo '<span class="feedback_required_mark">(*)'; 00084 echo get_string('items_are_required', 'feedback'); 00085 echo '</span>'; 00086 } 00087 //print the inserted items 00088 $itempos = 0; 00089 foreach ($feedbackitems as $feedbackitem) { 00090 echo $OUTPUT->box_start('feedback_item_box_'.$align); 00091 $itempos++; 00092 //Items without value only are labels 00093 if ($feedbackitem->hasvalue == 1 AND $feedback->autonumbering) { 00094 $itemnr++; 00095 echo $OUTPUT->box_start('feedback_item_number_'.$align); 00096 echo $itemnr; 00097 echo $OUTPUT->box_end(); 00098 } 00099 echo $OUTPUT->box_start('box generalbox boxalign_'.$align); 00100 if ($feedbackitem->typ != 'pagebreak') { 00101 feedback_print_item_complete($feedbackitem, false, false); 00102 } else { 00103 echo $OUTPUT->box_start('feedback_pagebreak'); 00104 echo '<hr class="feedback_pagebreak" />'; 00105 echo $OUTPUT->box_end(); 00106 } 00107 echo $OUTPUT->box_end(); 00108 echo $OUTPUT->box_end(); 00109 } 00110 echo $OUTPUT->box_end(); 00111 } else { 00112 echo $OUTPUT->box(get_string('no_items_available_yet', 'feedback'), 00113 'generalbox boxaligncenter boxwidthwide'); 00114 } 00115 echo $OUTPUT->continue_button('view.php?id='.$id); 00116 echo $OUTPUT->box_end(); 00121 00122 echo $OUTPUT->footer(); 00123