ILIAS  Release_4_4_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

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

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

{
global $tpl, $ilCtrl, $ilTabs, $ilToolbar, $lng, $ilAccess;
$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->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 117 of file class.ilOrgUnitSimpleUserImportGUI.php.

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

Referenced by startImport().

{
if (! $importer->hasErrors() && ! $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 64 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 85 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 96 of file class.ilOrgUnitSimpleUserImportGUI.php.

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

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->wirte($e->getMessage() . " - " . $e->getTraceAsString());
ilUtil::sendFailure($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::userImportScreen ( )

Definition at line 79 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 23 of file class.ilOrgUnitSimpleUserImportGUI.php.

ilOrgUnitSimpleUserImportGUI::$ilAccess
protected

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

Referenced by __construct().

ilOrgUnitSimpleUserImportGUI::$lng
protected

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

Referenced by __construct(), and startImport().

ilOrgUnitSimpleUserImportGUI::$parent_object
protected

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

ilOrgUnitSimpleUserImportGUI::$tabs_gui
protected

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

ilOrgUnitSimpleUserImportGUI::$toolbar
protected

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

ilOrgUnitSimpleUserImportGUI::$tpl
protected

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

Referenced by __construct().


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