コード例 #1
0
ファイル: PhoneCallCommon_0.php プロジェクト: 62BRAINS/EPESI
 public static function applet_info_format($r)
 {
     if (isset($r['customer']) && $r['customer'] != '') {
         $customer = CRM_ContactsCommon::autoselect_company_contact_format($r['customer']);
         list($rset, $id) = explode(':', $r['customer']);
         $cus = Utils_RecordBrowserCommon::get_record($rset == 'P' ? 'contact' : 'company', $id);
         if (isset($r['phone']) && $r['phone'] != '') {
             $num = $r['phone'];
             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;
             }
             $phone = $nr . ': ' . (isset($cus[$id]) ? $cus[$id] : 'error');
         } else {
             $phone = __('Other') . ': ' . $r['other_phone_number'];
         }
     } else {
         $customer = $r['other_customer_name'];
         $phone = $r['other_phone_number'];
         $company = '---';
     }
     // Build array representing 2-column tooltip
     // Format: array (Label,value)
     $access = Utils_CommonDataCommon::get_translated_array('CRM/Access');
     $priority = Utils_CommonDataCommon::get_translated_array('CRM/Priority');
     $status = Utils_CommonDataCommon::get_translated_array('CRM/Status');
     $args = array(__('Call') => '<b>' . $phone . '</b>', __('Customer') => $customer, __('Subject') => '<b>' . $r['subject'] . '</b>', __('Description') => $r['description'], __('Assigned to') => CRM_ContactsCommon::display_contact(array('id' => $r['employees']), true, array('id' => 'id', 'param' => '::;CRM_ContactsCommon::contact_format_no_company')), __('Date and Time') => Base_RegionalSettingsCommon::time2reg($r['date_and_time']), __('Status') => $status[$r['status']], __('Permission') => $access[$r['permission']], __('Priority') => $priority[$r['priority']]);
     // Pass 2 arguments: array containing pairs: label/value
     // and the name of the group for translation
     $bg_color = '';
     switch ($r['priority']) {
         case 1:
             $bg_color = '#FFFFD5';
             break;
         case 2:
             $bg_color = '#FFD5D5';
             break;
     }
     $ret = array('notes' => Utils_TooltipCommon::format_info_tooltip($args));
     if ($bg_color) {
         $ret['row_attrs'] = 'style="background:' . $bg_color . ';"';
     }
     return $ret;
 }
コード例 #2
0
ファイル: TasksCommon_0.php プロジェクト: 62BRAINS/EPESI
 public static function applet_info_format($r)
 {
     // Build array representing 2-column tooltip
     // Format: array (Label,value)
     $access = Utils_CommonDataCommon::get_translated_array('CRM/Access');
     $priority = Utils_CommonDataCommon::get_translated_array('CRM/Priority');
     $status = Utils_CommonDataCommon::get_translated_array('CRM/Status');
     $contacts = array();
     $companies = array();
     $customers = '';
     foreach ($r['customers'] as $arg) {
         if ($customers) {
             $customers .= '<br>';
         }
         $customers .= CRM_ContactsCommon::autoselect_company_contact_format($arg);
     }
     $args = array(__('Task') => '<b>' . $r['title'] . '</b>', __('Description') => $r['description'], __('Assigned to') => CRM_ContactsCommon::display_contact(array('id' => $r['employees']), true, array('id' => 'id', 'param' => '::;CRM_ContactsCommon::contact_format_no_company')), __('Customers') => $customers, __('Status') => $status[$r['status']], __('Deadline') => $r['deadline'] != '' ? Base_RegionalSettingsCommon::time2reg($r['deadline'], false) : __('Not set'), __('Longterm') => $r['longterm'] != 0 ? __('Yes') : __('No'), __('Permission') => $access[$r['permission']], __('Priority') => $priority[$r['priority']]);
     $bg_color = '';
     switch ($r['priority']) {
         case 0:
             $bg_color = '#FFFFFF';
             break;
             // low priority
         // low priority
         case 1:
             $bg_color = '#FFFFD5';
             break;
             // medium
         // medium
         case 2:
             $bg_color = '#FFD5D5';
             break;
             // high
     }
     // Pass 2 arguments: array containing pairs: label/value
     // and the name of the group for translation
     //return	Utils_TooltipCommon::format_info_tooltip($args,'CRM_Tasks');
     $ret = array('notes' => Utils_TooltipCommon::format_info_tooltip($args));
     if ($bg_color) {
         $ret['row_attrs'] = 'style="background:' . $bg_color . ';"';
     }
     return $ret;
 }
コード例 #3
0
ファイル: Activities_0.php プロジェクト: cretzu89/EPESI
 public function display_activities($events, $tasks, $phonecalls)
 {
     $gb = $this->init_module(Utils_GenericBrowser::module_name(), 'activities', 'activities');
     $gb->set_table_columns(array(array('name' => __('Type'), 'wrapmode' => 'nowrap', 'width' => 8), array('name' => __('Subject'), 'width' => 20), array('name' => __('Date/Deadline'), 'wrapmode' => 'nowrap', 'width' => 8), array('name' => __('Employees'), 'width' => 11), array('name' => __('Customers'), 'width' => 11), array('name' => __('Attachments'), 'width' => 4)));
     $amount = 0;
     if ($this->display['events']) {
         $amount += count($events);
     }
     if ($this->display['tasks']) {
         $amount += count($tasks);
     }
     if ($this->display['phonecalls']) {
         $amount += count($phonecalls);
     }
     $limit = $gb->get_limit($amount);
     for ($i = 0; $i < $limit['offset'] + $limit['numrows'] && $i < $amount; $i++) {
         if ($this->display['events'] && count($events)) {
             $ev = current($events);
         } else {
             $ev = array('start' => -1);
         }
         if ($this->display['tasks'] && count($tasks)) {
             $t = current($tasks);
             if (!$t['deadline']) {
                 $t['deadline'] = 0;
             } else {
                 $t['deadline'] = strtotime($t['deadline']);
             }
         } else {
             $t = array('deadline' => -1);
         }
         if ($this->display['phonecalls'] && count($phonecalls)) {
             $ph = current($phonecalls);
             $ph['date_and_time'] = strtotime($ph['date_and_time']);
         } else {
             $ph = array('date_and_time' => -1);
         }
         $maxt = max($ev['start'], $t['deadline'], $ph['date_and_time']);
         $gb_row = $gb->get_new_row();
         if ($ev['start'] == $maxt) {
             $v = array_shift($events);
             if ($i >= $limit['offset'] && $v) {
                 if (isset($v['view_action'])) {
                     $view_href = $v['view_action'];
                 } else {
                     $view_href = $this->create_callback_href(array($this, 'view_event'), array($v['id']));
                 }
                 $title = '<a ' . $view_href . '>' . $v['title'] . '</a>';
                 if (isset($v['description']) && $v['description'] != '') {
                     $title = '<span ' . Utils_TooltipCommon::open_tag_attrs($v['description'], false) . '>' . $title . '</span>';
                 }
                 $gb_row->add_info(Utils_RecordBrowserCommon::get_html_record_info('crm_meeting', $v['id']));
                 $gb_row->add_data(__('Meeting'), $title, Base_RegionalSettingsCommon::time2reg($v['start'], $v['duration'] == -1 ? false : 2), CRM_ContactsCommon::display_contact(array('employees' => $v['employees']), false, array('id' => 'employees', 'param' => ';CRM_ContactsCommon::contact_format_no_company')), CRM_ContactsCommon::display_company_contact(array('customers' => $v['customers']), false, array('id' => 'customers', 'param' => ';::')), Utils_AttachmentCommon::count('crm_meeting/' . $v['id']));
             }
         } elseif ($t['deadline'] == $maxt) {
             $v = array_shift($tasks);
             $v = Utils_RecordBrowserCommon::filter_record_by_access('task', $v);
             if ($i >= $limit['offset'] && $v) {
                 $gb_row->add_info(Utils_RecordBrowserCommon::get_html_record_info('task', $v['id']));
                 $gb_row->add_data(__('Task'), CRM_TasksCommon::display_title($v, false), !isset($v['deadline']) || !$v['deadline'] ? __('No deadline') : Base_RegionalSettingsCommon::time2reg($v['deadline'], false, true, false), CRM_ContactsCommon::display_contact($v, false, array('id' => 'employees', 'param' => ';CRM_ContactsCommon::contact_format_no_company')), CRM_ContactsCommon::display_company_contact($v, false, array('id' => 'customers')), Utils_AttachmentCommon::count('task/' . $v['id']));
             }
         } else {
             $v = array_shift($phonecalls);
             $v = Utils_RecordBrowserCommon::filter_record_by_access('phonecall', $v);
             if ($i >= $limit['offset'] && $v) {
                 $gb_row->add_info(Utils_RecordBrowserCommon::get_html_record_info('phonecall', $v['id']));
                 $gb_row->add_data(__('Phonecall'), CRM_PhoneCallCommon::display_subject($v), Base_RegionalSettingsCommon::time2reg($v['date_and_time'], 2), CRM_ContactsCommon::display_contact($v, false, array('id' => 'employees', 'param' => ';CRM_ContactsCommon::contact_format_no_company')), CRM_PhoneCallCommon::display_contact_name($v, false), Utils_AttachmentCommon::count('phonecall/' . $v['id']));
             }
         }
     }
     $this->display_module($gb);
 }