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


PHP CRM_Campaign_BAO_Survey::getResultSets方法代码示例

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


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

示例1: __construct

 /**
  */
 public function __construct()
 {
     //filter options for survey activity status.
     $responseStatus = array('' => '- Any -');
     self::$_surveyRespondentStatus = array();
     $activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
     if ($statusId = array_search('Scheduled', $activityStatus)) {
         $responseStatus[$statusId] = ts('Reserved');
         self::$_surveyRespondentStatus[$statusId] = 'Reserved';
     }
     if ($statusId = array_search('Completed', $activityStatus)) {
         $responseStatus[$statusId] = ts('Interviewed');
         self::$_surveyRespondentStatus[$statusId] = 'Interviewed';
     }
     $optionGroups = CRM_Campaign_BAO_Survey::getResultSets('name');
     $resultOptions = array();
     foreach ($optionGroups as $gid => $name) {
         if ($name) {
             $value = array();
             $value = CRM_Core_OptionGroup::values($name);
             if (!empty($value)) {
                 $value = array_combine($value, $value);
             }
             $resultOptions = $resultOptions + $value;
         }
     }
     asort($resultOptions);
     //get all interviewers.
     $allSurveyInterviewers = CRM_Campaign_BAO_Survey::getInterviewers();
     $this->_columns = array('civicrm_activity_contact' => array('dao' => 'CRM_Activity_DAO_ActivityContact', 'fields' => array('contact_id' => array('title' => ts('Interviewer Name'))), 'filters' => array('contact_id' => array('name' => 'contact_id', 'title' => ts('Interviewer Name'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('' => ts('- any interviewer -')) + $allSurveyInterviewers)), 'grouping' => 'survey-interviewer-fields'), 'civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('id' => array('title' => ts('Contact ID'), 'no_display' => TRUE, 'required' => TRUE), 'sort_name' => array('title' => ts('Respondent Name'), 'required' => TRUE, 'no_repeat' => TRUE)), 'filters' => array('sort_name' => array('title' => ts('Respondent Name'), 'operator' => 'like')), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Respondent Name'), 'required' => TRUE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('name' => 'phone', 'title' => ts('Phone'))), 'grouping' => 'location-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_number' => array('name' => 'street_number', 'title' => ts('Street Number'), 'type' => 1), 'street_name' => array('name' => 'street_name', 'title' => ts('Street Name'), 'type' => 1), 'street_unit' => array('name' => 'street_unit', 'title' => ts('Street Unit'), 'type' => 1), 'postal_code' => array('name' => 'postal_code', 'title' => ts('Postal Code'), 'type' => 1), 'city' => array('name' => 'city', 'title' => ts('City'), 'type' => 1), 'state_province_id' => array('name' => 'state_province_id', 'title' => ts('State/Province')), 'country_id' => array('name' => 'country_id', 'title' => ts('Country'))), 'filters' => array('street_number' => array('title' => ts('Street Number'), 'type' => 1, 'name' => 'street_number'), 'street_name' => array('title' => ts('Street Name'), 'name' => 'street_name', 'operator' => 'like'), 'postal_code' => array('title' => ts('Postal Code'), 'type' => 1, 'name' => 'postal_code'), 'city' => array('title' => ts('City'), 'operator' => 'like', 'name' => 'city'), 'state_province_id' => array('name' => 'state_province_id', 'title' => ts('State/Province'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::stateProvince()), 'country_id' => array('name' => 'country_id', 'title' => ts('Country'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::country())), 'order_bys' => array('street_name' => array('title' => ts('Street Name')), 'street_number_odd_even' => array('title' => ts('Odd / Even Street Number'), 'name' => 'street_number', 'dbAlias' => 'address_civireport.street_number%2'), 'street_number' => array('title' => 'Street Number')), 'grouping' => 'location-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('name' => 'email', 'title' => ts('Email'))), 'grouping' => 'location-fields'), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'alias' => 'survey_activity', 'fields' => array('survey_id' => array('name' => 'source_record_id', 'title' => ts('Survey'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Campaign_BAO_Survey::getSurveys()), 'survey_response' => array('name' => 'survey_response', 'title' => ts('Survey Responses')), 'details' => array('name' => 'details', 'title' => ts('Note'), 'type' => 1), 'result' => array('name' => 'result', 'required' => TRUE, 'title' => ts('Survey Result'))), 'filters' => array('survey_id' => array('name' => 'source_record_id', 'title' => ts('Survey'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Campaign_BAO_Survey::getSurveys()), 'status_id' => array('name' => 'status_id', 'title' => ts('Respondent Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $responseStatus), 'result' => array('title' => ts('Survey Result'), 'type' => CRM_Utils_Type::T_STRING, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $resultOptions)), 'grouping' => 'survey-activity-fields'));
     parent::__construct();
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:34,代码来源:SurveyDetails.php

示例2: buildSearchForm

 /**
  * Add all the elements shared between case activity search and advanced search.
  *
  *
  * @param CRM_Core_Form $form
  * @return void
  */
 public static function buildSearchForm(&$form)
 {
     $activityOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
     $form->addSelect('activity_type_id', array('entity' => 'activity', 'label' => 'Activity Type(s)', 'multiple' => 'multiple', 'option_url' => NULL, 'placeholder' => ts('- any -')));
     CRM_Core_Form_Date::buildDateRange($form, 'activity_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
     $followUpActivity = array(1 => ts('Yes'), 2 => ts('No'));
     $form->addRadio('parent_id', NULL, $followUpActivity, array('allowClear' => TRUE));
     $form->addRadio('followup_parent_id', NULL, $followUpActivity, array('allowClear' => TRUE));
     $activityRoles = array(3 => ts('With'), 2 => ts('Assigned to'), 1 => ts('Added by'));
     $form->addRadio('activity_role', NULL, $activityRoles, array('allowClear' => TRUE));
     $form->setDefaults(array('activity_role' => 3));
     $activityStatus = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'status_id', array('flip' => 1, 'labelColumn' => 'name'));
     $form->addSelect('status_id', array('entity' => 'activity', 'multiple' => 'multiple', 'option_url' => NULL, 'placeholder' => ts('- any -')));
     $form->setDefaults(array('status_id' => array($activityStatus['Completed'], $activityStatus['Scheduled'])));
     $form->addElement('text', 'activity_subject', ts('Subject'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
     $form->addYesNo('activity_test', ts('Activity is a Test?'));
     $activity_tags = CRM_Core_BAO_Tag::getTags('civicrm_activity');
     if ($activity_tags) {
         foreach ($activity_tags as $tagID => $tagName) {
             $form->_tagElement =& $form->addElement('checkbox', "activity_tags[{$tagID}]", NULL, $tagName);
         }
     }
     $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_activity');
     CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_activity', NULL, TRUE, TRUE);
     $surveys = CRM_Campaign_BAO_Survey::getSurveys(TRUE, FALSE, FALSE, TRUE);
     if ($surveys) {
         $form->add('select', 'activity_survey_id', ts('Survey / Petition'), array('' => ts('- none -')) + $surveys, FALSE, array('class' => 'crm-select2'));
     }
     $extends = array('Activity');
     $groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
     if ($groupDetails) {
         $form->assign('activityGroupTree', $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, 'activity_campaign_id');
     //add engagement level CRM-7775
     $buildEngagementLevel = FALSE;
     $buildSurveyResult = FALSE;
     if (CRM_Campaign_BAO_Campaign::isCampaignEnable() && CRM_Campaign_BAO_Campaign::accessCampaign()) {
         $buildEngagementLevel = TRUE;
         $form->addSelect('activity_engagement_level', array('entity' => 'activity', 'context' => 'search'));
         // Add survey result field.
         $optionGroups = CRM_Campaign_BAO_Survey::getResultSets('name');
         $resultOptions = array();
         foreach ($optionGroups as $gid => $name) {
             if ($name) {
                 $value = array();
                 $value = CRM_Core_OptionGroup::values($name);
                 if (!empty($value)) {
                     while (list($k, $v) = each($value)) {
                         $resultOptions[$v] = $v;
                     }
                 }
             }
         }
         // If no survey result options have been created, don't build
         // the field to avoid clutter.
         if (count($resultOptions) > 0) {
             $buildSurveyResult = TRUE;
             asort($resultOptions);
             $form->add('select', 'activity_result', ts("Survey Result"), $resultOptions, FALSE, array('id' => 'activity_result', 'multiple' => 'multiple', 'class' => 'crm-select2'));
         }
     }
     $form->assign('buildEngagementLevel', $buildEngagementLevel);
     $form->assign('buildSurveyResult', $buildSurveyResult);
     $form->setDefaults(array('activity_test' => 0));
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:80,代码来源:Query.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

 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     $optionGroups = CRM_Campaign_BAO_Survey::getResultSets();
     if (empty($optionGroups)) {
         $optionTypes = array('1' => ts('Create new result set'));
     } else {
         $optionTypes = array('1' => ts('Create new result set'), '2' => ts('Use existing result set'));
         $this->add('select', 'option_group_id', ts('Select Result 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) || empty($this->_values['result_id'])) {
         $this->setdefaults(array('option_type' => 1));
     } elseif (!empty($this->_values['result_id'])) {
         $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();
     $this->addElement('checkbox', 'create_report', ts('Create Report'));
     $this->addElement('text', 'report_title', ts('Report Title'));
     if ($this->_reportId) {
         $this->freeze('create_report');
         $this->freeze('report_title');
     }
     $this->addFormRule(array('CRM_Campaign_Form_Survey_Results', 'formRule'), $this);
     parent::buildQuickForm();
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:54,代码来源:Results.php


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