*/
public function buildQuickForm() {
parent::buildQuickForm();
- $this->addSortNameField();
-
- $this->_group = CRM_Core_PseudoConstant::nestedGroup();
-
- // multiselect for groups
- if ($this->_group) {
- $this->add('select', 'group', ts('Groups'), $this->_group, FALSE,
- array('id' => 'group', 'multiple' => 'multiple', 'class' => 'crm-select2')
- );
- }
-
- // multiselect for tags
- $contactTags = CRM_Core_BAO_Tag::getTags();
-
- if ($contactTags) {
- $this->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE,
- array('id' => 'contact_tags', 'multiple' => 'multiple', 'class' => 'crm-select2')
- );
- }
+ $this->addContactSearchFields();
CRM_Contribute_BAO_Query::buildSearchForm($this);
return ts('Contributor Name');
}
+ /**
+ * Get the label for the tag field.
+ *
+ * We do this in a function so the 'ts' wraps the whole string to allow
+ * better translation.
+ *
+ * @return string
+ */
+ protected function getTagLabel() {
+ return ts('Contributor Tag(s)');
+ }
+
+ /**
+ * Get the label for the group field.
+ *
+ * @return string
+ */
+ protected function getGroupLabel() {
+ return ts('Contributor Group(s)');
+ }
+
+ /**
+ * Get the label for the group field.
+ *
+ * @return string
+ */
+ protected function getContactTypeLabel() {
+ return ts('Contributor Contact Type');
+ }
+
/**
* The post processing of the form gets done here.
*
return 'search';
}
+ /**
+ * Add generic fields that specify the contact.
+ */
+ protected function addContactSearchFields() {
+ $this->addSortNameField();
+
+ $this->_group = CRM_Core_PseudoConstant::nestedGroup();
+ if ($this->_group) {
+ $this->add('select', 'group', $this->getGroupLabel(), $this->_group, FALSE,
+ array(
+ 'id' => 'group',
+ 'multiple' => 'multiple',
+ 'class' => 'crm-select2',
+ )
+ );
+ }
+
+ $contactTags = CRM_Core_BAO_Tag::getTags();
+ if ($contactTags) {
+ $this->add('select', 'contact_tags', $this->getTagLabel(), $contactTags, FALSE,
+ array(
+ 'id' => 'contact_tags',
+ 'multiple' => 'multiple',
+ 'class' => 'crm-select2',
+ )
+ );
+ }
+ $this->addField('contact_type', array('entity' => 'Contact'));
+
+ if (CRM_Core_Permission::check('access deleted contacts') && Civi::settings()->get('contact_undelete')) {
+ $this->addElement('checkbox', 'deleted_contacts', ts('Search in Trash') . '<br />' . ts('(deleted contacts)'));
+ }
+
+ }
+
}
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2017
- * $Id$
- *
*/
/**
*/
public function buildQuickForm() {
parent::buildQuickForm();
- $this->addSortNameField();
-
- if (CRM_Core_Permission::check('access deleted contacts') and Civi::settings()->get('contact_undelete')) {
- $this->addElement('checkbox', 'deleted_contacts', ts('Search in Trash') . '<br />' . ts('(deleted contacts)'));
- }
+ $this->addContactSearchFields();
CRM_Event_BAO_Query::buildSearchForm($this);
return ts('Participant Name');
}
+ /**
+ * Get the label for the tag field.
+ *
+ * We do this in a function so the 'ts' wraps the whole string to allow
+ * better translation.
+ *
+ * @return string
+ */
+ protected function getTagLabel() {
+ return ts('Participant Tag(s)');
+ }
+
+ /**
+ * Get the label for the group field.
+ *
+ * @return string
+ */
+ protected function getGroupLabel() {
+ return ts('Participant Group(s)');
+ }
+
+ /**
+ * Get the label for the group field.
+ *
+ * @return string
+ */
+ protected function getContactTypeLabel() {
+ return ts('Participant Contact Type');
+ }
+
/**
* The post processing of the form gets done here.
*
*/
public function buildQuickForm() {
parent::buildQuickForm();
- $this->addSortNameField();
+ $this->addContactSearchFields();
CRM_Member_BAO_Query::buildSearchForm($this);
return ts('Member Name');
}
+ /**
+ * Get the label for the tag field.
+ *
+ * We do this in a function so the 'ts' wraps the whole string to allow
+ * better translation.
+ *
+ * @return string
+ */
+ protected function getTagLabel() {
+ return ts('Member Tag(s)');
+ }
+
+ /**
+ * Get the label for the group field.
+ *
+ * @return string
+ */
+ protected function getGroupLabel() {
+ return ts('Member Group(s)');
+ }
+
+ /**
+ * Get the label for the group field.
+ *
+ * @return string
+ */
+ protected function getContactTypeLabel() {
+ return ts('Member Contact Type');
+ }
+
/**
* The post processing of the form gets done here.
*
*/
public function buildQuickForm() {
parent::buildQuickForm();
- $this->addSortNameField();
+ $this->addContactSearchFields();
CRM_Pledge_BAO_Query::buildSearchForm($this);
return ts('Pledger Name');
}
+ /**
+ * Get the label for the tag field.
+ *
+ * We do this in a function so the 'ts' wraps the whole string to allow
+ * better translation.
+ *
+ * @return string
+ */
+ protected function getTagLabel() {
+ return ts('Pledger Tag(s)');
+ }
+
+ /**
+ * Get the label for the group field.
+ *
+ * @return string
+ */
+ protected function getGroupLabel() {
+ return ts('Pledger Group(s)');
+ }
+
+ /**
+ * Get the label for the group field.
+ *
+ * @return string
+ */
+ protected function getContactTypeLabel() {
+ return ts('Pledger Contact Type');
+ }
+
/**
* The post processing of the form gets done here.
*
--- /dev/null
+<tr>
+ <td class="font-size12pt">
+ {$form.sort_name.label} {$form.sort_name.html|crmAddClass:'twenty'}
+ </td>
+ <td>{$form.buttons.html}</td>
+</tr>
+<tr>
+ {if $form.contact_tags}
+ <td><label>{$form.contact_tags.label}</label>
+ {$form.contact_tags.html}
+ </td>
+ {else}
+ <td> </td>
+ {/if}
+
+ {if $form.group}
+ <td><label>{$form.group.label}</label>
+ {$form.group.html}
+ </td>
+ {else}
+ <td> </td>
+ {/if}
+</tr>
+<tr class="crm-event-search-form-block-deleted_contacts">
+ <td>{$form.contact_type.label} {$form.contact_type.html}<br></td>
+ <td>
+ {if $form.deleted_contacts}
+ {$form.deleted_contacts.html} {$form.deleted_contacts.label}
+ {/if}
+ </td>
+</tr>
<div class="crm-accordion-body">
{strip}
<table class="form-layout">
- <tr>
- <td class="font-size12pt" colspan="2"> {$form.sort_name.label} {$form.sort_name.html|crmAddClass:'twenty'} {$form.buttons.html}
- </td>
- </tr>
- <tr>
- {if $form.contact_tags}
- <td><label>{ts}Contributor Tag(s){/ts}</label>
- {$form.contact_tags.html}
- </td>
- {else}
- <td> </td>
- {/if}
-
- {if $form.group}
- <td><label>{ts}Contributor Group(s){/ts}</label>
- {$form.group.html}
- </td>
- {else}
- <td> </td>
- {/if}
- </tr>
-{include file="CRM/Contribute/Form/Search/Common.tpl"}
+ {include file="CRM/Contact/Form/Search/ContactSearchFields.tpl"}
+ {include file="CRM/Contribute/Form/Search/Common.tpl"}
<tr>
<td colspan="2">{$form.buttons.html}</td>
</tr>
<div id="searchForm">
{strip}
<table class="form-layout">
- <tr class="crm-event-search-form-block-sort_name">
- <td class="font-size12pt" colspan="2">
- {$form.sort_name.label} {$form.sort_name.html|crmAddClass:'twenty'} {$form.buttons.html}
- </td>
- </tr>
- {if $form.deleted_contacts}
- <tr class="crm-event-search-form-block-deleted_contacts">
- <td colspan="2">
- {$form.deleted_contacts.html} {$form.deleted_contacts.label}
- </td>
- </tr>
- {/if}
+ {include file="CRM/Contact/Form/Search/ContactSearchFields.tpl"}
{include file="CRM/Event/Form/Search/Common.tpl"}
<div class="crm-accordion-body">
{strip}
<table class="form-layout">
- <tr>
- <td class="font-size12pt" colspan="2">
- {$form.sort_name.label} {$form.sort_name.html|crmAddClass:'twenty'} {$form.buttons.html}
- </td>
- </tr>
-
+ {include file="CRM/Contact/Form/Search/ContactSearchFields.tpl"}
{include file="CRM/Member/Form/Search/Common.tpl"}
<tr>
<div id="searchForm">
{strip}
<table class="form-layout">
- <tr>
- <td class="font-size12pt" colspan="2">
- {$form.sort_name.label} {$form.sort_name.html|crmAddClass:'twenty'} {$form.buttons.html}
- </td>
- </tr>
+ {include file="CRM/Contact/Form/Search/ContactSearchFields.tpl"}
{include file="CRM/Pledge/Form/Search/Common.tpl"}
<tr>