コード例 #1
0
ファイル: Task.php プロジェクト: bhirsch/civicrm
 static function initTasks()
 {
     if (!self::$_tasks) {
         self::$_tasks = array(1 => array('title' => ts('Add Contacts to Group'), 'class' => 'CRM_Contact_Form_Task_AddToGroup', 'result' => true), 2 => array('title' => ts('Remove Contacts from Group'), 'class' => 'CRM_Contact_Form_Task_RemoveFromGroup', 'result' => true), 3 => array('title' => ts('Tag Contacts (assign tags)'), 'class' => 'CRM_Contact_Form_Task_AddToTag', 'result' => true), 4 => array('title' => ts('Untag Contacts (remove tags)'), 'class' => 'CRM_Contact_Form_Task_RemoveFromTag', 'result' => true), 5 => array('title' => ts('Export Contacts'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => false), 6 => array('title' => ts('Send Email to Contacts'), 'class' => 'CRM_Contact_Form_Task_Email', 'result' => false), 7 => array('title' => ts('Send SMS to Contacts'), 'class' => 'CRM_Contact_Form_Task_SMS', 'result' => true), 8 => array('title' => ts('Delete Contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => false), 11 => array('title' => ts('Record Activity for Contacts'), 'class' => 'CRM_Activity_Form_Activity', 'result' => true), 13 => array('title' => ts('New Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch', 'result' => true), 14 => array('title' => ts('Update Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch_Update', 'result' => true), 15 => array('title' => ts('Print Contacts'), 'class' => 'CRM_Contact_Form_Task_Print', 'result' => false), 16 => array('title' => ts('Mailing Labels'), 'class' => 'CRM_Contact_Form_Task_Label', 'result' => true), 17 => array('title' => ts('Batch Update via Profile'), 'class' => array('CRM_Contact_Form_Task_PickProfile', 'CRM_Contact_Form_Task_Batch'), 'result' => true), 19 => array('title' => ts('Print PDF Letter for Contacts'), 'class' => 'CRM_Contact_Form_Task_PDF', 'result' => true), 21 => array('title' => ts('Merge Contacts'), 'class' => 'CRM_Contact_Form_Task_Merge', 'result' => true));
         if (CRM_Contact_BAO_ContactType::isActive('Household')) {
             $label = CRM_Contact_BAO_ContactType::getLabel('Household');
             self::$_tasks[9] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToHousehold', 'result' => true);
         }
         if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
             $label = CRM_Contact_BAO_ContactType::getLabel('Organization');
             self::$_tasks[10] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToOrganization', 'result' => true);
         }
         //CRM-4418, check for delete
         if (!CRM_Core_Permission::check('delete contacts')) {
             unset(self::$_tasks[8]);
         }
         //show map action only if map provider and key is set
         $config =& CRM_Core_Config::singleton();
         if ($config->mapProvider && $config->mapAPIKey) {
             self::$_tasks[12] = array('title' => ts('Map Contacts'), 'class' => 'CRM_Contact_Form_Task_Map', 'result' => false);
         }
         if (CRM_Core_Permission::access('CiviEvent')) {
             self::$_tasks[18] = array('title' => ts('Add Contacts to Event'), 'class' => 'CRM_Event_Form_Participant', 'result' => true);
         }
         if (CRM_Core_Permission::access('CiviMail')) {
             self::$_tasks[20] = array('title' => ts('Schedule/Send a Mass Mailing'), 'class' => array('CRM_Mailing_Form_Group', 'CRM_Mailing_Form_Settings', 'CRM_Mailing_Form_Upload', 'CRM_Mailing_Form_Test', 'CRM_Mailing_Form_Schedule'), 'result' => false);
         }
         self::$_tasks += CRM_Core_Component::taskList();
         require_once 'CRM/Utils/Hook.php';
         CRM_Utils_Hook::searchTasks('contact', self::$_tasks);
         asort(self::$_tasks);
     }
 }
コード例 #2
0
ファイル: Individual.php プロジェクト: bhirsch/voipdev
 /**
  * This function provides the HTML form elements that are specific to the Individual Contact Type
  * 
  * @access public
  * @return None 
  */
 public function buildQuickForm(&$form, $action = null)
 {
     $form->applyFilter('__ALL__', 'trim');
     //prefix
     $prefix = CRM_Core_PseudoConstant::individualPrefix();
     if (!empty($prefix)) {
         $form->addElement('select', 'prefix_id', ts('Prefix'), array('' => '') + $prefix);
     }
     $attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact');
     // first_name
     $form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name']);
     //middle_name
     $form->addElement('text', 'middle_name', ts('Middle Name'), $attributes['middle_name']);
     // last_name
     $form->addElement('text', 'last_name', ts('Last Name'), $attributes['last_name']);
     // suffix
     $suffix = CRM_Core_PseudoConstant::individualSuffix();
     if ($suffix) {
         $form->addElement('select', 'suffix_id', ts('Suffix'), array('' => '') + $suffix);
     }
     // nick_name
     $form->addElement('text', 'nick_name', ts('Nick Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'nick_name'));
     // job title
     // override the size for UI to look better
     $attributes['job_title']['size'] = 30;
     $form->addElement('text', 'job_title', ts('Job title'), $attributes['job_title'], 'size="30"');
     if ($action & CRM_Core_Action::UPDATE) {
         $mailToHouseholdID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $form->_contactId, 'mail_to_household_id', 'id');
         $form->assign('mailToHouseholdID', $mailToHouseholdID);
     }
     //Shared Address Element
     require_once 'CRM/Contact/BAO/ContactType.php';
     if (CRM_Contact_BAO_ContactType::isActive('Household')) {
         $label = CRM_Contact_BAO_ContactType::getLabel('Household');
         $form->addElement('checkbox', 'use_household_address', null, ts('Use %1 Address', array(1 => $label)));
     }
     $housholdDataURL = CRM_Utils_System::url('civicrm/ajax/search', "hh=1", false, null, false);
     $form->assign('housholdDataURL', $housholdDataURL);
     $form->add('text', 'shared_household', ts('Select Household'));
     $form->add('hidden', 'shared_household_id', '', array('id' => 'shared_household_id'));
     //Home Url Element
     $form->addElement('text', 'home_URL', ts('Website'), array_merge(CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'home_URL'), array('onfocus' => "if (!this.value) this.value='http://'; else return false", 'onblur' => "if ( this.value == 'http://') this.value=''; else return false")));
     $form->addRule('home_URL', ts('Enter a valid web location beginning with \'http://\' or \'https://\'. EXAMPLE: http://www.mysite.org/'), 'url');
     //Current Employer Element
     $employerDataURL = CRM_Utils_System::url('civicrm/ajax/contactlist', 'org=1', false, null, false);
     $form->assign('employerDataURL', $employerDataURL);
     $form->addElement('text', 'current_employer', ts('Current Employer'), '');
     $form->addElement('hidden', 'current_employer_id', '', array('id' => 'current_employer_id'));
     $form->addElement('text', 'contact_source', ts('Source'));
     //External Identifier Element
     $form->add('text', 'external_identifier', ts('External Id'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'external_identifier'), false);
     $form->addRule('external_identifier', ts('External ID already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Contact', $form->_contactId, 'external_identifier'));
     $config =& CRM_Core_Config::singleton();
     CRM_Core_ShowHideBlocks::links($form, 'demographics', '', '');
 }
コード例 #3
0
 public static function initTasks()
 {
     if (!self::$_tasks) {
         self::$_tasks = array(self::GROUP_CONTACTS => array('title' => ts('Add Contacts to Group'), 'class' => 'CRM_Contact_Form_Task_AddToGroup'), self::REMOVE_CONTACTS => array('title' => ts('Remove Contacts from Group'), 'class' => 'CRM_Contact_Form_Task_RemoveFromGroup'), self::TAG_CONTACTS => array('title' => ts('Tag Contacts (assign tags)'), 'class' => 'CRM_Contact_Form_Task_AddToTag'), self::REMOVE_TAGS => array('title' => ts('Untag Contacts (remove tags)'), 'class' => 'CRM_Contact_Form_Task_RemoveFromTag'), self::EXPORT_CONTACTS => array('title' => ts('Export Contacts'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => FALSE), self::EMAIL_CONTACTS => array('title' => ts('Send Email to Contacts'), 'class' => 'CRM_Contact_Form_Task_Email', 'result' => TRUE), self::DELETE_CONTACTS => array('title' => ts('Delete Contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE), self::RECORD_CONTACTS => array('title' => ts('Record Activity for Contacts'), 'class' => 'CRM_Activity_Form_Activity'), self::SAVE_SEARCH => array('title' => ts('New Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch', 'result' => TRUE), self::SAVE_SEARCH_UPDATE => array('title' => ts('Update Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch_Update', 'result' => TRUE), self::PRINT_CONTACTS => array('title' => ts('Print Selected Rows'), 'class' => 'CRM_Contact_Form_Task_Print', 'result' => FALSE), self::LABEL_CONTACTS => array('title' => ts('Mailing Labels'), 'class' => 'CRM_Contact_Form_Task_Label', 'result' => TRUE), self::BATCH_UPDATE => array('title' => ts('Batch Update via Profile'), 'class' => array('CRM_Contact_Form_Task_PickProfile', 'CRM_Contact_Form_Task_Batch'), 'result' => TRUE), self::PRINT_FOR_CONTACTS => array('title' => ts('Print PDF Letter for Contacts'), 'class' => 'CRM_Contact_Form_Task_PDF', 'result' => TRUE), self::EMAIL_UNHOLD => array('title' => ts('Unhold Emails'), 'class' => 'CRM_Contact_Form_Task_Unhold'), self::COMMUNICATION_PREFS => array('title' => ts('Alter Contact Communication Preferences'), 'class' => 'CRM_Contact_Form_Task_AlterPreferences'), self::RESTORE => array('title' => ts('Restore Contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE), self::DELETE_PERMANENTLY => array('title' => ts('Delete Permanently'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE));
         //CRM-16329, if SMS provider is configured show sms action.
         $providersCount = CRM_SMS_BAO_Provider::activeProviderCount();
         if ($providersCount) {
             self::$_tasks[self::SMS_CONTACTS] = array('title' => ts('Send SMS to Contacts'), 'class' => 'CRM_Contact_Form_Task_SMS', 'result' => TRUE);
         }
         if (CRM_Contact_BAO_ContactType::isActive('Household')) {
             $label = CRM_Contact_BAO_ContactType::getLabel('Household');
             self::$_tasks[self::HOUSEHOLD_CONTACTS] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToHousehold');
         }
         if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
             $label = CRM_Contact_BAO_ContactType::getLabel('Organization');
             self::$_tasks[self::ORGANIZATION_CONTACTS] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToOrganization');
         }
         if (CRM_Core_Permission::check('merge duplicate contacts')) {
             self::$_tasks[self::MERGE_CONTACTS] = array('title' => ts('Merge Contacts'), 'class' => 'CRM_Contact_Form_Task_Merge', 'result' => TRUE);
         }
         //CRM-4418, check for delete
         if (!CRM_Core_Permission::check('delete contacts')) {
             unset(self::$_tasks[self::DELETE_CONTACTS]);
         }
         //show map action only if map provider and geoprovider are set (Google doesn't need geoprovider)
         // should fix this to be more flexible as providers are added ??
         $config = CRM_Core_Config::singleton();
         if ($config->mapProvider && ($config->mapProvider == 'Google' || ($config->mapProvider == 'OpenStreetMaps' || $config->geoProvider == 'Google'))) {
             self::$_tasks[self::MAP_CONTACTS] = array('title' => ts('Map Contacts'), 'class' => 'CRM_Contact_Form_Task_Map', 'result' => FALSE);
         }
         if (CRM_Core_Permission::access('CiviEvent')) {
             self::$_tasks[self::ADD_EVENT] = array('title' => ts('Add Contacts to Event'), 'class' => 'CRM_Event_Form_Participant');
         }
         if (defined('CIVICRM_CIVIMAIL_UI_LEGACY')) {
             if (CRM_Core_Permission::access('CiviMail')) {
                 self::$_tasks[self::CREATE_MAILING] = array('title' => ts('Schedule/Send a Mass Mailing'), 'class' => array('CRM_Mailing_Form_Group', 'CRM_Mailing_Form_Settings', 'CRM_Mailing_Form_Upload', 'CRM_Mailing_Form_Test', 'CRM_Mailing_Form_Schedule'), 'result' => FALSE);
             } elseif (CRM_Mailing_Info::workflowEnabled() && CRM_Core_Permission::check('create mailings')) {
                 self::$_tasks[self::CREATE_MAILING] = array('title' => ts('Create a Mass Mailing'), 'class' => array('CRM_Mailing_Form_Group', 'CRM_Mailing_Form_Settings', 'CRM_Mailing_Form_Upload', 'CRM_Mailing_Form_Test'), 'result' => FALSE);
             }
         } else {
             if (CRM_Core_Permission::access('CiviMail') || CRM_Mailing_Info::workflowEnabled() && CRM_Core_Permission::check('create mailings')) {
                 self::$_tasks[self::CREATE_MAILING] = array('title' => ts('Schedule/Send a Mass Mailing'), 'class' => 'CRM_Mailing_Form_Task_AdhocMailing', 'result' => FALSE);
             }
         }
         self::$_tasks += CRM_Core_Component::taskList();
         CRM_Utils_Hook::searchTasks('contact', self::$_tasks);
         asort(self::$_tasks);
     }
 }
コード例 #4
0
 static function relatedContactInfo($contactId)
 {
     $return = array();
     if (empty($contactId)) {
         return $return;
     }
     $phone = CRM_Core_BAO_Phone::allPhones($contactId, TRUE, NULL, array('is_primary' => 1));
     $contactSubType = CRM_Contact_BAO_Contact::getContactSubType($contactId);
     $contactType = CRM_Contact_BAO_ContactType::getLabel($contactSubType[0]);
     $gid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', 'PCP_Supporter_Profile', 'id', 'name');
     $updateURL = CRM_Utils_System::url('civicrm/profile/edit', "reset=1&gid={$gid}&cid={$contactId}");
     // $updateURL      =CRM_Utils_System::url('civicrm/pcp/support', "action=browse&component=event&id={$params['pcpId']}");
     $return = array('name' => CRM_Contact_BAO_Contact::displayName($contactId), 'type' => $contactType, 'email' => CRM_Contact_BAO_Contact::getPrimaryEmail($contactId), 'phone' => !empty($phone) && isset($phone[1]['phone']) ? $phone[1]['phone'] : NULL, 'action' => "<a href={$updateURL}>Update Contact Information</a>");
     return $return;
 }
コード例 #5
0
ファイル: Task.php プロジェクト: nganivet/civicrm-core
 public static function initTasks()
 {
     if (!self::$_tasks) {
         self::$_tasks = array(self::GROUP_CONTACTS => array('title' => ts('Group - add contacts'), 'class' => 'CRM_Contact_Form_Task_AddToGroup'), self::REMOVE_CONTACTS => array('title' => ts('Group - remove contacts'), 'class' => 'CRM_Contact_Form_Task_RemoveFromGroup'), self::TAG_CONTACTS => array('title' => ts('Tag - add to contacts'), 'class' => 'CRM_Contact_Form_Task_AddToTag'), self::REMOVE_TAGS => array('title' => ts('Tag - remove from contacts'), 'class' => 'CRM_Contact_Form_Task_RemoveFromTag'), self::EXPORT_CONTACTS => array('title' => ts('Export contacts'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => FALSE), self::EMAIL_CONTACTS => array('title' => ts('Email - send now (to 50 or less)'), 'class' => 'CRM_Contact_Form_Task_Email', 'result' => TRUE), self::DELETE_CONTACTS => array('title' => ts('Delete contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE), self::RECORD_CONTACTS => array('title' => ts('Add activity'), 'class' => 'CRM_Activity_Form_Activity'), self::SAVE_SEARCH => array('title' => ts('Smart group - create'), 'class' => 'CRM_Contact_Form_Task_SaveSearch', 'result' => TRUE), self::SAVE_SEARCH_UPDATE => array('title' => ts('Smart group - update'), 'class' => 'CRM_Contact_Form_Task_SaveSearch_Update', 'result' => TRUE), self::PRINT_CONTACTS => array('title' => ts('Print selected rows'), 'class' => 'CRM_Contact_Form_Task_Print', 'result' => FALSE), self::LABEL_CONTACTS => array('title' => ts('Mailing labels - print'), 'class' => 'CRM_Contact_Form_Task_Label', 'result' => TRUE), self::BATCH_UPDATE => array('title' => ts('Batch update contacts via profile'), 'class' => array('CRM_Contact_Form_Task_PickProfile', 'CRM_Contact_Form_Task_Batch'), 'result' => TRUE), self::PRINT_FOR_CONTACTS => array('title' => ts('PDF letters - print'), 'class' => 'CRM_Contact_Form_Task_PDF', 'result' => TRUE), self::EMAIL_UNHOLD => array('title' => ts('Email - unhold addresses'), 'class' => 'CRM_Contact_Form_Task_Unhold'), self::COMMUNICATION_PREFS => array('title' => ts('Communication preferences - alter'), 'class' => 'CRM_Contact_Form_Task_AlterPreferences'), self::RESTORE => array('title' => ts('Restore contacts from trash'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE), self::DELETE_PERMANENTLY => array('title' => ts('Delete permanently'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE));
         //CRM-16329, if SMS provider is configured show sms action.
         $providersCount = CRM_SMS_BAO_Provider::activeProviderCount();
         if ($providersCount) {
             self::$_tasks[self::SMS_CONTACTS] = array('title' => ts('SMS - schedule/send'), 'class' => 'CRM_Contact_Form_Task_SMS', 'result' => TRUE);
         }
         if (CRM_Contact_BAO_ContactType::isActive('Household')) {
             $label = CRM_Contact_BAO_ContactType::getLabel('household');
             self::$_tasks[self::HOUSEHOLD_CONTACTS] = array('title' => ts('Add relationship - to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToHousehold');
         }
         if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
             $label = CRM_Contact_BAO_ContactType::getLabel('organization');
             self::$_tasks[self::ORGANIZATION_CONTACTS] = array('title' => ts('Add relationship - to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToOrganization');
         }
         if (CRM_Core_Permission::check('merge duplicate contacts')) {
             self::$_tasks[self::MERGE_CONTACTS] = array('title' => ts('Merge contacts'), 'class' => 'CRM_Contact_Form_Task_Merge', 'result' => TRUE);
         }
         //CRM-4418, check for delete
         if (!CRM_Core_Permission::check('delete contacts')) {
             unset(self::$_tasks[self::DELETE_CONTACTS]);
         }
         //show map action only if map provider and geoprovider are set (Google doesn't need geoprovider)
         // should fix this to be more flexible as providers are added ??
         $config = CRM_Core_Config::singleton();
         if ($config->mapProvider && ($config->mapProvider == 'Google' || ($config->mapProvider == 'OpenStreetMaps' || $config->geoProvider == 'Google'))) {
             self::$_tasks[self::MAP_CONTACTS] = array('title' => ts('Map contacts'), 'class' => 'CRM_Contact_Form_Task_Map', 'result' => FALSE);
         }
         if (CRM_Core_Permission::access('CiviEvent')) {
             self::$_tasks[self::ADD_EVENT] = array('title' => ts('Register participants for event'), 'class' => 'CRM_Event_Form_Participant');
         }
         if (CRM_Core_Permission::access('CiviMail') || CRM_Mailing_Info::workflowEnabled() && CRM_Core_Permission::check('create mailings')) {
             self::$_tasks[self::CREATE_MAILING] = array('title' => ts('Email - schedule/send via CiviMail'), 'class' => 'CRM_Mailing_Form_Task_AdhocMailing', 'result' => FALSE);
         }
         self::$_tasks += CRM_Core_Component::taskList();
         CRM_Utils_Hook::searchTasks('contact', self::$_tasks);
         asort(self::$_tasks);
     }
 }
コード例 #6
0
ファイル: Task.php プロジェクト: hguru/224Civi
 static function initTasks()
 {
     if (!self::$_tasks) {
         self::$_tasks = array(1 => array('title' => ts('Add Contacts to Group'), 'class' => 'CRM_Contact_Form_Task_AddToGroup'), 2 => array('title' => ts('Remove Contacts from Group'), 'class' => 'CRM_Contact_Form_Task_RemoveFromGroup'), 3 => array('title' => ts('Tag Contacts (assign tags)'), 'class' => 'CRM_Contact_Form_Task_AddToTag'), 4 => array('title' => ts('Untag Contacts (remove tags)'), 'class' => 'CRM_Contact_Form_Task_RemoveFromTag'), 5 => array('title' => ts('Export Contacts'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => FALSE), 6 => array('title' => ts('Send Email to Contacts'), 'class' => 'CRM_Contact_Form_Task_Email', 'result' => TRUE), 7 => array('title' => ts('Send SMS to Contacts'), 'class' => 'CRM_Contact_Form_Task_SMS', 'result' => TRUE), 8 => array('title' => ts('Delete Contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE), 11 => array('title' => ts('Record Activity for Contacts'), 'class' => 'CRM_Activity_Form_Activity'), 13 => array('title' => ts('New Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch', 'result' => TRUE), 14 => array('title' => ts('Update Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch_Update', 'result' => TRUE), 15 => array('title' => ts('Print Contacts'), 'class' => 'CRM_Contact_Form_Task_Print', 'result' => FALSE), 16 => array('title' => ts('Mailing Labels'), 'class' => 'CRM_Contact_Form_Task_Label', 'result' => TRUE), 17 => array('title' => ts('Batch Update via Profile'), 'class' => array('CRM_Contact_Form_Task_PickProfile', 'CRM_Contact_Form_Task_Batch'), 'result' => TRUE), 19 => array('title' => ts('Print PDF Letter for Contacts'), 'class' => 'CRM_Contact_Form_Task_PDF', 'result' => TRUE), 22 => array('title' => ts('Unhold Emails'), 'class' => 'CRM_Contact_Form_Task_Unhold'), 25 => array('title' => ts('Alter Contact Communication Preferences'), 'class' => 'CRM_Contact_Form_Task_AlterPreferences'), self::RESTORE => array('title' => ts('Restore Contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE), self::DELETE_PERMANENTLY => array('title' => ts('Delete Permanently'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE));
         if (CRM_Contact_BAO_ContactType::isActive('Household')) {
             $label = CRM_Contact_BAO_ContactType::getLabel('Household');
             self::$_tasks[9] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToHousehold');
         }
         if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
             $label = CRM_Contact_BAO_ContactType::getLabel('Organization');
             self::$_tasks[10] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToOrganization');
         }
         if (CRM_Core_Permission::check('merge duplicate contacts')) {
             self::$_tasks[21] = array('title' => ts('Merge Contacts'), 'class' => 'CRM_Contact_Form_Task_Merge', 'result' => TRUE);
         }
         //CRM-4418, check for delete
         if (!CRM_Core_Permission::check('delete contacts')) {
             unset(self::$_tasks[8]);
         }
         //show map action only if map provider and geoprovider are set (Google doesn't need geoprovider)
         // should fix this to be more flexible as providers are added ??
         $config = CRM_Core_Config::singleton();
         if ($config->mapProvider && ($config->mapProvider == 'Google' || ($config->mapProvider == 'OpenStreetMaps' || $config->geoProvider == 'Google'))) {
             self::$_tasks[12] = array('title' => ts('Map Contacts'), 'class' => 'CRM_Contact_Form_Task_Map', 'result' => FALSE);
         }
         if (CRM_Core_Permission::access('CiviEvent')) {
             self::$_tasks[18] = array('title' => ts('Add Contacts to Event'), 'class' => 'CRM_Event_Form_Participant');
         }
         if (CRM_Core_Permission::access('CiviMail')) {
             self::$_tasks[20] = array('title' => ts('Schedule/Send a Mass Mailing'), 'class' => array('CRM_Mailing_Form_Group', 'CRM_Mailing_Form_Settings', 'CRM_Mailing_Form_Upload', 'CRM_Mailing_Form_Test', 'CRM_Mailing_Form_Schedule'), 'result' => FALSE);
         } elseif (CRM_Mailing_Info::workflowEnabled() && CRM_Core_Permission::check('create mailings')) {
             self::$_tasks[20] = array('title' => ts('Create a Mass Mailing'), 'class' => array('CRM_Mailing_Form_Group', 'CRM_Mailing_Form_Settings', 'CRM_Mailing_Form_Upload', 'CRM_Mailing_Form_Test'), 'result' => FALSE);
         }
         self::$_tasks += CRM_Core_Component::taskList();
         CRM_Utils_Hook::searchTasks('contact', self::$_tasks);
         asort(self::$_tasks);
     }
 }
コード例 #7
0
 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     if ($this->_cdType) {
         return CRM_Custom_Form_CustomData::buildQuickForm($this);
     }
     $relTypeID = explode('_', $this->_rtypeId, 3);
     if ($this->_action & CRM_Core_Action::DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     $callAjax = $this->get('callAjax');
     $searchRows = null;
     if (!$callAjax) {
         $searchRows = $this->get('searchRows');
     } else {
         $this->addElement('hidden', 'store_contacts', '', array('id' => 'store_contacts'));
         $sourceUrl = 'snippet=4&relType=' . $this->get('relType');
         $sourceUrl .= '&relContact=' . $this->get('relContact');
         $sourceUrl .= '&cid=' . $this->_contactId;
         $this->assign('searchCount', true);
         // To handle employee of and employer of
         if (!empty($this->_relationshipTypeId) && !empty($this->_rtype)) {
             $sourceUrl .= '&typeName=' . $this->_allRelationshipNames[$this->_relationshipTypeId]["name_{$this->_rtype}"];
         }
         $this->assign('sourceUrl', CRM_Utils_System::url('civicrm/ajax/relationshipcontacts', $sourceUrl, false, null, false));
     }
     $this->assign('callAjax', $callAjax);
     $this->_callAjax = $callAjax;
     $this->addElement('select', 'relationship_type_id', ts('Relationship Type'), array('' => ts('- select -')) + CRM_Contact_BAO_Relationship::getContactRelationshipType($this->_contactId, $this->_rtype, $this->_relationshipId, null, false, 'label'));
     // add a ajax facility for searching contacts
     $dataUrl = CRM_Utils_System::url("civicrm/ajax/search", "reset=1", true, null, false);
     $this->assign('dataUrl', $dataUrl);
     $this->add('text', 'rel_contact', ts('Find Target Contact'));
     $this->add('hidden', "rel_contact_id");
     $this->addDate('start_date', ts('Start Date'), false, array('formatType' => 'searchDate'));
     $this->addDate('end_date', ts('End Date'), false, array('formatType' => 'searchDate'));
     $this->addElement('advcheckbox', 'is_active', ts('Enabled?'), null, 'setChecked()');
     $this->addElement('checkbox', 'is_permission_a_b', ts('Permission for contact a to view and update information for contact b'), null);
     $this->addElement('checkbox', 'is_permission_b_a', ts('permission for contact b to view and update information for contact a'), null);
     $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Relationship', 'description'));
     CRM_Contact_Form_Edit_Notes::buildQuickForm($this);
     $searchCount = $this->get('searchCount');
     $duplicateRelationship = $this->get('duplicateRelationship');
     $searchDone = $this->get('searchDone');
     $isEmployeeOf = $isEmployerOf = false;
     if (!empty($this->_relationshipTypeId) && !empty($this->_rtype)) {
         if ($this->_allRelationshipNames[$this->_relationshipTypeId]["name_{$this->_rtype}"] == 'Employee of') {
             $isEmployeeOf = true;
         } else {
             if ($this->_allRelationshipNames[$this->_relationshipTypeId]["name_{$this->_rtype}"] == 'Employer of') {
                 $isEmployerOf = true;
             }
         }
     }
     $employers = $checkBoxes = $employees = array();
     if ($searchRows) {
         foreach ($searchRows as $id => $row) {
             $checkBoxes[$id] = $this->createElement('checkbox', $id, null, '');
             if ($isEmployeeOf) {
                 $employers[$id] = $this->createElement('radio', null, $id, null, $id);
             } else {
                 if ($isEmployerOf) {
                     $employees[$id] = $this->createElement('checkbox', $id, null, '');
                 }
             }
         }
         $this->addGroup($checkBoxes, 'contact_check');
         $this->assign('searchRows', $searchRows);
     }
     if ($isEmployeeOf) {
         $this->assign('isEmployeeOf', $isEmployeeOf);
         if (!$callAjax) {
             $this->addGroup($employers, 'employee_of');
         }
     } else {
         if ($isEmployerOf) {
             $this->assign('isEmployerOf', $isEmployerOf);
             if (!$callAjax) {
                 $this->addGroup($employees, 'employer_of');
             }
         }
     }
     if ($callAjax && ($isEmployeeOf || $isEmployerOf)) {
         $this->addElement('hidden', 'store_employers', '', array('id' => 'store_employers'));
     }
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $this->addElement('checkbox', 'is_current_employer');
     }
     $this->assign('duplicateRelationship', $duplicateRelationship);
     $this->assign('searchCount', $searchCount);
     $this->assign('searchDone', $searchDone);
     if ($this->get('contact_type')) {
         require_once 'CRM/Contact/BAO/ContactType.php';
         $typeLabel = CRM_Contact_BAO_ContactType::getLabel($this->get('contact_type'));
         $this->assign('contact_type', $this->get('contact_type'));
         $this->assign('contact_type_display', $typeLabel);
     }
     if ($searchDone) {
         $searchBtn = ts('Search Again');
     } else {
         $searchBtn = ts('Search');
     }
     $this->addElement('submit', $this->getButtonName('refresh'), $searchBtn, array('class' => 'form-submit', 'id' => 'search-button'));
     $this->addElement('submit', $this->getButtonName('refresh', 'save'), 'Quick Save', array('class' => 'form-submit', 'id' => 'quick-save'));
     $this->addElement('submit', $this->getButtonName('cancel'), ts('Cancel'), array('class' => 'form-submit'));
     $this->addElement('submit', $this->getButtonName('refresh', 'savedetails'), 'Save Relationship', array('class' => 'form-submit hiddenElement', 'id' => 'details-save'));
     $this->addElement('checkbox', 'add_current_employer', ts('Current Employer'), null);
     $this->addElement('checkbox', 'add_current_employee', ts('Current Employee'), null);
     //need to assign custom data type and subtype to the template
     $this->assign('customDataType', 'Relationship');
     $this->assign('customDataSubType', $this->_relationshipTypeId);
     $this->assign('entityID', $this->_relationshipId);
     // make this form an upload since we dont know if the custom data injected dynamically
     // is of type file etc $uploadNames = $this->get(
     // 'uploadNames' );
     $buttonParams = array('type' => 'upload', 'name' => ts('Save Relationship'), 'isDefault' => true);
     if ($callAjax) {
         $buttonParams['js'] = array('onclick' => ' submitAjaxData();');
     }
     $this->addButtons(array($buttonParams, array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
コード例 #8
0
ファイル: Contact.php プロジェクト: hampelm/Ginsberg-CiviDemo
 /**
  * Function to actually build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     //load form for child blocks
     if ($this->_addBlockName) {
         require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_Form_Edit_" . $this->_addBlockName) . ".php";
         return eval('CRM_Contact_Form_Edit_' . $this->_addBlockName . '::buildQuickForm( $this );');
     }
     if ($this->_action == CRM_Core_Action::UPDATE) {
         $deleteExtra = ts('Are you sure you want to delete contact image.');
         $deleteURL = array(CRM_Core_Action::DELETE => array('name' => ts('Delete Contact Image'), 'url' => 'civicrm/contact/image', 'qs' => 'reset=1&cid=%%id%%&action=delete', 'extra' => 'onclick = "if (confirm( \'' . $deleteExtra . '\' ) ) this.href+=\'&amp;confirmed=1\'; else return false;"'));
         $deleteURL = CRM_Core_Action::formLink($deleteURL, CRM_Core_Action::DELETE, array('id' => $this->_contactId));
         $this->assign('deleteURL', $deleteURL);
     }
     //build contact type specific fields
     require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_Form_Edit_" . $this->_contactType) . ".php";
     eval('CRM_Contact_Form_Edit_' . $this->_contactType . '::buildQuickForm( $this, $this->_action );');
     // build Custom data if Custom data present in edit option
     $buildCustomData = null;
     if (array_key_exists('CustomData', $this->_editOptions)) {
         $buildCustomData = "removeDefaultCustomFields( ), buildCustomData('{$this->_contactType}',this.value), highlightTabs( );";
     }
     // subtype is a common field. lets keep it here
     $typeLabel = CRM_Contact_BAO_ContactType::getLabel($this->_contactType);
     $subtypes = CRM_Contact_BAO_ContactType::subTypePairs($this->_contactType);
     $subtypeElem =& $this->addElement('select', 'contact_sub_type', ts('Contact Type'), array('' => $typeLabel) + $subtypes, array('onchange' => $buildCustomData));
     $allowEditSubType = true;
     if ($this->_contactId && $this->_contactSubType) {
         $allowEditSubType = CRM_Contact_BAO_ContactType::isAllowEdit($this->_contactId, $this->_contactSubType);
     }
     if (!$allowEditSubType) {
         $subtypeElem->freeze();
     }
     // build edit blocks ( custom data, demographics, communication preference, notes, tags and groups )
     foreach ($this->_editOptions as $name => $label) {
         if ($name == 'Address') {
             $this->_blocks['Address'] = $this->_editOptions['Address'];
             continue;
         }
         require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_Form_Edit_" . $name) . ".php";
         eval('CRM_Contact_Form_Edit_' . $name . '::buildQuickForm( $this );');
     }
     // build location blocks.
     CRM_Contact_Form_Location::buildQuickForm($this);
     // add attachment
     $this->addElement('file', 'image_URL', ts('Browse/Upload Image'), 'size=30 maxlength=60');
     $this->addUploadElement('image_URL');
     // add the dedupe button
     $this->addElement('submit', $this->_dedupeButtonName, ts('Check for Matching Contact(s)'));
     $this->addElement('submit', $this->_duplicateButtonName, ts('Save Matching Contact'));
     $this->addElement('submit', $this->getButtonName('next', 'sharedHouseholdDuplicate'), ts('Save With Duplicate Household'));
     $this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'subName' => 'view', 'isDefault' => true), array('type' => 'upload', 'name' => ts('Save and New'), 'spacing' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
コード例 #9
0
ファイル: Contact.php プロジェクト: bhirsch/voipdev
 /**
  * Function to actually build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     //load form for child blocks
     if ($this->_addBlockName) {
         require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_Form_Edit_" . $this->_addBlockName) . ".php";
         return eval('CRM_Contact_Form_Edit_' . $this->_addBlockName . '::buildQuickForm( $this );');
     }
     //build contact type specific fields
     require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_Form_Edit_" . $this->_contactType) . ".php";
     eval('CRM_Contact_Form_Edit_' . $this->_contactType . '::buildQuickForm( $this, $this->_action );');
     // subtype is a common field. lets keep it here
     $typeLabel = CRM_Contact_BAO_ContactType::getLabel($this->_contactType);
     $subtypes = CRM_Contact_BAO_ContactType::subTypePairs($this->_contactType);
     $subtypeElem =& $this->addElement('select', 'contact_sub_type', ts('Contact Type'), array('' => $typeLabel) + $subtypes);
     $allowEditSubType = true;
     if ($this->_contactId && $this->_contactSubType) {
         $allowEditSubType = CRM_Contact_BAO_ContactType::isAllowEdit($this->_contactId, $this->_contactSubType);
     }
     if (!$allowEditSubType) {
         $subtypeElem->freeze();
     }
     // build edit blocks ( custom data, demographics, communication preference, notes, tags and groups )
     foreach ($this->_editOptions as $name => $label) {
         if ($name == 'Address') {
             $this->_blocks['Address'] = $this->_editOptions['Address'];
             continue;
         }
         require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_Form_Edit_" . $name) . ".php";
         eval('CRM_Contact_Form_Edit_' . $name . '::buildQuickForm( $this );');
     }
     // build location blocks.
     CRM_Contact_Form_Location::buildQuickForm($this);
     // add the dedupe button
     $this->addElement('submit', $this->_dedupeButtonName, ts('Check for Matching Contact(s)'));
     $this->addElement('submit', $this->_duplicateButtonName, ts('Save Matching Contact'));
     $this->addElement('submit', $this->getButtonName('next', 'sharedHouseholdDuplicate'), ts('Save With Duplicate Household'));
     $this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'subName' => 'view', 'isDefault' => true), array('type' => 'upload', 'name' => ts('Save and New'), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }