$found = True; break; } $index++; } if ($found) { $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));
if ($page != $last) { $object->addSoftkey('8', Aastra_get_label('Next', $language), $XML_SERVER . '&action=' . $action . '&page=' . ($page + 1) . '&selection=' . $selection); } $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
# Reverse if ($action == 'reverse') { foreach ($directory as $key => $value) { if ($value['select']) { $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;
} } else { # Only one and autopick if ($count == 1 and $autopick == '1') { # Dial the orbit 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]);
$config = Aastra_get_user_context($menu_user, 'mymenu' . '_' . $menu_source); # Filter existing menus unset($all['RESERVED']); foreach ($config['menu'] as $key => $value) { unset($all[$value]); } # 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++;
$object->addEntry('Led: ' . $key . '=on'); } else { $object->addEntry('Led: ' . $key . '=off'); } sleep(2); 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 { Aastra_debug('RSS feed empty, wrong zip code'); $object = new AastraIPPhoneTextScreen(); $object->setTitle(Aastra_get_label('Error', $language)); $object->setText(Aastra_get_label('No data available, please check the ZIP code you entered.', $language)); $output = $object->output(); 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');
# Softkeys if ($nb_softkeys) { if ($nb_softkeys == 6) { $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');
$db_password = $config['']['ampdbpass']; $db_url = $engine . "://" . $db_username . ":" . $db_password . "@" . $db_host . "/" . $db_database; $db = DB::connect($db_url); //get arguments $user = $_GET['user']; $searchmethod = isset($_GET['searchmethod']) ? $_GET['searchmethod'] : null; //search method : onetouch or t9 $search = isset($_GET['search']) ? $_GET['search'] : null; //name of number to search for $searchterm = isset($_GET['searchterm']) ? $_GET['searchterm'] : null; // "" "" $contact = isset($_GET['contact']) ? $_GET['contact'] : null; //id of a specific contact //declare classes $input = new AastraIPPhoneInputScreen(); $menu = new AastraIPPhoneTextMenu(); $text = new AastraIPPhoneTextScreen(); $screen = new AastraIPPhoneFormattedTextScreen(); //if no $searchmethod is set, check for users perferd input method if (!$searchmethod) { $sql = 'SELECT val from contactdir_details where extension = ? and type =?'; $searchmethod = $db->getRow($sql, array($user, 'searchmethod')); if ($searchmethod) { $searchmethod = implode(",", $searchmethod); } } //step 1&2: ensure that the search term hasnt been entered yet, and promt for it. If //we dont have a search method either, return default to prompt for method if (!$search) { switch ($searchmethod) { case 't9':
} $object->setText($text); $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
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 { # 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) {
# At least one record if ($index > 0) { # Retrieve last page $last = intval($index / $MaxLines); 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)); } # Next Page if ($page != 1) { $object->addEntry(Aastra_get_label('Previous Page', $language), $XML_SERVER . '&action=list&page=' . ($page - 1)); } # Display items $index = 1; $rank = 1; foreach ($directory as $v) {
# Special for no softkey phones if (Aastra_is_softkeys_supported()) { $MaxLines = AASTRA_MAXLINES; } else { $MaxLines = AASTRA_MAXLINES - 2; } # Retrieve last page $count = count($array_rss); $last = intval($count / $MaxLines); if ($count - $last * $MaxLines != 0) { $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');
} else { $object->addSoftkey('9', Aastra_get_label('Back', $language), $XML_SERVER . '&confno=' . $confno); $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); $object->setCancelAction($XML_SERVER . '&confno=' . $confno); } } else { # 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) {
# At least one record if ($index > 0) { # Retrieve last page $last = intval($index / $MaxLines); 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); }
$object->addSoftkey('10', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=input_prefs2&state=' . $state); $object->setCancelAction($XML_SERVER . '&action=input_prefs2&state=' . $state); } } } 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; }
function output($page = NULL) { # Test phone firmware / model Aastra_test_phone_version('1.4.2.', 0); Aastra_test_phone_model(array('Aastra9112i', 'Aastra9133i'), False, 0); # Force destroyOnExit $this->_destroyOnExit = 'yes'; # Initial call? if (!isset($page)) { # Count number of entries in list $this->_count = count($this->_list); # Setup icons $this->_setupIcons(); # Setup Softkeys $this->_setupSoftKeys(); # Set Cancel URI if (!empty($this->_backCancelURL)) { parent::setCancelAction($this->_backCancelURL); } # Do some security / compliancy checks # Protect against wrap list bug in FW < R2.4.0 if (Aastra_test_phone_version('2.4.0.', 1)) { $this->_wraplist = 'no'; } if (!Aastra_is_wrap_title_supported()) { $this->_wraplist = 'no'; } if (!Aastra_is_textmenu_wrapitem_supported()) { $this->_title_wrap = 'no'; } if (!Aastra_is_style_textmenu_supported()) { $this->_style = ''; } if (!Aastra_is_lockin_supported()) { $this->_lockin = 'no'; } # Save object in user context (context = mac address) Aastra_save_user_context($this->_header['mac'], 'scrollableTextMenuData', $this); } else { # If beep is set, only beep during initial call $this->_beep = 'no'; } # Generate the actual items of the menu for the given page $this->_generatePage($page); parent::output(); }
} break; # 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'); } }
} if ($action == 'clear') { $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, ''); } }
$object->setCancelAction($XML_SERVER); } } 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;
# At least one record if ($index > 0) { # Retrieve last page $last = intval($index / $MaxLines); 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'); $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 == '') {
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(); }
# Get user context if ($asterisk) { $conf_speed = Aastra_get_user_context(Aastra_get_userdevice_Asterisk($user), 'speed'); } else { $conf_speed = Aastra_get_user_context($user, 'speed'); } $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) {
} else { $object->addSoftkey('8', Aastra_get_label('Cancel', $language), $XML_SERVER . '&action=favorites&selection=' . $selection); $object->setCancelAction($XML_SERVER . '&action=favorites&selection=' . $selection); } $object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); } } 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
$index = count($directory); # At least one record if ($index > 0) { # Retrieve last page $last = intval($index / $MaxLines); if ($index - $last * $MaxLines != 0) { $last++; } # Get status if needed if ($AA_PRESENCE_STATE) { $directory = Aastra_get_hints_asterisk($directory); $status_text = Aastra_status_config_Asterisk(); } # Display Page require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); # Display list $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) {
$dial['home'] = prepare_number($Contact['phone_home'], 0, $conf); } 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']); }
require_once 'AastraIPPhoneTextScreen.class.php'; $object = new AastraIPPhoneTextScreen(); $object->setDestroyOnExit(); $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'); }
# Reverse if ($action == 'reverse') { foreach ($directory as $key => $value) { if ($value['select']) { $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(); 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; $object->addEntry('X ' . $value['name'], $XML_SERVER . '&action=dselect&msg=' . $msg . '&dpage=' . $dpage . '&dindex=' . $key);
# Number of records $index = count($directory); # At least one record if ($index > 0) { # Retrieve last page $last = intval($index / $MaxLines); if ($index - $last * $MaxLines != 0) { $last++; } # Get status if needed if ($AA_PRESENCE_STATE) { $directory = Aastra_get_hints_asterisk($directory); } # Display Page require_once 'AastraIPPhoneTextMenu.class.php'; $object = new AastraIPPhoneTextMenu(); $object->setDestroyOnExit(); $object->setStyle('none'); $object->setWrapList(); # Display List $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);