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 previews the uploaded file and returns summary statistics.
21 * TODO: CRM-11254 - if preProcess and postProcess functions can be reconciled between the 5 child classes,
22 * those classes can be removed entirely and this class will not need to be abstract
24 abstract class CRM_Import_Form_Preview
extends CRM_Core_Form
{
27 * Return a descriptive name for the page, used in wizard header.
31 public function getTitle() {
36 * Build the form object.
38 public function buildQuickForm() {
40 // FIXME: This is a hack...
41 // The tpl contains javascript that starts the import on form submit
42 // Since our back/cancel buttons are of html type "submit" we have to prevent a form submit event when they are clicked
43 // Hacking in some onclick js to make them act more like links instead of buttons
44 $path = CRM_Utils_System
::currentPath();
45 $query = ['_qf_MapField_display' => 'true'];
46 $qfKey = CRM_Utils_Request
::retrieve('qfKey', 'String');
47 if (CRM_Utils_Rule
::qfKey($qfKey)) {
48 $query['qfKey'] = $qfKey;
50 $previousURL = CRM_Utils_System
::url($path, $query, FALSE, NULL, FALSE);
51 $cancelURL = CRM_Utils_System
::url($path, 'reset=1', FALSE, NULL, FALSE);
56 'name' => ts('Previous'),
57 'js' => ['onclick' => "location.href='{$previousURL}'; return false;"],
61 'name' => ts('Import Now'),
62 'spacing' => ' ',
67 'name' => ts('Cancel'),
68 'js' => ['onclick' => "location.href='{$cancelURL}'; return false;"],
74 * Set status url for ajax.
76 public function setStatusUrl() {
77 $statusID = $this->get('statusID');
79 $statusID = md5(uniqid(rand(), TRUE));
80 $this->set('statusID', $statusID);
82 $statusUrl = CRM_Utils_System
::url('civicrm/ajax/status', "id={$statusID}", FALSE, NULL, FALSE);
83 $this->assign('statusUrl', $statusUrl);