From ec6016cd38fc5ce6455cace6ffbc703f78f31096 Mon Sep 17 00:00:00 2001 From: msquare Date: Tue, 15 Nov 2016 16:28:20 +0100 Subject: reduce complexity of menu and hints --- includes/view/UserHintsRenderer.php | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 includes/view/UserHintsRenderer.php (limited to 'includes/view/UserHintsRenderer.php') diff --git a/includes/view/UserHintsRenderer.php b/includes/view/UserHintsRenderer.php new file mode 100644 index 00000000..54f9c149 --- /dev/null +++ b/includes/view/UserHintsRenderer.php @@ -0,0 +1,57 @@ +hints) > 0) { + $hint_class = $this->important ? 'danger' : 'info'; + $glyphicon = $this->important ? 'warning-sign' : 'info-sign'; + + return toolbar_popover($glyphicon . ' text-' . $hint_class, '', $this->hints, 'bg-' . $hint_class); + } + + return ''; + } + + /** + * Add a hint to the list, if its not null and a not empty string. + * + * @param string $hint + * The hint + * @param boolean $important + * Is the hint important? + */ + public function addHint($hint, $important = false) { + if ($hint != null && $hint != '') { + $this->hints[] = $hint; + if ($important) { + $this->important = true; + } + } + } + + /** + * Get all hints. + */ + public function getHints() { + return $this->hints; + } + + /** + * Are there important hints? This leads to a more intensive icon. + */ + public function isImportant() { + return $this->important; + } +} + +?> \ No newline at end of file -- cgit v1.2.3-54-g00ecf