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


PHP CRM_Activity_BAO_Activity::exportableFields方法代码示例

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


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

示例1: array

 static function &getFields()
 {
     $fields = array();
     $fields = CRM_Case_BAO_Case::exportableFields();
     // add activity related fields
     $fields = array_merge($fields, CRM_Activity_BAO_Activity::exportableFields('Case'));
     return $fields;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:8,代码来源:Query.php

示例2: array_merge

 /**
  * Get fields.
  *
  * @param bool $excludeActivityFields
  *
  * @return array
  */
 public static function &getFields($excludeActivityFields = FALSE)
 {
     $fields = CRM_Case_BAO_Case::exportableFields();
     // add activity related fields
     if (!$excludeActivityFields) {
         $fields = array_merge($fields, CRM_Activity_BAO_Activity::exportableFields('Case'));
     }
     return $fields;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:16,代码来源:Query.php

示例3: array

 static function &getFields()
 {
     require_once 'CRM/Case/BAO/Case.php';
     $fields = array();
     $fields = CRM_Case_BAO_Case::exportableFields();
     // add activity related fields
     require_once 'CRM/Activity/BAO/Activity.php';
     $fields = array_merge($fields, CRM_Activity_BAO_Activity::exportableFields('Case'));
     return $fields;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:10,代码来源:Query.php

示例4: __construct

 /**
  * class constructor which also does all the work
  *
  * @param array   $params
  * @param array   $returnProperties
  * @param array   $fields
  * @param boolean $includeContactIds
  * @param boolean $strict
  * @param boolean $mode - mode the search is operating on
  *
  * @return Object
  * @access public
  */
 function __construct($params = NULL, $returnProperties = NULL, $fields = NULL, $includeContactIds = FALSE, $strict = FALSE, $mode = 1, $skipPermission = FALSE, $searchDescendentGroups = TRUE, $smartGroupCache = TRUE, $displayRelationshipType = NULL, $operator = 'AND')
 {
     // CRM_Core_Error::backtrace( );
     // CRM_Core_Error::debug( 'params', $params );
     // CRM_Core_Error::debug( 'post', $_POST );
     // CRM_Core_Error::debug( 'r', $returnProperties );
     $this->_params =& $params;
     if ($this->_params == NULL) {
         $this->_params = array();
     }
     if (empty($returnProperties)) {
         $this->_returnProperties = self::defaultReturnProperties($mode);
     } else {
         $this->_returnProperties =& $returnProperties;
     }
     $this->_includeContactIds = $includeContactIds;
     $this->_strict = $strict;
     $this->_mode = $mode;
     $this->_skipPermission = $skipPermission;
     $this->_smartGroupCache = $smartGroupCache;
     $this->_displayRelationshipType = $displayRelationshipType;
     $this->setOperator($operator);
     if ($fields) {
         $this->_fields =& $fields;
         $this->_search = FALSE;
         $this->_skipPermission = TRUE;
     } else {
         $this->_fields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE, TRUE);
         $fields = CRM_Core_Component::getQueryFields();
         unset($fields['note']);
         $this->_fields = array_merge($this->_fields, $fields);
         // add activity fields
         $fields = CRM_Activity_BAO_Activity::exportableFields();
         $this->_fields = array_merge($this->_fields, $fields);
     }
     // basically do all the work once, and then reuse it
     $this->initialize();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:51,代码来源:Query.php

示例5: fields

 static function fields()
 {
     $fields = array_merge(CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE), CRM_Core_Component::getQueryFields(), CRM_Contact_BAO_Query_Hook::singleton()->getFields(), CRM_Activity_BAO_Activity::exportableFields());
     return $fields;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:5,代码来源:Builder.php

示例6: whereClauseSingle

 /**
  * Where clause for a single field.
  *
  * @param $values
  * @param $query
  * @return void
  */
 public static function whereClauseSingle(&$values, &$query)
 {
     list($name, $op, $value, $grouping) = $values;
     $fields = CRM_Activity_BAO_Activity::exportableFields();
     $query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
     if ($query->_mode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
         $query->_skipDeleteClause = TRUE;
     }
     switch ($name) {
         case 'activity_type_id':
         case 'activity_status_id':
         case 'activity_engagement_level':
         case 'activity_subject':
         case 'activity_id':
             $qillName = $name;
             if (in_array($name, array('activity_engagement_level', 'activity_id'))) {
                 $name = $qillName = str_replace('activity_', '', $name);
             }
             if (in_array($name, array('activity_status_id', 'activity_subject'))) {
                 $name = str_replace('activity_', '', $name);
                 $qillName = str_replace('_id', '', $qillName);
             }
             $dataType = !empty($fields[$qillName]['type']) ? CRM_Utils_Type::typeToString($fields[$qillName]['type']) : 'String';
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_activity.{$name}", $op, $value, $dataType);
             list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Activity_DAO_Activity', $name, $value, $op);
             $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $fields[$qillName]['title'], 2 => $op, 3 => $value));
             break;
         case 'activity_type':
         case 'activity_status':
             $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("{$name}.label", $op, $value, 'String');
             list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Activity_DAO_Activity', $name, $value, $op);
             $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $fields[$name]['title'], 2 => $op, 3 => $value));
             $query->_tables[$name] = $query->_whereTables[$name] = 1;
             break;
         case 'activity_survey_id':
             if (!$value) {
                 break;
             }
             $value = CRM_Utils_Type::escape($value, 'Integer');
             $query->_where[$grouping][] = " civicrm_activity.source_record_id = {$value}";
             $query->_qill[$grouping][] = ts('Survey') . ' - ' . CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $value, 'title');
             break;
         case 'activity_role':
             CRM_Contact_BAO_Query::$_activityRole = $values[2];
             $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
             $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
             $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
             $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
             if ($values[2]) {
                 $query->_tables['civicrm_activity_contact'] = $query->_whereTables['civicrm_activity_contact'] = 1;
                 if ($values[2] == 1) {
                     $query->_where[$grouping][] = " civicrm_activity_contact.record_type_id = {$sourceID}";
                     $query->_qill[$grouping][] = ts('Activity created by');
                 } elseif ($values[2] == 2) {
                     $query->_where[$grouping][] = " civicrm_activity_contact.record_type_id = {$assigneeID}";
                     $query->_qill[$grouping][] = ts('Activity assigned to');
                 } elseif ($values[2] == 3) {
                     $query->_where[$grouping][] = " civicrm_activity_contact.record_type_id = {$targetID}";
                     $query->_qill[$grouping][] = ts('Activity targeted to');
                 }
             }
             break;
         case 'activity_test':
             // We don't want to include all tests for sql OR CRM-7827
             if (!$value || $query->getOperator() != 'OR') {
                 $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_activity.is_test", $op, $value, "Boolean");
                 if ($value) {
                     $query->_qill[$grouping][] = ts('Activity is a Test');
                 }
             }
             break;
         case 'activity_date':
         case 'activity_date_low':
         case 'activity_date_high':
             $query->dateQueryBuilder($values, 'civicrm_activity', 'activity_date', 'activity_date_time', ts('Activity Date'));
             break;
         case 'activity_taglist':
             $taglist = $value;
             $value = array();
             foreach ($taglist as $val) {
                 if ($val) {
                     $val = explode(',', $val);
                     foreach ($val as $tId) {
                         if (is_numeric($tId)) {
                             $value[$tId] = 1;
                         }
                     }
                 }
             }
         case 'activity_tags':
             $value = array_keys($value);
             $activityTags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
             $names = array();
//.........这里部分代码省略.........
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:101,代码来源:Query.php

示例7: __construct

 /**
  * Class constructor which also does all the work.
  *
  * @param array $params
  * @param array $returnProperties
  * @param array $fields
  * @param bool $includeContactIds
  * @param bool $strict
  * @param bool|int $mode - mode the search is operating on
  *
  * @param bool $skipPermission
  * @param bool $searchDescendentGroups
  * @param bool $smartGroupCache
  * @param null $displayRelationshipType
  * @param string $operator
  *
  * @return \CRM_Contact_BAO_Query
  */
 public function __construct($params = NULL, $returnProperties = NULL, $fields = NULL, $includeContactIds = FALSE, $strict = FALSE, $mode = 1, $skipPermission = FALSE, $searchDescendentGroups = TRUE, $smartGroupCache = TRUE, $displayRelationshipType = NULL, $operator = 'AND')
 {
     $this->_params =& $params;
     if ($this->_params == NULL) {
         $this->_params = array();
     }
     if (empty($returnProperties)) {
         $this->_returnProperties = self::defaultReturnProperties($mode);
     } else {
         $this->_returnProperties =& $returnProperties;
     }
     $this->_includeContactIds = $includeContactIds;
     $this->_strict = $strict;
     $this->_mode = $mode;
     $this->_skipPermission = $skipPermission;
     $this->_smartGroupCache = $smartGroupCache;
     $this->_displayRelationshipType = $displayRelationshipType;
     $this->setOperator($operator);
     if ($fields) {
         $this->_fields =& $fields;
         $this->_search = FALSE;
         $this->_skipPermission = TRUE;
     } else {
         $this->_fields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE, TRUE, FALSE, !$skipPermission);
         $fields = CRM_Core_Component::getQueryFields(!$this->_skipPermission);
         unset($fields['note']);
         $this->_fields = array_merge($this->_fields, $fields);
         // add activity fields
         $fields = CRM_Activity_BAO_Activity::exportableFields();
         $this->_fields = array_merge($this->_fields, $fields);
         // add any fields provided by hook implementers
         $extFields = CRM_Contact_BAO_Query_Hook::singleton()->getFields();
         $this->_fields = array_merge($this->_fields, $extFields);
     }
     // basically do all the work once, and then reuse it
     $this->initialize();
 }
开发者ID:vincent1892,项目名称:civicrm-core,代码行数:55,代码来源:Query.php

示例8: buildMappingForm

 /**
  * Build the mapping form.
  *
  * @param CRM_Core_Form $form
  * @param string $mappingType
  *   (Export/Import/Search Builder).
  * @param int $mappingId
  * @param int $columnNo
  * @param int $blockCount
  *   (no of blocks shown).
  * @param NULL $exportMode
  *
  * @return void
  */
 public static function buildMappingForm(&$form, $mappingType = 'Export', $mappingId = NULL, $columnNo, $blockCount = 3, $exportMode = NULL)
 {
     if ($mappingType == 'Export') {
         $name = "Map";
         $columnCount = array('1' => $columnNo);
     } elseif ($mappingType == 'Search Builder') {
         $name = "Builder";
         $columnCount = $columnNo;
     }
     //get the saved mapping details
     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'));
     } elseif ($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;
     } elseif ($mappingType == 'Search Builder') {
         $required = FALSE;
     }
     $contactType = array('Individual', 'Household', 'Organization');
     foreach ($contactType as $value) {
         $contactFields = CRM_Contact_BAO_Contact::exportableFields($value, FALSE, $required);
         $contactFields = array_merge($contactFields, CRM_Contact_BAO_Query_Hook::singleton()->getFields());
         // exclude the address options disabled in the Address Settings
         $fields[$value] = CRM_Core_BAO_Address::validateAddressOptions($contactFields);
         ksort($fields[$value]);
         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();
     //we need to unset groups, tags, notes for component export
     if ($exportMode != CRM_Export_Form_Select::CONTACT_EXPORT) {
         foreach (array('groups', 'tags', 'notes') as $value) {
             unset($fields['Individual'][$value]);
             unset($fields['Household'][$value]);
             unset($fields['Organization'][$value]);
         }
     }
     if ($mappingType == 'Search Builder') {
         //build the common contact fields array.
         $fields['Contact'] = array();
         foreach ($fields['Individual'] as $key => $value) {
//.........这里部分代码省略.........
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:101,代码来源:Mapping.php

示例9: preProcess

 /**
  * Set variables up before form is built.
  *
  * @return void
  */
 public function preProcess()
 {
     $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     if ($this->_gid) {
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'title');
         $this->setPageTitle(ts('Profile Field'));
         $url = CRM_Utils_System::url('civicrm/admin/uf/group/field', "reset=1&action=browse&gid={$this->_gid}");
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext($url);
         $breadCrumb = array(array('title' => ts('CiviCRM Profile Fields'), 'url' => $url));
         CRM_Utils_System::appendBreadCrumb($breadCrumb);
     }
     $showBestResult = CRM_Utils_Request::retrieve('sbr', 'Positive', CRM_Core_DAO::$_nullArray);
     if ($showBestResult) {
         $this->assign('showBestResult', $showBestResult);
     }
     $this->_fields = CRM_Contact_BAO_Contact::importableFields('All', TRUE, TRUE, TRUE, TRUE, TRUE);
     $this->_fields = array_merge(CRM_Activity_BAO_Activity::exportableFields('Activity'), $this->_fields);
     //unset campaign related fields.
     if (isset($this->_fields['activity_campaign_id'])) {
         $this->_fields['activity_campaign_id']['title'] = ts('Campaign');
         if (isset($this->_fields['activity_campaign'])) {
             unset($this->_fields['activity_campaign']);
         }
     }
     if (CRM_Core_Permission::access('CiviContribute')) {
         $this->_fields = array_merge(CRM_Contribute_BAO_Contribution::getContributionFields(FALSE), $this->_fields);
         $this->_fields = array_merge(CRM_Core_BAO_UFField::getContribBatchEntryFields(), $this->_fields);
     }
     if (CRM_Core_Permission::access('CiviMember')) {
         $this->_fields = array_merge(CRM_Member_BAO_Membership::getMembershipFields(), $this->_fields);
     }
     if (CRM_Core_Permission::access('CiviEvent')) {
         $this->_fields = array_merge(CRM_Event_BAO_Query::getParticipantFields(), $this->_fields);
     }
     if (CRM_Core_Permission::access('CiviCase')) {
         $this->_fields = array_merge(CRM_Case_BAO_Query::getFields(), $this->_fields);
     }
     $this->_fields = array_merge($this->_fields, CRM_Contact_BAO_Query_Hook::singleton()->getFields());
     $this->_selectFields = array();
     foreach ($this->_fields as $name => $field) {
         // lets skip note for now since we dont support it
         if ($name == 'note') {
             continue;
         }
         $this->_selectFields[$name] = $field['title'];
         $this->_hasLocationTypes[$name] = CRM_Utils_Array::value('hasLocationType', $field);
     }
     // lets add group, tag and current_employer to this list
     $this->_selectFields['group'] = ts('Group(s)');
     $this->_selectFields['tag'] = ts('Tag(s)');
     $this->_selectFields['current_employer'] = ts('Current Employer');
     $this->_selectFields['phone_and_ext'] = ts('Phone and Extension');
     //CRM-4363 check for in selector or searchable fields.
     $this->_hasSearchableORInSelector = CRM_Core_BAO_UFField::checkSearchableORInSelector($this->_gid);
     $this->assign('fieldId', $this->_id);
     if ($this->_id) {
         $fieldTitle = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFField', $this->_id, 'label');
         $this->assign('fieldTitle', $fieldTitle);
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:67,代码来源:Field.php

示例10: formRule

 /**
  * global validation rules for the form
  *
  * @param array $fields posted values of the form
  *
  * @return array list of errors to be posted back to the form
  * @static
  * @access public
  */
 static function formRule($values)
 {
     if (CRM_Utils_Array::value('addMore', $values) || CRM_Utils_Array::value('addBlock', $values)) {
         return TRUE;
     }
     $fields = array();
     $fields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE);
     $compomentFields = CRM_Core_Component::getQueryFields();
     $activityFields = CRM_Activity_BAO_Activity::exportableFields();
     $compomentFields = array_merge($compomentFields, $activityFields);
     $fields = array_merge($fields, $compomentFields);
     $fld = array();
     $fld = CRM_Core_BAO_Mapping::formattedFields($values, TRUE);
     $errorMsg = array();
     foreach ($fld as $k => $v) {
         if (!$v[1]) {
             $errorMsg["operator[{$v['3']}][{$v['4']}]"] = ts("Please enter the operator.");
         } else {
             // CRM-10338
             $v[2] = self::checkArrayKeyEmpty($v[2]);
             if (in_array($v[1], array('IS NULL', 'IS NOT NULL')) && !empty($v[2])) {
                 $errorMsg["value[{$v['3']}][{$v['4']}]"] = ts('Please clear your value if you want to use %1 operator.', array(1 => $v[1]));
             } elseif (($v[0] == 'group' || $v[0] == 'tag') && !empty($v[2])) {
                 $grpId = array_keys($v[2]);
                 if (!key($v[2])) {
                     $errorMsg["value[{$v['3']}][{$v['4']}]"] = ts("Please enter the value.");
                 }
                 if (count($grpId) > 1) {
                     if ($v[1] != 'IN' && $v[1] != 'NOT IN') {
                         $errorMsg["value[{$v['3']}][{$v['4']}]"] = ts("Please enter the valid value.");
                     }
                     foreach ($grpId as $val) {
                         $error = CRM_Utils_Type::validate($val, 'Integer', FALSE);
                         if ($error != $val) {
                             $errorMsg["value[{$v['3']}][{$v['4']}]"] = ts("Please enter valid value.");
                             break;
                         }
                     }
                 } else {
                     $error = CRM_Utils_Type::validate($grpId[0], 'Integer', FALSE);
                     if ($error != $grpId[0]) {
                         $errorMsg["value[{$v['3']}][{$v['4']}]"] = ts('Please enter valid %1 id.', array(1 => $v[0]));
                     }
                 }
             } elseif (substr($v[0], 0, 7) === 'do_not_' or substr($v[0], 0, 3) === 'is_') {
                 if (isset($v[2])) {
                     $v2 = array($v[2]);
                     if (!isset($v[2])) {
                         $errorMsg["value[{$v['3']}][{$v['4']}]"] = ts("Please enter the value.");
                     }
                     $error = CRM_Utils_Type::validate($v2[0], 'Integer', FALSE);
                     if ($error != $v2[0]) {
                         $errorMsg["value[{$v['3']}][{$v['4']}]"] = ts("Please enter valid value.");
                     }
                 } else {
                     $errorMsg["value[{$v['3']}][{$v['4']}]"] = ts("Please enter the value.");
                 }
             } elseif ($v[0] === 'sort_name' || $v[0] === 'display_name') {
                 $v2 = trim($v[2]);
                 if (empty($v2)) {
                     $errorMsg["value[{$v['3']}][{$v['4']}]"] = ts("Please enter the value.");
                 }
             } else {
                 if (substr($v[0], 0, 7) == 'custom_') {
                     $type = $fields[$v[0]]['data_type'];
                     // hack to handle custom data of type state and country
                     if (in_array($type, array('Country', 'StateProvince'))) {
                         $type = "Integer";
                     }
                 } else {
                     $fldName = $v[0];
                     // FIXME: no idea at this point what to do with this,
                     // FIXME: but definitely needs fixing.
                     if (substr($v[0], 0, 13) == 'contribution_') {
                         $fldName = substr($v[0], 13);
                     }
                     $fldValue = CRM_Utils_Array::value($fldName, $fields);
                     $fldType = CRM_Utils_Array::value('type', $fldValue);
                     $type = CRM_Utils_Type::typeToString($fldType);
                     // Check Empty values for Integer Or Boolean Or Date type For operators other than IS NULL and IS NOT NULL.
                     if (!in_array($v[1], array('IS NULL', 'IS NOT NULL'))) {
                         if (($type == 'Int' || $type == 'Boolean') && !trim($v[2]) && $v[2] != '0') {
                             $errorMsg["value[{$v['3']}][{$v['4']}]"] = ts("Please enter the value.");
                         } elseif ($type == 'Date' && !trim($v[2])) {
                             $errorMsg["value[{$v['3']}][{$v['4']}]"] = ts("Please enter the value.");
                         }
                     }
                 }
                 if ($type && empty($errorMsg)) {
                     // check for valid format while using IN Operator
                     if ($v[1] == 'IN') {
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Builder.php

示例11: __construct

 /**
  * class constructor which also does all the work
  *
  * @param array   $params
  * @param array   $returnProperties
  * @param array   $fields
  * @param boolean $includeContactIds
  * @param boolean $strict
  * @param boolean $mode - mode the search is operating on
  *
  * @return Object
  * @access public
  */
 function __construct($params = null, $returnProperties = null, $fields = null, $includeContactIds = false, $strict = false, $mode = 1, $skipPermission = false, $searchDescendentGroups = true, $smartGroupCache = true)
 {
     require_once 'CRM/Contact/BAO/Contact.php';
     // CRM_Core_Error::backtrace( );
     // CRM_Core_Error::debug_var( 'params', $params );
     // CRM_Core_Error::debug( 'post', $_POST );
     // CRM_Core_Error::debug( 'r', $returnProperties );
     $this->_params =& $params;
     if ($this->_params == null) {
         $this->_params = array();
     }
     if (empty($returnProperties)) {
         $this->_returnProperties =& self::defaultReturnProperties($mode);
     } else {
         $this->_returnProperties =& $returnProperties;
     }
     $this->_includeContactIds = $includeContactIds;
     $this->_strict = $strict;
     $this->_mode = $mode;
     $this->_skipPermission = $skipPermission;
     $this->_smartGroupCache = $smartGroupCache;
     if ($fields) {
         $this->_fields =& $fields;
         $this->_search = false;
         $this->_skipPermission = true;
     } else {
         require_once 'CRM/Contact/BAO/Contact.php';
         $this->_fields = CRM_Contact_BAO_Contact::exportableFields('All', false, true);
         require_once 'CRM/Core/Component.php';
         $fields =& CRM_Core_Component::getQueryFields();
         unset($fields['note']);
         $this->_fields = array_merge($this->_fields, $fields);
         // add activity fields
         require_once 'CRM/Activity/BAO/Activity.php';
         $fields = CRM_Activity_BAO_Activity::exportableFields();
         $this->_fields = array_merge($this->_fields, $fields);
     }
     // basically do all the work once, and then reuse it
     $this->initialize();
     // CRM_Core_Error::debug( $this );
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:54,代码来源:Query.php

示例12: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 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);
         // set it to null if so (avoids crappy E_NOTICE errors below
         $defaults['location_type_id'] = CRM_Utils_Array::value('location_type_id', $defaults);
         $specialFields = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'postal_code', 'postal_code_suffix', 'geo_code_1', 'geo_code_2', 'state_province', 'country', 'county', 'phone', 'email', 'im', 'address_name');
         if (!$defaults['location_type_id'] && in_array($defaults['field_name'], $specialFields)) {
             $defaults['location_type_id'] = 0;
         }
         $defaults['field_name'] = array($defaults['field_type'], $defaults['field_name'], $defaults['location_type_id'], CRM_Utils_Array::value('phone_type_id', $defaults));
         $this->_gid = $defaults['uf_group_id'];
     } else {
         $defaults['is_active'] = 1;
     }
     if ($this->_action & CRM_Core_Action::ADD) {
         $fieldValues = array('uf_group_id' => $this->_gid);
         $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_UFField', $fieldValues);
     }
     // 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::importableFields('Individual', false, false, true);
     $fields['Household'] =& CRM_Contact_BAO_Contact::importableFields('Household', false, false, true);
     $fields['Organization'] =& CRM_Contact_BAO_Contact::importableFields('Organization', false, false, true);
     // add current employer for individuals
     $fields['Individual']['current_employer'] = array('name' => 'organization_name', 'title' => ts('Current Employer'));
     require_once 'CRM/Core/BAO/Preferences.php';
     $addressOptions = CRM_Core_BAO_Preferences::valueOptions('address_options', true, null, true);
     if (!$addressOptions['county']) {
         unset($fields['Individual']['county']);
         unset($fields['Household']['county']);
         unset($fields['Organization']['county']);
     }
     //build the common contact fields array CRM-3037.
     foreach ($fields['Individual'] as $key => $value) {
         if (CRM_Utils_Array::value($key, $fields['Household']) && CRM_Utils_Array::value($key, $fields['Organization'])) {
             $fields['Contact'][$key] = $value;
             //as we move common fields to contacts. There fore these fields
             //are unset from resoective array's.
             unset($fields['Individual'][$key]);
             unset($fields['Household'][$key]);
             unset($fields['Organization'][$key]);
         }
     }
     // add current employer for individuals
     $fields['Contact']['id'] = array('name' => 'id', 'title' => ts('Internal Contact ID'));
     unset($fields['Contact']['contact_type']);
     // since we need a hierarchical list to display contact types & subtypes,
     // this is what we going to display in first selector
     $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(false, false);
     unset($contactTypes['']);
     // include Subtypes For Profile
     $subTypes = CRM_Contact_BAO_ContactType::subTypeInfo();
     foreach ($subTypes as $name => $val) {
         //custom fields for sub type
         $subTypeFields = CRM_Core_BAO_CustomField::getFieldsForImport($name);
         if (array_key_exists($val['parent'], $fields)) {
             $fields[$name] = $fields[$val['parent']] + $subTypeFields;
         } else {
             $fields[$name] = $subTypeFields;
         }
     }
     //group selected and unwanted fields list
     require_once 'CRM/Core/BAO/UFGroup.php';
     $groupFieldList = array_merge(CRM_Core_BAO_UFGroup::getFields($this->_gid, false, null, null, null, true, null, true), array('note', 'email_greeting_custom', 'postal_greeting_custom', 'addressee_custom', 'id'));
     //unset selected fields
     foreach ($groupFieldList as $key => $value) {
         if (is_integer($key)) {
             unset($fields['Individual'][$value], $fields['Household'][$value], $fields['Organization'][$value]);
             continue;
         }
         if (CRM_Utils_Array::value('field_name', $defaults) && $defaults['field_name']['0'] == $value['field_type'] && $defaults['field_name']['1'] == $key) {
             continue;
         }
         unset($fields[$value['field_type']][$key]);
     }
     unset($subTypes);
     if (CRM_Core_Permission::access('Quest')) {
         require_once 'CRM/Quest/BAO/Student.php';
         $fields['Student'] =& CRM_Quest_BAO_Student::exportableFields();
     }
     if (CRM_Core_Permission::access('CiviContribute')) {
         $contribFields =& CRM_Contribute_BAO_Contribution::getContributionFields();
         if (!empty($contribFields)) {
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Field.php

示例13: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     if ($this->_gid) {
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'title');
         CRM_Utils_System::setTitle($this->_title . ' - ' . ts('CiviCRM Profile Fields'));
         $url = CRM_Utils_System::url('civicrm/admin/uf/group/field', "reset=1&action=browse&gid={$this->_gid}");
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext($url);
         $breadCrumb = array(array('title' => ts('CiviCRM Profile Fields'), 'url' => $url));
         CRM_Utils_System::appendBreadCrumb($breadCrumb);
     }
     $showBestResult = CRM_Utils_Request::retrieve('sbr', 'Positive', CRM_Core_DAO::$_nullArray);
     if ($showBestResult) {
         $this->assign('showBestResult', $showBestResult);
     }
     $this->_fields = CRM_Contact_BAO_Contact::importableFields('All', TRUE, TRUE, TRUE);
     $this->_fields = array_merge(CRM_Activity_BAO_Activity::exportableFields('Activity'), $this->_fields);
     $this->_contriBatchEntryFields = array('send_receipt' => array('name' => 'send_receipt', 'title' => ts('Send Receipt')), 'soft_credit' => array('name' => 'soft_credit', 'title' => ts('Soft Credit')), 'product_name' => array('name' => 'product_name', 'title' => ts('Premiums')), 'contribution_note' => array('name' => 'contribution_note', 'title' => ts('Contribution Note')));
     $this->_memberBatchEntryFields = array('send_receipt' => array('name' => 'send_receipt', 'title' => ts('Send Receipt')), 'soft_credit' => array('name' => 'soft_credit', 'title' => ts('Soft Credit')), 'product_name' => array('name' => 'product_name', 'title' => ts('Premiums')), 'contribution_type' => array('name' => 'contribution_type', 'title' => ts('Contribution Type')), 'total_amount' => array('name' => 'total_amount', 'title' => ts('Total Amount')), 'receive_date' => array('name' => 'receive_date', 'title' => ts('Receive Date')), 'payment_instrument' => array('name' => 'payment_instrument', 'title' => ts('Payment Instrument')), 'contribution_status_id' => array('name' => 'contribution_status_id', 'title' => ts('Contribution Status')));
     //unset campaign related fields.
     if (isset($this->_fields['activity_campaign_id'])) {
         $this->_fields['activity_campaign_id']['title'] = ts('Campaign');
         if (isset($this->_fields['activity_campaign'])) {
             unset($this->_fields['activity_campaign']);
         }
     }
     if (CRM_Core_Permission::access('CiviContribute')) {
         $this->_fields = array_merge(CRM_Contribute_BAO_Contribution::getContributionFields(FALSE), $this->_fields);
         $this->_fields = array_merge($this->_contriBatchEntryFields, $this->_fields);
     }
     if (CRM_Core_Permission::access('CiviMember')) {
         $this->_fields = array_merge(CRM_Member_BAO_Membership::getMembershipFields(), $this->_fields);
     }
     if (CRM_Core_Permission::access('CiviEvent')) {
         $this->_fields = array_merge(CRM_Event_BAO_Query::getParticipantFields(TRUE), $this->_fields);
     }
     if (CRM_Core_Permission::access('Quest')) {
         $this->_fields = array_merge(CRM_Quest_BAO_Student::exportableFields(), $this->_fields);
     }
     $this->_selectFields = array();
     foreach ($this->_fields as $name => $field) {
         // lets skip note for now since we dont support it
         if ($name == 'note') {
             continue;
         }
         $this->_selectFields[$name] = $field['title'];
         $this->_hasLocationTypes[$name] = CRM_Utils_Array::value('hasLocationType', $field);
     }
     // lets add group, tag and current_employer to this list
     $this->_selectFields['group'] = ts('Group(s)');
     $this->_selectFields['tag'] = ts('Tag(s)');
     $this->_selectFields['current_employer'] = ts('Current Employer');
     //CRM-4363 check for in selector or searchable fields.
     $this->_hasSearchableORInSelector = CRM_Core_BAO_UFField::checkSearchableORInSelector($this->_gid);
     $this->assign('fieldId', $this->_id);
     if ($this->_id) {
         $fieldTitle = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFField', $this->_id, 'label');
         $this->assign('fieldTitle', $fieldTitle);
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:68,代码来源:Field.php

示例14: getFields

 /**
  * get all the fields that belong to the group with the name title
  *
  * @param mix      $id           the id of the UF group or ids of ufgroup
  * @param int      $register     are we interested in registration fields
  * @param int      $action       what action are we doing
  * @param int      $visibility   visibility of fields we are interested in
  * @param          $searchable
  * @param boolean  $showall
  * @param string   $restrict     should we restrict based on a specified profile type
  *
  * @return array   the fields that belong to this ufgroup(s)
  * @static
  * @access public
  */
 static function getFields($id, $register = false, $action = null, $visibility = null, $searchable = null, $showAll = false, $restrict = null, $skipPermission = false, $ctype = null, $permissionType = CRM_Core_Permission::CREATE)
 {
     if (!is_array($id)) {
         $id = CRM_Utils_Type::escape($id, 'Positive');
         $profileIds = array($id);
     } else {
         $profileIds = $id;
     }
     $gids = implode(',', $profileIds);
     $params = array();
     if ($restrict) {
         $query = "SELECT g.* from civicrm_uf_group g, civicrm_uf_join j \n                WHERE g.id IN ( {$gids} ) \n                AND j.uf_group_id IN ( {$gids} )\n                AND j.module      = %1\n                ";
         $params = array(1 => array($restrict, 'String'));
     } else {
         $query = "SELECT g.* from civicrm_uf_group g WHERE g.id IN ( {$gids} ) ";
     }
     if (!$showAll) {
         $query .= " AND g.is_active = 1";
     }
     // add permissioning for profiles only if not registration
     if (!$skipPermission) {
         require_once 'CRM/Core/Permission.php';
         $permissionClause = CRM_Core_Permission::ufGroupClause($permissionType, 'g.');
         $query .= " AND {$permissionClause} ";
     }
     $group =& CRM_Core_DAO::executeQuery($query, $params);
     $fields = array();
     $validGroup = false;
     while ($group->fetch()) {
         $validGroup = true;
         $where = " WHERE uf_group_id = {$group->id}";
         if ($searchable) {
             $where .= " AND is_searchable = 1";
         }
         if (!$showAll) {
             $where .= " AND is_active = 1";
         }
         if ($visibility) {
             $clause = array();
             if ($visibility & self::PUBLIC_VISIBILITY) {
                 $clause[] = 'visibility = "Public Pages"';
             }
             if ($visibility & self::ADMIN_VISIBILITY) {
                 $clause[] = 'visibility = "User and User Admin Only"';
             }
             if ($visibility & self::LISTINGS_VISIBILITY) {
                 $clause[] = 'visibility = "Public Pages and Listings"';
             }
             if (!empty($clause)) {
                 $where .= ' AND ( ' . implode(' OR ', $clause) . ' ) ';
             }
         }
         $query = "SELECT * FROM civicrm_uf_field {$where} ORDER BY weight, field_name";
         $field =& CRM_Core_DAO::executeQuery($query);
         require_once 'CRM/Contact/BAO/Contact.php';
         if (!$showAll) {
             $importableFields =& CRM_Contact_BAO_Contact::importableFields("All");
         } else {
             $importableFields =& CRM_Contact_BAO_Contact::importableFields("All", false, true);
         }
         require_once 'CRM/Core/Component.php';
         require_once 'CRM/Core/BAO/UFField.php';
         require_once 'CRM/Activity/BAO/Activity.php';
         $profileType = CRM_Core_BAO_UFField::getProfileType($group->id);
         if ($profileType == 'Activity') {
             $componentFields = CRM_Activity_BAO_Activity::exportableFields('Activity');
         } else {
             $componentFields = CRM_Core_Component::getQueryFields();
         }
         $importableFields = array_merge($importableFields, $componentFields);
         $importableFields['group']['title'] = ts('Group(s)');
         $importableFields['group']['where'] = null;
         $importableFields['tag']['title'] = ts('Tag(s)');
         $importableFields['tag']['where'] = null;
         $locationFields = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'postal_code', 'postal_code_suffix', 'geo_code_1', 'geo_code_2', 'state_province', 'country', 'county', 'phone', 'email', 'im', 'address_name');
         //get location type
         $locationType = array();
         $locationType =& CRM_Core_PseudoConstant::locationType();
         require_once 'CRM/Core/BAO/CustomField.php';
         $customFields = CRM_Core_BAO_CustomField::getFieldsForImport($ctype);
         // hack to add custom data for components
         $components = array("Contribution", "Participant", "Membership", "Activity");
         foreach ($components as $value) {
             $customFields = array_merge($customFields, CRM_Core_BAO_CustomField::getFieldsForImport($value));
         }
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:UFGroup.php


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