Location: PHPKode > projects > ZZ/OSS Installer > zic-1.1.0dev1/installer/lib/ZZOSS_Installer/ConfigInput.php
<?php   
    /*
    Copyright (C) 2001-2004 ZZOSS GbR, http://www.zzoss.com

    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.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    */
    
    /**
    @version $Id: ConfigInput.php,v 1.4 2004/04/06 19:11:57 ordnas Exp $
    @copyright Copyright &copy; 2001-2004 ZZ/OSS GbR, http://www.zzoss.com
    @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
    */

	require_once 'XML/Parser.php';
	
class ZZOSS_InstallerConfigInput extends XML_Parser
{
	var $output;
	
	// turn off case folding  
	var $folding = false;

	/**  
	 * Constructor  
	 * Instantiates PEAR XML_Parser class.  
	 */  
	function ZZOSS_InstallerConfigInput()  
	{  
		$this->XML_Parser();
		$this->setMode('event');
		// initialise widget class of installer
		include_once 'ZZOSS_Installer/Widget.php';
		global $zi_errors;
		$this->widget = new ZZOSS_InstallerWidget;
		$this->widget->setErrors($zi_errors);
	}
	
	function startHandler($xp, $element, $attribs = array())
	{
		//echo $element;
		if($element == "widget"){
            
            // check if a certain mode must be met 
            if(isset($attribs['mode']) && strlen($attribs['mode'])){
                $modes = explode('|',$attribs['mode']);
                //echo $attribs['variable'];
                //print_r($modes);
                if(!in_array($GLOBALS['ZI']['mode'], $modes)){
                    // check if it's a widget for developing the installer itself
                    // which we should display
                    if($GLOBALS['ZI']['installer_dev']){
                        if(!in_array('dev_inst', $modes)){
                            return false;
                        }
                    } else {
                        return false;
                    }
                }
            }
            
            // check if a certain mode is not allowed 
            if(isset($attribs['not_mode']) && strlen($attribs['not_mode'])){
                $modes = explode('|',$attribs['not_mode']);
                //echo $attribs['variable'];
                //print_r($modes);
                if(in_array($GLOBALS['ZI']['mode'], $modes)){
                    return false;
                } else {
                    // check if it's a widget for developing the installer itself
                    // which we are not supposed to display
                    if($GLOBALS['ZI']['installer_dev']){
                        if(in_array('dev_inst', $modes)){
                            return false;
                        }
                    } else {
                        return false;
                    }
                }
            }
			
            if(!isset($attribs['label'])){
                $attribs['label'] = null;
            }
            
			// set default value?
			if(isset($attribs['default'])){
				$this->widget->setDefault(
											$attribs['variable'],
											$attribs['default']
											);
			}
			// initialise widget
			$options = $attribs;

			echo $this->widget->add(
											$attribs['name'],
											$attribs['label'],
											$attribs['variable'],
											$options
											);
		}
	}
}	
?>
Return current item: ZZ/OSS Installer