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


PHP CRM_Core_Form::getElementValue方法代码示例

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


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

示例1: addCampaign

 /**
  * Add select element for campaign
  * and assign needful info to templates.
  *
  * @param CRM_Core_Form $form
  * @param int $connectedCampaignId
  */
 public static function addCampaign(&$form, $connectedCampaignId = NULL)
 {
     //some forms do set default and freeze.
     $appendDates = TRUE;
     if ($form->get('action') & CRM_Core_Action::VIEW) {
         $appendDates = FALSE;
     }
     $campaignDetails = self::getPermissionedCampaigns($connectedCampaignId, NULL, TRUE, TRUE, $appendDates);
     $fields = array('campaigns', 'hasAccessCampaign', 'isCampaignEnabled');
     foreach ($fields as $fld) {
         ${$fld} = CRM_Utils_Array::value($fld, $campaignDetails);
     }
     //lets see do we have past campaigns.
     $hasPastCampaigns = FALSE;
     $allActiveCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, TRUE, FALSE);
     if (count($allActiveCampaigns) > count($campaigns)) {
         $hasPastCampaigns = TRUE;
     }
     $hasCampaigns = FALSE;
     if (!empty($campaigns)) {
         $hasCampaigns = TRUE;
     }
     if ($hasPastCampaigns) {
         $hasCampaigns = TRUE;
         $form->add('hidden', 'included_past_campaigns');
     }
     $showAddCampaign = FALSE;
     $alreadyIncludedPastCampaigns = FALSE;
     if ($connectedCampaignId || $isCampaignEnabled && $hasAccessCampaign) {
         $showAddCampaign = TRUE;
         //lets add past campaigns as options to quick-form element.
         if ($hasPastCampaigns && $form->getElementValue('included_past_campaigns')) {
             $campaigns = $allActiveCampaigns;
             $alreadyIncludedPastCampaigns = TRUE;
         }
         $campaign =& $form->add('select', 'campaign_id', ts('Campaign'), array('' => ts('- select -')) + $campaigns, FALSE, array('class' => 'crm-select2'));
         //lets freeze when user does not has access or campaign is disabled.
         if (!$isCampaignEnabled || !$hasAccessCampaign) {
             $campaign->freeze();
         }
     }
     $addCampaignURL = NULL;
     if (empty($campaigns) && $hasAccessCampaign && $isCampaignEnabled) {
         $addCampaignURL = CRM_Utils_System::url('civicrm/campaign/add', 'reset=1');
     }
     $includePastCampaignURL = NULL;
     if ($hasPastCampaigns && $isCampaignEnabled && $hasAccessCampaign) {
         $includePastCampaignURL = CRM_Utils_System::url('civicrm/ajax/rest', 'className=CRM_Campaign_Page_AJAX&fnName=allActiveCampaigns', FALSE, NULL, FALSE);
     }
     //carry this info to templates.
     $infoFields = array('hasCampaigns', 'addCampaignURL', 'showAddCampaign', 'hasPastCampaigns', 'hasAccessCampaign', 'isCampaignEnabled', 'includePastCampaignURL', 'alreadyIncludedPastCampaigns');
     foreach ($infoFields as $fld) {
         $campaignInfo[$fld] = ${$fld};
     }
     $form->assign('campaignInfo', $campaignInfo);
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:63,代码来源:Campaign.php


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