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

104 lines
3.5 KiB
PHP

<?
########################################################################################################
# Aastra XML API Classes - AastraIPPhoneTextScreen
# Copyright Aastra Telecom 2007
#
# AastraIPPhoneTextScreen object.
#
# Public methods
#
# Inherited from AastraIPPhone
# setTitle(Title) to setup the title of an object (optional)
# setTitleWrap() to set the title to be wrapped on 2 lines (optional)
# setDestroyOnExit() to set DestroyonExit parameter to 'yes', 'no' by default (optional)
# setCancelAction(uri) to set the cancel parameter with the URI to be called on Cancel (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,iconindex) to add custom softkeys to the object (optional)
# addIcon(index,icon) to add custom icons to the object (optional)
# setRefresh(timeout,URL) to add Refresh parameters to the object (optional)
# generate() to return the object content
# output() to display the object
#
# Specific to the object
# setText(text) to set the text to be displayed.
# setDoneAction(uri) to set the URI to be called when the user selects the default "Done" key (optional)
#
# Example
# require_once('AastraIPPhoneTextScreen.class.php');
# $text = new AastraIPPhoneTextScreen();
# $text->setTitle('Title');
# $text->setText('Text to be displayed.');
# $text->setDestroyOnExit();
# $text->addSoftkey('1', 'Mail', 'http://myserver.com/script.php?action=1','1');
# $text->addSoftkey('6', 'Exit', 'SoftKey:Exit');
# $text->addIcon('1', 'Icon:Envelope');
# $text->output();
#
########################################################################################################
require_once('AastraIPPhone.class.php');
class AastraIPPhoneTextScreen extends AastraIPPhone {
var $_text;
var $_doneAction="";
function setText($text)
{
$this->_text = $text;
}
function setDoneAction($uri)
{
$this->_doneAction = $uri;
}
function render()
{
$title = $this->escape($this->_title);
$text = $this->escape($this->_text);
$out = '';
$out .= "<AastraIPPhoneTextScreen";
if($this->_destroyOnExit == 'yes') $out .= " destroyOnExit=\"yes\"";
if($this->_cancelAction != "")
{
$cancelAction = $this->escape($this->_cancelAction);
$out .= " cancelAction=\"{$cancelAction}\"";
}
if($this->_doneAction != "")
{
$doneAction = $this->escape($this->_doneAction);
$out .= " doneAction=\"{$doneAction}\"";
}
if($this->_beep=='yes') $out .= " Beep=\"yes\"";
if($this->_allowAnswer == 'yes') $out .= " allowAnswer=\"yes\"";
$out .= ">\n";
if ($this->_title!='')
{
$title = $this->escape($this->_title);
$out .= "<Title";
if ($this->_title_wrap=='yes') $out .= " wrap=\"yes\"";
$out .= ">".$title."</Title>\n";
}
$out .= "<Text>{$text}</Text>\n";
foreach ($this->_softkeys as $softkey) $out .= $softkey->render();
$IconList=0;
foreach ($this->_icons as $icon)
{
if($IconList==0)
{
$out .= "<IconList>\n";
$IconList=1;
}
$out .= $icon->render();
}
if($IconList!=0) $out .= "</IconList>\n";
$out .= "</AastraIPPhoneTextScreen>\n";
return $out;
}
}
?>