141 lines
3.4 KiB
PHP
141 lines
3.4 KiB
PHP
<?php
|
|
|
|
###################################################################################################
|
|
# Aastra XML API Classes - AastraIPPhone
|
|
# Copyright Aastra Telecom 2007
|
|
#
|
|
# AastraIPPhone is the root class for all the Aastra XML objects.
|
|
#
|
|
# Public methods
|
|
# setTitle(Title) to setup the title of an object (optional)
|
|
# setTitleWrap() to set the title to be wrapped on 2 lines (optional)
|
|
# setCancelAction(uri) to set the cancel parameter with the URI to be called on Cancel (optional)
|
|
# setDestroyOnExit() to set DestroyonExit parameter to 'yes', 'no' by default (optional)
|
|
# setBeep() to enable a notification beep with the object (optional)
|
|
# setLockIn() to set the Lock-in tag to 'yes' (optional)
|
|
# setAllowAnswer() to set the allowAnswer tag to 'yes' (optional)
|
|
# setTimeout(timeout) to define a specific timeout for the XML object (optional)
|
|
# addSoftkey(index,label,uri,icon_index) to add custom soktkeys to the object (optional)
|
|
# addIcon(index,icon) to add custom icons to the object (optional)
|
|
# generate() to return the object content
|
|
# output() to display the object
|
|
#
|
|
###################################################################################################
|
|
|
|
require_once('AastraIPPhoneSoftkeyEntry.class.php');
|
|
require_once('AastraIPPhoneIconEntry.class.php');
|
|
|
|
class AastraIPPhone {
|
|
var $_entries;
|
|
var $_softkeys;
|
|
var $_icons;
|
|
var $_title='';
|
|
var $_title_wrap='';
|
|
var $_destroyOnExit='';
|
|
var $_cancelAction='';
|
|
var $_refreshTimeout=0;
|
|
var $_refreshURL='';
|
|
var $_beep='';
|
|
var $_lockin='';
|
|
var $_timeout=0;
|
|
var $_allowAnswer='';
|
|
|
|
function AastraIPPhone()
|
|
{
|
|
$this->_entries = array();
|
|
$this->_softkeys = array();
|
|
$this->_icons = array();
|
|
$this->_title = '';
|
|
$this->_destroyOnExit='';
|
|
$this->_refreshTimeout=0;
|
|
$this->_refreshURL='';
|
|
$this->_beep='';
|
|
$this->_lockin='';
|
|
$this->_timeout=0;
|
|
$this->_allowAnswer='';
|
|
}
|
|
|
|
function setTitle($title)
|
|
{
|
|
$this->_title = $title;
|
|
}
|
|
|
|
function setTitleWrap()
|
|
{
|
|
$this->_title_wrap = "yes";
|
|
}
|
|
|
|
function setRefresh($timeout,$URL)
|
|
{
|
|
$this->_refreshTimeout = $timeout;
|
|
$this->_refreshURL = $URL;
|
|
}
|
|
|
|
function setBeep()
|
|
{
|
|
$this->_beep='yes';
|
|
}
|
|
|
|
function setDestroyOnExit()
|
|
{
|
|
$this->_destroyOnExit='yes';
|
|
}
|
|
|
|
function setCancelAction($cancelAction)
|
|
{
|
|
$this->_cancelAction=$cancelAction;
|
|
}
|
|
|
|
|
|
function setLockIn()
|
|
{
|
|
$this->_lockin='yes';
|
|
}
|
|
|
|
function setTimeout($timeout)
|
|
{
|
|
$this->_timeout=$timeout;
|
|
}
|
|
|
|
function setAllowAnswer()
|
|
{
|
|
$this->_allowAnswer='yes';
|
|
}
|
|
|
|
function output()
|
|
{
|
|
header("Content-type: text/xml");
|
|
if (($this->_refreshTimeout!=0) and ($this->_refreshURL!='')) header("Refresh: ".$this->_refreshTimeout."; url=".$this->_refreshURL);
|
|
$output=$this->render();
|
|
header("Content-Length: ".strlen($output));
|
|
echo($output);
|
|
}
|
|
|
|
function generate()
|
|
{
|
|
$output=$this->render();
|
|
return($output);
|
|
}
|
|
|
|
|
|
function addSoftkey($index, $label, $uri, $icon=NULL)
|
|
{
|
|
$this->_softkeys[] = new AastraIPPhoneSoftkeyEntry($index, $this->escape($label), $this->escape($uri), $icon);
|
|
}
|
|
|
|
function addIcon($index, $icon)
|
|
{
|
|
$this->_icons[] = new AastraIPPhoneIconEntry($index, $icon);
|
|
}
|
|
|
|
function escape($string)
|
|
{
|
|
return(str_replace(
|
|
array('<', '>', '&'),
|
|
array('<', '>', '&'),
|
|
$string
|
|
));
|
|
}
|
|
}
|
|
?>
|