if ($_SERVER["REQUEST_METHOD"] == "POST" && $tabStep > 2 && check_freetrix_sessid()) { //Check $csvImport = false; $ldp = false; if ($dataSource == "csv") { $csvFilePath = $_SERVER["DOCUMENT_ROOT"].Rel2Abs("/", $csvDataFile); if (is_file($csvFilePath) && is_readable($csvFilePath)) { $csvImport = new CSVUserImport($csvFilePath, $arDelimeters[$delimeter]); $csvImport->SetUserGroups($userGroups); $csvImport->IgnoreDuplicate($ignoreDuplicate == "Y"); $csvImport->SetCallback("_OnUserAdd"); $csvImport->SetImageFilePath($pathToImages); $csvImport->AttachUsersToIBlock($attachIBlockID); $defaultUserEmail = $csvImport->GetDefaultEmail(); if ($ldapServer > 0 && $ldapExists) { $dbLdap = CLdapServer::GetByID($ldapServer); if ($dbLdap->Fetch()) $csvImport->externalAuthID = "LDAP#".$ldapServer; } if ($csvImport->IsErrorOccured()) $strError = $csvImport->GetErrorMessage(); } else
$userGroups = array(2); $dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "EMPLOYEES_" . WIZARD_SITE_ID, "STRING_ID_EXACT_MATCH" => "Y")); if ($arGroup = $dbResult->Fetch()) { $userGroups[] = $arGroup["ID"]; } $csvImport->SetUserGroups($userGroups); //Reference to iblock $departmentIBlockID = 0; if (CModule::IncludeModule("iblock")) { $dbIBlock = CIBlock::GetList(array(), array("CODE" => "departments")); if ($arIBlock = $dbIBlock->Fetch()) { $departmentIBlockID = $arIBlock["ID"]; } } $csvImport->AttachUsersToIBlock($departmentIBlockID); $csvImport->SetImageFilePath(WIZARD_SERVICE_RELATIVE_PATH . "/photos/"); $csvFile =& $csvImport->GetCsvObject(); $position = isset($_SESSION["WIZARD_USER_IMPORT_POSITION"]) && intval($_SESSION["WIZARD_USER_IMPORT_POSITION"]) > 0 ? intval($_SESSION["WIZARD_USER_IMPORT_POSITION"]) : false; if ($position !== false) { $csvFile->SetPos($position); } $userImportCnt = 0; while ($csvImport->ImportUser()) { $userImportCnt++; if ($userImportCnt >= 50) { $_SESSION["WIZARD_USER_IMPORT_POSITION"] = $csvFile->GetPos(); return; } } // moving all root departments into the one if (IntVal($departmentIBlockID) > 0) {