Location: PHPKode > scripts > PHP Voice > php-voice/ccxml.class.php
<?php

/**
 * gonx_ccxml class : 
 * 
 * @package GONX
 * @author Ben Yacoub Hatem <hide@address.com>
 * @copyright Copyright (c) 2004
 * @version $Id: ccxml.class.php,v 1.3 2004/11/05 07:59:42 hatemben Exp $ - 2004-10-25 11:34:40 - ccxml.class.php
 * @generator dtd2php version 1.0.1
 * @access public
 **/
class gonx_ccxml{
	/**
     * Constructor
     * @access protected
     */
	function gonx_ccxml(){
		$this->_document = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
	}

	var $_document;

	/*
	* Open  ccxml tag.
	*/
	function start_ccxml()
	{
		$this->_document .= "<ccxml>\n";
	}
	
	/*
	* Close  ccxml tag.
	*
	*/
	function end_ccxml()
	{
		$this->_document .= "</ccxml>\n";
	}

	/*
	* Create  accept tag.
	*/
	function start_accept()
	{
		$this->_document .= "<accept />\n";
	}

	/*
	* Create  cancel tag.
	*/
	function start_cancel()
	{
		$this->_document .= "<cancel />\n";
	}

	/*
	* Create  assign tag.
	*/
	function start_assign()
	{
		$this->_document .= "<assign />\n";
	}

	/*
	* Create  createcall tag.
	*/
	function start_createcall()
	{
		$this->_document .= "<createcall />\n";
	}

	/*
	* Create  createccxml tag.
	*/
	function start_createccxml()
	{
		$this->_document .= "<createccxml />\n";
	}

	/*
	* Create  createconference tag.
	*/
	function start_createconference()
	{
		$this->_document .= "<createconference />\n";
	}

	/*
	* Create  destroyconference tag.
	*/
	function start_destroyconference()
	{
		$this->_document .= "<destroyconference />\n";
	}

	/*
	* Open  dialogprepare tag.
	*
	* @param	connectionid
	* @param	conferencid
	* @param	src	this variable is required
	* @param	type
	* @param	namelist
	* @param	dialogid

	*/
	function start_dialogprepare($connectionid = "", $conferencid = "", $src = "", $type = "", $namelist = "", $dialogid = "")
	{
		$resu = '<dialogprepare';

		if ((isset($connectionid)) and ($connectionid!=="")){
			$resu .= ' connectionid="'.$connectionid.'"';
		}
		if ((isset($conferencid)) and ($conferencid!=="")){
			$resu .= ' conferencid="'.$conferencid.'"';
		}
		if ((isset($src)) and ($src!=="")){
			$resu .= ' src="'.$src.'"';
		} else {
			$resu .= ' <!-- Error occured in dialogprepare. Need to pass "src"=... -->';
		}

		if ((isset($type)) and ($type!=="")){
			$resu .= ' type="'.$type.'"';
		}
		if ((isset($namelist)) and ($namelist!=="")){
			$resu .= ' namelist="'.$namelist.'"';
		}
		if ((isset($dialogid)) and ($dialogid!=="")){
			$resu .= ' dialogid="'.$dialogid.'"';
		}
		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  dialogprepare tag.
	*
	*/
	function end_dialogprepare()
	{
		$this->_document .= "</dialogprepare>\n";
	}

	/*
	* Create  dialogstart tag.
	*/
	function start_dialogstart()
	{
		$this->_document .= "<dialogstart />\n";
	}

	/*
	* Create  dialogterminate tag.
	*/
	function start_dialogterminate()
	{
		$this->_document .= "<dialogterminate />\n";
	}

	/*
	* Create  disconnect tag.
	*/
	function start_disconnect()
	{
		$this->_document .= "<disconnect />\n";
	}

	/*
	* Create  else tag.
	*/
	function start_else()
	{
		$this->_document .= "<else />\n";
	}

	/*
	* Create  elseif tag.
	*/
	function start_elseif()
	{
		$this->_document .= "<elseif />\n";
	}

	/*
	* Open  eventprocesser tag.
	*/
	function start_eventprocesser()
	{
		$this->_document .= "<eventprocesser>\n";
	}
	
	/*
	* Close  eventprocesser tag.
	*
	*/
	function end_eventprocesser()
	{
		$this->_document .= "</eventprocesser>\n";
	}

	/*
	* Create  fetch tag.
	*/
	function start_fetch()
	{
		$this->_document .= "<fetch />\n";
	}

	/*
	* Create  goto tag.
	*/
	function start_goto()
	{
		$this->_document .= "<goto />\n";
	}

	/*
	* Open  if tag.
	*/
	function start_if()
	{
		$this->_document .= "<if>\n";
	}
	
	/*
	* Close  if tag.
	*
	*/
	function end_if()
	{
		$this->_document .= "</if>\n";
	}

	/*
	* Create  join tag.
	*/
	function start_join()
	{
		$this->_document .= "<join />\n";
	}

	/*
	* Create  log tag.
	*/
	function start_log()
	{
		$this->_document .= "<log />\n";
	}

	/*
	* Create  move tag.
	*/
	function start_move()
	{
		$this->_document .= "<move />\n";
	}

	/*
	* Create  redirect tag.
	*/
	function start_redirect()
	{
		$this->_document .= "<redirect />\n";
	}

	/*
	* Create  reject tag.
	*/
	function start_reject()
	{
		$this->_document .= "<reject />\n";
	}

	/*
	* Open  script tag.
	*/
	function start_script()
	{
		$this->_document .= "<script>\n";
	}
	
	/*
	* Close  script tag.
	*
	*/
	function end_script()
	{
		$this->_document .= "</script>\n";
	}

	/*
	* Create  send tag.
	*/
	function start_send()
	{
		$this->_document .= "<send />\n";
	}

	/*
	* Open  transition tag.
	*/
	function start_transition()
	{
		$this->_document .= "<transition>\n";
	}
	
	/*
	* Close  transition tag.
	*
	*/
	function end_transition()
	{
		$this->_document .= "</transition>\n";
	}

	/*
	* Create  unjoin tag.
	*/
	function start_unjoin()
	{
		$this->_document .= "<unjoin />\n";
	}

	/*
	* Create  var tag.
	*/
	function start_var()
	{
		$this->_document .= "<var />\n";
	}

	/*
	* Create  meta tag.
	*/
	function start_meta()
	{
		$this->_document .= "<meta />\n";
	}

	/*
	* Create  exit tag.
	*/
	function start_exit()
	{
		$this->_document .= "<exit />\n";
	}

   /*
	* 
	* Load a ccxml Module to extends class funtionnalities.
	* 
	*/
	function load($module,$params)
	{
		
		if (ereg('::',$module)) {
			$d = explode('::',$module);
			$module = $d[0];
			$method = $d[1];
		}
		
		// Usage of absolute path to library
		if (ereg('WIN',PHP_OS)) {
			$path = explode('\\', __FILE__);
		} else $path = explode('/', __FILE__);
		array_pop($path) ;
		$path = implode('/',$path);
		
		if (is_file("$path/ccxml_mods/{$module}.class.php")) {
			
			require_once("$path/ccxml_mods/$module.class.php");

			$m = new $module($this,$params);
			if (isset($method)) {
				$m->$method($params);
			}
			
		}
	}
	
	/*
	* 
	* Echo generated  ccxml application to user.
	* 
	*/
	function generate()
	{
		echo $this->_document;
	}
 
}

?>
Return current item: PHP Voice