Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
 * @deprecated since Moodle 3.0 use \mod_forum\output\forum_post_email instead
264
 */
265
function forum_make_mail_text() {
266
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use '
267
        . '\mod_forum\output\forum_post_email');
268
}
269
 
270
/**
271
 * @deprecated since Moodle 3.0 use \mod_forum\output\forum_post_email instead
272
 */
273
function forum_make_mail_html() {
274
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use '
275
        . '\mod_forum\output\forum_post_email');
276
}
277
 
278
/**
279
 * @deprecated since Moodle 3.0 use \mod_forum\output\forum_post_email instead
280
 */
281
function forum_make_mail_post() {
282
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use '
283
        . '\mod_forum\output\forum_post_email');
284
}
285
 
286
/**
287
 * @deprecated since Moodle 3.7
288
 */
289
function forum_cron_minimise_user_record() {
290
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. It has not been replaced.');
291
}
292
 
293
/**
294
 * @deprecated since Moodle 3.7
295
 */
296
function forum_cron() {
297
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. Please use the forum tasks');
298
}
299
 
300
/**
301
 * @deprecated since Moodle 3.7
302
 */
303
function forum_print_discussion() {
304
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. ' .
305
        'please use \mod_forum\local\renderers\discussion instead');
306
}
307
 
308
 
309
/**
310
 * @deprecated since Moodle 3.7
311
 */
312
function forum_post_nesting_cache() {
313
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. ' .
314
        'please use \mod_forum\local\renderers\posts instead');
315
}
316
 
317
/**
318
 * @deprecated since Moodle 3.7
319
 */
320
function forum_should_start_post_nesting() {
321
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. ' .
322
        'please use \mod_forum\local\renderers\posts instead');
323
}
324
 
325
/**
326
 * @deprecated since Moodle 3.7
327
 */
328
function forum_should_end_post_nesting() {
329
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. ' .
330
        'please use \mod_forum\local\renderers\posts instead');
331
}
332
 
333
/**
334
 * @deprecated since Moodle 3.7
335
 */
336
function forum_print_post_start() {
337
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. ' .
338
        'please use \mod_forum\local\renderers\posts instead');
339
}
340
 
341
/**
342
 * @deprecated since Moodle 3.7
343
 */
344
function forum_print_post_end() {
345
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. ' .
346
        'please use \mod_forum\local\renderers\posts instead');
347
}
348
 
349
/**
350
 * @deprecated since Moodle 3.7
351
 */
352
function forum_print_post() {
353
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. ' .
354
        'please use \mod_forum\local\renderers\posts instead');
355
}
356
 
357
/**
358
 * @deprecated since Moodle 3.7
359
 */
360
function forum_print_posts_flat() {
361
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. ' .
362
        'please use \mod_forum\local\renderers\posts instead');
363
}
364
 
365
/**
366
 * @deprecated since Moodle 3.7
367
 */
368
function forum_print_posts_threaded() {
369
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. ' .
370
        'please use \mod_forum\local\renderers\posts instead');
371
}
372
 
373
/**
374
 * @deprecated since Moodle 3.7
375
 */
376
function forum_print_posts_nested() {
377
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. ' .
378
        'please use \mod_forum\local\renderers\posts instead');
379
}
380
 
381
/**
382
 * @deprecated since Moodle 3.7
383
 */
384
function forum_print_latest_discussions() {
385
    throw new coding_exception(__FUNCTION__ . '() can not be used any more. ');
386
}
387
 
388
/**
389
 * @deprecated since Moodle 3.7
390
 */
391
function forum_count_replies() {
392
    throw new coding_exception(__FUNCTION__ . ' has been removed. Please use get_reply_count_for_post_id_in_discussion_id in
393
    the post vault.');
394
}
395
 
396
/**
397
 * @deprecated since Moodle 3.8
398
 */
399
function forum_scale_used() {
400
    throw new coding_exception('forum_scale_used() can not be used anymore. Plugins can implement ' .
401
        '<modname>_scale_used_anywhere, all implementations of <modname>_scale_used are now ignored');
402
}
403
 
404
/**
405
 * @deprecated since Moodle 3.8
406
 */
407
function forum_get_user_grades() {
408
    throw new \coding_exception('forum_get_user_grades() is deprecated and no longer used. '  .
409
        'Please use rating_manager::get_user_grades() instead.');
410
}
411
 
412
/**
413
 * @deprecated since Moodle 3.11
414
 */
415
function forum_get_completion_state() {
416
    $completionclass = \mod_forum\completion\custom_completion::class;
417
    throw new coding_exception(__FUNCTION__ . "() has been removed, please use the '{$completionclass}' class instead");
418
}
419
 
420
/**
421
 * Prints the editing button on subscribers page
422
 *
423
 * @deprecated since Moodle 4.0
424
 * @todo MDL-73956 Final deprecation in Moodle 4.4
425
 * @global object
426
 * @global object
427
 * @param int $courseid
428
 * @param int $forumid
429
 * @return string
430
 */
431
function forum_update_subscriptions_button($courseid, $forumid): string {
432
    global $CFG, $USER;
433
 
434
    debugging('The method forum_update_subscriptions_button() has been deprecated as it is no longer used.' .
435
            'The \'Manage subscribers\' button has been replaced with tertiary navigation.', DEBUG_DEVELOPER);
436
 
437
    if (!empty($USER->subscriptionsediting)) {
438
        $string = get_string('managesubscriptionsoff', 'forum');
439
        $edit = "off";
440
    } else {
441
        $string = get_string('managesubscriptionson', 'forum');
442
        $edit = "on";
443
    }
444
 
445
    $subscribers = html_writer::start_tag('form', ['action' => $CFG->wwwroot . '/mod/forum/subscribers.php',
446
        'method' => 'get', 'class' => 'd-flex flex-wrap align-items-center']);
447
    $subscribers .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => $string,
448
        'class' => 'btn btn-secondary'));
449
    $subscribers .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'id', 'value' => $forumid));
450
    $subscribers .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'edit', 'value' => $edit));
451
    $subscribers .= html_writer::end_tag('form');
452
 
453
    return $subscribers;
454
}
455
 
456
/**
457
 * This function prints the overview of a discussion in the forum listing.
458
 * It needs some discussion information and some post information, these
459
 * happen to be combined for efficiency in the $post parameter by the function
460
 * that calls this one: forum_print_latest_discussions()
461
 *
462
 * @deprecated since Moodle 4.3
463
 */
464
function forum_print_discussion_header() {
465
    throw new \coding_exception('forum_print_discussion_header has been deprecated');
466
}