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


PHP CRM_Core_BAO_CustomGroup::retrieve方法代码示例

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


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

示例1: preProcess

 /**
  * Set variables up before form is built.
  *
  *
  * @return void
  */
 public function preProcess()
 {
     // current set id
     $this->_id = $this->get('id');
     if ($this->_id && ($isReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_id, 'is_reserved', 'id'))) {
         CRM_Core_Error::fatal("You cannot edit the settings of a reserved custom field-set.");
     }
     // setting title for html page
     if ($this->_action == CRM_Core_Action::UPDATE) {
         $title = CRM_Core_BAO_CustomGroup::getTitle($this->_id);
         CRM_Utils_System::setTitle(ts('Edit %1', array(1 => $title)));
     } elseif ($this->_action == CRM_Core_Action::VIEW) {
         $title = CRM_Core_BAO_CustomGroup::getTitle($this->_id);
         CRM_Utils_System::setTitle(ts('Preview %1', array(1 => $title)));
     } else {
         CRM_Utils_System::setTitle(ts('New Custom Field Set'));
     }
     if (isset($this->_id)) {
         $params = array('id' => $this->_id);
         CRM_Core_BAO_CustomGroup::retrieve($params, $this->_defaults);
         $subExtends = CRM_Utils_Array::value('extends_entity_column_value', $this->_defaults);
         if (!empty($subExtends)) {
             $this->_subtypes = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($subExtends, 1, -1));
         }
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:32,代码来源:Group.php

示例2: preProcess

 /**
  * set up variables to build the form
  *
  * @return void
  * @acess protected
  */
 function preProcess()
 {
     $this->_id = $this->get('id');
     $defaults = array();
     $params = array('id' => $this->_id);
     CRM_Core_BAO_CustomGroup::retrieve($params, $defaults);
     $this->_title = $defaults['title'];
     $this->assign('name', $this->_title);
     CRM_Utils_System::setTitle(ts('Confirm Custom Group Delete'));
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:16,代码来源:DeleteGroup.php

示例3: testRetrieve

 /**
  * Function to test retrieve()
  */
 function testRetrieve()
 {
     $customGrouptitle = 'My Custom Group';
     $groupParams = array('title' => $customGrouptitle, 'name' => 'my_custom_group', 'style' => 'Tab', 'extends' => 'Individual', 'help_pre' => 'Custom Group Help Pre', 'help_post' => 'Custom Group Help Post', 'is_active' => 1, 'collapse_display' => 1, 'weight' => 2);
     $customGroup = Custom::createGroup($groupParams);
     $customGroupId = $customGroup->id;
     $params = array('id' => $customGroupId);
     require_once 'CRM/Core/BAO/CustomGroup.php';
     $customGroup = CRM_Core_BAO_CustomGroup::retrieve($params, $dafaults);
     $dbCustomGroupTitle = $this->assertDBNotNull('CRM_Core_DAO_CustomGroup', $customGroupId, 'title', 'id', 'Database check for custom group record.');
     $this->assertEquals($customGrouptitle, $dbCustomGroupTitle);
     //check retieve values
     $this->assertAttributesEquals($groupParams, $dafaults);
     //cleanup DB by deleting customGroup
     Custom::deleteGroup($customGroup);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:19,代码来源:CustomGroupTest.php

示例4: preProcess

 /**
  * set up variables to build the form
  *
  * @return void
  * @acess protected
  */
 function preProcess()
 {
     $this->_id = $this->get('id');
     $defaults = array();
     $params = array('id' => $this->_id);
     CRM_Core_BAO_CustomGroup::retrieve($params, $defaults);
     $this->_title = $defaults['title'];
     //check wheter this contain any custom fields
     $customField = new CRM_Core_DAO_CustomField();
     $customField->custom_group_id = $this->_id;
     if ($customField->find(TRUE)) {
         CRM_Core_Session::setStatus(ts("The Group '%1' cannot be deleted! You must Delete all custom fields in this group prior to deleting the group.", array(1 => $this->_title)), ts('Deletion Error'), 'error');
         $url = CRM_Utils_System::url('civicrm/admin/custom/group', "reset=1");
         CRM_Utils_System::redirect($url);
         return TRUE;
     }
     $this->assign('title', $this->_title);
     CRM_Utils_System::setTitle(ts('Confirm Custom Group Delete'));
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:25,代码来源:DeleteGroup.php

示例5: buildRecipientContacts


//.........这里部分代码省略.........
             $contactField = 'e.contact_id';
             $table = 'civicrm_membership e';
             // build where clause
             if ($status == 2) {
                 //auto-renew memberships
                 $where[] = "e.contribution_recur_id IS NOT NULL ";
             } elseif ($status == 1) {
                 $where[] = "e.contribution_recur_id IS NULL ";
             }
             // build where clause
             if (!empty($value)) {
                 $where[] = "e.membership_type_id IN ({$value})";
             } else {
                 $where[] = "e.membership_type_id IS NULL";
             }
             $where[] = "( e.is_override IS NULL OR e.is_override = 0 )";
             $dateField = str_replace('membership_', 'e.', $actionSchedule->start_action_date);
             $notINClause = self::permissionedRelationships($contactField);
             $membershipStatus = CRM_Member_PseudoConstant::membershipStatus(NULL, "(is_current_member = 1 OR name = 'Expired')", 'id');
             $mStatus = implode(',', $membershipStatus);
             $where[] = "e.status_id IN ({$mStatus})";
         }
         if ($mapping->entity == 'civicrm_contact') {
             if ($value == 'birth_date') {
                 $dateDBField = 'birth_date';
                 $table = 'civicrm_contact e';
                 $contactField = 'e.id';
                 $where[] = 'e.is_deleted = 0';
                 $where[] = 'e.is_deceased = 0';
             } else {
                 //custom field
                 $customFieldParams = array('id' => substr($value, 7));
                 $customGroup = $customField = array();
                 CRM_Core_BAO_CustomField::retrieve($customFieldParams, $customField);
                 $dateDBField = $customField['column_name'];
                 $customGroupParams = array('id' => $customField['custom_group_id'], $customGroup);
                 CRM_Core_BAO_CustomGroup::retrieve($customGroupParams, $customGroup);
                 $from = $table = "{$customGroup['table_name']} e";
                 $contactField = 'e.entity_id';
                 $where[] = '1';
                 // possible to have no "where" in this case
             }
             $status_ = explode(',', $status);
             if (in_array(2, $status_)) {
                 // anniversary mode:
                 $dateField = 'DATE_ADD(e.' . $dateDBField . ', INTERVAL ROUND(DATEDIFF(DATE(' . $now . '), e.' . $dateDBField . ') / 365) YEAR)';
                 $anniversary = true;
             } else {
                 // regular mode:
                 $dateField = 'e.' . $dateDBField;
             }
             // TODO get this working
             // TODO: Make sure everything's provided for repetition, etc.
         }
         // CRM-13577 Introduce Smart Groups Handling
         if ($actionSchedule->group_id) {
             // Need to check if its a smart group or not
             // Then decide which table to join onto the query
             $group = CRM_Contact_DAO_Group::getTableName();
             // Get the group information
             $sql = "\nSELECT     {$group}.id, {$group}.cache_date, {$group}.saved_search_id, {$group}.children\nFROM       {$group}\nWHERE      {$group}.id = {$actionSchedule->group_id}\n";
             $groupDAO = CRM_Core_DAO::executeQuery($sql);
             $isSmartGroup = FALSE;
             if ($groupDAO->fetch() && !empty($groupDAO->saved_search_id)) {
                 // Check that the group is in place in the cache and up to date
                 CRM_Contact_BAO_GroupContactCache::check($actionSchedule->group_id);
开发者ID:ruchirapingale,项目名称:civicrm-core,代码行数:67,代码来源:ActionSchedule.php

示例6: testRetrieveInvalidParams

 /**
  * Test retrieve() with Inalid Params
  */
 public function testRetrieveInvalidParams()
 {
     $params = array('id' => 99);
     $customGroup = CRM_Core_BAO_CustomGroup::retrieve($params, $dafaults);
     $this->assertNull($customGroup, 'Check that no custom Group is retreived');
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:9,代码来源:CustomGroupTest.php

示例7: formRuleCustomDataExtentColumnValue

 /**
  * Validation rule for custom data extends entity column values.
  *
  * @param Object $customField
  *   Custom field.
  * @param int $gid
  *   Group Id.
  * @param string $fieldType
  *   Group type of the field.
  * @param array $errors
  *   Collect errors.
  *
  * @return array
  *   list of errors to be posted back to the form
  */
 public static function formRuleCustomDataExtentColumnValue($customField, $gid, $fieldType, &$errors)
 {
     // fix me : check object $customField
     if (in_array($fieldType, array('Participant', 'Contribution', 'Membership', 'Activity', 'Case'))) {
         $params = array('id' => $customField->custom_group_id);
         $customGroup = array();
         CRM_Core_BAO_CustomGroup::retrieve($params, $customGroup);
         if ($fieldType != CRM_Utils_Array::value('extends', $customGroup) || empty($customGroup['extends_entity_column_value'])) {
             return $errors;
         }
         $extendsColumnValues = array();
         foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $customGroup['extends_entity_column_value']) as $val) {
             if ($val) {
                 $extendsColumnValues[] = $val;
             }
         }
         if (empty($extendsColumnValues)) {
             return $errors;
         }
         $fieldTypeValues = CRM_Core_BAO_UFGroup::groupTypeValues($gid, $fieldType);
         if (empty($fieldTypeValues[$fieldType])) {
             return;
         }
         $disallowedTypes = array_diff($extendsColumnValues, $fieldTypeValues[$fieldType]);
         if (!empty($disallowedTypes)) {
             $errors['field_name'] = ts('Profile is already having custom fields extending different group types, you can not add or update this custom field.');
         }
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:44,代码来源:Field.php

示例8: createQuery

 /**
  * Generate a query to locate recipients who match the given
  * schedule.
  *
  * @param \CRM_Core_DAO_ActionSchedule $schedule
  *   The schedule as configured by the administrator.
  * @param string $phase
  *   See, e.g., RecipientBuilder::PHASE_RELATION_FIRST.
  * @param array $defaultParams
  *
  * @return \CRM_Utils_SQL_Select
  * @throws \CRM_Core_Exception
  * @see RecipientBuilder
  */
 public function createQuery($schedule, $phase, $defaultParams)
 {
     $selectedValues = (array) \CRM_Utils_Array::explodePadded($schedule->entity_value);
     $selectedStatuses = (array) \CRM_Utils_Array::explodePadded($schedule->entity_status);
     // FIXME: This assumes that $values only has one field, but UI shows multiselect.
     // Properly supporting multiselect would require total rewrite of this function.
     if (count($selectedValues) != 1 || !isset($selectedValues[0])) {
         throw new \CRM_Core_Exception("Error: Scheduled reminders may only have one contact field.");
     } elseif (in_array($selectedValues[0], $this->contactDateFields)) {
         $dateDBField = $selectedValues[0];
         $query = \CRM_Utils_SQL_Select::from("{$this->entity} e")->param($defaultParams);
         $query->param(array('casAddlCheckFrom' => 'civicrm_contact e', 'casContactIdField' => 'e.id', 'casEntityIdField' => 'e.id', 'casContactTableAlias' => 'e'));
         $query->where('e.is_deleted = 0 AND e.is_deceased = 0');
     } else {
         //custom field
         $customFieldParams = array('id' => substr($selectedValues[0], 7));
         $customGroup = $customField = array();
         \CRM_Core_BAO_CustomField::retrieve($customFieldParams, $customField);
         $dateDBField = $customField['column_name'];
         $customGroupParams = array('id' => $customField['custom_group_id'], $customGroup);
         \CRM_Core_BAO_CustomGroup::retrieve($customGroupParams, $customGroup);
         $query = \CRM_Utils_SQL_Select::from("{$customGroup['table_name']} e")->param($defaultParams);
         $query->param(array('casAddlCheckFrom' => "{$customGroup['table_name']} e", 'casContactIdField' => 'e.entity_id', 'casEntityIdField' => 'e.id', 'casContactTableAlias' => NULL));
         $query->where('1');
         // possible to have no "where" in this case
     }
     $query['casDateField'] = 'e.' . $dateDBField;
     if (in_array(2, $selectedStatuses)) {
         $query['casAnniversaryMode'] = 1;
         $query['casDateField'] = 'DATE_ADD(' . $query['casDateField'] . ', INTERVAL ROUND(DATEDIFF(DATE(' . $query['casNow'] . '), ' . $query['casDateField'] . ') / 365) YEAR)';
     }
     return $query;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:47,代码来源:ActionMapping.php

示例9: preProcess

 /**
  * Function to set variables up before form is built
  * 
  * @param null
  * 
  * @return void
  * @access public
  */
 public function preProcess()
 {
     require_once 'CRM/Core/BAO/CustomGroup.php';
     // current set id
     $this->_id = $this->get('id');
     // setting title for html page
     if ($this->_action == CRM_Core_Action::UPDATE) {
         $title = CRM_Core_BAO_CustomGroup::getTitle($this->_id);
         CRM_Utils_System::setTitle(ts('Edit %1', array(1 => $title)));
     } else {
         if ($this->_action == CRM_Core_Action::VIEW) {
             $title = CRM_Core_BAO_CustomGroup::getTitle($this->_id);
             CRM_Utils_System::setTitle(ts('Preview %1', array(1 => $title)));
         } else {
             CRM_Utils_System::setTitle(ts('New Custom Field Set'));
         }
     }
     if (isset($this->_id)) {
         $params = array('id' => $this->_id);
         CRM_Core_BAO_CustomGroup::retrieve($params, $this->_defaults);
         $subExtends = CRM_Utils_Array::value('extends_entity_column_value', $this->_defaults);
         if (!empty($subExtends)) {
             $this->_subtypes = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($subExtends, 1, -1));
         }
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:34,代码来源:Group.php

示例10: setDefaultValues

 /**
  * This function sets the default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  * 
  * @param null
  * 
  * @return array   array of default values
  * @access public
  */
 function setDefaultValues()
 {
     $defaults = array();
     if ($this->_action == CRM_CORE_ACTION_ADD) {
         $defGroup =& new CRM_Core_DAO_CustomGroup();
         $defGroup->domain_id = CRM_Core_Config::domainID();
         $defGroup->orderBy('weight DESC');
         $defGroup->find();
         if ($defGroup->fetch()) {
             $defaults['weight'] = $defGroup->weight + 1;
         } else {
             $defaults['weight'] = 1;
         }
     }
     if (isset($this->_id)) {
         $params = array('id' => $this->_id);
         CRM_Core_BAO_CustomGroup::retrieve($params, $defaults);
     } else {
         $defaults['is_active'] = 1;
         $defaults['style'] = 'Inline';
     }
     return $defaults;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:32,代码来源:Group.php


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