From cc7d85586b3037f3d3f0fabbb53c654c40d57a74 Mon Sep 17 00:00:00 2001 From: cajus Date: Sun, 28 Feb 2010 19:45:23 +0000 Subject: [PATCH] Added image function git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15775 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/functions.inc | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 8609fab62..fd8252b1f 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -3517,5 +3517,43 @@ function mark($needle, $haystack, $ignorecase= true) return $result.$haystack; } + +/* Return an image description using the path */ +function image($path, $label= null) +{ + // Bail out, if there's no style file + if(!session::global_is_set("img-styles")){ + + // Get theme + if (isset ($config)){ + $theme= $config->get_cfg_value("theme", "default"); + } else { + # For debuging - avoid that there's no theme set + die("config not set!"); + $theme= "default"; + } + + if (!file_exists("$BASE_DIR/ihtml/themes/$theme/img.styles")){ + die ("No img.style for this theme found!"); + } + + session::global_set('img-styles', unserialize(file_get_contents("$BASE_DIR/ihtml/themes/$theme/img.styles"))); + } + $styles= session::global_get('img-styles'); + + $lbl= ""; + if ($label) { + if (isset($styles["images/label-".$label.".png"])) { + $lbl= "
"; + } else { + die("Invalid label specified: $label\n"); + } + } + + return "
$lbl
"; +} + + + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> -- 2.30.2