Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
   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   * Issued badge renderable.
  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  
  27  namespace core_badges\output;
  28  
  29  defined('MOODLE_INTERNAL') || die();
  30  
  31  require_once($CFG->libdir . '/badgeslib.php');
  32  
  33  use renderable;
  34  
  35  /**
  36   * Link to external resources this badge is aligned with.
  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   */
  42  class badge_alignments 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 array list of badges. */
  60      public $alignments = array();
  61  
  62      /** @var array list of badges. */
  63      public $currentbadgeid = 0;
  64  
  65      /**
  66       * Initializes the list of alignments to display.
  67       *
  68       * @param array $alignments List alignments to render.
  69       * @param int $currentbadgeid ID current badge.
  70       */
  71      public function __construct($alignments, $currentbadgeid) {
  72          $this->alignments = $alignments;
  73          $this->currentbadgeid = $currentbadgeid;
  74      }
  75  }