Initial commit
This commit is contained in:
commit
71c98918c4
15 changed files with 1276 additions and 0 deletions
21
classes/output/renderer.php
Normal file
21
classes/output/renderer.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
// Standard GPL and phpdocs
|
||||
namespace block_timetable\output;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
use plugin_renderer_base;
|
||||
|
||||
class renderer extends plugin_renderer_base {
|
||||
/**
|
||||
* Defer to template.
|
||||
*
|
||||
* @param index_page $page
|
||||
*
|
||||
* @return string html for the page
|
||||
*/
|
||||
public function render_index_page($page) {
|
||||
$data = $page->export_for_template($this);
|
||||
return parent::render_from_template('mod_timetable/timetable', $data);
|
||||
}
|
||||
}
|
||||
26
classes/output/timetable.php
Normal file
26
classes/output/timetable.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
// Standard GPL and phpdocs
|
||||
namespace block_timetable\output;
|
||||
|
||||
use renderable;
|
||||
use renderer_base;
|
||||
use templatable;
|
||||
use stdClass;
|
||||
|
||||
class timetable implements renderable, templatable {
|
||||
/** @var string $sometext Some text to show how to pass data to a template. */
|
||||
var $sometext = null;
|
||||
|
||||
public function __construct($timetable) {
|
||||
$this->timetable = $timetable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export this data so it can be used as the context for a mustache template.
|
||||
*
|
||||
* @return stdClass
|
||||
*/
|
||||
public function export_for_template(renderer_base $output) {
|
||||
return $this->timetable->prepare_output();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue