From bb74cdfef339c39aaf15e5a4e395f2758e8f3f62 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 25 Sep 2013 15:40:23 +0800 Subject: [PATCH] MDL-41792 block_calendar_upcoming: tidy existing code --- .../block_calendar_upcoming.php | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/blocks/calendar_upcoming/block_calendar_upcoming.php b/blocks/calendar_upcoming/block_calendar_upcoming.php index a3872948b8d..335bcc4e7e2 100644 --- a/blocks/calendar_upcoming/block_calendar_upcoming.php +++ b/blocks/calendar_upcoming/block_calendar_upcoming.php @@ -1,25 +1,53 @@ . +/** + * Handles displaying the calendar upcoming events block. + * + * @package block_calendar_upcoming + * @copyright 2004 Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class block_calendar_upcoming extends block_base { - function init() { + + /** + * Initialise the block. + */ + public function init() { $this->title = get_string('pluginname', 'block_calendar_upcoming'); } - function get_content() { - global $USER, $CFG, $SESSION; - $cal_m = optional_param( 'cal_m', 0, PARAM_INT ); - $cal_y = optional_param( 'cal_y', 0, PARAM_INT ); + /** + * Return the content of this block. + * + * @return stdClass the content + */ + public function get_content() { + global $CFG; require_once($CFG->dirroot.'/calendar/lib.php'); - if ($this->content !== NULL) { + if ($this->content !== null) { return $this->content; } $this->content = new stdClass; $this->content->text = ''; $filtercourse = array(); - if (empty($this->instance)) { // Overrides: use no course at all + if (empty($this->instance)) { // Overrides: use no course at all. $courseshown = false; $this->content->footer = '';