Example #1
0
 public static function display_phone($r, $nolink, $desc)
 {
     if ($nolink) {
         return $r[$desc['id']];
     }
     if (MOBILE_DEVICE && IPHONE && preg_match('/^([0-9\\t\\+-]+)/', $r[$desc['id']], $args)) {
         return '<a href="tel:' . $args[1] . '">' . $r[$desc['id']] . '</a>';
     }
     $num = $r[$desc['id']];
     if ($num && strpos($num, '+') === false) {
         if (isset($r['country']) && $r['country']) {
             $calling_code = Utils_CommonDataCommon::get_value('Calling_Codes/' . $r['country']);
             if ($calling_code) {
                 $num = $calling_code . $num;
             }
         }
     }
     return CRM_CommonCommon::get_dial_code($num);
 }
Example #2
0
 public static function display_phone($record, $nolink, $desc)
 {
     if ($record[$desc['id']] == '') {
         return '';
     }
     $num = $record[$desc['id']];
     if (!isset($record['customer']) || !$record['customer']) {
         return '---';
     }
     list($r, $id) = explode(':', $record['customer']);
     if ($r == 'P') {
         $contact = CRM_ContactsCommon::get_contact($id);
     } else {
         $contact = CRM_ContactsCommon::get_company($id);
     }
     $nr = '';
     switch ($num) {
         case 1:
             $id = 'mobile_phone';
             $nr = 'Mobile Phone';
             break;
         case 2:
             $id = 'work_phone';
             $nr = 'Work Phone';
             break;
         case 3:
             $id = 'home_phone';
             $nr = 'Home Phone';
             break;
         case 4:
             $id = 'phone';
             $nr = 'Phone';
             break;
     }
     if (!$nr) {
         return '';
     }
     if (!isset($contact[$id])) {
         return '---';
     }
     $number = $contact[$id];
     if ($number && strpos($number, '+') === false) {
         if ($contact['country']) {
             $calling_code = Utils_CommonDataCommon::get_value('Calling_Codes/' . $contact['country']);
             if ($calling_code) {
                 $number = $calling_code . ' ' . $number;
             }
         }
     }
     if (MOBILE_DEVICE && IPHONE) {
         return $nr[0] . ': ' . '<a href="tel:' . $number . '">' . $number . '</a>';
     }
     if ($nolink) {
         return $nr[0] . ': ' . $number;
     }
     return $nr[0] . ': ' . CRM_CommonCommon::get_dial_code($number);
 }