}
+/**
+ * Generates a span tag
+ *
+ * @param string $value The contents that belong inside the span
+ * @param string $class The CSS class name (OPTIONAL; default
+ * not used)
+ * @param string $id The ID name (OPTIONAL; default not used)
+ *
+ * @return string The desired span tag.
+ *
+ * @since 1.5.2
+ *
+ */
+function create_span($value, $class='', $id='') {
+
+ global $oTemplate;
+
+ $oTemplate->assign('value', $value);
+ $oTemplate->assign('class', $class);
+ $oTemplate->assign('id', $id);
+
+ return $oTemplate->fetch('span.tpl');
+
+}
+
+
/**
* Generates html tags
+//FIXME: this should not be used anywhere in the core, or we should
+// convert this to use templates. We sould not be assuming HTML output.
*
* @param string $tag Tag to output
* @param string $val Value between tags
switch ($priority) {
case 1:
case 2:
- $icon = getIcon($icon_theme_path, 'prio_high.png', '<span class="high_priority">!</span>');
+ $icon = getIcon($icon_theme_path, 'prio_high.png', create_span('!', 'high_priority'));
break;
case 5:
- $icon = getIcon($icon_theme_path, 'prio_low.png', '<span class="low_priority">↓</span>');
+ $icon = getIcon($icon_theme_path, 'prio_low.png', create_span('↓', 'low_priority'));
break;
default:
$icon = getIcon($icon_theme_path, 'transparent.png', '', '', 5);
break;
}
- echo "prio = $priority<br>icon = $icon<br>";
return $icon;
}
--- /dev/null
+<?php
+
+/**
+ * span.tpl
+ *
+ * Template for constructing a span tag.
+ *
+ * The following variables are available in this template:
+ * + $value - The contents that belong inside the span
+ * + $class - CSS class name (optional; may not be present)
+ * + $id - ID name (optional; may not be present)
+ *
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage templates
+ */
+
+
+// retrieve the template vars
+//
+extract($t);
+
+
+?><span<?php if (!empty($class)) echo ' class="' . $class . '"'; ?><?php if (!empty($id)) echo ' id="' . $id . '"'; ?>><?php echo $value; ?></span>