本文整理汇总了PHP中Aastra_save_user_context函数的典型用法代码示例。如果您正苦于以下问题:PHP Aastra_save_user_context函数的具体用法?PHP Aastra_save_user_context怎么用?PHP Aastra_save_user_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Aastra_save_user_context函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_user_config
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;
}
示例2: get_user_config
function get_user_config($user)
{
global $asterisk;
if ($asterisk) {
$array_user = Aastra_get_user_context(Aastra_get_userdevice_Asterisk($user), 'contacts');
} else {
$array_user = Aastra_get_user_context($user, 'contacts');
}
if ($array_user['display'] == '') {
$array_user['display'] = 'firstlast';
}
if ($array_user['sort'] == '') {
$array_user['sort'] = 'first';
}
if ($asterisk) {
Aastra_save_user_context(Aastra_get_userdevice_Asterisk($user), 'contacts', $array_user);
} else {
Aastra_save_user_context($user, 'contacts', $array_user);
}
return $array_user;
}
示例3: Aastra_propagate_daynight_Asterisk
function Aastra_propagate_daynight_Asterisk($device, $index)
{
global $ASTERISK_LOCATION;
# Get the list of devices
$sip_array = Aastra_readINIfile($ASTERISK_LOCATION . 'sip_additional.conf', ';', '=');
foreach ($sip_array as $key => $value) {
if ($value['callerid'] != '') {
$array_device[] = $key;
}
}
# Remove current device
$array_device = array_flip($array_device);
unset($array_device[$device]);
unset($array_device['']);
$array_device = array_flip($array_device);
# Remove the devices without the application
foreach ($array_device as $key => $value) {
if (!Aastra_is_daynight_notify_allowed_Asterisk(Aastra_get_userdevice_Asterisk($value), $index)) {
unset($array_device[$key]);
} else {
$data = Aastra_get_user_context($value, 'notify');
$data['daynight'] = '1';
Aastra_save_user_context($value, 'notify', $data);
}
}
# Send Notification
Aastra_send_SIP_notify_Asterisk('aastra-xml', $array_device);
}
示例4: Aastra_store_signature
function Aastra_store_signature($user)
{
# Store the signature
$header = Aastra_decode_HTTP_header();
$signature['mac'] = $header['mac'];
$signature['ip'] = $header['ip'];
$signature['model'] = $header['model'];
$signature['signature'] = Aastra_getphone_fingerprint();
Aastra_save_user_context($user, 'signature', $signature);
}
示例5: Aastra_get_label
if ($data['last'] != NULL) {
$object->setDefault($data['last']);
}
if ($nb_softkeys) {
if ($nb_softkeys == 6) {
$object->addSoftkey('1', Aastra_get_label('Backspace', $language), 'SoftKey:BackSpace');
$object->addSoftkey('5', Aastra_get_label('Submit', $language), 'SoftKey:Submit');
$object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
} else {
$object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
}
}
} else {
# Save last value requested
$data['last'] = $zip;
Aastra_save_user_context($user, 'weather', $data);
# Test if we need to regenerate the static pages
$generate = 0;
$file_name = AASTRA_PATH_CACHE . 'w-' . $zip . '.rss';
if (!file_exists($file_name)) {
$generate = 1;
} else {
if (time() - filemtime($file_name) > 4 * 3600) {
$generate = 1;
}
}
# If need to generate
if ($generate == 1) {
# Check if target directory is present
if (!is_dir(AASTRA_PATH_CACHE)) {
@mkdir(AASTRA_PATH_CACHE);
示例6: update_user_config
function update_user_config($user, $array_key, $header, $selection1, $selection2 = NULL, $type = 'key')
{
# No special key yet
$special = False;
# Retrieve current configuration
$array_temp = Aastra_readINIfile(AASTRA_TFTP_DIRECTORY . '/' . $header['mac'] . '.cfg', '#', ':');
$array_user = $array_temp[''];
# Prepare process of both keys
if ($selection2) {
$array_selection = array($selection1, $selection2);
} else {
$array_selection = array($selection1);
}
# Process both changes
foreach ($array_selection as $selection) {
# Key update
if ($type == 'key') {
# Update selection
if ($array_key[$selection]['type'] != '' and $array_key[$selection]['type'] != 'empty') {
# XML?
if ($array_key[$selection]['type'] == 'xml') {
$special = True;
}
# Update configuration (MAC.cfg)
$array_user[$selection . ' type'] = $array_key[$selection]['type'];
$array_user[$selection . ' value'] = $array_key[$selection]['value'];
$array_user[$selection . ' label'] = $array_key[$selection]['label'];
if ($array_key[$selection]['states'] != '') {
$array_user[$selection . ' states'] = $array_key[$selection]['states'];
} else {
unset($array_user[$selection . ' states']);
}
if ($array_key[$selection]['locked'] != '') {
$array_user[$selection . ' locked'] = $array_key[$selection]['locked'];
} else {
unset($array_user[$selection . ' locked']);
}
# Update configuration (dynamic)
$array_update[] = array('param' => $selection . ' type', 'value' => $array_user[$selection . ' type']);
$array_update[] = array('param' => $selection . ' value', 'value' => $array_user[$selection . ' value']);
$array_update[] = array('param' => $selection . ' label', 'value' => $array_user[$selection . ' label']);
if ($array_key[$selection]['states'] != '') {
$array_update[] = array('param' => $selection . ' states', 'value' => $array_user[$selection . ' states']);
}
if ($array_key[$selection]['locked'] != '') {
$array_update[] = array('param' => $selection . ' locked', 'value' => $array_user[$selection . ' locked']);
}
} else {
# Maybe we changed a special key
if ($array_user[$selection . ' type'] == 'xml') {
$special = True;
}
# Key is not programmed but maybe locked
if ($array_key[$selection]['type'] == '') {
unset($array_user[$selection . ' type']);
} else {
$array_user[$selection . ' type'] = 'empty';
}
if ($array_key[$selection]['locked'] == '1') {
$array_user[$selection . ' locked'] = $array_key[$selection]['locked'];
} else {
unset($array_user[$selection . ' locked']);
}
unset($array_user[$selection . ' value']);
unset($array_user[$selection . ' label']);
unset($array_user[$selection . ' states']);
# Update array
$array_update[] = array('param' => $selection . ' type', 'value' => $array_user[$selection . ' type']);
$array_update[] = array('param' => $selection . ' value', 'value' => '');
$array_update[] = array('param' => $selection . ' label', 'value' => '');
$array_update[] = array('param' => $selection . ' locked', 'value' => $array_user[$selection . ' locked']);
$array_update[] = array('param' => $selection . ' states', 'value' => '');
}
} else {
# Update parameter
$array_user[$selection] = $array_key[$selection]['value'];
$array_update[] = array('param' => $selection, 'value' => $array_key[$selection]['value']);
}
}
# Update MAC.cfg
$write = @fopen(AASTRA_TFTP_DIRECTORY . '/' . $header['mac'] . '.cfg', 'w');
if ($write) {
# Dump the config file
foreach ($array_user as $key => $value) {
fputs($write, $key . ': ' . $value . "\n");
}
# Close the MAC.cfg file
fclose($write);
# Update the user keys
$keys = Aastra_get_user_context($user, 'keys');
foreach ($array_user as $key => $value) {
if (stristr($key, 'key')) {
$array_keys[$key] = $value;
}
if (stristr($key, 'expmod') and stristr($key, 'page')) {
$array_keys[$key] = $value;
}
}
$keys[$header['model']] = $array_keys;
Aastra_save_user_context($user, 'keys', $keys);
//.........这里部分代码省略.........
示例7: Aastra_get_user_context
if ($bdate == '') {
$date = Aastra_get_user_context($user, 'biorhytm');
$object = new AastraIPPhoneInputScreen();
$object->setTitle(Aastra_get_label('Biorhythms', $language));
$object->setPrompt(Aastra_get_label('Birth Date (MM/DD/YYYY)', $language));
$object->setParameter('bdate');
$object->setType('dateUS');
$object->setURL($XML_SERVER);
$object->setDefault($date);
$object->setDestroyOnExit();
if ($nb_softkeys == 10) {
$object->addSoftkey('10', Aastra_get_label('Exit', $language), "SoftKey:Exit");
}
} else {
# Save user context
Aastra_save_user_context($user, 'biorhytm', $bdate);
# Extract day/month/year
$birthMonth = substr($bdate, 0, 2);
$birthDay = substr($bdate, 3, 2);
$birthYear = substr($bdate, 6, 4);
# check date for validity, display error message if invalid
if (!@checkDate($birthMonth, $birthDay, $birthYear)) {
# Display error message
$object = new AastraIPPhoneTextScreen();
$object->setTitle(Aastra_get_label('Invalid Birth Date', $language));
$object->setText(Aastra_get_label('Please enter a valid Birth Date.', $language));
} else {
# calculate the number of days this person is alive
$daysGone = abs(gregorianToJD($birthMonth, $birthDay, $birthYear) - gregorianToJD(date("m"), date("d"), date("Y")));
# Get the results
$array = getResults();
示例8: AastraIPPhoneTextMenu
# Create list
$object = new AastraIPPhoneTextMenu();
$summary = False;
$object->setTitle(Aastra_get_label('Watch List', $language));
for ($i = 0; $i < AASTRA_MAXLINES; $i++) {
if ($data['favorites'][$i]['source'] == '' or $data['favorites'][$i]['target'] == '') {
$object->addEntry('...........................', $XML_SERVER . '&action=inputfav1&selection=' . $i, $i);
$data['favorites'][$i]['source'] = '';
$data['favorites'][$i]['target'] = '';
} else {
$object->addEntry(sprintf(Aastra_get_label('%s to %s', $language), $data['favorites'][$i]['source'], $data['favorites'][$i]['target']), $XML_SERVER . '&action=displayfav&selection=' . $i, $i);
$summary = True;
}
}
# Update user favorites
Aastra_save_user_context($user, 'currency', $data);
# Set default index
if ($default != '') {
$object->setDefaultIndex($default);
}
# Add softkeys
if ($nb_softkeys == 6) {
# Regular phone
if ($page == '0') {
$object->addSoftkey('1', Aastra_get_label('Select', $language), 'SoftKey:Select');
$object->addSoftkey('2', Aastra_get_label('Move Up', $language), $XML_SERVER . '&action=up');
if ($summary) {
$object->addSoftkey('3', Aastra_get_label('Summary', $language), $XML_SERVER . '&action=summary');
}
$object->addSoftkey('4', Aastra_get_label('Edit', $language), $XML_SERVER . '&action=inputfav1&choice=fav1');
$object->addSoftkey('5', Aastra_get_label('Move Down', $language), $XML_SERVER . '&action=down');
示例9: Aastra_get_label
$object->setCancelAction($XML_SERVER . '&action=input');
$object->addSoftkey('10', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
}
}
break;
# Display result
# Display result
case 'display':
case 'displayfav':
# Retrieve cached data
$data = Aastra_get_user_context($user, 'stock');
# Simple lookup
if ($action == 'display') {
# Save the last request
$data['last'] = $symbol;
Aastra_save_user_context($user, 'stock', $data);
# Prepare request
$array[0] = $symbol;
} else {
# Prepare request
$array[0] = $data['favorites'][$selection];
}
# Process request
$return = get_quote($array);
# Return OK
if ($return[0]) {
# Can we use a formatted text screen
if (Aastra_is_formattedtextscreen_supported()) {
# Get size of the screen
$nb_carac = Aastra_size_display_line();
# Create the object
示例10: Aastra_get_callerid_Asterisk
$secret = $password;
}
$callerid = Aastra_get_callerid_Asterisk($extension);
# Get user/device profile
$profile = Aastra_get_startup_profile_Asterisk($extension);
# Create mac.cfg
if (create_mac($header['mac'], $extension, $username, $secret, $callerid, $header['model'], $profile, $tz_name, $tz_code, $cl, $lang)) {
# If override
if ($action == 'override') {
# Send a SIP notify
if (Aastra_is_user_registered_Asterisk($extension)) {
if (Aastra_is_dynamic_sip_supported($ext_array[$extension]) or $ext_array[$extension]['model'] == 'Aastra8000i') {
$notify_type = 'aastra-xml';
$notify = Aastra_get_user_context($extension, 'notify');
$notify['forced_logout'] = '1';
Aastra_save_user_context($extension, 'notify', $notify);
} else {
Aastra_delete_mac($ext_array[$extension]['mac']);
$notify_type = 'aastra-check-cfg';
}
Aastra_send_SIP_notify_Asterisk($notify_type, array($extension));
} else {
if ($ext_array[$extension]['model'] != 'Aastra8000i') {
Aastra_delete_mac($ext_array[$extension]['mac']);
}
}
# Send an email
Aastra_send_HDmail($ext_array[$extension], $callerid, 'FORCED LOGOUT', $AA_EMAIL, $AA_SENDER);
}
# Update config file
Aastra_update_HDconfig_file(AASTRA_PATH_CACHE . 'startup_asterisk.cfg', $extension, $header);
示例11: Aastra_save_user_context
}
}
}
for ($i = 1; $i <= $last; $i++) {
$object->addEntry($XML_SERVER . '&action=configuration&page=' . $i);
}
$object->addEntry($array_config['action uri startup']);
# Clear the critical keys
Aastra_save_user_context($user, 'cfwd', NULL);
Aastra_save_user_context($user, 'dnd', NULL);
Aastra_save_user_context($user, 'daynight', NULL);
Aastra_save_user_context($user, 'away', NULL);
Aastra_save_user_context($user, 'agent', NULL);
Aastra_save_user_context($user, 'follow', NULL);
Aastra_save_user_context($user, 'parking', NULL);
Aastra_save_user_context($user, 'vmail', NULL);
} else {
# Erase mac.cfg
Aastra_delete_mac($header['mac']);
# Reboot needed
require_once 'AastraIPPhoneExecute.class.php';
$object = new AastraIPPhoneExecute();
# Bug 673i
if ($header['model'] != 'Aastra6739i') {
$object->addEntry($XML_SERVER . '&action=display');
} else {
$object->setTriggerDestroyOnExit();
}
if (Aastra_is_local_reset_supported() and $header['model'] != 'Aastra6739i') {
$object->addEntry('Command: ClearCallersList');
$object->addEntry('Command: ClearDirectory');
示例12: Aastra_manage_dnd_Asterisk
# Initial or recurrent check
# Initial or recurrent check
case 'check':
case 'register':
# Update needed
$update = 1;
# Get current DND status
$dnd = Aastra_manage_dnd_Asterisk($user, 'get');
# Get last DND status
$data = Aastra_get_user_context($user, 'dnd');
$last = $data['last'];
$key = $data['key'];
# Save DND status
$data['last'] = $dnd;
if ($dnd != $last) {
Aastra_save_user_context($user, 'dnd', $data);
}
# Update needed?
if ($action == 'check' and $dnd == $last) {
$update = 0;
}
if ($action == 'register' and $dnd == 0) {
$update = 0;
}
# Prepare display update
require_once 'AastraIPPhoneExecute.class.php';
$object = new AastraIPPhoneExecute();
if ($update == 1) {
# Change msg status
$object->addEntry($XML_SERVER . '&action=msg&status=' . $dnd);
# Change LED if supported
示例13: Aastra_get_startup_profile_Asterisk
# credentials OK
if (Aastra_check_user_login_Asterisk($user, $password)) {
# Retrieve user template
$profile = Aastra_get_startup_profile_Asterisk($user);
if (file_exists($profile . '-device-user.prf')) {
# Store language if needed
if ($lang != '') {
$data['language'] = $lang;
$data['code'] = $cl;
$array_wl = array('fr' => 'French', 'it' => 'Italian', 'es' => 'Spanish', 'en' => 'English', 'de' => 'German', 'pt' => 'Portuguese');
if ($array_wl[substr($lang, 0, 2)] != '') {
$data['clear'] = $array_wl[substr($lang, 0, 2)];
} else {
$data['clear'] = '';
}
Aastra_save_user_context($device, 'language', $data);
}
# Trigger a sync on the phone
$object = new AastraIPPhoneExecute();
$object->setTriggerDestroyOnExit();
$object->addEntry('Dial:loguser' . $user);
} else {
# Display error as a TextScreen
$object = new AastraIPPhoneTextScreen();
$object->setDestroyOnExit();
$object->setTitle(Aastra_get_label('Configuration error', $language));
$object->setText(Aastra_get_label('Configuration file cannot be generated. Please contact your administrator.', $language));
if ($nb_softkeys) {
if ($nb_softkeys == 6) {
$object->addSoftkey('6', Aastra_get_label('Exit', $language), 'SoftKey:Exit');
} else {
示例14: Aastra_get_user_context
# Update needed
$update = 1;
# Get global status
if (is_agent_logged($agent)) {
$status = 1;
} else {
$status = 0;
}
# Get last agent status
$data = Aastra_get_user_context($agent, 'agent');
$last = $data['last'];
$key = $data['key'];
# Save status if changed
if ($status != $last) {
$data['last'] = $status;
Aastra_save_user_context($agent, 'agent', $data);
}
# Update needed?
if ($action == 'check' and $status == $last) {
$update = 0;
}
if ($action == 'register' and $status == 0) {
$update = 0;
}
# Prepare display update
require_once 'AastraIPPhoneExecute.class.php';
$object = new AastraIPPhoneExecute();
# Update LED if necessary
if ($key != '' and Aastra_is_ledcontrol_supported() and $update == 1) {
if ($status == 1) {
$object->addEntry('Led: ' . $key . '=on');
示例15: Aastra_get_label
$object->addSoftkey('10', Aastra_get_label('Close', $language), $XML_SERVER . '&action=edit&selection=' . $selection . '&input1=' . $input1 . '&input2=' . $input2 . '&input3=' . $input3 . '&input4=' . $input4 . '&input5=' . $input5);
}
} else {
$object->setDoneAction($XML_SERVER . '&action=edit&selection=' . $selection);
}
} else {
# Update user data
$data[$selection]['name'] = $input1;
$data[$selection]['work'] = $input2;
$data[$selection]['mobile'] = $input3;
$data[$selection]['home'] = $input4;
$data[$selection]['other'] = $input5;
if ($asterisk) {
$data = Aastra_save_user_context(Aastra_get_userdevice_Asterisk($user), 'speed', $data);
} else {
Aastra_save_user_context($user, 'speed', $data);
}
# Back to the list
require_once 'AastraIPPhoneExecute.class.php';
$object = new AastraIPPhoneExecute();
$object->addEntry($XML_SERVER . '&action=list&selection=' . $selection);
}
break;
# EDIT
# EDIT
case 'edit':
# Multiple input fields?
if (Aastra_is_multipleinputfields_supported()) {
# Input Screen
require_once 'AastraIPPhoneInputScreen.class.php';
$object = new AastraIPPhoneInputScreen();