public function uninstall() { CRM_CalendarCommon::delete_event_handler('Tasks'); CRM_RoundcubeCommon::delete_addon('task'); Utils_AttachmentCommon::delete_addon('task'); Base_ThemeCommon::uninstall_default_theme(CRM_TasksInstall::module_name()); Utils_RecordBrowserCommon::unregister_processing_callback('task', array('CRM_TasksCommon', 'submit_task')); Utils_RecordBrowserCommon::uninstall_recordset('task'); return true; }
public function uninstall() { CRM_CalendarCommon::delete_event_handler('Phonecalls'); CRM_RoundcubeCommon::delete_addon('phonecall'); Base_ThemeCommon::uninstall_default_theme(CRM_PhoneCallInstall::module_name()); Utils_AttachmentCommon::delete_addon('phonecall'); Utils_AttachmentCommon::persistent_mass_delete('phonecall/'); Utils_RecordBrowserCommon::unregister_processing_callback('phonecall', array('CRM_PhoneCallCommon', 'submit_phonecall')); Utils_RecordBrowserCommon::uninstall_recordset('phonecall'); return true; }
public function uninstall() { Utils_AttachmentCommon::delete_addon('crm_meeting'); Utils_RecordBrowserCommon::delete_addon('crm_meeting', CRM_MeetingInstall::module_name(), 'messanger_addon'); CRM_RoundcubeCommon::delete_addon('crm_meeting'); CRM_CalendarCommon::delete_event_handler('Meetings'); Base_ThemeCommon::uninstall_default_theme(CRM_MeetingInstall::module_name()); Utils_RecordBrowserCommon::uninstall_recordset('crm_meeting'); Utils_RecordBrowserCommon::unregister_processing_callback('crm_meeting', array('CRM_MeetingCommon', 'submit_meeting')); return true; }
public static function get_new_event_href($def, $id = 'none') { if (self::$last_added !== null) { if (is_numeric(self::$last_added)) { self::view_event('view', self::$last_added); } self::$last_added = null; } if (isset($_REQUEST['__add_event']) && $id == $_REQUEST['__add_event']) { unset($_REQUEST['__add_event']); self::view_event('add', $def); return array(); } return array('__add_event' => $id); }
public function body($args = array()) { $ev_mod = $this->init_module(CRM_Calendar_Event::module_name()); $ev_mod->help('Calendar Help', 'main'); if (isset($_REQUEST['search_date']) && is_numeric($_REQUEST['search_date']) && isset($_REQUEST['ev_id']) && is_numeric($_REQUEST['ev_id'])) { $default_date = intval($_REQUEST['search_date']); $this->view_event(intval($_REQUEST['ev_id'])); } else { $default_date = null; } $handlers = DB::GetAll('SELECT id, group_name, handler_callback FROM crm_calendar_custom_events_handlers'); $this->lp = $this->init_module('Utils_LeightboxPrompt'); $count = 0; foreach ($handlers as $v) { $callback = explode('::', $v['handler_callback']); if (!is_callable($callback)) { continue; } $new_events = call_user_func($callback, 'new_event_types'); if ($new_events !== null) { foreach ($new_events as $k => $w) { if (!is_array($w)) { $w = array('label' => $w, 'icon' => null); } $this->lp->add_option('new_event__' . $v['id'] . '__' . $k, $w['label'], $w['icon'], null); $count++; } } } if ($count < 2) { $this->lp = null; } else { $this->display_module($this->lp, array(__('New Event'), array('timestamp', 'timeless'), '', false)); $vals = $this->lp->export_values(); if ($vals) { $this->jump_to_new_event($vals['option'], $vals['params']['timestamp'], $vals['params']['timeless']); return; } } CRM_Calendar_EventCommon::$filter = CRM_FiltersCommon::get(); $args_defaults = array('default_view' => Base_User_SettingsCommon::get('CRM_Calendar', 'default_view'), 'first_day_of_week' => Utils_PopupCalendarCommon::get_first_day_of_week(), 'start_day' => Base_User_SettingsCommon::get('CRM_Calendar', 'start_day'), 'end_day' => Base_User_SettingsCommon::get('CRM_Calendar', 'end_day'), 'interval' => Base_User_SettingsCommon::get('CRM_Calendar', 'interval'), 'default_date' => $default_date, 'custom_agenda_cols' => array(array('name' => __('Type'), 'order' => 'cus_col_0', 'width' => 6, 'wrapmode' => 'nowrap'), __('Description'), __('Assigned to'), __('Related with'))); foreach ($args_defaults as $k => $v) { if (!isset($args[$k])) { $args[$k] = $args_defaults[$k]; } } if (isset($_REQUEST['jump_to_date']) && is_numeric($_REQUEST['jump_to_date']) && isset($_REQUEST['switch_to_tab']) && is_string($_REQUEST['switch_to_tab'])) { $args['default_date'] = $_REQUEST['jump_to_date']; $args['default_view'] = $_REQUEST['switch_to_tab']; } $theme = $this->init_module(Base_Theme::module_name()); $c = $this->init_module(Utils_Calendar::module_name(), array(CRM_Calendar_Event::module_name(), $args, array($this, 'get_new_event_href_js'))); $view_type = $c->get_current_view(); CRM_CalendarCommon::$mode = $view_type; $theme->assign('calendar', $this->get_html_of_module($c)); $theme->display(); $events = $c->get_displayed_events(); if (!empty($events['events'])) { switch ($view_type) { case 'Day': $view = __('Daily agenda'); break; case 'Month': $view = __('Monthly agenda'); break; case 'Week': $view = __('Weekly agenda'); break; case 'Agenda': $view = __('Agenda'); break; } if (isset($view)) { $pdf = $this->pack_module(Libs_TCPDF::module_name(), null, null, 'L'); if ($pdf->prepare()) { set_time_limit(0); $start = date('d F Y', Base_RegionalSettingsCommon::reg2time($events['start'])); $end = date('d F Y', Base_RegionalSettingsCommon::reg2time($events['end'])); $pdf->set_title($view . ', ' . $start . ($view_type != 'Day' ? ' - ' . $end : '')); $filter = CRM_FiltersCommon::get(); $me = CRM_ContactsCommon::get_my_record(); if (trim($filter, '()') == $me['id']) { $desc = $me['last_name'] . ' ' . $me['first_name']; } else { $desc = CRM_FiltersCommon::get_profile_desc(); } $pdf->set_subject(__('CRM Filters: %s', array($desc))); $pdf->prepare_header(); $pdf->AddPage(); foreach ($events['events'] as $v) { $ev_mod->make_event_PDF($pdf, $v, true, $view_type); } } $pdf->add_actionbar_icon($view); } } }
public function get_navigation_bar_additions() { $custom_handlers = CRM_CalendarCommon::get_event_handlers(); if (empty($custom_handlers)) { return ''; } $form = $this->init_module('Libs/QuickForm'); $elements_name = array(); $default = array(); foreach ($custom_handlers as $k => $v) { $form->addElement('checkbox', 'events_handlers__' . $k, $v, null, array('onclick' => 'calendar_event_handlers_changed=1;')); $elements_name[$k] = 'events_handlers__' . $k; $default[] = $k; } $form->addElement('hidden', 'event_handlers_changed', '', array('id' => 'event_handlers_changed')); eval_js('calendar_event_handlers_changed=0;'); eval_js('hide_calendar_event_handlers_popup = function() {' . 'if(var_hide_calendar_event_handlers_popup==1){' . '$("calendar_event_handlers_popup").style.display="none";' . '$("calendar_event_handlers_trigger").innerHTML=calendar_event_handlers_message_default;' . 'if(calendar_event_handlers_changed==1){' . $form->get_submit_form_js() . '$("calendar_event_handlers_trigger").innerHTML=calendar_event_handlers_message_processing;' . '}' . '}' . '}'); eval_js('show_calendar_event_handlers_popup = function() {' . '$("calendar_event_handlers_popup").style.display="";' . '$("calendar_event_handlers_trigger").innerHTML=calendar_event_handlers_message_confirm;' . '}'); $selected = $this->get_module_variable('events_handlers', $default); if ($form->validate()) { $vals = $form->exportValues(); $selected = array(); foreach ($elements_name as $k => $e) { if (isset($vals[$e]) && $vals[$e]) { $selected[] = $k; } } $this->set_module_variable('events_handlers', $selected); } CRM_Calendar_EventCommon::$events_handlers = $selected; foreach ($selected as $k => $e) { if (isset($elements_name[$e])) { $form->setDefaults(array($elements_name[$e] => true)); } } $label = 'Filter: Error'; $select_count = count($selected); if ($select_count == count($custom_handlers)) { $label = __('All'); } else { $label = __('Selection (%d)', array($select_count)); } if ($select_count == 1) { $label = $custom_handlers[reset($selected)]; } if ($select_count == 0) { $label = __('None'); } $theme = $this->init_module('Base/Theme'); $theme->assign('elements_name', $elements_name); $theme->assign('label', $label); eval_js('calendar_event_handlers_message_default="' . $label . '";'); eval_js('calendar_event_handlers_message_processing="' . __('Processing...') . '";'); eval_js('calendar_event_handlers_message_confirm="' . __('Save selection') . '";'); $form->assign_theme('form', $theme); ob_start(); $theme->display('custom_event_handlers_form'); $handlers_form = ob_get_clean(); return $handlers_form; }