/**
* Function to build tag widget if correct parent is passed
*
- * @param object $form form object
+ * @param CRM_Core_Form $form form object
* @param string $parentName parent name ( tag name)
* @param string $entityTable entitytable 'eg: civicrm_contact'
* @param int $entityId entityid 'eg: contact id'
$tagset[$tagsetItem]['tagsetElementName'] = $tagsetElementName;
if ($tagsetElementName) {
- $form->add('text', "{$tagsetElementName}[{$parentId}]", NULL);
+ $form->addEntityRef("{$tagsetElementName}[{$parentId}]", NULL, array(
+ 'entity' => 'tag',
+ 'multiple' => TRUE,
+ 'create' => TRUE,
+ 'api' => array('params' => array('parent_id' => $parentId)))
+ );
}
if ($entityId) {
// assign current tagsets which is used in postProcess
$form->_tagsetInfo = $tagset;
$form->assign("tagsetType", $mode);
- $form->assign("tagsetInfo_$mode", $tagset);
+ $tagsetInfo = (array) $form->get_template_vars("tagsetInfo");
+ $tagsetInfo[$mode] = $tagset;
+ $form->assign("tagsetInfo", $tagsetInfo);
$form->assign("isTagset", TRUE);
}
}
{/if}
{if $tagsetInfo_activity}
- <tr class="crm-activity-form-block-tag_set"><td colspan="2">{include file="CRM/common/Tag.tpl" tagsetType='activity'}</td></tr>
+ <tr class="crm-activity-form-block-tag_set"><td colspan="2">{include file="CRM/common/Tagset.tpl" tagsetType='activity'}</td></tr>
{/if}
{if $action neq 4 OR $viewCustomData}
<label>{$form.activity_result.label}</label><br />
{$form.activity_result.html}
</td>
- <td colspan="2">{include file="CRM/common/Tag.tpl" tagsetType='activity'}</td>
+ <td colspan="2">{include file="CRM/common/Tagset.tpl" tagsetType='activity'}</td>
</tr>
{else}
<tr>
- <td colspan="3">{include file="CRM/common/Tag.tpl" tagsetType='activity'}</td>
+ <td colspan="3">{include file="CRM/common/Tagset.tpl" tagsetType='activity'}</td>
</tr>
{/if}
</tr>
<tr>
<td>
- {include file="CRM/common/Tag.tpl"}
+ {include file="CRM/common/Tagset.tpl"}
</td>
</tr>
</tr>
<tr>
<td>
- {include file="CRM/common/Tag.tpl"}
+ {include file="CRM/common/Tagset.tpl"}
</td>
</tr>
</td>
</tr>
{/if}
- <tr class="crm-case-activity-form-block-tag_set"><td colspan="2">{include file="CRM/common/Tag.tpl" tagsetType='activity'}</td></tr>
+ <tr class="crm-case-activity-form-block-tag_set"><td colspan="2">{include file="CRM/common/Tagset.tpl" tagsetType='activity'}</td></tr>
</table>
{/if}
</td>
</tr>
-<tr class="crm-case-form-block-tag_set"><td colspan="2">{include file="CRM/common/Tag.tpl" tagsetType='case'}</td></tr>
+<tr class="crm-case-form-block-tag_set"><td colspan="2">{include file="CRM/common/Tagset.tpl" tagsetType='case'}</td></tr>
</table>
{/if}
{assign var="tagExits" value=1}
{/if}
- {foreach from=$tagsetInfo_case item=displayTagset}
+ {foreach from=$tagsetInfo.case item=displayTagset}
{if $displayTagset.entityTagsArray}
<div class="crm-block crm-content-block crm-case-caseview-display-tagset">
{$displayTagset.parentName}:
<div class="label">{$form.case_tag.label}</div>
<div class="view-value"><div class="crm-select-container">{$form.case_tag.html}</div>
<br/>
- <div style="text-align:left;">{include file="CRM/common/Tag.tpl" tagsetType='case'}</div>
+ <div style="text-align:left;">{include file="CRM/common/Tagset.tpl" tagsetType='case'}</div>
<br/>
<div class="clear"></div>
</div>
{/if}
</tr>
-<tr><td colspan="3">{include file="CRM/common/Tag.tpl" tagsetType='case'}</td></tr>
+<tr><td colspan="3">{include file="CRM/common/Tagset.tpl" tagsetType='case'}</td></tr>
{if $caseGroupTree}
<tr>
{/foreach}
</tr>
{if !$type || $type eq 'tag'}
- <tr><td>{include file="CRM/common/Tag.tpl"}</td></tr>
+ <tr><td>{include file="CRM/common/Tagset.tpl"}</td></tr>
{/if}
</table>
{if $title}
<td> </td>
{/if}
{if $isTagset}
- <td colspan="2">{include file="CRM/common/Tag.tpl"}</td>
+ <td colspan="2">{include file="CRM/common/Tagset.tpl"}</td>
{/if}
<td>{$form.tag_search.label} {help id="id-all-tags"}<br />{$form.tag_search.html}</td>
{if ! $isTagset}
</tr>
<tr>
<td>
- {include file="CRM/common/Tag.tpl"}
+ {include file="CRM/common/Tagset.tpl"}
</td>
</tr>
</tr>
<tr>
<td>
- {include file="CRM/common/Tag.tpl"}
+ {include file="CRM/common/Tagset.tpl"}
</td>
</tr>
<td><label>{$form.tag_1.label}</label> <div class="crm-select-container crm-attachment-tags">{$form.tag_1.html}</div></td>
</tr>
{/if}
- {if $tagsetInfo_attachment}
- <tr><td></td><td>{include file="CRM/common/Tag.tpl" tagsetType='attachment' tagsetNumber=1 }</td></tr>
+ {if $tagsetInfo.attachment}
+ <tr><td></td><td>{include file="CRM/common/Tagset.tpl" tagsetType='attachment' tagsetNumber=1 }</td></tr>
{/if}
{section name=attachLoop start=2 loop=$numAttachments+1}
{assign var=index value=$smarty.section.attachLoop.index}
<td></td>
<td><label>{$form.$tagElement.label}</label> <div class="crm-select-container crm-attachment-tags">{$form.$tagElement.html}</div></td>
</tr>
- {if $tagsetInfo_attachment}
- <tr><td></td><td>{include file="CRM/common/Tag.tpl" tagsetType='attachment' tagsetNumber=$index}</td></tr>
+ {if $tagsetInfo.attachment}
+ <tr><td></td><td>{include file="CRM/common/Tagset.tpl" tagsetType='attachment' tagsetNumber=$index}</td></tr>
{/if}
{/section}
</ul>
</div>
<br />
-{include file="CRM/common/Tag.tpl" context="contactTab"}
+{include file="CRM/common/Tagset.tpl" context="contactTab"}
</div>
--- /dev/null
+{*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.5 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*}
+{if empty($tagsetType)}
+ {capture assign="tagsetType"}contact{/capture}
+{/if}
+{foreach from=$tagsetInfo.$tagsetType item=tagset}
+ <div class="crm-section tag-section {$tagsetType}-tagset {$tagsetType}-tagset-{$tagset.parentID}-section">
+ <label>{$tagset.parentName}</label>
+ <div class="crm-clearfix"{if $context EQ "contactTab"} style="margin-top:-15px;"{/if}>
+ {assign var=elemName value = $tagset.tagsetElementName}
+ {assign var=parID value = $tagset.parentID}
+ {assign var=editTagSet value=false}
+ {$form.$elemName.$parID.html}
+ {if $action ne 4 }
+ {assign var=editTagSet value=true}
+ {if $action eq 16 and !($permission eq 'edit') }
+ {assign var=editTagSet value=false}
+ {/if}
+ {/if}
+ </div>
+ </div>
+{/foreach}