• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CRM_Core_DAO_CustomGroup类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: civicrm_api3_custom_group_delete

/**
 * Use this API to delete an existing group.
 *
 * @param array $params
 *
 * @return array
 */
function civicrm_api3_custom_group_delete($params)
{
    $values = new CRM_Core_DAO_CustomGroup();
    $values->id = $params['id'];
    $values->find(TRUE);
    $result = CRM_Core_BAO_CustomGroup::deleteGroup($values, TRUE);
    return $result ? civicrm_api3_create_success() : civicrm_api3_create_error('Error while deleting custom group');
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:15,代码来源:CustomGroup.php


示例2: updateValue

 /**
  * When changing the value of an option this is called to update all corresponding custom data
  *
  * @param int $optionId
  * @param string $newValue
  */
 public static function updateValue($optionId, $newValue)
 {
     $optionValue = new CRM_Core_DAO_OptionValue();
     $optionValue->id = $optionId;
     $optionValue->find(TRUE);
     $oldValue = $optionValue->value;
     if ($oldValue == $newValue) {
         return;
     }
     $customField = new CRM_Core_DAO_CustomField();
     $customField->option_group_id = $optionValue->option_group_id;
     $customField->find();
     while ($customField->fetch()) {
         $customGroup = new CRM_Core_DAO_CustomGroup();
         $customGroup->id = $customField->custom_group_id;
         $customGroup->find(TRUE);
         if (CRM_Core_BAO_CustomField::isSerialized($customField)) {
             $params = array(1 => array(CRM_Utils_Array::implodePadded($oldValue), 'String'), 2 => array(CRM_Utils_Array::implodePadded($newValue), 'String'), 3 => array('%' . CRM_Utils_Array::implodePadded($oldValue) . '%', 'String'));
         } else {
             $params = array(1 => array($oldValue, 'String'), 2 => array($newValue, 'String'), 3 => array($oldValue, 'String'));
         }
         $sql = "UPDATE `{$customGroup->table_name}` SET `{$customField->column_name}` = REPLACE(`{$customField->column_name}`, %1, %2) WHERE `{$customField->column_name}` LIKE %3";
         $customGroup->free();
         CRM_Core_DAO::executeQuery($sql, $params);
     }
     $customField->free();
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:33,代码来源:CustomOption.php


示例3: postProcess

 /**
  * Process the form when submitted
  *
  * @return void
  * @access public
  */
 public function postProcess()
 {
     $group = new CRM_Core_DAO_CustomGroup();
     $group->id = $this->_id;
     $group->find(TRUE);
     $wt = CRM_Utils_Weight::delWeight('CRM_Core_DAO_CustomGroup', $this->_id);
     CRM_Core_BAO_CustomGroup::deleteGroup($group);
     CRM_Core_Session::setStatus(ts("The Group '%1' has been deleted.", array(1 => $group->title)), '', 'success');
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:15,代码来源:DeleteGroup.php


示例4: array

 /**
  * Store and return an array of all active custom fields.
  *
  * @param string      $customDataType      type of Custom Data
  * @param boolean     $showAll             If true returns all fields (includes disabled fields)
  * @param boolean     $inline              If true returns all inline fields (includes disabled fields)
  * @param int         $customDataSubType   Custom Data sub type value
  * @param int         $customDataSubName   Custom Data sub name value
  * @param boolean     $onlyParent          return only top level custom data, for eg, only Participant and ignore subname and subtype  
  *
  * @return array      $fields - an array of active custom fields.
  *
  * @access public
  * @static
  */
 public static function &getFields($customDataType = 'Individual', $showAll = false, $inline = false, $customDataSubType = null, $customDataSubName = null, $onlyParent = false)
 {
     $onlySubType = false;
     if ($customDataType && !is_array($customDataType)) {
         if (in_array($customDataType, CRM_Contact_BAO_ContactType::subTypes())) {
             // This is the case when getFieldsForImport() requires fields
             // limited strictly to a subtype.
             $customDataSubType = $customDataType;
             $customDataType = CRM_Contact_BAO_ContactType::getBasicType($customDataType);
             $onlySubType = true;
         }
         if (in_array($customDataType, array_keys(CRM_Core_SelectValues::customGroupExtends()))) {
             // this makes the method flexible to support retrieving fields
             // for multiple extends value.
             $customDataType = array($customDataType);
         }
     }
     if (is_array($customDataType)) {
         $cacheKey = implode('_', $customDataType);
     } else {
         $cacheKey = $customDataType;
     }
     $cacheKey .= $customDataSubType ? "{$customDataSubType}_" : "_0";
     $cacheKey .= $customDataSubName ? "{$customDataSubName}_" : "_0";
     $cacheKey .= $showAll ? "_1" : "_0";
     $cacheKey .= $inline ? "_1_" : "_0_";
     $cacheKey .= $onlyParent ? "_1_" : "_0_";
     $cacheKey .= $onlySubType ? "_1_" : "_0_";
     $cgTable = CRM_Core_DAO_CustomGroup::getTableName();
     // also get the permission stuff here
     require_once 'CRM/Core/Permission.php';
     $permissionClause = CRM_Core_Permission::customGroupClause(CRM_Core_Permission::VIEW, "{$cgTable}.");
     // lets md5 permission clause and take first 8 characters
     $cacheKey .= substr(md5($permissionClause), 0, 8);
     if (strlen($cacheKey) > 40) {
         $cacheKey = md5($cacheKey);
     }
     if (!self::$_importFields || CRM_Utils_Array::value($cacheKey, self::$_importFields) === null) {
         if (!self::$_importFields) {
             self::$_importFields = array();
         }
         // check if we can retrieve from database cache
         require_once 'CRM/Core/BAO/Cache.php';
         $fields =& CRM_Core_BAO_Cache::getItem('contact fields', "custom importableFields {$cacheKey}");
         if ($fields === null) {
             $cfTable = self::getTableName();
             $extends = '';
             if (is_array($customDataType)) {
                 $value = null;
                 foreach ($customDataType as $dataType) {
                     if (in_array($dataType, array_keys(CRM_Core_SelectValues::customGroupExtends()))) {
                         if (in_array($dataType, array('Individual', 'Household', 'Organization'))) {
                             $val = "'" . CRM_Utils_Type::escape($dataType, 'String') . "', 'Contact' ";
                         } else {
                             $val = "'" . CRM_Utils_Type::escape($dataType, 'String') . "'";
                         }
                         $value = $value ? $value . ", {$val}" : $val;
                     }
                 }
                 if ($value) {
                     $extends = "AND   {$cgTable}.extends IN ( {$value} ) ";
                 }
             }
             if ($onlyParent) {
                 $extends .= " AND {$cgTable}.extends_entity_column_value IS NULL AND {$cgTable}.extends_entity_column_id IS NULL ";
             }
             $query = "SELECT {$cfTable}.id, {$cfTable}.label,\n                            {$cgTable}.title,\n                            {$cfTable}.data_type, {$cfTable}.html_type,\n                            {$cfTable}.options_per_line,\n                            {$cgTable}.extends, {$cfTable}.is_search_range,\n                            {$cgTable}.extends_entity_column_value,\n                            {$cgTable}.extends_entity_column_id,\n                            {$cfTable}.is_view,\n                            {$cfTable}.option_group_id,\n                            {$cfTable}.date_format,\n                            {$cfTable}.time_format,\n                            {$cgTable}.is_multiple\n                     FROM {$cfTable}\n                     INNER JOIN {$cgTable}\n                     ON {$cfTable}.custom_group_id = {$cgTable}.id\n                     WHERE ( 1 ) ";
             if (!$showAll) {
                 $query .= " AND {$cfTable}.is_active = 1 AND {$cgTable}.is_active = 1 ";
             }
             if ($inline) {
                 $query .= " AND {$cgTable}.style = 'Inline' ";
             }
             //get the custom fields for specific type in
             //combination with fields those support any type.
             if ($customDataSubType) {
                 $customDataSubType = CRM_Core_DAO::VALUE_SEPARATOR . $customDataSubType . CRM_Core_DAO::VALUE_SEPARATOR;
                 $query .= " AND ( {$cgTable}.extends_entity_column_value LIKE '%{$customDataSubType}%'";
                 if (!$onlySubType) {
                     $query .= " OR {$cgTable}.extends_entity_column_value IS NULL";
                 }
                 $query .= " )";
             }
             if ($customDataSubName) {
                 $query .= " AND ( {$cgTable}.extends_entity_column_id = {$customDataSubName} ) ";
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdev,代码行数:101,代码来源:CustomField.php


示例5: getMultipleFieldGroup

 /**
  * @return array
  */
 public static function getMultipleFieldGroup()
 {
     $multipleGroup = array();
     $dao = new CRM_Core_DAO_CustomGroup();
     $dao->is_multiple = 1;
     $dao->find();
     while ($dao->fetch()) {
         $multipleGroup[$dao->id] = $dao->title;
     }
     return $multipleGroup;
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:14,代码来源:CustomGroup.php


示例6: upgrade_3_3_alpha1

 function upgrade_3_3_alpha1($rev)
 {
     $config = CRM_Core_Config::singleton();
     if ($config->userSystem->is_drupal) {
         // CRM-6426 - make civicrm profiles permissioned on drupal my account
         $config->userSystem->updateCategories();
     }
     // CRM-6846
     // insert name column for custom field table.
     // make sure name for custom field, group and
     // profile should be unique and properly munged.
     $colQuery = 'ALTER TABLE `civicrm_custom_field` ADD `name` VARCHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL AFTER `custom_group_id` ';
     CRM_Core_DAO::executeQuery($colQuery, CRM_Core_DAO::$_nullArray, TRUE, NULL, FALSE, FALSE);
     $customFldCntQuery = 'select count(*) from civicrm_custom_field where name like %1 and id != %2';
     $customField = new CRM_Core_DAO_CustomField();
     $customField->selectAdd();
     $customField->selectAdd('id, label');
     $customField->find();
     while ($customField->fetch()) {
         $name = CRM_Utils_String::munge($customField->label, '_', 64);
         $fldCnt = CRM_Core_DAO::singleValueQuery($customFldCntQuery, array(1 => array($name, 'String'), 2 => array($customField->id, 'Integer')), TRUE, FALSE);
         if ($fldCnt) {
             $name = CRM_Utils_String::munge("{$name}_" . rand(), '_', 64);
         }
         $customFieldQuery = "\nUpdate `civicrm_custom_field`\nSET `name` = %1\nWHERE id = %2\n";
         $customFieldParams = array(1 => array($name, 'String'), 2 => array($customField->id, 'Integer'));
         CRM_Core_DAO::executeQuery($customFieldQuery, $customFieldParams, TRUE, NULL, FALSE, FALSE);
     }
     $customField->free();
     $customGrpCntQuery = 'select count(*) from civicrm_custom_group where name like %1 and id != %2';
     $customGroup = new CRM_Core_DAO_CustomGroup();
     $customGroup->selectAdd();
     $customGroup->selectAdd('id, title');
     $customGroup->find();
     while ($customGroup->fetch()) {
         $name = CRM_Utils_String::munge($customGroup->title, '_', 64);
         $grpCnt = CRM_Core_DAO::singleValueQuery($customGrpCntQuery, array(1 => array($name, 'String'), 2 => array($customGroup->id, 'Integer')));
         if ($grpCnt) {
             $name = CRM_Utils_String::munge("{$name}_" . rand(), '_', 64);
         }
         CRM_Core_DAO::setFieldValue('CRM_Core_DAO_CustomGroup', $customGroup->id, 'name', $name);
     }
     $customGroup->free();
     $ufGrpCntQuery = 'select count(*) from civicrm_uf_group where name like %1 and id != %2';
     $ufGroup = new CRM_Core_DAO_UFGroup();
     $ufGroup->selectAdd();
     $ufGroup->selectAdd('id, title');
     $ufGroup->find();
     while ($ufGroup->fetch()) {
         $name = CRM_Utils_String::munge($ufGroup->title, '_', 64);
         $ufGrpCnt = CRM_Core_DAO::singleValueQuery($ufGrpCntQuery, array(1 => array($name, 'String'), 2 => array($ufGroup->id, 'Integer')));
         if ($ufGrpCnt) {
             $name = CRM_Utils_String::munge("{$name}_" . rand(), '_', 64);
         }
         CRM_Core_DAO::setFieldValue('CRM_Core_DAO_UFGroup', $ufGroup->id, 'name', $name);
     }
     $ufGroup->free();
     $upgrade = new CRM_Upgrade_Form();
     $upgrade->processSQL($rev);
     // now modify the config so that the directories are stored in option group/value
     // CRM-6914
     // require_once 'CRM/Core/BAO/ConfigSetting.php';
     // $params = array( );
     // CRM_Core_BAO_ConfigSetting::add( $parambs );
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:65,代码来源:ThreeThree.php


示例7: CRM_Core_DAO_CustomGroup

 public static function &getActiveGroups($entityType, $path, $cidToken = '%%cid%%')
 {
     // for Group's
     $customGroupDAO = new CRM_Core_DAO_CustomGroup();
     // get only 'Tab' groups
     $customGroupDAO->whereAdd("style = 'Tab'");
     $customGroupDAO->whereAdd("is_active = 1");
     // add whereAdd for entity type
     self::_addWhereAdd($customGroupDAO, $entityType, $cidToken);
     $groups = array();
     $permissionClause = CRM_Core_Permission::customGroupClause(CRM_Core_Permission::VIEW, null, true);
     $customGroupDAO->whereAdd($permissionClause);
     // order by weight
     $customGroupDAO->orderBy('weight');
     $customGroupDAO->find();
     // process each group with menu tab
     while ($customGroupDAO->fetch()) {
         $group = array();
         $group['id'] = $customGroupDAO->id;
         $group['path'] = $path;
         $group['title'] = "{$customGroupDAO->title}";
         $group['query'] = "reset=1&gid={$customGroupDAO->id}&cid={$cidToken}";
         $group['extra'] = array('gid' => $customGroupDAO->id);
         $group['table_name'] = $customGroupDAO->table_name;
         $groups[] = $group;
     }
     return $groups;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:28,代码来源:CustomGroup.php


示例8: moveField

 /**
  * Move a custom data field from one group (table) to another
  *
  * @param int $fieldID
  *   FK to civicrm_custom_field.
  * @param int $newGroupID
  *   FK to civicrm_custom_group.
  *
  * @return void
  */
 public static function moveField($fieldID, $newGroupID)
 {
     $validation = self::_moveFieldValidate($fieldID, $newGroupID);
     if (TRUE !== $validation) {
         CRM_Core_Error::fatal(implode(' ', $validation));
     }
     $field = new CRM_Core_DAO_CustomField();
     $field->id = $fieldID;
     $field->find(TRUE);
     $newGroup = new CRM_Core_DAO_CustomGroup();
     $newGroup->id = $newGroupID;
     $newGroup->find(TRUE);
     $oldGroup = new CRM_Core_DAO_CustomGroup();
     $oldGroup->id = $field->custom_group_id;
     $oldGroup->find(TRUE);
     $add = clone $field;
     $add->custom_group_id = $newGroup->id;
     self::createField($add, 'add');
     $sql = "INSERT INTO {$newGroup->table_name} (entity_id, {$field->column_name})\n            SELECT entity_id, {$field->column_name} FROM {$oldGroup->table_name}\n            ON DUPLICATE KEY UPDATE {$field->column_name} = {$oldGroup->table_name}.{$field->column_name}\n            ";
     CRM_Core_DAO::executeQuery($sql);
     $del = clone $field;
     $del->custom_group_id = $oldGroup->id;
     self::createField($del, 'delete');
     $add->save();
     CRM_Utils_System::flushCache();
 }
开发者ID:Hack4Eugene,项目名称:Hack4Cause2016,代码行数:36,代码来源:CustomField.php


示例9: array

 /**
  * Store and return an array of all active custom fields.
  *
  * @param string      $contactType   Contact type
  * @param boolean     $showAll       If true returns all fields (includes disabled fields)
  *
  * @return array      $fields - an array of active custom fields.
  *
  * @access public
  * @static
  */
 function &getFields($contactType = 'Individual', $showAll = false)
 {
     if (!$GLOBALS['_CRM_CORE_BAO_CUSTOMFIELD']['_importFields'] || !CRM_Utils_Array::value($contactType, $GLOBALS['_CRM_CORE_BAO_CUSTOMFIELD']['_importFields'])) {
         if (!$GLOBALS['_CRM_CORE_BAO_CUSTOMFIELD']['_importFields']) {
             $GLOBALS['_CRM_CORE_BAO_CUSTOMFIELD']['_importFields'] = array();
         }
         $cfTable = CRM_Core_BAO_CustomField::getTableName();
         $cgTable = CRM_Core_DAO_CustomGroup::getTableName();
         $extends = '';
         if ($contactType) {
             if (in_array($contactType, array('Individual', 'Household', 'Organization'))) {
                 $value = "'" . CRM_Utils_Type::escape($contactType, 'String') . "', 'Contact' ";
             } else {
                 $value = "'" . CRM_Utils_Type::escape($contactType, 'String') . "'";
             }
             $extends = "AND   {$cgTable}.extends IN ( {$value} ) ";
         }
         $query = "SELECT {$cfTable}.id, {$cfTable}.label,\n                            {$cgTable}.title,\n                            {$cfTable}.data_type, {$cfTable}.html_type,\n                            {$cfTable}.options_per_line,\n                            {$cgTable}.extends, {$cfTable}.is_search_range\n                     FROM {$cfTable}\n                     INNER JOIN {$cgTable}\n                     ON {$cfTable}.custom_group_id = {$cgTable}.id\n                     WHERE ";
         if (!$showAll) {
             $query .= "{$cfTable}.is_active = 1\n                          AND {$cgTable}.is_active = 1";
         } else {
             $query .= " 1 ";
         }
         $query .= " {$extends}\n                       ORDER BY {$cgTable}.weight, {$cgTable}.title,\n                                {$cfTable}.weight, {$cfTable}.label";
         $crmDAO =& new CRM_Core_DAO();
         $crmDAO->query($query);
         $result = $crmDAO->getDatabaseResult();
         $fields = array();
         while (($row = $result->fetchRow()) != null) {
             $id = array_shift($row);
             $fields[$id] = $row;
         }
         $GLOBALS['_CRM_CORE_BAO_CUSTOMFIELD']['_importFields'][$contactType] = $fields;
     }
     // CRM_Core_Error::debug( 's', self::$_importFields );
     return $GLOBALS['_CRM_CORE_BAO_CUSTOMFIELD']['_importFields'][$contactType];
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:48,代码来源:CustomField.php


示例10: postProcess

 public function postProcess()
 {
     // get the acl clauses built before we assemble the query
     $this->buildACLClause($this->_aliases['civicrm_contact']);
     $this->beginPostProcess();
     // CRM-18312 - display soft_credits and soft_credits_for column
     // when 'Contribution or Soft Credit?' column is not selected
     if (empty($this->_params['fields']['contribution_or_soft'])) {
         $this->_params['fields']['contribution_or_soft'] = 1;
         $this->noDisplayContributionOrSoftColumn = TRUE;
     }
     if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'contributions_only' && !empty($this->_params['fields']['soft_credit_type_id'])) {
         unset($this->_params['fields']['soft_credit_type_id']);
         if (!empty($this->_params['soft_credit_type_id_value'])) {
             $this->_params['soft_credit_type_id_value'] = array();
         }
     }
     // 1. use main contribution query to build temp table 1
     $sql = $this->buildQuery();
     $tempQuery = 'CREATE TEMPORARY TABLE civireport_contribution_detail_temp1 AS ' . $sql;
     CRM_Core_DAO::executeQuery($tempQuery);
     $this->setPager();
     // 2. customize main contribution query for soft credit, and build temp table 2 with soft credit contributions only
     $this->from(TRUE);
     // also include custom group from if included
     // since this might be included in select
     $this->customDataFrom();
     $select = str_ireplace('contribution_civireport.total_amount', 'contribution_soft_civireport.amount', $this->_select);
     $select = str_ireplace("'Contribution' as", "'Soft Credit' as", $select);
     // we inner join with temp1 to restrict soft contributions to those in temp1 table
     $sql = "{$select} {$this->_from} {$this->_where} {$this->_groupBy}";
     $tempQuery = 'CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS ' . $sql;
     CRM_Core_DAO::executeQuery($tempQuery);
     if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'soft_credits_only') {
         // revise pager : prev, next based on soft-credits only
         $this->setPager();
     }
     // copy _from for later use of stats calculation for soft credits, and reset $this->_from to main query
     $this->_softFrom = $this->_from;
     // simple reset of ->_from
     $this->from();
     // also include custom group from if included
     // since this might be included in select
     $this->customDataFrom();
     // 3. Decide where to populate temp3 table from
     if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'contributions_only') {
         $tempQuery = "(SELECT * FROM civireport_contribution_detail_temp1)";
     } elseif (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'soft_credits_only') {
         $tempQuery = "(SELECT * FROM civireport_contribution_detail_temp2)";
     } else {
         $tempQuery = "\n(SELECT * FROM civireport_contribution_detail_temp1)\nUNION ALL\n(SELECT * FROM civireport_contribution_detail_temp2)";
     }
     // 4. build temp table 3
     $sql = "CREATE TEMPORARY TABLE civireport_contribution_detail_temp3 AS {$tempQuery}";
     CRM_Core_DAO::executeQuery($sql);
     // 5. Re-construct order-by to make sense for final query on temp3 table
     $orderBy = '';
     if (!empty($this->_orderByArray)) {
         $aliases = array_flip($this->_aliases);
         $orderClause = array();
         foreach ($this->_orderByArray as $clause) {
             list($alias, $rest) = explode('.', $clause);
             // CRM-17280 -- In case, we are ordering by custom fields
             // modify $rest to match the alias used for them in temp3 table
             $grp = new CRM_Core_DAO_CustomGroup();
             $grp->table_name = $aliases[$alias];
             if ($grp->find()) {
                 list($fld, $order) = explode(' ', $rest);
                 foreach ($this->_columns[$aliases[$alias]]['fields'] as $fldName => $value) {
                     if ($value['name'] == $fld) {
                         $fld = $fldName;
                     }
                 }
                 $rest = "{$fld} {$order}";
             }
             $orderClause[] = $aliases[$alias] . "_" . $rest;
         }
         $orderBy = !empty($orderClause) ? "ORDER BY " . implode(', ', $orderClause) : '';
     }
     // 6. show result set from temp table 3
     $rows = array();
     $sql = "SELECT * FROM civireport_contribution_detail_temp3 {$orderBy}";
     $this->buildRows($sql, $rows);
     // format result set.
     $this->formatDisplay($rows, FALSE);
     // assign variables to templates
     $this->doTemplateAssignment($rows);
     // do print / pdf / instance stuff if needed
     $this->endPostProcess($rows);
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:90,代码来源:Detail.php


示例11: del

 /**
  * Delete Contact SubTypes.
  *
  * @param int $contactTypeId
  *   ID of the Contact Subtype to be deleted.
  *
  * @return bool
  */
 public static function del($contactTypeId)
 {
     if (!$contactTypeId) {
         return FALSE;
     }
     $params = array('id' => $contactTypeId);
     self::retrieve($params, $typeInfo);
     $name = $typeInfo['name'];
     // check if any custom group
     $custom = new CRM_Core_DAO_CustomGroup();
     $custom->whereAdd("extends_entity_column_value LIKE '%" . CRM_Core_DAO::VALUE_SEPARATOR . $name . CRM_Core_DAO::VALUE_SEPARATOR . "%'");
     if ($custom->find()) {
         return FALSE;
     }
     // remove subtype for existing contacts
     $sql = "\nUPDATE civicrm_contact SET contact_sub_type = NULL\nWHERE contact_sub_type = '{$name}'";
     CRM_Core_DAO::executeQuery($sql);
     // remove subtype from contact type table
     $contactType = new CRM_Contact_DAO_ContactType();
     $contactType->id = $contactTypeId;
     $contactType->delete();
     // remove navigation entry if any
     if ($name) {
         $sql = "\nDELETE\nFROM civicrm_navigation\nWHERE name = %1";
         $params = array(1 => array("New {$name}", 'String'));
         $dao = CRM_Core_DAO::executeQuery($sql, $params);
         CRM_Core_BAO_Navigation::resetNavigation();
     }
     return TRUE;
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:38,代码来源:ContactType.php


示例12: browse

 /**
  * Browse all custom data groups.
  * 
  * @param string $action   the action to be invoked
  * 
  * @return void
  * @access public
  */
 function browse($action = null)
 {
     // get all custom groups sorted by weight
     $customGroup = array();
     $dao =& new CRM_Core_DAO_CustomGroup();
     // set the domain_id parameter
     $config =& CRM_Core_Config::singleton();
     $dao->domain_id = $config->domainID();
     $dao->orderBy('weight, title');
     $dao->find();
     while ($dao->fetch()) {
         $customGroup[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $customGroup[$dao->id]);
         // form all action links
         $action = array_sum(array_keys($this->actionLinks()));
         // update enable/disable links depending on custom_group properties.
         if ($dao->is_active) {
             $action -= CRM_CORE_ACTION_ENABLE;
         } else {
             $action -= CRM_CORE_ACTION_DISABLE;
         }
         $customGroup[$dao->id]['action'] = CRM_Core_Action::formLink(CRM_Custom_Page_Group::actionLinks(), $action, array('id' => $dao->id));
     }
     $customGroupExtends = CRM_Core_SelectValues::customGroupExtends();
     foreach ($customGroup as $key => $array) {
         CRM_Core_DAO_CustomGroup::addDisplayEnums($customGroup[$key]);
         $customGroup[$key]['extends_display'] = $customGroupExtends[$customGroup[$key]['extends']];
     }
     $this->assign('rows', $customGroup);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:38,代码来源:Group.php


示例13: civicrm_custom_group_delete

/**
 * Use this API to delete an existing group.
 *
 * @param array id of the group to be deleted
 *
 * @return Null if success
 * @access public
 **/
function civicrm_custom_group_delete($params)
{
    _civicrm_initialize();
    if (!is_array($params)) {
        return civicrm_create_error('Params is not an array');
    }
    if (!CRM_Utils_Array::value('id', $params)) {
        return civicrm_create_error('Invalid or no value for Custom group ID');
    }
    // convert params array into Object
    require_once 'CRM/Core/DAO/CustomGroup.php';
    $values = new CRM_Core_DAO_CustomGroup();
    $values->id = $params['id'];
    $values->find(true);
    require_once 'CRM/Core/BAO/CustomGroup.php';
    $result = CRM_Core_BAO_CustomGroup::deleteGroup($values);
    return $result ? civicrm_create_success() : civicrm_error('Error while deleting custom group');
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:26,代码来源:CustomGroup.php


示例14: browse

 /**
  * Browse all custom data groups.
  *
  * @param string $action   the action to be invoked
  *
  * @return void
  * @access public
  */
 function browse($action = NULL)
 {
     // get all custom groups sorted by weight
     $customGroup = array();
     $dao = new CRM_Core_DAO_CustomGroup();
     $dao->orderBy('weight, title');
     $dao->find();
     while ($dao->fetch()) {
         $customGroup[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $customGroup[$dao->id]);
         // form all action links
         $action = array_sum(array_keys($this->actionLinks()));
         // update enable/disable links depending on custom_group properties.
         if ($dao->is_active) {
             $action -= CRM_Core_Action::ENABLE;
         } else {
             $action -= CRM_Core_Action::DISABLE;
         }
         $customGroup[$dao->id]['order'] = $customGroup[$dao->id]['weight'];
         $customGroup[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $dao->id));
     }
     $customGroupExtends = CRM_Core_SelectValues::customGroupExtends();
     foreach ($customGroup as $key => $array) {
         CRM_Core_DAO_CustomGroup::addDisplayEnums($customGroup[$key]);
         $customGroup[$key]['extends_display'] = $customGroupExtends[$customGroup[$key]['extends']];
     }
     //fix for Displaying subTypes
     $subTypes = array();
     $subTypes['Activity'] = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE);
     $subTypes['Contribution'] = CRM_Contribute_PseudoConstant::contributionType();
     $subTypes['Membership'] = CRM_Member_BAO_MembershipType::getMembershipTypes(FALSE);
     $subTypes['Event'] = CRM_Core_OptionGroup::values('event_type');
     $subTypes['Grant'] = CRM_Core_OptionGroup::values('grant_type');
     $subTypes['Campaign'] = CRM_Campaign_PseudoConstant::campaignType();
     $subTypes['Participant'] = array();
     $subTypes['ParticipantRole'] = CRM_Core_OptionGroup::values('participant_role');
     $subTypes['ParticipantEventName'] = CRM_Event_PseudoConstant::event();
     $subTypes['ParticipantEventType'] = CRM_Core_OptionGroup::values('event_type');
     $subTypes['Individual'] = CRM_Contact_BAO_ContactType::subTypePairs('Individual', FALSE, NULL);
     $subTypes['Household'] = CRM_Contact_BAO_ContactType::subTypePairs('Household', FALSE, NULL);
     $subTypes['Organization'] = CRM_Contact_BAO_ContactType::subTypePairs('Organization', FALSE, NULL);
     $relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Individual');
     $relTypeOrg = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Organization');
     $relTypeHou = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Household');
     $allRelationshipType = array();
     $allRelationshipType = array_merge($relTypeInd, $relTypeOrg);
     $allRelationshipType = array_merge($allRelationshipType, $relTypeHou);
     //adding subtype specific relationships CRM-5256
     $relSubType = CRM_Contact_BAO_ContactType::subTypeInfo();
     foreach ($relSubType as $subType => $val) {
         $subTypeRelationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $val['parent'], FALSE, 'label', TRUE, $subType);
         $allRelationshipType = array_merge($allRelationshipType, $subTypeRelationshipTypes);
     }
     $subTypes['Relationship'] = $allRelationshipType;
     $cSubTypes = CRM_Core_Component::contactSubTypes();
     $contactSubTypes = array();
     foreach ($cSubTypes as $key => $value) {
         $contactSubTypes[$key] = $key;
     }
     $subTypes['Contact'] = $contactSubTypes;
     CRM_Core_BAO_CustomGroup::getExtendedObjectTypes($subTypes);
     foreach ($customGroup as $key => $values) {
         $subValue = CRM_Utils_Array::value('extends_entity_column_value', $customGroup[$key]);
         $subName = CRM_Utils_Array::value('extends_entity_column_id', $customGroup[$key]);
         $type = CRM_Utils_Array::value('extends', $customGroup[$key]);
         if ($subValue) {
             $subValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($subValue, 1, -1));
             $colValue = NULL;
             foreach ($subValue as $sub) {
                 if ($sub) {
                     if ($type == 'Participant') {
                         if ($subName == 1) {
                             $colValue = $colValue ? $colValue . ', ' . $subTypes['ParticipantRole'][$sub] : $subTypes['ParticipantRole'][$sub];
                         } elseif ($subName == 2) {
                             $colValue = $colValue ? $colValue . ', ' . $subTypes['ParticipantEventName'][$sub] : $subTypes['ParticipantEventName'][$sub];
                         } elseif ($subName == 3) {
                             $colValue = $colValue ? $colValue . ', ' . $subTypes['ParticipantEventType'][$sub] : $subTypes['ParticipantEventType'][$sub];
                         }
                     } elseif ($type == 'Relationship') {
                         $colValue = $colValue ? $colValue . ', ' . $subTypes[$type][$sub . '_a_b'] : $subTypes[$type][$sub . '_a_b'];
                         if (isset($subTypes[$type][$sub . '_b_a'])) {
                             $colValue = $colValue ? $colValue . ', ' . $subTypes[$type][$sub . '_b_a'] : $subTypes[$type][$sub . '_b_a'];
                         }
                     } else {
                         $colValue = $colValue ? $colValue . (isset($subTypes[$type][$sub]) ? ', ' . $subTypes[$type][$sub] : '') : (isset($subTypes[$type][$sub]) ? $subTypes[$type][$sub] : '');
                     }
                 }
             }
             $customGroup[$key]["extends_entity_column_value"] = $colValue;
         } else {
             if (is_array(CRM_Utils_Array::value($type, $subTypes))) {
                 $customGroup[$key]["extends_entity_column_value"] = ts("Any");
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Group.php


示例15: CRM_Core_BAO_CustomGroup

 /**
  * class constructor
  */
 function CRM_Core_BAO_CustomGroup()
 {
     parent::CRM_Core_DAO_CustomGroup();
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:7,代码来源:CustomGroup.php


示例16: addDisplayEnums

 /**
  * adds $value['foo_display'] for each $value['foo'] enum from civicrm_custom_group
  *
  * @param array $values (reference)  the array up for enhancing
  * @return void
  */
 static function addDisplayEnums(&$values)
 {
     $enumFields =& CRM_Core_DAO_CustomGroup::getEnums();
     foreach ($enumFields as $enum) {
         if (isset($values[$enum])) {
             $values[$enum . '_display'] = CRM_Core_DAO_CustomGroup::tsEnum($enum, $values[$enum]);
         }
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:15,代码来源:CustomGroup.php


示例17:

 /**
  * class constructor
  */
 function __construct()
 {
     parent::__construct();
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:7,代码来源:CustomGroup.php


示例18: array

 /**
  * Returns the list of fields that can be exported
  *
  * @param bool $prefix
  *
  * @return array
  */
 static function &export($prefix = false)
 {
     if (!self::$_export) {
         self::$_export = array();
         $fields = self::fields();
         foreach ($fields as $name => $field) {
             if (CRM_Utils_Array::value('export', $field)) {
                 if ($prefix) {
                     self::$_export['custom_group'] =& $fields[$name];
                 } else {
                     self::$_export[$name] =& $fields[$name];
                 }
             }
         }
     }
     return self::$_export;
 }
开发者ID:agroknow,项目名称:mermix,代码行数:24,代码来源:CustomGroup.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Core_DAO_Domain类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Core_DAO_CustomField类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap