ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilOrgUnitSimpleUserImportGUI Class Reference

Class ilOrgUnitSimpleUserImportGUI. More...

+ Collaboration diagram for ilOrgUnitSimpleUserImportGUI:

Public Member Functions

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

Protected Member Functions

 testImport ()
 @description FSX Can be deleted; Just for a single Test of a UserImport More...
 
 initForm ()
 

Protected Attributes

 $tabs_gui
 
 $toolbar
 
 $ctrl
 
 $tpl
 
 $parent_object
 
 $lng
 
 $ilAccess
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitSimpleUserImportGUI::__construct (   $parent_gui)
Parameters
$parent_gui

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

47 {
48 global $tpl, $ilCtrl, $ilToolbar, $lng, $ilAccess, $log;
49 $this->tpl = $tpl;
50 $this->ctrl = $ilCtrl;
51 $this->parent_gui = $parent_gui;
52 $this->parent_object = $parent_gui->object;
53 $this->tabs_gui = $this->parent_gui->tabs_gui;
54 $this->toolbar = $ilToolbar;
55 $this->lng = $lng;
56 $this->ilLog = $log;
57 $this->ilAccess = $ilAccess;
58 $this->lng->loadLanguageModule('user');
59 if (!$this->ilAccess->checkaccess('write', '', $this->parent_gui->object->getRefId())) {
60 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
61 }
62 }
logging
Definition: class.ilLog.php:19
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilCtrl
Definition: ilias.php:18

References $ilAccess, $ilCtrl, $lng, $log, $tpl, and ilUtil\sendFailure().

+ Here is the call graph for this function:

Member Function Documentation

◆ displayImportResults()

ilOrgUnitSimpleUserImportGUI::displayImportResults (   $importer)
Parameters
$importerilOrgUnitImporter

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

142 {
143 if (!$importer->hasErrors() AND !$importer->hasWarnings()) {
144 $stats = $importer->getStats();
145 ilUtil::sendSuccess(sprintf($this->lng->txt('user_import_successful'), $stats['created'], $stats['removed']), true);
146 }
147 if ($importer->hasWarnings()) {
148 $msg = $this->lng->txt('import_terminated_with_warnings') . '<br>';
149 foreach ($importer->getWarnings() as $warning) {
150 $msg .= '-' . $this->lng->txt($warning['lang_var']) . ' (Import ID: ' . $warning['import_id'] . ')<br>';
151 }
152 ilUtil::sendInfo($msg, true);
153 }
154 if ($importer->hasErrors()) {
155 $msg = $this->lng->txt('import_terminated_with_errors') . '<br>';
156 foreach ($importer->getErrors() as $warning) {
157 $msg .= '- ' . $this->lng->txt($warning['lang_var']) . ' (Import ID: ' . $warning['import_id'] . ')<br>';
158 }
159 ilUtil::sendFailure($msg, true);
160 }
161 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

Referenced by startImport().

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

◆ executeCommand()

ilOrgUnitSimpleUserImportGUI::executeCommand ( )
Returns
bool

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

68 {
69 $cmd = $this->ctrl->getCmd();
70
71 switch ($cmd) {
72 case 'userImportScreen':
73 $this->userImportScreen();
74 break;
75 case 'startImport':
76 $this->startImport();
77 break;
78 }
79
80 return true;
81 }
$cmd
Definition: sahs_server.php:35

References $cmd, startImport(), and userImportScreen().

+ Here is the call graph for this function:

◆ initForm()

ilOrgUnitSimpleUserImportGUI::initForm ( )
protected

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

108 {
109 $form = new ilPropertyFormGUI();
110 $input = new ilFileInputGUI($this->lng->txt('import_xml_file'), 'import_file');
111 $input->setRequired(true);
112 $form->addItem($input);
113 $form->setFormAction($this->ctrl->getFormAction($this));
114 $form->addCommandButton('startImport', $this->lng->txt('import'));
115
116 return $form;
117 }
This class represents a file property in a property form.
This class represents a property form user interface.

Referenced by startImport(), and userImportScreen().

+ Here is the caller graph for this function:

◆ startImport()

ilOrgUnitSimpleUserImportGUI::startImport ( )

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

120 {
121 $form = $this->initForm();
122 if (!$form->checkInput()) {
123 $this->tpl->setContent($form->getHTML());
124 } else {
125 $file = $form->getInput('import_file');
126 $importer = new ilOrgUnitSimpleUserImport();
127 try {
128 $importer->simpleUserImport($file['tmp_name']);
129 } catch (Exception $e) {
130 $this->ilLog->write($e->getMessage() . ' - ' . $e->getTraceAsString());
131 ilUtil::sendFailure($this->lng->txt('import_failed'), true);
132 $this->ctrl->redirect($this, 'render');
133 }
134 $this->displayImportResults($importer);
135 }
136 }
print $file
write($a_msg, $a_log_level=NULL)
Class ilOrgUnitSimpleUserImport.

References $file, displayImportResults(), initForm(), ilUtil\sendFailure(), and ilLog\write().

Referenced by executeCommand().

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

◆ testImport()

ilOrgUnitSimpleUserImportGUI::testImport ( )
protected

@description FSX Can be deleted; Just for a single Test of a UserImport

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

93 {
94 return false;
95 $importer = new ilOrgUnitSimpleUserImport();
96 $string = '<Assignment action=\'add\'>
97 <User id_type=\'ilias_login\'>root</User>
98 <OrgUnit id_type=\'external_id\'>imported_001</OrgUnit>
99 <Role>superior</Role>
100 </Assignment>';
101
102 $xml = new SimpleXMLElement($string);
103 $importer->simpleUserImportElement($xml);
104 ilUtil::sendInfo('<pre>' . print_r($importer->getErrors(), 1) . '</pre>');
105 }

References ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ userImportScreen()

ilOrgUnitSimpleUserImportGUI::userImportScreen ( )

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

84 {
85 $form = $this->initForm();
86 $this->tpl->setContent($form->getHTML());
87 }

References initForm().

Referenced by executeCommand().

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

Field Documentation

◆ $ctrl

ilOrgUnitSimpleUserImportGUI::$ctrl
protected

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

◆ $ilAccess

ilOrgUnitSimpleUserImportGUI::$ilAccess
protected

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

Referenced by __construct().

◆ $lng

ilOrgUnitSimpleUserImportGUI::$lng
protected

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

Referenced by __construct().

◆ $parent_object

ilOrgUnitSimpleUserImportGUI::$parent_object
protected

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

◆ $tabs_gui

ilOrgUnitSimpleUserImportGUI::$tabs_gui
protected

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

◆ $toolbar

ilOrgUnitSimpleUserImportGUI::$toolbar
protected

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

◆ $tpl

ilOrgUnitSimpleUserImportGUI::$tpl
protected

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

Referenced by __construct().


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