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


PHP CRM_Contact_BAO_Group::discard方法代码示例

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


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

示例1: delete

 /**
  * Delete a saved search.
  *
  * @param int $id
  *   Id of saved search.
  */
 public function delete($id)
 {
     // first delete the group associated with this saved search
     $group = new CRM_Contact_DAO_Group();
     $group->saved_search_id = $id;
     if ($group->find(TRUE)) {
         CRM_Contact_BAO_Group::discard($group->id);
     }
     $savedSearch = new CRM_Contact_DAO_SavedSearch();
     $savedSearch->id = $id;
     $savedSearch->is_active = 0;
     $savedSearch->save();
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:19,代码来源:SavedSearch.php

示例2: updateCiviGroup

 static function updateCiviGroup(&$params, $op, $groupType = NULL)
 {
     $abort = false;
     $params['version'] = 3;
     $params['id'] = CRM_Bridge_OG_Utils::groupID($params['source'], $params['title'], $abort);
     if ($op == 'add') {
         if ($groupType) {
             $params['group_type'] = $groupType;
         }
         $group = civicrm_api('group', 'create', $params);
         if (!civicrm_error($group)) {
             $params['group_id'] = $group['id'];
         }
     } else {
         // do this only if we have a valid id
         if ($params['id']) {
             CRM_Contact_BAO_Group::discard($params['id']);
             $params['group_id'] = $params['id'];
         }
     }
     unset($params['id']);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:22,代码来源:Drupal.php

示例3: updateCiviGroup

 static function updateCiviGroup(&$params, $op, $groupType = null)
 {
     $abort = $op == 'delete' ? true : false;
     $params['id'] = CRM_Bridge_OG_Utils::groupID($params['source'], $params['title'], $abort);
     if ($op == 'add') {
         require_once 'api/v2/Group.php';
         if ($groupType) {
             $params['group_type'] = $groupType;
         }
         $group = civicrm_group_add($params);
         if (!civicrm_error($group)) {
             $params['group_id'] = $group['result'];
         }
     } else {
         // do this only if we have a valid id
         if ($params['id']) {
             require_once 'CRM/Contact/BAO/Group.php';
             CRM_Contact_BAO_Group::discard($params['id']);
             $params['group_id'] = $params['id'];
         }
     }
     unset($params['id']);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:23,代码来源:Drupal.php

示例4: civicrm_api3_group_delete

/**
 * Delete an existing Group.
 *
 * @param array $params
 *   [id]
 *
 * @return array
 *   API result array
 */
function civicrm_api3_group_delete($params)
{
    CRM_Contact_BAO_Group::discard($params['id']);
    return civicrm_api3_create_success(TRUE);
}
开发者ID:kidaa30,项目名称:yes,代码行数:14,代码来源:Group.php

示例5: postProcess

 /**
  * Process the form when submitted.
  */
 public function postProcess()
 {
     CRM_Utils_System::flushCache('CRM_Core_DAO_Group');
     $updateNestingCache = FALSE;
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Contact_BAO_Group::discard($this->_id);
         CRM_Core_Session::setStatus(ts("The Group '%1' has been deleted.", array(1 => $this->_title)), ts('Group Deleted'), 'success');
         $updateNestingCache = TRUE;
     } else {
         // store the submitted values in an array
         $params = $this->controller->exportValues($this->_name);
         $params['is_active'] = CRM_Utils_Array::value('is_active', $this->_groupValues, 1);
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $params['id'] = $this->_id;
         }
         if ($this->_action & CRM_Core_Action::UPDATE && isset($this->_groupOrganizationID)) {
             $params['group_organization'] = $this->_groupOrganizationID;
         }
         $params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
         $groupTypeIds = array();
         $groupType = CRM_Utils_Array::value('group_type', $params);
         if (is_array($groupType)) {
             foreach ($groupType as $type => $selected) {
                 if ($selected) {
                     $groupTypeIds[] = $type;
                 }
             }
         }
         $params['group_type'] = $groupTypeIds;
         $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->_id, 'Group');
         $group = CRM_Contact_BAO_Group::create($params);
         //Remove any parent groups requested to be removed
         if (!empty($this->_groupValues['parents'])) {
             $parentGroupIds = explode(',', $this->_groupValues['parents']);
             foreach ($parentGroupIds as $parentGroupId) {
                 if (isset($params["remove_parent_group_{$parentGroupId}"])) {
                     CRM_Contact_BAO_GroupNesting::remove($parentGroupId, $group->id);
                     $updateNestingCache = TRUE;
                 }
             }
         }
         CRM_Core_Session::setStatus(ts('The Group \'%1\' has been saved.', array(1 => $group->title)), ts('Group Saved'), 'success');
         // Add context to the session, in case we are adding members to the group
         if ($this->_action & CRM_Core_Action::ADD) {
             $this->set('context', 'amtg');
             $this->set('amtgID', $group->id);
             $session = CRM_Core_Session::singleton();
             $session->pushUserContext(CRM_Utils_System::url('civicrm/group/search', 'reset=1&force=1&context=smog&gid=' . $group->id));
         }
     }
     // update the nesting cache
     if ($updateNestingCache) {
         CRM_Contact_BAO_GroupNestingCache::update();
     }
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:58,代码来源:Edit.php

示例6: crm_delete_group

/**
 *
 * Delete an existing group.
 *
 * @param $group         A valid group object (passed by reference)
 *
 * @return  null, if successful.or  CRM error object, if permissions are insufficient, etc.
 *
 *
 * @access public
 */
function crm_delete_group(&$group)
{
    _crm_initialize();
    if (!is_a($group, 'CRM_Contact_BAO_Group') && !is_a($group, 'CRM_Contact_DAO_Group')) {
        return _crm_error('Invalid group object passed in');
    }
    if ($group->id == null) {
        return _crm_error('Could not locate group with id: $id');
    }
    if (!CRM_Contact_BAO_Group::checkPermission($group->id, $group->title)) {
        return CRM_Core_Error::fatal("You do not have permission to access group with id: {$id}");
    }
    CRM_Contact_BAO_Group::discard($group->id);
    return null;
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:26,代码来源:Group.php

示例7: civicrm_group_delete

/**
 * delete an existing group
 *
 * This method is used to delete any existing group. id of the group
 * to be deleted is required field in $params array
 *
 * @param array $params  (referance) array containing id of the group
 *                       to be deleted
 *
 * @return array  (referance) returns flag true if successfull, error
 *                message otherwise
 *
 * @access public
 */
function civicrm_group_delete(&$params)
{
    _civicrm_initialize();
    if (is_null($params) || !is_array($params) || !CRM_Utils_Array::value('id', $params)) {
        return civicrm_create_error('Required parameter missing');
    }
    CRM_Contact_BAO_Group::discard($params['id']);
    return civicrm_create_success(TRUE);
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:23,代码来源:Group.php

示例8: postProcess

 /**
  * Process the form when submitted
  *
  * @return void
  * @access public
  */
 public function postProcess()
 {
     $updateNestingCache = false;
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Contact_BAO_Group::discard($this->_id);
         CRM_Core_Session::setStatus(ts("The Group '%1' has been deleted.", array(1 => $this->_title)));
         $updateNestingCache = true;
     } else {
         // store the submitted values in an array
         $params = $this->controller->exportValues($this->_name);
         $params['is_active'] = 1;
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $params['id'] = $this->_id;
         }
         if ($this->_action & CRM_Core_Action::UPDATE && isset($this->_groupOrganizationID)) {
             $params['group_organization'] = $this->_groupOrganizationID;
         }
         $customFields = CRM_Core_BAO_CustomField::getFields('Group');
         $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_id, 'Group');
         require_once 'CRM/Contact/BAO/Group.php';
         $group =& CRM_Contact_BAO_Group::create($params);
         /*
          * Remove any parent groups requested to be removed
          */
         if (CRM_Utils_Array::value('parents', $this->_groupValues)) {
             $parentGroupIds = explode(',', $this->_groupValues['parents']);
             foreach ($parentGroupIds as $parentGroupId) {
                 if (isset($params["remove_parent_group_{$parentGroupId}"])) {
                     CRM_Contact_BAO_GroupNesting::remove($parentGroupId, $group->id);
                     $updateNestingCache = true;
                 }
             }
         }
         CRM_Core_Session::setStatus(ts('The Group \'%1\' has been saved.', array(1 => $group->title)));
         /*
          * Add context to the session, in case we are adding members to the group
          */
         if ($this->_action & CRM_Core_Action::ADD) {
             $this->set('context', 'amtg');
             $this->set('amtgID', $group->id);
             $session =& CRM_Core_Session::singleton();
             $session->pushUserContext(CRM_Utils_System::url('civicrm/group/search', 'reset=1&force=1&context=smog&gid=' . $group->id));
         }
     }
     // update the nesting cache
     if ($updateNestingCache) {
         require_once 'CRM/Contact/BAO/GroupNestingCache.php';
         CRM_Contact_BAO_GroupNestingCache::update();
     }
     require_once 'CRM/Utils/Recent.php';
     // add the recently added group
     CRM_Utils_Recent::add($group->title, CRM_Utils_System::url('civicrm/group/search', 'reset=1&force=1&context=smog&gid=' . $group->id), $group->id, 'Group', null, null);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:59,代码来源:Edit.php

示例9: civicrm_api3_group_delete

/**
 * Delete an existing Group.
 *
 * @param array $params
 *   [id]
 *
 * @return array
 *   API result array
 */
function civicrm_api3_group_delete($params)
{
    $group = civicrm_api3_group_get(array('id' => $params['id']));
    if ($group['count'] == 0) {
        throw new API_Exception('Could not delete group ' . $params['id']);
    }
    CRM_Contact_BAO_Group::discard($params['id']);
    return civicrm_api3_create_success(TRUE);
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:18,代码来源:Group.php

示例10: postProcess

 /**
  * Process the form when submitted
  *
  * @return void
  * @access public
  */
 function postProcess()
 {
     if ($this->_action & CRM_CORE_ACTION_DELETE) {
         CRM_Contact_BAO_Group::discard($this->_id);
         CRM_Core_Session::setStatus(ts('The Group "%1" has been deleted.', array(1 => $this->_title)));
     } else {
         // store the submitted values in an array
         $params = $this->exportValues();
         $params['domain_id'] = CRM_Core_Config::domainID();
         $params['is_active'] = 1;
         if ($this->_action & CRM_CORE_ACTION_UPDATE) {
             $params['id'] = $this->_id;
         }
         $group =& CRM_Contact_BAO_Group::create($params);
         // do the updates/inserts
         CRM_Core_BAO_CustomGroup::postProcess($this->_groupTree, $params);
         CRM_Core_BAO_CustomGroup::updateCustomData($this->_groupTree, 'Group', $group->id);
         CRM_Core_Session::setStatus(ts('The Group "%1" has been saved.', array(1 => $group->title)));
         /*
          * Add context to the session, in case we are adding members to the group
          */
         if ($this->_action & CRM_CORE_ACTION_ADD) {
             $this->set('context', 'amtg');
             $this->set('amtgID', $group->id);
             $session =& CRM_Core_Session::singleton();
             $session->pushUserContext(CRM_Utils_System::url('civicrm/group/search', 'reset=1&force=1&context=smog&gid=' . $group->id));
         }
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:35,代码来源:Edit.php


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