Merge pull request #17480 from tunbola/email-template-perms
[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 * $Id$
17 *
18 */
19
20 /**
21 * This class gets the name of the file to upload
22 */
23 class CRM_Event_Import_Form_DataSource extends CRM_Import_Form_DataSource {
24
25 const PATH = 'civicrm/event/import';
26
27 const IMPORT_ENTITY = 'Participant';
28
29 /**
30 * Build the form object.
31 *
32 * @return void
33 */
34 public function buildQuickForm() {
35 parent::buildQuickForm();
36
37 $duplicateOptions = [];
38 $duplicateOptions[] = $this->createElement('radio',
39 NULL, NULL, ts('Skip'), CRM_Import_Parser::DUPLICATE_SKIP
40 );
41 $duplicateOptions[] = $this->createElement('radio',
42 NULL, NULL, ts('Update'), CRM_Import_Parser::DUPLICATE_UPDATE
43 );
44 $duplicateOptions[] = $this->createElement('radio',
45 NULL, NULL, ts('No Duplicate Checking'), CRM_Import_Parser::DUPLICATE_NOCHECK
46 );
47 $this->addGroup($duplicateOptions, 'onDuplicate',
48 ts('On Duplicate Entries')
49 );
50
51 $this->setDefaults(['onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP]);
52
53 $this->addContactTypeSelector();
54 }
55
56 /**
57 * Process the uploaded file.
58 *
59 * @return void
60 */
61 public function postProcess() {
62 $this->storeFormValues([
63 'onDuplicate',
64 'contactType',
65 'dateFormats',
66 'savedMapping',
67 ]);
68
69 $this->submitFileForMapping('CRM_Event_Import_Parser_Participant');
70 }
71
72 }