static function &getFields() { $fields = array(); require_once 'CRM/Grant/DAO/Grant.php'; $fields = array_merge($fields, CRM_Grant_DAO_Grant::export()); return $fields; }
/** * Combine all the exportable fields from the lower levels object. * * @return array * array of exportable Fields */ public static function &exportableFields() { if (!self::$_exportableFields) { if (!self::$_exportableFields) { self::$_exportableFields = array(); } $grantFields = array('grant_status' => array('title' => 'Grant Status', 'name' => 'grant_status', 'data_type' => CRM_Utils_Type::T_STRING), 'grant_type' => array('title' => 'Grant Type', 'name' => 'grant_type', 'data_type' => CRM_Utils_Type::T_STRING), 'grant_money_transfer_date' => array('title' => 'Grant Money Transfer Date', 'name' => 'grant_money_transfer_date', 'data_type' => CRM_Utils_Type::T_DATE), 'grant_amount_requested' => array('title' => 'Grant Amount Requested', 'name' => 'grant_amount_requested', 'data_type' => CRM_Utils_Type::T_FLOAT), 'grant_application_received_date' => array('title' => 'Grant Application Received Date', 'name' => 'grant_application_received_date', 'data_type' => CRM_Utils_Type::T_DATE)); $fields = CRM_Grant_DAO_Grant::export(); $grantNote = array('grant_note' => array('title' => ts('Grant Note'), 'name' => 'grant_note', 'data_type' => CRM_Utils_Type::T_TEXT)); $fields = array_merge($fields, $grantFields, $grantNote, CRM_Core_BAO_CustomField::getFieldsForImport('Grant')); self::$_exportableFields = $fields; } return self::$_exportableFields; }
/** * 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['grant'] =& $fields[$name]; } else { self::$_export[$name] =& $fields[$name]; } } } } return self::$_export; }
/** * Takes a bunch of params that are needed to match certain criteria and * retrieves the relevant objects. Typically the valid params are only * contact_id. We'll tweak this function to be more full featured over a period * of time. This is the inverse function of create. It also stores all the retrieved * values in the default array * * @param array $params (reference ) an assoc array of name/value pairs * @param array $defaults (reference ) an assoc array to hold the flattened values * * @return object CRM_Grant_BAO_ManageGrant object * @access public * @static */ static function retrieve(&$params, &$defaults) { $grant = new CRM_Grant_DAO_Grant(); $grant->copyValues($params); if ($grant->find(true)) { CRM_Core_DAO::storeValues($grant, $defaults); return $grant; } return null; }
/** * combine all the exportable fields from the lower levels object * * @return array array of exportable Fields * @access public */ function &exportableFields() { if (!self::$_exportableFields) { if (!self::$_exportableFields) { self::$_exportableFields = array(); } require_once 'CRM/Grant/DAO/Grant.php'; $fields = CRM_Grant_DAO_Grant::export(); $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Grant')); self::$_exportableFields = $fields; } return self::$_exportableFields; }