本文整理汇总了PHP中CRM_Campaign_BAO_Survey::isSurveyActivity方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Campaign_BAO_Survey::isSurveyActivity方法的具体用法?PHP CRM_Campaign_BAO_Survey::isSurveyActivity怎么用?PHP CRM_Campaign_BAO_Survey::isSurveyActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Campaign_BAO_Survey
的用法示例。
在下文中一共展示了CRM_Campaign_BAO_Survey::isSurveyActivity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
public function buildQuickForm()
{
if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::RENEW)) {
//enable form element (ActivityLinks sets this true)
$this->assign('suppressForm', false);
$button = ts('Delete');
if ($this->_action & CRM_Core_Action::RENEW) {
$button = ts('Restore');
}
$this->addButtons(array(array('type' => 'next', 'name' => $button, 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
if (!$this->_single && !empty($this->_contactIds)) {
$withArray = array();
require_once 'CRM/Contact/BAO/Contact.php';
foreach ($this->_contactIds as $contactId) {
$withDisplayName = self::_getDisplayNameById($contactId);
$withArray[] = "\"{$withDisplayName}\" ";
}
$this->assign('with', implode(', ', $withArray));
}
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::buildQuickForm($this);
}
//build other activity links
require_once 'CRM/Activity/Form/ActivityLinks.php';
CRM_Activity_Form_ActivityLinks::buildQuickForm();
//enable form element (ActivityLinks sets this true)
$this->assign('suppressForm', false);
$element =& $this->add('select', 'activity_type_id', ts('Activity Type'), $this->_fields['followup_activity_type_id']['attributes'], false, array('onchange' => "buildCustomData( 'Activity', this.value );"));
//freeze for update mode.
if ($this->_action & CRM_Core_Action::UPDATE) {
$element->freeze();
}
foreach ($this->_fields as $field => $values) {
if (CRM_Utils_Array::value($field, $this->_fields)) {
$attribute = null;
if (CRM_Utils_Array::value('attributes', $values)) {
$attribute = $values['attributes'];
}
$required = false;
if (CRM_Utils_Array::value('required', $values)) {
$required = true;
}
if ($values['type'] == 'wysiwyg') {
$this->addWysiwyg($field, $values['label'], $attribute, $required);
} else {
$this->add($values['type'], $field, $values['label'], $attribute, $required);
}
}
}
$this->addRule('duration', ts('Please enter the duration as number of minutes (integers only).'), 'positiveInteger');
$this->addRule('interval', ts('Please enter the follow-up interval as a number (integers only).'), 'positiveInteger');
$this->addDateTime('activity_date_time', ts('Date'), true, array('formatType' => 'activityDateTime'));
//autocomplete url
$dataUrl = CRM_Utils_System::url("civicrm/ajax/rest", "className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=activity&reset=1", false, null, false);
$this->assign('dataUrl', $dataUrl);
//tokeninput url
$tokenUrl = CRM_Utils_System::url("civicrm/ajax/checkemail", "noemail=1", false, null, false);
$this->assign('tokenUrl', $tokenUrl);
$admin = CRM_Core_Permission::check('administer CiviCRM');
//allow to edit sourcecontactfield field if context is civicase.
if ($this->_context == 'caseActivity') {
$admin = true;
}
$this->assign('admin', $admin);
$sourceContactField =& $this->add($this->_fields['source_contact_id']['type'], 'source_contact_id', $this->_fields['source_contact_id']['label'], null, $admin);
$hiddenSourceContactField =& $this->add('hidden', 'source_contact_qid', '', array('id' => 'source_contact_qid'));
$targetContactField =& $this->add('text', 'target_contact_id', ts('target'));
$assigneeContactField =& $this->add('text', 'assignee_contact_id', ts('assignee'));
if ($sourceContactField->getValue()) {
$this->assign('source_contact', $sourceContactField->getValue());
} else {
if ($this->_currentUserId) {
// we're setting currently LOGGED IN user as source for this activity
$this->assign('source_contact_value', self::_getDisplayNameById($this->_currentUserId));
}
}
//need to assign custom data type and subtype to the template
$this->assign('customDataType', 'Activity');
$this->assign('customDataSubType', $this->_activityTypeId);
$this->assign('entityID', $this->_activityId);
if ($this->_targetContactId) {
$defaultTargetContactName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_targetContactId, 'sort_name');
$this->assign('target_contact_value', $defaultTargetContactName);
}
require_once 'CRM/Core/BAO/Tag.php';
$tags = CRM_Core_BAO_Tag::getTags('civicrm_activity');
if (!empty($tags)) {
$this->add('select', 'tag', ts('Tags'), $tags, false, array('id' => 'tags', 'multiple' => 'multiple', 'title' => ts('- select -')));
}
// build tag widget
require_once 'CRM/Core/Form/Tag.php';
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_activity');
CRM_Core_Form_Tag::buildQuickForm($this, $parentNames, 'civicrm_activity', $this->_activityId, false, true);
// check for survey activity
$this->_isSurveyActivity = false;
if ($this->_activityId) {
require_once 'CRM/Campaign/BAO/Survey.php';
$this->_isSurveyActivity = CRM_Campaign_BAO_Survey::isSurveyActivity($this->_activityId);
//.........这里部分代码省略.........
示例2: buildQuickForm
public function buildQuickForm()
{
if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::RENEW)) {
//enable form element (ActivityLinks sets this true)
$this->assign('suppressForm', FALSE);
$button = ts('Delete');
if ($this->_action & CRM_Core_Action::RENEW) {
$button = ts('Restore');
}
$this->addButtons(array(array('type' => 'next', 'name' => $button, 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
// Build other activity links.
CRM_Activity_Form_ActivityLinks::commonBuildQuickForm($this);
// Enable form element (ActivityLinks sets this true).
$this->assign('suppressForm', FALSE);
$element =& $this->add('select', 'activity_type_id', ts('Activity Type'), array('' => '- ' . ts('select') . ' -') + $this->_fields['followup_activity_type_id']['attributes'], FALSE, array('onchange' => "CRM.buildCustomData( 'Activity', this.value );", 'class' => 'crm-select2 required'));
// Freeze for update mode.
if ($this->_action & CRM_Core_Action::UPDATE) {
$element->freeze();
}
// Call to RecurringEntity buildQuickForm for add/update mode.
if ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD)) {
CRM_Core_Form_RecurringEntity::buildQuickForm($this);
}
foreach ($this->_fields as $field => $values) {
if (!empty($this->_fields[$field])) {
$attribute = CRM_Utils_Array::value('attributes', $values);
$required = !empty($values['required']);
if ($values['type'] == 'select' && empty($attribute)) {
$this->addSelect($field, array('entity' => 'activity'), $required);
} elseif ($values['type'] == 'entityRef') {
$this->addEntityRef($field, $values['label'], $attribute, $required);
} else {
$this->add($values['type'], $field, $values['label'], $attribute, $required, CRM_Utils_Array::value('extra', $values));
}
}
}
// CRM-7362 --add campaigns.
CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values));
// Add engagement level CRM-7775
$buildEngagementLevel = FALSE;
if (CRM_Campaign_BAO_Campaign::isCampaignEnable() && CRM_Campaign_BAO_Campaign::accessCampaign()) {
$buildEngagementLevel = TRUE;
$this->addSelect('engagement_level', array('entity' => 'activity'));
$this->addRule('engagement_level', ts('Please enter the engagement index as a number (integers only).'), 'positiveInteger');
}
$this->assign('buildEngagementLevel', $buildEngagementLevel);
// check for survey activity
$this->_isSurveyActivity = FALSE;
if ($this->_activityId && CRM_Campaign_BAO_Campaign::isCampaignEnable() && CRM_Campaign_BAO_Campaign::accessCampaign()) {
$this->_isSurveyActivity = CRM_Campaign_BAO_Survey::isSurveyActivity($this->_activityId);
if ($this->_isSurveyActivity) {
$surveyId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $this->_activityId, 'source_record_id');
$responseOptions = CRM_Campaign_BAO_Survey::getResponsesOptions($surveyId);
if ($responseOptions) {
$this->add('select', 'result', ts('Result'), array('' => ts('- select -')) + array_combine($responseOptions, $responseOptions));
}
$surveyTitle = NULL;
if ($surveyId) {
$surveyTitle = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $surveyId, 'title');
}
$this->assign('surveyTitle', $surveyTitle);
}
}
$this->assign('surveyActivity', $this->_isSurveyActivity);
// this option should be available only during add mode
if ($this->_action != CRM_Core_Action::UPDATE) {
$this->add('advcheckbox', 'is_multi_activity', ts('Create a separate activity for each contact.'));
}
$this->addRule('duration', ts('Please enter the duration as number of minutes (integers only).'), 'positiveInteger');
$this->addDateTime('activity_date_time', ts('Date'), TRUE, array('formatType' => 'activityDateTime'));
// Add followup date.
$this->addDateTime('followup_date', ts('in'), FALSE, array('formatType' => 'activityDateTime'));
// Only admins and case-workers can change the activity source
if (!CRM_Core_Permission::check('administer CiviCRM') && $this->_context != 'caseActivity') {
$this->getElement('source_contact_id')->freeze();
}
//need to assign custom data type and subtype to the template
$this->assign('customDataType', 'Activity');
$this->assign('customDataSubType', $this->_activityTypeId);
$this->assign('entityID', $this->_activityId);
CRM_Core_BAO_Tag::getTags('civicrm_activity', $tags, NULL, ' ', TRUE);
if (!empty($tags)) {
$this->add('select', 'tag', ts('Tags'), $tags, FALSE, array('id' => 'tags', 'multiple' => 'multiple', 'class' => 'crm-select2 huge'));
}
// we need to hide activity tagset for special activities
$specialActivities = array('Open Case');
if (!in_array($this->_activityTypeName, $specialActivities)) {
// build tag widget
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_activity');
CRM_Core_Form_Tag::buildQuickForm($this, $parentNames, 'civicrm_activity', $this->_activityId);
}
// if we're viewing, we're assigning different buttons than for adding/editing
if ($this->_action & CRM_Core_Action::VIEW) {
if (isset($this->_groupTree)) {
CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $this->_groupTree);
}
// form should be frozen for view mode
$this->freeze();
//.........这里部分代码省略.........
示例3: buildQuickForm
public function buildQuickForm()
{
if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::RENEW)) {
//enable form element (ActivityLinks sets this true)
$this->assign('suppressForm', FALSE);
$button = ts('Delete');
if ($this->_action & CRM_Core_Action::RENEW) {
$button = ts('Restore');
}
$this->addButtons(array(array('type' => 'next', 'name' => $button, 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
if (!$this->_single && !empty($this->_contactIds)) {
$withArray = array();
foreach ($this->_contactIds as $contactId) {
$withDisplayName = self::_getDisplayNameById($contactId);
$withArray[] = "\"{$withDisplayName}\" ";
}
$this->assign('with', implode(', ', $withArray));
}
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::buildQuickForm($this);
}
//build other activity links
CRM_Activity_Form_ActivityLinks::commonBuildQuickForm($this);
//enable form element (ActivityLinks sets this true)
$this->assign('suppressForm', FALSE);
$element =& $this->add('select', 'activity_type_id', ts('Activity Type'), $this->_fields['followup_activity_type_id']['attributes'], FALSE, array('onchange' => "CRM.buildCustomData( 'Activity', this.value );"));
//freeze for update mode.
if ($this->_action & CRM_Core_Action::UPDATE) {
$element->freeze();
}
foreach ($this->_fields as $field => $values) {
if (CRM_Utils_Array::value($field, $this->_fields)) {
$attribute = NULL;
if (CRM_Utils_Array::value('attributes', $values)) {
$attribute = $values['attributes'];
}
$required = FALSE;
if (CRM_Utils_Array::value('required', $values)) {
$required = TRUE;
}
if ($values['type'] == 'wysiwyg') {
$this->addWysiwyg($field, $values['label'], $attribute, $required);
} else {
$this->add($values['type'], $field, $values['label'], $attribute, $required);
}
}
}
//CRM-7362 --add campaigns.
CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values));
//add engagement level CRM-7775
$buildEngagementLevel = FALSE;
if (CRM_Campaign_BAO_Campaign::isCampaignEnable() && CRM_Campaign_BAO_Campaign::accessCampaign()) {
$buildEngagementLevel = TRUE;
$this->add('select', 'engagement_level', ts('Engagement Index'), array('' => ts('- select -')) + CRM_Campaign_PseudoConstant::engagementLevel());
$this->addRule('engagement_level', ts('Please enter the engagement index as a number (integers only).'), 'positiveInteger');
}
$this->assign('buildEngagementLevel', $buildEngagementLevel);
// check for survey activity
$this->_isSurveyActivity = FALSE;
if ($this->_activityId && CRM_Campaign_BAO_Campaign::isCampaignEnable() && CRM_Campaign_BAO_Campaign::accessCampaign()) {
$this->_isSurveyActivity = CRM_Campaign_BAO_Survey::isSurveyActivity($this->_activityId);
if ($this->_isSurveyActivity) {
$surveyId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $this->_activityId, 'source_record_id');
$responseOptions = CRM_Campaign_BAO_Survey::getResponsesOptions($surveyId);
if ($responseOptions) {
$this->add('select', 'result', ts('Result'), array('' => ts('- select -')) + array_combine($responseOptions, $responseOptions));
}
$surveyTitle = NULL;
if ($surveyId) {
$surveyTitle = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $surveyId, 'title');
}
$this->assign('surveyTitle', $surveyTitle);
}
}
$this->assign('surveyActivity', $this->_isSurveyActivity);
// this option should be available only during add mode
if ($this->_action != CRM_Core_Action::UPDATE) {
$this->add('advcheckbox', 'is_multi_activity', ts('Create a separate activity for each contact.'));
}
$this->addRule('duration', ts('Please enter the duration as number of minutes (integers only).'), 'positiveInteger');
$this->addDateTime('activity_date_time', ts('Date'), TRUE, array('formatType' => 'activityDateTime'));
//add followup date
$this->addDateTime('followup_date', ts('in'), FALSE, array('formatType' => 'activityDateTime'));
//autocomplete url
$dataUrl = CRM_Utils_System::url("civicrm/ajax/rest", "className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=activity&reset=1", FALSE, NULL, FALSE);
$this->assign('dataUrl', $dataUrl);
//tokeninput url
$tokenUrl = CRM_Utils_System::url("civicrm/ajax/checkemail", "noemail=1", FALSE, NULL, FALSE);
$this->assign('tokenUrl', $tokenUrl);
$admin = CRM_Core_Permission::check('administer CiviCRM');
//allow to edit source contact field field if context is civicase.
if ($this->_context == 'caseActivity') {
$admin = TRUE;
}
$this->assign('admin', $admin);
$sourceContactField =& $this->add($this->_fields['source_contact_id']['type'], 'source_contact_id', $this->_fields['source_contact_id']['label'], NULL, $admin);
$this->add('hidden', 'source_contact_qid', '', array('id' => 'source_contact_qid'));
CRM_Contact_Form_NewContact::buildQuickForm($this);
//.........这里部分代码省略.........