1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
<?php
/**
* The Horde_UI_Widget:: class provides base functionality for other Horde
* UI elements.
*
* $Horde: framework/UI/UI/Widget.php,v 1.7.10.8 2006/06/20 09:08:45 jan Exp $
*
* Copyright 2003-2006 Jason M. Felice <jfelice@cronosys.com>
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
* @since Horde_UI 0.0.1
* @package Horde_UI
*/
class Horde_UI_Widget {
/**
* Any variables that should be preserved in all of the widget's
* links.
*
* @var array
*/
var $_preserve = array();
/**
* The name of this widget. This is used as the basename for variables
* we access and manipulate.
*
* @var string
*/
var $_name;
/**
* A reference to a Variables:: object this widget will use and
* manipulate.
*
* @var Variables
*/
var $_vars;
/**
* An array of name => value pairs which configure how this widget
* behaves.
*
* @var array
*/
var $_config;
/**
* Construct a new UI Widget interface.
*
* @param string $name The name of the variable which will track this
* UI widget's state.
* @param Variables &$vars A Variables:: object.
* @param array $config The widget's configuration.
*/
function Horde_UI_Widget($name, &$vars, $config = array())
{
$this->_name = $name;
$this->_vars = &$vars;
$this->_config = $config;
}
/**
* Instruct Horde_UI_Widget:: to preserve a variable.
*
* @param string $var The name of the variable to preserve.
* @param mixed $value The value of the variable to preserve.
*/
function preserve($var, $value)
{
$this->_preserve[$var] = $value;
}
/**
* @access private
*/
function _addPreserved($link)
{
foreach ($this->_preserve as $varName => $varValue) {
$link = Util::addParameter($link, $varName, $varValue);
}
return $link;
}
/**
* Render the widget.
*
* @abstract
*
* @param mixed $data The widget's state data.
*/
function render() {}
}
|