function engagements_get_from_phones_for_fapi

6.x engagements.module engagements_get_from_phones_for_fapi($bool_return_all = TRUE, $account = NULL, $bool_only_mass_text_numbers = FALSE)

Returns back the phone lines available.

If bool_return_all == FALSE, it means we will first check to make sure the user (specified by account) has permission to send sms for that number.

4 calls to engagements_get_from_phones_for_fapi()
engagements_form_alter in modules/engagements/engagements.module
Implements hook_form_alter
engagements_get_user_notify_sms_receipt_values in modules/engagements/engagements.module
Get an array of numbers which the user should be notified of when they receive an SMS.
engagements_mass_sms_form in modules/engagements/engagements.module
user_edit_user_form in modules/user/user.module
Let the user edit a user's roles and other information.

File

modules/engagements/engagements.module, line 3016
This is the primary module file for the engagements module.

Code

function engagements_get_from_phones_for_fapi($bool_return_all = TRUE, $account = NULL, $bool_only_mass_text_numbers = FALSE) 
 {
  global $user;
  $rtn = array();

  if ($account == NULL) {
    $account = $user;
  }

  $phones = engagements_get_from_phones($bool_only_mass_text_numbers);
  $default = $phones ['default']['num'];
  $rtn [$default] = t("[Default] ") . engagements_convert_to_pretty_phone_number($default) . ' - ' . $phones ['default']['description'];

  foreach ($phones ['lines'] as $num => $details) {

    if (!isset($rtn [$details ['num']])) {
      $rtn [$details ['num']] = engagements_convert_to_pretty_phone_number($details ['num']) . " - " . $details ['description'];
    }
  }



  // if bool_return_all != TRUE, then make sure the account has permissing to send from each number.  If not, remove it.
  foreach ($rtn as $num => $details) {
    if (!$bool_return_all) {
      if (!$bool_only_mass_text_numbers && !user_has_permission("can_send_sms_from_$num", $account)) {
        unset($rtn [$num]);
      }
    }
  }



  return $rtn;
}