ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilTestExportGUI Class Reference

Export User Interface Class. More...

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

Public Member Functions

 createTestArchiveExport ()
 
 listExportFiles ()
 List export files. More...
 
- 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$

@ilCtrl_Calls ilTestExportGUI:

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

Member Function Documentation

◆ buildExportTableGUI()

ilTestExportGUI::buildExportTableGUI ( )
protected
Returns
ilTestExportTableGUI

Reimplemented from ilExportGUI.

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

51 {
52 require_once 'Modules/Test/classes/tables/class.ilTestExportTableGUI.php';
53 $table = new ilTestExportTableGUI($this, 'listExportFiles', $this->obj);
54 return $table;
55 }

Referenced by listExportFiles().

+ Here is the caller graph for this function:

◆ createTestArchiveExport()

ilTestExportGUI::createTestArchiveExport ( )

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

113 {
114 global $ilAccess, $ilCtrl, $ilDB, $lng;
115
116 if ($ilAccess->checkAccess("write", "", $this->obj->ref_id))
117 {
118 require_once 'Modules/Test/classes/class.ilTestEvaluation.php';
119 $evaluation = new ilTestEvaluation($ilDB, $this->obj->getTestId());
120 $allActivesPasses = $evaluation->getAllActivesPasses();
121
122 require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
123 $participantData = new ilTestParticipantData($ilDB, $lng);
124 $participantData->setActiveIds(array_keys($allActivesPasses));
125 $participantData->load($this->obj->getTestId());
126
127 require_once 'Modules/Test/classes/class.ilTestArchiveService.php';
128 $archiveService = new ilTestArchiveService($this->obj);
129 $archiveService->setParticipantData($participantData);
130 $archiveService->archivePassesByActives($allActivesPasses);
131
132 include_once("./Modules/Test/classes/class.ilTestArchiver.php");
133 $test_id = $this->obj->getId();
134 $archive_exp = new ilTestArchiver($test_id);
135
136 require_once './Modules/Test/classes/class.ilTestScoring.php';
137 $scoring = new ilTestScoring($this->obj);
138 $best_solution = $scoring->calculateBestSolutionForTest();
139
140 require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
141 $generator = new ilTestPDFGenerator();
142 $generator->generatePDF($best_solution, ilTestPDFGenerator::PDF_OUTPUT_FILE, 'Best_Solution.pdf');
143 $archive_exp->handInTestBestSolution($best_solution, 'Best_Solution.pdf');
144 unlink('Best_Solution.pdf');
145
146 $archive_exp->updateTestArchive();
147 $archive_exp->compressTestArchive();
148 }
149 else
150 {
151 ilUtil::sendInfo("cannot_export_archive", TRUE);
152 }
153 $ilCtrl->redirectByClass('iltestexportgui');
154 }
Class ilTestArchiver.
Class ilTestPDFGenerator.
Class ilTestScoring.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
global $ilDB

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

+ Here is the call graph for this function:

◆ listExportFiles()

ilTestExportGUI::listExportFiles ( )

List export files.

Parameters

return

Reimplemented from ilExportGUI.

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

157 {
158 global $tpl, $ilToolbar, $ilCtrl, $lng;
159
160 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
161
162 if(count($this->getFormats()) > 1)
163 {
164 foreach($this->getFormats() as $f)
165 {
166 $options[$f["key"]] = $f["txt"];
167 }
168 include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
169 $si = new ilSelectInputGUI($lng->txt("type"), "format");
170 $si->setOptions($options);
171 $ilToolbar->addInputItem($si, true);
172 $ilToolbar->addFormButton($lng->txt("exp_create_file"), "createExportFile");
173 }
174 else
175 {
176 $format = $this->getFormats();
177 $format = $format[0];
178 $ilToolbar->addFormButton($lng->txt("exp_create_file") . " (" . $format["txt"] . ")", "create_" . $format["key"]);
179 }
180
181 require_once 'class.ilTestArchiver.php';
182 $archiver = new ilTestArchiver($this->getParentGUI()->object->getId());
183 $archive_dir = $archiver->getZipExportDirectory();
184 $archive_files = array();
185 if( file_exists($archive_dir) && is_dir($archive_dir) )
186 {
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 {
195 foreach($export_files as $exp_file)
196 {
197 $file_arr = explode("__", $exp_file);
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 {
208 foreach($archive_files as $exp_file)
209 {
210 if ($exp_file == '.' || $exp_file == '..')
211 {
212 continue;
213 }
214 $file_arr = explode("_", $exp_file);
215 array_push($data, array(
216 'file' => $exp_file,
217 'size' => filesize($archive_dir."/".$exp_file),
218 'timestamp' => $file_arr[4]
219 ));
220 }
221 }
222
223 $table = $this->buildExportTableGUI();
224 $table->setSelectAllCheckbox("file");
225 foreach($this->getCustomColumns() as $c)
226 {
227 $table->addCustomColumn($c["txt"], $c["obj"], $c["func"]);
228 }
229
230 foreach($this->getCustomMultiCommands() as $c)
231 {
232 $table->addCustomMultiCommand($c["txt"], "multi_".$c["func"]);
233 }
234
235 $table->setData($data);
236 $tpl->setContent($table->getHTML());
237 }
global $tpl
Definition: ilias.php:8
getParentGUI()
get parent gui
getCustomColumns()
Get custom columns.
getFormats()
Get formats.
getCustomMultiCommands()
Get custom multi commands.
This class represents a selection list property in a property form.
if(!is_array($argv)) $options

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

+ Here is the call graph for this function:

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