ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTestExportGUI Class Reference

Export User Interface Class. More...

+ Inheritance diagram for ilTestExportGUI:
+ Collaboration diagram for ilTestExportGUI:

Public Member Functions

 createTestArchiveExport ()
 listExportFiles ()
 List export files.
- Public Member Functions inherited from ilExportGUI
 __construct ($a_parent_gui, $a_main_obj=null)
 Constuctor.
 addFormat ($a_key, $a_txt="", $a_call_obj=null, $a_call_func="")
 Add formats.
 getFormats ()
 Get formats.
 addCustomColumn ($a_txt, $a_obj, $a_func)
 Add custom column.
 addCustomMultiCommand ($a_txt, $a_obj, $a_func)
 Add custom multi command.
 getCustomMultiCommands ()
 Get custom multi commands.
 getCustomColumns ()
 Get custom columns.
 executeCommand ()
 Execute command.
 createExportFile ()
 Create export file.
 confirmDeletion ()
 Confirm file deletion.
 delete ()
 Delete files.
 download ()
 Download file.
 handleCustomMultiCommand ()
 Handle custom multi command.

Additional Inherited Members

- Protected Member Functions inherited from ilExportGUI
 getParentGUI ()
 get parent gui
 showItemSelection ()
 Show container item selection table.
 saveItemSelection ()
 Save selection of subitems.
- Protected Attributes inherited from ilExportGUI
 $formats = array()
 $custom_columns = array()
 $custom_multi_commands = array()

Detailed Description

Export User Interface Class.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

ilTestExportGUI:

Definition at line 18 of file class.ilTestExportGUI.php.

Member Function Documentation

ilTestExportGUI::createTestArchiveExport ( )

Definition at line 89 of file class.ilTestExportGUI.php.

References $ilCtrl, ilTestPDFGenerator\PDF_OUTPUT_FILE, and ilUtil\sendInfo().

{
global $ilAccess, $ilCtrl;
if ($ilAccess->checkAccess("write", "", $this->obj->ref_id))
{
include_once("./Modules/Test/classes/class.ilTestArchiver.php");
$test_id = $this->obj->getId();
$archive_exp = new ilTestArchiver($test_id);
require_once './Modules/Test/classes/class.ilTestScoring.php';
$scoring = new ilTestScoring($this->obj);
$best_solution = $scoring->calculateBestSolutionForTest();
require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
$generator = new ilTestPDFGenerator();
$generator->generatePDF($best_solution, ilTestPDFGenerator::PDF_OUTPUT_FILE, 'Best_Solution.pdf');
$archive_exp->handInTestBestSolution($best_solution, 'Best_Solution.pdf');
unlink('Best_Solution.pdf');
$archive_exp->updateTestArchive();
$archive_exp->compressTestArchive();
}
else
{
ilUtil::sendInfo("cannot_export_archive", TRUE);
}
$ilCtrl->redirectByClass('iltestexportgui');
}

+ Here is the call graph for this function:

ilTestExportGUI::listExportFiles ( )

List export files.

Parameters
@return

Reimplemented from ilExportGUI.

Definition at line 119 of file class.ilTestExportGUI.php.

References $ilCtrl, $lng, $options, $si, $tpl, ilExportGUI\getCustomColumns(), ilExportGUI\getCustomMultiCommands(), ilExportGUI\getFormats(), ilExportGUI\getParentGUI(), and ilTestArchiver\getZipExportDirectory().

{
global $tpl, $ilToolbar, $ilCtrl, $lng;
$ilToolbar->setFormAction($ilCtrl->getFormAction($this));
if(count($this->getFormats()) > 1)
{
foreach($this->getFormats() as $f)
{
$options[$f["key"]] = $f["txt"];
}
include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
$si = new ilSelectInputGUI($lng->txt("type"), "format");
$si->setOptions($options);
$ilToolbar->addInputItem($si, true);
$ilToolbar->addFormButton($lng->txt("exp_create_file"), "createExportFile");
}
else
{
$format = $this->getFormats();
$format = $format[0];
$ilToolbar->addFormButton($lng->txt("exp_create_file") . " (" . $format["txt"] . ")", "create_" . $format["key"]);
}
require_once 'class.ilTestArchiver.php';
$archiver = new ilTestArchiver($this->getParentGUI()->object->getId());
$archive_dir = $archiver->getZipExportDirectory();
$archive_files = array();
if( file_exists($archive_dir) && is_dir($archive_dir) )
{
$archive_files = scandir($archive_dir);
}
$export_dir = $this->obj->getExportDirectory();
$export_files = $this->obj->getExportFiles($export_dir);
$data = array();
if(count($export_files) > 0)
{
foreach($export_files as $exp_file)
{
$file_arr = explode("__", $exp_file);
array_push($data, array(
'file' => $exp_file,
'size' => filesize($export_dir . "/" . $exp_file),
'timestamp' => $file_arr[0]
));
}
}
if(count($archive_files) > 0)
{
foreach($archive_files as $exp_file)
{
if ($exp_file == '.' || $exp_file == '..')
{
continue;
}
$file_arr = explode("_", $exp_file);
array_push($data, array(
'file' => $exp_file,
'size' => filesize($archive_dir."/".$exp_file),
'timestamp' => $file_arr[4]
));
}
}
require_once 'Modules/Test/classes/tables/class.ilTestExportTableGUI.php';
$table = new ilTestExportTableGUI($this, 'listExportFiles', $this->obj);
$table->setSelectAllCheckbox("file");
foreach($this->getCustomColumns() as $c)
{
$table->addCustomColumn($c["txt"], $c["obj"], $c["func"]);
}
foreach($this->getCustomMultiCommands() as $c)
{
$table->addCustomMultiCommand($c["txt"], "multi_".$c["func"]);
}
$table->setData($data);
$tpl->setContent($table->getHTML());
}

+ Here is the call graph for this function:


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