public function getImportTypeName($import_type) { if (!$datatypes) { $datatypes = EfrontImport::getImportTypes(); } return $datatypes[$import_type]; }
<?php if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) { exit; } if (isset($currentUser->coreAccess['users']) && $currentUser->coreAccess['users'] == 'hidden') { eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure"); } $loadScripts[] = "includes/import"; $import_export_types = EfrontImport::getImportTypes(); // ******************************************* Import form ******************************************* $importForm = new HTML_QuickForm("import_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=import_export&op=import", "", null, true); $importForm->addElement('file', 'import_file', _DATAFILE, 'class = "inputText"'); $importForm->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024); //getUploadMaxSize returns size in KB $importForm->addElement('select', 'import_type', _DATATYPE, $import_export_types, 'id ="import_type" class = "inputCheckbox" onchange="changeCategory(this.value)"'); $importForm->addElement('advcheckbox', 'import_keep', _KEEPEXISTINGUSERS, null, 'class = "inputCheckbox"', array(0, 1)); $importForm->addElement('advcheckbox', 'replace_assignments', _REPLACEASSIGNMENTS, null, 'class = "inputCheckbox"', array(0, 1)); $importForm->addElement("select", "date_format", _DATEFORMAT, array("DD/MM/YYYY" => "DD/MM/YYYY", "MM/DD/YYYY" => "MM/DD/YYYY", "YYYY/MM/DD" => "YYYY/MM/DD")); $importForm->setDefaults(array('import_keep' => 0)); $importForm->addElement('submit', 'submit_import', _IMPORTDATA, 'class = "flatButton"'); $help_info = array(); foreach ($import_export_types as $type => $name) { if ($type != "anything") { $help_info[$type] = array("mandatory" => implode(", ", EfrontImport::getMandatoryFields($type)), "optional" => implode(", ", EfrontImport::getOptionalFields($type)), "sample_type" => $type); } } $smarty->assign("T_HELP_IMPORT_INFO", $help_info); if (isset($_GET['csv_sample']) && $_GET['csv_sample'] == 1 && isset($_GET['sample_type'])) { $sample_type = $_GET['sample_type']; header("content-type:text/plain");