Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 27... Línea 27...
27
 *
27
 *
28
 * @package    core
28
 * @package    core
29
 * @subpackage lib
29
 * @subpackage lib
30
 * @copyright  Jamie Pratt
30
 * @copyright  Jamie Pratt
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
32
 * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
33
 * @todo Final removal in Moodle 6.0 MDL-80804.
32
 */
34
 */
Línea 33... Línea 35...
33
 
35
 
Línea 34... Línea 36...
34
defined('MOODLE_INTERNAL') || die();
36
defined('MOODLE_INTERNAL') || die();
Línea 41... Línea 43...
41
 * page reload so everything is rebuilt from scratch.
43
 * page reload so everything is rebuilt from scratch.
42
 *
44
 *
43
 * @package moodlecore
45
 * @package moodlecore
44
 * @copyright Jamie Pratt
46
 * @copyright Jamie Pratt
45
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
47
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
48
 * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
49
 * @todo Final removal in Moodle 6.0 MDL-80804.
46
 */
50
 */
-
 
51
#[\core\attribute\deprecated(null, since: 4.5, reason: 'No longer used in core code', mdl: 'MDL-72397')]
47
abstract class moodle_list {
52
abstract class moodle_list {
48
    public $attributes;
53
    public $attributes;
49
    public $listitemclassname = 'list_item';
54
    public $listitemclassname = 'list_item';
Línea 50... Línea 55...
50
 
55
 
Línea 90... Línea 95...
90
     * @param boolean $editable
95
     * @param boolean $editable
91
     * @param moodle_url $pageurl url for this page
96
     * @param moodle_url $pageurl url for this page
92
     * @param integer $page if 0 no pagination. (These three params only used in top level list.)
97
     * @param integer $page if 0 no pagination. (These three params only used in top level list.)
93
     * @param string $pageparamname name of url param that is used for passing page no
98
     * @param string $pageparamname name of url param that is used for passing page no
94
     * @param integer $itemsperpage no of top level items.
99
     * @param integer $itemsperpage no of top level items.
-
 
100
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
101
     * @todo Final removal in Moodle 6.0 MDL-80804.
95
     */
102
     */
96
    public function __construct($type='ul', $attributes='', $editable = false, $pageurl=null, $page = 0, $pageparamname = 'page', $itemsperpage = 20) {
103
    public function __construct($type='ul', $attributes='', $editable = false, $pageurl=null, $page = 0, $pageparamname = 'page', $itemsperpage = 20) {
-
 
104
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
97
        global $PAGE;
105
        global $PAGE;
Línea 98... Línea 106...
98
 
106
 
99
        $this->editable = $editable;
107
        $this->editable = $editable;
100
        $this->attributes = $attributes;
108
        $this->attributes = $attributes;
Línea 112... Línea 120...
112
 
120
 
113
    /**
121
    /**
114
     * Returns html string.
122
     * Returns html string.
115
     *
123
     *
-
 
124
     * @param integer $indent depth of indentation.
-
 
125
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
116
     * @param integer $indent depth of indentation.
126
     * @todo Final removal in Moodle 6.0 MDL-80804.
117
     */
127
     */
-
 
128
    public function to_html($indent=0, $extraargs=array()) {
118
    public function to_html($indent=0, $extraargs=array()) {
129
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
119
        if (count($this->items)) {
130
        if (count($this->items)) {
120
            $tabs = str_repeat("\t", $indent);
131
            $tabs = str_repeat("\t", $indent);
121
            $first = true;
132
            $first = true;
122
            $itemiter = 1;
133
            $itemiter = 1;
Línea 154... Línea 165...
154
     * Recurse down the tree and find an item by it's id.
165
     * Recurse down the tree and find an item by it's id.
155
     *
166
     *
156
     * @param integer $id
167
     * @param integer $id
157
     * @param boolean $suppresserror error if not item found?
168
     * @param boolean $suppresserror error if not item found?
158
     * @return list_item *copy* or null if item is not found
169
     * @return list_item *copy* or null if item is not found
-
 
170
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
171
     * @todo Final removal in Moodle 6.0 MDL-80804.
159
     */
172
     */
160
    public function find_item($id, $suppresserror = false) {
173
    public function find_item($id, $suppresserror = false) {
-
 
174
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
161
        if (isset($this->items)) {
175
        if (isset($this->items)) {
162
            foreach ($this->items as $key => $child) {
176
            foreach ($this->items as $key => $child) {
163
                if ($child->id == $id) {
177
                if ($child->id == $id) {
164
                    return $this->items[$key];
178
                    return $this->items[$key];
165
                }
179
                }
Línea 177... Línea 191...
177
            throw new \moodle_exception('listnoitem');
191
            throw new \moodle_exception('listnoitem');
178
        }
192
        }
179
        return null;
193
        return null;
180
    }
194
    }
Línea -... Línea 195...
-
 
195
 
-
 
196
    /**
-
 
197
     * Add list item
-
 
198
     *
-
 
199
     * @param $item
-
 
200
     * @return void
-
 
201
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
202
     * @todo Final removal in Moodle 6.0 MDL-80804.
181
 
203
     */
-
 
204
    public function add_item($item) {
182
    public function add_item($item) {
205
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
183
        $this->items[] = $item;
206
        $this->items[] = $item;
Línea -... Línea 207...
-
 
207
    }
-
 
208
 
-
 
209
    /**
-
 
210
     * Set parent item.
-
 
211
     *
-
 
212
     * @param $parent
-
 
213
     * @return void
-
 
214
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
184
    }
215
     * @todo Final removal in Moodle 6.0 MDL-80804.
-
 
216
     */
185
 
217
    public function set_parent($parent) {
186
    public function set_parent($parent) {
218
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
Línea 187... Línea 219...
187
        $this->parentitem = $parent;
219
        $this->parentitem = $parent;
188
    }
220
    }
Línea 194... Línea 226...
194
     * If the parent field doesn't point to another record in the array then this is
226
     * If the parent field doesn't point to another record in the array then this is
195
     * a top level list
227
     * a top level list
196
     *
228
     *
197
     * @param integer $offset how many list toplevel items are there in lists before this one
229
     * @param integer $offset how many list toplevel items are there in lists before this one
198
     * @return array(boolean, integer) whether there is more than one page, $offset + how many toplevel items where there in this list.
230
     * @return array(boolean, integer) whether there is more than one page, $offset + how many toplevel items where there in this list.
-
 
231
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
199
     *
232
     * @todo Final removal in Moodle 6.0 MDL-80804.
200
     */
233
     */
201
    public function list_from_records($paged = false, $offset = 0) {
234
    public function list_from_records($paged = false, $offset = 0) {
-
 
235
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
202
        $this->paged = $paged;
236
        $this->paged = $paged;
203
        $this->offset = $offset;
237
        $this->offset = $offset;
204
        $this->get_records();
238
        $this->get_records();
205
        $records = $this->records;
239
        $records = $this->records;
206
        $page = $this->page;
240
        $page = $this->page;
Línea 247... Línea 281...
247
        return array($this->paged, $itemiter);
281
        return array($this->paged, $itemiter);
248
    }
282
    }
Línea 249... Línea 283...
249
 
283
 
250
    /**
284
    /**
-
 
285
     * Should be overriden to return an array of records of list items.
-
 
286
     *
-
 
287
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
251
     * Should be overriden to return an array of records of list items.
288
     * @todo Final removal in Moodle 6.0 MDL-80804.
252
     */
289
     */
Línea 253... Línea 290...
253
    abstract public function get_records();
290
    abstract public function get_records();
254
 
291
 
-
 
292
    /**
-
 
293
     * display list of page numbers for navigation
-
 
294
     *
255
    /**
295
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
256
     * display list of page numbers for navigation
296
     * @todo Final removal in Moodle 6.0 MDL-80804.
-
 
297
     */
257
     */
298
    public function display_page_numbers() {
258
    public function display_page_numbers() {
299
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
259
        $html = '';
300
        $html = '';
260
        $topcount = count($this->items);
301
        $topcount = count($this->items);
261
        $this->pagecount = (integer) ceil(($topcount + $this->offset)/ QUESTION_PAGE_LENGTH );
302
        $this->pagecount = (integer) ceil(($topcount + $this->offset)/ QUESTION_PAGE_LENGTH );
Línea 278... Línea 319...
278
    /**
319
    /**
279
     * Returns an array of ids of peers of an item.
320
     * Returns an array of ids of peers of an item.
280
     *
321
     *
281
     * @param    int itemid - if given, restrict records to those with this parent id.
322
     * @param    int itemid - if given, restrict records to those with this parent id.
282
     * @return   array peer ids
323
     * @return   array peer ids
-
 
324
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
325
     * @todo Final removal in Moodle 6.0 MDL-80804.
283
     */
326
     */
284
    public function get_items_peers($itemid) {
327
    public function get_items_peers($itemid) {
-
 
328
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
285
        $itemref = $this->find_item($itemid);
329
        $itemref = $this->find_item($itemid);
286
        $peerids = $itemref->parentlist->get_child_ids();
330
        $peerids = $itemref->parentlist->get_child_ids();
287
        return $peerids;
331
        return $peerids;
288
    }
332
    }
Línea 289... Línea 333...
289
 
333
 
290
    /**
334
    /**
291
     * Returns an array of ids of child items.
335
     * Returns an array of ids of child items.
292
     *
336
     *
-
 
337
     * @return   array peer ids
-
 
338
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
293
     * @return   array peer ids
339
     * @todo Final removal in Moodle 6.0 MDL-80804.
294
     */
340
     */
-
 
341
    public function get_child_ids() {
295
    public function get_child_ids() {
342
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
296
        $childids = array();
343
        $childids = array();
297
        foreach ($this->items as $child) {
344
        foreach ($this->items as $child) {
298
           $childids[] = $child->id;
345
           $childids[] = $child->id;
299
        }
346
        }
Línea 304... Línea 351...
304
     * Returns the value to be used as the parent for the $item when it goes to the top level.
351
     * Returns the value to be used as the parent for the $item when it goes to the top level.
305
     * Override if needed.
352
     * Override if needed.
306
     *
353
     *
307
     * @param list_item $item The item which its top level parent is going to be returned.
354
     * @param list_item $item The item which its top level parent is going to be returned.
308
     * @return int
355
     * @return int
-
 
356
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
357
     * @todo Final removal in Moodle 6.0 MDL-80804.
309
     */
358
     */
310
    public function get_top_level_parent_id($item) {
359
    public function get_top_level_parent_id($item) {
-
 
360
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
311
        return 0; // Top level items have no parent.
361
        return 0; // Top level items have no parent.
312
    }
362
    }
Línea 313... Línea 363...
313
 
363
 
314
    /**
364
    /**
315
     * Move a record up or down
365
     * Move a record up or down
316
     *
366
     *
317
     * @param string $direction up / down
367
     * @param string $direction up / down
-
 
368
     * @param integer $id
-
 
369
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
318
     * @param integer $id
370
     * @todo Final removal in Moodle 6.0 MDL-80804.
319
     */
371
     */
-
 
372
    public function move_item_up_down($direction, $id) {
320
    public function move_item_up_down($direction, $id) {
373
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
321
        $peers = $this->get_items_peers($id);
374
        $peers = $this->get_items_peers($id);
322
        $itemkey = array_search($id, $peers);
375
        $itemkey = array_search($id, $peers);
323
        switch ($direction) {
376
        switch ($direction) {
324
            case 'down' :
377
            case 'down' :
Línea 342... Línea 395...
342
                break;
395
                break;
343
        }
396
        }
344
        $this->reorder_peers($peers);
397
        $this->reorder_peers($peers);
345
    }
398
    }
Línea -... Línea 399...
-
 
399
 
-
 
400
    /**
-
 
401
     * Reorder peers
-
 
402
     *
-
 
403
     * @param $peers
-
 
404
     * @return void
-
 
405
     * @throws dml_exception
-
 
406
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
407
     * @todo Final removal in Moodle 6.0 MDL-80804.
346
 
408
     */
-
 
409
    public function reorder_peers($peers) {
347
    public function reorder_peers($peers) {
410
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
348
        global $DB;
411
        global $DB;
349
        foreach ($peers as $key => $peer) {
412
        foreach ($peers as $key => $peer) {
350
            $DB->set_field($this->table, "sortorder", $key, array("id"=>$peer));
413
            $DB->set_field($this->table, "sortorder", $key, array("id"=>$peer));
351
        }
414
        }
Línea 354... Línea 417...
354
    /**
417
    /**
355
     * Moves the item one step up in the tree.
418
     * Moves the item one step up in the tree.
356
     *
419
     *
357
     * @param int $id an item index.
420
     * @param int $id an item index.
358
     * @return list_item the item that used to be the parent of the item moved.
421
     * @return list_item the item that used to be the parent of the item moved.
-
 
422
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
423
     * @todo Final removal in Moodle 6.0 MDL-80804.
359
     */
424
     */
360
    public function move_item_left($id) {
425
    public function move_item_left($id) {
-
 
426
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
361
        global $DB;
427
        global $DB;
Línea 362... Línea 428...
362
 
428
 
363
        $item = $this->find_item($id);
429
        $item = $this->find_item($id);
364
        if (!isset($item->parentlist->parentitem->parentlist)) {
430
        if (!isset($item->parentlist->parentitem->parentlist)) {
Línea 380... Línea 446...
380
 
446
 
381
    /**
447
    /**
382
     * Make item with id $id the child of the peer that is just above it in the sort order.
448
     * Make item with id $id the child of the peer that is just above it in the sort order.
383
     *
449
     *
-
 
450
     * @param integer $id
-
 
451
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
384
     * @param integer $id
452
     * @todo Final removal in Moodle 6.0 MDL-80804.
385
     */
453
     */
-
 
454
    public function move_item_right($id) {
386
    public function move_item_right($id) {
455
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
Línea 387... Línea 456...
387
        global $DB;
456
        global $DB;
388
 
457
 
389
        $peers = $this->get_items_peers($id);
458
        $peers = $this->get_items_peers($id);
Línea 409... Línea 478...
409
     * @param integer $left id of item to move left
478
     * @param integer $left id of item to move left
410
     * @param integer $right id of item to move right
479
     * @param integer $right id of item to move right
411
     * @param integer $moveup id of item to move up
480
     * @param integer $moveup id of item to move up
412
     * @param integer $movedown id of item to move down
481
     * @param integer $movedown id of item to move down
413
     * @return unknown
482
     * @return unknown
-
 
483
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
484
     * @todo Final removal in Moodle 6.0 MDL-80804.
414
     */
485
     */
415
    public function process_actions($left, $right, $moveup, $movedown) {
486
    public function process_actions($left, $right, $moveup, $movedown) {
-
 
487
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
416
        //should this action be processed by this list object?
488
        //should this action be processed by this list object?
417
        if (!(array_key_exists($left, $this->records) || array_key_exists($right, $this->records) || array_key_exists($moveup, $this->records) || array_key_exists($movedown, $this->records))) {
489
        if (!(array_key_exists($left, $this->records) || array_key_exists($right, $this->records) || array_key_exists($moveup, $this->records) || array_key_exists($movedown, $this->records))) {
418
            return false;
490
            return false;
419
        }
491
        }
420
        if (!empty($left)) {
492
        if (!empty($left)) {
Línea 454... Línea 526...
454
 
526
 
455
    /**
527
    /**
456
     * @param integer $itemid an item id.
528
     * @param integer $itemid an item id.
457
     * @return boolean Is the item with the given id the first top-level item on
529
     * @return boolean Is the item with the given id the first top-level item on
-
 
530
     * the current page?
-
 
531
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
458
     * the current page?
532
     * @todo Final removal in Moodle 6.0 MDL-80804.
459
     */
533
     */
-
 
534
    public function item_is_first_on_page($itemid) {
460
    public function item_is_first_on_page($itemid) {
535
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
461
        return $this->page && isset($this->items[$this->firstitem]) &&
536
        return $this->page && isset($this->items[$this->firstitem]) &&
462
                $itemid == $this->items[$this->firstitem]->id;
537
                $itemid == $this->items[$this->firstitem]->id;
Línea 463... Línea 538...
463
    }
538
    }
464
 
539
 
465
    /**
540
    /**
466
     * @param integer $itemid an item id.
541
     * @param integer $itemid an item id.
-
 
542
     * @return boolean Is the item with the given id the last top-level item on
-
 
543
     * the current page?
467
     * @return boolean Is the item with the given id the last top-level item on
544
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
468
     * the current page?
545
     * @todo Final removal in Moodle 6.0 MDL-80804.
-
 
546
     */
469
     */
547
    public function item_is_last_on_page($itemid) {
470
    public function item_is_last_on_page($itemid) {
548
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
471
        return $this->page && isset($this->items[$this->lastitem]) &&
549
        return $this->page && isset($this->items[$this->lastitem]) &&
472
                $itemid == $this->items[$this->lastitem]->id;
550
                $itemid == $this->items[$this->lastitem]->id;
Línea 473... Línea 551...
473
    }
551
    }
474
}
552
}
475
 
553
 
476
/**
554
/**
-
 
555
 * @package moodlecore
-
 
556
 * @copyright Jamie Pratt
477
 * @package moodlecore
557
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
558
 * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
478
 * @copyright Jamie Pratt
559
 * @todo Final removal in Moodle 6.0 MDL-80804.
479
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
560
 */
480
 */
561
#[\core\attribute\deprecated(null, since: '4.5', reason: 'No longer used in core code.', mdl: 'MDL-72397')]
Línea 481... Línea 562...
481
abstract class list_item {
562
abstract class list_item {
Línea 498... Línea 579...
498
    /** @var moodle_list Set if there are any children of this listitem. */
579
    /** @var moodle_list Set if there are any children of this listitem. */
499
    public $children;
580
    public $children;
Línea 500... Línea 581...
500
 
581
 
501
    /**
582
    /**
-
 
583
     * Constructor
502
     * Constructor
584
     *
503
     * @param mixed $item fragment of html for list item or record
585
     * @param mixed $item fragment of html for list item or record
504
     * @param object $parent reference to parent of this item
586
     * @param object $parent reference to parent of this item
505
     * @param string $attributes attributes for li tag
587
     * @param string $attributes attributes for li tag
506
     * @param boolean $display whether this item is displayed. Some items may be loaded so we have a complete
588
     * @param boolean $display whether this item is displayed. Some items may be loaded so we have a complete
507
     *                              structure in memory to work with for actions but are not displayed.
589
     *                              structure in memory to work with for actions but are not displayed.
-
 
590
     * @return list_item
-
 
591
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
508
     * @return list_item
592
     * @todo Final removal in Moodle 6.0 MDL-80804.
509
     */
593
     */
-
 
594
    public function __construct($item, $parent, $attributes = '', $display = true) {
510
    public function __construct($item, $parent, $attributes = '', $display = true) {
595
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
511
        $this->item = $item;
596
        $this->item = $item;
512
        if (is_object($this->item)) {
597
        if (is_object($this->item)) {
513
            $this->id = $this->item->id;
598
            $this->id = $this->item->id;
514
            $this->name = $this->item->{$this->fieldnamesname};
599
            $this->name = $this->item->{$this->fieldnamesname};
Línea 522... Línea 607...
522
    }
607
    }
Línea 523... Línea 608...
523
 
608
 
524
    /**
609
    /**
525
     * Output the html just for this item. Called by to_html which adds html for children.
610
     * Output the html just for this item. Called by to_html which adds html for children.
-
 
611
     *
-
 
612
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
526
     *
613
     * @todo Final removal in Moodle 6.0 MDL-80804.
527
     */
614
     */
-
 
615
    public function item_html($extraargs = array()) {
528
    public function item_html($extraargs = array()) {
616
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
529
        if (is_string($this->item)) {
617
        if (is_string($this->item)) {
530
            $html = $this->item;
618
            $html = $this->item;
531
        } elseif (is_object($this->item)) {
619
        } elseif (is_object($this->item)) {
532
            //for debug purposes only. You should create a sub class to
620
            //for debug purposes only. You should create a sub class to
Línea 541... Línea 629...
541
     *
629
     *
542
     * @param integer $indent
630
     * @param integer $indent
543
     * @param array $extraargs any extra data that is needed to print the list item
631
     * @param array $extraargs any extra data that is needed to print the list item
544
     *                            may be used by sub class.
632
     *                            may be used by sub class.
545
     * @return string html
633
     * @return string html
-
 
634
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
635
     * @todo Final removal in Moodle 6.0 MDL-80804.
546
     */
636
     */
547
    public function to_html($indent = 0, $extraargs = array()) {
637
    public function to_html($indent = 0, $extraargs = array()) {
-
 
638
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
548
        if (!$this->display) {
639
        if (!$this->display) {
549
            return '';
640
            return '';
550
        }
641
        }
551
        $tabs = str_repeat("\t", $indent);
642
        $tabs = str_repeat("\t", $indent);
Línea 556... Línea 647...
556
            $childrenhtml = '';
647
            $childrenhtml = '';
557
        }
648
        }
558
        return $this->item_html($extraargs).' '.(join('', $this->icons)).(($childrenhtml !='')?("\n".$childrenhtml):'');
649
        return $this->item_html($extraargs).' '.(join('', $this->icons)).(($childrenhtml !='')?("\n".$childrenhtml):'');
559
    }
650
    }
Línea -... Línea 651...
-
 
651
 
-
 
652
    /**
-
 
653
     * Set icon HTML
-
 
654
     *
-
 
655
     * @param $first
-
 
656
     * @param $last
-
 
657
     * @param $lastitem
-
 
658
     * @return void
-
 
659
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
660
     * @todo Final removal in Moodle 6.0 MDL-80804.
560
 
661
     */
-
 
662
    public function set_icon_html($first, $last, $lastitem) {
561
    public function set_icon_html($first, $last, $lastitem) {
663
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
562
        global $CFG;
664
        global $CFG;
563
        $strmoveup = get_string('moveup');
665
        $strmoveup = get_string('moveup');
564
        $strmovedown = get_string('movedown');
666
        $strmovedown = get_string('movedown');
Línea 606... Línea 708...
606
        } else {
708
        } else {
607
            $this->icons['right'] =  $this->image_spacer();
709
            $this->icons['right'] =  $this->image_spacer();
608
        }
710
        }
609
    }
711
    }
Línea -... Línea 712...
-
 
712
 
-
 
713
    /**
-
 
714
     * Return image icon HTML
-
 
715
     *
-
 
716
     * @param $action
-
 
717
     * @param $url
-
 
718
     * @param $icon
-
 
719
     * @return string
-
 
720
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
721
     * @todo Final removal in Moodle 6.0 MDL-80804.
610
 
722
     */
-
 
723
    public function image_icon($action, $url, $icon) {
611
    public function image_icon($action, $url, $icon) {
724
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
612
        global $OUTPUT;
725
        global $OUTPUT;
613
        return '<a title="' . s($action) .'" href="'.$url.'">' .
726
        return '<a title="' . s($action) .'" href="'.$url.'">' .
614
                $OUTPUT->pix_icon('t/' . $icon, $action) . '</a> ';
727
                $OUTPUT->pix_icon('t/' . $icon, $action) . '</a> ';
Línea -... Línea 728...
-
 
728
    }
-
 
729
 
-
 
730
    /**
-
 
731
     * Return image spacer HTML
-
 
732
     *
-
 
733
     * @return mixed
-
 
734
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
615
    }
735
     * @todo Final removal in Moodle 6.0 MDL-80804.
-
 
736
     */
616
 
737
    public function image_spacer() {
617
    public function image_spacer() {
738
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
618
        global $OUTPUT;
739
        global $OUTPUT;
Línea 619... Línea 740...
619
        return $OUTPUT->spacer();
740
        return $OUTPUT->spacer();
620
    }
741
    }
621
 
742
 
622
    /**
743
    /**
623
     * Recurse down tree creating list_items, called from moodle_list::list_from_records
744
     * Recurse down tree creating list_items, called from moodle_list::list_from_records
624
     *
745
     *
-
 
746
     * @param array $records
-
 
747
     * @param array $children
625
     * @param array $records
748
     * @param integer $thisrecordid
626
     * @param array $children
749
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
-
 
750
     * @todo Final removal in Moodle 6.0 MDL-80804.
627
     * @param integer $thisrecordid
751
     */
628
     */
752
    public function create_children(&$records, &$children, $thisrecordid) {
629
    public function create_children(&$records, &$children, $thisrecordid) {
753
        \core\deprecation::emit_deprecation([$this, __FUNCTION__]);
630
        //keys where value is $thisrecordid
754
        //keys where value is $thisrecordid
631
        $thischildren = moodle_array_keys_filter($children, $thisrecordid);
755
        $thischildren = moodle_array_keys_filter($children, $thisrecordid);
632
        foreach ($thischildren as $child) {
756
        foreach ($thischildren as $child) {
633
            $thisclass = get_class($this);
757
            $thisclass = get_class($this);
634
            $newlistitem = new $thisclass($records[$child], $this->children, $this->attributes);
758
            $newlistitem = new $thisclass($records[$child], $this->children, $this->attributes);
635
            $this->children->add_item($newlistitem);
759
            $this->children->add_item($newlistitem);
Línea -... Línea 760...
-
 
760
            $newlistitem->create_children($records, $children, $records[$child]->id);
-
 
761
        }
-
 
762
    }
-
 
763
 
-
 
764
    /**
-
 
765
     * Set parent list
-
 
766
     *
-
 
767
     * @param $parent
636
            $newlistitem->create_children($records, $children, $records[$child]->id);
768
     * @return void
-
 
769
     * @deprecated Since Moodle 4.5 MDL-72397. This is no longer used in core code.
637
        }
770
     * @todo Final removal in Moodle 6.0 MDL-80804.
638
    }
771
     */
639
 
772
    public function set_parent($parent) {