*/
class CRM_Event_Import_Form_Preview extends CRM_Import_Form_Preview {
- /**
- * Process the mapped fields and map it into the uploaded file
- * preview the file and extract some summary statistics
- *
- * @return void
- */
- public function postProcess() {
- $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
- $separator = $this->controller->exportValue('DataSource', 'fieldSeparator');
- $invalidRowCount = $this->get('invalidRowCount');
- $onDuplicate = $this->get('onDuplicate');
-
- $mapper = $this->controller->exportValue('MapField', 'mapper');
- $mapperKeys = [];
-
- foreach ($mapper as $key => $value) {
- $mapperKeys[$key] = $mapper[$key][0];
- }
-
- $parser = new CRM_Event_Import_Parser_Participant($mapperKeys);
- $parser->setUserJobID($this->getUserJobID());
- $mapFields = $this->get('fields');
-
- foreach ($mapper as $key => $value) {
- $header = [];
- if (isset($mapFields[$mapper[$key][0]])) {
- $header[] = $mapFields[$mapper[$key][0]];
- }
- $mapperFields[] = implode(' - ', $header);
- }
- $parser->run($fileName, $separator,
- $mapperFields,
- $this->getSubmittedValue('skipColumnHeader'),
- CRM_Import_Parser::MODE_IMPORT
- );
-
- // add all the necessary variables to the form
- $parser->set($this, CRM_Import_Parser::MODE_IMPORT);
- }
-
/**
* @return CRM_Event_Import_Parser_Participant
*/