當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。