ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestExportGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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...
 
 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 31 of file class.ilTestExportGUI.php.

Member Function Documentation

◆ buildExportTableGUI()

ilTestExportGUI::buildExportTableGUI ( )
protected

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

References $DIC, and $lng.

Referenced by listExportFiles().

62  {
63  require_once 'Modules/Test/classes/tables/class.ilTestExportTableGUI.php';
64  $table = new ilTestExportTableGUI($this, 'listExportFiles', $this->obj);
65  return $table;
66  }
+ Here is the caller graph for this function:

◆ createTestArchiveExport()

ilTestExportGUI::createTestArchiveExport ( )

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

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

112  {
113  global $DIC;
114  $ilAccess = $DIC['ilAccess'];
115  $ilCtrl = $DIC['ilCtrl'];
116  $ilDB = $DIC['ilDB'];
117  $lng = $DIC['lng'];
118 
119  if ($ilAccess->checkAccess("write", "", $this->obj->ref_id)) {
120  // prepare generation before contents are processed (for mathjax)
122 
123  require_once 'Modules/Test/classes/class.ilTestEvaluation.php';
124  $evaluation = new ilTestEvaluation($ilDB, $this->obj->getTestId());
125  $allActivesPasses = $evaluation->getAllActivesPasses();
126 
127  $participantData = new ilTestParticipantData($ilDB, $lng);
128  $participantData->setActiveIdsFilter(array_keys($allActivesPasses));
129  $participantData->load($this->obj->getTestId());
130 
131  require_once 'Modules/Test/classes/class.ilTestArchiveService.php';
132  $archiveService = new ilTestArchiveService($this->obj);
133  $archiveService->setParticipantData($participantData);
134  $archiveService->archivePassesByActives($allActivesPasses);
135 
136  include_once("./Modules/Test/classes/class.ilTestArchiver.php");
137  $test_id = $this->obj->getId();
138  $archive_exp = new ilTestArchiver($test_id);
139 
140  require_once './Modules/Test/classes/class.ilTestScoring.php';
141  $scoring = new ilTestScoring($this->obj);
142  $best_solution = $scoring->calculateBestSolutionForTest();
143 
144  $tmpFileName = ilUtil::ilTempnam();
145  if (!is_dir($tmpFileName)) {
146  ilUtil::makeDirParents($tmpFileName);
147  }
148 
149  $directory_name = realpath($tmpFileName);
150  $file_name = $directory_name . DIRECTORY_SEPARATOR . 'Best_Solution.pdf';
151 
152  require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
153  $generator = new ilTestPDFGenerator();
154  $generator->generatePDF($best_solution, ilTestPDFGenerator::PDF_OUTPUT_FILE, $file_name, PDF_USER_RESULT);
155  $archive_exp->handInTestBestSolution($best_solution, $file_name);
156  ilUtil::delDir($directory_name);
157 
158  $archive_exp->updateTestArchive();
159  $archive_exp->compressTestArchive();
160  } else {
161  ilUtil::sendInfo("cannot_export_archive", true);
162  }
163  $ilCtrl->redirectByClass('iltestexportgui');
164  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const PDF_USER_RESULT
PDF Purposes.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$lng
global $DIC
Definition: goto.php:24
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 166 of file class.ilTestExportGUI.php.

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

167  {
168  global $DIC;
169  $tpl = $DIC['tpl'];
170  $ilToolbar = $DIC['ilToolbar'];
171  $ilCtrl = $DIC['ilCtrl'];
172  $lng = $DIC['lng'];
173 
174  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
175 
176  if (count($this->getFormats()) > 1) {
177  foreach ($this->getFormats() as $f) {
178  $options[$f["key"]] = $f["txt"];
179  }
180  include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
181  $si = new ilSelectInputGUI($lng->txt("type"), "format");
182  $si->setOptions($options);
183  $ilToolbar->addInputItem($si, true);
184  $ilToolbar->addFormButton($lng->txt("exp_create_file"), "createExportFile");
185  } else {
186  $format = $this->getFormats();
187  $format = $format[0];
188  $ilToolbar->addFormButton($lng->txt("exp_create_file") . " (" . $format["txt"] . ")", "create_" . $format["key"]);
189  }
190 
191  require_once 'class.ilTestArchiver.php';
192  $archiver = new ilTestArchiver($this->getParentGUI()->object->getId());
193  $archive_dir = $archiver->getZipExportDirectory();
194  $archive_files = array();
195 
196  if (file_exists($archive_dir) && is_dir($archive_dir)) {
197  $archive_files = scandir($archive_dir);
198  }
199 
200  $export_dir = $this->obj->getExportDirectory();
201  $export_files = $this->obj->getExportFiles($export_dir);
202  $data = array();
203  if (count($export_files) > 0) {
204  foreach ($export_files as $exp_file) {
205  $file_arr = explode("__", $exp_file);
206  if ($file_arr[0] == $exp_file) {
207  continue;
208  }
209 
210  array_push($data, array(
211  'file' => $exp_file,
212  'size' => filesize($export_dir . "/" . $exp_file),
213  'timestamp' => $file_arr[0]
214  ));
215  }
216  }
217 
218  if (count($archive_files) > 0) {
219  foreach ($archive_files as $exp_file) {
220  if ($exp_file == '.' || $exp_file == '..') {
221  continue;
222  }
223  $file_arr = explode("_", $exp_file);
224 
225  $data[] = [
226  'file' => $exp_file,
227  'size' => filesize($archive_dir . "/" . $exp_file),
228  'timestamp' => $file_arr[4],
229  ];
230  }
231  }
232 
233  $table = $this->buildExportTableGUI();
234  $table->setSelectAllCheckbox("file");
235  foreach ($this->getCustomColumns() as $c) {
236  $table->addCustomColumn($c["txt"], $c["obj"], $c["func"]);
237  }
238 
239  foreach ($this->getCustomMultiCommands() as $c) {
240  $table->addCustomMultiCommand($c["txt"], "multi_" . $c["func"]);
241  }
242 
243  $table->resetFormats();
244  foreach ($this->formats as $format) {
245  $table->addFormat($format['key']);
246  }
247 
248  $table->setData($data);
249  $this->tpl->setOnScreenMessage('info', $lng->txt('no_manual_feedback_export_info'), true);
250  $tpl->setContent($table->getHTML());
251  }
$data
Definition: storeScorm.php:23
$c
Definition: cli.php:37
getCustomColumns()
Get custom columns.
$lng
getZipExportDirectory()
Return the export directory, where zips are placed.
global $DIC
Definition: goto.php:24
$format
Definition: metadata.php:218
getFormats()
Get formats.
getCustomMultiCommands()
Get custom multi commands.
Class ilTestArchiver.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
getParentGUI()
get parent gui
+ Here is the call graph for this function:

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