[ Index ] |
PHP Cross Reference of Unnamed Project |
[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 * @package mod_forum 19 * @copyright 2014 Andrew Robert Nicols <andrew@nicols.co.uk> 20 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 21 */ 22 23 defined('MOODLE_INTERNAL') || die(); 24 25 // Deprecated a very long time ago. 26 27 /** 28 * @deprecated since Moodle 1.1 - please do not use this function any more. 29 */ 30 function forum_count_unrated_posts() { 31 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 32 } 33 34 35 // Since Moodle 1.5. 36 37 /** 38 * @deprecated since Moodle 1.5 - please do not use this function any more. 39 */ 40 function forum_tp_count_discussion_read_records() { 41 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 42 } 43 44 /** 45 * @deprecated since Moodle 1.5 - please do not use this function any more. 46 */ 47 function forum_get_user_discussions() { 48 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 49 } 50 51 52 // Since Moodle 1.6. 53 54 /** 55 * @deprecated since Moodle 1.6 - please do not use this function any more. 56 */ 57 function forum_tp_count_forum_posts() { 58 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 59 } 60 61 /** 62 * @deprecated since Moodle 1.6 - please do not use this function any more. 63 */ 64 function forum_tp_count_forum_read_records() { 65 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 66 } 67 68 69 // Since Moodle 1.7. 70 71 /** 72 * @deprecated since Moodle 1.7 - please do not use this function any more. 73 */ 74 function forum_get_open_modes() { 75 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 76 } 77 78 79 // Since Moodle 1.9. 80 81 /** 82 * @deprecated since Moodle 1.9 MDL-13303 - please do not use this function any more. 83 */ 84 function forum_get_child_posts() { 85 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 86 } 87 88 /** 89 * @deprecated since Moodle 1.9 MDL-13303 - please do not use this function any more. 90 */ 91 function forum_get_discussion_posts() { 92 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 93 } 94 95 96 // Since Moodle 2.0. 97 98 /** 99 * @deprecated since Moodle 2.0 MDL-21657 - please do not use this function any more. 100 */ 101 function forum_get_ratings() { 102 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 103 } 104 105 /** 106 * @deprecated since Moodle 2.0 MDL-14632 - please do not use this function any more. 107 */ 108 function forum_get_tracking_link() { 109 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 110 } 111 112 /** 113 * @deprecated since Moodle 2.0 MDL-14113 - please do not use this function any more. 114 */ 115 function forum_tp_count_discussion_unread_posts() { 116 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 117 } 118 119 /** 120 * @deprecated since Moodle 2.0 MDL-23479 - please do not use this function any more. 121 */ 122 function forum_convert_to_roles() { 123 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 124 } 125 126 /** 127 * @deprecated since Moodle 2.0 MDL-14113 - please do not use this function any more. 128 */ 129 function forum_tp_get_read_records() { 130 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 131 } 132 133 /** 134 * @deprecated since Moodle 2.0 MDL-14113 - please do not use this function any more. 135 */ 136 function forum_tp_get_discussion_read_records() { 137 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 138 } 139 140 // Deprecated in 2.3. 141 142 /** 143 * @deprecated since Moodle 2.3 MDL-33166 - please do not use this function any more. 144 */ 145 function forum_user_enrolled() { 146 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 147 } 148 149 150 // Deprecated in 2.4. 151 152 /** 153 * @deprecated since Moodle 2.4 use forum_user_can_see_post() instead 154 */ 155 function forum_user_can_view_post() { 156 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 157 } 158 159 160 // Deprecated in 2.6. 161 162 /** 163 * FORUM_TRACKING_ON - deprecated alias for FORUM_TRACKING_FORCED. 164 * @deprecated since 2.6 165 */ 166 define('FORUM_TRACKING_ON', 2); 167 168 /** 169 * @deprecated since Moodle 2.6 170 * @see shorten_text() 171 */ 172 function forum_shorten_post($message) { 173 throw new coding_exception(__FUNCTION__ . '() can not be used any more. ' 174 . 'Please use shorten_text($message, $CFG->forum_shortpost) instead.'); 175 } 176 177 // Deprecated in 2.8. 178 179 /** 180 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::is_subscribed() instead 181 */ 182 function forum_is_subscribed() { 183 throw new coding_exception(__FUNCTION__ . '() can not be used any more.'); 184 } 185 186 /** 187 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::subscribe_user() instead 188 */ 189 function forum_subscribe() { 190 throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use ' 191 . \mod_forum\subscriptions::class . '::subscribe_user() instead'); 192 } 193 194 /** 195 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::unsubscribe_user() instead 196 */ 197 function forum_unsubscribe() { 198 throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use ' 199 . \mod_forum\subscriptions::class . '::unsubscribe_user() instead'); 200 } 201 202 /** 203 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::fetch_subscribed_users() instead 204 */ 205 function forum_subscribed_users() { 206 throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use ' 207 . \mod_forum\subscriptions::class . '::fetch_subscribed_users() instead'); 208 } 209 210 /** 211 * Determine whether the forum is force subscribed. 212 * 213 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::is_forcesubscribed() instead 214 */ 215 function forum_is_forcesubscribed($forum) { 216 throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use ' 217 . \mod_forum\subscriptions::class . '::is_forcesubscribed() instead'); 218 } 219 220 /** 221 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::set_subscription_mode() instead 222 */ 223 function forum_forcesubscribe($forumid, $value = 1) { 224 throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use ' 225 . \mod_forum\subscriptions::class . '::set_subscription_mode() instead'); 226 } 227 228 /** 229 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::get_subscription_mode() instead 230 */ 231 function forum_get_forcesubscribed($forum) { 232 throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use ' 233 . \mod_forum\subscriptions::class . '::set_subscription_mode() instead'); 234 } 235 236 /** 237 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::is_subscribed in combination wtih 238 * \mod_forum\subscriptions::fill_subscription_cache_for_course instead. 239 */ 240 function forum_get_subscribed_forums() { 241 throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use ' 242 . \mod_forum\subscriptions::class . '::is_subscribed(), and ' 243 . \mod_forum\subscriptions::class . '::fill_subscription_cache_for_course() instead'); 244 } 245 246 /** 247 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::get_unsubscribable_forums() instead 248 */ 249 function forum_get_optional_subscribed_forums() { 250 throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use ' 251 . \mod_forum\subscriptions::class . '::get_unsubscribable_forums() instead'); 252 } 253 254 /** 255 * @deprecated since Moodle 2.8 use \mod_forum\subscriptions::get_potential_subscribers() instead 256 */ 257 function forum_get_potential_subscribers() { 258 throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use ' 259 . \mod_forum\subscriptions::class . '::get_potential_subscribers() instead'); 260 } 261 262 /** 263 * Builds and returns the body of the email notification in plain text. 264 * 265 * @uses CONTEXT_MODULE 266 * @param object $course 267 * @param object $cm 268 * @param object $forum 269 * @param object $discussion 270 * @param object $post 271 * @param object $userfrom 272 * @param object $userto 273 * @param boolean $bare 274 * @param string $replyaddress The inbound address that a user can reply to the generated e-mail with. [Since 2.8]. 275 * @return string The email body in plain text format. 276 * @deprecated since Moodle 3.0 use \mod_forum\output\forum_post_email instead 277 */ 278 function forum_make_mail_text($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $bare = false, $replyaddress = null) { 279 global $PAGE; 280 $renderable = new \mod_forum\output\forum_post_email( 281 $course, 282 $cm, 283 $forum, 284 $discussion, 285 $post, 286 $userfrom, 287 $userto, 288 forum_user_can_post($forum, $discussion, $userto, $cm, $course) 289 ); 290 291 $modcontext = context_module::instance($cm->id); 292 $renderable->viewfullnames = has_capability('moodle/site:viewfullnames', $modcontext, $userto->id); 293 294 if ($bare) { 295 $renderer = $PAGE->get_renderer('mod_forum', 'emaildigestfull', 'textemail'); 296 } else { 297 $renderer = $PAGE->get_renderer('mod_forum', 'email', 'textemail'); 298 } 299 300 debugging("forum_make_mail_text() has been deprecated, please use the \mod_forum\output\forum_post_email renderable instead.", 301 DEBUG_DEVELOPER); 302 303 return $renderer->render($renderable); 304 } 305 306 /** 307 * Builds and returns the body of the email notification in html format. 308 * 309 * @param object $course 310 * @param object $cm 311 * @param object $forum 312 * @param object $discussion 313 * @param object $post 314 * @param object $userfrom 315 * @param object $userto 316 * @param string $replyaddress The inbound address that a user can reply to the generated e-mail with. [Since 2.8]. 317 * @return string The email text in HTML format 318 * @deprecated since Moodle 3.0 use \mod_forum\output\forum_post_email instead 319 */ 320 function forum_make_mail_html($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $replyaddress = null) { 321 return forum_make_mail_post($course, 322 $cm, 323 $forum, 324 $discussion, 325 $post, 326 $userfrom, 327 $userto, 328 forum_user_can_post($forum, $discussion, $userto, $cm, $course) 329 ); 330 } 331 332 /** 333 * Given the data about a posting, builds up the HTML to display it and 334 * returns the HTML in a string. This is designed for sending via HTML email. 335 * 336 * @param object $course 337 * @param object $cm 338 * @param object $forum 339 * @param object $discussion 340 * @param object $post 341 * @param object $userfrom 342 * @param object $userto 343 * @param bool $ownpost 344 * @param bool $reply 345 * @param bool $link 346 * @param bool $rate 347 * @param string $footer 348 * @return string 349 * @deprecated since Moodle 3.0 use \mod_forum\output\forum_post_email instead 350 */ 351 function forum_make_mail_post($course, $cm, $forum, $discussion, $post, $userfrom, $userto, 352 $ownpost=false, $reply=false, $link=false, $rate=false, $footer="") { 353 global $PAGE; 354 $renderable = new \mod_forum\output\forum_post_email( 355 $course, 356 $cm, 357 $forum, 358 $discussion, 359 $post, 360 $userfrom, 361 $userto, 362 $reply); 363 364 $modcontext = context_module::instance($cm->id); 365 $renderable->viewfullnames = has_capability('moodle/site:viewfullnames', $modcontext, $userto->id); 366 367 // Assume that this is being used as a standard forum email. 368 $renderer = $PAGE->get_renderer('mod_forum', 'email', 'htmlemail'); 369 370 debugging("forum_make_mail_post() has been deprecated, please use the \mod_forum\output\forum_post_email renderable instead.", 371 DEBUG_DEVELOPER); 372 373 return $renderer->render($renderable); 374 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |