[ 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 abstract class feedback_item_base { 18 protected $type; 19 20 /** 21 * constructor 22 * 23 */ 24 public function __construct() { 25 $this->init(); 26 } 27 28 //this function only can used after the call of build_editform() 29 public function show_editform() { 30 $this->item_form->display(); 31 } 32 33 public function is_cancelled() { 34 return $this->item_form->is_cancelled(); 35 } 36 37 public function get_data() { 38 if ($this->item = $this->item_form->get_data()) { 39 return true; 40 } 41 return false; 42 } 43 44 public function value_type() { 45 return PARAM_RAW; 46 } 47 48 public function value_is_array() { 49 return false; 50 } 51 52 abstract public function init(); 53 abstract public function build_editform($item, $feedback, $cm); 54 abstract public function save_item(); 55 abstract public function check_value($value, $item); 56 abstract public function create_value($data); 57 abstract public function compare_value($item, $dbvalue, $dependvalue); 58 abstract public function get_presentation($data); 59 abstract public function get_hasvalue(); 60 abstract public function can_switch_require(); 61 62 /** 63 * @param object $worksheet a reference to the pear_spreadsheet-object 64 * @param integer $row_offset 65 * @param object $item the db-object from feedback_item 66 * @param integer $groupid 67 * @param integer $courseid 68 * @return integer the new row_offset 69 */ 70 abstract public function excelprint_item(&$worksheet, $row_offset, 71 $xls_formats, $item, 72 $groupid, $courseid = false); 73 74 /** 75 * @param $item the db-object from feedback_item 76 * @param string $itemnr 77 * @param integer $groupid 78 * @param integer $courseid 79 * @return integer the new itemnr 80 */ 81 abstract public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false); 82 83 /** 84 * @param object $item the db-object from feedback_item 85 * @param string $value a item-related value from feedback_values 86 * @return string 87 */ 88 abstract public function get_printval($item, $value); 89 90 /** 91 * returns an Array with three values(typ, name, XXX) 92 * XXX is also an Array (count of responses on type $this->type) 93 * each element is a structure (answertext, answercount) 94 * @param $item the db-object from feedback_item 95 * @param $groupid if given 96 * @param $courseid if given 97 * @return array 98 */ 99 abstract public function get_analysed($item, $groupid = false, $courseid = false); 100 101 /** 102 * print the item at the edit-page of feedback 103 * 104 * @global object 105 * @param object $item 106 * @return void 107 */ 108 abstract public function print_item_preview($item); 109 110 /** 111 * print the item at the complete-page of feedback 112 * 113 * @global object 114 * @param object $item 115 * @param string $value 116 * @param bool $highlightrequire 117 * @return void 118 */ 119 abstract public function print_item_complete($item, $value = '', $highlightrequire = false); 120 121 /** 122 * print the item at the complete-page of feedback 123 * 124 * @global object 125 * @param object $item 126 * @param string $value 127 * @return void 128 */ 129 abstract public function print_item_show_value($item, $value = ''); 130 131 /** 132 * cleans the userinput while submitting the form 133 * 134 * @param mixed $value 135 * @return mixed 136 */ 137 abstract public function clean_input_value($value); 138 139 } 140 141 //a dummy class to realize pagebreaks 142 class feedback_item_pagebreak extends feedback_item_base { 143 protected $type = "pagebreak"; 144 145 public function show_editform() { 146 } 147 public function is_cancelled() { 148 } 149 public function get_data() { 150 } 151 public function init() { 152 } 153 public function build_editform($item, $feedback, $cm) { 154 } 155 public function save_item() { 156 } 157 public function check_value($value, $item) { 158 } 159 public function create_value($data) { 160 } 161 public function compare_value($item, $dbvalue, $dependvalue) { 162 } 163 public function get_presentation($data) { 164 } 165 public function get_hasvalue() { 166 } 167 public function excelprint_item(&$worksheet, $row_offset, 168 $xls_formats, $item, 169 $groupid, $courseid = false) { 170 } 171 172 public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) { 173 } 174 public function get_printval($item, $value) { 175 } 176 public function get_analysed($item, $groupid = false, $courseid = false) { 177 } 178 public function print_item_preview($item) { 179 } 180 public function print_item_complete($item, $value = '', $highlightrequire = false) { 181 } 182 public function print_item_show_value($item, $value = '') { 183 } 184 public function can_switch_require() { 185 } 186 public function value_type() { 187 } 188 public function clean_input_value($value) { 189 } 190 191 }
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 |