<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
class CRM_Contribute_BAO_Premium extends CRM_Contribute_DAO_Premium {
/**
- * product information
+ * Product information
* @var array
* @static
*/
private static $productInfo;
/**
- * class constructor
+ * Class constructor
*/
- function __construct() {
+ public function __construct() {
parent::__construct();
}
/**
- * 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
+ * Fetch object based on array of properties
*
- * @param array $params (reference ) an assoc array of name/value pairs
- * @param array $defaults (reference ) an assoc array to hold the flattened values
+ * @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_Contribute_BAO_ManagePremium object
- * @access public
+ * @return CRM_Contribute_BAO_ManagePremium object
* @static
*/
- static function retrieve(&$params, &$defaults) {
+ public static function retrieve(&$params, &$defaults) {
$premium = new CRM_Contribute_DAO_Product();
$premium->copyValues($params);
if ($premium->find(TRUE)) {
}
/**
- * update the is_active flag in the db
+ * Update the is_active flag in the db
*
- * @param int $id id of the database record
- * @param boolean $is_active value we want to set the is_active field
+ * @param int $id
+ * Id of the database record.
+ * @param bool $is_active
+ * Value we want to set the is_active field.
*
* @return Object DAO object on sucess, null otherwise
* @static
*/
- static function setIsActive($id, $is_active) {
+ public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_Premium', $id, 'premiums_active ', $is_active);
}
/**
- * Function to delete financial Types
+ * Delete financial Types
*
- * @param $premiumID
+ * @param int $premiumID
*
- * @internal param int $contributionTypeId
* @static
*/
- static function del($premiumID) {
+ public static function del($premiumID) {
//check dependencies
- //delete from financial Type table
+ //delete from financial Type table
$premium = new CRM_Contribute_DAO_Premium();
$premium->id = $premiumID;
$premium->delete();
}
/**
- * Function to build Premium Block im Contribution Pages
+ * Build Premium Block im Contribution Pages
*
- * @param $form CRM_Core_Form
- * @param $pageID
+ * @param CRM_Core_Form $form
+ * @param int $pageID
* @param bool $formItems
- * @param null $selectedProductID
+ * @param int $selectedProductID
* @param null $selectedOption
*
- * @internal param int $pageId
* @static
*/
- static function buildPremiumBlock(&$form, $pageID, $formItems = FALSE, $selectedProductID = NULL, $selectedOption = NULL) {
+ public static function buildPremiumBlock(&$form, $pageID, $formItems = FALSE, $selectedProductID = NULL, $selectedOption = NULL) {
$form->add('hidden', "selectProduct", $selectedProductID, array('id' => 'selectProduct'));
$dao = new CRM_Contribute_DAO_Premium();
}
/**
- * Function to build Premium B im Contribution Pages
+ * Build Premium B im Contribution Pages
*
- * @param $form CRM_Core_Form
- * @param $productID
- * @param null $premiumProductID
+ * @param CRM_Core_Form $form
+ * @param int $productID
+ * @param int $premiumProductID
*
- * @internal param int $pageId
* @static
*/
- function buildPremiumPreviewBlock($form, $productID, $premiumProductID = NULL) {
+ public function buildPremiumPreviewBlock($form, $productID, $premiumProductID = NULL) {
if ($premiumProductID) {
$dao = new CRM_Contribute_DAO_PremiumsProduct();
$dao->id = $premiumProductID;
}
/**
- * Function to delete premium associated w/ contribution page.
+ * Delete premium associated w/ contribution page.
*
- * @param $contributionPageID
+ * @param int $contributionPageID
*
- * @internal param int $contribution page id
* @static
*/
- static function deletePremium($contributionPageID) {
+ public static function deletePremium($contributionPageID) {
if (!$contributionPageID) {
return;
}
}
/**
- * Function to retrieve premium product and their options
+ * Retrieve premium product and their options
*
* @return array product and option arrays
* @static
- * @access public
*/
- static function getPremiumProductInfo() {
+ public static function getPremiumProductInfo() {
if (!self::$productInfo) {
$products = $options = array();
return self::$productInfo;
}
}
-