Merge pull request #17828 from eileenmcnaughton/matt
[civicrm-core.git] / CRM / Event / Import / Form / DataSource.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /**
19 * This class gets the name of the file to upload
20 */
21 class CRM_Event_Import_Form_DataSource extends CRM_Import_Form_DataSource {
22
23 const PATH = 'civicrm/event/import';
24
25 const IMPORT_ENTITY = 'Participant';
26
27 /**
28 * Build the form object.
29 *
30 * @return void
31 */
32 public function buildQuickForm() {
33 parent::buildQuickForm();
34
35 $duplicateOptions = [];
36 $duplicateOptions[] = $this->createElement('radio',
37 NULL, NULL, ts('Skip'), CRM_Import_Parser::DUPLICATE_SKIP
38 );
39 $duplicateOptions[] = $this->createElement('radio',
40 NULL, NULL, ts('Update'), CRM_Import_Parser::DUPLICATE_UPDATE
41 );
42 $duplicateOptions[] = $this->createElement('radio',
43 NULL, NULL, ts('No Duplicate Checking'), CRM_Import_Parser::DUPLICATE_NOCHECK
44 );
45 $this->addGroup($duplicateOptions, 'onDuplicate',
46 ts('On Duplicate Entries')
47 );
48
49 $this->setDefaults(['onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP]);
50
51 $this->addContactTypeSelector();
52 }
53
54 /**
55 * Process the uploaded file.
56 *
57 * @return void
58 */
59 public function postProcess() {
60 $this->storeFormValues([
61 'onDuplicate',
62 'contactType',
63 'dateFormats',
64 'savedMapping',
65 ]);
66
67 $this->submitFileForMapping('CRM_Event_Import_Parser_Participant');
68 }
69
70 }