Files
aastra-xml-php/php_classes/AastraIPPhoneStatus.class.php
2018-02-15 22:59:05 +01:00

70 lines
2.1 KiB
PHP

<?php
########################################################################################################
# Aastra XML API Classes - AastraIPPhoneStatus
# Copyright Aastra Telecom 2007
#
# AastraIPPhoneStatus object.
#
# Public methods
#
# Inherited from AastraIPPhone
# output() to display the object
# generate() to return the object content
# setBeep() to enable a notification beep with the object (optional)
#
# Specific to the object
# setSession(session) to setup the session ID
# setTriggerDestroyOnExit() to set the triggerDestroyOnExit tag to
# "yes" (optional)
# addEntry(index,message,type,timeout) to add a message to be displayed
# on the idle screen.
#
# Example
# require_once('AastraIPPhoneStatus.class.php');
# $status = new AastraIPPhoneStatus();
# $status->setSession('Session');
# $status->setBeep();
# $status->addEntry('1','Message 1','',0);
# $status->addEntry('2','Message 2','alert',5);
# $status->output();
#
########################################################################################################
require_once('AastraIPPhone.class.php');
require_once('AastraIPPhoneStatusEntry.class.php');
class AastraIPPhoneStatus extends AastraIPPhone {
var $_session;
var $_triggerDestroyOnExit="";
function setSession($session)
{
$this->_session=$session;
}
function setTriggerDestroyOnExit()
{
$this->_triggerDestroyOnExit="yes";
}
function addEntry($index, $message, $type='', $timeout=NULL)
{
$this->_entries[] = new AastraIPPhoneStatusEntry($index, $message, $type, $timeout);
}
function render()
{
$session = $this->escape($this->_session);
$out = "<AastraIPPhoneStatus";
if($this->_beep=='yes') $out .= " Beep=\"yes\"";
if($this->_triggerDestroyOnExit=='yes') $out .= " triggerDestroyOnExit=\"yes\"";
$out .= ">\n";
$out .= "<Session>".$session."</Session>\n";
foreach ($this->_entries as $entry) $out .= $entry->render();
$out .= "</AastraIPPhoneStatus>\n";
return($out);
}
}
?>