if ($index - $last * $MaxLines != 0) { $last++; } # 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'); if ($last != 1) { $object->setTitle(sprintf(Aastra_get_label('Directory (%s/%s)', $language), $page, $last)); } 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']; }
$menu->addEntry('Choice 2', 'http://myserver.com/script.php?choice=2', 'Value=2', '', '12345'); $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->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');
if ($Contact['phone_work'] != '') { $display['work'] = prepare_number($Contact['phone_work'], 1, $conf); $dial['work'] = prepare_number($Contact['phone_work'], 0, $conf); } if ($Contact['phone_mobile'] != '') { $display['mobile'] = prepare_number($Contact['phone_mobile'], 1, $conf); $dial['mobile'] = prepare_number($Contact['phone_mobile'], 0, $conf); } if ($Contact['phone_other'] != '') { $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']);
$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)); } else { $object->setTitle(Aastra_get_label('Directory', $language)); } } else { if ($last != 1) { $object->setTitle(sprintf(Aastra_get_label('Results (%s-%s)', $language), $min, $max)); } else { $object->setTitle(Aastra_get_label('Results', $language)); } } # Softkeys $object->addSoftkey('1', Aastra_get_label('Dial', $language), $XML_SERVER . '&action=dial', 10); if (Aastra_get_intercom_config_Asterisk() != '') { $object->addSoftkey('2', Aastra_get_label('Intercom', $language), $XML_SERVER . '&action=intercom', 11); }
$object->setTitle(Aastra_get_label('Follow-me', $language)); $object->setText(Aastra_get_label('This feature is not configured for your phone. Please contact your administrator.', $language)); 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) {
exit; } } # Display the requested article or list $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();
} $found = 0; $i = 0; while ($found == 0 and $i < $MaxLines) { if ($conf_speed[$i]['name'] == '') { $found = 1; } $i++; } require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); if ($found == 1) { $object->setDefaultIndex($i); } $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, ''); }
} } } else { # 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'); }
$object->addSoftkey('5', Aastra_get_label('Cancel', $language), 'SoftKey:Exit'); $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');
$last++; } # More than one item if ($count > 1) { # Display list $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); if ($last_rank != '') { $object->setDefaultIndex(($last_rank - 1) % $MaxLines + 1); $page = intval($last_rank / $MaxLines); if ($last_rank - $page * $MaxLines != 0) { $page++; } } 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)); }
$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;
# Retrieve last page $last = intval($nbuser / AASTRA_MAXLINES); if ($nbuser - $last * AASTRA_MAXLINES != 0) { $last++; } # Sort by name Aastra_natsort2d($meetmechannel, '2'); # Prepare object require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); if (Aastra_is_style_textmenu_supported()) { $object->setStyle('none'); } if ($last == 1) { $object->setTitle(sprintf(Aastra_get_label('Conference %s', $language), $confno)); } else { $object->setTitle(sprintf(Aastra_get_label('Conference %s (%s/%s)', $language), $confno, $page, $last)); } $new_selection = 1; $index = 0; $user = Aastra_get_userdevice_Asterisk($ext); foreach ($meetmechannel as $value) { if ($index >= ($page - 1) * AASTRA_MAXLINES and $index < $page * AASTRA_MAXLINES) { if ($value[1] == $user) { $name = sprintf(Aastra_get_label('%s (YOU)', $language), $value[2]); } else { $name = $value[2]; } $icon = ''; if ($value[3]) {
$default = $index % $MaxLines; $page = ($index - $default) / $MaxLines + 1; if (!$nb_softkeys and $page != 1) { $default++; } } } # TextMenu for the list require_once 'AastraIPPhoneTextMenu.class.php'; $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;
} # Get user context $ARRAY_USER = get_user_config($user); # If no search string was provided, don't perfom search if (empty($lookup) && empty($lastname) && empty($firstname) && $action == 'search') { $action = 'input'; } # Process action 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');
break; # List with all the indexes # List with all the indexes case 'list': # Authenticate user Aastra_check_signature_Asterisk($user); # Retrieve all status $array_night = Aastra_manage_daynight_Asterisk('get_all', ''); # Textmenu require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); if (Aastra_is_style_textmenu_supported()) { $object->setStyle('none'); } $object->setTitle(Aastra_get_label('Day/Night Control', $language)); $day = 0; $night = 0; foreach ($array_night as $i => $value) { if ($value['night'] == '1') { $display = sprintf(Aastra_get_label('%s (%d)-NIGHT', $language), $value['desc'], $i); if ($value['password'] != '') { $day = 2; } else { if ($day != 2) { $day = 1; } } } else { $display = sprintf(Aastra_get_label('%s (%d)-DAY', $language), $value['desc'], $i); if ($value['password'] != '') {
//step 1: promt for search method $text->setTitle('Contact Directory'); $text->setText('Chose input method to use for search:'); $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();
$array_fav[$selection]['index'] = ''; $array_fav[$selection]['name'] = ''; Aastra_save_user_context($user, 'clock', $array_fav); $selection++; } if ($action == 'set') { $key = search_index($city, $array); $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) {
break; # Select destination # Select destination case 'select_number': # Retrieve stored data $array_user = Aastra_manage_userinfo_Asterisk($user, 'get'); # All indexes $array_index = array('cell' => array('1', Aastra_get_label('(M)', $language), '1'), 'home' => array('2', Aastra_get_label('(H)', $language), '2'), 'other' => array('3', Aastra_get_label('(O)', $language), '3')); # Personal phone numbers require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $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) {
require_once 'AastraIPPhoneExecute.class.php'; $object = new AastraIPPhoneExecute(); if (Aastra_is_dialuri_supported()) { $object->addEntry('Dial:' . $park[0][0]); } 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]);
# Just one # Just one 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; }
# At least one to add if (count($all) > 0) { # Retrieve last menu_page $nb_menu_pages = count($all); $last = intval($nb_menu_pages / $MaxLines); if ($nb_menu_pages - $last * $MaxLines != 0) { $last++; } # 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) {
} else { $object->setText(sprintf(Aastra_get_label('Extension already in use on a %s at %s.', $language), $ext_array[$extension]['model'], $ext_array[$extension]['ip'])); 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);
} $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } 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);
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(); }
$directory[$key]['select'] = False; } else { $directory[$key]['select'] = True; } } } # Save the session $array = array('directory' => base64_encode(serialize($directory))); Aastra_save_session('vmail', '600', $array, $ext); # Display Page require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setStyle('none'); 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 {
# Show queue callers # Show queue callers case 'show_queue_entries': # Erase refresh @unlink(AASTRA_PATH_CACHE . $header['mac'] . '.queues'); # Retrieve current members $entries = Aastra_get_queue_entries_Asterisk($queue); # Sort by position $entries = Aastra_array_multi_sort($entries, 'Position'); # Do we have any if (sizeof($entries)) { # Display the list require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setTitle(sprintf('%s (%s)', $q_desc, $queue)); if (Aastra_is_style_textmenu_supported()) { $object->setStyle('none'); } $index = 1; foreach ($entries as $value) { if ($index <= AASTRA_MAXLINES) { $object->addEntry(sprintf('%d. %s (%s)', $value['Position'], $value['CallerIDName'], $value['CallerIDNum']), $XML_SERVER . '&action=redirect&queue=' . $queue . '&q_desc=' . $q_desc . '&member=' . $value['Channel'], '&member=' . $value['Channel']); } $index++; } # Softkeys if ($nb_softkeys == 6) { $object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select'); $object->addSoftKey('4', Aastra_get_label('Refresh', $language), $XML_SERVER . '&action=show_queue_entries&queue=' . $queue . '&q_desc=' . $q_desc); $object->addSoftKey('5', Aastra_get_label('Back', $language), $XML_SERVER . '&action=show_queues&queue=' . $queue);