$menu->addEntry('Choice 4', 'http://myserver.com/script.php?choice=4', 'Value=4'); $menu->addEntry('Choice 5', 'http://myserver.com/script.php?choice=5', 'Value=5'); $menu->addEntry('Choice 6', 'http://myserver.com/script.php?choice=6', 'Value=6'); $menu->addEntry('Choice 7', 'http://myserver.com/script.php?choice=7', 'Value=7'); $menu->natsortByName(); $menu->addSoftkey('1', 'My Select', 'http://myserver.com/script.php?action=1'); $menu->addSoftkey('10', 'Done', 'SoftKey:Exit'); $menu->output(); break; case 'textmenu2': 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('9', 'Back', $XML_SERVER); $menu->addSoftkey('10', 'Exit', 'SoftKey:Exit'); $menu->output(); break; case 'textscreen': require_once 'AastraIPPhoneTextScreen.class.php'; $text = new AastraIPPhoneTextScreen(); $text->setTitle('Title'); $text->setText('The screen object can be implemented similar to the firmware info screen.'); $text->setDestroyOnExit(); $text->addSoftkey('1', 'Mail', 'http://myserver.com/script.php?action=1');
break; # Display favorites # Display favorites case 'favorites': # Save last request if ($input != '') { $data['favorites'][$selection]['target'] = $input; Aastra_save_user_context($user, 'currency', $data); } # Create list $object = new AastraIPPhoneTextMenu(); $summary = False; $object->setTitle(Aastra_get_label('Watch List', $language)); for ($i = 0; $i < AASTRA_MAXLINES; $i++) { if ($data['favorites'][$i]['source'] == '' or $data['favorites'][$i]['target'] == '') { $object->addEntry('...........................', $XML_SERVER . '&action=inputfav1&selection=' . $i, $i); $data['favorites'][$i]['source'] = ''; $data['favorites'][$i]['target'] = ''; } else { $object->addEntry(sprintf(Aastra_get_label('%s to %s', $language), $data['favorites'][$i]['source'], $data['favorites'][$i]['target']), $XML_SERVER . '&action=displayfav&selection=' . $i, $i); $summary = True; } } # Update user favorites Aastra_save_user_context($user, 'currency', $data); # Set default index if ($default != '') { $object->setDefaultIndex($default); } # Add softkeys if ($nb_softkeys == 6) {
if ($last != 1) { $object->setTitle(sprintf(Aastra_get_label('Msg Forward (%s/%s)', $language), $dpage, $last)); } else { $object->setTitle(Aastra_get_label('Message Forward', $language)); } $index = 1; $rank = 1; $submit = False; # Display items foreach ($directory as $key => $value) { if ($index >= ($dpage - 1) * $MaxLines + 1 and $index <= $dpage * $MaxLines) { if ($value['select']) { $submit = True; } if ($value['select']) { $object->addEntry('X ' . $value['name'], $XML_SERVER . '&action=dselect&msg=' . $msg . '&dpage=' . $dpage . '&dindex=' . $key); } else { $object->addEntry('_ ' . $value['name'], $XML_SERVER . '&action=dselect&msg=' . $msg . '&dpage=' . $dpage . '&dindex=' . $key); } if ($key == $dindex) { $object->setDefaultIndex($rank); } $rank++; } $index++; } # Actions if ($dpage != $last) { $object->addEntry(Aastra_get_label('Next Page', $language), $XML_SERVER . '&action=forward2&msg=' . $msg . '&dpage=' . ($dpage + 1)); } $object->addEntry(Aastra_get_label('Reverse Select.', $language), $XML_SERVER . '&action=reverse&msg=' . $msg . '&dpage=' . $dpage);
} else { $object->addEntry($XML_SERVER . '&action=dial&value=' . $park[0][0]); } } else { # Display the queue require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); if (Aastra_is_style_textmenu_supported()) { $object->setStyle('none'); } $object->setTitle(Aastra_get_label('Parked Calls', $language)); if (Aastra_is_softkeys_supported()) { if (Aastra_is_dialuri_supported()) { for ($index = 0; $index < $count; $index++) { $object->addEntry(sprintf('%s-%s', $park[$index][0], $park[$index][1]), 'Dial:' . $park[$index][0], $park[$index][0], '', $park[$index][0]); } $object->addSoftkey(1, Aastra_get_label('Pickup', $language), 'SoftKey:Select'); } else { if (Aastra_is_dialkey_supported()) { for ($index = 0; $index < $count; $index++) { $object->addEntry(sprintf('%s-%s', $park[$index][0], $park[$index][1]), $park[$index][0], $park[$index][0]); } $object->addSoftkey(1, Aastra_get_label('Pickup', $language), 'SoftKey:Dial'); } else { for ($index = 0; $index < $count; $index++) { $object->addEntry(sprintf('%s-%s', $park[$index][0], $park[$index][1]), $XML_SERVER . '&action=dial&value=' . $park[$index][0], $park[$index][0]); } $object->addSoftkey(1, Aastra_get_label('Pickup', $language), 'SoftKey:Select'); } }
} # Display menu $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $title = Aastra_get_label('Add Application', $language); if ($last != 1) { $title .= ' (' . $menu_page . '/' . $last . ')'; } $object->setTitle($title); if ($is_style_textmenu) { $object->setStyle('none'); } $index = 0; foreach ($all as $key => $value) { if ($index >= ($menu_page2 - 1) * $MaxLines and $index < $menu_page2 * $MaxLines) { $object->addEntry($value['title'], $XML_SERVER . '&menu_action=update&selection=' . $key . '&menu_page2=' . $menu_page2, $key); } $index++; } # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Add', $language), 'SoftKey:Select'); if ($menu_page2 != 1) { $object->addSoftkey('2', Aastra_get_label('Previous', $language), $XML_SERVER . '&menu_action=add&menu_page2=' . ($menu_page2 - 1)); } if ($menu_page2 != $last) { $object->addSoftkey('5', Aastra_get_label('Next', $language), $XML_SERVER . '&menu_action=add&menu_page2=' . ($menu_page2 + 1)); } $object->addSoftkey('3', Aastra_get_label('Details', $language), $XML_SERVER . '&menu_action=details&menu_page2=' . $menu_page2); $object->addSoftkey('4', Aastra_get_label('Back', $language), $XML_SERVER . '&menu_page=' . $menu_page);
$icon = ''; $protected = ' '; if ($value['password'] != '') { if ($is_icons) { $icon = '1'; } else { $protected = '*'; } } else { if ($is_icons) { $icon = '2'; } else { $protected = '-'; } } $object->addEntry($protected . $display, $XML_SERVER . '&action=change&index=' . $i, '&index=' . $i, $icon); } # Default position if ($index != '') { $object->setDefaultIndex($index + 1); } # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { # Regular phone $object->addSoftkey('1', Aastra_get_label('Toggle', $language), 'SoftKey:Select'); if ($day == 1) { $object->addSoftkey('2', Aastra_get_label('All DAY', $language), $XML_SERVER . '&action=day'); } if ($night == 1) { $object->addSoftkey('3', Aastra_get_label('All NIGHT', $language), $XML_SERVER . '&action=night');
$array_rss = Aastra_readINIfile($file_name, '#', '='); if (empty($index)) { # Reguler phone? if ($nb_softkeys < 7) { # Display list $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); if (Aastra_is_style_textmenu_supported()) { $object->setStyle('radio'); } # Title $object->setTitle($array_rss[99]['title']); # Display topics foreach ($array_rss as $key => $value) { if ($key != '99') { $object->addEntry($value['title'], $value['uri'] . '&user='******'1', Aastra_get_label('Select', $language), 'SoftKey:Select'); $object->addSoftkey('5', Aastra_get_label('Back', $language), $XML_SERVER); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } } else { # Display first item $object = new AastraIPPhoneExecute(); $object->addEntry($XML_SERVER . '&zip=' . $zip . '&index=1'); } } else { # shift $index
$object->addSoftkey('1', Aastra_get_label('Change', $language), $XML_SERVER . '&action=' . $change); $object->addSoftkey('2', Aastra_get_label('Deactivate', $language), $XML_SERVER . '&action=cancel'); } if ($nb_softkeys == 6) { $object->addSoftkey('3', Aastra_get_label('My Numbers', $language), $XML_SERVER . '&action=info'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('6', Aastra_get_label('My Numbers', $language), $XML_SERVER . '&action=info'); $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } } else { # TextMenu for non softkey phone require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); if ($cf == '') { $object->setTitle(Aastra_get_label('CFWD deactivated', $language)); $object->addEntry(Aastra_get_label('Activate', $language), $XML_SERVER . '&action=' . $change); } else { $object->setTitle(sprintf(Aastra_get_label('CFWD set (%s)', $language), $cf)); $object->addEntry(Aastra_get_label('Deactivate', $language), $XML_SERVER . '&action=cancel'); $object->addEntry(Aastra_get_label('Change', $language), $XML_SERVER . '&action=' . $change); } $object->addEntry(Aastra_get_label('My numbers', $language), $XML_SERVER . '&action=info'); $object->addEntry(Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } break; } # Display answer $object->output(); exit;
# Depending on action switch ($action) { # Language Selection case 'language': # Associated labels $array_lang = array('en' => Aastra_get_label('English', $language), 'fr' => Aastra_get_label('French (Europe)', $language), 'fr_ca' => Aastra_get_label('French (Canada)', $language), 'de' => Aastra_get_label('German', $language), 'it' => Aastra_get_label('Italian', $language), 'es' => Aastra_get_label('Spanish (Europe)', $language), 'es_mx' => Aastra_get_label('Spanish (Mexico)', $language), 'pt' => Aastra_get_label('Portuguese (Europe)', $language), 'pt_br' => Aastra_get_label('Portuguese (Brazil)', $language)); # Create TextMenu $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); if (Aastra_is_lockin_supported()) { $object->setLockIn(); } $object->setTitle(Aastra_get_label('Select Language', $language)); $index = 1; foreach ($code[1] as $key => $value) { $object->addEntry($array_lang[$value], $XML_SERVER . '&action=input&lang=' . $value . '&cl=' . $key); if ($key == $code[2]) { $object->setDefaultIndex($index); } $index++; } if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select'); $object->addSoftkey('6', Aastra_get_label('Cancel', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('6', Aastra_get_label('Cancel', $language), 'SoftKey:Exit'); } } break; # Input data
} else { $name = $value[2]; } $icon = ''; if ($value[3]) { if (!$is_icons) { $name = '(' . $name . ')'; } else { $icon = 2; } } else { if ($is_icons) { $icon = 1; } } $object->addEntry($name, $XML_SERVER . '&action=refresh&page=' . $page . '&confno=' . $confno . '&mode=' . $mode, $new_selection . '&user_id=' . $value[0], $icon); $new_selection++; } $index++; } # Timeout $object->setTimeout('120'); # Default value if (isset($selection)) { $object->setDefaultIndex($selection); } # Icons if ($is_icons) { if (Aastra_phone_type() != 5) { $object->addIcon('1', Aastra_get_custom_icon('Speaker')); $object->addIcon('2', Aastra_get_custom_icon('Muted'));
if ($last == '1') { $object->setTitle($Title[$index]); } else { $object->setTitle(sprintf($Title[$index] . ' (%d/%d)', $page, $last)); } if (Aastra_is_style_textmenu_supported()) { $object->setStyle('radio'); } if (Aastra_is_textmenu_wrapitem_supported()) { $object->setWrapList(); } if (Aastra_is_wrap_title_supported()) { $object->setTitleWrap(); } if (!Aastra_is_softkeys_supported() and $page != 1) { $object->addEntry(Aastra_get_label('Previous Page', $language), $XML_SERVER . '&index=' . ($index + 1) . '&page=' . ($page - 1)); } $i = 1; foreach ($array_rss as $key => $value) { if ($i >= ($page - 1) * $MaxLines + 1 and $i <= $page * $MaxLines) { $object->addEntry($value['title'], $value['uri'] . '&set=' . $set); } $i++; } if (Aastra_is_softkeys_supported()) { if (Aastra_number_softkeys_supported() < 7) { $object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select'); if ($page != 1) { $object->addSoftkey('2', Aastra_get_label('Previous', $language), $XML_SERVER . '&index=' . ($index + 1) . '&page=' . ($page - 1)); } if ($page != $last) {
$object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); if (Aastra_is_textmenu_wrapitem_supported()) { $object->setWrapList(); } if ($last == 1) { $object->setTitle(Aastra_get_label('ACD Queues', $language)); } else { $object->setTitle(sprintf(Aastra_get_label('ACD Queues (%d/%d)', $language), $page, $last)); } if (Aastra_is_style_textmenu_supported()) { $object->setStyle('none'); } # Previous page for non softkey phones if (!$nb_softkeys and $page != 1) { $object->addEntry(Aastra_get_label('Previous Page', $language), $XML_SERVER . '&action=show_queues_page&page=' . ($page - 1)); } # Display list of queues $index = 1; $logoff_all = False; $pause = False; $pause_all = False; $unpause_all = False; foreach ($queues as $value) { # Compute extra keys if (!$logoff_all and $agents[$value['Queue']]['Status'] > 0 and $agents[$value['Queue']]['Membership'] != 'static') { $logoff_all = True; } if (!$pause and $agents[$value['Queue']]['Status'] > 0) { $pause = True; }
if ($AA_PRESENCE_STATE) { if ($v['status'] == AA_PRESENCE_AVAILABLE) { if ($v['hint'] == 'Idle') { $icon = '1'; } else { if ($v['hint'] == 'Ringing') { $icon = '3'; } else { $icon = '4'; } } } else { $icon = '2'; } } $object->addEntry($name, 'Dial:' . $v['number'], $v['number'], $icon, $v['number']); $rank++; $max = substr($v['name'], 0, 2); } $index++; } # Title if ($lookup == '') { if ($last != 1) { $object->setTitle(sprintf(Aastra_get_label('Directory (%s-%s)', $language), $min, $max)); } else { $object->setTitle(Aastra_get_label('Directory', $language)); } } else { if ($last != 1) { $object->setTitle(sprintf(Aastra_get_label('Results (%s-%s)', $language), $min, $max));
switch ($action) { # Settings case 'settings': # Display selection require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setTitle(Aastra_get_label('Settings', $LANGUAGE)); if ($is_style_textmenu) { $object->setStyle('none'); } if ($index != '') { $object->setDefaultIndex($index); } $text = array('firstlast' => Aastra_get_label('First Last', $LANGUAGE), 'lastfirst' => Aastra_get_label('Last First', $LANGUAGE)); $object->addEntry(sprintf(Aastra_get_label('Display: %s', $LANGUAGE), $text[$ARRAY_USER['display']]), $XML_SERVER . '&action=set_display', ''); $text = array('last' => Aastra_get_label('Last Name', $LANGUAGE), 'first' => Aastra_get_label('First Name', $LANGUAGE)); $object->addEntry(sprintf(Aastra_get_label('Sort: %s', $LANGUAGE), $text[$ARRAY_USER['sort']]), $XML_SERVER . '&action=set_sort', ''); # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Change', $LANGUAGE), 'SoftKey:Select'); $object->addSoftkey('4', Aastra_get_label('Back', $LANGUAGE), $XML_SERVER . '&action=input'); $object->addSoftkey('6', Aastra_get_label('Exit', $LANGUAGE), 'SoftKey:Exit'); } else { $object->addSoftkey('9', Aastra_get_label('Back', $LANGUAGE), $XML_SERVER . '&action=input', 1); $object->addSoftkey('10', Aastra_get_label('Exit', $LANGUAGE), 'SoftKey:Exit', 2); $object->setCancelAction($XML_SERVER . '&action=input'); $object->addIcon(1, 'Icon:ArrowLeft'); $object->addIcon(2, 'Icon:CircleRed'); }
$display['other'] = prepare_number($Contact['phone_other'], 1, $conf); $dial['other'] = prepare_number($Contact['phone_other'], 0, $conf); } # Dialable object $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setTitle($Contact['last_name'] . ' ' . $Contact['first_name']); if ($is_style_textmenu) { $object->setStyle('none'); } $title = array('W' => Aastra_get_label('W', $language), 'M' => Aastra_get_label('M', $language), 'H' => Aastra_get_label('H', $language), 'O' => Aastra_get_label('O', $language)); switch ($header['model']) { case 'Aastra480i': case 'Aastra480i Cordless': if ($display['work'] != '') { $object->addEntry($title['W'] . ' ' . $display['work'], $dial['work']); } if ($display['mobile'] != '') { $object->addEntry($title['M'] . ' ' . $display['mobile'], $dial['mobile']); } if ($display['home'] != '') { $object->addEntry($title['H'] . ' ' . $display['home'], $dial['home']); } if ($display['other'] != '') { $object->addEntry($title['O'] . ' ' . $display['other'], $dial['other']); } $object->addSoftkey('1', Aastra_get_label('Dial', $language), 'SoftKey:Dial'); break; case 'Aastra9143i': case 'Aastra51i': case 'Aastra53i':
$object->addSoftkey('6', Aastra_get_label('Close', $language), $XML_SERVER); } else { $object->addSoftkey('9', Aastra_get_label('Cancel', $language), 'SoftKey:Exit'); $object->addSoftkey('10', Aastra_get_label('Close', $language), $XML_SERVER); } } } else { # Only if auto-logout is supported//configured if ($is_sip_notify and $AA_AUTOLOGOUT) { # Confirm logout require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setStyle('none'); $object->setTitle(Aastra_get_label('Confirm Logout', $language)); $object->addEntry(Aastra_get_label('Logout', $language), $XML_SERVER . '&action=logout'); $logout = Aastra_manage_presence_Asterisk($user, 'logout'); if ($logout == '') { $object->addEntry(Aastra_get_label('Auto-logout (None)', $language), $XML_SERVER . '&action=input_logout&origin=submit&password='******''); } else { $object->addEntry(sprintf(Aastra_get_label('Auto-logout (%s)', $language), format_time($logout)), $XML_SERVER . '&action=input_logout&origin=submit&password='******''); } $object->addEntry(Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=cancel'); # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); }
} else { $object->setTitle(Aastra_get_label('Directory', $language)); } $index = 1; $rank = 1; $dial = 2; foreach ($directory as $v) { if ($index >= ($page - 1) * $MaxLines + 1 and $index <= $page * $MaxLines) { if ($v['number'] == $selection) { $object->setDefaultIndex($rank); } $name = $v['name']; if ($AA_PRESENCE_STATE) { $name = '[' . $status_text[$v['status']]['mnemonic'] . ']' . $v['name']; } $object->addEntry($name, $v['number'], $v['number']); $rank++; } $index++; } # Softkeys if (!$AA_PRESENCE_STATE) { $object->addSoftkey('1', Aastra_get_label('Dial', $language), 'SoftKey:Dial'); if ($AA_SPEEDDIAL_STATE) { $object->addSoftkey('3', Aastra_get_label('+Speed', $language), $XML_SERVER . '&action=select&orig_s=list&page=' . $page); } } else { $object->addSoftkey('1', Aastra_get_label('Select', $language), $XML_SERVER . '&action=zoom&page=' . $page); $object->addSoftkey('3', Aastra_get_label('Dial', $language), 'SoftKey:Dial'); if ($origin != 'presence') { if ($AA_SPEEDDIAL_STATE) {
$text->setDestroyOnExit(); $text->addSoftkey('1', 'One-Touch', $XML_SERVER_PATH . 'contactdir.php?user='******'&searchmethod=onetouch'); $text->addSoftkey('2', 'T9', $XML_SERVER_PATH . 'contactdir.php?user='******'&searchmethod=t9'); $text->addSoftkey('3', 'Help', $XML_SERVER_PATH . 'contactdir.php?user='******'&searchmethod=help'); $text->addSoftkey('6', 'Exit', 'SoftKey:Exit'); $text->output(); break; } //step3: if we do have a search term, see if there are any contacts for said term } elseif (!$contact) { $contacts = search($search); if ($contacts) { $menu->setTitle('Please select a contact'); $menu->setDestroyOnExit(); foreach ($contacts as $contact => $val) { $menu->addEntry($val['first_name'] . ' ' . $val['last_name'], $XML_SERVER_PATH . 'contactdir.php?user='******'&contact=' . $val['id'] . '&searchmethod=' . $searchmethod . '&search=' . $search); } $menu->natsortByName(); $menu->addSoftkey('3', 'Exit', 'SoftKey:Exit'); $menu->addSoftkey('5', 'Back', $XML_SERVER_PATH . 'contactdir.php?user='******'&searchmethod=' . $searchmethod . '&searchterm=' . $search); $menu->addSoftkey('6', 'Select', 'SoftKey:Select'); $menu->output(); } else { //if no contacts are found, return error and prompt again /* $text->setTitle('Error'); $text->setText('No Matches Found!'); $text->setDestroyOnExit(); $text->setRefresh('3',$XML_SERVER_PATH.'contactdir.php?user='******'&searchmethod='.$searchmethod.'&searchterm='.$search); $text->addSoftKey('6','','SoftKey:Exit'); //hide default buttons $text->output();
$array_fav[$rank]['index'] = $array[$key]['index']; $array_fav[$rank]['name'] = $array[$key]['name']; Aastra_save_user_context($user, 'clock', $array_fav); $selection = $rank + 1; } # Display the favorites $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setTitle(Aastra_get_label('Favorite Cities', $language)); $object->setDefaultIndex($selection); if (Aastra_is_style_textmenu_supported) { $object->setStyle('none'); } for ($i = 0; $i < $MaxLines; $i++) { if ($array_fav[$i]['name'] != '') { $object->addEntry($array_fav[$i]['name'], $XML_SERVER . '?action=zoomfav&city=' . $array_fav[$i]['index'] . '&user='******'&selection=' . ($i + 1), $i); } else { $array[$i]['name'] = ''; $array[$i]['index'] = ''; $object->addEntry('..........................', $XML_SERVER . '?action=select' . '&user='******'&rank=' . $i, ''); } } # Softkeys if ($nb_softkeys > 0) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select'); $object->addSoftkey('2', Aastra_get_label('Move Up', $language), $XML_SERVER . '?user='******'&action=up'); $object->addSoftkey('3', Aastra_get_label('Clear', $language), $XML_SERVER . '?user='******'&action=clear'); $object->addSoftkey('4', Aastra_get_label('Back', $language), $XML_SERVER . '?user='******'&action=list'); $object->addSoftkey('5', Aastra_get_label('Move Down', $language), $XML_SERVER . '?user='******'&action=down'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
$object->setDestroyOnExit(); if ($is_style_textmenu) { $object->setStyle('radio'); } $object->setTitle(Aastra_get_label('Select Destination', $language)); # Numbers foreach ($array_index as $key => $value) { if ($array_user[$key] != '') { $label = $array_user[$key]; if ($is_icons) { $icon = $value[0]; } else { $icon = ''; $label = $value[1] . ' ' . $label; } $object->addEntry($label, $XML_SERVER . '&action=set_prefs&state=' . $state . '&value1=' . AA_PRESENCE_ACT_CFWD . '&type=' . $array_user[$key], '', $icon); } } # Manuel entry if ($is_icons) { $icon = '4'; } else { $icon = ''; } $object->addEntry(Aastra_get_label('Enter Number', $language), $XML_SERVER . '&action=edit_number1&state=' . $state, '', $icon); # Icons if ($is_icons) { $object->addIcon(1, Aastra_get_custom_icon('Cellphone')); $object->addIcon(2, Aastra_get_custom_icon('Home')); $object->addIcon(3, Aastra_get_custom_icon('Phone')); $object->addIcon(4, Aastra_get_custom_icon('Keypad'));
} # Get status if needed if ($AA_PRESENCE_STATE) { $directory = Aastra_get_hints_asterisk($directory); } # Labels for status $status_text = Aastra_status_config_Asterisk(); # Display Page require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setStyle('none'); $object->setWrapList(); # Next Page if ($page != 1) { $object->addEntry(Aastra_get_label('Previous Page', $language), $XML_SERVER . '&action=list&page=' . ($page - 1) . '&lookup=' . $lookup); } # Display items $index = 1; $rank = 1; $min = ''; $max = ''; foreach ($directory as $v) { if ($index >= ($page - 1) * $MaxLines + 1 and $index <= $page * $MaxLines) { if ($min == '') { $min = substr($v['name'], 0, 2); } if ($v['number'] == $selection) { $object->setDefaultIndex($rank); } if ($AA_PRESENCE_STATE) {
case '1': # Straight to the directory require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute(); $object->addEntry($ARRAY_CONFIG[$first_source]['uri']); break; # More than one # More than one default: # Display selection require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setTitle(Aastra_get_label('Directory Selection', $language)); foreach ($ARRAY_CONFIG as $source => $value) { $object->addEntry($value['label'], $value['uri'] . '&back=1'); } # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit', 1); $object->addIcon(1, 'Icon:CircleRed'); } } break; } # Send XML answer $object->output();
} $object->setTitle(Aastra_get_label('Speed Dial List', $language)); for ($i = 0; $i < AASTRA_MAXLINES; $i++) { $name = $conf_speed[$i]['name']; if ($name == '') { if ($nb_softkeys == 10) { $name = $i + 1 . '. .................................................'; } else { $name = '..................'; } } else { if ($nb_softkeys == 10) { $name = $i + 1 . '. ' . $name; } } $object->addEntry($name, $XML_SERVER . '&action=set_speed&speed=' . $i, ''); } # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select'); $object->addSoftkey('4', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=zoom'); $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('9', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=zoom', 1); $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit', 2); $object->setCancelAction($XML_SERVER . '&action=zoom'); $object->addIcon(1, 'Icon:PresenceNotAvailable'); $object->addIcon(2, 'Icon:CircleRed'); } }
if ($nb_softkeys == 6) { $object->addSoftkey('5', Aastra_get_label('Override', $language), $XML_SERVER . '&action=override&extension=' . $extension . '&password='******'&tz_code=' . $tz_code . '&tz_name=' . $tz_name); $object->addSoftkey('6', Aastra_get_label('Close', $language), $XML_SERVER); } else { $object->addSoftkey('9', Aastra_get_label('Override', $language), $XML_SERVER . '&action=override&extension=' . $extension . '&password='******'&tz_code=' . $tz_code . '&tz_name=' . $tz_name); $object->addSoftkey('10', Aastra_get_label('Close', $language), $XML_SERVER); $object->setCancelAction($XML_SERVER); } } } else { # Display error as a TextMenu $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setTitle(Aastra_get_label('Extension in Use', $language)); if (Aastra_is_user_registered_Asterisk($extension) or time() - $ext_array[$extension]['time'] > 180) { $object->addEntry(Aastra_get_label('Override', $language), $XML_SERVER . '&action=override&extension=' . $extension . '&password='******'&tz_code=' . $tz_code . '&tz_name=' . $tz_name); } $object->addEntry(Aastra_get_label('Cancel', $language), $XML_SERVER); } } else { # Collect user data if ($AA_FREEPBX_MODE == '1') { $username = Aastra_get_username_Asterisk($extension); $secret = Aastra_get_secret_Asterisk($extension); } else { $username = $extension; $secret = $password; } $callerid = Aastra_get_callerid_Asterisk($extension); # Get user/device profile $profile = Aastra_get_startup_profile_Asterisk($extension);
if ($AA_PRESENCE_STATE) { if (Aastra_is_icons_supported()) { if ($v['status'] == AA_PRESENCE_AVAILABLE) { if ($v['hint'] == 'Idle') { $icon = '1'; } else { if ($v['hint'] == 'Ringing') { $icon = '3'; } else { $icon = '4'; } } } else { $icon = '2'; } $object->addEntry($v['name'], $XML_SERVER . '&action=zoom&lookup=' . $lookup . '&page=' . $page . '&selection=' . $v['number'], $v['number'], $icon, $v['number']); } else { $object->addEntry('[' . $status_text[$v['status']]['mnemonic'] . '] ' . $v['name'], $XML_SERVER . '&action=zoom&lookup=' . $lookup . '&page=' . $page . '&selection=' . $v['number'], $v['number'], NULL, $v['number']); } } else { $object->addEntry($v['name'], 'Dial:' . $v['number'], $v['number'], NULL, $v['number']); } $rank++; $max = substr($v['name'], 0, 2); } $index++; } # Title if ($lookup == '') { if ($last != 1) { $object->setTitle(sprintf(Aastra_get_label('Directory (%s-%s)', $language), $min, $max));
function zoom($index, $recentPage, $recentSelection) { # Find record matching the given index foreach ($this->_list as $record) { if ($record['index'] == $index) { $myrecord = $record; break; } } # Textmenu for the zoom $menu = new AastraIPPhoneTextMenu(); $menu->setDestroyOnExit(); if (Aastra_is_style_textmenu_supported()) { $menu->setStyle('none'); } if (Aastra_is_wrap_title_supported()) { $menu->setTitleWrap(); } if (Aastra_is_textmenu_wrapitem_supported()) { $menu->setWrapList(); } $menu->setTitle($myrecord['name']); # Default Index $defaultIndex = 1; if (!empty($myrecord['title'])) { $menu->addEntry($myrecord['title'], NULL, NULL); $defaultIndex++; } if (!empty($myrecord['department'])) { $menu->addEntry($myrecord['department'], NULL, NULL); $defaultIndex++; } if (!empty($myrecord['company'])) { $menu->addEntry($myrecord['company'], NULL, NULL); $defaultIndex++; } $menu->setDefaultIndex($defaultIndex); # If Dial2 softkey is supported, add 'Dial:' Prefix to URL (so number can be dialed by pressing right navigation key) if (!Aastra_test_phone_version('2.0.1.', 1)) { $URLprefix = 'Dial:'; } else { $URLprefix = ''; } # Office Number if (!empty($myrecord['office'])) { if (Aastra_is_icons_supported()) { $iconIndex = 10; $prompt = ''; } else { $iconIndex = NULL; $prompt = Aastra_get_label('(W)', $this->_language) . ' '; } if (!Aastra_test_phone_version('2.0.1.', 1)) { $menu->addEntry($prompt . $myrecord['office'], $URLprefix . $myrecord['officeDigits'], $myrecord['officeDigits'], $iconIndex, $myrecord['officeDigits']); } else { $menu->addEntry($prompt . $myrecord['office'], $URLprefix . $myrecord['officeDigits'], $myrecord['officeDigits']); } } # Office 2 number if (!empty($myrecord['office2'])) { if (Aastra_is_icons_supported()) { $iconIndex = 10; $prompt = ''; } else { $iconIndex = NULL; $prompt = Aastra_get_label('(W)', $this->_language) . ' '; } if (!Aastra_test_phone_version('2.0.1.', 1)) { $menu->addEntry($prompt . $myrecord['office2'], $URLprefix . $myrecord['office2Digits'], $myrecord['officeDigits'], $iconIndex, $myrecord['office2Digits']); } else { $menu->addEntry($prompt . $myrecord['office2'], $URLprefix . $myrecord['office2Digits'], $myrecord['officeDigits']); } } # Mobile number if (!empty($myrecord['mobile'])) { if (Aastra_is_icons_supported()) { $iconIndex = 11; $prompt = ''; } else { $iconIndex = NULL; $prompt = Aastra_get_label('(C)', $this->_language) . ' '; } if (!Aastra_test_phone_version('2.0.1.', 1)) { $menu->addEntry($prompt . $myrecord['mobile'], $URLprefix . $myrecord['mobileDigits'], $myrecord['officeDigits'], $iconIndex, $myrecord['mobileDigits']); } else { $menu->addEntry($prompt . $myrecord['mobile'], $URLprefix . $myrecord['mobileDigits'], $myrecord['officeDigits']); } } # Home number if (!empty($myrecord['home'])) { if (Aastra_is_icons_supported()) { $iconIndex = 12; $prompt = ''; } else { $iconIndex = NULL; $prompt = Aastra_get_label('(H)', $this->_language) . ' '; } if (!Aastra_test_phone_version('2.0.1.', 1)) { $menu->addEntry($prompt . $myrecord['home'], $URLprefix . $myrecord['homeDigits'], $myrecord['officeDigits'], $iconIndex, $myrecord['homeDigits']); } else { $menu->addEntry($prompt . $myrecord['home'], $URLprefix . $myrecord['homeDigits'], $myrecord['officeDigits']); } } # Softkeys if (Aastra_is_softkeys_supported()) { if (Aastra_number_softkeys_supported() != 10) { # Regular phone with 6 softkeys if (!Aastra_test_phone_version('2.0.1.', 1)) { $dialKeyType = 'SoftKey:Dial2'; } else { $dialKeyType = 'SoftKey:Dial'; } $menu->addSoftkey(1, Aastra_get_label('Dial', $this->_language), $dialKeyType); $menu->addSoftkey(3, Aastra_get_label('Back', $this->_language), $this->_scrollHandlerReference . '&listPage=' . $recentPage . '&recentSelection=' . $recentSelection); $menu->addSoftkey(6, Aastra_get_label('Exit', $this->_language), 'SoftKey:Exit'); # Check if speed dial URL is set if (isset($myrecord['speedURL'])) { $menu->addSoftkey(4, Aastra_get_label('Add to Speed Dial', $this->_language), $myrecord['speedURL']); } } else { # 6739i $menu->addSoftkey(9, Aastra_get_label('Back', $this->_language), $this->_scrollHandlerReference . '&listPage=' . $recentPage . '&recentSelection=' . $recentSelection, 8); $menu->addSoftkey(10, Aastra_get_label('Exit', $this->_language), 'SoftKey:Exit', 9); # Check if speed dial URL is set if (isset($myrecord['speedURL'])) { $menu->addSoftkey(6, Aastra_get_label('+Speed', $this->_language), $myrecord['speedURL']); } } } # Icons if (Aastra_is_icons_supported()) { if (Aastra_phone_type() != 5) { $menu->addIcon(10, Aastra_get_custom_icon('Office')); $menu->addIcon(11, Aastra_get_custom_icon('Cellphone')); $menu->addIcon(12, Aastra_get_custom_icon('Home')); } else { $menu->addIcon(8, 'Icon:ArrowLeft'); $menu->addIcon(9, 'Icon:CircleRed'); $menu->addIcon(10, 'Icon:Office'); $menu->addIcon(11, 'Icon:CellPhone'); $menu->addIcon(12, 'Icon:Home'); } } # Cancel action $menu->setCancelAction($this->_scrollHandlerReference . '&listPage=' . $recentPage . '&recentSelection=' . $recentSelection); # Display XML object $menu->output(); }
if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } else { $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } } } else { # Configured: List of options require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setStyle('none'); $object->setTitle(sprintf(Aastra_get_label('Follow-me for %s', $language), Aastra_get_userdevice_Asterisk($user))); if ($array_fm['status'] == '1') { $object->addEntry(Aastra_get_label('Status: Activated', $language), $XML_SERVER . '&action=change_status'); } else { $object->addEntry(Aastra_get_label('Status: Deactivated', $language), $XML_SERVER . '&action=change_status'); } $object->addEntry(sprintf(Aastra_get_label('Initial Ring Time: %ss', $language), $array_fm['prering']), $XML_SERVER . '&action=change_prering'); $object->addEntry(sprintf(Aastra_get_label('Ring Time: %ss', $language), $array_fm['grptime']), $XML_SERVER . '&action=change_grptime'); if ($array_fm['grpconf']) { $object->addEntry(Aastra_get_label('Confirm Calls: Yes', $language), $XML_SERVER . '&action=change_grpconf'); } else { $object->addEntry(Aastra_get_label('Confirm Calls: No', $language), $XML_SERVER . '&action=change_grpconf'); } $object->addEntry(sprintf(Aastra_get_label('%s phone number(s)', $language), count($array_fm['grplist'])), $XML_SERVER . '&action=change_grplist'); # Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Change', $language), 'SoftKey:Select');
} } break; # Display favorites # Display favorites case 'favorites': # Retrieve favorites $data = Aastra_get_user_context($user, 'stock'); # Create list require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $summary = False; $object->setTitle(Aastra_get_label('Watch List', $language)); for ($i = 0; $i < AASTRA_MAXLINES; $i++) { if ($data['favorites'][$i] == '') { $object->addEntry('...........................', $XML_SERVER . '&action=inputfav&selection=' . $i, $i); } else { $object->addEntry($data['favorites'][$i], $XML_SERVER . '&action=displayfav&selection=' . $i, $i); $summary = True; } } # Set default index if ($default != '') { $object->setDefaultIndex($default); } # Add softkeys if ($nb_softkeys > 0) { if ($nb_softkeys == 6) { if ($page == 1) { $object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select'); $object->addSoftkey('2', Aastra_get_label('Move Up', $language), $XML_SERVER . '&action=up');
if ($last != 1) { $object->setTitle(sprintf(Aastra_get_label('Msg Forward (%s/%s)', $language), $dpage, $last)); } else { $object->setTitle(Aastra_get_label('Message Forward', $language)); } $index = 1; $rank = 1; $submit = False; # Display items foreach ($directory as $key => $value) { if ($index >= ($dpage - 1) * $MaxLines + 1 and $index <= $dpage * $MaxLines) { if ($value['select']) { $submit = True; } if ($value['select']) { $object->addEntry($value['name'], $XML_SERVER . '&action=dselect&msg=' . $msg . '&dpage=' . $dpage . '&dindex=' . $key, '', 1); } else { $object->addEntry($value['name'], $XML_SERVER . '&action=dselect&msg=' . $msg . '&dpage=' . $dpage . '&dindex=' . $key, '', 2); } if ($key == $dindex) { $object->setDefaultIndex($rank); } $rank++; } $index++; } # Icons $object->addIcon('1', '0000000804020C30C0000000'); $object->addIcon('2', '000000000000000000000000'); # Softkeys $object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select');
if ($selection != '') { $object->setDefaultIndex($selection + 1); } # Display items $nb_entries = 0; $object->setBase($XML_SERVER); for ($i = 0; $i < AASTRA_MAXLINES; $i++) { $name = $data[$i]['name']; if ($name == '') { if ($mode == 'dynamic') { if ($nb_softkeys == 10) { $name = $i + 1 . '. .................................................'; } else { $name = '..................'; } $object->addEntry($name, '&action=edit&selection=' . $i, $i); } } else { if ($nb_softkeys == 10) { $name = $i + 1 . '. ' . $name; $array_test = array('work', 'mobile', 'home', 'other'); $dial = ''; $count = 0; foreach ($array_test as $value) { if ($data[$i][$value] != '') { if ($dial == '') { $dial = $data[$i][$value]; } $count++; } }