Exemple #1
0
function get_user_config($user, $menu_source, $menu_mode)
{
    global $language;
    # Retrieve phone data
    $update = 0;
    $header = Aastra_decode_HTTP_header();
    $header['model'] = strtolower($header['model']);
    $is_softkeys_supported = Aastra_is_softkeys_supported();
    # Read all menu
    $all = Aastra_readINIfile($menu_source . '.menu', '#', '=');
    # Get user config
    if ($is_softkeys_supported and $menu_mode == 'dynamic') {
        $config = Aastra_get_user_context($user, 'mymenu' . '_' . $menu_source);
    } else {
        $config = NULL;
    }
    # File does not exist
    if ($config == NULL) {
        unset($all['RESERVED']);
        foreach ($all as $key => $value) {
            if ($value[$header['model']] == 'no') {
                unset($all[$key]);
            } else {
                $all[$key]['title'] = Aastra_get_label($all[$key]['title'], $language);
            }
        }
        Aastra_natsort2d($all, 'title');
        foreach ($all as $key => $value) {
            $config['menu'][] = $key;
        }
        if ($is_softkeys_supported and $menu_mode == 'dynamic') {
            $update = 1;
        }
    } else {
        # Read config file
        foreach ($config['menu'] as $key => $value) {
            if ($all[$value] == NULL or $all[$value][$header['model']] == 'no') {
                unset($config['menu'][$key]);
                $update = 1;
            }
        }
    }
    # Read final file
    if ($update == 1) {
        Aastra_save_user_context($user, 'mymenu' . '_' . $menu_source, $config);
        unset($config);
        $config = Aastra_get_user_context($user, 'mymenu' . '_' . $menu_source);
    }
    # Return array
    return $config;
}
 function render()
 {
     # Beginning of root tag
     $out = "<AastraIPPhoneTextMenu";
     # DestroyOnExit
     if ($this->_destroyOnExit == 'yes') {
         $out .= " destroyOnExit=\"yes\"";
     }
     # CancelAction
     if ($this->_cancelAction != "") {
         $cancelAction = $this->escape($this->_cancelAction);
         $out .= " cancelAction=\"{$cancelAction}\"";
     }
     # DefaultIndex
     if ($this->_defaultIndex != "") {
         $out .= " defaultIndex=\"{$this->_defaultIndex}\"";
     }
     # Style
     if ($this->_style != '') {
         $out .= " style=\"{$this->_style}\"";
     }
     # Beep
     if ($this->_beep == 'yes') {
         $out .= " Beep=\"yes\"";
     }
     # Lockin
     if ($this->_lockin != '') {
         $out .= " LockIn=\"{$this->_lockin}\"";
     }
     # WrapList
     if ($this->_wraplist == 'yes') {
         $out .= " wrapList=\"yes\"";
     }
     # AllowAnswer
     if ($this->_allowAnswer == 'yes') {
         $out .= " allowAnswer=\"yes\"";
     }
     # AllowDrop
     if ($this->_allowDrop == 'yes') {
         $out .= " allowDrop=\"yes\"";
     }
     # AllowXfer
     if ($this->_allowXfer == 'yes') {
         $out .= " allowXfer=\"yes\"";
     }
     # AllowConf
     if ($this->_allowConf == 'yes') {
         $out .= " allowConf=\"yes\"";
     }
     # Timeout
     if ($this->_timeout != 0) {
         $out .= " Timeout=\"{$this->_timeout}\"";
     }
     # Prevent list wrap
     if ($this->_scrollConstrain == 'yes') {
         $out .= " scrollConstrain=\"yes\"";
     }
     # Number selection
     if ($this->_numberLaunch == 'yes') {
         $out .= " numberLaunch=\"yes\"";
     }
     # Scrolls up/down
     if ($this->_scrollUp != '') {
         $out .= " scrollUp=\"" . $this->escape($this->_scrollUp) . "\"";
     }
     if ($this->_scrollDown != '') {
         $out .= " scrollDown=\"" . $this->escape($this->_scrollDown) . "\"";
     }
     # Unit scroll (6739i)
     if ($this->_unitScroll == 'yes') {
         $out .= " unitScroll=\"yes\"";
     }
     # End of root tag
     $out .= ">\n";
     # Title
     if ($this->_title != '') {
         $title = $this->escape($this->_title);
         $out .= "<Title";
         if ($this->_title_wrap == 'yes') {
             $out .= " wrap=\"yes\"";
         }
         $out .= ">" . $title . "</Title>\n";
     }
     # Menu items
     if (isset($this->_entries) && is_array($this->_entries)) {
         $index = 0;
         $base = NULL;
         $length = Aastra_size_display_line();
         $is_softkeys = Aastra_is_softkeys_supported();
         foreach ($this->_entries as $entry) {
             if ($entry->getBase() != NULL) {
                 $base = $entry->getBase();
             } else {
                 if ($base != NULL) {
                     if ($index < $this->_maxitems) {
                         $out .= $entry->render($this->_style, $length, $is_softkeys, $base);
                     }
                     $base = NULL;
                 } else {
                     if ($index < $this->_maxitems) {
                         $out .= $entry->render($this->_style, $length, $is_softkeys);
                     }
                 }
                 $index++;
             }
         }
     }
     # Softkeys
     if (isset($this->_softkeys) && is_array($this->_softkeys)) {
         foreach ($this->_softkeys as $softkey) {
             $out .= $softkey->render();
         }
     }
     # Icons
     if (isset($this->_icons) && is_array($this->_icons)) {
         $IconList = False;
         foreach ($this->_icons as $icon) {
             if (!$IconList) {
                 $out .= "<IconList>\n";
                 $IconList = True;
             }
             $out .= $icon->render();
         }
         if ($IconList) {
             $out .= "</IconList>\n";
         }
     }
     # End Tag
     $out .= "</AastraIPPhoneTextMenu>\n";
     # Return XML object
     return $out;
 }
Exemple #3
0
     $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]);
                 }
Exemple #4
0
     if ($index >= ($page - 1) * $MaxLines) {
         if ($action == 'list') {
             $object->addEntry($array[$index]['name'], $XML_SERVER . '?action=zoom&city=' . $array[$index]['index'] . '&user='******'&page=' . $page . '&selection=' . $selection, '');
         } else {
             $object->addEntry($array[$index]['name'], $XML_SERVER . '?action=set&city=' . $array[$index]['index'] . '&user='******'&rank=' . $rank, '');
         }
         if ($start == '') {
             $start = substr($array[$index]['name'], 0, 2);
         }
         $end = substr($array[$index]['name'], 0, 2);
         $selection++;
     }
     $index++;
 }
 $object->setTitle(sprintf(Aastra_get_label('World Clock (%s-%s)', $language), $start, $end));
 if (!Aastra_is_softkeys_supported() and $page != $last) {
     $object->addEntry(Aastra_get_label('Next Page', $language), $XML_SERVER . '?page=' . ($page + 1) . '&user='******'&action=' . $action . '&rank=' . $rank);
 }
 # Softkeys
 if ($nb_softkeys > 0) {
     if ($nb_softkeys == 6) {
         $object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select');
         if ($page != 1) {
             $object->addSoftkey('2', Aastra_get_label('Previous', $language), $XML_SERVER . '?page=' . ($page - 1) . '&user='******'&action=' . $action . '&rank=' . $rank);
         }
         if ($page != $last) {
             $object->addSoftkey('5', Aastra_get_label('Next', $language), $XML_SERVER . '?page=' . ($page + 1) . '&user='******'&action=' . $action . '&rank=' . $rank);
         }
         if ($action == 'list') {
             $object->addSoftkey('3', Aastra_get_label('Favorites', $language), $XML_SERVER . '?page=' . $page . '&user='******'&action=favorites');
         }
 function _setupSoftKeys()
 {
     if (Aastra_is_softkeys_supported()) {
         if (Aastra_phone_type() != 5) {
             # non 6739i
             $this->addSoftkey($this->_selectKeyPosition, Aastra_get_label($this->_selectKeyLabel, $this->_language), 'SoftKey:Select');
             if (!$this->_exitKeyDisabled) {
                 $this->addSoftkey($this->_exitKeyPosition, Aastra_get_label('Exit', $this->_language), 'SoftKey:Exit');
             }
             if (!empty($this->_backCancelURL)) {
                 $this->addSoftkey($this->_backKeyPosition, Aastra_get_label('Back', $this->_language), $this->_backCancelURL);
             }
         } else {
             # 6739i SoftKey:Select not yet supported
             #$this->addSoftkey($this->_selectKeyPosition, Aastra_get_label($this->_selectKeyLabel,$this->_language), 'SoftKey:Select',$this->_selectKeyIconIndex);
             if (!$this->_exitKeyDisabled) {
                 $this->addSoftkey($this->_exitKeyPosition, Aastra_get_label('Exit', $this->_language), 'SoftKey:Exit', $this->_exitKeyIconIndex);
             }
             if (!empty($this->_backCancelURL)) {
                 $this->addSoftkey($this->_backKeyPosition, Aastra_get_label('Back', $this->_language), $this->_backCancelURL, $this->_backKeyIconIndex);
             }
         }
     }
 }
$page = Aastra_getvar_safe('page', '1');
$index = Aastra_getvar_safe('index');
$selection = Aastra_getvar_safe('selection');
$action = Aastra_getvar_safe('action', 'input');
# Log call to the application
Aastra_trace_call('sugarCRM', 'lookup=' . $lookup . ', action=' . $action);
# Test User Agent
Aastra_test_phone_version('1.4.2.', 0);
# Test phone type
Aastra_test_phone_model(array('Aastra9112i', 'Aastra9133i'), False, 0);
# Retrieve phone information
$header = Aastra_decode_HTTP_header();
# Get Language
$language = Aastra_get_language();
# Get global compatibility
$is_softkeys = Aastra_is_softkeys_supported();
$is_icons = Aastra_is_icons_supported();
$is_style_textmenu = Aastra_is_style_textmenu_supported();
# Compute MaxLines
if ($is_softkeys) {
    $MaxLines = AASTRA_MAXLINES;
} else {
    $MaxLines = AASTRA_MAXLINES - 2;
}
# PROCESS Action
switch ($action) {
    # Input lookup
    case 'input':
        # Input object
        $object = new AastraIPPhoneInputScreen();
        $object->setTitle(Aastra_get_label('SugarCRM Lookup', $language));
 function _setupSoftKeys()
 {
     # Check if softkeys and the Dial2 softkey is supported. Don't put dial key on 6739i
     if (Aastra_is_softkeys_supported() && !Aastra_test_phone_version('2.0.1.', 1) && Aastra_phone_type() != 5) {
         $this->addSoftkey($this->_dialKeyPosition, Aastra_get_label('Dial', $this->_language), 'SoftKey:Dial2');
     }
     parent::_setupSoftKeys();
 }
Exemple #8
0
     if (isset($data['userdevice'])) {
         if ($data['userdevice'] == '1') {
             if ($AA_FREEPBX_MODE == '2') {
                 $object->addEntry($XML_SERVER . '?user='******'&action=register');
             }
             $data['userdevice'] = '0';
         }
     }
     if (isset($data['meetmejoin'])) {
         if ($data['meetmejoin'] == '1' and $AA_FREEPBX_MODE == '1' and Aastra_is_softkeys_supported()) {
             $object->addEntry($XML_SERVER_PATH . 'meetme.php?action=select&number=$$REMOTENUMBER$$&ext=' . $user);
             $data['meetmejoin'] = '0';
         }
     }
     if (isset($data['meetmeleave'])) {
         if ($data['meetmeleave'] == '1' and $AA_FREEPBX_MODE == '1' and Aastra_is_softkeys_supported()) {
             $object->addEntry('');
             $object->setTriggerDestroyOnExit('');
             $data['meetmeleave'] = '0';
         }
     }
     Aastra_save_user_context($user, 'notify', $data);
     break;
     # Message
 # Message
 case 'send':
     # Retrieve Message
     $data = Aastra_get_user_context($user, 'message');
     # Send message
     if ($data['long'] != '' and $data['short'] != '') {
         require_once 'AastraIPPhoneStatus.class.php';