ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 ()
 FSX Can be deleted; Just for a single Test of a UserImport
 initForm ()

Protected Attributes

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

Detailed Description

Constructor & Destructor Documentation

ilOrgUnitSimpleUserImportGUI::__construct (   $parent_gui)
Parameters
$parent_gui

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

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

{
global $tpl, $ilCtrl, $ilToolbar, $lng, $ilAccess, $log;
$this->tpl = $tpl;
$this->ctrl = $ilCtrl;
$this->parent_gui = $parent_gui;
$this->parent_object = $parent_gui->object;
$this->tabs_gui = $this->parent_gui->tabs_gui;
$this->toolbar = $ilToolbar;
$this->lng = $lng;
$this->ilLog = $log;
$this->ilAccess = $ilAccess;
$this->lng->loadLanguageModule('user');
if (!$this->ilAccess->checkaccess('write', '', $this->parent_gui->object->getRefId())) {
ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilOrgUnitSimpleUserImportGUI::displayImportResults (   $importer)
Parameters
$importerilOrgUnitImporter

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

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

Referenced by startImport().

{
if (!$importer->hasErrors() AND !$importer->hasWarnings()) {
$stats = $importer->getStats();
ilUtil::sendSuccess(sprintf($this->lng->txt('user_import_successful'), $stats['created'], $stats['removed']), true);
}
if ($importer->hasWarnings()) {
$msg = $this->lng->txt('import_terminated_with_warnings') . '<br>';
foreach ($importer->getWarnings() as $warning) {
$msg .= '-' . $this->lng->txt($warning['lang_var']) . ' (Import ID: ' . $warning['import_id'] . ')<br>';
}
ilUtil::sendInfo($msg, true);
}
if ($importer->hasErrors()) {
$msg = $this->lng->txt('import_terminated_with_errors') . '<br>';
foreach ($importer->getErrors() as $warning) {
$msg .= '- ' . $this->lng->txt($warning['lang_var']) . ' (Import ID: ' . $warning['import_id'] . ')<br>';
}
ilUtil::sendFailure($msg, true);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOrgUnitSimpleUserImportGUI::executeCommand ( )
Returns
bool

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

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

{
$cmd = $this->ctrl->getCmd();
switch ($cmd) {
case 'userImportScreen':
$this->userImportScreen();
break;
case 'startImport':
$this->startImport();
break;
}
return true;
}

+ Here is the call graph for this function:

ilOrgUnitSimpleUserImportGUI::initForm ( )
protected

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

References ilFormPropertyGUI\setRequired().

Referenced by startImport(), and userImportScreen().

{
$form = new ilPropertyFormGUI();
$input = new ilFileInputGUI($this->lng->txt('import_xml_file'), 'import_file');
$input->setRequired(true);
$form->addItem($input);
$form->setFormAction($this->ctrl->getFormAction($this));
$form->addCommandButton('startImport', $this->lng->txt('import'));
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOrgUnitSimpleUserImportGUI::startImport ( )

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

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

Referenced by executeCommand().

{
$form = $this->initForm();
if (!$form->checkInput()) {
$this->tpl->setContent($form->getHTML());
} else {
$file = $form->getInput('import_file');
$importer = new ilOrgUnitSimpleUserImport();
try {
$importer->simpleUserImport($file['tmp_name']);
} catch (Exception $e) {
$this->ilLog->write($e->getMessage() . ' - ' . $e->getTraceAsString());
ilUtil::sendFailure($this->lng->txt('import_failed'), true);
$this->ctrl->redirect($this, 'render');
}
$this->displayImportResults($importer);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOrgUnitSimpleUserImportGUI::testImport ( )
protected

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

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

References ilUtil\sendInfo().

{
return false;
$importer = new ilOrgUnitSimpleUserImport();
$string = '<Assignment action=\'add\'>
<User id_type=\'ilias_login\'>root</User>
<OrgUnit id_type=\'external_id\'>imported_001</OrgUnit>
<Role>superior</Role>
</Assignment>';
$xml = new SimpleXMLElement($string);
$importer->simpleUserImportElement($xml);
ilUtil::sendInfo('<pre>' . print_r($importer->getErrors(), 1) . '</pre>');
}

+ Here is the call graph for this function:

ilOrgUnitSimpleUserImportGUI::userImportScreen ( )

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

References initForm().

Referenced by executeCommand().

{
$form = $this->initForm();
$this->tpl->setContent($form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilOrgUnitSimpleUserImportGUI::$ctrl
protected

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

ilOrgUnitSimpleUserImportGUI::$ilAccess
protected

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

Referenced by __construct().

ilOrgUnitSimpleUserImportGUI::$lng
protected

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

Referenced by __construct().

ilOrgUnitSimpleUserImportGUI::$parent_object
protected

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

ilOrgUnitSimpleUserImportGUI::$tabs_gui
protected

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

ilOrgUnitSimpleUserImportGUI::$toolbar
protected

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

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: