Skip to content
Snippets Groups Projects
Unverified Commit b520b57d authored by Monish Deb's avatar Monish Deb Committed by GitHub
Browse files

Merge pull request #18463 from eileenmcnaughton/searchhhook

#2017 remove unused SearchTaskHookSample.php
parents 49f5c017 9a0fec65
Branches
Tags
No related merge requests found
Showing with 0 additions and 632 deletions
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
/**
* This class provides the functionality to save a search
* Saved Searches are used for saving frequently used queries
*/
class CRM_Activity_Form_Task_SearchTaskHookSample extends CRM_Activity_Form_Task {
/**
* Build all the data structures needed to build the form.
*/
public function preProcess() {
parent::preProcess();
$rows = [];
// display name and activity details of all selected contacts
$activityIDs = implode(',', $this->_activityHolderIds);
$activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$query = "
SELECT at.subject as subject,
ov.label as activity_type,
at.activity_date_time as activity_date,
ct.display_name as display_name
FROM civicrm_activity at
LEFT JOIN civicrm_activity_contact ac ON ( ac.activity_id = at.id AND ac.record_type_id = {$sourceID} )
INNER JOIN civicrm_contact ct ON ( ac.contact_id = ct.id )
LEFT JOIN civicrm_option_group og ON ( og.name = 'activity_type' )
LEFT JOIN civicrm_option_value ov ON (at.activity_type_id = ov.value AND og.id = ov.option_group_id )
WHERE at.id IN ( $activityIDs )";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$rows[] = [
'subject' => $dao->subject,
'activity_type' => $dao->activity_type,
'activity_date' => $dao->activity_date,
'display_name' => $dao->display_name,
];
}
$this->assign('rows', $rows);
}
/**
* Build the form object.
*/
public function buildQuickForm() {
$this->addButtons([
[
'type' => 'done',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]);
}
}
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
/**
* This class provides the functionality to save a search
* Saved Searches are used for saving frequently used queries
*/
class CRM_Case_Form_Task_SearchTaskHookSample extends CRM_Case_Form_Task {
/**
* Build all the data structures needed to build the form.
*/
public function preProcess() {
parent::preProcess();
$rows = [];
// display name and email of all contact ids
$caseIDs = implode(',', $this->_entityIds);
$statusId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'case_status', 'id', 'name');
$query = "
SELECT ct.display_name as display_name,
cs.start_date as start_date,
ov.label as status
FROM civicrm_case cs
INNER JOIN civicrm_case_contact cc ON ( cs.id = cc.case_id)
INNER JOIN civicrm_contact ct ON ( cc.contact_id = ct.id)
LEFT JOIN civicrm_option_value ov ON (cs.status_id = ov.value AND ov.option_group_id = {$statusId} )
WHERE cs.id IN ( {$caseIDs} )";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$rows[] = [
'display_name' => $dao->display_name,
'start_date' => CRM_Utils_Date::customFormat($dao->start_date),
'status' => $dao->status,
];
}
$this->assign('rows', $rows);
}
/**
* Build the form object.
*/
public function buildQuickForm() {
$this->addButtons([
[
'type' => 'done',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]);
}
}
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
/**
* This class provides the functionality to save a search
* Saved Searches are used for saving frequently used queries
*/
class CRM_Contribute_Form_Task_SearchTaskHookSample extends CRM_Contribute_Form_Task {
/**
* Build all the data structures needed to build the form.
*/
public function preProcess() {
parent::preProcess();
$rows = [];
// display name and contribution details of all selected contacts
$contribIDs = implode(',', $this->_contributionIds);
$query = "
SELECT co.total_amount as amount,
co.receive_date as receive_date,
co.source as source,
ct.display_name as display_name
FROM civicrm_contribution co
INNER JOIN civicrm_contact ct ON ( co.contact_id = ct.id )
WHERE co.id IN ( $contribIDs )";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$rows[] = [
'display_name' => $dao->display_name,
'amount' => $dao->amount,
'source' => $dao->source,
'receive_date' => $dao->receive_date,
];
}
$this->assign('rows', $rows);
}
/**
* Build the form object.
*/
public function buildQuickForm() {
$this->addButtons([
[
'type' => 'done',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]);
}
}
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
/**
* This class provides the functionality to save a search
* Saved Searches are used for saving frequently used queries
*/
class CRM_Event_Form_Task_SearchTaskHookSample extends CRM_Event_Form_Task {
/**
* Build all the data structures needed to build the form.
*
* @return void
*/
public function preProcess() {
parent::preProcess();
$rows = [];
// display name and participation details of participants
$participantIDs = implode(',', $this->_participantIds);
$query = "
SELECT p.fee_amount as amount,
p.register_date as register_date,
p.source as source,
ct.display_name as display_name
FROM civicrm_participant p
INNER JOIN civicrm_contact ct ON ( p.contact_id = ct.id )
WHERE p.id IN ( $participantIDs )";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$rows[] = [
'display_name' => $dao->display_name,
'amount' => $dao->amount,
'register_date' => CRM_Utils_Date::customFormat($dao->register_date),
'source' => $dao->source,
];
}
$this->assign('rows', $rows);
}
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm() {
$this->addButtons([
[
'type' => 'done',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]);
}
}
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
/**
* This class provides the functionality to save a search
* Saved Searches are used for saving frequently used queries
*/
class CRM_Grant_Form_Task_SearchTaskHookSample extends CRM_Grant_Form_Task {
/**
* Build all the data structures needed to build the form.
*
* @return void
*/
public function preProcess() {
parent::preProcess();
$rows = [];
// display name and grant details of all selectced contacts
$grantIDs = implode(',', $this->_grantIds);
$query = "
SELECT grt.decision_date as decision_date,
grt.amount_total as amount_total,
grt.amount_granted as amount_granted,
ct.display_name as display_name
FROM civicrm_grant grt
INNER JOIN civicrm_contact ct ON ( grt.contact_id = ct.id )
WHERE grt.id IN ( $grantIDs )";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$rows[] = [
'display_name' => $dao->display_name,
'decision_date' => $dao->decision_date,
'amount_requested' => $dao->amount_total,
'amount_granted' => $dao->amount_granted,
];
}
$this->assign('rows', $rows);
}
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm() {
$this->addButtons([
[
'type' => 'done',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]);
}
}
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
/**
* This class provides the functionality to save a search
* Saved Searches are used for saving frequently used queries
*/
class CRM_Member_Form_Task_SearchTaskHookSample extends CRM_Member_Form_Task {
/**
* Build all the data structures needed to build the form.
*
* @return void
*/
public function preProcess() {
parent::preProcess();
$rows = [];
// display name and membership details of all selected contacts
$memberIDs = implode(',', $this->_memberIds);
$query = "
SELECT mem.start_date as start_date,
mem.end_date as end_date,
mem.source as source,
ct.display_name as display_name
FROM civicrm_membership mem
INNER JOIN civicrm_contact ct ON ( mem.contact_id = ct.id )
WHERE mem.id IN ( $memberIDs )";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$rows[] = [
'display_name' => $dao->display_name,
'start_date' => CRM_Utils_Date::customFormat($dao->start_date),
'end_date' => CRM_Utils_Date::customFormat($dao->end_date),
'source' => $dao->source,
];
}
$this->assign('rows', $rows);
}
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm() {
$this->addButtons([
[
'type' => 'done',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]);
}
}
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
/**
* This class provides the functionality to save a search
* Saved Searches are used for saving frequently used queries
*/
class CRM_Pledge_Form_Task_SearchTaskHookSample extends CRM_Pledge_Form_Task {
/**
* Build all the data structures needed to build the form.
*/
public function preProcess() {
parent::preProcess();
$rows = [];
// display name and pledge details of all selected contacts
$pledgeIDs = implode(',', $this->_pledgeIds);
$query = "
SELECT plg.amount as amount,
plg.create_date as create_date,
ct.display_name as display_name
FROM civicrm_pledge plg
INNER JOIN civicrm_contact ct ON ( plg.contact_id = ct.id )
WHERE plg.id IN ( $pledgeIDs )";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$rows[] = [
'display_name' => $dao->display_name,
'amount' => $dao->amount,
'create_date' => CRM_Utils_Date::customFormat($dao->create_date),
];
}
$this->assign('rows', $rows);
}
/**
* Build the form object.
*/
public function buildQuickForm() {
$this->addButtons([
[
'type' => 'done',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]);
}
}
{if $rows}
<div class="crm-submit-buttons">
<span class="element-right">{include file="CRM/common/formButtons.tpl" location="top"}</span>
</div>
<div class="spacer"></div>
<div>
<br />
<table>
<tr class="columnheader">
<th>{ts}Display Name{/ts}</th>
<th>{ts}Start Date{/ts}</th>
<th>{ts}Status{/ts}</th>
</tr>
{foreach from=$rows item=row}
<tr class="{cycle values="odd-row,even-row"}">
<td class="crm-case-searchtaskhooksample-display_name">{$row.display_name}</td>
<td class="crm-case-searchtaskhooksample-start_date">{$row.start_date}</td>
<td class="crm-case-searchtaskhooksample-status">{$row.status}</td>
</tr>
{/foreach}
</table>
</div>
<div class="crm-submit-buttons">
<span class="element-right">{include file="CRM/common/formButtons.tpl" location="bottom"}</span>
</div>
{else}
<div class="messages status no-popup">
{icon icon="fa-info-circle"}{/icon}
{ts}There are no records selected.{/ts}
</div>
{/if}
{if $rows}
<div class="form-item crm-block crm-form-block crm-contribution-form-block">
<span class="element-right">{$form.buttons.html}</span>
</div>
<div class="spacer"></div>
<div>
<br />
<table>
<tr class="columnheader">
<th>{ts}Display Name{/ts}</th>
<th>{ts}Amount{/ts}</th>
<th>{ts}Source{/ts}</th>
<th>{ts}Receive Date{/ts}</th>
</tr>
{foreach from=$rows item=row}
<tr class="{cycle values="odd-row,even-row"}">
<td>{$row.display_name}</td>
<td>{$row.amount}</td>
<td>{$row.source}</td>
<td>{$row.receive_date}</td>
</tr>
{/foreach}
</table>
</div>
<div class="form-item">
<span class="element-right">{$form.buttons.html}</span>
</div>
{else}
<div class="messages status no-popup">
{icon icon="fa-info-circle"}{/icon}
{ts}There are no records selected.{/ts}
</div>
{/if}
{if $rows}
<div class="crm-submit-buttons">
<span class="element-right">{include file="CRM/common/formButtons.tpl" location="top"}</span>
</div>
<div class="spacer"></div>
<div>
<br />
<table>
<tr class="columnheader">
<th>{ts}Display Name{/ts}</th>
<th>{ts}Amount{/ts}</th>
<th>{ts}Register Date{/ts}</th>
<th>{ts}Source{/ts}</th>
</tr>
{foreach from=$rows item=row}
<tr class="{cycle values="odd-row,even-row"}">
<td class="crm-event-searchtaskhooksample-display_name">{$row.display_name}</td>
<td class="crm-event-searchtaskhooksample-amount">{$row.amount}</td>
<td class="crm-event-searchtaskhooksample-register_date">{$row.register_date}</td>
<td class="crm-event-searchtaskhooksample-source">{$row.source}</td>
</tr>
{/foreach}
</table>
</div>
<div class="crm-submit-buttons">
<span class="element-right">{include file="CRM/common/formButtons.tpl" location="bottom"}</span>
</div>
{else}
<div class="messages status no-popup">
{icon icon="fa-info-circle"}{/icon}{ts}There are no records selected.{/ts}
</div>
{/if}
{if $rows}
<div class="crm-submit-buttons element-right">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<div class="spacer"></div>
<div>
<br />
<table>
<tr class="columnheader">
<td>{ts}Display Name{/ts}</td>
<td>{ts}Decision Date{/ts}</td>
<td>{ts}Amount Requested{/ts}</td>
<td>{ts}Amount Granted{/ts}</td>
</tr>
{foreach from=$rows item=row}
<tr class="{cycle values="odd-row,even-row"} crm-grant">
<td class="crm-grant-task-SearchTaskHookSample-form-block-display_name">{$row.display_name}</td>
<td class="crm-grant-task-SearchTaskHookSample-form-block-decision_date">{$row.decision_date}</td>
<td class="crm-grant-task-SearchTaskHookSample-form-block-amount_requested">{$row.amount_requested}</td>
<td class="crm-grant-task-SearchTaskHookSample-form-block-amount_granted">{$row.amount_granted}</td>
</tr>
{/foreach}
</table>
</div>
<div class="crm-submit-buttons element-right">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
{else}
<div class="messages status no-popup">
{icon icon="fa-info-circle"}{/icon}
{ts}There are no records selected.{/ts}
</div>
{/if}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment