当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_SelectValues::contactType方法代码示例

本文整理汇总了PHP中CRM_Core_SelectValues::contactType方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_SelectValues::contactType方法的具体用法?PHP CRM_Core_SelectValues::contactType怎么用?PHP CRM_Core_SelectValues::contactType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_SelectValues的用法示例。


在下文中一共展示了CRM_Core_SelectValues::contactType方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildForm

 /**
  * @param $form
  */
 function buildForm(&$form)
 {
     /**
      * You can define a custom title for the search form
      */
     $this->setTitle('Find Latest Activities');
     /**
      * Define the search form fields here
      */
     // Allow user to choose which type of contact to limit search on
     $form->add('select', 'contact_type', ts('Find...'), CRM_Core_SelectValues::contactType());
     // Text box for Activity Subject
     $form->add('text', 'activity_subject', ts('Activity Subject'));
     // Select box for Activity Type
     $activityType = array('' => ' - select activity - ') + CRM_Core_PseudoConstant::activityType();
     $form->add('select', 'activity_type_id', ts('Activity Type'), $activityType, FALSE);
     // textbox for Activity Status
     $activityStatus = array('' => ' - select status - ') + CRM_Core_PseudoConstant::activityStatus();
     $form->add('select', 'activity_status_id', ts('Activity Status'), $activityStatus, FALSE);
     // Activity Date range
     $form->addDate('start_date', ts('Activity Date From'), FALSE, array('formatType' => 'custom'));
     $form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
     // Contact Name field
     $form->add('text', 'sort_name', ts('Contact Name'));
     /**
      * If you are using the sample template, this array tells the template fields to render
      * for the search form.
      */
     $form->assign('elements', array('contact_type', 'activity_subject', 'activity_type_id', 'activity_status_id', 'start_date', 'end_date', 'sort_name'));
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:33,代码来源:ActivitySearch.php

示例2: getContactType

 /**
  * Retrieve the first non-generic contact type
  *
  * @param int $id  id of uf_group
  * @return string  contact type
  */
 static function getContactType($id)
 {
     $valid = array_filter(array_keys(CRM_Core_SelectValues::contactType()));
     $types = explode(',', CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $id, 'group_type'));
     foreach ($types as $type) {
         if (in_array($type, $valid)) {
             return $type;
         }
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:16,代码来源:UFGroup.php

示例3: buildForm

 function buildForm(&$form)
 {
     $form->add('select', 'contact_type', ts('Find...'), CRM_Core_SelectValues::contactType());
     // add select for groups
     $group = array('' => ts('- any group -')) + CRM_Core_PseudoConstant::group();
     $form->addElement('select', 'group', ts('in'), $group);
     // add select for categories
     $tag = array('' => ts('- any tag -')) + CRM_Core_PseudoConstant::tag();
     $form->addElement('select', 'tag', ts('Tagged'), $tag);
     // text for sort_name
     $form->add('text', 'sort_name', ts('Name'));
     $form->assign('elements', array('sort_name', 'contact_type', 'group', 'tag'));
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:13,代码来源:Basic.php

示例4: getContactType

 /**
  * Retrieve the first non-generic contact type
  *
  * @param int $id
  *   Id of uf_group.
  *
  * @return string
  *   contact type
  */
 public static function getContactType($id)
 {
     $validTypes = array_filter(array_keys(CRM_Core_SelectValues::contactType()));
     $validSubTypes = CRM_Contact_BAO_ContactType::subTypeInfo();
     $typesParts = explode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $id, 'group_type'));
     $types = explode(',', $typesParts[0]);
     $cType = NULL;
     foreach ($types as $type) {
         if (in_array($type, $validTypes)) {
             $cType = $type;
         } elseif (array_key_exists($type, $validSubTypes)) {
             $cType = CRM_Utils_Array::value('parent', $validSubTypes[$type]);
         }
         if ($cType) {
             break;
         }
     }
     return $cType;
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:28,代码来源:UFGroup.php

示例5: getContactType

 /**
  * Retrieve the first non-generic contact type
  *
  * @param int $id  id of uf_group
  * @return string  contact type
  */
 static function getContactType($id)
 {
     require_once 'CRM/Contact/BAO/ContactType.php';
     $validTypes = array_filter(array_keys(CRM_Core_SelectValues::contactType()));
     $validSubTypes = CRM_Contact_BAO_ContactType::subTypeInfo();
     $types = explode(',', CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $id, 'group_type'));
     $cType = null;
     foreach ($types as $type) {
         if (in_array($type, $validTypes)) {
             $cType = $type;
         } else {
             if (array_key_exists($type, $validSubTypes)) {
                 $cType = CRM_Utils_Array::value('parent', $validSubTypes[$type]);
             }
         }
         if ($cType) {
             break;
         }
     }
     return $cType;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:27,代码来源:UFGroup.php

示例6: buildQuickForm

 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 function buildQuickForm()
 {
     parent::buildQuickForm();
     if ($this->_action & CRM_CORE_ACTION_DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'name_a_b', ts('Relationship Label-A to B'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'name_a_b'));
     $this->addRule('name_a_b', ts('Please enter a valid Relationship Label for A to B.'), 'required');
     $this->addRule('name_a_b', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_RelationshipType', $this->_id, 'name_a_b'));
     $this->add('text', 'name_b_a', ts('Relationship Label-B to A'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'name_b_a'));
     $this->addRule('name_b_a', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_RelationshipType', $this->_id, 'name_b_a'));
     // add select for contact type
     $this->add('select', 'contact_type_a', ts('Contact Type A') . ' ', CRM_Core_SelectValues::contactType());
     $this->add('select', 'contact_type_b', ts('Contact Type B') . ' ', CRM_Core_SelectValues::contactType());
     $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'description'));
     $this->add('checkbox', 'is_active', ts('Enabled?'));
     if ($this->_action & CRM_CORE_ACTION_VIEW) {
         $this->freeze();
         $this->addElement('button', 'done', ts('Done'), array('onClick' => "location.href='civicrm/admin/reltype?reset=1&action=browse'"));
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:28,代码来源:RelationshipType.php

示例7: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 function buildQuickForm()
 {
     if ($this->_action & CRM_CORE_ACTION_DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete Profile Field'), 'spacing' => '         ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     if (isset($this->_id)) {
         $params = array('id' => $this->_id);
         CRM_Core_BAO_UFField::retrieve($params, $defaults);
         $defaults['field_name'] = array($defaults['field_type'], $defaults['field_name'], $defaults['location_type_id'], $defaults['phone_type']);
         $this->_gid = $defaults['uf_group_id'];
     } else {
         $defaults['is_active'] = 1;
     }
     if ($this->_action & CRM_CORE_ACTION_ADD) {
         $uf =& new CRM_Core_DAO();
         $sql = "SELECT weight FROM civicrm_uf_field  WHERE uf_group_id = " . $this->_gid . " ORDER BY weight  DESC LIMIT 0, 1";
         $uf->query($sql);
         while ($uf->fetch()) {
             $defaults['weight'] = $uf->weight + 1;
         }
         if (empty($defaults['weight'])) {
             $defaults['weight'] = 1;
         }
     }
     // lets trim all the whitespace
     $this->applyFilter('__ALL__', 'trim');
     //hidden field to catch the group id in profile
     $this->add('hidden', 'group_id', $this->_gid);
     //hidden field to catch the field id in profile
     $this->add('hidden', 'field_id', $this->_id);
     $fields = array();
     $fields['Individual'] =& CRM_Contact_BAO_Contact::exportableFields('Individual');
     $fields['Household'] =& CRM_Contact_BAO_Contact::exportableFields('Household');
     $fields['Organization'] =& CRM_Contact_BAO_Contact::exportableFields('Organization');
     $contribFields =& CRM_Contribute_BAO_Contribution::getContributionFields();
     if (!empty($contribFields)) {
         $fields['Contribution'] =& $contribFields;
     }
     foreach ($fields as $key => $value) {
         foreach ($value as $key1 => $value1) {
             $this->_mapperFields[$key][$key1] = $value1['title'];
             $hasLocationTypes[$key][$key1] = $value1['hasLocationType'];
         }
     }
     require_once 'CRM/Core/BAO/LocationType.php';
     $this->_location_types =& CRM_Core_PseudoConstant::locationType();
     $defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
     /* FIXME: dirty hack to make the default option show up first.  This
      * avoids a mozilla browser bug with defaults on dynamically constructed
      * selector widgets. */
     if ($defaultLocationType) {
         $defaultLocation = $this->_location_types[$defaultLocationType->id];
         unset($this->_location_types[$defaultLocationType->id]);
         $this->_location_types = array($defaultLocationType->id => $defaultLocation) + $this->_location_types;
     }
     $sel1 = array('' => '-select-') + CRM_Core_SelectValues::contactType();
     if (!empty($contribFields)) {
         $sel1['Contribution'] = 'Contributions';
     }
     foreach ($sel1 as $key => $sel) {
         if ($key) {
             $sel2[$key] = $this->_mapperFields[$key];
         }
     }
     $sel3[''] = null;
     $phoneTypes = CRM_Core_SelectValues::phoneType();
     foreach ($sel1 as $k => $sel) {
         if ($k) {
             foreach ($this->_location_types as $key => $value) {
                 $sel4[$k]['phone'][$key] =& $phoneTypes;
             }
         }
     }
     foreach ($sel1 as $k => $sel) {
         if ($k) {
             foreach ($this->_mapperFields[$k] as $key => $value) {
                 if ($hasLocationTypes[$k][$key]) {
                     $sel3[$k][$key] = $this->_location_types;
                 } else {
                     $sel3[$key] = null;
                 }
             }
         }
     }
     $this->_defaults = array();
     $js = "<script type='text/javascript'>\n";
     $formName = "document.{$this->_name}";
     $sel =& $this->addElement('hierselect', "field_name", ts('Field Name'), 'onclick="showLabel();"');
     $formValues = array();
     //$formValues = $this->controller->exportValues( $this->_name );
     $formValues = $_POST;
     // using $_POST since export values don't give values on first submit
     if (empty($formValues)) {
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:101,代码来源:Field.php

示例8: buildQuickForm

 /**
  * Build the form
  *
  * @access public
  * @return void
  */
 function buildQuickForm()
 {
     $this->add('select', 'contact_type', ts('Find...'), CRM_Core_SelectValues::contactType());
     // add select for groups
     $group = array('' => ts('- any group -')) + $this->_group;
     $this->_groupElement =& $this->addElement('select', 'group', ts('in'), $group);
     // add select for categories
     $tag = array('' => ts('- any tag -')) + $this->_tag;
     $this->_tagElement =& $this->addElement('select', 'tag', ts('Tagged'), $tag);
     // text for sort_name
     $this->add('text', 'sort_name', ts('Name or email'));
     //commented ajax autocomplete
     // $this->add('text', 'sort_name', ts('Name or email'), 'onkeyup="getSearchResult(this,event, false);"  onblur="getSearchResult(this,event, false);" autocomplete="off"' );
     $this->buildQuickFormCommon();
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:21,代码来源:Search.php

示例9: import

 /**
  * handle the values in import mode
  *
  * @param int $onDuplicate the code for what action to take on duplicates
  * @param array $values the array of values belonging to this line
  *
  * @return boolean      the result of this processing
  * @access public
  */
 function import($onDuplicate, &$values)
 {
     // first make sure this is a valid line
     //$this->_updateWithId = false;
     $response = $this->summary($values);
     if ($response != CRM_IMPORT_PARSER_VALID) {
         return $response;
     }
     $params =& $this->getActiveFieldParams();
     $formatted = array('contact_type' => $this->_contactType);
     //for date-Formats
     $session =& CRM_Core_Session::singleton();
     $dateType = $session->get("dateType");
     $customFields = CRM_Core_BAO_CustomField::getFields($params['contact_type']);
     foreach ($params as $key => $val) {
         if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
             if ($customFields[$customFieldID][2] == 'Date') {
                 CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key);
             }
         }
         if ($key == 'birth_date') {
             if ($val) {
                 CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key);
             }
         }
     }
     //date-Format part ends
     if ($GLOBALS['_CRM_IMPORT_PARSER_CONTACT']['indieFields'] == null) {
         require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_DAO_" . $this->_contactType) . ".php";
         eval('$tempIndieFields =& CRM_Contact_DAO_' . $this->_contactType . '::import();');
         //modified for PHP4 issue
         $GLOBALS['_CRM_IMPORT_PARSER_CONTACT']['indieFields'] = $tempIndieFields;
     }
     foreach ($params as $key => $field) {
         if ($field == null || $field === '') {
             continue;
         }
         if (is_array($field)) {
             foreach ($field as $value) {
                 $break = false;
                 if (is_array($value)) {
                     foreach ($value as $name => $testForEmpty) {
                         if ($name !== 'phone_type' && ($testForEmpty === '' || $testForEmpty == null)) {
                             $break = true;
                             break;
                         }
                     }
                 } else {
                     $break = true;
                 }
                 if (!$break) {
                     _crm_add_formatted_param($value, $formatted);
                 }
             }
             continue;
         }
         $value = array($key => $field);
         if (array_key_exists($key, $GLOBALS['_CRM_IMPORT_PARSER_CONTACT']['indieFields'])) {
             $value['contact_type'] = $this->_contactType;
         }
         _crm_add_formatted_param($value, $formatted);
     }
     /*if (in_array('id',$this->_mapperKeys)) {
           $this->_updateWithId = true;
       }*/
     $relationship = false;
     // Support Match and Update Via Contact ID
     if ($this->_updateWithId) {
         $error = _crm_duplicate_formatted_contact($formatted);
         if (CRM_Import_Parser_Contact::isDuplicate($error)) {
             $matchedIDs = explode(',', $error->_errors[0]['params'][0]);
             if (count($matchedIDs) >= 1) {
                 $updateflag = true;
                 foreach ($matchedIDs as $contactId) {
                     if ($params['id'] == $contactId) {
                         $paramsValues = array('contact_id' => $contactId);
                         $contactExits = crm_get_contact($paramsValues);
                         if ($formatted['contact_type'] == $contactExits->contact_type) {
                             $newContact = crm_update_contact_formatted($contactId, $formatted, true);
                             $updateflag = false;
                             $this->_retCode = CRM_IMPORT_PARSER_VALID;
                         } else {
                             $message = "Mismatched contact Types :";
                             array_unshift($values, $message);
                             $updateflag = false;
                             $this->_retCode = CRM_IMPORT_PARSER_NO_MATCH;
                         }
                     }
                 }
                 if ($updateflag) {
                     $message = "Mismatched contact IDs OR Mismatched contact Types :";
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:101,代码来源:Contact.php

示例10: buildQuickForm


//.........这里部分代码省略.........
     foreach ($fields as $key => $value) {
         foreach ($value as $key1 => $value1) {
             //CRM-2676, replacing the conflict for same custom field name from different custom group.
             require_once 'CRM/Core/BAO/CustomField.php';
             if ($customFieldId = CRM_Core_BAO_CustomField::getKeyID($key1)) {
                 $customGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $customFieldId, 'custom_group_id');
                 $customGroupName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'title');
                 $this->_mapperFields[$key][$key1] = $value1['title'] . ' :: ' . $customGroupName;
             } else {
                 $this->_mapperFields[$key][$key1] = $value1['title'];
             }
             $hasLocationTypes[$key][$key1] = CRM_Utils_Array::value('hasLocationType', $value1);
             // hide the 'is searchable' field for 'File' custom data
             if (isset($value1['data_type']) && isset($value1['html_type']) && ($value1['data_type'] == 'File' && $value1['html_type'] == 'File' || $value1['data_type'] == 'Link' && $value1['html_type'] == 'Link')) {
                 if (!in_array($value1['title'], $noSearchable)) {
                     $noSearchable[] = $value1['title'];
                 }
             }
         }
     }
     $this->assign('noSearchable', $noSearchable);
     require_once 'CRM/Core/BAO/LocationType.php';
     $this->_location_types =& CRM_Core_PseudoConstant::locationType();
     $defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
     /* FIXME: dirty hack to make the default option show up first.  This
      * avoids a mozilla browser bug with defaults on dynamically constructed
      * selector widgets. */
     if ($defaultLocationType) {
         $defaultLocation = $this->_location_types[$defaultLocationType->id];
         unset($this->_location_types[$defaultLocationType->id]);
         $this->_location_types = array($defaultLocationType->id => $defaultLocation) + $this->_location_types;
     }
     $this->_location_types = array('Primary') + $this->_location_types;
     $sel1 = array('' => '- select -') + array('Contact' => 'Contacts') + CRM_Core_SelectValues::contactType() + $contactSubTypes;
     if (CRM_Core_Permission::access('Quest')) {
         $sel1['Student'] = 'Students';
     }
     if (CRM_Core_Permission::access('CiviEvent')) {
         $sel1['Participant'] = 'Participants';
     }
     if (!empty($contribFields)) {
         $sel1['Contribution'] = 'Contributions';
     }
     if (!empty($membershipFields)) {
         $sel1['Membership'] = 'Membership';
     }
     foreach ($sel1 as $key => $sel) {
         if ($key) {
             $sel2[$key] = $this->_mapperFields[$key];
         }
     }
     $sel3[''] = null;
     $phoneTypes = CRM_Core_PseudoConstant::phoneType();
     ksort($phoneTypes);
     foreach ($sel1 as $k => $sel) {
         if ($k) {
             foreach ($this->_location_types as $key => $value) {
                 $sel4[$k]['phone'][$key] =& $phoneTypes;
             }
         }
     }
     foreach ($sel1 as $k => $sel) {
         if ($k) {
             if (is_array($this->_mapperFields[$k])) {
                 foreach ($this->_mapperFields[$k] as $key => $value) {
                     if ($hasLocationTypes[$k][$key]) {
开发者ID:ksecor,项目名称:civicrm,代码行数:67,代码来源:Field.php

示例11: buildQuickForm

 /**
  * Build the form
  *
  * @access public
  * @return void
  */
 function buildQuickForm()
 {
     // add checkboxes for contact type
     $contact_type = array();
     foreach (CRM_Core_SelectValues::contactType() as $k => $v) {
         if (!empty($k)) {
             $contact_type[] = HTML_QuickForm::createElement('checkbox', $k, null, $v);
         }
     }
     $this->addGroup($contact_type, 'contact_type', ts('Contact Type(s)'), '<br />');
     // checkboxes for groups
     $group = array();
     foreach ($this->_group as $groupID => $groupName) {
         $this->_groupElement =& $this->addElement('checkbox', "group[{$groupID}]", null, $groupName);
     }
     // checkboxes for categories
     foreach ($this->_tag as $tagID => $tagName) {
         $this->_tagElement =& $this->addElement('checkbox', "tag[{$tagID}]", null, $tagName);
     }
     // add text box for last name, first name, street name, city
     $this->addElement('text', 'sort_name', ts('Find...'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
     $this->addElement('text', 'street_address', ts('Street Address'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Address', 'street_address'));
     $this->addElement('text', 'city', ts('City'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Address', 'city'));
     // select for state province
     $stateProvince = array('' => ts('- any state/province -')) + CRM_Core_PseudoConstant::stateProvince();
     $this->addElement('select', 'state_province', ts('State/Province'), $stateProvince);
     // select for country
     $country = array('' => ts('- any country -')) + CRM_Core_PseudoConstant::country();
     $this->addElement('select', 'country', ts('Country'), $country);
     // add text box for postal code
     $this->addElement('text', 'postal_code', ts('Postal Code'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Address', 'postal_code'));
     $this->addElement('text', 'postal_code_low', ts('Range-From'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Address', 'postal_code'));
     $this->addElement('text', 'postal_code_high', ts('To'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Address', 'postal_code'));
     $this->addElement('text', 'location_name', ts('Location Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Location', 'name'));
     // checkboxes for DO NOT phone, email, mail
     // we take labels from SelectValues
     $t = CRM_Core_SelectValues::privacy();
     $privacy[] = HTML_QuickForm::createElement('advcheckbox', 'do_not_phone', null, $t['do_not_phone']);
     $privacy[] = HTML_QuickForm::createElement('advcheckbox', 'do_not_email', null, $t['do_not_email']);
     $privacy[] = HTML_QuickForm::createElement('advcheckbox', 'do_not_mail', null, $t['do_not_mail']);
     $privacy[] = HTML_QuickForm::createElement('advcheckbox', 'do_not_trade', null, $t['do_not_trade']);
     $this->addGroup($privacy, 'privacy', ts('Privacy'), '&nbsp;');
     // checkboxes for location type
     $location_type = array();
     $locationType = CRM_Core_PseudoConstant::locationType();
     foreach ($locationType as $locationTypeID => $locationTypeName) {
         $location_type[] = HTML_QuickForm::createElement('checkbox', $locationTypeID, null, $locationTypeName);
     }
     $this->addGroup($location_type, 'location_type', ts('Location Types'), '&nbsp;');
     // textbox for Activity Type
     $this->addElement('text', 'activity_type', ts('Activity Type'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_ActivityHistory', 'activity_type'));
     // Date selects for activity date
     $this->add('date', 'activity_date_from', ts('Activity Dates - From'), CRM_Core_SelectValues::date('relative'));
     $this->addRule('activity_date_from', ts('Select a valid date.'), 'qfDate');
     $this->add('date', 'activity_date_to', ts('To'), CRM_Core_SelectValues::date('relative'));
     $this->addRule('activity_date_to', ts('Select a valid date.'), 'qfDate');
     $this->assign('validCiviContribute', false);
     if (CRM_Utils_System::accessCiviContribute()) {
         $this->assign('validCiviContribute', true);
         require_once 'CRM/Contribute/Form/Search.php';
         CRM_Contribute_Form_Search::buildQuickFormCommon($this);
     }
     //Custom data Search Fields
     $this->customDataSearch();
     $this->buildQuickFormCommon();
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:72,代码来源:Advanced.php

示例12: buildMappingForm

 /**
  * Function to build the mapping form
  *
  * @params object $form        form object
  * @params string $mappingType mapping type (Export/Import/Search Builder)
  * @params int    $mappingId   mapping id
  * @params mixed  $columnCount column count is int for and array for search builder
  * @params int    $blockCount  block count (no of blocks shown) 
  *
  * @return none
  * @access public
  * @static
  */
 static function buildMappingForm(&$form, $mappingType = 'Export', $mappingId = null, $columnNo, $blockCount = 3, $exportMode = null)
 {
     if ($mappingType == 'Export') {
         $name = "Map";
         $columnCount = array('1' => $columnNo);
     } else {
         if ($mappingType == 'Search Builder') {
             $name = "Builder";
             $columnCount = $columnNo;
         }
     }
     //get the saved mapping details
     require_once 'CRM/Core/DAO/Mapping.php';
     require_once 'CRM/Contact/BAO/Contact.php';
     require_once 'CRM/Core/BAO/LocationType.php';
     if ($mappingType == 'Export') {
         $form->applyFilter('saveMappingName', 'trim');
         //to save the current mappings
         if (!isset($mappingId)) {
             $saveDetailsName = ts('Save this field mapping');
             $form->add('text', 'saveMappingName', ts('Name'));
             $form->add('text', 'saveMappingDesc', ts('Description'));
         } else {
             $form->assign('loadedMapping', $mappingId);
             $params = array('id' => $mappingId);
             $temp = array();
             $mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
             $form->assign('savedName', $mappingDetails->name);
             $form->add('hidden', 'mappingId', $mappingId);
             $form->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), null);
             $saveDetailsName = ts('Save as a new field mapping');
             $form->add('text', 'saveMappingName', ts('Name'));
             $form->add('text', 'saveMappingDesc', ts('Description'));
         }
         $form->addElement('checkbox', 'saveMapping', $saveDetailsName, null, array('onclick' => "showSaveDetails(this)"));
         $form->addFormRule(array('CRM_Export_Form_Map', 'formRule'), $form->get('mappingTypeId'));
     } else {
         if ($mappingType == 'Search Builder') {
             $form->addElement('submit', 'addBlock', ts('Also include contacts where'), array('class' => 'submit-link'));
         }
     }
     $defaults = array();
     $hasLocationTypes = array();
     $hasRelationTypes = array();
     $fields = array();
     if ($mappingType == 'Export') {
         $required = true;
     } else {
         if ($mappingType == 'Search Builder') {
             $required = false;
         }
     }
     $contactType = array('Individual', 'Household', 'Organization');
     foreach ($contactType as $value) {
         $relationfields[$value] = $fields[$value] =& CRM_Contact_BAO_Contact::exportableFields($value, false, $required);
         if ($mappingType == 'Export') {
             $relationships = array();
             $relationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(null, null, null, $value);
             asort($relationshipTypes);
             foreach ($relationshipTypes as $key => $var) {
                 list($type) = explode('_', $key);
                 $relationships[$key]['title'] = $var;
                 $relationships[$key]['headerPattern'] = '/' . preg_quote($var, '/') . '/';
                 $relationships[$key]['export'] = true;
                 $relationships[$key]['relationship_type_id'] = $type;
                 $relationships[$key]['related'] = true;
                 $relationships[$key]['hasRelationType'] = 1;
             }
             if (!empty($relationships)) {
                 $fields[$value] = array_merge($fields[$value], array('related' => array('title' => ts('- related contact info -'))), $relationships);
             }
         }
     }
     //get the current employer for mapping.
     if ($required) {
         $fields['Individual']['current_employer']['title'] = ts('Current Employer');
     }
     // add component fields
     $compArray = array();
     if (CRM_Core_Permission::access('Quest')) {
         require_once 'CRM/Quest/BAO/Student.php';
         $fields['Student'] =& CRM_Quest_BAO_Student::exportableFields();
         $compArray['Student'] = 'Student';
     }
     //we need to unset groups, tags, notes for component export
     require_once 'CRM/Export/Form/Select.php';
     if ($exportMode != CRM_Export_Form_Select::CONTACT_EXPORT) {
//.........这里部分代码省略.........
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:Mapping.php

示例13: buildQuickForm

 function buildQuickForm()
 {
     //get the saved mapping details
     require_once 'CRM/Core/DAO/Mapping.php';
     require_once 'CRM/Contact/BAO/Contact.php';
     require_once 'CRM/Core/BAO/LocationType.php';
     $mappingDAO =& new CRM_Core_DAO_Mapping();
     $mappingDAO->domain_id = CRM_Core_Config::domainID();
     $mappingDAO->mapping_type = 'Export';
     $mappingDAO->find();
     $mappingArray = array();
     while ($mappingDAO->fetch()) {
         $mappingArray[$mappingDAO->id] = $mappingDAO->name;
     }
     if (!empty($mappingArray)) {
         $this->assign('savedMapping', $mappingArray);
         $this->add('select', 'savedMapping', ts('Mapping Option'), array('' => '-select-') + $mappingArray);
         //if ( !isset($this->_loadedMappingId) ) {
         //$this->addRule('savedMapping',ts('Please select saved mappings.'), 'required');
         //}
         $this->addElement('submit', 'loadMapping', ts('Load Mapping'), array('class' => 'form-submit'));
     }
     //to save the current mappings
     if (!isset($this->_loadedMappingId)) {
         $saveDetailsName = ts('Save this field mapping');
         $this->add('text', 'saveMappingName', ts('Name'));
         $this->add('text', 'saveMappingDesc', ts('Description'));
     } else {
         //mapping is to be loaded from database
         $mapping =& new CRM_Core_DAO_MappingField();
         $mapping->mapping_id = $this->_loadedMappingId;
         $mapping->orderBy('column_number');
         $mapping->find();
         $mappingName = array();
         $mappingLocation = array();
         $mappingContactType = array();
         $mappingPhoneType = array();
         while ($mapping->fetch()) {
             if ($mapping->name) {
                 $mappingName[] = $mapping->name;
             }
             if ($mapping->contact_type) {
                 $mappingContactType[] = $mapping->contact_type;
             }
             if (!empty($mapping->location_type_id)) {
                 $mappingLocation[$mapping->column_number] = $mapping->location_type_id;
             }
             if (!empty($mapping->phone_type)) {
                 $mappingPhoneType[$mapping->column_number] = $mapping->phone_type;
             }
         }
         $this->assign('loadedMapping', $this->_loadedMappingId);
         $getMappingName =& new CRM_Core_DAO_Mapping();
         $getMappingName->id = $savedMapping;
         $getMappingName->mapping_type = 'Export';
         $getMappingName->find();
         while ($getMappingName->fetch()) {
             $mapperName = $getMappingName->name;
         }
         $this->assign('savedName', $mapperName);
         $this->add('hidden', 'mappingId', $this->_loadedMappingId);
         $this->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), null);
         $saveDetailsName = ts('Save as a new field mapping');
         $this->add('text', 'saveMappingName', ts('Name'));
         $this->add('text', 'saveMappingDesc', ts('Description'));
     }
     $this->addElement('checkbox', 'saveMapping', $saveDetailsName, null, array('onclick' => "showSaveDetails(this)"));
     $this->addFormRule(array('CRM_Contact_Form_Task_Export_Map', 'formRule'));
     //-------- end of saved mapping stuff ---------
     $this->_defaults = array();
     $hasLocationTypes = array();
     $contactId = array();
     $fields = array();
     $fields['Individual'] =& CRM_Contact_BAO_Contact::exportableFields('Individual', false, true);
     $fields['Household'] =& CRM_Contact_BAO_Contact::exportableFields('Household', false, true);
     $fields['Organization'] =& CRM_Contact_BAO_Contact::exportableFields('Organization', false, true);
     foreach ($fields as $key => $value) {
         foreach ($value as $key1 => $value1) {
             $this->_mapperFields[$key][$key1] = $value1['title'];
             $hasLocationTypes[$key][$key1] = $value1['hasLocationType'];
         }
     }
     $mapperKeys = array_keys($this->_mapperFields);
     $this->_location_types =& CRM_Core_PseudoConstant::locationType();
     $defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
     /* FIXME: dirty hack to make the default option show up first.  This
      * avoids a mozilla browser bug with defaults on dynamically constructed
      * selector widgets. */
     if ($defaultLocationType) {
         $defaultLocation = $this->_location_types[$defaultLocationType->id];
         unset($this->_location_types[$defaultLocationType->id]);
         $this->_location_types = array($defaultLocationType->id => $defaultLocation) + $this->_location_types;
     }
     $sel1 = array('' => '-select-') + CRM_Core_SelectValues::contactType();
     foreach ($sel1 as $key => $sel) {
         if ($key) {
             $sel2[$key] = $this->_mapperFields[$key];
         }
     }
     $sel3[''] = null;
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:101,代码来源:Map.php


注:本文中的CRM_Core_SelectValues::contactType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。