/** * Retrieve DB object based on input parameters. * * 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 \CRM_Campaign_DAO_Campaign|null */ public static function retrieve(&$params, &$defaults) { $campaign = new CRM_Campaign_DAO_Campaign(); $campaign->copyValues($params); if ($campaign->find(TRUE)) { CRM_Core_DAO::storeValues($campaign, $defaults); return $campaign; } return NULL; }
/** * 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['campaign'] =& $fields[$name]; } else { self::$_export[$name] =& $fields[$name]; } } } } return self::$_export; }
/** * Function to get Campaigns * * @param $all boolean true if campaign is active else returns camapign * * @static */ static function getCampaign($all = false, $id = false) { $campaign = array(); $dao = new CRM_Campaign_DAO_Campaign(); if (!$all) { $dao->is_active = 1; } if ($id) { $dao->id = $id; } $dao->find(); while ($dao->fetch()) { CRM_Core_DAO::storeValues($dao, $campaign[$dao->id]); } return $campaign; }