. /** * Class definition for mod_attendance_header * * @package mod_attendance * @author Daniel Thee Roperto * @copyright 2017 Catalyst IT Australia {@link http://www.catalyst-au.net} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * Used to render the page header. * * @package mod_attendance * @author Daniel Thee Roperto * @copyright 2017 Catalyst IT Australia {@link http://www.catalyst-au.net} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class mod_attendance_header implements renderable { /** @var mod_attendance_structure */ private $attendance; /** @var string */ private $title; /** * mod_attendance_header constructor. * * @param mod_attendance_structure $attendance * @param null $title */ public function __construct(mod_attendance_structure $attendance, $title = null) { $this->attendance = $attendance; $this->title = $title; } /** * Gets the attendance data. * * @return mod_attendance_structure */ public function get_attendance() { return $this->attendance; } /** * Gets the title. If title was not provided, use the module name. * * @return string */ public function get_title() { return is_null($this->title) ? $this->attendance->name : $this->title; } /** * Checks if the header should be rendered. * * @return bool */ public function should_render() { return !is_null($this->title) || !empty($this->attendance->intro); } }