summaryrefslogtreecommitdiff
path: root/includes/sys_template.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/sys_template.php')
-rw-r--r--includes/sys_template.php36
1 files changed, 22 insertions, 14 deletions
diff --git a/includes/sys_template.php b/includes/sys_template.php
index 48ec7e8c..a988ca7c 100644
--- a/includes/sys_template.php
+++ b/includes/sys_template.php
@@ -3,15 +3,16 @@
/**
* 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.
+ * @return string
*/
function stats($label, $number, $style = null)
{
- if(empty($style)) {
- if($number > 0) {
+ if (empty($style)) {
+ if ($number > 0) {
$style = 'danger';
} else {
$style = 'success';
@@ -27,24 +28,26 @@ function stats($label, $number, $style = null)
/**
* Renders tabs from the array. Array key is tab name, array value is tab content.
- *
+ *
* @param array $tabs
- * @param int $selected The selected tab, default 0
+ * @param int $selected The selected tab, default 0
* @return string HTML
*/
function tabs($tabs, $selected = 0)
{
$tab_header = [];
$tab_content = [];
- foreach($tabs as $header => $content) {
+ foreach ($tabs as $header => $content) {
$class = '';
- if(count($tab_header) == $selected) {
+ if (count($tab_header) == $selected) {
$class = 'active';
}
$tab_header[] = '<li role="presentation" class="' . $class . '">
- <a href="#' . $header . '" aria-controls="' . $header . '" role="tab" data-toggle="tab">'
- . $header . '</a></li>';
- $tab_content[] = '<div role="tabpanel" class="tab-pane ' . $class . '" id="' . $header . '">' . $content . '</div>';
+ <a href="#' . $header . '" aria-controls="' . $header . '" role="tab" data-toggle="tab">'
+ . $header . '</a></li>';
+ $tab_content[] = '<div role="tabpanel" class="tab-pane ' . $class . '" id="' . $header . '">'
+ . $content
+ . '</div>';
}
return div('', [
'<ul class="nav nav-tabs" role="tablist">' . join($tab_header) . '</ul>',
@@ -114,7 +117,9 @@ function glyph($glyph_name)
*/
function glyph_bool($boolean)
{
- return '<span class="text-' . ($boolean ? 'success' : 'danger') . '">' . glyph($boolean ? 'ok' : 'remove') . '</span>';
+ return '<span class="text-' . ($boolean ? 'success' : 'danger') . '">'
+ . glyph($boolean ? 'ok' : 'remove')
+ . '</span>';
}
/**
@@ -265,12 +270,15 @@ function page_with_title($title, $elements)
/**
* Renders a description based on the data arrays key and values as label an description.
+ *
* @param array $data
+ * @return string
*/
-function description($data) {
+function description($data)
+{
$elements = [];
- foreach($data as $label => $description) {
- if(!empty($label) && !empty($description)) {
+ foreach ($data as $label => $description) {
+ if (!empty($label) && !empty($description)) {
$elements[] = '<dt>' . $label . '</dt><dd>' . $description . '</dd>';
}
}