setDestroyOnExit(); # $menu->setDeFaultIndex('3'); # $menu->setLayout('1'); # $menu->setMode('regular'); # $menu->setFontMono('yes'); # $menu->addEntry('http://myserver.com/script.php?choice=1','Value=1','Icon:Alarm','yes'); # $menu->addLine('Line 11','left','red'); # $menu->addLine('Line 12','right','green'); # $menu->addLine('Line 13','center','blue'); # $menu->addEntry('http://myserver.com/script.php?choice=2','Value=2','Icon:AlarmFilled','no'); # $menu->addLine('Line 21','left','red'); # $menu->addLine('Line 22','right','green'); # $menu->addLine('Line 23','center','blue'); # $menu->addSoftkey('1', 'My Select', 'http://myserver.com/script.php?action=1'); # $menu->addSoftkey('6', 'Exit', 'SoftKey:Exit'); # $menu->output(); # ######################################################################################################## require_once('AastraIPPhone.class.php'); require_once('AastraIPPhoneIconMenuEntry.class.php'); class AastraIPPhoneIconMenu extends AastraIPPhone { var $_layout=''; var $_mode=''; var $_defaultIndex=''; var $_style=''; var $_maxitems='24'; var $_fontMono=''; function setLayout($layout) { $this->_layout = $layout; } function setMode($mode) { $this->_mode = $mode; } function setFontMono($fontMono) { $this->_fontMono = $fontMono; } function setDefaultIndex($defaultIndex) { $this->_defaultIndex = $defaultIndex; } function setStyle($style) { $this->_style = $style; } function addEntry($url, $selection=NULL, $icon=NULL, $iconScaled=NULL, $fontMono=NULL, $dial=NULL, $line=NULL) { $this->_entries[] = new AastraIPPhoneIconMenuEntry( $url, $selection, $icon, $iconScaled, $fontMono, $dial, $line ); } function addLine($text, $align=NULL, $color=NULL) { $index=count($this->_entries); if($index>0) { $this->_entries[$index-1]->addLine($text, $align, $color); } } function render() { # Beginning of root tag $out = "_destroyOnExit=='yes') $out .= " destroyOnExit=\"yes\""; # DefaultIndex if ($this->_defaultIndex!="") $out .= " defaultIndex=\"{$this->_defaultIndex}\""; # Layout if ($this->_layout!='') $out .= " layout=\"{$this->_layout}\""; # Mode if ($this->_mode!='') $out .= " mode=\"{$this->_mode}\""; # FontMono if ($this->_fontMono!='') $out .= " fontMono=\"{$this->_fontMono}\""; # 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}\""; } # Timeout if ($this->_timeout!=0) $out .= " Timeout=\"{$this->_timeout}\""; # Background color if ($this->_background_color!='') $out .= " bgColor=\"{$this->_background_color}\""; # Font Monotype if ($this->_fontMono == 'no') $out .= " fontMono=\"no\""; # End of root tag $out .= ">\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; $is_softkeys=Aastra_is_softkeys_supported(); foreach ($this->_entries as $entry) { if($index<$this->_maxitems) $out .= $entry->render(); $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); } } ?>