if (array_key_exists('TagsAndGroups', $this->_editOptions)) {
//add contact to tags
- $params['tag'] = array_flip(explode(',', $params['tag']));
- CRM_Core_BAO_EntityTag::create($params['tag'], 'civicrm_contact', $params['contact_id']);
+ if (isset($params['tag']) && !empty($params['tag'])) {
+ $params['tag'] = array_flip(explode(',', $params['tag']));
+ CRM_Core_BAO_EntityTag::create($params['tag'], 'civicrm_contact', $params['contact_id']);
+ }
//save free tags
if (isset($params['contact_taglist']) && !empty($params['contact_taglist'])) {
if ($groupElementType == 'select' && !empty($groupsOptions)) {
$form->add('select', $fName, $groupName, $groupsOptions, FALSE,
- array('id' => $fName, 'multiple' => 'multiple', 'class' => 'crm-select2', 'style' => 'width: 310px')
+ array('id' => $fName, 'multiple' => 'multiple', 'class' => 'crm-select2 twenty')
);
$form->assign('groupCount', count($groupsOptions));
}
if (!empty($tags)) {
$form->add('select2', 'tag', ts('Tag(s)'), $tags, FALSE, array('class' => 'huge', 'placeholder' => ts('- select -'), 'multiple' => TRUE));
}
- }
- // build tag widget
- $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_contact');
- CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_contact', $contactId, FALSE, TRUE);
+ // 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);
}
if ($type & self::TAG) {
$defaults['tag'] = implode(',', CRM_Core_BAO_EntityTag::getTag($id, 'civicrm_contact'));
- CRM_Core_Error::debug_var('tag', $defaults['tag']);
}
}
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
-{literal}
-<style>
- #tagtree .highlighted > span {
- background-color: #fefca6;
- }
- #tagtree .helpicon ins {
- display: none;
- }
- #tagtree ins.jstree-icon {
- cursor: pointer;
- }
-</style>
-<script type="text/javascript">
- (function($, _){{/literal}
- var entityID='{$entityID}',
- entityTable='{$entityTable}',
- $form = $('form.{$form.formClass}');
- {literal}
-
- $(function() {
- function highlightSelected() {
- $("ul input:not(:checked)", '#tagtree').each(function () {
- $(this).closest("li").removeClass('highlighted');
- });
- $("ul input:checked", '#tagtree').each(function () {
- $(this).parents("li[id^=tag]").addClass('highlighted');
- });
- }
- highlightSelected();
-
- $("#tagtree input").change(function(){
- highlightSelected();
- });
-
- var childTag = "{/literal}{$loadjsTree}{literal}";
- if (childTag) {
- //load js tree.
- $("#tagtree").jstree({
- plugins : ["themes", "html_data"],
- themes: {
- "theme": 'classic',
- "dots": false,
- "icons": false,
- "url": CRM.config.resourceBase + 'packages/jquery/plugins/jstree/themes/classic/style.css'
- }
- });
- }
- {/literal}
- {if !empty($permission) && $permission neq 'edit'}
- {literal}
- $("#tagtree input").prop('disabled', true);
- {/literal}
- {/if}
- {literal}
- });
- })(CRM.$, CRM._);
- {/literal}
-</script>
-
{if $title}
<div class="crm-accordion-wrapper crm-tagGroup-accordion collapsed">
<div class="crm-accordion-header">{$title}</div>
<tr>
{if !$type || $type eq 'tag'}
<td>
- <span class="label">{if $title}{$form.tag.label}{/if}</span><br />
- {$form.tag.html}
+ <div class="crm-section tag-section">
+ {if $title}{$form.tag.label}{/if}
+ {$form.tag.html}
+ </div>
+ {if $context NEQ 'profile'}
+ {include file="CRM/common/Tagset.tpl"}
+ {/if}
</td>
{/if}
{if !$type || $type eq 'group'}
<td>
{if $groupElementType eq 'select'}
- <span class="label">{if $title}{$form.group.label}{/if}</span>
+ <div class="crm-section group-section">
+ {if $title}{$form.group.label}{/if}
{$form.group.html}
+ </div>
{else}
{foreach key=key item=item from=$tagGroup.group}
<div class="group-wrapper">
</td>
{/if}
</tr>
- {if !$type || $type eq 'tag'}
- <tr><td>{include file="CRM/common/Tagset.tpl"}</td></tr>
- {/if}
</table>
{if $title}
</div>
{if $n eq 'email_greeting' or $n eq 'postal_greeting' or $n eq 'addressee'}
{include file="CRM/Profile/Form/GreetingType.tpl"}
{elseif ( $n eq 'group' && $form.group ) || ( $n eq 'tag' && $form.tag )}
- {include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$n context="profile"}
+ {include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$n context="profile" tableLayout=1}
{elseif ( $form.$n.name eq 'image_URL' )}
{$form.$n.html}
{if !empty($imageURL)}