function engagements_get_from_phones
Search API
7.x engagements.module | engagements_get_from_phones($bool_mass_text_numbers = FALSE) |
6.x engagements.module | engagements_get_from_phones($bool_mass_text_numbers = FALSE) |
Get the available "from phone" numbers in an organized array structure.
7 calls to engagements_get_from_phones()
- engagements_display_advisee_engagements_page in modules/
engagements/ engagements.module - engagements_display_main in modules/
engagements/ engagements.module - displays the main Engagements tab, which shows the history of past engagements.
- engagements_get_from_phones_for_fapi in modules/
engagements/ engagements.module - Returns back the phone lines available.
- engagements_handle_incoming_sms in modules/
engagements/ engagements.module - This catches incoming sms messages from POST, but can also be used by our "sms_get_all_messages" function, but it is also used by the sms_get_all_messages to save/update information.
- engagements_perm in modules/
engagements/ engagements.module
File
- modules/
engagements/ engagements.module, line 1063 - This is the primary module file for the engagements module.
Code
function engagements_get_from_phones($bool_mass_text_numbers = FALSE)
{
$rtn = array();
$val = variable_get('sms_from_phone', '555-555-1234');
if ($bool_mass_text_numbers) {
$val = variable_get('sms_mass_phone', '800-555-1234');
}
$bool_default_set = FALSE;
$first_num = "";
$lines = explode("\n", $val);
foreach ($lines as $line) {
$line = trim($line);
if ($line == "") {
continue;
}
$temp = explode("~", $line);
$num = engagements_convert_to_valid_phone_number(trim($temp [0]));
$desc = @trim($temp [1]);
$default = @trim(strtolower($temp [2]));
if ($desc == '') {
$desc = $num;
}
if ($first_num == '') {
$first_num = $num;
}
$rtn ['lines'][$num] = array(
'num' => $num,
'description' => $desc,
'default' => $default,
);
if ($default == 'default') {
$rtn ['default'] = $rtn ['lines'][$num];
$bool_default_set = TRUE;
}
}
// Default not set, so use the first number.
if (!$bool_default_set) {
$rtn ['default'] = $rtn ['lines'][$first_num];
}
return $rtn;
}