3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2014
37 * This class provides the functionality to save a search
38 * Saved Searches are used for saving frequently used queries
40 class CRM_Contact_Form_Task_Print
extends CRM_Contact_Form_Task
{
43 * Build all the data structures needed to build the form.
47 public function preProcess() {
50 // set print view, so that print templates are called
51 $this->controller
->setPrint(1);
52 $this->assign('id', $this->get('id'));
53 $this->assign('pageTitle', ts('CiviCRM Contact Listing'));
55 $params = $this->get('queryParams');
56 if (!empty($this->_contactIds
)) {
57 //using _contactIds field for creating params for query so that multiple selections on multiple pages
59 foreach ($this->_contactIds
as $contactId) {
61 CRM_Core_Form
::CB_PREFIX
. $contactId,
70 // create the selector, controller and run - store results in session
71 $fv = $this->get('formValues');
72 $returnProperties = $this->get('returnProperties');
75 if ($this->get(CRM_Utils_Sort
::SORT_ID
)) {
76 $sortID = CRM_Utils_Sort
::sortIDValue($this->get(CRM_Utils_Sort
::SORT_ID
),
77 $this->get(CRM_Utils_Sort
::SORT_DIRECTION
)
81 $includeContactIds = FALSE;
82 if ($fv['radio_ts'] == 'ts_sel') {
83 $includeContactIds = TRUE;
86 $selectorName = $this->controller
->selectorName();
87 require_once str_replace('_', DIRECTORY_SEPARATOR
, $selectorName) . '.php';
89 $returnP = isset($returnPropeties) ?
$returnPropeties : "";
90 $customSearchClass = $this->get('customSearchClass');
91 $selector = new $selectorName($customSearchClass,
98 $controller = new CRM_Core_Selector_Controller($selector,
101 CRM_Core_Action
::VIEW
,
103 CRM_Core_Selector_Controller
::SCREEN
105 $controller->setEmbedded(TRUE);
110 * Build the form object - it consists of
111 * - displaying the QILL (query in local language)
112 * - displaying elements for saving the search
117 public function buildQuickForm() {
119 // just need to add a javacript to popup the window for printing
121 $this->addButtons(array(
124 'name' => ts('Print Contact List'),
125 'js' => array('onclick' => 'window.print()'),
130 'name' => ts('Done'),
137 * Process the form after the input has been submitted and validated.
142 public function postProcess() {
143 // redirect to the main search page after printing is over