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'); require_once('AastraIPPhoneTextScreenEntry.class.php'); class AastraIPPhoneTextScreen extends AastraIPPhone { var $_doneAction=''; var $_allowDTMF=''; var $_scrollUp=''; var $_scrollDown=''; var $_scrollLeft=''; var $_scrollRight=''; var $_dialNumber=''; var $_dialLine=''; function setDoneAction($uri) { $this->_doneAction = $uri; } function setScrollUp($uri) { $this->_scrollUp = $uri; } function setScrollDown($uri) { $this->_scrollDown = $uri; } function setScrollLeft($uri) { $this->_scrollLeft = $uri; } function setScrollRight($uri) { $this->_scrollRight = $uri; } function setAllowDTMF() { $this->_allowDTMF = 'yes'; } function addEntry($text, $color='') { $this->_entries[] = new AastraIPPhoneTextScreenEntry($text, $color); } function setText($text,$color='') { $pieces=explode("\n",$text); foreach($pieces as $key=>$value) { $this->_entries[] = new AastraIPPhoneTextScreenEntry($value, $color); } } function setDial($dialNumber,$dialLine='') { $this->_dialNumber = $dialNumber; $this->_dialLine = $dialLine; } function render() { # Beginning of root tag $out = "_destroyOnExit == 'yes') $out .= " destroyOnExit=\"yes\""; # CancelAction if($this->_cancelAction != "") { $cancelAction = $this->escape($this->_cancelAction); $out .= " cancelAction=\"{$cancelAction}\""; } # DoneAction if($this->_doneAction != "") { $doneAction = $this->escape($this->_doneAction); $out .= " doneAction=\"{$doneAction}\""; } # Beep if ($this->_beep=='yes') $out .= " Beep=\"yes\""; # TimeOut if ($this->_timeout!=0) $out .= " Timeout=\"{$this->_timeout}\""; # Background color if ($this->_background_color!='') $out .= " bgColor=\"{$this->_background_color}\""; # Lockin if($this->_lockin!='') { $out .= " LockIn=\"{$this->_lockin}\""; if($this->_lockin_uri!='') $out .= " GoodbyeLockInURI=\"".$this->escape($this->_lockin_uri)."\""; } # Call Protection if($this->_callprotection!='') { $out .= " CallProtection=\"{$this->_callprotection}\""; } # AllowAnswer if ($this->_allowAnswer == 'yes') $out .= " allowAnswer=\"yes\""; # AllowDrop if ($this->_allowDrop == 'yes') $out .= " allowDrop=\"yes\""; # AllowXfer if ($this->_allowXfer == 'yes') $out .= " allowXfer=\"yes\""; # AllowConf if ($this->_allowConf == 'yes') $out .= " allowConf=\"yes\""; # AllowDTMF if ($this->_allowDTMF=='yes') $out .= " allowDTMF=\"yes\""; # Scrolls up/down/left/right if($this->_scrollUp!='') $out .= " scrollUp=\"".$this->escape($this->_scrollUp)."\""; if($this->_scrollDown!='') $out .= " scrollDown=\"".$this->escape($this->_scrollDown)."\""; if($this->_scrollLeft!='') $out .= " scrollLeft=\"".$this->escape($this->_scrollLeft)."\""; if($this->_scrollRight!='') $out .= " scrollRight=\"".$this->escape($this->_scrollRight)."\""; # End of root tag $out .= ">\n"; # Title if ($this->_title!='') { $title = $this->escape($this->_title); $out .= "_title_wrap=='yes') $out .= " wrap=\"yes\""; if ($this->_title_color!='') $out .= " Color=\"{$this->_title_color}\""; $out .= ">".$title."\n"; } # Top Title if ($this->_toptitle!='') { $toptitle = $this->escape($this->_toptitle); $out .= "_toptitle_icon!='') $out .= " icon=\"{$this->_toptitle_icon}\""; if ($this->_toptitle_color!='') $out .= " Color=\"{$this->_toptitle_color}\""; $out .= ">".$toptitle."\n"; } # Text Items if (isset($this->_entries) && is_array($this->_entries)) { foreach ($this->_entries as $entry) $out .= $entry->render(); } # Dial if ($this->_dialNumber!='') { $dialNumber = $this->escape($this->_dialNumber); $out .= "_dialLine!='') $out .= " line=\"{$this->_dialLine}\""; $out .= ">".$dialNumber."\n"; } # Softkeys if (isset($this->_softkeys) && is_array($this->_softkeys)) { foreach ($this->_softkeys as $softkey) $out .= $softkey->render(); } # Icons if (isset($this->_icons) && is_array($this->_icons)) { $IconList=False; foreach ($this->_icons as $icon) { if(!$IconList) { $out .= "\n"; $IconList=True; } $out .= $icon->render(); } if($IconList) $out .= "\n"; } # End tag $out .= "\n"; # Return XML object return $out; } } ?>