Location: PHPKode > scripts > ezSqliteAdmin > ezsqliteadmin/DbtreeManageView.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: DbtreeManageView.php,v 1.3 2004/09/18 09:30:02 wenlong Exp $
//
require_once('DbtreeManageModel.php');
/**
* DbtreeManageView
*
* @package		ezSqliteAdmin
* @version		$Revision: 1.3 $
* @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 DbtreeManageView extends AView implements IView {
	/**
	* contains DbtreeManageModel class
	*
	* @access	private
	* @var		object
	*/
	private $model = null;

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

	function buildListItem() {
		$list = $this->model->getDbtreeList();
		$xul = '';
		foreach ($list as $row) {
			$xul .= '<listitem>';
			$xul .= '<listcell label="'. $row['alias'] .'" />';
			$xul .= '<listcell label="'. $row['path'] .'" />';
			$xul .= '</listitem>';
		}
		return $xul;
	}

	/**
	* Prepare XUL for output
	*
	* @access	public
	* @return	string		XUL
	*/
	public function render() {
		$xul = <<<EOD
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window
    id="DbtreeManageDialog"
    name="DbtreeManageDialog"
    title="Database Manager"
    xmlns:html="http://www.w3.org/1999/xhtml"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hbox flex="1">
	<groupbox flex="1">
		<caption label="Databases" />
		<listbox flex="1">
			<listcols>
				<listcol flex="1"/>
				<listcol/>
			</listcols>
			<listhead allowevents="true">
				<listheader label="Alias" />
				<listheader label="Database" />
			</listhead>
EOD;
		$xul .= $this->buildListItem();
		$xul .= <<< EOD
		</listbox>
	</groupbox>
	<vbox>
		<button label="Add" onclick=""/>
		<button label="Edit" onclick=""/>
		<button label="Delete" onclick=""/>
		<button label="Close" onclick="window.close();" default="true"/>
	</vbox>
</hbox>
</window>

EOD;
		return $xul;
	}
}
?>
Return current item: ezSqliteAdmin