[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * print a printview of feedback-items 19 * 20 * @author Andreas Grabs 21 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License 22 * @package mod_feedback 23 */ 24 25 require_once("../../config.php"); 26 require_once ("lib.php"); 27 28 $id = required_param('id', PARAM_INT); 29 30 $PAGE->set_url('/mod/feedback/print.php', array('id'=>$id)); 31 32 if (! $cm = get_coursemodule_from_id('feedback', $id)) { 33 print_error('invalidcoursemodule'); 34 } 35 36 if (! $course = $DB->get_record("course", array("id"=>$cm->course))) { 37 print_error('coursemisconf'); 38 } 39 40 if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) { 41 print_error('invalidcoursemodule'); 42 } 43 44 $context = context_module::instance($cm->id); 45 46 require_login($course, true, $cm); 47 48 require_capability('mod/feedback:view', $context); 49 $PAGE->set_pagelayout('embedded'); 50 51 /// Print the page header 52 $strfeedbacks = get_string("modulenameplural", "feedback"); 53 $strfeedback = get_string("modulename", "feedback"); 54 55 $feedback_url = new moodle_url('/mod/feedback/index.php', array('id'=>$course->id)); 56 $PAGE->navbar->add($strfeedbacks, $feedback_url); 57 $PAGE->navbar->add(format_string($feedback->name)); 58 59 $PAGE->set_title($feedback->name); 60 $PAGE->set_heading($course->fullname); 61 echo $OUTPUT->header(); 62 63 /// Print the main part of the page 64 /////////////////////////////////////////////////////////////////////////// 65 /////////////////////////////////////////////////////////////////////////// 66 /////////////////////////////////////////////////////////////////////////// 67 echo $OUTPUT->heading(format_text($feedback->name)); 68 69 $feedbackitems = $DB->get_records('feedback_item', array('feedback'=>$feedback->id), 'position'); 70 echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide'); 71 echo $OUTPUT->continue_button('view.php?id='.$id); 72 if (is_array($feedbackitems)) { 73 $itemnr = 0; 74 $align = right_to_left() ? 'right' : 'left'; 75 76 echo $OUTPUT->box_start('feedback_items printview'); 77 //check, if there exists required-elements 78 $params = array('feedback'=>$feedback->id, 'required'=>1); 79 $countreq = $DB->count_records('feedback_item', $params); 80 if ($countreq > 0) { 81 echo '<div class="fdescription required">'; 82 echo get_string('somefieldsrequired', 'form', '<img alt="'.get_string('requiredelement', 'form'). 83 '" src="'.$OUTPUT->pix_url('req') .'" class="req" />'); 84 echo '</div>'; 85 } 86 //print the inserted items 87 $itempos = 0; 88 foreach ($feedbackitems as $feedbackitem) { 89 echo $OUTPUT->box_start('feedback_item_box_'.$align); 90 $itempos++; 91 //Items without value only are labels 92 if ($feedbackitem->hasvalue == 1 AND $feedback->autonumbering) { 93 $itemnr++; 94 echo $OUTPUT->box_start('feedback_item_number_'.$align); 95 echo $itemnr; 96 echo $OUTPUT->box_end(); 97 } 98 echo $OUTPUT->box_start('box generalbox boxalign_'.$align); 99 if ($feedbackitem->typ != 'pagebreak') { 100 feedback_print_item_complete($feedbackitem, false, false); 101 } else { 102 echo $OUTPUT->box_start('feedback_pagebreak'); 103 echo '<hr class="feedback_pagebreak" />'; 104 echo $OUTPUT->box_end(); 105 } 106 echo $OUTPUT->box_end(); 107 echo $OUTPUT->box_end(); 108 } 109 echo $OUTPUT->box_end(); 110 } else { 111 echo $OUTPUT->box(get_string('no_items_available_yet', 'feedback'), 112 'generalbox boxaligncenter boxwidthwide'); 113 } 114 echo $OUTPUT->continue_button('view.php?id='.$id); 115 echo $OUTPUT->box_end(); 116 /// Finish the page 117 /////////////////////////////////////////////////////////////////////////// 118 /////////////////////////////////////////////////////////////////////////// 119 /////////////////////////////////////////////////////////////////////////// 120 121 echo $OUTPUT->footer(); 122
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |