Example #1
0
 public static function &getComponents($force = FALSE)
 {
     static $_cache = NULL;
     if (!$_cache || $force) {
         $_cache = array();
         $cr = new CRM_Core_DAO_Component();
         $cr->find(FALSE);
         while ($cr->fetch()) {
             $infoClass = $cr->namespace . '_' . self::COMPONENT_INFO_CLASS;
             require_once str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php';
             $infoObject = new $infoClass($cr->name, $cr->namespace, $cr->id);
             if ($infoObject->info['name'] !== $cr->name) {
                 CRM_Core_Error::fatal("There is a discrepancy between name in component registry and in info file ({$cr->name}).");
             }
             $_cache[$cr->name] = $infoObject;
             unset($infoObject);
         }
     }
     return $_cache;
 }
Example #2
0
 /**
  * @return array
  *   Array(string $name => int $id).
  */
 public static function &getComponentIDs()
 {
     $componentIDs = array();
     $cr = new CRM_Core_DAO_Component();
     $cr->find(FALSE);
     while ($cr->fetch()) {
         $componentIDs[$cr->name] = $cr->id;
     }
     return $componentIDs;
 }
Example #3
0
 /**
  * Returns the list of fields that can be exported
  *
  * @param bool $prefix
  *
  * @return array
  */
 static 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['component'] =& $fields[$name];
                 } else {
                     self::$_export[$name] =& $fields[$name];
                 }
             }
         }
     }
     return self::$_export;
 }