break; # Display result # Display result case 'display': case 'displayfav': # Retrieve quote if ($action == 'display') { $array[0] = $data['last']; } else { $array[0] = $data['favorites'][$selection]; } $return = get_currency($array); # Return OK if ($return[0]) { # Create the object $object = new AastraIPPhoneFormattedTextScreen(); # Display results if ($nb_softkeys == 6) { # Regular phone if ($action == 'display') { $object->addLine($data['last']['source'] . ' to ' . $data['last']['target'], NULL, 'center'); } else { $object->addLine($data['favorites'][$selection]['source'] . ' to ' . $data['favorites'][$selection]['target'], NULL, 'center'); } $object->setScrollStart(Aastra_size_formattedtextscreen() - 1); $nb_carac = Aastra_size_display_line(); $object->addLine(''); $object->addLine(format_line($nb_carac, Aastra_get_label('Last Trade', $language), $return[1][0][1])); $object->addLine(format_line($nb_carac, Aastra_get_label('Ask', $language), $return[1][0][4])); $object->addLine(format_line($nb_carac, Aastra_get_label('Bid', $language), $return[1][0][5])); $object->addLine(format_line($nb_carac, Aastra_get_label('Date', $language), $return[1][0][2]));
# New text screen require_once 'AastraIPPhoneTextScreen.class.php'; $object = new AastraIPPhoneTextScreen(); $object->setDestroyOnExit(); $object->setTitle($err_title); $object->setText($err_text); if ($err_key[2] != 'SoftKey:Exit') { $object->setDoneAction($err_key[2]); } break; # Flash message # Flash message case 'flash': # New formatted text screen require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); $object->setDestroyOnExit(); $size = Aastra_size_display_line(); if (strlen($flash_text) > $size) { $temp = wordwrap($flash_text, $size, "\n", True); $lines = explode("\n", $temp); } else { $lines[0] = $flash_text; } $nb_lines = count($lines); if ($nb_lines == 1) { $object->addLine($lines[0], 'double', 'center'); } else { foreach ($lines as $value) { $object->addLine($value, NULL, 'center'); }
$temp = unserialize(base64_decode($array['csv_directory'])); $directory = $temp[1]; # Update global variable $XML_SERVER .= '&lookup=' . $lookup . '&lastn=' . $lastn . '&firstn=' . $firstn . '&index=' . $index . '&page=' . $page . '&company=' . $company; # Display details if ($ARRAY_USER['display'] == 'firstlast') { $name = $directory[$index]['first'] . ' ' . $directory[$index]['last']; } else { $name = $directory[$index]['last'] . ' ' . $directory[$index]['first']; } if ($name == ' ') { $name = $directory[$index]['company']; } if ($is_formatted_textscreen) { require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); $object->setDestroyOnExit(); $object->addLine($name, 'double'); if ($directory[$index]['company'] != '') { $object->addLine($directory[$index]['company']); } else { $object->addLine(Aastra_get_label('Company...', $language)); } if ($directory[$index]['title'] != '') { $object->addLine($directory[$index]['title']); } else { $object->addLine(Aastra_get_label('Title...', $language)); } } else { require_once 'AastraIPPhoneTextScreen.class.php'; $object = new AastraIPPhoneTextScreen();
if ($away['status'] != AA_PRESENCE_AVAILABLE) { $explodem = explode(',', $away['notifym']); $explodev = explode(',', $away['notifyv']); $real_user = Aastra_get_userdevice_Asterisk($user); if (in_array($real_user, $explodem) or in_array($real_user, $explodev)) { $notify = True; } else { $notify = False; } } else { # Dynamic status $hint = Aastra_get_user_hint_asterisk($selection); } # Use a FormattedTextScreen require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); $object->setDestroyOnExit(); # Define color based on status if ($away['status'] != AA_PRESENCE_AVAILABLE) { $color = 'red'; } else { if ($hint == 'Idle') { $color = 'green'; } else { $color = 'red'; } } $object->addLine(Aastra_get_callerid_Asterisk($selection) . ' (' . $selection . ')', 'large', NULL, $color); $line = sprintf(Aastra_get_label('Currently %s', $language), $status_text[$away['status']]['label']); $object->addLine($line); if ($away['status'] != AA_PRESENCE_AVAILABLE) {
} # Cleanup unset($array_night); } } # Callback $XML_SERVER .= '?user='******'&mode=' . $mode; # Depending on action switch ($action) { # Display case 'display': # Display current status if (Aastra_is_formattedtextscreen_supported()) { # Advanced display require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); $object->setdestroyOnExit(); $object->setTimeout('2'); if (Aastra_size_formattedtextscreen() > 3) { $object->addLine(''); $object->addLine(''); } if ($status == 1) { $object->addLine(sprintf(Aastra_get_label('Night Mode activated (%d)', $language), $index), 'double', 'center'); } else { $object->addLine(sprintf(Aastra_get_label('Day Mode activated (%d)', $language), $index), 'double', 'center'); } if ($nb_softkeys == 6) { $object->addSoftKey('6', '', 'SoftKey:Exit'); } } else {
} break; case '1': $value .= $line; $current = filter_format($value); $found = 2; break; } $previous_line = $line; } fclose($handle); if ($found == 2) { if (Aastra_is_formattedtextscreen_supported()) { sscanf($current, '%s %s %d, %d at %s %[^$]s', $day, $month, $day2, $year, $time, $AMPM); require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); $object->setDestroyOnExit(); $size = Aastra_size_formattedtextscreen(); if ($size > 5) { $font = 'double'; } else { $font = NULL; } $object->addLine($title, $font, 'center'); if ($size < 4) { $object->setScrollStart($size - 1); } if (Aastra_size_formattedtextscreen() > 4) { $object->addLine(''); } if (Aastra_size_formattedtextscreen() > 5) {
# Summary # Summary case 'summary': # Retrieve favorites $data = Aastra_get_user_context($user, 'stock'); foreach ($data['favorites'] as $key => $value) { if ($value != '') { $array[] = $value; } } $return = get_quote($array); # Return OK if ($return[0]) { # Create the object require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); # No color FTS if (!Aastra_is_formattedtextscreen_color_supported()) { # Process the results $nb_carac = Aastra_size_display_line(); $object->setScrollStart(Aastra_size_formattedtextscreen()); foreach ($return[1] as $key => $value) { if ($value != NULL) { if ($value[8] != 'N/A') { $last = 'Not Found'; } else { $last = $value[2]; } $object->addLine(format_line($nb_carac, $value[0], $last)); } }
fclose($handle); if ($callerid != '') { $callerid_type = 'external'; } } } } # We identified something if ($callerid != '') { # Labels for status $status_text = Aastra_status_config_Asterisk(); # Display formatted screen if supported if (Aastra_is_formattedtextscreen_supported()) { # Create formatted screen require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); # Called party is internal if ($callerid_type == 'internal') { # Presence enabled if ($AA_PRESENCE_STATE) { # Retrieve presence data $away = Aastra_manage_presence_Asterisk($number, 'get', 'status'); # Display presence data if ($away['status'] != AA_PRESENCE_AVAILABLE) { if ($away['status'] == AA_PRESENCE_DISCONNECTED) { $color = 'red'; } else { $color = 'yellow'; } $line[] = array($callerid . ' (' . $number . ')', 'double', $color); $line[] = array($status_text[$away['status']]['label'], $color);
$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': $sql = 'DELETE FROM contactdir_details WHERE extension = ? and type = ?'; $db->query($sql, array($user, 'searchmethod'));
} } else { # Save session $array = array('uri_onhook' => $XML_SERVER, 'user' => $user, 'type' => 'temp', 'action' => 'record'); Aastra_save_session('vmail', '600', $array, $user); # Dial special number $object->addEntry('Dial:vmail'); } break; # Display # Display case 'display_back': # Display user message if (Aastra_is_formattedtextscreen_supported()) { require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); if (Aastra_size_formattedtextscreen() > 2) { $object->addLine(''); } if (Aastra_is_formattedtextscreen_color_supported()) { $object->addLine(''); $object->addLine(''); $object->addLine(''); $object->addLine(Aastra_get_label('Welcome Back', $language), 'large', 'center', 'green'); } else { $object->addLine(Aastra_get_label('Welcome Back', $language), 'double', 'center'); } } else { require_once 'AastraIPPhoneTextScreen.class.php'; $object = new AastraIPPhoneTextScreen(); $object->setTitle(Aastra_get_label('Presence', $language));
$explodev = explode(',', $away['notifyv']); $real_user = Aastra_get_userdevice_Asterisk($user); if (in_array($real_user, $explodem) or in_array($real_user, $explodev)) { $notify = True; } else { $notify = False; } } else { # Dynamic status $hint = Aastra_get_user_hint_asterisk($selection); } # Get display size $size = Aastra_size_display_line(); # Use a FormattedTextScreen require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); $object->setDestroyOnExit(); $object->addLine(Aastra_get_callerid_Asterisk($selection) . ' (' . $selection . ')'); $object->setScrollStart(Aastra_size_formattedtextscreen() - 1); $line = sprintf(Aastra_get_label('Currently %s', $language), $status_text[$away['status']]['label']); if (strlen($line) > $size) { $line = sprintf('%s', $status_text[$away['status']]['label']); } $object->addLine($line); if ($away['status'] != AA_PRESENCE_AVAILABLE) { $line = Aastra_format_presence_dt_Asterisk($away['return']); foreach ($line as $data) { $object->addLine($data); } if ($notify) { $object->addLine(Aastra_get_label('Notification on return', $language));
function display_message($title, $message, $backURL = NULL) { global $LANGUAGE; # Depending on phone type if (Aastra_phone_type() != 5) { # non 6739i require_once 'AastraIPPhoneTextScreen.class.php'; $object = new AastraIPPhoneTextScreen(); $object->setTitle($title); $object->setText($message); $object->addSoftkey('5', Aastra_get_label('Back', $LANGUAGE), $backURL); $object->addSoftkey('6', Aastra_get_label('Exit', $LANGUAGE), 'SoftKey:Exit'); } else { # 6739i/8000i require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); $object->addLine('', 'double', 'center'); $object->addLine($title, 'double', 'center', 'red'); $object->setScrollStart('3'); $object->addLine(''); $object->addLine(''); $object->addLine($message, NULL, 'center'); $object->setScrollEnd(); $object->addLine('', NULL, 'center'); $object->addSoftkey('9', Aastra_get_label('Back', $LANGUAGE), $backURL, 1); $object->addSoftkey('10', Aastra_get_label('Exit', $LANGUAGE), 'SoftKey:Exit', 2); $object->addIcon(1, 'Icon:ArrowLeft'); $object->addIcon(2, 'Icon:CircleRed'); } # Common parameters $object->setDestroyOnExit(); $object->setCancelAction($backURL); $object->output(); exit; }
$execute->setTriggerDestroyOnExit(); $execute->addEntry('Led: softkey1=on'); $execute->addEntry('Dial:7001', 'no'); $execute->output(); break; case 'configuration': require_once 'AastraIPPhoneConfiguration.class.php'; $configuration = new AastraIPPhoneConfiguration(); $configuration->addEntry('softkey1 label', 'Test'); $configuration->addEntry('softkey1 type', 'xml'); $configuration->setTriggerDestroyOnExit(); $configuration->output(); break; case 'formattedtextscreen': require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $ftext = new AastraIPPhoneFormattedTextScreen(); $ftext->setDestroyOnExit(); $ftext->addLine('Formatted Screen', 'double', 'center', 'red'); $ftext->setScrollStart(); $ftext->addLine('Scrolled text1'); $ftext->addLine('Scrolled text2'); $ftext->addLine('Scrolled text3'); $ftext->addLine('Scrolled text4'); $ftext->addLine('Scrolled text5'); $ftext->setScrollEnd(); $ftext->addLine('Footer', NULL, 'center'); $ftext->addSoftkey('10', 'Exit', 'SoftKey:Exit'); $ftext->output(); break; case 'status1': require_once 'AastraIPPhoneStatus.class.php';
$new = 0; } else { $new = 1; } $object->addSoftkey('2', Aastra_get_label('Emotional', $language), $XML_SERVER . '&bdate=' . $bdate . '&I=' . $I . '&E=' . $new . '&P=' . $P); if ($P == 1) { $new = 0; } else { $new = 1; } $object->addSoftkey('3', Aastra_get_label('Physical', $language), $XML_SERVER . '&bdate=' . $bdate . '&I=' . $I . '&E=' . $E . '&P=' . $new); } else { # Display results if (Aastra_is_formattedtextscreen_supported()) { # create object $object = new AastraIPPhoneFormattedTextScreen(); if (Aastra_size_formattedtextscreen() > 3) { $object->addLine(Aastra_get_label('BIORHYTHMS', $language)); if (Aastra_size_formattedtextscreen() > 4) { $object->addLine(''); } $object->addLine(sprintf(Aastra_get_label('I=%+.3f %s', $language), $array['day']['I'], $array['trend']['I'])); $object->addLine(sprintf(Aastra_get_label('E=%+.3f %s', $language), $array['day']['E'], $array['trend']['E'])); $object->addLine(sprintf(Aastra_get_label('P=%+.3f %s', $language), $array['day']['P'], $array['trend']['P'])); } else { $object->setScrollStart('2'); $object->addLine(sprintf(Aastra_get_label('I=%+.3f %s', $language), $array['day']['I'], $array['trend']['I'])); $object->addLine(sprintf(Aastra_get_label('E=%+.3f %s', $language), $array['day']['E'], $array['trend']['E'])); $object->addLine(sprintf(Aastra_get_label('P=%+.3f %s', $language), $array['day']['P'], $array['trend']['P'])); $object->setScrollEnd(); }
# Error message case 'error': # New text screen require_once 'AastraIPPhoneTextScreen.class.php'; $object = new AastraIPPhoneTextScreen(); $object->setDestroyOnExit(); $object->setTitle($err_title); $object->setText($err_text); $object->addSoftkey($err_key[0], $err_key[1], $err_key[2]); break; # Flash message # Flash message case 'flash': # New formatted text screen require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); $object->setDestroyOnExit(); $size = Aastra_size_display_line(); if (strlen($flash_text) > $size) { $temp = wordwrap($flash_text, $size, "\n", True); $lines = explode("\n", $temp); } else { $lines[0] = $flash_text; } $nb_lines = count($lines); if ($nb_lines == 1) { $object->addLine(''); $object->addLine(''); $object->addLine(''); $object->addLine(''); $object->addLine('');
# Error message case 'error': # New text screen require_once 'AastraIPPhoneTextScreen.class.php'; $object = new AastraIPPhoneTextScreen(); $object->setDestroyOnExit(); $object->setTitle($err_title); $object->setText($err_text); $object->addSoftkey($err_key[0], $err_key[1], $err_key[2]); break; # Flash message # Flash message case 'flash': # New formatted text screen require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); $object->setDestroyOnExit(); $size = Aastra_size_display_line(); if (strlen($flash_text) > $size) { $temp = wordwrap($flash_text, $size, "\n", True); $lines = explode("\n", $temp); } else { $lines[0] = $flash_text; } $nb_lines = count($lines); if ($nb_lines == 1) { $object->addLine(''); $object->addLine(''); $object->addLine($lines[0], 'double', 'center'); } else { if ($nb_lines < 4) {
$object->addSoftKey('9', Aastra_get_label('Back', $language), $XML_SERVER . '&action=show_queues&queue=' . $queue); $object->addSoftKey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit'); $object->setCancelAction($XML_SERVER . '&action=show_queues&queue=' . $queue); } } break; # Show agent detail # Show agent detail case 'agent_detail': # Collect data $detail = get_agent_status($queue, $member); # Depending on the phone if (Aastra_is_formattedtextscreen_supported()) { # Display Agent status require_once 'AastraIPPhoneFormattedTextScreen.class.php'; $object = new AastraIPPhoneFormattedTextScreen(); $object->setDestroyOnExit(); if ($is_color_ftextscreen) { if ($detail['Paused']) { $color = 'yellow'; } else { $color = 'green'; } } if ($is_color_ftextscreen) { $object->addLine(sprintf('%s (%s)', Aastra_get_callerid_Asterisk($member), $queue), 'double', 'center', $color); } else { $object->addLine(sprintf('%s (%s)', Aastra_get_callerid_Asterisk($member), $queue), NULL, 'center'); } if ($is_color_ftextscreen) { $object->setScrollStart();