Esempio n. 1
0
function get_registrationGroups($aclGroups)
{
    $roles = get_aclRoles($aclGroups);
    if (count($roles) > 0) {
        foreach ($roles as $role) {
            $entity_id = $role["acl_role_id"];
            $apiParams = array("entity_id" => $entity_id, "deny" => 0, "object_table" => "civicrm_saved_search", "entity_table" => "civicrm_acl_role", "is_active" => 1);
            $entity_name = "Acl";
            $result = civicrm_api3_get($entity_name, $apiParams);
            // object_id should be 56
            $key = "id";
            if (is_array($result)) {
                foreach ($result as $record) {
                    $records[$record[$key]] = $record;
                }
            } else {
                $records[$result[$key]] = $result;
            }
        }
    }
    $acls = $records;
    unset($records);
    unset($result);
    $key = "id";
    if (count($acls) > 0) {
        foreach ($acls as $acl) {
            $result = civicrm_api3_get('Group', array($key => $acl["object_id"]));
            if (is_array($result)) {
                foreach ($result as $record) {
                    $records[$record[$key]] = $record;
                }
            } else {
                $records[$result[$key]] = $result;
            }
        }
    }
    return $records;
}
Esempio n. 2
0
/**
 * Get relationships for a contact id
 *
 *
 * @param $cid long
 * @param $is_active short
 * @param $apiParams array
 * @param $field string
 * @return array
 */
function get_relationships($cid = null, $is_active = 0, $apiParams, $field = 'contact_id_a')
{
    if (isset($cid)) {
        $apiParams = params_merge($apiParams, array($field => $cid));
    }
    $apiParams = params_merge($apiParams, array('is_active' => $is_active));
    return civicrm_api3_get('Relationship', $apiParams);
}