public function applet($conf, &$opts) { $opts['go'] = true; $opts['title'] = __('Meetings'); $me = CRM_ContactsCommon::get_my_record(); if ($me['id'] == -1) { CRM_ContactsCommon::no_contact_message(); return; } $closed = isset($conf['closed']) && $conf['closed']; $related = $conf['related']; $rb = $this->init_module('Utils/RecordBrowser', 'crm_meeting', 'crm_meeting'); $crits = array(); if (!$closed) { $crits['!status'] = array(2, 3); } if ($related == 0) { $crits['employees'] = array($me['id']); } if ($related == 1) { $crits['customers'] = array($me['id']); } if ($related == 2) { $crits['(employees'] = array($me['id']); $crits['|customers'] = array($me['id']); } $conds = array(array(array('field' => 'title', 'width' => 14, 'callback' => array('CRM_MeetingCommon', 'display_title_with_mark')), array('field' => 'status', 'width' => 4)), $crits, array('date' => 'ASC', 'time' => 'ASC', 'status' => 'ASC', 'priority' => 'DESC'), array('CRM_MeetingCommon', 'applet_info_format'), 15, $conf, &$opts); $opts['actions'][] = Utils_RecordBrowserCommon::applet_new_record_button('crm_meeting', array('employees' => array($me['id']), 'status' => 0, 'permission' => 0, 'priority' => CRM_CommonCommon::get_default_priority(), 'date' => $this->get_module_variable('date', date('Y-m-d')), 'time' => $this->get_module_variable('time', date('H:i:s')), 'duration' => 3600)); $this->display_module($rb, $conds, 'mini_view'); }
public function applet($conf, &$opts) { $opts['go'] = true; $rb = $this->init_module('Utils/RecordBrowser', 'phonecall', 'phonecall'); $me = CRM_ContactsCommon::get_my_record(); if ($me['id'] == -1) { CRM_ContactsCommon::no_contact_message(); return; } $crits = array('employees' => array($me['id']), '!status' => array(2, 3)); if (!isset($conf['past']) || !$conf['past']) { $crits['>=date_and_time'] = date('Y-m-d 00:00:00'); } if (!isset($conf['today']) || !$conf['today']) { $crits['(>=date_and_time'] = date('Y-m-d 00:00:00', strtotime('+1 day')); $crits['|<date_and_time'] = date('Y-m-d 00:00:00'); } if ($conf['future'] != -1) { $crits['<=date_and_time'] = date('Y-m-d 23:59:59', strtotime('+' . $conf['future'] . ' day')); } $conds = array(array(array('field' => 'contact_name', 'width' => 14), array('field' => 'phone_number', 'width' => 20), array('field' => 'status', 'width' => 8)), $crits, array('status' => 'ASC', 'date_and_time' => 'ASC', 'priority' => 'DESC'), array('CRM_PhoneCallCommon', 'applet_info_format'), 15, $conf, &$opts); $date = $this->get_module_variable('applet_date', date('Y-m-d H:i:s')); $opts['actions'][] = Utils_RecordBrowserCommon::applet_new_record_button('phonecall', array('date_and_time' => $date, 'employees' => array($me['id']), 'permission' => '0', 'status' => '0', 'priority' => CRM_CommonCommon::get_default_priority())); $this->display_module($rb, $conds, 'mini_view'); }
public function applet($conf, &$opts) { $opts['go'] = true; $opts['title'] = __('Tasks') . ($conf['related'] == 0 ? ' - ' . __('Todo') : '') . ($conf['related'] == 1 ? ' - ' . __('Related') : '') . ($conf['term'] == 's' ? ' - ' . __('Short-term') : ($conf['term'] == 'l' ? ' - ' . __('Long-term') : '')); $me = CRM_ContactsCommon::get_my_record(); if ($me['id'] == -1) { CRM_ContactsCommon::no_contact_message(); return; } $short = $conf['term'] == 's' || $conf['term'] == 'b'; $long = $conf['term'] == 'l' || $conf['term'] == 'b'; $related = $conf['related']; $rb = $this->init_module(Utils_RecordBrowser::module_name(), 'task', 'task'); $status = array(); foreach (Utils_CommonDataCommon::get_array('CRM/Status') as $status_id => $label) { if (isset($conf['status_' . $status_id]) && $conf['status_' . $status_id]) { $status[] = $status_id; } } $crits = array(); $crits['status'] = $status; if ($short && !$long) { $crits['!longterm'] = 1; } if (!$short && $long) { $crits['longterm'] = 1; } if ($related == 0) { $crits['employees'] = array($me['id']); } if ($related == 1) { $crits['customers'] = array($me['id']); } if ($related == 2) { $crits['(employees'] = array($me['id']); $crits['|customers'] = array($me['id']); } $conds = array(array(array('field' => 'title', 'width' => 20, 'callback' => array('CRM_TasksCommon', 'display_title_with_mark')), array('field' => 'deadline', 'width' => 10), array('field' => 'status', 'width' => 6)), $crits, array('deadline' => 'ASC', 'status' => 'ASC', 'priority' => 'DESC'), array('CRM_TasksCommon', 'applet_info_format'), 15, $conf, &$opts); $opts['actions'][] = Utils_RecordBrowserCommon::applet_new_record_button('task', array('employees' => array($me['id']), 'status' => 0, 'permission' => 0, 'priority' => CRM_CommonCommon::get_default_priority())); $this->display_module($rb, $conds, 'mini_view'); }