3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class provides the functionality to save a search
20 * Saved Searches are used for saving frequently used queries
22 class CRM_Activity_Form_Task_SearchTaskHookSample
extends CRM_Activity_Form_Task
{
25 * Build all the data structures needed to build the form.
27 public function preProcess() {
30 // display name and activity details of all selected contacts
31 $activityIDs = implode(',', $this->_activityHolderIds
);
33 $activityContacts = CRM_Activity_BAO_ActivityContact
::buildOptions('record_type_id', 'validate');
34 $sourceID = CRM_Utils_Array
::key('Activity Source', $activityContacts);
36 SELECT at.subject as subject,
37 ov.label as activity_type,
38 at.activity_date_time as activity_date,
39 ct.display_name as display_name
40 FROM civicrm_activity at
41 LEFT JOIN civicrm_activity_contact ac ON ( ac.activity_id = at.id AND ac.record_type_id = {$sourceID} )
42 INNER JOIN civicrm_contact ct ON ( ac.contact_id = ct.id )
43 LEFT JOIN civicrm_option_group og ON ( og.name = 'activity_type' )
44 LEFT JOIN civicrm_option_value ov ON (at.activity_type_id = ov.value AND og.id = ov.option_group_id )
45 WHERE at.id IN ( $activityIDs )";
47 $dao = CRM_Core_DAO
::executeQuery($query);
49 while ($dao->fetch()) {
51 'subject' => $dao->subject
,
52 'activity_type' => $dao->activity_type
,
53 'activity_date' => $dao->activity_date
,
54 'display_name' => $dao->display_name
,
57 $this->assign('rows', $rows);
61 * Build the form object.
63 public function buildQuickForm() {