Location: PHPKode > projects > Itshomi PHP Framework > itshomi/components/configurator/ParseXmlEvents.php
<?php
error_log("path:".$this->path);
include_once($this->path."/utils/WgDomParser.php");

class ParseXmlEvents extends WgDomParser{
	private $fileParsed = false;
	function __construct(){
		
	}
	
	function parseEvents($filename){ error_log("xml fname:".$filename);
		$this->fileParsed = $this->parseFile($filename,"menu");
	}
	
	function install($navigator){ 
		$menu_attrs = array("component","event","wfid");
		if($this->fileParsed){
			$menues = $this->getElementsByTagName("listener");
			$db = $navigator->getInstance("dbtable");
			$db->useTable("workflow");
			$db->delRows();
			foreach($menues as $menuitem){
				$names = array();$values = array();
				foreach($menu_attrs as $attrname){
					if(strlen($menuitem->getAttribute($attrname))==0 && !($attrname=="url" || $attrname=="title" || $attrname=="event")){
						throw new Exception("No value specified for non null menu attribute ".$attrname);
					}else{ 
						$names[count($names)]=$attrname;
						if($attrname!="access_level")
							$values[count($values)]="'".$menuitem->getAttribute($attrname)."'";
						else	
							$values[count($values)]=$menuitem->getAttribute($attrname);
					}
				}
				if(!$db->addRow($names,$values))
					throw new Exception("Failed to map parameters while installing menu with ".$names[0]." = ".$values[0]);
			}
		}
	}
}
?>
Return current item: Itshomi PHP Framework