本文整理汇总了PHP中CRM_Core_PseudoConstant::ActivityType方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_PseudoConstant::ActivityType方法的具体用法?PHP CRM_Core_PseudoConstant::ActivityType怎么用?PHP CRM_Core_PseudoConstant::ActivityType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Core_PseudoConstant::ActivityType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setFields
/**
* The _fields var can be used by sub class to set/unset/edit the
* form fields based on their requirement
*/
public function setFields()
{
$this->_fields = array('subject' => array('type' => 'text', 'label' => ts('Subject'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'subject')), 'duration' => array('type' => 'text', 'label' => ts('Duration'), 'attributes' => array('size' => 4, 'maxlength' => 8), 'required' => FALSE), 'location' => array('type' => 'text', 'label' => ts('Location'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'location'), 'required' => FALSE), 'details' => array('type' => 'wysiwyg', 'label' => ts('Details'), 'attributes' => array('class' => 'huge'), 'required' => FALSE), 'status_id' => array('type' => 'select', 'required' => TRUE), 'priority_id' => array('type' => 'select', 'required' => TRUE), 'source_contact_id' => array('type' => 'entityRef', 'label' => ts('Added By'), 'required' => FALSE), 'target_contact_id' => array('type' => 'entityRef', 'label' => ts('With Contact'), 'attributes' => array('multiple' => TRUE, 'create' => TRUE)), 'assignee_contact_id' => array('type' => 'entityRef', 'label' => ts('Assigned to'), 'attributes' => array('multiple' => TRUE, 'create' => TRUE, 'api' => array('params' => array('is_deceased' => 0)))), 'followup_assignee_contact_id' => array('type' => 'entityRef', 'label' => ts('Assigned to'), 'attributes' => array('multiple' => TRUE, 'create' => TRUE, 'api' => array('params' => array('is_deceased' => 0)))), 'followup_activity_type_id' => array('type' => 'select', 'label' => ts('Followup Activity'), 'attributes' => array('' => '- ' . ts('select activity') . ' -') + CRM_Core_PseudoConstant::ActivityType(FALSE), 'extra' => array('class' => 'crm-select2')), 'followup_activity_subject' => array('type' => 'text', 'label' => ts('Subject'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'subject')));
if ($this->_context == 'standalone' && ($printPDF = CRM_Utils_Array::key('Print PDF Letter', $this->_fields['followup_activity_type_id']['attributes']))) {
unset($this->_fields['followup_activity_type_id']['attributes'][$printPDF]);
}
}
示例2: extractGroupTypes
static function extractGroupTypes($groupType)
{
$returnGroupTypes = array();
if (!$groupType) {
return $returnGroupTypes;
}
$groupTypeParts = explode(CRM_Core_DAO::VALUE_SEPARATOR, $groupType);
foreach (explode(',', $groupTypeParts[0]) as $type) {
$returnGroupTypes[$type] = $type;
}
if (CRM_Utils_Array::value(1, $groupTypeParts)) {
foreach (explode(',', $groupTypeParts[1]) as $typeValue) {
$groupTypeValues = $valueLabels = array();
$valueParts = explode(':', $typeValue);
$typeName = NULL;
switch ($valueParts[0]) {
case 'ContributionType':
$typeName = 'Contribution';
$valueLabels = CRM_Contribute_PseudoConstant::financialType();
break;
case 'ParticipantRole':
$typeName = 'Participant';
$valueLabels = CRM_Event_PseudoConstant::participantRole();
break;
case 'ParticipantEventName':
$typeName = 'Participant';
$valueLabels = CRM_Event_PseudoConstant::event();
break;
case 'ParticipantEventType':
$typeName = 'Participant';
$valueLabels = CRM_Event_PseudoConstant::eventType();
break;
case 'MembershipType':
$typeName = 'Membership';
$valueLabels = CRM_Member_PseudoConstant::membershipType();
break;
case 'ActivityType':
$typeName = 'Activity';
$valueLabels = CRM_Core_PseudoConstant::ActivityType(TRUE, TRUE, FALSE, 'label', TRUE);
break;
}
foreach ($valueParts as $val) {
if (CRM_Utils_Rule::integer($val)) {
$groupTypeValues[$val] = CRM_Utils_Array::value($val, $valueLabels);
}
}
if (!is_array($returnGroupTypes[$typeName])) {
$returnGroupTypes[$typeName] = array();
}
$returnGroupTypes[$typeName][$valueParts[0]] = $groupTypeValues;
}
}
return $returnGroupTypes;
}
示例3: buildQuickForm
//.........这里部分代码省略.........
break;
case 'cc':
$form->_ccContactIds[] = $contactId;
break;
case 'bcc':
$form->_bccContactIds[] = $contactId;
break;
}
$form->_allContactIds[] = $contactId;
}
}
$setDefaults = TRUE;
}
}
//get the group of contacts as per selected by user in case of Find Activities
if (!empty($form->_activityHolderIds)) {
$contact = $form->get('contacts');
$form->_allContactIds = $form->_contactIds = $contact;
}
// check if we need to setdefaults and check for valid contact emails / communication preferences
if (is_array($form->_allContactIds) && $setDefaults) {
$returnProperties = array('sort_name' => 1, 'email' => 1, 'do_not_email' => 1, 'is_deceased' => 1, 'on_hold' => 1, 'display_name' => 1, 'preferred_mail_format' => 1);
// get the details for all selected contacts ( to, cc and bcc contacts )
list($form->_contactDetails) = CRM_Utils_Token::getTokenDetails($form->_allContactIds, $returnProperties, FALSE, FALSE);
// make a copy of all contact details
$form->_allContactDetails = $form->_contactDetails;
// perform all validations
foreach ($form->_allContactIds as $key => $contactId) {
$value = $form->_contactDetails[$contactId];
if ($value['do_not_email'] || empty($value['email']) || !empty($value['is_deceased']) || $value['on_hold']) {
$suppressedEmails++;
// unset contact details for contacts that we won't be sending email. This is prevent extra computation
// during token evaluation etc.
unset($form->_contactDetails[$contactId]);
} else {
$email = $value['email'];
// build array's which are used to setdefaults
if (in_array($contactId, $form->_toContactIds)) {
$form->_toContactDetails[$contactId] = $form->_contactDetails[$contactId];
// If a particular address has been specified as the default, use that instead of contact's primary email
if (!empty($form->_toEmail) && $form->_toEmail['contact_id'] == $contactId) {
$email = $form->_toEmail['email'];
}
$toArray[] = array('text' => '"' . $value['sort_name'] . '" <' . $email . '>', 'id' => "{$contactId}::{$email}");
} elseif (in_array($contactId, $form->_ccContactIds)) {
$ccArray[] = array('text' => '"' . $value['sort_name'] . '" <' . $email . '>', 'id' => "{$contactId}::{$email}");
} elseif (in_array($contactId, $form->_bccContactIds)) {
$bccArray[] = array('text' => '"' . $value['sort_name'] . '" <' . $email . '>', 'id' => "{$contactId}::{$email}");
}
}
}
if (empty($toArray)) {
CRM_Core_Error::statusBounce(ts('Selected contact(s) do not have a valid email address, or communication preferences specify DO NOT EMAIL, or they are deceased or Primary email address is On Hold.'));
}
}
$form->assign('toContact', json_encode($toArray));
$form->assign('ccContact', json_encode($ccArray));
$form->assign('bccContact', json_encode($bccArray));
$form->assign('suppressedEmails', $suppressedEmails);
$form->assign('totalSelectedContacts', count($form->_contactIds));
$form->add('text', 'subject', ts('Subject'), 'size=50 maxlength=254', TRUE);
$form->add('select', 'fromEmailAddress', ts('From'), $form->_fromEmails, TRUE, array('class' => 'crm-select2 huge'));
CRM_Mailing_BAO_Mailing::commonCompose($form);
// add attachments
CRM_Core_BAO_File::buildAttachment($form, NULL);
if ($form->_single) {
// also fix the user context stack
if ($form->_caseId) {
$ccid = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseContact', $form->_caseId, 'contact_id', 'case_id');
$url = CRM_Utils_System::url('civicrm/contact/view/case', "&reset=1&action=view&cid={$ccid}&id={$form->_caseId}");
} elseif ($form->_context) {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
} else {
$url = CRM_Utils_System::url('civicrm/contact/view', "&show=1&action=browse&cid={$form->_contactIds[0]}&selectedChild=activity");
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
$form->addDefaultButtons(ts('Send Email'), 'upload', 'cancel');
} else {
$form->addDefaultButtons(ts('Send Email'), 'upload');
}
$fields = array('followup_assignee_contact_id' => array('type' => 'entityRef', 'label' => ts('Assigned to'), 'attributes' => array('multiple' => TRUE, 'create' => TRUE, 'api' => array('params' => array('is_deceased' => 0)))), 'followup_activity_type_id' => array('type' => 'select', 'label' => ts('Followup Activity'), 'attributes' => array('' => '- ' . ts('select activity') . ' -') + CRM_Core_PseudoConstant::ActivityType(FALSE), 'extra' => array('class' => 'crm-select2')), 'followup_activity_subject' => array('type' => 'text', 'label' => ts('Subject'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'subject')));
//add followup date
$form->addDateTime('followup_date', ts('in'), FALSE, array('formatType' => 'activityDateTime'));
foreach ($fields as $field => $values) {
if (!empty($fields[$field])) {
$attribute = CRM_Utils_Array::value('attributes', $values);
$required = !empty($values['required']);
if ($values['type'] == 'select' && empty($attribute)) {
$form->addSelect($field, array('entity' => 'activity'), $required);
} elseif ($values['type'] == 'entityRef') {
$form->addEntityRef($field, $values['label'], $attribute, $required);
} else {
$form->add($values['type'], $field, $values['label'], $attribute, $required, CRM_Utils_Array::value('extra', $values));
}
}
}
$form->addFormRule(array('CRM_Contact_Form_Task_EmailCommon', 'formRule'), $form);
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contact/Form/Task/EmailCommon.js', 0, 'html-header');
}
示例4: setFields
/**
* The _fields var can be used by sub class to set/unset/edit the
* form fields based on their requirement
*
*/
function setFields()
{
$this->_fields = array('subject' => array('type' => 'text', 'label' => ts('Subject'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'subject')), 'duration' => array('type' => 'text', 'label' => ts('Duration'), 'attributes' => array('size' => 4, 'maxlength' => 8), 'required' => false), 'location' => array('type' => 'text', 'label' => ts('Location'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'location'), 'required' => false), 'details' => array('type' => 'textarea', 'label' => ts('Details'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'details'), 'required' => false), 'status_id' => array('type' => 'select', 'label' => ts('Status'), 'attributes' => CRM_Core_PseudoConstant::activityStatus(), 'required' => true), 'priority_id' => array('type' => 'select', 'label' => 'Priority', 'attributes' => CRM_Core_PseudoConstant::priority(), 'required' => true), 'source_contact_id' => array('type' => 'text', 'label' => ts('Added By'), 'required' => false), 'followup_activity_type_id' => array('type' => 'select', 'label' => ts('Followup Activity'), 'attributes' => array('' => '- ' . ts('select activity') . ' -') + CRM_Core_PseudoConstant::ActivityType(false)), 'interval' => array('type' => 'text', 'label' => 'in', 'attributes' => array('size' => 4, 'maxlength' => 8)), 'interval_unit' => array('type' => 'select', 'label' => null, 'attributes' => CRM_Core_OptionGroup::values('recur_frequency_units', false, false, false, null, 'name')), 'followup_activity_subject' => array('type' => 'text', 'label' => ts('Subject'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'subject')));
// append (s) for interval_unit attribute list
foreach ($this->_fields['interval_unit']['attributes'] as $name => $label) {
$this->_fields['interval_unit']['attributes'][$name] = $label . '(s)';
}
asort($this->_fields['followup_activity_type_id']['attributes']);
}
示例5: setFields
/**
* The _fields var can be used by sub class to set/unset/edit the
* form fields based on their requirement
*
*/
function setFields()
{
$this->_fields = array('subject' => array('type' => 'text', 'label' => ts('Subject'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'subject')), 'duration' => array('type' => 'text', 'label' => ts('Duration'), 'attributes' => array('size' => 4, 'maxlength' => 8), 'required' => FALSE), 'location' => array('type' => 'text', 'label' => ts('Location'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'location'), 'required' => FALSE), 'details' => array('type' => 'wysiwyg', 'label' => ts('Details'), 'attributes' => array('rows' => 4, 'cols' => 60), 'required' => FALSE), 'status_id' => array('type' => 'select', 'required' => TRUE), 'priority_id' => array('type' => 'select', 'required' => TRUE), 'source_contact_id' => array('type' => 'text', 'label' => ts('Added By'), 'required' => FALSE), 'followup_activity_type_id' => array('type' => 'select', 'label' => ts('Followup Activity'), 'attributes' => array('' => '- ' . ts('select activity') . ' -') + CRM_Core_PseudoConstant::ActivityType(FALSE)), 'followup_activity_subject' => array('type' => 'text', 'label' => ts('Subject'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'subject')));
if ($this->_context == 'standalone' && ($printPDF = CRM_Utils_Array::key('Print PDF Letter', $this->_fields['followup_activity_type_id']['attributes']))) {
unset($this->_fields['followup_activity_type_id']['attributes'][$printPDF]);
}
}
示例6: setFields
/**
* The _fields var can be used by sub class to set/unset/edit the
* form fields based on their requirement
*/
public function setFields()
{
// Remove print document activity type
$unwanted = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, "AND v.name = 'Print PDF Letter'");
$activityTypes = array_diff_key(CRM_Core_PseudoConstant::ActivityType(FALSE), $unwanted);
$this->_fields = array('subject' => array('type' => 'text', 'label' => ts('Subject'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'subject')), 'duration' => array('type' => 'text', 'label' => ts('Duration'), 'attributes' => array('size' => 4, 'maxlength' => 8), 'required' => FALSE), 'location' => array('type' => 'text', 'label' => ts('Location'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'location'), 'required' => FALSE), 'details' => array('type' => 'wysiwyg', 'label' => ts('Details'), 'attributes' => array('class' => 'huge'), 'required' => FALSE), 'status_id' => array('type' => 'select', 'required' => TRUE), 'priority_id' => array('type' => 'select', 'required' => TRUE), 'source_contact_id' => array('type' => 'entityRef', 'label' => ts('Added By'), 'required' => FALSE), 'target_contact_id' => array('type' => 'entityRef', 'label' => ts('With Contact'), 'attributes' => array('multiple' => TRUE, 'create' => TRUE)), 'assignee_contact_id' => array('type' => 'entityRef', 'label' => ts('Assigned to'), 'attributes' => array('multiple' => TRUE, 'create' => TRUE, 'api' => array('params' => array('is_deceased' => 0)))), 'followup_assignee_contact_id' => array('type' => 'entityRef', 'label' => ts('Assigned to'), 'attributes' => array('multiple' => TRUE, 'create' => TRUE, 'api' => array('params' => array('is_deceased' => 0)))), 'followup_activity_type_id' => array('type' => 'select', 'label' => ts('Followup Activity'), 'attributes' => array('' => '- ' . ts('select activity') . ' -') + $activityTypes, 'extra' => array('class' => 'crm-select2')), 'followup_activity_subject' => array('type' => 'text', 'label' => ts('Subject'), 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'subject')));
}