ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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.

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

References $DIC, $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 157 of file class.ilOrgUnitSimpleUserImportGUI.php.

158 {
159 if (!$importer->hasErrors() and !$importer->hasWarnings()) {
160 $stats = $importer->getStats();
161 ilUtil::sendSuccess(sprintf($this->lng->txt('user_import_successful'), $stats['created'], $stats['removed']), true);
162 }
163 if ($importer->hasWarnings()) {
164 $msg = $this->lng->txt('import_terminated_with_warnings') . '<br>';
165 foreach ($importer->getWarnings() as $warning) {
166 $msg .= '-' . $this->lng->txt($warning['lang_var']) . ' (Import ID: ' . $warning['import_id'] . ')<br>';
167 }
168 ilUtil::sendInfo($msg, true);
169 }
170 if ($importer->hasErrors()) {
171 $msg = $this->lng->txt('import_terminated_with_errors') . '<br>';
172 foreach ($importer->getErrors() as $warning) {
173 $msg .= '- ' . $this->lng->txt($warning['lang_var']) . ' (Import ID: ' . $warning['import_id'] . ')<br>';
174 }
175 ilUtil::sendFailure($msg, true);
176 }
177 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

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

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 75 of file class.ilOrgUnitSimpleUserImportGUI.php.

76 {
77 $cmd = $this->ctrl->getCmd();
78
79 $this->tabs_gui->clearTargets();
80 $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTargetByClass('ilOrgUnitSimpleImportGUI', 'chooseImport'));
81
82 switch ($cmd) {
83 case 'userImportScreen':
84 $this->userImportScreen();
85 break;
86 case 'startImport':
87 $this->startImport();
88 break;
89 }
90
91 return true;
92 }

References startImport(), and userImportScreen().

+ Here is the call graph for this function:

◆ initForm()

ilOrgUnitSimpleUserImportGUI::initForm ( )
protected

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

122 {
123 $form = new ilPropertyFormGUI();
124 $input = new ilFileInputGUI($this->lng->txt('import_xml_file'), 'import_file');
125 $input->setRequired(true);
126 $form->addItem($input);
127 $form->setFormAction($this->ctrl->getFormAction($this));
128 $form->addCommandButton('startImport', $this->lng->txt('import'));
129
130 return $form;
131 }
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 134 of file class.ilOrgUnitSimpleUserImportGUI.php.

135 {
136 $form = $this->initForm();
137 if (!$form->checkInput()) {
138 $this->tpl->setContent($form->getHTML());
139 } else {
140 $file = $form->getInput('import_file');
141 $importer = new ilOrgUnitSimpleUserImport();
142 try {
143 $importer->simpleUserImport($file['tmp_name']);
144 } catch (Exception $e) {
145 $this->ilLog->write($e->getMessage() . ' - ' . $e->getTraceAsString());
146 ilUtil::sendFailure($this->lng->txt('import_failed'), true);
147 $this->ctrl->redirect($this, 'render');
148 }
149 $this->displayImportResults($importer);
150 }
151 }
write($a_msg, $a_log_level=null)
logging
Class ilOrgUnitSimpleUserImport.

References Vendor\Package\$e, 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 105 of file class.ilOrgUnitSimpleUserImportGUI.php.

106 {
107 return false;
108 $importer = new ilOrgUnitSimpleUserImport();
109 $string = '<Assignment action=\'add\'>
110 <User id_type=\'ilias_login\'>root</User>
111 <OrgUnit id_type=\'external_id\'>imported_001</OrgUnit>
112 <Role>superior</Role>
113 </Assignment>';
114
115 $xml = new SimpleXMLElement($string);
116 $importer->simpleUserImportElement($xml);
117 ilUtil::sendInfo('<pre>' . print_r($importer->getErrors(), 1) . '</pre>');
118 }
$xml
Definition: metadata.php:332

References $xml, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ userImportScreen()

ilOrgUnitSimpleUserImportGUI::userImportScreen ( )

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

96 {
97 $form = $this->initForm();
98 $this->tpl->setContent($form->getHTML());
99 }

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: