MDL-59106 report_insights: Fix predicted value styling
[moodle.git] / report / insights / classes / output / renderer.php
CommitLineData
373b1de1
DM
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 * Renderer.
19 *
20 * @package report_insights
21 * @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25namespace report_insights\output;
26
27defined('MOODLE_INTERNAL') || die();
28
29use plugin_renderer_base;
30use templatable;
31use renderable;
32
33/**
34 * Renderer class.
35 *
36 * @package report_insights
37 * @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
39 */
40class renderer extends plugin_renderer_base {
41
42 /**
f9e7447f 43 * Renders the list of insights
373b1de1
DM
44 *
45 * @param renderable $renderable
46 * @return string HTML
47 */
f9e7447f 48 protected function render_insights_list(renderable $renderable) {
373b1de1 49 $data = $renderable->export_for_template($this);
f9e7447f 50 return parent::render_from_template('report_insights/insights_list', $data);
373b1de1
DM
51 }
52
53 /**
f9e7447f 54 * Renders an insight
373b1de1
DM
55 *
56 * @param renderable $renderable
57 * @return string HTML
58 */
f9e7447f 59 protected function render_insight(renderable $renderable) {
373b1de1 60 $data = $renderable->export_for_template($this);
f9e7447f 61 return parent::render_from_template('report_insights/insight_details', $data);
373b1de1
DM
62 }
63
64 /**
65 * Model disabled info.
66 *
67 * @param \stdClass $insightinfo
68 * @return string HTML
69 */
70 public function render_model_disabled($insightinfo) {
71 global $OUTPUT, $PAGE;
72
73 // We don't want to disclose the name of the model if it has not been enabled.
74 $PAGE->set_title($insightinfo->contextname);
75 $PAGE->set_heading($insightinfo->contextname);
76
77 $output = $OUTPUT->header();
3e0f33aa 78 $output .= $OUTPUT->notification(get_string('disabledmodel', 'report_insights'), \core\output\notification::NOTIFY_INFO);
373b1de1
DM
79 $output .= $OUTPUT->footer();
80
81 return $output;
82 }
83
84 /**
f9e7447f 85 * Model without insights info.
373b1de1
DM
86 *
87 * @param \context $context
88 * @return string HTML
89 */
f9e7447f 90 public function render_no_insights(\context $context) {
373b1de1
DM
91 global $OUTPUT, $PAGE;
92
93 // We don't want to disclose the name of the model if it has not been enabled.
94 $PAGE->set_title($context->get_context_name());
95 $PAGE->set_heading($context->get_context_name());
96
97 $output = $OUTPUT->header();
f9e7447f
DM
98 $output .= $OUTPUT->notification(get_string('noinsights', 'analytics'), \core\output\notification::NOTIFY_INFO);
99 $output .= $OUTPUT->footer();
100
101 return $output;
102 }
103
104 /**
105 * Model which target does not generate insights.
106 *
107 * @param \context $context
108 * @return string HTML
109 */
110 public function render_no_insights_model(\context $context) {
111 global $OUTPUT, $PAGE;
112
113 // We don't want to disclose the name of the model if it has not been enabled.
114 $PAGE->set_title($context->get_context_name());
115 $PAGE->set_heading($context->get_context_name());
116
117 $output = $OUTPUT->header();
118 $output .= $OUTPUT->notification(get_string('noinsightsmodel', 'analytics'), \core\output\notification::NOTIFY_INFO);
373b1de1
DM
119 $output .= $OUTPUT->footer();
120
121 return $output;
122 }
123}