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