ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 25 of file class.ilOrgUnitSimpleUserImportGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitSimpleUserImportGUI::__construct ( object  $parent_gui)

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

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

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

Member Function Documentation

◆ displayImportResults()

ilOrgUnitSimpleUserImportGUI::displayImportResults ( ilOrgUnitImporter  $importer)

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

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

Referenced by startImport().

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

◆ executeCommand()

ilOrgUnitSimpleUserImportGUI::executeCommand ( )

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

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

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

◆ initForm()

ilOrgUnitSimpleUserImportGUI::initForm ( )
private

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

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

Referenced by startImport(), and userImportScreen().

85  {
86  $form = new ilPropertyFormGUI();
87  $input = new ilFileInputGUI($this->lng->txt('import_xml_file'), 'import_file');
88  $input->setRequired(true);
89  $form->addItem($input);
90  $form->setFormAction($this->ctrl->getFormAction($this));
91  $form->addCommandButton('startImport', $this->lng->txt('import'));
92 
93  return $form;
94  }
This class represents a file property in a property form.
setRequired(bool $a_required)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startImport()

ilOrgUnitSimpleUserImportGUI::startImport ( )

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

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

Referenced by executeCommand().

96  : void
97  {
98  $form = $this->initForm();
99  if (!$form->checkInput()) {
100  $this->tpl->setContent($form->getHTML());
101  } else {
102  $file = $form->getInput('import_file');
103  $importer = new ilOrgUnitSimpleUserImport();
104  try {
105  $importer->simpleUserImport($file['tmp_name']);
106  } catch (Exception $e) {
107  $this->ilLog->write($e->getMessage() . ' - ' . $e->getTraceAsString());
108  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('import_failed'), true);
109  $this->ctrl->redirect($this, 'render');
110  }
111  $this->displayImportResults($importer);
112  }
113  }
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:30
displayImportResults(ilOrgUnitImporter $importer)
write(string $a_msg, $a_log_level=null)
logging
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userImportScreen()

ilOrgUnitSimpleUserImportGUI::userImportScreen ( )

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

References initForm().

Referenced by executeCommand().

78  : void
79  {
80  $form = $this->initForm();
81  $this->tpl->setContent($form->getHTML());
82  }
+ 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 29 of file class.ilOrgUnitSimpleUserImportGUI.php.

◆ $ilAccess

ilAccessHandler ilOrgUnitSimpleUserImportGUI::$ilAccess
protected

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

◆ $ilLog

ILIAS DI LoggingServices ilOrgUnitSimpleUserImportGUI::$ilLog
protected

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

◆ $lng

ilLanguage ilOrgUnitSimpleUserImportGUI::$lng
protected

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

◆ $parent_gui

object ilOrgUnitSimpleUserImportGUI::$parent_gui
protected

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

Referenced by __construct().

◆ $parent_object

object ilOrgUnitSimpleUserImportGUI::$parent_object
protected

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

◆ $tabs_gui

ilTabsGUI ilOrgUnitSimpleUserImportGUI::$tabs_gui
protected

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

◆ $toolbar

ilToolbarGUI ilOrgUnitSimpleUserImportGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilOrgUnitSimpleUserImportGUI::$tpl
protected

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


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