ILIAS  release_8 Revision v8.24
ilOrgUnitSimpleUserImportGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilOrgUnitSimpleUserImportGUI:

Public Member Functions

 __construct (object $parent_gui)
 
 executeCommand ()
 
 userImportScreen ()
 
 startImport ()
 
 displayImportResults (ilOrgUnitImporter $importer)
 

Protected Attributes

ilTabsGUI $tabs_gui
 
ilToolbarGUI $toolbar
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
object $parent_object
 
object $parent_gui
 
ilLanguage $lng
 
ilAccessHandler $ilAccess
 
ILIAS DI LoggingServices $ilLog
 

Private Member Functions

 initForm ()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilOrgUnitSimpleUserImportGUI

Author
Oskar Truffer ot@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Martin Studer ms@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 26 of file class.ilOrgUnitSimpleUserImportGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitSimpleUserImportGUI::__construct ( object  $parent_gui)

Definition at line 39 of file class.ilOrgUnitSimpleUserImportGUI.php.

40 {
41 global $DIC;
42 $this->tpl = $DIC->ui()->mainTemplate();
43 $this->ctrl = $DIC->ctrl();
44 $this->parent_gui = $parent_gui;
45 $this->parent_object = $parent_gui->getObject();
46 $this->tabs_gui = $DIC->tabs();
47 $this->toolbar = $DIC->toolbar();
48 $this->lng = $DIC->language();
49 $this->ilLog = $DIC->logger();
50 $this->ilAccess = $DIC->access();
51 $this->lng->loadLanguageModule('user');
52 if (!$this->ilAccess->checkaccess('write', '', $this->parent_gui->getObject()->getRefId())) {
53 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
54 }
55 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilLog.php:31
global $DIC
Definition: feed.php:28

References $DIC, $parent_gui, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ displayImportResults()

ilOrgUnitSimpleUserImportGUI::displayImportResults ( ilOrgUnitImporter  $importer)

Definition at line 116 of file class.ilOrgUnitSimpleUserImportGUI.php.

116 : void
117 {
118 if (!$importer->hasErrors() and !$importer->hasWarnings()) {
119 $stats = $importer->getStats();
120 $this->tpl->setOnScreenMessage(
121 'success',
122 sprintf($this->lng->txt('user_import_successful'), $stats['created'], $stats['removed']),
123 true
124 );
125 }
126 if ($importer->hasWarnings()) {
127 $msg = $this->lng->txt('import_terminated_with_warnings') . '<br>';
128 foreach ($importer->getWarnings() as $warning) {
129 $msg .= '-' . $this->lng->txt($warning['lang_var']) . ' (Import ID: ' . $warning['import_id'] . ')<br>';
130 }
131 $this->tpl->setOnScreenMessage('info', $msg, true);
132 }
133 if ($importer->hasErrors()) {
134 $msg = $this->lng->txt('import_terminated_with_errors') . '<br>';
135 foreach ($importer->getErrors() as $warning) {
136 $msg .= '- ' . $this->lng->txt($warning['lang_var']) . ' (Import ID: ' . $warning['import_id'] . ')<br>';
137 }
138 $this->tpl->setOnScreenMessage('failure', $msg, true);
139 }
140 }

References ilOrgUnitImporter\getErrors(), ilOrgUnitImporter\getStats(), ilOrgUnitImporter\getWarnings(), ilOrgUnitImporter\hasErrors(), ilOrgUnitImporter\hasWarnings(), and ILIAS\Repository\lng().

Referenced by startImport().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilOrgUnitSimpleUserImportGUI::executeCommand ( )

Definition at line 57 of file class.ilOrgUnitSimpleUserImportGUI.php.

57 : bool
58 {
59 $cmd = $this->ctrl->getCmd();
60
61 $this->tabs_gui->clearTargets();
62 $this->tabs_gui->setBackTarget(
63 $this->lng->txt("back"),
64 $this->ctrl->getLinkTargetByClass('ilOrgUnitSimpleImportGUI', 'chooseImport')
65 );
66
67 switch ($cmd) {
68 case 'userImportScreen':
69 $this->userImportScreen();
70 break;
71 case 'startImport':
72 $this->startImport();
73 break;
74 }
75
76 return true;
77 }

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), startImport(), and userImportScreen().

+ Here is the call graph for this function:

◆ initForm()

ilOrgUnitSimpleUserImportGUI::initForm ( )
private

Definition at line 85 of file class.ilOrgUnitSimpleUserImportGUI.php.

86 {
87 $form = new ilPropertyFormGUI();
88 $input = new ilFileInputGUI($this->lng->txt('import_xml_file'), 'import_file');
89 $input->setRequired(true);
90 $form->addItem($input);
91 $form->setFormAction($this->ctrl->getFormAction($this));
92 $form->addCommandButton('startImport', $this->lng->txt('import'));
93
94 return $form;
95 }
This class represents a file property in a property form.
This class represents a property form user interface.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by startImport(), and userImportScreen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startImport()

ilOrgUnitSimpleUserImportGUI::startImport ( )

Definition at line 97 of file class.ilOrgUnitSimpleUserImportGUI.php.

97 : void
98 {
99 $form = $this->initForm();
100 if (!$form->checkInput()) {
101 $this->tpl->setContent($form->getHTML());
102 } else {
103 $file = $form->getInput('import_file');
104 $importer = new ilOrgUnitSimpleUserImport();
105 try {
106 $importer->simpleUserImport($file['tmp_name']);
107 } catch (Exception $e) {
108 $this->ilLog->write($e->getMessage() . ' - ' . $e->getTraceAsString());
109 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_failed'), true);
110 $this->ctrl->redirect($this, 'render');
111 }
112 $this->displayImportResults($importer);
113 }
114 }
write(string $a_msg, $a_log_level=null)
logging
displayImportResults(ilOrgUnitImporter $importer)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References Vendor\Package\$e, ILIAS\Repository\ctrl(), displayImportResults(), initForm(), ILIAS\Repository\lng(), and ilLog\write().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userImportScreen()

ilOrgUnitSimpleUserImportGUI::userImportScreen ( )

Definition at line 79 of file class.ilOrgUnitSimpleUserImportGUI.php.

79 : void
80 {
81 $form = $this->initForm();
82 $this->tpl->setContent($form->getHTML());
83 }

References initForm().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilOrgUnitSimpleUserImportGUI::$ctrl
protected

Definition at line 30 of file class.ilOrgUnitSimpleUserImportGUI.php.

◆ $ilAccess

ilAccessHandler ilOrgUnitSimpleUserImportGUI::$ilAccess
protected

Definition at line 35 of file class.ilOrgUnitSimpleUserImportGUI.php.

◆ $ilLog

ILIAS DI LoggingServices ilOrgUnitSimpleUserImportGUI::$ilLog
protected

Definition at line 36 of file class.ilOrgUnitSimpleUserImportGUI.php.

◆ $lng

ilLanguage ilOrgUnitSimpleUserImportGUI::$lng
protected

Definition at line 34 of file class.ilOrgUnitSimpleUserImportGUI.php.

◆ $parent_gui

object ilOrgUnitSimpleUserImportGUI::$parent_gui
protected

Definition at line 33 of file class.ilOrgUnitSimpleUserImportGUI.php.

Referenced by __construct().

◆ $parent_object

object ilOrgUnitSimpleUserImportGUI::$parent_object
protected

Definition at line 32 of file class.ilOrgUnitSimpleUserImportGUI.php.

◆ $tabs_gui

ilTabsGUI ilOrgUnitSimpleUserImportGUI::$tabs_gui
protected

Definition at line 28 of file class.ilOrgUnitSimpleUserImportGUI.php.

◆ $toolbar

ilToolbarGUI ilOrgUnitSimpleUserImportGUI::$toolbar
protected

Definition at line 29 of file class.ilOrgUnitSimpleUserImportGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilOrgUnitSimpleUserImportGUI::$tpl
protected

Definition at line 31 of file class.ilOrgUnitSimpleUserImportGUI.php.


The documentation for this class was generated from the following file: