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 * Collection of all related badges.
19 *
20 * @package    core
21 * @subpackage badges
22 * @copyright  2012 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
23 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 * @author     Yuliya Bozhko <yuliya.bozhko@totaralms.com>
25 */
26
27namespace core_badges\output;
28
29defined('MOODLE_INTERNAL') || die();
30
31require_once($CFG->libdir . '/badgeslib.php');
32
33use renderable;
34
35/**
36 * Collection of all related badges.
37 *
38 * @copyright  2018 Tung Thai
39 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
40 * @author     Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
41 */
42class badge_related implements renderable {
43
44    /** @var string how are the data sorted. */
45    public $sort = 'name';
46
47    /** @var string how are the data sorted. */
48    public $dir = 'ASC';
49
50    /** @var int page number to display. */
51    public $page = 0;
52
53    /** @var int number of badges to display per page. */
54    public $perpage = BADGE_PERPAGE;
55
56    /** @var int the total number of badges to display. */
57    public $totalcount = null;
58
59    /** @var int the current badge. */
60    public $currentbadgeid = 0;
61
62    /** @var array list of badges. */
63    public $badges = array();
64
65    /**
66     * Initializes the list of badges to display.
67     *
68     * @param array $badges related badges to render.
69     * @param int $currentbadgeid ID current badge.
70     */
71    public function __construct($badges, $currentbadgeid) {
72        $this->badges = $badges;
73        $this->currentbadgeid = $currentbadgeid;
74    }
75}
76
77