ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTestExportGUI Class Reference

Export User Interface Class. More...

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

Public Member Functions

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

Protected Member Functions

 buildExportTableGUI ()
 
- Protected Member Functions inherited from ilExportGUI
 buildExportTableGUI ()
 
 getParentGUI ()
 get parent gui More...
 
 showItemSelection ()
 Show container item selection table. More...
 
 saveItemSelection ()
 Save selection of subitems. More...
 

Additional Inherited Members

- 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

◆ buildExportTableGUI()

ilTestExportGUI::buildExportTableGUI ( )
protected
Returns
ilTestExportTableGUI

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

References $ilCtrl, $lng, $table, and ilUtil\sendSuccess().

Referenced by listExportFiles().

51  {
52  require_once 'Modules/Test/classes/tables/class.ilTestExportTableGUI.php';
53  $table = new ilTestExportTableGUI($this, 'listExportFiles', $this->obj);
54  return $table;
55  }
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createTestArchiveExport()

ilTestExportGUI::createTestArchiveExport ( )

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

References $ilCtrl, $ilDB, $lng, ilUtil\delDir(), ilTestEvaluation\getAllActivesPasses(), ilUtil\ilTempnam(), ilUtil\makeDirParents(), ilTestPDFGenerator\PDF_OUTPUT_FILE, PDF_USER_RESULT, ilPDFGeneration\prepareGeneration(), and ilUtil\sendInfo().

97  {
98  global $ilAccess, $ilCtrl, $ilDB, $lng;
99 
100  if ($ilAccess->checkAccess("write", "", $this->obj->ref_id)) {
101  // prepare generation before contents are processed (for mathjax)
102  require_once 'Services/PDFGeneration/classes/class.ilPDFGeneration.php';
104 
105  require_once 'Modules/Test/classes/class.ilTestEvaluation.php';
106  $evaluation = new ilTestEvaluation($ilDB, $this->obj->getTestId());
107  $allActivesPasses = $evaluation->getAllActivesPasses();
108 
109  require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
110  $participantData = new ilTestParticipantData($ilDB, $lng);
111  $participantData->setActiveIds(array_keys($allActivesPasses));
112  $participantData->load($this->obj->getTestId());
113 
114  require_once 'Modules/Test/classes/class.ilTestArchiveService.php';
115  $archiveService = new ilTestArchiveService($this->obj);
116  $archiveService->setParticipantData($participantData);
117  $archiveService->archivePassesByActives($allActivesPasses);
118 
119  include_once("./Modules/Test/classes/class.ilTestArchiver.php");
120  $test_id = $this->obj->getId();
121  $archive_exp = new ilTestArchiver($test_id);
122 
123  require_once './Modules/Test/classes/class.ilTestScoring.php';
124  $scoring = new ilTestScoring($this->obj);
125  $best_solution = $scoring->calculateBestSolutionForTest();
126 
127  $tmpFileName = ilUtil::ilTempnam();
128  if (!is_dir($tmpFileName)) {
129  ilUtil::makeDirParents($tmpFileName);
130  }
131 
132  $directory_name = realpath($tmpFileName);
133  $file_name = $directory_name . DIRECTORY_SEPARATOR . 'Best_Solution.pdf';
134 
135  require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
136  $generator = new ilTestPDFGenerator();
137  $generator->generatePDF($best_solution, ilTestPDFGenerator::PDF_OUTPUT_FILE, $file_name, PDF_USER_RESULT);
138  $archive_exp->handInTestBestSolution($best_solution, $file_name);
139  ilUtil::delDir($directory_name);
140 
141  $archive_exp->updateTestArchive();
142  $archive_exp->compressTestArchive();
143  } else {
144  ilUtil::sendInfo("cannot_export_archive", true);
145  }
146  $ilCtrl->redirectByClass('iltestexportgui');
147  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
Class ilTestPDFGenerator.
const PDF_USER_RESULT
PDF Purposes.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class ilTestScoring.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static prepareGeneration()
Prepare the PDF generation This initializes the purpose for MathJax rendering It has to be called bef...
Class ilTestArchiver.
global $lng
Definition: privfeed.php:17
global $ilDB
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ listExportFiles()

ilTestExportGUI::listExportFiles ( )

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

References $_GET, $_POST, $data, $file, $filename, $format, $ilCtrl, $lng, $options, $si, $table, $tpl, array, buildExportTableGUI(), ilUtil\delDir(), ilUtil\deliverFile(), ilExportGUI\download(), ilExportGUI\getCustomColumns(), ilExportGUI\getCustomMultiCommands(), ilExportGUI\getFormats(), ilExportGUI\getParentGUI(), ilTestArchiver\getZipExportDirectory(), object, ilUtil\sendInfo(), and ilUtil\sendSuccess().

150  {
151  global $tpl, $ilToolbar, $ilCtrl, $lng;
152 
153  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
154 
155  if (count($this->getFormats()) > 1) {
156  foreach ($this->getFormats() as $f) {
157  $options[$f["key"]] = $f["txt"];
158  }
159  include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
160  $si = new ilSelectInputGUI($lng->txt("type"), "format");
161  $si->setOptions($options);
162  $ilToolbar->addInputItem($si, true);
163  $ilToolbar->addFormButton($lng->txt("exp_create_file"), "createExportFile");
164  } else {
165  $format = $this->getFormats();
166  $format = $format[0];
167  $ilToolbar->addFormButton($lng->txt("exp_create_file") . " (" . $format["txt"] . ")", "create_" . $format["key"]);
168  }
169 
170  require_once 'class.ilTestArchiver.php';
171  $archiver = new ilTestArchiver($this->getParentGUI()->object->getId());
172  $archive_dir = $archiver->getZipExportDirectory();
173  $archive_files = array();
174  if (file_exists($archive_dir) && is_dir($archive_dir)) {
175  $archive_files = scandir($archive_dir);
176  }
177 
178  $export_dir = $this->obj->getExportDirectory();
179  $export_files = $this->obj->getExportFiles($export_dir);
180  $data = array();
181  if (count($export_files) > 0) {
182  foreach ($export_files as $exp_file) {
183  $file_arr = explode("__", $exp_file);
184  array_push($data, array(
185  'file' => $exp_file,
186  'size' => filesize($export_dir . "/" . $exp_file),
187  'timestamp' => $file_arr[0]
188  ));
189  }
190  }
191 
192  if (count($archive_files) > 0) {
193  foreach ($archive_files as $exp_file) {
194  if ($exp_file == '.' || $exp_file == '..') {
195  continue;
196  }
197  $file_arr = explode("_", $exp_file);
198  array_push($data, array(
199  'file' => $exp_file,
200  'size' => filesize($archive_dir . "/" . $exp_file),
201  'timestamp' => $file_arr[4]
202  ));
203  }
204  }
205 
206  $table = $this->buildExportTableGUI();
207  $table->setSelectAllCheckbox("file");
208  foreach ($this->getCustomColumns() as $c) {
209  $table->addCustomColumn($c["txt"], $c["obj"], $c["func"]);
210  }
211 
212  foreach ($this->getCustomMultiCommands() as $c) {
213  $table->addCustomMultiCommand($c["txt"], "multi_" . $c["func"]);
214  }
215 
216  $table->setData($data);
217  $tpl->setContent($table->getHTML());
218  }
$format
Definition: metadata.php:141
This class represents a selection list property in a property form.
$tpl
Definition: ilias.php:10
global $ilCtrl
Definition: ilias.php:18
getCustomColumns()
Get custom columns.
getZipExportDirectory()
Return the export directory, where zips are placed.
Create styles array
The data for the language used.
getFormats()
Get formats.
getCustomMultiCommands()
Get custom multi commands.
Class ilTestArchiver.
Create new PHPExcel object
obj_idprivate
global $lng
Definition: privfeed.php:17
if(empty($password)) $table
Definition: pwgen.php:24
getParentGUI()
get parent gui
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ Here is the call graph for this function:

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