diff options
author | Philip Häusler <msquare@notrademark.de> | 2014-12-25 22:32:18 +0100 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2014-12-25 22:32:18 +0100 |
commit | e89acc0c1d1188662da7490e3a75a4a5c3950a75 (patch) | |
tree | f646260cc23195008f6ca5152426b17641fc4f69 /includes/sys_template.php | |
parent | bcd33c02c814a8d82c08c078c8fae287d1cd95a5 (diff) | |
parent | 544a51612f14c4f3cf7d1c4a6de26a99ea94b788 (diff) |
merge feature-shift-types
Diffstat (limited to 'includes/sys_template.php')
-rw-r--r-- | includes/sys_template.php | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/includes/sys_template.php b/includes/sys_template.php index d7017bd9..d3f7a24e 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -6,13 +6,26 @@ $themes = array( "0" => "Engelsystem light", "1" => "Engelsystem dark", - "2" => "Engelsystem 31c3" + "2" => "Engelsystem 31c3" ); /** + * Display muted (grey) text. + * + * @param string $text + */ +function mute($text) { + return '<span class="text-muted">' . $text . '</span>'; +} + +function progress_bar($valuemin, $valuemax, $valuenow, $class = '', $content = '') { + return '<div class="progress"><div class="progress-bar ' . $class . '" role="progressbar" aria-valuenow="' . $valuenow . '" aria-valuemin="' . $valuemin . '" aria-valuemax="' . $valuemax . '" style="width: ' . (($valuenow - $valuemin) * 100 / ($valuemax - $valuemin)) . '%">' . $content . '</div></div>'; +} + +/** * Render glyphicon * - * @param string $glyph_name + * @param string $glyph_name */ function glyph($glyph_name) { return ' <span class="glyphicon glyphicon-' . $glyph_name . '"></span> '; @@ -21,7 +34,7 @@ function glyph($glyph_name) { /** * Renders a tick or a cross by given boolean * - * @param boolean $boolean + * @param boolean $boolean */ function glyph_bool($boolean) { return '<span class="text-' . ($boolean ? 'success' : 'danger') . '">' . glyph($boolean ? 'ok' : 'remove') . '</span>'; @@ -39,7 +52,7 @@ function heading($content, $number = 1) { /** * Render a toolbar. * - * @param array $items + * @param array $items * @return string */ function toolbar($items = array(), $right = false) { @@ -49,10 +62,10 @@ function toolbar($items = array(), $right = false) { /** * Render a link for a toolbar. * - * @param string $href - * @param string $glyphicon - * @param string $label - * @param bool $selected + * @param string $href + * @param string $glyphicon + * @param string $label + * @param bool $selected * @return string */ function toolbar_item_link($href, $glyphicon, $label, $selected = false) { @@ -74,7 +87,7 @@ function toolbar_popover($glyphicon, $label, $content, $class = '') { return '<li class="dropdown messages ' . $class . '"> <a id="' . $id . '" href="#" tabindex="0">' . ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '') . $label . ' <span class="caret"></span></a> <script type="text/javascript"> - $(document).ready(function(){$("#' . $id . '").popover({trigger: "focus", html: true, content: "' . addslashes(join('', $content)) . '", placement: "bottom", container: "body"})}); + $(document).ready(function(){$("#' . $id . '").popover({trigger: "click focus", html: true, content: "' . addslashes(join('', $content)) . '", placement: "bottom", container: "#navbar-collapse-1"})}); </script></li>'; } @@ -125,9 +138,9 @@ function form_checkboxes($name, $label, $items, $selected) { $html = form_element($label, ''); foreach ($items as $key => $item) $html .= form_checkbox($name . '_' . $key, $item, array_search($key, $selected) !== false); - + return $html; - + $html = "<ul>"; foreach ($items as $key => $item) { $id = $name . '_' . $key; @@ -191,7 +204,7 @@ function form_radio($name, $label, $selected, $value) { */ function form_info($label, $text = "") { if ($label == "") - return '<span class="help-block">' . $text . '</span>'; + return '<span class="help-block">' . glyph('info-sign') . $text . '</span>'; if ($text == "") return '<h4>' . $label . '</h4>'; return form_element($label, '<p class="form-control-static">' . $text . '</p>', ''); @@ -283,17 +296,17 @@ function table($columns, $rows_raw, $data = true) { // If only one column is given if (! is_array($columns)) { $columns = array( - 'col' => $columns + 'col' => $columns ); - + $rows = array(); foreach ($rows_raw as $row) $rows[] = array( - 'col' => $row + 'col' => $row ); } else $rows = $rows_raw; - + if (count($rows) == 0) return info(_("No data found."), true); $html = ""; @@ -381,7 +394,7 @@ function html_options($name, $options, $selected = "") { $html = ""; foreach ($options as $value => $label) $html .= '<input type="radio"' . ($value == $selected ? ' checked="checked"' : '') . ' name="' . $name . '" value="' . $value . '"> ' . $label; - + return $html; } @@ -419,7 +432,7 @@ function ReplaceSmilies($neueckig) { $neueckig = str_replace(";P", "<img src=\"pic/smiles/icon_mad.gif\">", $neueckig); $neueckig = str_replace(";oP", "<img src=\"pic/smiles/icon_mad.gif\">", $neueckig); $neueckig = str_replace("?)", "<img src=\"pic/smiles/icon_question.gif\">", $neueckig); - + return $neueckig; } ?> |