本文整理匯總了PHP中CRM_Contribute_DAO_Product::fetch方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Contribute_DAO_Product::fetch方法的具體用法?PHP CRM_Contribute_DAO_Product::fetch怎麽用?PHP CRM_Contribute_DAO_Product::fetch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Contribute_DAO_Product
的用法示例。
在下文中一共展示了CRM_Contribute_DAO_Product::fetch方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: buildPremium
/**
* Function to build the form for Premium Information.
*
* @access public
* @return None
*/
function buildPremium(&$form)
{
//premium section
$form->add('hidden', 'hidden_Premium', 1);
require_once 'CRM/Contribute/DAO/Product.php';
$sel1 = $sel2 = array();
$dao = new CRM_Contribute_DAO_Product();
$dao->is_active = 1;
$dao->find();
$min_amount = array();
$sel1[0] = '-select product-';
while ($dao->fetch()) {
$sel1[$dao->id] = $dao->name . " ( " . $dao->sku . " )";
$min_amount[$dao->id] = $dao->min_contribution;
$options = explode(',', $dao->options);
foreach ($options as $k => $v) {
$options[$k] = trim($v);
}
if ($options[0] != '') {
$sel2[$dao->id] = $options;
}
$form->assign('premiums', true);
}
$form->_options = $sel2;
$form->assign('mincontribution', $min_amount);
$sel =& $form->addElement('hierselect', "product_name", ts('Premium'), 'onclick="showMinContrib();"');
$js = "<script type='text/javascript'>\n";
$formName = 'document.forms.' . $form->getName();
for ($k = 1; $k < 2; $k++) {
if (!isset($defaults['product_name'][$k]) || !$defaults['product_name'][$k]) {
$js .= "{$formName}['product_name[{$k}]'].style.display = 'none';\n";
}
}
$sel->setOptions(array($sel1, $sel2));
$js .= "</script>\n";
$form->assign('initHideBoxes', $js);
$this->addDate('fulfilled_date', ts('Fulfilled'), false, array('formatType' => 'activityDate'));
$form->addElement('text', 'min_amount', ts('Minimum Contribution Amount'));
}
示例2: browse
/**
* Browse all custom data groups.
*
*
* @return void
*/
public function browse()
{
// get all custom groups sorted by weight
$premiums = array();
$dao = new CRM_Contribute_DAO_Product();
$dao->orderBy('name');
$dao->find();
while ($dao->fetch()) {
$premiums[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $premiums[$dao->id]);
// form all action links
$action = array_sum(array_keys($this->links()));
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$premiums[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id), ts('more'), FALSE, 'premium.manage.row', 'Premium', $dao->id);
//Financial Type
if (!empty($dao->financial_type_id)) {
require_once 'CRM/Core/DAO.php';
$premiums[$dao->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name');
}
}
$this->assign('rows', $premiums);
}
示例3: getPremiumProductInfo
/**
* Retrieve premium product and their options.
*
* @return array
* product and option arrays
*/
public static function getPremiumProductInfo()
{
if (!self::$productInfo) {
$products = $options = array();
$dao = new CRM_Contribute_DAO_Product();
$dao->is_active = 1;
$dao->find();
while ($dao->fetch()) {
$products[$dao->id] = $dao->name . " ( " . $dao->sku . " )";
$opts = explode(',', $dao->options);
foreach ($opts as $k => $v) {
$ops[$k] = trim($v);
}
if ($ops[0] != '') {
$options[$dao->id] = $opts;
}
}
self::$productInfo = array($products, $options);
}
return self::$productInfo;
}
示例4: products
/**
* Get all premiums.
*
*
* @param int $pageID
* @return array
* array of all Premiums if any
*/
public static function products($pageID = NULL)
{
$products = array();
$dao = new CRM_Contribute_DAO_Product();
$dao->is_active = 1;
$dao->orderBy('id');
$dao->find();
while ($dao->fetch()) {
$products[$dao->id] = $dao->name;
}
if ($pageID) {
$dao = new CRM_Contribute_DAO_Premium();
$dao->entity_table = 'civicrm_contribution_page';
$dao->entity_id = $pageID;
$dao->find(TRUE);
$premiumID = $dao->id;
$productID = array();
$dao = new CRM_Contribute_DAO_PremiumsProduct();
$dao->premiums_id = $premiumID;
$dao->find();
while ($dao->fetch()) {
$productID[$dao->product_id] = $dao->product_id;
}
$tempProduct = array();
foreach ($products as $key => $value) {
if (!array_key_exists($key, $productID)) {
$tempProduct[$key] = $value;
}
}
return $tempProduct;
}
return $products;
}
示例5: browse
/**
* Browse all custom data groups.
*
*
* @return void
* @access public
* @static
*/
function browse()
{
// get all custom groups sorted by weight
$premiums = array();
$dao = new CRM_Contribute_DAO_Product();
$dao->orderBy('name');
$dao->find();
while ($dao->fetch()) {
$premiums[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $premiums[$dao->id]);
// form all action links
$action = array_sum(array_keys($this->links()));
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
} else {
$action -= CRM_Core_Action::DISABLE;
}
$premiums[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $dao->id));
}
$this->assign('rows', $premiums);
}