3 require_once(
'class.ilOrgUnitSimpleUserImport.php');
51 $ilToolbar = $DIC[
'ilToolbar'];
57 $this->parent_gui = $parent_gui;
58 $this->parent_object = $parent_gui->object;
59 $this->tabs_gui = $this->parent_gui->tabs_gui;
60 $this->toolbar = $ilToolbar;
64 $this->lng->loadLanguageModule(
'user');
65 if (!$this->ilAccess->checkaccess(
'write',
'', $this->parent_gui->object->getRefId())) {
75 $cmd = $this->ctrl->getCmd();
77 $this->tabs_gui->clearTargets();
78 $this->tabs_gui->setBackTarget($this->lng->txt(
"back"), $this->ctrl->getLinkTargetByClass(
'ilOrgUnitSimpleImportGUI',
'chooseImport'));
81 case 'userImportScreen':
95 $this->tpl->setContent($form->getHTML());
105 $string =
'<Assignment action=\'add\'> 106 <User id_type=\'ilias_login\'>root</User> 107 <OrgUnit id_type=\'external_id\'>imported_001</OrgUnit> 108 <Role>superior</Role> 112 $importer->simpleUserImportElement($xml);
119 $input =
new ilFileInputGUI($this->lng->txt(
'import_xml_file'),
'import_file');
121 $form->addItem($input);
122 $form->setFormAction($this->ctrl->getFormAction($this));
123 $form->addCommandButton(
'startImport', $this->lng->txt(
'import'));
131 if (!$form->checkInput()) {
132 $this->tpl->setContent($form->getHTML());
134 $file = $form->getInput(
'import_file');
137 $importer->simpleUserImport(
$file[
'tmp_name']);
139 $this->
ilLog->
write($e->getMessage() .
' - ' . $e->getTraceAsString());
141 $this->ctrl->redirect($this,
'render');
152 if (!$importer->hasErrors() AND !$importer->hasWarnings()) {
153 $stats = $importer->getStats();
154 ilUtil::sendSuccess(sprintf($this->lng->txt(
'user_import_successful'), $stats[
'created'], $stats[
'removed']),
true);
156 if ($importer->hasWarnings()) {
157 $msg = $this->lng->txt(
'import_terminated_with_warnings') .
'<br>';
158 foreach ($importer->getWarnings() as $warning) {
159 $msg .=
'-' . $this->lng->txt($warning[
'lang_var']) .
' (Import ID: ' . $warning[
'import_id'] .
')<br>';
163 if ($importer->hasErrors()) {
164 $msg = $this->lng->txt(
'import_terminated_with_errors') .
'<br>';
165 foreach ($importer->getErrors() as $warning) {
166 $msg .=
'- ' . $this->lng->txt($warning[
'lang_var']) .
' (Import ID: ' . $warning[
'import_id'] .
')<br>';
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
displayImportResults($importer)
Class ilOrgUnitSimpleUserImport.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
write($a_msg, $a_log_level=NULL)
logging
testImport()
FSX Can be deleted; Just for a single Test of a UserImport
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilOrgUnitSimpleUserImportGUI.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file