summaryrefslogtreecommitdiff
path: root/includes/sys_template.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2017-12-12 21:57:57 +0100
committermsquare <msquare@notrademark.de>2017-12-12 21:57:57 +0100
commitff94df53d69234ae2625462a76926e131ade05b7 (patch)
treeb5ee27bd8461a06a2b7e082faa48c6fa66fc560f /includes/sys_template.php
parentd5631297dc42c06b1695fdb6f65d2b6a4b04c633 (diff)
finish basic public dashboard
Diffstat (limited to 'includes/sys_template.php')
-rw-r--r--includes/sys_template.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/includes/sys_template.php b/includes/sys_template.php
index 819b7d1c..b5846e9b 100644
--- a/includes/sys_template.php
+++ b/includes/sys_template.php
@@ -1,6 +1,31 @@
<?php
/**
+ * Render a stat for dashborad (big number with label).
+ * If no style given, style is danger if number > 0, and success if number == 0.
+ *
+ * @param string $label
+ * @param string $number
+ * @param string $style default, warning, danger or success. Optional.
+ */
+function stats($label, $number, $style = null)
+{
+ if(empty($style)) {
+ if($number > 0) {
+ $style = 'danger';
+ } else {
+ $style = 'success';
+ }
+ }
+ return div('stats stats-' . $style, [
+ $label,
+ div('number', [
+ $number
+ ])
+ ]);
+}
+
+/**
* Renders tabs from the array. Array key is tab name, array value is tab content.
*
* @param array $tabs