function engagements_sms_replace_patterns
Search API
7.x engagements.module | engagements_sms_replace_patterns($str, $from_mobile = "", $account = NULL) |
6.x engagements.module | engagements_sms_replace_patterns($str, $from_mobile = "", $account = NULL) |
2 calls to engagements_sms_replace_patterns()
- engagements_form_alter in modules/
engagements/ engagements.module - Implements hook_form_alter
- engagements_send_email_or_txt_form_submit in modules/
engagements/ engagements.module
File
- modules/
engagements/ engagements.module, line 1022 - This is the primary module file for the engagements module.
Code
function engagements_sms_replace_patterns($str, $from_mobile = "", $account = NULL)
{
global $user;
if ($account == NULL) {
$account = $user;
}
$school_id = 0;
$school_name = "";
if (function_exists('schools_menu')) {
$school_id = schools_get_school_id_for_user($account->id);
$school_name = schools_get_school_name_for_id($school_id);
}
$name = $account->f_name . " " . $account->l_name;
$line_desc = $line_desc_trimmed = t("Num/Dept Description");
$phones = engagements_get_from_phones();
if ($from_mobile == "") {
$from_mobile = $phones ['default']['num']; // use default if it was left blank
}
if ($from_mobile) {
$line_desc = @$phones ['lines'][$from_mobile]['description'];
$line_desc_trimmed = substr($line_desc, 0, 20);
}
$str = str_ireplace("@initials", variable_get_for_school('school_initials', '', $school_id), $str);
$str = str_ireplace("@school", $school_name, $str);
$str = str_ireplace("@name", $name, $str);
$str = str_ireplace("@line-desc-trimmed", $line_desc_trimmed, $str);
$str = str_ireplace("@line-desc", $line_desc, $str);
return $str;
}