当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Contribute_PseudoConstant::products方法代码示例

本文整理汇总了PHP中CRM_Contribute_PseudoConstant::products方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_PseudoConstant::products方法的具体用法?PHP CRM_Contribute_PseudoConstant::products怎么用?PHP CRM_Contribute_PseudoConstant::products使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Contribute_PseudoConstant的用法示例。


在下文中一共展示了CRM_Contribute_PseudoConstant::products方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preProcess

 /**
  * Pre  process the form.
  *
  *
  * @return void
  */
 public function preProcess()
 {
     parent::preProcess();
     $this->_products = CRM_Contribute_PseudoConstant::products($this->_id);
     $this->_pid = CRM_Utils_Request::retrieve('pid', 'Positive', $this, FALSE, 0);
     if ($this->_pid) {
         $dao = new CRM_Contribute_DAO_PremiumsProduct();
         $dao->id = $this->_pid;
         $dao->find(TRUE);
         $temp = CRM_Contribute_PseudoConstant::products();
         $this->_products[$dao->product_id] = $temp[$dao->product_id];
     }
     //$this->_products = array_merge(array('' => '-- Select Product --') , $this->_products );
 }
开发者ID:kidaa30,项目名称:yes,代码行数:20,代码来源:AddProduct.php

示例2: browse

 /**
  * Browse function.
  */
 public function browse()
 {
     // get all custom groups sorted by weight
     $premiums = array();
     $pageID = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
     $dao = new CRM_Contribute_DAO_Premium();
     $dao->entity_table = 'civicrm_contribution_page';
     $dao->entity_id = $pageID;
     $dao->find(TRUE);
     $premiumID = $dao->id;
     $this->assign('products', FALSE);
     $this->assign('id', $pageID);
     if (!$premiumID) {
         return;
     }
     $dao = new CRM_Contribute_DAO_PremiumsProduct();
     $dao->premiums_id = $premiumID;
     $dao->orderBy('weight');
     $dao->find();
     while ($dao->fetch()) {
         $productDAO = new CRM_Contribute_DAO_Product();
         $productDAO->id = $dao->product_id;
         $productDAO->is_active = 1;
         if ($productDAO->find(TRUE)) {
             $premiums[$productDAO->id] = array();
             $premiums[$productDAO->id]['weight'] = $dao->weight;
             CRM_Core_DAO::storeValues($productDAO, $premiums[$productDAO->id]);
             $action = array_sum(array_keys($this->links()));
             $premiums[$dao->product_id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $pageID, 'pid' => $dao->id), ts('more'), FALSE, 'premium.contributionpage.row', 'Premium', $dao->id);
             //Financial Type
             if (!empty($dao->financial_type_id)) {
                 $premiums[$productDAO->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name');
             }
         }
     }
     if (count(CRM_Contribute_PseudoConstant::products($pageID)) == 0) {
         $this->assign('products', FALSE);
     } else {
         $this->assign('products', TRUE);
     }
     // Add order changing widget to selector
     $returnURL = CRM_Utils_System::url('civicrm/admin/contribute/premium', "reset=1&action=update&id={$pageID}");
     $filter = "premiums_id = {$premiumID}";
     CRM_Utils_Weight::addOrder($premiums, 'CRM_Contribute_DAO_PremiumsProduct', 'id', $returnURL, $filter);
     $this->assign('rows', $premiums);
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:49,代码来源:Premium.php

示例3: buildQillForFieldValue

 /**
  * Build qill for field.
  *
  * Qill refers to the query detail visible on the UI.
  *
  * @param string $daoName
  * @param string $fieldName
  * @param mixed $fieldValue
  * @param string $op
  * @param array $pseudoExtraParam
  * @param int $type
  *   Type of the field per CRM_Utils_Type
  *
  * @return array
  */
 public static function buildQillForFieldValue($daoName, $fieldName, $fieldValue, $op, $pseudoExtraParam = array(), $type = CRM_Utils_Type::T_STRING)
 {
     $qillOperators = CRM_Core_SelectValues::getSearchBuilderOperators();
     // if Operator chosen is NULL/EMPTY then
     if (strpos($op, 'NULL') !== FALSE || strpos($op, 'EMPTY') !== FALSE) {
         return array(CRM_Utils_Array::value($op, $qillOperators, $op), '');
     }
     if ($fieldName == 'activity_type_id') {
         $pseudoOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
     } elseif ($fieldName == 'country_id') {
         $pseduoOptions = CRM_Core_PseudoConstant::country();
     } elseif ($fieldName == 'county_id') {
         $pseduoOptions = CRM_Core_PseudoConstant::county();
     } elseif ($fieldName == 'world_region') {
         $pseduoOptions = CRM_Core_PseudoConstant::worldRegion();
     } elseif ($daoName == 'CRM_Event_DAO_Event' && $fieldName == 'id') {
         $pseudoOptions = CRM_Event_BAO_Event::getEvents(0, $fieldValue, TRUE, TRUE, TRUE);
     } elseif ($fieldName == 'contribution_product_id') {
         $pseudoOptions = CRM_Contribute_PseudoConstant::products();
     } elseif ($daoName == 'CRM_Contact_DAO_Group' && $fieldName == 'id') {
         $pseudoOptions = CRM_Core_PseudoConstant::group();
     } elseif ($fieldName == 'country_id') {
         $pseudoOptions = CRM_Core_PseudoConstant::country();
     } elseif ($daoName) {
         $pseudoOptions = CRM_Core_PseudoConstant::get($daoName, $fieldName, $pseudoExtraParam);
     }
     //API usually have fieldValue format as array(operator => array(values)),
     //so we need to separate operator out of fieldValue param
     if (is_array($fieldValue) && in_array(key($fieldValue), CRM_Core_DAO::acceptedSQLOperators(), TRUE)) {
         $op = key($fieldValue);
         $fieldValue = $fieldValue[$op];
     }
     if (is_array($fieldValue)) {
         $qillString = array();
         if (!empty($pseudoOptions)) {
             foreach ((array) $fieldValue as $val) {
                 $qillString[] = CRM_Utils_Array::value($val, $pseudoOptions, $val);
             }
             $fieldValue = implode(', ', $qillString);
         } else {
             if ($type == CRM_Utils_Type::T_DATE) {
                 foreach ($fieldValue as $index => $value) {
                     $fieldValue[$index] = CRM_Utils_Date::customFormat($value);
                 }
             }
             $separator = ', ';
             // @todo - this is a bit specific (one operator).
             // However it is covered by a unit test so can be altered later with
             // some confidence.
             if ($op == 'BETWEEN') {
                 $separator = ' AND ';
             }
             $fieldValue = implode($separator, $fieldValue);
         }
     } elseif (!empty($pseudoOptions) && array_key_exists($fieldValue, $pseudoOptions)) {
         $fieldValue = $pseudoOptions[$fieldValue];
     } elseif ($type === CRM_Utils_Type::T_DATE) {
         $fieldValue = CRM_Utils_Date::customFormat($fieldValue);
     }
     return array(CRM_Utils_Array::value($op, $qillOperators, $op), $fieldValue);
 }
开发者ID:hoegrammer,项目名称:civicrm-core,代码行数:76,代码来源:Query.php

示例4: buildQillForFieldValue

 /**
  * Build qill for field.
  *
  * Qill refers to the query detail visible on the UI.
  *
  * @param $daoName
  * @param $fieldName
  * @param $fieldValue
  * @param $op
  * @param array $pseduoExtraParam
  *
  * @return array
  */
 public static function buildQillForFieldValue($daoName = NULL, $fieldName, $fieldValue, $op, $pseduoExtraParam = array())
 {
     $qillOperators = CRM_Core_SelectValues::getSearchBuilderOperators();
     if ($fieldName == 'activity_type_id') {
         $pseduoOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
     } elseif ($daoName == 'CRM_Event_DAO_Event' && $fieldName == 'id') {
         $pseduoOptions = CRM_Event_BAO_Event::getEvents(0, $fieldValue, TRUE, TRUE, TRUE);
     } elseif ($fieldName == 'contribution_product_id') {
         $pseduoOptions = CRM_Contribute_PseudoConstant::products();
     } elseif ($daoName) {
         $pseduoOptions = CRM_Core_PseudoConstant::get($daoName, $fieldName, $pseduoExtraParam = array());
     }
     //API usually have fieldValue format as array(operator => array(values)),
     //so we need to separate operator out of fieldValue param
     if (is_array($fieldValue) && in_array(key($fieldValue), CRM_Core_DAO::acceptedSQLOperators(), TRUE)) {
         $op = key($fieldValue);
         $fieldValue = $fieldValue[$op];
     }
     if (is_array($fieldValue)) {
         $qillString = array();
         if (!empty($pseduoOptions)) {
             foreach ((array) $fieldValue as $val) {
                 $qillString[] = $pseduoOptions[$val];
             }
             $fieldValue = implode(', ', $qillString);
         } else {
             $fieldValue = implode(', ', $fieldValue);
         }
     } elseif (!empty($pseduoOptions) && array_key_exists($fieldValue, $pseduoOptions)) {
         $fieldValue = $pseduoOptions[$fieldValue];
     }
     return array(CRM_Utils_Array::value($op, $qillOperators, $op), $fieldValue);
 }
开发者ID:vakeesan26,项目名称:civicrm-core,代码行数:46,代码来源:Query.php

示例5: buildSearchForm

 /**
  * Add all the elements shared between contribute search and advnaced search.
  *
  *
  * @param CRM_Core_Form $form
  *
  * @return void
  */
 public static function buildSearchForm(&$form)
 {
     // Added contribution source
     $form->addElement('text', 'contribution_source', ts('Contribution Source'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'source'));
     CRM_Core_Form_Date::buildDateRange($form, 'contribution_date', 1, '_low', '_high', ts('From:'), FALSE);
     $form->add('text', 'contribution_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
     $form->addRule('contribution_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
     $form->add('text', 'contribution_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
     $form->addRule('contribution_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
     // Adding select option for curreny type -- CRM-4711
     $form->add('select', 'contribution_currency_type', ts('Currency Type'), array('' => ts('- any -')) + CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array('labelColumn' => 'name')), FALSE, array('class' => 'crm-select2'));
     // CRM-13848
     $form->addSelect('financial_type_id', array('entity' => 'contribution', 'multiple' => 'multiple', 'context' => 'search'));
     $form->add('select', 'contribution_page_id', ts('Contribution Page'), CRM_Contribute_PseudoConstant::contributionPage(), FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple', 'placeholder' => ts('- any -')));
     $form->addSelect('payment_instrument_id', array('entity' => 'contribution', 'multiple' => 'multiple', 'label' => ts('Payment Method'), 'option_url' => NULL, 'placeholder' => ts('- any -')));
     // Fixme: Not a true entityRef field. Relies on PCP.js.tpl
     $form->add('text', 'contribution_pcp_made_through_id', ts('Personal Campaign Page'), array('class' => 'twenty', 'id' => 'pcp_made_through_id', 'placeholder' => ts('- any -')));
     // stores the label
     $form->add('hidden', 'pcp_made_through');
     $statusValues = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status');
     // Remove status values that are only used for recurring contributions or pledges (In Progress, Overdue).
     unset($statusValues['5'], $statusValues['6']);
     $form->addSelect('contribution_status_id', array('entity' => 'contribution', 'multiple' => 'multiple', 'label' => ts('Contribution Status(s)'), 'option_url' => NULL, 'placeholder' => ts('- any -')));
     // Add fields for thank you and receipt
     $form->addYesNo('contribution_thankyou_date_is_not_null', ts('Thank-you sent?'), TRUE);
     $form->addYesNo('contribution_receipt_date_is_not_null', ts('Receipt sent?'), TRUE);
     $form->addYesNo('contribution_pay_later', ts('Contribution is Pay Later?'), TRUE);
     $form->addYesNo('contribution_recurring', ts('Contribution is Recurring?'), TRUE);
     // Recurring contribution fields
     foreach (self::getRecurringFields() as $key => $label) {
         CRM_Core_Form_Date::buildDateRange($form, $key, 1, '_low', '_high');
         // If data has been entered for a recurring field, tell the tpl layer to open the pane
         if (!empty($form->_formValues[$key . '_relative']) || !empty($form->_formValues[$key . '_low']) || !empty($form->_formValues[$key . '_high'])) {
             $form->assign('contribution_recur_pane_open', TRUE);
         }
     }
     $form->addYesNo('contribution_test', ts('Contribution is a Test?'), TRUE);
     // Add field for transaction ID search
     $form->addElement('text', 'contribution_trxn_id', ts("Transaction ID"));
     $form->addElement('text', 'invoice_id', ts("Invoice ID"));
     $form->addElement('text', 'contribution_check_number', ts('Check Number'));
     // Add field for pcp display in roll search
     $form->addYesNo('contribution_pcp_display_in_roll', ts('Personal Campaign Page Honor Roll?'), TRUE);
     // Soft credit related fields
     $options = array('only_contribs' => ts('Contributions Only'), 'only_scredits' => ts('Soft Credits Only'), 'both_related' => ts('Soft Credits with related Hard Credit'), 'both' => ts('Both'));
     $form->add('select', 'contribution_or_softcredits', ts('Contributions OR Soft Credits?'), $options, FALSE, array('class' => "crm-select2"));
     $form->addSelect('contribution_soft_credit_type_id', array('entity' => 'contribution_soft', 'field' => 'soft_credit_type_id', 'multiple' => TRUE, 'context' => 'search'));
     // CRM-16713 - contribution search by premiums on 'Find Contribution' form.
     $form->add('select', 'contribution_product_id', ts('Premium'), CRM_Contribute_PseudoConstant::products(), FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple', 'placeholder' => ts('- any -')));
     // Add all the custom searchable fields
     $contribution = array('Contribution');
     $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contribution);
     if ($groupDetails) {
         $form->assign('contributeGroupTree', $groupDetails);
         foreach ($groupDetails as $group) {
             foreach ($group['fields'] as $field) {
                 $fieldId = $field['id'];
                 $elementName = 'custom_' . $fieldId;
                 CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
             }
         }
     }
     CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'contribution_campaign_id');
     // Add batch select
     $batches = CRM_Contribute_PseudoConstant::batch();
     if (!empty($batches)) {
         $form->add('select', 'contribution_batch_id', ts('Batch Name'), array('' => ts('- any -')) + $batches, FALSE, array('class' => 'crm-select2'));
     }
     $form->assign('validCiviContribute', TRUE);
     $form->setDefaults(array('contribution_test' => 0));
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:79,代码来源:Query.php

示例6: browse

 /**
  * Browse all custom data groups.
  *  
  * 
  * @return void
  * @access public
  * @static
  */
 function browse()
 {
     // get all custom groups sorted by weight
     $premiums = array();
     require_once 'CRM/Contribute/DAO/Product.php';
     $pageID = CRM_Utils_Request::retrieve('id', $this, false, 0);
     $dao =& new CRM_Contribute_DAO_Premium();
     $dao->entity_table = 'civicrm_contribution_page';
     $dao->entity_id = $pageID;
     $dao->find(true);
     $premiumID = $dao->id;
     require_once 'CRM/Contribute/DAO/PremiumsProduct.php';
     $dao =& new CRM_Contribute_DAO_PremiumsProduct();
     $dao->premiums_id = $premiumID;
     $dao->orderBy('sort_position');
     $dao->find();
     while ($dao->fetch()) {
         $productDAO =& new CRM_Contribute_DAO_Product();
         $productDAO->id = $dao->product_id;
         $productDAO->is_active = 1;
         if ($productDAO->find(true)) {
             $premiums[$productDAO->id] = array();
             $premiums[$productDAO->id]['weight'] = $dao->sort_position;
             CRM_Core_DAO::storeValues($productDAO, $premiums[$productDAO->id]);
             $action = array_sum(array_keys($this->links()));
             $premiums[$dao->product_id]['action'] = CRM_Core_Action::formLink(CRM_Contribute_Page_Premium::links(), $action, array('id' => $pageID, 'pid' => $dao->id));
         }
     }
     require_once 'CRM/Contribute/PseudoConstant.php';
     if (count(CRM_Contribute_PseudoConstant::products($pageID)) == 0) {
         $this->assign('products', false);
     } else {
         $this->assign('products', true);
     }
     $this->assign('rows', $premiums);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:44,代码来源:Premium.php

示例7: browse

 /**
  * 
  * @return void
  * @access public
  * @static
  */
 function browse()
 {
     // get all custom groups sorted by weight
     $premiums = array();
     require_once 'CRM/Contribute/DAO/Product.php';
     $pageID = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0);
     $dao =& new CRM_Contribute_DAO_Premium();
     $dao->entity_table = 'civicrm_contribution_page';
     $dao->entity_id = $pageID;
     $dao->find(true);
     $premiumID = $dao->id;
     $this->assign('products', false);
     if (!$premiumID) {
         return;
     }
     require_once 'CRM/Contribute/DAO/PremiumsProduct.php';
     $dao =& new CRM_Contribute_DAO_PremiumsProduct();
     $dao->premiums_id = $premiumID;
     $dao->orderBy('weight');
     $dao->find();
     while ($dao->fetch()) {
         $productDAO =& new CRM_Contribute_DAO_Product();
         $productDAO->id = $dao->product_id;
         $productDAO->is_active = 1;
         if ($productDAO->find(true)) {
             $premiums[$productDAO->id] = array();
             $premiums[$productDAO->id]['weight'] = $dao->weight;
             CRM_Core_DAO::storeValues($productDAO, $premiums[$productDAO->id]);
             $action = array_sum(array_keys($this->links()));
             $premiums[$dao->product_id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $pageID, 'pid' => $dao->id));
         }
     }
     require_once 'CRM/Contribute/PseudoConstant.php';
     if (count(CRM_Contribute_PseudoConstant::products($pageID)) == 0) {
         $this->assign('products', false);
     } else {
         $this->assign('products', true);
     }
     // Add order changing widget to selector
     $returnURL = CRM_Utils_System::url('civicrm/admin/contribute', "reset=1&action=update&id={$pageID}&subPage=Premium");
     $filter = "premiums_id = {$premiumID}";
     require_once 'CRM/Utils/Weight.php';
     CRM_Utils_Weight::addOrder($premiums, 'CRM_Contribute_DAO_PremiumsProduct', 'id', $returnURL, $filter);
     $this->assign('rows', $premiums);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:51,代码来源:Premium.php


注:本文中的CRM_Contribute_PseudoConstant::products方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。