Line1,1=>Line2,2=>Offset,3=>Char,4=>Mode) # @url string # @selection string (optional) # @icon integer (optional) # @dial string, phone number to dial (optional) # @line integer, SIP line to use (optional) # @color string, "red", "black", ... (optional) # @split integer, position of the split between line 1 and line 2 (optional) # @iconr1 integer (optional) # @iconr2 integer (optional) # @iconr3 integer (optional) # @iconr4 integer (optional) # setScrollUp(uri) to set the URI to be called when the user presses the Up arrow (optional) # @uri string # setScrollDown(uri) to set the URI to be called when the user presses the Down arrow (optional) # @uri string # setUnitScroll() to set the unitScroll tag to yes which changes the scrolling behavior on the 6739i (optional and 6739i only) # natsortbyname() to order the list, must not be use in conjunction with setBase or resetBase # # Example 1 # require_once('AastraIPPhoneTextMenu.class.php'); # $menu = new AastraIPPhoneTextMenu(); # $menu->setTitle('Title'); # $menu->setDestroyOnExit(); # $menu->setDeFaultIndex('3'); # $menu->addEntry('Choice 2', 'http://myserver.com/script.php?choice=2', 'Value=2'); # $menu->addEntry('Choice 1', 'http://myserver.com/script.php?choice=1', 'Value=1'); # $menu->addEntry('Choice 3', 'http://myserver.com/script.php?choice=3', 'Value=3'); # $menu->natsortByName(); # $menu->addSoftkey('1', 'My Select', 'http://myserver.com/script.php?action=1'); # $menu->addSoftkey('6', 'Exit', 'SoftKey:Exit'); # $menu->output(); # # Example 2 # require_once('AastraIPPhoneTextMenu.class.php'); # $menu = new AastraIPPhoneTextMenu(); # $menu->setTitle('Title'); # $menu->setDestroyOnExit(); # $menu->setDeFaultIndex('2'); # $menu->addEntry('Choice 2', 'http://myserver.com/script.php?choice=2', 'Value=2','1'); # $menu->addEntry('Choice 1', 'http://myserver.com/script.php?choice=1', 'Value=1','2'); # $menu->addEntry('Choice 3', 'http://myserver.com/script.php?choice=3', 'Value=3','3'); # $menu->natsortByName(); # $menu->addSoftkey('1', 'My Select', 'http://myserver.com/script.php?action=1'); # $menu->addSoftkey('6', 'Exit', 'SoftKey:Exit'); # $menu->addIcon('1', 'Icon:PhoneOnHook'); # $menu->addIcon('2', 'Icon:PhoneOffHook'); # $menu->addIcon('3', 'Icon:PhoneRinging'); # $menu->output(); # ######################################################################################################## require_once('AastraIPPhone.class.php'); require_once('AastraIPPhoneTextMenuEntry.class.php'); class AastraIPPhoneTextMenu extends AastraIPPhone { var $_defaultIndex=''; var $_style=''; var $_wraplist=''; var $_maxitems='30'; var $_scrollConstrain=''; var $_numberLaunch=''; var $_touchLaunch=''; var $_scrollUp=''; var $_scrollDown=''; var $_unitScroll=''; var $_fontMono=''; function setDefaultIndex($defaultIndex) { $this->_defaultIndex = $defaultIndex; } function setStyle($style) { $this->_style = $style; } function addEntry($name, $url, $selection=NULL, $icon=NULL, $dial=NULL, $line=NULL, $color='', $split=NULL, $iconRight1=NULL, $iconRight2=NULL, $iconRight3=NULL, $iconRight4=NULL) { if(!Aastra_is_icons_supported()) $icon=NULL; $this->_entries[] = new AastraIPPhoneTextMenuEntry( $name, $url, $selection, $icon, $dial, $line, $color, $split, NULL, $iconRight1, $iconRight2, $iconRight3, $iconRight4 ); } function setBase($base) { $this->_entries[] = new AastraIPPhoneTextMenuEntry(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $base); } function resetBase() { $this->_entries[] = new AastraIPPhoneTextMenuEntry(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'AASTRA_RESETBASE'); } function setWrapList() { $this->_wraplist = 'yes'; } function setScrollConstrain() { $this->_scrollConstrain = 'yes'; } function setUnitScroll() { $this->_unitScroll = 'yes'; } function setNumberLaunch() { $this->_numberLaunch = 'yes'; } function setTouchLaunch() { $this->_touchLaunch = 'yes'; } function setNoFontMono() { $this->_fontMono = 'no'; } function setScrollUp($uri) { $this->_scrollUp = $uri; } function setScrollDown($uri) { $this->_scrollDown = $uri; } function natsortByName() { $tmpary = array(); foreach ($this->_entries as $id => $entry) $tmpary[$id] = $entry->getName(); natsort($tmpary); foreach ($tmpary as $id => $name) $newele[] = $this->_entries[$id]; $this->_entries = $newele; } function render() { # Beginning of root tag $out = "_destroyOnExit=='yes') $out .= " destroyOnExit=\"yes\""; # CancelAction if($this->_cancelAction != "") { $cancelAction = $this->escape($this->_cancelAction); $out .= " cancelAction=\"{$cancelAction}\""; } # DefaultIndex if ($this->_defaultIndex!="") $out .= " defaultIndex=\"{$this->_defaultIndex}\""; # Style if ($this->_style!='') $out .= " style=\"{$this->_style}\""; # Beep if ($this->_beep=='yes') $out .= " Beep=\"yes\""; # 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}\""; } # WrapList if ($this->_wraplist=='yes') $out .= " wrapList=\"yes\""; # 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\""; # Timeout if ($this->_timeout!=0) $out .= " Timeout=\"{$this->_timeout}\""; # Background color if ($this->_background_color!='') $out .= " bgColor=\"{$this->_background_color}\""; # Prevent list wrap if ($this->_scrollConstrain == 'yes') $out .= " scrollConstrain=\"yes\""; # Number selection if ($this->_numberLaunch == 'yes') $out .= " numberLaunch=\"yes\""; # Number selection if ($this->_touchLaunch == 'yes') $out .= " touchLaunch=\"yes\""; # Font Monotype if ($this->_fontMono == 'no') $out .= " fontMono=\"no\""; # Scrolls up/down if($this->_scrollUp!='') $out .= " scrollUp=\"".$this->escape($this->_scrollUp)."\""; if($this->_scrollDown!='') $out .= " scrollDown=\"".$this->escape($this->_scrollDown)."\""; # Unit scroll (6739i) if ($this->_unitScroll == 'yes') $out .= " unitScroll=\"yes\""; # 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"; } # Menu items if (isset($this->_entries) && is_array($this->_entries)) { $index=0; $base=NULL; $length=Aastra_size_display_line(); $is_softkeys=Aastra_is_softkeys_supported(); foreach ($this->_entries as $entry) { if($entry->getBase()!=NULL) $base=$entry->getBase(); else { if($base!=NULL) { if($index<$this->_maxitems) $out .= $entry->render($this->_style,$length,$is_softkeys,$base); $base=NULL; } else if($index<$this->_maxitems) $out .= $entry->render($this->_style,$length,$is_softkeys); $index++; } } } # 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); } } ?>