Merge branch 'MDL-81073' of https://github.com/paulholden/moodle
[moodle.git] / availability / classes / multiple_messages.php
blob0ba70a7a33349de72f5fc803789dcac8521db8fa
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.
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/>.
17 /**
18 * Represents multiple availability messages.
20 * These are messages like 'Not available until <date>'. This class includes
21 * multiple messages so that they can be rendered into a combined display, e.g.
22 * using bulleted lists.
24 * The tree structure of this object matches that of the availability
25 * restrictions.
27 * @package core_availability
28 * @copyright 2015 Andrew Nicols <andrew@nicols.co.uk>
29 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32 /**
33 * Represents multiple availability messages.
35 * These are messages like 'Not available until <date>'. This class includes
36 * multiple messages so that they can be rendered into a combined display, e.g.
37 * using bulleted lists.
39 * The tree structure of this object matches that of the availability
40 * restrictions.
42 * @package core_availability
43 * @copyright 2015 Andrew Nicols <andrew@nicols.co.uk>
44 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
46 class core_availability_multiple_messages implements renderable {
47 /** @var bool True if this object represents the root of the tree */
48 public $root;
49 /** @var bool True if items use the AND operator (false = OR) */
50 public $andoperator;
51 /** @var bool True if this part of the tree is marked 'hide entirely' for non-matching users */
52 public $treehidden;
53 /** @var array Array of child items (may be string or this type) */
54 public $items;
56 /**
57 * Constructor.
59 * @param bool $root True if this object represents the root of the tree
60 * @param bool $andoperator True if items use the AND operator (false = OR)
61 * @param bool $treehidden True if this part of the tree is marked 'hide entirely' for non-matching users
62 * @param array $items Array of items (may be string or this type)
64 public function __construct($root, $andoperator, $treehidden, array $items) {
65 $this->root = $root;
66 $this->andoperator = $andoperator;
67 $this->treehidden = $treehidden;
68 $this->items = $items;