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


PHP CRM_Campaign_BAO_Campaign::getAllCampaign方法代码示例

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


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

示例1: browse

 function browse()
 {
     require_once 'CRM/Core/Permission.php';
     $surveys = CRM_Campaign_BAO_Survey::getSurvey(true);
     if (!empty($surveys)) {
         require_once 'CRM/Campaign/BAO/Campaign.php';
         $surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType();
         $campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
         $activityTypes = CRM_Core_OptionGroup::values('activity_type', false, false, false, false, 'name');
         foreach ($surveys as $sid => $survey) {
             $surveys[$sid]['campaign_id'] = $campaigns[$survey['campaign_id']];
             $surveys[$sid]['activity_type_id'] = $surveyType[$survey['activity_type_id']];
             $surveys[$sid]['release_frequency'] = $survey['release_frequency_interval'] . ' ' . $survey['release_frequency_unit'];
             $action = array_sum(array_keys($this->actionLinks()));
             if ($survey['is_active']) {
                 $action -= CRM_Core_Action::ENABLE;
             } else {
                 $action -= CRM_Core_Action::DISABLE;
             }
             $surveys[$sid]['action'] = CRM_Core_Action::formLink($this->actionLinks(), $action, array('id' => $sid));
         }
     }
     $this->assign('surveys', $surveys);
     $this->assign('addSurveyUrl', CRM_Utils_System::url('civicrm/survey/add', 'reset=1&action=add'));
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:25,代码来源:Survey.php

示例2: browse

 public function browse()
 {
     $surveys = CRM_Campaign_BAO_Survey::getSurveySummary();
     if (!empty($surveys)) {
         $surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType();
         $campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
         $activityTypes = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, FALSE, 'name');
         foreach ($surveys as $sid => $survey) {
             $surveys[$sid]['campaign_id'] = $campaigns[$survey['campaign_id']];
             $surveys[$sid]['activity_type_id'] = $surveyType[$survey['activity_type_id']];
             $surveys[$sid]['release_frequency'] = $survey['release_frequency_interval'] . ' ' . $survey['release_frequency_unit'];
             $action = array_sum(array_keys($this->actionLinks()));
             if ($survey['is_active']) {
                 $action -= CRM_Core_Action::ENABLE;
             } else {
                 $action -= CRM_Core_Action::DISABLE;
             }
             $surveys[$sid]['action'] = CRM_Core_Action::formLink($this->actionLinks(), $action, array('id' => $sid), ts('more'), FALSE, 'survey.selector.row', 'Survey', $sid);
         }
     }
     $this->assign('surveys', $surveys);
     $this->assign('addSurveyUrl', CRM_Utils_System::url('civicrm/survey/add', 'reset=1&action=add'));
 }
开发者ID:kidaa30,项目名称:yes,代码行数:23,代码来源:Survey.php

示例3: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @param null
  * 
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     require_once 'CRM/Event/PseudoConstant.php';
     require_once 'CRM/Core/BAO/UFGroup.php';
     require_once 'CRM/Core/BAO/CustomField.php';
     $this->add('text', 'title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'title'), true);
     $surveyActivityTypes = CRM_Campaign_BAO_Survey::getSurveyActivityType();
     // Activity Type id
     $this->add('select', 'activity_type_id', ts('Activity Type'), array('' => ts('- select -')) + $surveyActivityTypes, true);
     // Campaign id
     require_once 'CRM/Campaign/BAO/Campaign.php';
     $campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
     $this->add('select', 'campaign_id', ts('Campaign'), array('' => ts('- select -')) + $campaigns);
     $customProfiles = CRM_Core_BAO_UFGroup::getProfiles(array('Activity'));
     // custom group id
     $this->add('select', 'profile_id', ts('Profile'), array('' => ts('- select -')) + $customProfiles);
     $optionGroups = CRM_Campaign_BAO_Survey::getResultSets();
     if (empty($optionGroups)) {
         $optionTypes = array('1' => ts('Create new response set'));
     } else {
         $optionTypes = array('1' => ts('Create a new response set'), '2' => ts('Use existing response set'));
         $this->add('select', 'option_group_id', ts('Select Response Set'), array('' => ts('- select -')) + $optionGroups, false, array('onChange' => 'loadOptionGroup( )'));
     }
     $element =& $this->addRadio('option_type', ts('Survey Responses'), $optionTypes, array('onclick' => "showOptionSelect();"), '<br/>', true);
     if (empty($optionGroups) || !CRM_Utils_Array::value('result_id', $this->_values)) {
         $this->setdefaults(array('option_type' => 1));
     } else {
         if (CRM_Utils_Array::value('result_id', $this->_values)) {
             $this->setdefaults(array('option_type' => 2, 'option_group_id' => $this->_values['result_id']));
         }
     }
     // form fields of Custom Option rows
     $defaultOption = array();
     $_showHide = new CRM_Core_ShowHideBlocks('', '');
     $optionAttributes =& CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue');
     $optionAttributes['label']['size'] = $optionAttributes['value']['size'] = 25;
     for ($i = 1; $i <= self::NUM_OPTION; $i++) {
         //the show hide blocks
         $showBlocks = 'optionField_' . $i;
         if ($i > 2) {
             $_showHide->addHide($showBlocks);
             if ($i == self::NUM_OPTION) {
                 $_showHide->addHide('additionalOption');
             }
         } else {
             $_showHide->addShow($showBlocks);
         }
         $this->add('text', 'option_label[' . $i . ']', ts('Label'), $optionAttributes['label']);
         // value
         $this->add('text', 'option_value[' . $i . ']', ts('Value'), $optionAttributes['value']);
         // weight
         $this->add('text', "option_weight[{$i}]", ts('Order'), $optionAttributes['weight']);
         $this->add('text', 'option_interval[' . $i . ']', ts('Recontact Interval'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'release_frequency'));
         $defaultOption[$i] = $this->createElement('radio', null, null, null, $i);
     }
     //default option selection
     $this->addGroup($defaultOption, 'default_option');
     $_showHide->addToTemplate();
     // script / instructions
     $this->add('textarea', 'instructions', ts('Instructions for interviewers'), array('rows' => 5, 'cols' => 40));
     // release frequency
     $this->add('text', 'release_frequency', ts('Release frequency'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'release_frequency'));
     $this->addRule('release_frequency', ts('Release Frequency interval should be a positive number.'), 'positiveInteger');
     // max reserved contacts at a time
     $this->add('text', 'default_number_of_contacts', ts('Maximum reserved at one time'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'default_number_of_contacts'));
     $this->addRule('default_number_of_contacts', ts('Maximum reserved at one time should be a positive number'), 'positiveInteger');
     // total reserved per interviewer
     $this->add('text', 'max_number_of_contacts', ts('Total reserved per interviewer'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'max_number_of_contacts'));
     $this->addRule('max_number_of_contacts', ts('Total reserved contacts should be a positive number'), 'positiveInteger');
     // is active ?
     $this->add('checkbox', 'is_active', ts('Active?'));
     // is default ?
     $this->add('checkbox', 'is_default', ts('Default?'));
     // add buttons
     if ($this->_context == 'dialog') {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'), 'js' => array('onclick' => "cj('#survey-dialog').dialog('close'); return false;"))));
     } else {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'next', 'name' => ts('Save and New'), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
     }
     // add a form rule to check default value
     $this->addFormRule(array('CRM_Campaign_Form_Survey', 'formRule'), $this);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:94,代码来源:Survey.php

示例4: buildQuickForm

 public function buildQuickForm()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     require_once 'CRM/Event/PseudoConstant.php';
     require_once 'CRM/Core/BAO/UFGroup.php';
     require_once 'CRM/Core/OptionGroup.php';
     $this->add('text', 'title', ts('Petition Title'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'title'), true);
     $attributes = CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey');
     $petitionTypeID = CRM_Core_OptionGroup::getValue('activity_type', 'petition', 'name');
     $this->addElement('hidden', 'activity_type_id', $petitionTypeID);
     //        $surveyActivityTypes = CRM_Campaign_BAO_Survey::getSurveyActivityType( );
     // Activity Type id
     //        $this->add('select', 'activity_type_id', ts('Select Activity Type'), array( '' => ts('- select -') ) + $surveyActivityTypes, true );
     // script / instructions / description of petition purpose
     $this->addWysiwyg('instructions', ts('Introduction'), $attributes['instructions']);
     // Campaign id
     require_once 'CRM/Campaign/BAO/Campaign.php';
     $campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
     $this->add('select', 'campaign_id', ts('Campaign'), array('' => ts('- select -')) + $campaigns);
     $customContactProfiles = CRM_Core_BAO_UFGroup::getProfiles(array('Individual'));
     // custom group id
     $this->add('select', 'contact_profile_id', ts('Contact Profile'), array('' => ts('- select -')) + $customContactProfiles, true);
     $customProfiles = CRM_Core_BAO_UFGroup::getProfiles(array('Activity'));
     // custom group id
     $this->add('select', 'profile_id', ts('Activity Profile'), array('' => ts('- select -')) + $customProfiles);
     // is active ?
     $this->add('checkbox', 'is_active', ts('Is Active?'));
     // is default ?
     $this->add('checkbox', 'is_default', ts('Is Default?'));
     // add buttons
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'next', 'name' => ts('Save and New'), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
     // add a form rule to check default value
     $this->addFormRule(array('CRM_Campaign_Form_Survey', 'formRule'), $this);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:37,代码来源:Petition.php

示例5: buildQuickForm

 public function buildQuickForm()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $attributes = CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Campaign');
     // add comaign title.
     $this->add('text', 'title', ts('Title'), $attributes['title'], true);
     // add description
     $this->add('textarea', 'description', ts('Description'), $attributes['description']);
     // add campaign start date
     $this->addDateTime('start_date', ts('Start Date'), true, array('formatType' => 'activityDateTime'));
     // add campaign end date
     $this->addDateTime('end_date', ts('End Date'), false, array('formatType' => 'activityDateTime'));
     // add campaign type
     $campaignType = CRM_Campaign_PseudoConstant::campaignType();
     $this->add('select', 'campaign_type_id', ts('Campaign Type'), array('' => ts('- select -')) + $campaignType, true);
     // add campaign status
     $campaignStatus = CRM_Campaign_PseudoConstant::campaignStatus();
     $this->addElement('select', 'status_id', ts('Campaign Status'), array('' => ts('- select -')) + $campaignStatus);
     // add External Identifire Element
     $this->add('text', 'external_identifier', ts('External Id'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Campaign', 'external_identifier'), false);
     // add Campaign Parent Id
     require_once 'CRM/Campaign/BAO/Campaign.php';
     $campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign($this->_campaignId);
     if ($campaigns) {
         $this->addElement('select', 'parent_id', ts('Parent Id'), array('' => ts('- select Parent -')) + $campaigns);
     }
     //get the campaign groups.
     $groups = CRM_Core_PseudoConstant::group('Campaign');
     $inG =& $this->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $inG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     // is this Campaign active
     $this->addElement('checkbox', 'is_active', ts('Is Active?'));
     if ($this->_context == 'dialog') {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'), 'js' => array('onclick' => "cj('#campaign-dialog').dialog('close'); return false;"))));
     } else {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'next', 'name' => ts('Save and New'), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:43,代码来源:Campaign.php

示例6: browseSurvey

 function browseSurvey()
 {
     $surveysData = array();
     //get the survey.
     $surveys = CRM_Campaign_BAO_Survey::getSurvey(true);
     if (!empty($surveys)) {
         $campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
         $surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType();
         foreach ($surveys as $sid => $survey) {
             $surveysData[$sid] = $survey;
             $campaignId = CRM_Utils_Array::value('campaign_id', $survey);
             $surveysData[$sid]['campaign_id'] = CRM_Utils_Array::value($campaignId, $campaigns);
             $surveysData[$sid]['activity_type'] = $surveyType[$survey['activity_type_id']];
             if (CRM_Utils_Array::value('release_frequency', $survey)) {
                 $surveysData[$sid]['release_frequency'] = $survey['release_frequency'] . ' Day(s)';
             }
             $action = array_sum(array_keys($this->surveyActionLinks($surveysData[$sid]['activity_type'])));
             if ($survey['is_active']) {
                 $action -= CRM_Core_Action::ENABLE;
             } else {
                 $action -= CRM_Core_Action::DISABLE;
             }
             $surveysData[$sid]['action'] = CRM_Core_Action::formLink($this->surveyActionLinks($surveysData[$sid]['activity_type']), $action, array('id' => $sid));
             if (CRM_Utils_Array::value('activity_type', $surveysData[$sid]) != 'Petition') {
                 $surveysData[$sid]['voterLinks'] = CRM_Campaign_BAO_Survey::buildPermissionLinks($sid);
             }
         }
     }
     $this->assign('surveys', $surveysData);
     $this->assign('addSurveyUrl', CRM_Utils_System::url('civicrm/survey/add', 'reset=1&action=add'));
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:31,代码来源:DashBoard.php


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