* @copyright 2004 by http://wombat.exit0.net * @package wombatSite * @subpackage cmHtml */ /** * Dialog interface * * @todo check user before display! * * @version 0.1.0 * @package wombatSite * @subpackage cmHtml */ class wbDialog { /** * options * @var array $_options */ var $_options = array(); /** * selected string * @var string */ var $_selection = ''; /** * patTemplate object * @var object $_tmpl */ var $_tmpl; /** * init language depending data * * @access private */ function _init() { $this->_options = array( 'width' => 500, 'height' => 500, 'class' => 'Dialog', 'title' => _( 'Wombat Basic Dialog' ), 'brief' => _( 'There is no description' ), 'name' => 'dialog', 'vars' => '', 'type' => 'inline', ); return true; } /** * constructor * * @access public */ function __construct() { $this->_tmpl =& wbFactory::singleton( 'patTemplate' ); $this->_init(); } /** * constructor wrapper for PHP4 * * @access public * @see __construct() */ function wbDialog() { // this should work because dialog should be called by wbDialogController $this->__construct(); } /** * pass selected string * * @access public * @param string $selection * @return true on success */ public function setSelection( $selection ) { $this->_selection = $selection; return true; } /** * process dialog * * @access public * @param string $html html to be displayed, or null to get it from template * @return boolean $result true */ function process() { $this->_loadTemplates( $this->_options['class'] ); return $this->_tmpl->getParsedTemplate( 'dialog' ); } /** * get options * * @access public * @return array $options associative arrey of options */ function getOptions() { return $this->_options; } /** * load tempaltes * * @access public * @param string $tmpl load dialog template file * @return boolean $result true */ function _loadTemplates( $tmpl ) { return $this->_tmpl->readTemplatesFromInput( 'cmHtml/dialog/' . $tmpl . '.tmpl' ); } } ?>