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


PHP CRM_Member_BAO_MembershipStatus::add方法代码示例

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


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

示例1: civicrm_api3_membership_status_create

/**
 * Create a Membership Status
 *
 * This API is used for creating a Membership Status
 *
 * @param   array  $params  an associative array of name/value property values of civicrm_membership_status
 *
 * @return array of newly created membership status property values.
 * {@getfields MembershipStatus_create}
 * @access public
 */
function civicrm_api3_membership_status_create($params)
{
    civicrm_api3_verify_one_mandatory($params, 'CRM_Member_DAO_MembershipStatus', array('name', 'label'));
    //move before verifiy? DAO check requires?
    if (empty($params['name'])) {
        $params['name'] = CRM_Utils_Array::value('label', $params);
    }
    //don't allow duplicate names.
    require_once 'CRM/Member/DAO/MembershipStatus.php';
    $status = new CRM_Member_DAO_MembershipStatus();
    $status->name = $params['name'];
    if ($status->find(TRUE)) {
        return civicrm_api3_create_error(ts('A membership status with this name already exists.'));
    }
    require_once 'CRM/Member/BAO/MembershipStatus.php';
    $ids = array();
    $membershipStatusBAO = CRM_Member_BAO_MembershipStatus::add($params, $ids);
    if (is_a($membershipStatusBAO, 'CRM_Core_Error')) {
        return civicrm_api3_create_error("Membership is not created");
    } else {
        $values = array();
        $values['id'] = $membershipStatusBAO->id;
        $values['is_error'] = 0;
        return civicrm_api3_create_success($values, $params);
    }
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:37,代码来源:MembershipStatus.php

示例2: civicrm_membership_status_create

/**
 * Create a Membership Status
 *
 * This API is used for creating a Membership Status
 *
 * @param   array  $params  an associative array of name/value property values of civicrm_membership_status
 *
 * @return array of newly created membership status property values.
 * @access public
 */
function civicrm_membership_status_create(&$params)
{
    _civicrm_initialize();
    if (!is_array($params)) {
        return civicrm_create_error('Params is not an array.');
    }
    if (empty($params)) {
        return civicrm_create_error('Params can not be empty.');
    }
    $name = CRM_Utils_Array::value('name', $params);
    if (!$name) {
        $name = CRM_Utils_Array::value('label', $params);
    }
    if (!$name) {
        return civicrm_create_error('Missing required fields');
    }
    //don't allow duplicate names.
    require_once 'CRM/Member/DAO/MembershipStatus.php';
    $status = new CRM_Member_DAO_MembershipStatus();
    $status->name = $name;
    if ($status->find(TRUE)) {
        return civicrm_create_error(ts('A membership status with this name already exists.'));
    }
    require_once 'CRM/Member/BAO/MembershipStatus.php';
    $ids = array();
    $membershipStatusBAO = CRM_Member_BAO_MembershipStatus::add($params, $ids);
    if (is_a($membershipStatusBAO, 'CRM_Core_Error')) {
        return civicrm_create_error("Membership is not created");
    } else {
        $values = array();
        $values['id'] = $membershipStatusBAO->id;
        $values['is_error'] = 0;
        return $values;
    }
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:45,代码来源:MembershipStatus.php

示例3: civicrm_membership_status_create

/**
 * Create a Membership Status
 *  
 * This API is used for creating a Membership Status
 * 
 * @param   array  $params  an associative array of name/value property values of civicrm_membership_status
 * @return array of newly created membership status property values.
 * @access public
 */
function civicrm_membership_status_create(&$params)
{
    _civicrm_initialize();
    if (!is_array($params)) {
        return civicrm_create_error('Params is not an array.');
    }
    if (empty($params)) {
        return civicrm_create_error('Params can not be empty.');
    }
    if (!isset($params['name'])) {
        return civicrm_create_error('Missing required fields');
    }
    require_once 'CRM/Member/BAO/MembershipStatus.php';
    $ids = array();
    $membershipStatusBAO = CRM_Member_BAO_MembershipStatus::add($params, $ids);
    if (is_a($membershipStatusBAO, 'CRM_Core_Error')) {
        return civicrm_create_error("Membership is not created");
    } else {
        $values = array();
        $values['id'] = $membershipStatusBAO->id;
        $values['is_error'] = 0;
        return $values;
    }
}
开发者ID:ksecor,项目名称:civicrm,代码行数:33,代码来源:MembershipStatus.php

示例4: postProcess

 /**
  * Function to process the form
  *
  * @access public
  *
  * @return void
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         try {
             CRM_Member_BAO_MembershipStatus::del($this->_id);
         } catch (CRM_Core_Exception $e) {
             CRM_Core_Error::statusBounce($e->getMessage(), NULL, ts('Delete Failed'));
         }
         CRM_Core_Session::setStatus(ts('Selected membership status has been deleted.'), ts('Record Deleted'), 'success');
     } else {
         $params = $ids = array();
         // store the submitted values in an array
         $params = $this->exportValues();
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $ids['membershipStatus'] = $this->_id;
         }
         $oldWeight = NULL;
         if ($this->_id) {
             $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $this->_id, 'weight', 'id');
         }
         $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Member_DAO_MembershipStatus', $oldWeight, $params['weight']);
         // only for add mode, set label to name.
         if ($this->_action & CRM_Core_Action::ADD) {
             $params['name'] = $params['label'];
         }
         $membershipStatus = CRM_Member_BAO_MembershipStatus::add($params, $ids);
         CRM_Core_Session::setStatus(ts('The membership status \'%1\' has been saved.', array(1 => $membershipStatus->label)), ts('Saved'), 'success');
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:36,代码来源:MembershipStatus.php

示例5: testgetMembershipStatusCurrent

 public function testgetMembershipStatusCurrent()
 {
     $params = array('name' => 'Current', 'is_active' => 1, 'is_current_member' => 1);
     $membershipStatus = CRM_Member_BAO_MembershipStatus::add($params);
     $result = CRM_Member_BAO_MembershipStatus::getMembershipStatusCurrent();
     $this->assertEquals(empty($result), FALSE, 'Verify membership status records is_current_member.');
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:7,代码来源:MembershipStatusTest.php

示例6: create

 /**
  * Takes an associative array and creates a membership Status object.
  * See http://wiki.civicrm.org/confluence/display/CRM/Database+layer
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  *
  * @throws Exception
  * @return CRM_Member_BAO_MembershipStatus
  */
 public static function create($params)
 {
     $ids = array();
     if (!empty($params['id'])) {
         $ids['membershipStatus'] = $params['id'];
     } else {
         //don't allow duplicate names - if id not set
         $status = new CRM_Member_DAO_MembershipStatus();
         $status->name = $params['name'];
         if ($status->find(TRUE)) {
             throw new Exception('A membership status with this name already exists.');
         }
     }
     $membershipStatusBAO = CRM_Member_BAO_MembershipStatus::add($params, $ids);
     return $membershipStatusBAO;
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:26,代码来源:MembershipStatus.php

示例7: crm_create_membership_status

/**
 * Create a Membership Status
 *  
 * This API is used for creating a Membership Status
 * 
 * @param   array  $params  an associative array of name/value property values of civicrm_membership_status
 * @return array of newly created membership status property values.
 * @access public
 */
function crm_create_membership_status($params)
{
    _crm_initialize();
    if (!is_array($params)) {
        return _crm_error('Params is not an array.');
    }
    if (empty($params)) {
        return _crm_error('Params can not be empty.');
    }
    if (!$params["name"]) {
        return _crm_error('Missing require fileds');
    }
    require_once 'CRM/Member/BAO/MembershipStatus.php';
    $ids = array();
    $membershipStatusBAO = CRM_Member_BAO_MembershipStatus::add($params, $ids);
    $membershipStatus = array();
    _crm_object_to_array($membershipStatusBAO, $membershipStatus);
    return $membershipStatus;
}
开发者ID:bhirsch,项目名称:voipdev,代码行数:28,代码来源:Membership.php

示例8: postProcess

 /**
  * Function to process the form
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     require_once 'CRM/Member/BAO/MembershipStatus.php';
     if ($this->_action & CRM_Core_Action::DELETE) {
         $wt = CRM_Utils_Weight::delWeight('CRM_Member_DAO_MembershipStatus', $this->_id);
         CRM_Member_BAO_MembershipStatus::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected membership status has been deleted.'));
     } else {
         $params = $ids = array();
         // store the submitted values in an array
         $params = $this->exportValues();
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $ids['membershipStatus'] = $this->_id;
         }
         if ($this->_id) {
             $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $this->_id, 'weight', 'id');
         }
         $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Member_DAO_MembershipStatus', $oldWeight, $params['weight']);
         // only for add mode, set label to name.
         if ($this->_action & CRM_Core_Action::ADD) {
             $params['name'] = $params['label'];
         }
         $membershipStatus = CRM_Member_BAO_MembershipStatus::add($params, $ids);
         CRM_Core_Session::setStatus(ts('The membership status \'%1\' has been saved.', array(1 => $membershipStatus->label)));
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:32,代码来源:MembershipStatus.php


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