/**
  * returns the list of fields that can be exported
  *
  * @access public
  * return array
  */
 function &export($prefix = false)
 {
     if (!$GLOBALS['_CRM_CORE_DAO_CUSTOMVALUE']['_export']) {
         $GLOBALS['_CRM_CORE_DAO_CUSTOMVALUE']['_export'] = array();
         $fields =& CRM_Core_DAO_CustomValue::fields();
         foreach ($fields as $name => $field) {
             if (CRM_Utils_Array::value('export', $field)) {
                 if ($prefix) {
                     $GLOBALS['_CRM_CORE_DAO_CUSTOMVALUE']['_export']['custom_value'] =& $fields[$name];
                 } else {
                     $GLOBALS['_CRM_CORE_DAO_CUSTOMVALUE']['_export'][$name] =& $fields[$name];
                 }
             }
         }
     }
     return $GLOBALS['_CRM_CORE_DAO_CUSTOMVALUE']['_export'];
 }
 /**
  * Get number of elements for a particular field.
  *
  * This method returns the number of entries in the crm_custom_value table for this particular field.
  *
  * @param int $fieldId - id of field.
  * @return int $numValue - number of custom data values for this field.
  *
  * @access public
  * @static
  *
  */
 function getNumValue($fieldId)
 {
     $cvTable = CRM_Core_DAO_CustomValue::getTableName();
     $query = "SELECT count(*) \n                  FROM   {$cvTable} \n                  WHERE  {$cvTable}.custom_field_id = " . CRM_Utils_Type::escape($fieldId, 'Integer');
     return CRM_Core_DAO::singleValueQuery($query);
 }