Пример #1
0
/**
 * This API will give list of the groups for particular contact 
 * Particualr status can be sent in params array
 * If no status mentioned in params, by default 'added' will be used
 * to fetch the records
 * 
 * @param  array $params  name value pair of contact information
 *
 * @return  array  list of groups, given contact subsribed to
 */
function civicrm_group_organization_get(&$params)
{
    _civicrm_initialize();
    if (!is_array($params)) {
        return civicrm_create_error(ts('Input parameter is not an array'));
    }
    if (empty($params)) {
        return civicrm_create_error('No input parameter present');
    }
    if (!array_key_exists('organization_id', $params) && !array_key_exists('group_id', $params)) {
        return civicrm_create_error(ts('at least one of organization_id or group_id is a required field'));
    }
    require_once 'CRM/Contact/DAO/GroupOrganization.php';
    $dao = new CRM_Contact_DAO_GroupOrganization();
    if (array_key_exists('organization_id', $params)) {
        $dao->organization_id = $params['organization_id'];
    }
    if (array_key_exists('group_id', $params)) {
        $dao->group_id = $params['group_id'];
    }
    $dao->find();
    $values = array();
    _civicrm_object_to_array($dao, $values);
    return civicrm_create_success($values);
}
 /**
  * returns the list of fields that can be exported
  *
  * @access public
  * return array
  */
 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['group_organization'] =& $fields[$name];
                 } else {
                     self::$_export[$name] =& $fields[$name];
                 }
             }
         }
     }
     return self::$_export;
 }
 /** 
  * Function to delete Group Organization
  * 
  * @param int $groupOrganizationID group organization id that needs to be deleted 
  *
  * @return $results   no of deleted group organization on success, false otherwise
  * @access public
  */
 function delete($groupOrganizationID)
 {
     $results = null;
     require_once 'CRM/Contact/DAO/GroupOrganization.php';
     $groupOrganization = new CRM_Contact_DAO_GroupOrganization();
     $groupOrganization->id = $groupOrganizationID;
     $results = $groupOrganization->delete();
     return $results;
 }
Пример #4
0
 /**
  * Delete Group Organization.
  *
  * @param int $groupOrganizationID
  *   Group organization id that needs to be deleted.
  *
  * @return int|null
  *   no of deleted group organization on success, false otherwise
  */
 public static function deleteGroupOrganization($groupOrganizationID)
 {
     $results = NULL;
     $groupOrganization = new CRM_Contact_DAO_GroupOrganization();
     $groupOrganization->id = $groupOrganizationID;
     $results = $groupOrganization->delete();
     return $results;
 }
Пример #5
0
 /**
  * class constructor
  */
 function __construct()
 {
     parent::__construct();
 }