本文整理汇总了PHP中CRM_Core_Form_Tag类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Form_Tag类的具体用法?PHP CRM_Core_Form_Tag怎么用?PHP CRM_Core_Form_Tag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_Form_Tag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Build the form
*
* @access public
*
* @return void
*/
function buildQuickForm()
{
// add select for tag
$this->_tags = CRM_Core_BAO_Tag::getTags('civicrm_activity');
foreach ($this->_tags as $tagID => $tagName) {
$this->_tagElement =& $this->addElement('checkbox', "tag[{$tagID}]", NULL, $tagName);
}
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_activity');
CRM_Core_Form_Tag::buildQuickForm($this, $parentNames, 'civicrm_activity', NULL, TRUE, FALSE, TRUE);
$this->addDefaultButtons(ts('Remove Tags from activities'));
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:18,代码来源:RemoveFromTag.php
示例2: buildQuickForm
/**
* Build the form
*
* @access public
*
* @return void
*/
function buildQuickForm()
{
// add select for tag
$this->_tags = CRM_Core_BAO_Tag::getTags();
foreach ($this->_tags as $tagID => $tagName) {
$this->_tagElement =& $this->addElement('checkbox', "tag[{$tagID}]", NULL, $tagName);
}
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_contact');
CRM_Core_Form_Tag::buildQuickForm($this, $parentNames, 'civicrm_contact');
$this->addDefaultButtons(ts('Tag Contacts'));
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:18,代码来源:AddToTag.php
示例3: buildQuickForm
/**
* Build the form
*
* @access public
* @return void
*/
function buildQuickForm()
{
// add select for tag
$this->_tags = CRM_Core_BAO_Tag::getTags();
foreach ($this->_tags as $tagID => $tagName) {
$this->_tagElement =& $this->addElement('checkbox', "tag[{$tagID}]", null, $tagName);
}
require_once 'CRM/Core/Form/Tag.php';
require_once 'CRM/Core/BAO/Tag.php';
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_contact');
CRM_Core_Form_Tag::buildQuickForm($this, $parentNames, 'civicrm_contact', null, true);
$this->addDefaultButtons(ts('Remove Tag Contacts'));
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:19,代码来源:RemoveFromTag.php
示例4: processCaseTags
function processCaseTags()
{
$caseId = CRM_Utils_Type::escape($_POST['case_id'], 'Integer');
$tags = CRM_Utils_Type::escape($_POST['tag'], 'String');
$tagList = $_POST['taglist'];
if (empty($caseId)) {
echo 'false';
CRM_Utils_System::civiExit();
}
$tagIds = array();
if ($tags) {
$tagIds = explode(',', $tags);
}
if (!empty($tagIds)) {
$params = array('entity_id' => $caseId, 'entity_table' => 'civicrm_case');
CRM_Core_BAO_EntityTag::del($params);
foreach ($tagIds as $tagid) {
if (is_numeric($tagid)) {
$params['tag_id'] = $tagid;
CRM_Core_BAO_EntityTag::add($params);
}
}
}
if (!empty($tagList)) {
CRM_Core_Form_Tag::postProcess($tagList, $caseId, 'civicrm_case', CRM_Core_DAO::$_nullObject);
}
$session = CRM_Core_Session::singleton();
$activityParams = array();
$activityParams['source_contact_id'] = $session->get('userID');
$activityParams['activity_type_id'] = CRM_Core_OptionGroup::getValue('activity_type', 'Change Case Tags', 'name');
$activityParams['activity_date_time'] = date('YmdHis');
$activityParams['status_id'] = CRM_Core_OptionGroup::getValue('activity_status', 'Completed', 'name');
$activityParams['case_id'] = $caseId;
$activityParams['is_auto'] = 0;
$activityParams['subject'] = 'Change Case Tags';
$activity = CRM_Activity_BAO_Activity::create($activityParams);
$caseParams = array('activity_id' => $activity->id, 'case_id' => $caseId);
CRM_Case_BAO_Case::processCaseActivity($caseParams);
echo 'true';
CRM_Utils_System::civiExit();
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:41,代码来源:AJAX.php
示例5: basic
/**
* @param CRM_Core_Form $form
*/
public static function basic(&$form)
{
$form->addElement('hidden', 'hidden_basic', 1);
if ($form->_searchOptions['contactType']) {
// add checkboxes for contact type
//@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
// this is loaded onto then replace with something like '__' & test
$separator = CRM_Core_DAO::VALUE_SEPARATOR;
$contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, $separator);
if ($contactTypes) {
$form->add('select', 'contact_type', ts('Contact Type(s)'), $contactTypes, FALSE, array('id' => 'contact_type', 'multiple' => 'multiple', 'class' => 'crm-select2', 'style' => 'width: 100%;'));
}
}
if ($form->_searchOptions['groups']) {
// multiselect for groups
if ($form->_group) {
// Arrange groups into hierarchical listing (child groups follow their parents and have indentation spacing in title)
$groupHierarchy = CRM_Contact_BAO_Group::getGroupsHierarchy($form->_group, NULL, ' ', TRUE);
$form->add('select', 'group', ts('Groups'), $groupHierarchy, FALSE, array('id' => 'group', 'multiple' => 'multiple', 'class' => 'crm-select2'));
$groupOptions = CRM_Core_BAO_OptionValue::getOptionValuesAssocArrayFromName('group_type');
$form->add('select', 'group_type', ts('Group Types'), $groupOptions, FALSE, array('id' => 'group_type', 'multiple' => 'multiple', 'class' => 'crm-select2'));
$form->add('hidden', 'group_search_selected', 'group');
}
}
if ($form->_searchOptions['tags']) {
// multiselect for categories
$contactTags = CRM_Core_BAO_Tag::getTags();
if ($contactTags) {
$form->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE, array('id' => 'contact_tags', 'multiple' => 'multiple', 'class' => 'crm-select2', 'style' => 'width: 100%;'));
}
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_contact');
CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_contact', NULL, TRUE, FALSE);
$used_for = CRM_Core_OptionGroup::values('tag_used_for');
$tagsTypes = array();
$showAllTagTypes = FALSE;
foreach ($used_for as $key => $value) {
//check tags for every type and find if there are any defined
$tags = CRM_Core_BAO_Tag::getTagsUsedFor($key, FALSE, TRUE, NULL);
// check if there are tags other than contact type, if no - keep checkbox hidden on adv search
// we will hide searching contact by attachments tags until it will be implemented in core
if (count($tags) && $key != 'civicrm_file' && $key != 'civicrm_contact') {
//if tags exists then add type to display in adv search form help text
$tagsTypes[] = ts($value);
$showAllTagTypes = TRUE;
}
}
$tagTypesText = implode(" or ", $tagsTypes);
if ($showAllTagTypes) {
$form->add('checkbox', 'all_tag_types', ts('Include tags used for %1', array(1 => $tagTypesText)));
$form->add('hidden', 'tag_types_text', $tagTypesText);
}
}
// add text box for last name, first name, street name, city
$form->addElement('text', 'sort_name', ts('Find...'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
// add text box for last name, first name, street name, city
$form->add('text', 'email', ts('Contact Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
//added contact source
$form->add('text', 'contact_source', ts('Contact Source'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'contact_source'));
//added job title
$form->addElement('text', 'job_title', ts('Job Title'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'job_title'));
//added internal ID
$form->addElement('text', 'contact_id', ts('Contact ID'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'id'));
$form->addRule('contact_id', ts('Please enter valid Contact ID'), 'positiveInteger');
//added external ID
$form->addElement('text', 'external_identifier', ts('External ID'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'external_identifier'));
if (CRM_Core_Permission::check('access deleted contacts') and CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_undelete', NULL)) {
$form->add('checkbox', 'deleted_contacts', ts('Search in Trash') . '<br />' . ts('(deleted contacts)'));
}
// add checkbox for cms users only
$form->addYesNo('uf_user', ts('CMS User?'), TRUE);
// tag all search
$form->add('text', 'tag_search', ts('All Tags'));
// add search profiles
// FIXME: This is probably a part of profiles - need to be
// FIXME: eradicated from here when profiles are reworked.
$types = array('Participant', 'Contribution', 'Membership');
// get component profiles
$componentProfiles = array();
$componentProfiles = CRM_Core_BAO_UFGroup::getProfiles($types);
$ufGroups = CRM_Core_BAO_UFGroup::getModuleUFGroup('Search Profile', 1);
$accessibleUfGroups = CRM_Core_Permission::ufGroup(CRM_Core_Permission::VIEW);
$searchProfiles = array();
foreach ($ufGroups as $key => $var) {
if (!array_key_exists($key, $componentProfiles) && in_array($key, $accessibleUfGroups)) {
$searchProfiles[$key] = $var['title'];
}
}
$form->add('select', 'uf_group_id', ts('Search Views'), array('0' => ts('- default view -')) + $searchProfiles, FALSE, array('class' => 'crm-select2'));
$componentModes = CRM_Contact_Form_Search::getModeSelect();
// unset contributions or participants if user does not have
// permission on them
if (!CRM_Core_Permission::access('CiviContribute')) {
unset($componentModes['2']);
}
if (!CRM_Core_Permission::access('CiviEvent')) {
unset($componentModes['3']);
}
//.........这里部分代码省略.........
开发者ID:kidaa30,项目名称:yes,代码行数:101,代码来源:Criteria.php
示例6: postProcess
/**
* Form submission of new/edit contact is processed.
*
* @access public
* @return None
*/
public function postProcess()
{
// check if dedupe button, if so return.
$buttonName = $this->controller->getButtonName();
if ($buttonName == $this->_dedupeButtonName) {
return;
}
//get the submitted values in an array
$params = $this->controller->exportValues($this->_name);
if (CRM_Utils_Array::value('image_URL', $params)) {
CRM_Contact_BAO_Contact::processImageParams($params);
}
if (is_numeric(CRM_Utils_Array::value('current_employer_id', $params)) && CRM_Utils_Array::value('current_employer', $params)) {
$params['current_employer'] = $params['current_employer_id'];
}
// don't carry current_employer_id field,
// since we don't want to directly update DAO object without
// handling related business logic ( eg related membership )
if (isset($params['current_employer_id'])) {
unset($params['current_employer_id']);
}
$params['contact_type'] = $this->_contactType;
if ($this->_contactSubType && !CRM_Utils_Array::value('contact_sub_type', $params)) {
$params['contact_sub_type'] = $this->_contactSubType;
}
if ($this->_contactId) {
$params['contact_id'] = $this->_contactId;
}
//make deceased date null when is_deceased = false
if ($this->_contactType == 'Individual' && CRM_Utils_Array::value('Demographics', $this->_editOptions) && !CRM_Utils_Array::value('is_deceased', $params)) {
$params['is_deceased'] = false;
$params['deceased_date'] = null;
}
// process membership status for deceased contact
$deceasedParams = array('contact_id' => $params['contact_id'], 'is_deceased' => $params['is_deceased'], 'deceased_date' => $params['deceased_date']);
$updateMembershipMsg = $this->updateMembershipStatus($deceasedParams);
// action is taken depending upon the mode
require_once 'CRM/Utils/Hook.php';
if ($this->_action & CRM_Core_Action::UPDATE) {
CRM_Utils_Hook::pre('edit', $params['contact_type'], $params['contact_id'], $params);
} else {
CRM_Utils_Hook::pre('create', $params['contact_type'], null, $params);
}
require_once 'CRM/Core/BAO/CustomField.php';
$customFields = CRM_Core_BAO_CustomField::getFields($params['contact_type'], false, true);
//CRM-5143
//if subtype is set, send subtype as extend to validate subtype customfield
$customFieldExtends = CRM_Utils_Array::value('contact_sub_type', $params) ? $params['contact_sub_type'] : $params['contact_type'];
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_contactId, $customFieldExtends, true);
if (array_key_exists('CommunicationPreferences', $this->_editOptions)) {
// this is a chekbox, so mark false if we dont get a POST value
$params['is_opt_out'] = CRM_Utils_Array::value('is_opt_out', $params, false);
}
// process shared contact address.
require_once 'CRM/Contact/BAO/Contact/Utils.php';
CRM_Contact_BAO_Contact_Utils::processSharedAddress($params['address']);
if (!array_key_exists('TagsAndGroups', $this->_editOptions)) {
unset($params['group']);
}
if (CRM_Utils_Array::value('contact_id', $params) && $this->_action & CRM_Core_Action::UPDATE) {
// figure out which all groups are intended to be removed
if (!empty($params['group'])) {
$contactGroupList =& CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], 'Added');
if (is_array($contactGroupList)) {
foreach ($contactGroupList as $key) {
if ($params['group'][$key['group_id']] != 1) {
$params['group'][$key['group_id']] = -1;
}
}
}
}
}
// parse street address, CRM-5450
$parseStatusMsg = null;
if ($this->_parseStreetAddress) {
$parseResult = $this->parseAddress($params);
$parseStatusMsg = $this->parseAddressStatusMsg($parseResult);
}
// Allow un-setting of location info, CRM-5969
$params['updateBlankLocInfo'] = true;
require_once 'CRM/Contact/BAO/Contact.php';
$contact =& CRM_Contact_BAO_Contact::create($params, true, false, true);
// set the contact ID
$this->_contactId = $contact->id;
if (array_key_exists('TagsAndGroups', $this->_editOptions)) {
//add contact to tags
require_once 'CRM/Core/BAO/EntityTag.php';
CRM_Core_BAO_EntityTag::create($params['tag'], 'civicrm_contact', $params['contact_id']);
//save free tags
if (isset($params['taglist']) && !empty($params['taglist'])) {
require_once 'CRM/Core/Form/Tag.php';
CRM_Core_Form_Tag::postProcess($params['taglist'], $params['contact_id'], 'civicrm_contact', $this);
}
}
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Contact.php
示例7: buildAttachment
static function buildAttachment(&$form, $entityTable, $entityID = NULL, $numAttachments = NULL, $ajaxDelete = FALSE)
{
if (!$numAttachments) {
$numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
}
// Assign maxAttachments count to template for help message
$form->assign('maxAttachments', $numAttachments);
$config = CRM_Core_Config::singleton();
// set default max file size as 2MB
$maxFileSize = $config->maxFileSize ? $config->maxFileSize : 2;
$currentAttachmentInfo = self::getEntityFile($entityTable, $entityID, TRUE);
$totalAttachments = 0;
if ($currentAttachmentInfo) {
$totalAttachments = count($currentAttachmentInfo);
$form->add('checkbox', 'is_delete_attachment', ts('Delete All Attachment(s)'));
$form->assign('currentAttachmentInfo', $currentAttachmentInfo);
} else {
$form->assign('currentAttachmentInfo', NULL);
}
if ($totalAttachments) {
if ($totalAttachments >= $numAttachments) {
$numAttachments = 0;
} else {
$numAttachments -= $totalAttachments;
}
}
$form->assign('numAttachments', $numAttachments);
$tags = CRM_Core_BAO_Tag::getTags('civicrm_file');
// get tagset info
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_file');
// add attachments
for ($i = 1; $i <= $numAttachments; $i++) {
$form->addElement('file', "attachFile_{$i}", ts('Attach File'), 'size=30 maxlength=60');
$form->addUploadElement("attachFile_{$i}");
$form->setMaxFileSize($maxFileSize * 1024 * 1024);
$form->addRule("attachFile_{$i}", ts('File size should be less than %1 MByte(s)', array(1 => $maxFileSize)), 'maxfilesize', $maxFileSize * 1024 * 1024);
$form->addElement('text', "attachDesc_{$i}", ts('Description'), 'size=40 maxlength=255');
if (!empty($tags)) {
$form->add('select', "tag_{$i}", ts('Tags'), $tags, FALSE, array('id' => "tags_{$i}", 'multiple' => 'multiple', 'title' => ts('- select -')));
}
}
// build tagset widget
CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_file', NULL, TRUE, TRUE, FALSE);
}
开发者ID:hguru,项目名称:224Civi,代码行数:44,代码来源:File.php
示例8: processActivity
/**
* Process activity creation.
*
* @param array $params
* Associated array of submitted values.
*
* @return self|null|object
*/
protected function processActivity(&$params)
{
$activityAssigned = array();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
// format assignee params
if (!CRM_Utils_Array::crmIsEmptyArray($params['assignee_contact_id'])) {
//skip those assignee contacts which are already assigned
//while sending a copy.CRM-4509.
$activityAssigned = array_flip($params['assignee_contact_id']);
if ($this->_activityId) {
$assigneeContacts = CRM_Activity_BAO_ActivityContact::getNames($this->_activityId, $assigneeID);
$activityAssigned = array_diff_key($activityAssigned, $assigneeContacts);
}
}
// call begin post process. Idea is to let injecting file do
// any processing before the activity is added/updated.
$this->beginPostProcess($params);
$activity = CRM_Activity_BAO_Activity::create($params);
// add tags if exists
$tagParams = array();
if (!empty($params['tag'])) {
foreach ($params['tag'] as $tag) {
$tagParams[$tag] = 1;
}
}
// Save static tags.
CRM_Core_BAO_EntityTag::create($tagParams, 'civicrm_activity', $activity->id);
// Save free tags.
if (isset($params['activity_taglist']) && !empty($params['activity_taglist'])) {
CRM_Core_Form_Tag::postProcess($params['activity_taglist'], $activity->id, 'civicrm_activity', $this);
}
// call end post process. Idea is to let injecting file do any
// processing needed, after the activity has been added/updated.
$this->endPostProcess($params, $activity);
// CRM-9590
if (!empty($params['is_multi_activity'])) {
$this->_activityIds[] = $activity->id;
} else {
$this->_activityId = $activity->id;
}
// create follow up activity if needed
$followupStatus = '';
$followupActivity = NULL;
if (!empty($params['followup_activity_type_id'])) {
$followupActivity = CRM_Activity_BAO_Activity::createFollowupActivity($activity->id, $params);
$followupStatus = ts('A followup activity has been scheduled.');
}
// send copy to assignee contacts.CRM-4509
$mailStatus = '';
if (Civi::settings()->get('activity_assignee_notification')) {
$activityIDs = array($activity->id);
if ($followupActivity) {
$activityIDs = array_merge($activityIDs, array($followupActivity->id));
}
$assigneeContacts = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames($activityIDs, TRUE, FALSE);
if (!CRM_Utils_Array::crmIsEmptyArray($params['assignee_contact_id'])) {
$mailToContacts = array();
// Build an associative array with unique email addresses.
foreach ($activityAssigned as $id => $dnc) {
if (isset($id) && array_key_exists($id, $assigneeContacts)) {
$mailToContacts[$assigneeContacts[$id]['email']] = $assigneeContacts[$id];
}
}
$sent = CRM_Activity_BAO_Activity::sendToAssignee($activity, $mailToContacts);
if ($sent) {
$mailStatus .= ts("A copy of the activity has also been sent to assignee contacts(s).");
}
}
// Also send email to follow-up activity assignees if set
if ($followupActivity) {
$mailToFollowupContacts = array();
foreach ($assigneeContacts as $values) {
if ($values['activity_id'] == $followupActivity->id) {
$mailToFollowupContacts[$values['email']] = $values;
}
}
$sentFollowup = CRM_Activity_BAO_Activity::sendToAssignee($followupActivity, $mailToFollowupContacts);
if ($sentFollowup) {
$mailStatus .= '<br />' . ts("A copy of the follow-up activity has also been sent to follow-up assignee contacts(s).");
}
}
}
// set status message
$subject = '';
if (!empty($params['subject'])) {
$subject = "'" . $params['subject'] . "'";
}
CRM_Core_Session::setStatus(ts('Activity %1 has been saved. %2 %3', array(1 => $subject, 2 => $followupStatus, 3 => $mailStatus)), ts('Saved'), 'success');
return $activity;
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:99,代码来源:Activity.php
示例9: postProcess
//.........这里部分代码省略.........
//is_current_revision will be set to 1 by default.
// add attachments if any
CRM_Core_BAO_File::formatAttachment($newActParams, $newActParams, 'civicrm_activity');
// call begin post process, before the activity is created/updated.
$this->beginPostProcess($newActParams);
foreach ($this->_caseId as $key => $val) {
$newActParams['case_id'] = $val;
$activity = CRM_Activity_BAO_Activity::create($newActParams);
$vvalue[] = array('case_id' => $val, 'actId' => $activity->id);
// call end post process, after the activity has been created/updated.
$this->endPostProcess($newActParams, $activity);
}
// copy files attached to old activity if any, to new one,
// as long as users have not selected the 'delete attachment' option.
if (empty($newActParams['is_delete_attachment'])) {
CRM_Core_BAO_File::copyEntityFile('civicrm_activity', $this->_activityId, 'civicrm_activity', $activity->id);
}
// copy back params to original var
$params = $newActParams;
}
foreach ($vvalue as $vkey => $vval) {
if ($vval['actId']) {
// add tags if exists
$tagParams = array();
if (!empty($params['tag'])) {
foreach ($params['tag'] as $tag) {
$tagParams[$tag] = 1;
}
}
//save static tags
CRM_Core_BAO_EntityTag::create($tagParams, 'civicrm_activity', $vval['actId']);
//save free tags
if (isset($params['taglist']) && !empty($params['taglist'])) {
CRM_Core_Form_Tag::postProcess($params['taglist'], $vval['actId'], 'civicrm_activity', $this);
}
}
// update existing case record if needed
$caseParams = $params;
$caseParams['id'] = $vval['case_id'];
if (!empty($caseParams['case_status_id'])) {
$caseParams['status_id'] = $caseParams['case_status_id'];
}
// unset params intended for activities only
unset($caseParams['subject'], $caseParams['details'], $caseParams['status_id'], $caseParams['custom']);
$case = CRM_Case_BAO_Case::create($caseParams);
// create case activity record
$caseParams = array('activity_id' => $vval['actId'], 'case_id' => $vval['case_id']);
CRM_Case_BAO_Case::processCaseActivity($caseParams);
}
// Insert civicrm_log record for the activity (e.g. store the
// created / edited by contact id and date for the activity)
// Note - civicrm_log is already created by CRM_Activity_BAO_Activity::create()
// send copy to selected contacts.
$mailStatus = '';
$mailToContacts = array();
//CRM-5695
//check for notification settings for assignee contacts
$selectedContacts = array('contact_check');
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'activity_assignee_notification')) {
$selectedContacts[] = 'assignee_contact_id';
}
foreach ($vvalue as $vkey => $vval) {
foreach ($selectedContacts as $dnt => $val) {
if (array_key_exists($val, $params) && !CRM_Utils_array::crmIsEmptyArray($params[$val])) {
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:67,代码来源:Activity.php
示例10: processActivity
/**
* Process activity creation
*
* @param array $params associated array of submitted values
* @access protected
*/
protected function processActivity(&$params)
{
$activityAssigned = array();
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
// format assignee params
if (!CRM_Utils_Array::crmIsEmptyArray($params['assignee_contact_id'])) {
//skip those assignee contacts which are already assigned
//while sending a copy.CRM-4509.
$activityAssigned = array_flip($params['assignee_contact_id']);
if ($this->_activityId) {
$assigneeContacts = CRM_Activity_BAO_ActivityContact::getNames($this->_activityId, $assigneeID);
$activityAssigned = array_diff_key($activityAssigned, $assigneeContacts);
}
}
// call begin post process. Idea is to let injecting file do
// any processing before the activity is added/updated.
$this->beginPostProcess($params);
$activity = CRM_Activity_BAO_Activity::create($params);
// add tags if exists
$tagParams = array();
if (!empty($params['tag'])) {
foreach ($params['tag'] as $tag) {
$tagParams[$tag] = 1;
}
}
//save static tags
CRM_Core_BAO_EntityTag::create($tagParams, 'civicrm_activity', $activity->id);
//save free tags
if (isset($params['activity_taglist']) && !empty($params['activity_taglist'])) {
CRM_Core_Form_Tag::postProcess($params['activity_taglist'], $activity->id, 'civicrm_activity', $this);
}
// call end post process. Idea is to let injecting file do any
// processing needed, after the activity has been added/updated.
$this->endPostProcess($params, $activity);
// CRM-9590
if (CRM_Utils_Array::value('is_multi_activity', $params)) {
$this->_activityIds[] = $activity->id;
} else {
$this->_activityId = $activity->id;
}
// create follow up activity if needed
$followupStatus = '';
if (CRM_Utils_Array::value('followup_activity_type_id', $params)) {
CRM_Activity_BAO_Activity::createFollowupActivity($activity->id, $params);
$followupStatus = ts('A followup activity has been scheduled.');
}
// send copy to assignee contacts.CRM-4509
$mailStatus = '';
if (!CRM_Utils_Array::crmIsEmptyArray($params['assignee_contact_id']) && CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'activity_assignee_notification')) {
$mailToContacts = array();
$assigneeContacts = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames($activity->id, TRUE, FALSE);
//build an associative array with unique email addresses.
foreach ($activityAssigned as $id => $dnc) {
if (isset($id) && array_key_exists($id, $assigneeContacts)) {
$mailToContacts[$assigneeContacts[$id]['email']] = $assigneeContacts[$id];
}
}
if (!CRM_Utils_array::crmIsEmptyArray($mailToContacts)) {
//include attachments while sending a copy of activity.
$attachments = CRM_Core_BAO_File::getEntityFile('civicrm_activity', $activity->id);
$ics = new CRM_Activity_BAO_ICalendar($activity);
$ics->addAttachment($attachments, $mailToContacts);
// CRM-8400 add param with _currentlyViewedContactId for URL link in mail
CRM_Case_BAO_Case::sendActivityCopy(NULL, $activity->id, $mailToContacts, $attachments, NULL);
$ics->cleanup();
$mailStatus .= ts("A copy of the activity has also been sent to assignee contacts(s).");
}
}
// set status message
$subject = '';
if (CRM_Utils_Array::value('subject', $params)) {
$subject = "'" . $params['subject'] . "'";
}
CRM_Core_Session::setStatus(ts('Activity %1 has been saved. %2 %3', array(1 => $subject, 2 => $followupStatus, 3 => $mailStatus)), ts('Saved'), 'success');
return $activity;
}
开发者ID:hguru,项目名称:224Civi,代码行数:83,代码来源:Activity.php
示例11: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
// get categories for the contact id
$entityTag = CRM_Core_BAO_EntityTag::getTag($this->_entityID, $this->_entityTable);
$this->assign('tagged', $entityTag);
// get the list of all the categories
$allTag = CRM_Core_BAO_Tag::getTagsUsedFor($this->_entityTable);
// need to append the array with the " checked " if contact is tagged with the tag
foreach ($allTag as $tagID => $varValue) {
if (in_array($tagID, $entityTag)) {
$tagAttribute = array('onclick' => "return changeRowColor(\"rowidtag_{$tagID}\")", 'checked' => 'checked', 'id' => "tag_{$tagID}");
} else {
$tagAttribute = array('onclick' => "return changeRowColor(\"rowidtag_{$tagID}\")", 'id' => "tag_{$tagID}");
}
$tagChk[$tagID] = $this->createElement('checkbox', $tagID, '', '', $tagAttribute);
}
$this->addGroup($tagChk, 'tagList', NULL, NULL, TRUE);
$tags = new CRM_Core_BAO_Tag();
$tree = $tags->getTree($this->_entityTable, TRUE);
$this->assign('tree', $tree);
$this->assign('tag', $allTag);
//build tag widget
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_contact');
CRM_Core_Form_Tag::buildQuickForm($this, $parentNames, $this->_entityTable, $this->_entityID);
if ($this->_action & CRM_Core_Action::BROWSE) {
$this->freeze();
} else {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Update Tags'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:36,代码来源:Tag.php
示例12: buildQuickForm
/**
* Function to build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE)->addStyleFile('civicrm', 'packages/jquery/plugins/jstree/themes/default/style.css', 0, 'html-header');
// get categories for the contact id
$entityTag = CRM_Core_BAO_EntityTag::getTag($this->_entityID, $this->_entityTable);
$this->assign('tagged', $entityTag);
// get the list of all the categories
$allTag = CRM_Core_BAO_Tag::getTagsUsedFor($this->_entityTable);
// need to append the array with the " checked " if contact is tagged with the tag
foreach ($allTag as $tagID => $varValue) {
if (in_array($tagID, $entityTag)) {
$tagAttribute = array('checked' => 'checked', 'id' => "tag_{$tagID}");
} else {
$tagAttribute = array('id' => "tag_{$tagID}");
}
$tagChk[$tagID] = $this->createElement('checkbox', $tagID, '', '', $tagAttribute);
}
$this->addGroup($tagChk, 'tagList', NULL, NULL, TRUE);
$tags = new CRM_Core_BAO_Tag();
$tree = $tags->getTree($this->_entityTable, TRUE);
$this->assign('tree', $tree);
$this->assign('tag', $allTag);
//build tag widget
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_contact');
CRM_Core_Form_Tag::buildQuickForm($this, $parentNames, $this->_entityTable, $this->_entityID);
if ($this->_action & CRM_Core_Action::BROWSE) {
$this->freeze();
} else {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Update Tags'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:37,代码来源:Tag.php
示例13: postProcess
//.........这里部分代码省略.........
$newActParams['original_id'] = $activity->id;
}
//is_current_revision will be set to 1 by default.
// add attachments if any
CRM_Core_BAO_File::formatAttachment($newActParams, $newActParams, 'civicrm_activity');
// call begin post process, before the activity is created/updated.
$this->beginPostProcess($newActParams);
$newActParams['case_id'] = $this->_caseId;
$activity = CRM_Activity_BAO_Activity::create($newActParams);
// call end post process, after the activity has been created/updated.
$this->endPostProcess($newActParams, $activity);
// copy files attached to old activity if any, to new one,
// as long as users have not selected the 'delete attachment' option.
if (!CRM_Utils_Array::value('is_delete_attachment', $newActParams)) {
CRM_Core_BAO_File::copyEntityFile('civicrm_activity', $this->_activityId, 'civicrm_activity', $activity->id);
}
// copy back params to original var
$params = $newActParams;
}
if ($activity->id) {
// add tags if exists
$tagParams = array();
if (!empty($params['tag'])) {
foreach ($params['tag'] as $tag) {
$tagParams[$tag] = 1;
}
}
//save static tags
require_once 'CRM/Core/BAO/EntityTag.php';
CRM_Core_BAO_EntityTag::create($tagParams, 'civicrm_activity', $activity->id);
//save free tags
if (isset($params['taglist']) && !empty($params['taglist'])) {
require_once 'CRM/Core/Form/Tag.php';
CRM_Core_Form_Tag::postProcess($params['taglist'], $activity->id, 'civicrm_activity', $this);
}
}
$params['assignee_contact_id'] = $assineeContacts;
// update existing case record if needed
$caseParams = $params;
$caseParams['id'] = $this->_caseId;
if (CRM_Utils_Array::value('case_type_id', $caseParams)) {
$caseParams['case_type_id'] = CRM_Case_BAO_Case::VALUE_SEPERATOR . $caseParams['case_type_id'] . CRM_Case_BAO_Case::VALUE_SEPERATOR;
}
if (CRM_Utils_Array::value('case_status_id', $caseParams)) {
$caseParams['status_id'] = $caseParams['case_status_id'];
}
// unset params intended for activities only
unset($caseParams['subject'], $caseParams['details'], $caseParams['status_id'], $caseParams['custom']);
$case = CRM_Case_BAO_Case::create($caseParams);
// create case activity record
$caseParams = array('activity_id' => $activity->id, 'case_id' => $this->_caseId);
CRM_Case_BAO_Case::processCaseActivity($caseParams);
// create activity assignee records
$assigneeParams = array('activity_id' => $activity->id);
if (!CRM_Utils_Array::crmIsEmptyArray($params['assignee_contact_id'])) {
//skip those assignee contacts which are already assigned
//while sending a copy.CRM-4509.
$activityAssigned = array_flip($params['assignee_contact_id']);
$activityId = isset($this->_activityId) ? $this->_activityId : $activity->id;
$assigneeContacts = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames($activityId);
$activityAssigned = array_diff_key($activityAssigned, $assigneeContacts);
foreach ($params['assignee_contact_id'] as $key => $id) {
$assigneeParams['assignee_contact_id'] = $id;
CRM_Activity_BAO_Activity::createActivityAssignment($assigneeParams);
}
//modify assigne_contact as per newly assigned contact before sending copy. CRM-4509.
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:67,代码来源:Activity.php
示例14: buildQuickForm
/**
* This function is to build form elements
* params object $form object of the form
*
* @param Object $form the form object that we are operating on
* @param int $contactId contact id
* @param int $type what components are we interested in
* @param boolean $visibility visibility of the field
* @param string $groupName if used for building group block
* @param string $tagName if used for building tag block
* @param string $fieldName this is used in batch profile(i.e to build multiple blocks)
*
* @static
* @access public
*/
static function buildQuickForm(&$form, $contactId = 0, $type = CRM_Contact_Form_Edit_TagsandGroups::ALL, $visibility = FALSE, $isRequired = NULL, $groupName = 'Group(s)', $tagName = 'Tag(s)', $fieldName = NULL)
{
if (!isset($form->_tagGroup)) {
$form->_tagGroup = array();
}
// NYSS 5670
if (!$contactId && !empty($form->_contactId)) {
$contactId = $form->_contactId;
}
$type = (int) $type;
if ($type & CRM_Contact_Form_Edit_TagsandGroups::GROUP) {
$fName = 'group';
if ($fieldName) {
$fName = $fieldName;
}
$elements = array();
$groupID = isset($form->_grid) ? $form->_grid : NULL;
if ($groupID && $visibility) {
$ids = "= {$groupID}";
} else {
if ($visibility) {
$group = CRM_Core_PseudoConstant::allGroup();
} else {
$group = CRM_Core_PseudoConstant::group();
}
$ids = implode(',', array_keys($group));
$ids = 'IN (' . $ids . ')';
}
if ($groupID || !empty($group)) {
$sql = "\n SELECT id, title, description, visibility\n FROM civicrm_group\n WHERE id {$ids}\n ORDER BY title\n ";
$dao = CRM_Core_DAO::executeQuery($sql);
$attributes['skiplabel'] = TRUE;
while ($dao->fetch()) {
// make sure that this group has public visibility
if ($visibility && $dao->visibility == 'User and User Admin Only') {
continue;
}
$form->_tagGroup[$fName][$dao->id]['description'] = $dao->description;
$elements[] =& $form->addElement('advcheckbox', $dao->id, NULL, $dao->title, $attributes);
}
if (!empty($elements)) {
$form->addGroup($elements, $fName, $groupName, ' <br />');
$form->assign('groupCount', count($elements));
if ($isRequired) {
$form->addRule($fName, ts('%1 is a required field.', array(1 => $groupName)), 'required');
}
}
}
}
if ($type & CRM_Contact_Form_Edit_TagsandGroups::TAG) {
$fName = 'tag';
if ($fieldName) {
$fName = $fieldName;
}
$form->_tagGroup[$fName] = 1;
$elements = array();
$tag = CRM_Core_BAO_Tag::getTags();
foreach ($tag as $id => $name) {
$elements[] = $form->createElement('checkbox', $id, NULL, $name);
}
if (!empty($elements)) {
$form->addGroup($elements, $fName, $tagName, '<br />');
$form->assign('tagCount', count($elements));
}
if ($isRequired) {
$form->addRule($fName, ts('%1 is a required field.', array(1 => $tagName)), 'required');
}
// build tag widget
$parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_contact');
CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_contact', $contactId, FALSE, TRUE);
}
$form->assign('tagGroup', $form->_tagGroup);
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:88,代码来源:TagsAndGroups.php
示例15: buildSearchForm
/**
* add all the elements shared between case activity search and advanaced search
*
* @access public
*
* @return void
* @static
*/
static function buildSearchForm(&$form)
{
$activityOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
asort($activityOptions);
foreach ($activityOptions as $activityID => $activity) {
$form->_activityElement =& $form->addElement('checkbox', "activity_type_id[{$activityID}]", NULL, $activity, array('onClick' => 'showCustomData( this.id );'));
}
CRM_Core_Form_Date::buildDateRange($form, 'activity_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
$activityRoles = array(1 => ts('Created by'), 2 => ts('Assigned to'));
$form->addRadio('activity_role', NULL, $activityRoles, NULL, '<br />');
$form->addElement('text', 'activity_contact_name', ts('Contact Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
foreach ($activityStatus as $activityStatusID => $activityStatusName) {
$activity_status[] = $form->createElement('checkbox', $activityStatusID, NULL, $activityStatusName);
}
$form->addGroup($activity_status, 'activity_status', ts('Activity Status'));
$form->setDefaults(array('activity_status[1]' => 1, 'activity_status[2]' => 1));
$form->addElement('text', 'activity_subject', ts('Subject'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
$form->addElement('checkbox', 'activity_test', ts('Find Test Activities?'));
$acti
|
请发表评论