<?php

require_once 'Swat/SwatCellRenderer.php';

/**
 * A text cell renderer
 *
 * @package   Swat
 * @copyright 2004-2005 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class SwatTextCellRenderer extends SwatCellRenderer
{
	/**
	 * Cell value
	 *
	 * The textual content to place within this cell.
	 *
	 * @var string
	 */
	public $value = '';

	/**
	 * Renders the contents of this cell
	 *
	 * @see swatcellrenderer::render()
	 */
	public function render()
	{
		echo $this->value;
	}
}

?>

<?php

require_once 'Swat/SwatCellRenderer.php';

/**
 * A text cell renderer
 *
 * @package   Swat
 * @copyright 2004-2005 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class SwatTextCellRenderer extends SwatCellRenderer
{
	/**
	 * Cell content
	 *
	 * The textual content to place within this cell.
	 *
	 * @var string
	 */
	public $text = '';

	/**
	 * A value to substitute into the text of this cell
	 *
	 * The value is substituted using a call to printf. For example, if the
	 * {@link SwatCellRendererText::$text} property is set to 'My %s example'
	 * and the value property is set to 'awesome' the cell renderer will render
	 * as 'My aswesome example'.
	 *
	 * @var string
	 */
	public $value = null;

	/**
	 * Renders the contents of this cell
	 *
	 * @see swatcellrenderer::render()
	 */
	public function render()
	{
		if ($this->value === null)
			echo $this->text;
		else
			printf($this->text, $this->value);
	}
}

?>

Make it possible to do text substitution with this renderer.
Make it possible to do text substitution with this renderer.


svn commit r2278
