ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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: ilParticipantsTestResultsGUI

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

Member Function Documentation

◆ buildExportTableGUI()

ilTestExportGUI::buildExportTableGUI ( )
protected
Returns
ilTestExportTableGUI

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

References $DIC, $ilCtrl, $lng, and $table.

Referenced by listExportFiles().

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

◆ createTestArchiveExport()

ilTestExportGUI::createTestArchiveExport ( )

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

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

102  {
103  global $DIC;
104  $ilAccess = $DIC['ilAccess'];
105  $ilCtrl = $DIC['ilCtrl'];
106  $ilDB = $DIC['ilDB'];
107  $lng = $DIC['lng'];
108 
109  if ($ilAccess->checkAccess("write", "", $this->obj->ref_id)) {
110  // prepare generation before contents are processed (for mathjax)
112 
113  require_once 'Modules/Test/classes/class.ilTestEvaluation.php';
114  $evaluation = new ilTestEvaluation($ilDB, $this->obj->getTestId());
115  $allActivesPasses = $evaluation->getAllActivesPasses();
116 
117  require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
118  $participantData = new ilTestParticipantData($ilDB, $lng);
119  $participantData->setActiveIdsFilter(array_keys($allActivesPasses));
120  $participantData->load($this->obj->getTestId());
121 
122  require_once 'Modules/Test/classes/class.ilTestArchiveService.php';
123  $archiveService = new ilTestArchiveService($this->obj);
124  $archiveService->setParticipantData($participantData);
125  $archiveService->archivePassesByActives($allActivesPasses);
126 
127  include_once("./Modules/Test/classes/class.ilTestArchiver.php");
128  $test_id = $this->obj->getId();
129  $archive_exp = new ilTestArchiver($test_id);
130 
131  require_once './Modules/Test/classes/class.ilTestScoring.php';
132  $scoring = new ilTestScoring($this->obj);
133  $best_solution = $scoring->calculateBestSolutionForTest();
134 
135  $tmpFileName = ilUtil::ilTempnam();
136  if (!is_dir($tmpFileName)) {
137  ilUtil::makeDirParents($tmpFileName);
138  }
139 
140  $directory_name = realpath($tmpFileName);
141  $file_name = $directory_name . DIRECTORY_SEPARATOR . 'Best_Solution.pdf';
142 
143  require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
144  $generator = new ilTestPDFGenerator();
145  $generator->generatePDF($best_solution, ilTestPDFGenerator::PDF_OUTPUT_FILE, $file_name, PDF_USER_RESULT);
146  $archive_exp->handInTestBestSolution($best_solution, $file_name);
147  ilUtil::delDir($directory_name);
148 
149  $archive_exp->updateTestArchive();
150  $archive_exp->compressTestArchive();
151  } else {
152  ilUtil::sendInfo("cannot_export_archive", true);
153  }
154  $ilCtrl->redirectByClass('iltestexportgui');
155  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
Class ilTestPDFGenerator.
global $DIC
Definition: saml.php:7
const PDF_USER_RESULT
PDF Purposes.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$lng
Class ilTestScoring.
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
Class ilTestArchiver.
global $ilDB
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static prepareGenerationRequest($service, $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
+ Here is the call graph for this function:

◆ listExportFiles()

ilTestExportGUI::listExportFiles ( )

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

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

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

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