コード例 #1
0
ファイル: Campaign.php プロジェクト: kcristiano/civicrm-core
 /**
  * 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;
 }
コード例 #2
0
 /**
  * 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;
 }