X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCampaign%2FForm%2FCampaign.php;h=0fcca129221c1025e1e7632afc3eefe3c4458f4d;hb=7da04cdea71382ff22ffd94e9b3ae9915c25422b;hp=4f10650bb8fe6b259082c8bf8feea01e5fcb3c00;hpb=b987fa2b9f45bbfb37bfcebe9a846c003251e933;p=civicrm-core.git diff --git a/CRM/Campaign/Form/Campaign.php b/CRM/Campaign/Form/Campaign.php index 4f10650bb8..0fcca12922 100644 --- a/CRM/Campaign/Form/Campaign.php +++ b/CRM/Campaign/Form/Campaign.php @@ -1,9 +1,9 @@ set('type', 'Campaign'); $this->set('subType', CRM_Utils_Array::value('campaign_type_id', $_POST)); $this->set('entityId', $this->_campaignId); @@ -131,12 +131,12 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form { } /** - * This function sets the default values for the form. Note that in edit/view mode + * Set default values for the form. Note that in edit/view mode * the default values are retrieved from the database * * @access public * - * @return void + * @return array */ function setDefaultValues() { $defaults = $this->_values; @@ -215,9 +215,6 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form { return CRM_Custom_Form_CustomData::buildQuickForm($this); } - //campaign types. - $campaignTypes = CRM_Campaign_PseudoConstant::campaignType(); - //lets assign custom data type and subtype. $this->assign('customDataType', 'Campaign'); $this->assign('entityID', $this->_campaignId); @@ -238,49 +235,36 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form { $this->addDateTime('end_date', ts('End Date'), FALSE, array('formatType' => 'activityDateTime')); // add campaign type - $this->add('select', 'campaign_type_id', ts('Campaign Type'), - array( - '' => ts('- select -')) + $campaignTypes, TRUE, - array('onChange' => "CRM.buildCustomData( 'Campaign', this.value );") - ); + $this->addSelect('campaign_type_id', array('onChange' => "CRM.buildCustomData( 'Campaign', this.value );"), TRUE); // add campaign status - $campaignStatus = CRM_Campaign_PseudoConstant::campaignStatus(); - $this->addElement('select', 'status_id', ts('Campaign Status'), - array( - '' => ts('- select -')) + $campaignStatus - ); + $this->addSelect('status_id'); - // add External Identifire Element - $this->add('text', 'external_identifier', ts('External Id'), + // add External Identifier Element + $this->add('text', 'external_identifier', ts('External ID'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Campaign', 'external_identifier'), FALSE ); // add Campaign Parent Id - $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(CRM_Utils_Array::value('parent_id', $this->_values), - $this->_campaignId - ); + $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(CRM_Utils_Array::value('parent_id', $this->_values), $this->_campaignId); if (!empty($campaigns)) { - $this->addElement('select', 'parent_id', ts('Parent Id'), - array( - '' => ts('- select Parent -')) + $campaigns + $this->addElement('select', 'parent_id', ts('Parent ID'), + array('' => ts('- select Parent -')) + $campaigns, + array('class' => 'crm-select2') ); } - + $groups = CRM_Core_PseudoConstant::nestedGroup(); //get the campaign groups. - $groups = CRM_Core_PseudoConstant::group(); - - $inG = &$this->addElement('advmultiselect', 'includeGroups', - ts('Include Group(s)') . ' ', + $this->add('select', 'includeGroups', + ts('Include Group(s)'), $groups, + FALSE, array( - 'size' => 5, - 'style' => 'width:240px', - 'class' => 'advmultiselect', + 'multiple' => TRUE, + 'class' => 'crm-select2 huge', + 'placeholder' => ts('- none -'), ) ); - $inG->setButtonAttributes('add', array('value' => ts('Add >>'))); - $inG->setButtonAttributes('remove', array('value' => ts('<< Remove'))); $this->addWysiwyg('goal_general', ts('Campaign Goals'), array('rows' => 2, 'cols' => 40)); $this->add('text', 'goal_revenue', ts('Revenue Goal'), array('size' => 8, 'maxlength' => 12)); @@ -314,7 +298,11 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form { * This function is used to add the rules (mainly global rules) for form. * All local rules are added near the element * - * @return void + * @param $fields + * @param $files + * @param $errors + * + * @return bool|array * @access public * @see valid_date */