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_Contact_Form_Task_Print
extends CRM_Contact_Form_Task
{
25 * Build all the data structures needed to build the form.
27 public function preProcess() {
30 // set print view, so that print templates are called
31 $this->controller
->setPrint(1);
32 $this->assign('id', $this->get('id'));
33 $this->assign('pageTitle', ts('CiviCRM Contact Listing'));
35 $params = $this->get('queryParams');
36 if (!empty($this->_contactIds
)) {
37 //using _contactIds field for creating params for query so that multiple selections on multiple pages
39 foreach ($this->_contactIds
as $contactId) {
41 CRM_Core_Form
::CB_PREFIX
. $contactId,
50 // create the selector, controller and run - store results in session
51 $fv = $this->get('formValues');
52 $returnProperties = $this->get('returnProperties');
55 if ($this->get(CRM_Utils_Sort
::SORT_ID
)) {
56 $sortID = CRM_Utils_Sort
::sortIDValue($this->get(CRM_Utils_Sort
::SORT_ID
),
57 $this->get(CRM_Utils_Sort
::SORT_DIRECTION
)
61 $includeContactIds = FALSE;
62 if ($fv['radio_ts'] == 'ts_sel') {
63 $includeContactIds = TRUE;
66 $selectorName = $this->controller
->selectorName();
67 require_once str_replace('_', DIRECTORY_SEPARATOR
, $selectorName) . '.php';
69 $returnP = isset($returnProperties) ?
$returnProperties : "";
70 $customSearchClass = $this->get('customSearchClass');
71 $this->assign('customSearchID', $this->get('customSearchID'));
72 $selector = new $selectorName($customSearchClass,
79 $controller = new CRM_Core_Selector_Controller($selector,
82 CRM_Core_Action
::VIEW
,
84 CRM_Core_Selector_Controller
::SCREEN
86 $controller->setEmbedded(TRUE);
91 * Build the form object - it consists of
92 * - displaying the QILL (query in local language)
93 * - displaying elements for saving the search
95 public function buildQuickForm() {
97 // just need to add a javacript to popup the window for printing
102 'name' => ts('Print Contact List'),
103 'js' => ['onclick' => 'window.print()'],
108 'name' => ts('Done'),
114 * Process the form after the input has been submitted and validated.
116 public function postProcess() {
117 // redirect to the main search page after printing is over