Location: PHPKode > scripts > ezSqliteAdmin > ezsqliteadmin/MainEditorView.php
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
//
// +----------------------------------------------------------------------+
// | ezSqliteAdmin V0.1                                                   |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004, Wenlong Wu <hide@address.com>                 |
// | Homepage      http://www.phpsalon.com                                |
// | License       GNU Lesser General Public License (LGPL)               | 
// +----------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or        |
// | modify it under the terms of the GNU Lesser General Public           |
// | License as published by the Free Software Foundation; either         |
// | version 2.1 of the License, or (at your option) any later version.   |
// +----------------------------------------------------------------------+
// | Authors: Wenlong Wu <hide@address.com>                            |
// +----------------------------------------------------------------------+
//
// $Id: MainEditorView.php,v 1.1.1.2 2004/09/18 00:35:22 wenlong Exp $
//
require_once('MainEditorModel.php');
/**
* MainEditorView
*
* @package		ezSqliteAdmin
* @version		$Revision: 1.1.1.2 $
* @author		Wenlong Wu <hide@address.com>
* @homepage		http://www.phpsalon.com
* @copyright	Copyright (c) 2004, Wenlong Wu
* @license		http://opensource.org/licenses/lgpl-license.php
* @access		public
*/
class MainEditorView extends AView implements IView {
	/**
	* contains MainEditorModel class
	*
	* @access	private
	* @var		object
	*/
	private $model = null;

	/**
	* Constructor
	*/
	public function __construct() {
		$this->model = MainEditorModel::getInstance();
	}

	/**
	* Prepare XUL for output
	*
	* @access	public
	* @return	string		XUL
	*/
	public function render() {
		$schema = $this->model->getLastScript();
		$xul = <<<EOD
			<hbox>
					<!--<toolbar id="sqlEditorToolbar">-->
						<toolbarbutton image="images/file_open.png"/>
						<toolbarbutton image="images/file_save.png"/>
						<toolbarseparator/>
						<toolbarbutton image="images/undo.png"/>
						<toolbarbutton image="images/redo.png"/>
						<toolbarseparator/>
						<toolbarbutton image="images/edit_cut.png" />
						<toolbarbutton image="images/edit_copy.png" />
						<toolbarbutton image="images/edit_paste.png" />
						<toolbarbutton image="images/edit_delete.png" />
					<!--</toolbar>-->
				</hbox>
				<hbox flex="1">
					<textbox id="textarea" flex="1" multiline="true" value="$schema"/>
				</hbox>
EOD;
		if ($this->model->hasOutput()) {
			// there has any output
			$xul .= <<<EOD
				<splitter width="90%"/>
				<listbox flex="1">
					<listcols>
						<listcol flex="1"/>
						<listcol flex="1"/>
						<listcol flex="1"/>
						<listcol flex="1"/>
						<listcol flex="1"/>
					</listcols>
					<listhead allowevents="true">
						<listheader label="field1" />
						<listheader label="field2" />
						<listheader label="field3" />
						<listheader label="field4" />
						<listheader label="field5" />
					</listhead>
					<listitem>
						<listcell label="value1" />
						<listcell label="value2" />
						<listcell label="value3" />
						<listcell label="value4" />
						<listcell label="value5" />
					</listitem>
				</listbox>
EOD;
		} // end if
		return $xul;
	}
}
?>
Return current item: ezSqliteAdmin