Esempio n. 1
0
 /**
  * Get profiles by type  eg: pure Individual etc
  *
  * @param array $types
  *   Associative array of types eg: types('Individual').
  * @param bool $onlyPure
  *   True if only pure profiles are required.
  *
  * @return array
  *   associative array of profiles
  */
 public static function getProfiles($types, $onlyPure = FALSE)
 {
     $profiles = array();
     $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
     CRM_Utils_Hook::aclGroup(CRM_Core_Permission::ADMIN, NULL, 'civicrm_uf_group', $ufGroups, $ufGroups);
     // Exclude Batch Data Entry profiles - CRM-10901
     $batchProfiles = CRM_Core_BAO_UFGroup::getBatchProfiles();
     foreach ($ufGroups as $id => $title) {
         $ptype = CRM_Core_BAO_UFField::getProfileType($id, FALSE, $onlyPure);
         if (in_array($ptype, $types) && !array_key_exists($id, $batchProfiles)) {
             $profiles[$id] = $title;
         }
     }
     return $profiles;
 }