ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 

Additional Inherited Members

- Protected Member Functions inherited from ilExportGUI
 getParentGUI ()
 get parent gui More...
 
 showItemSelection ()
 Show container item selection table. More...
 
 saveItemSelection ()
 Save selection of subitems. More...
 
- 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

◆ createTestArchiveExport()

ilTestExportGUI::createTestArchiveExport ( )

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

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

90  {
91  global $ilAccess, $ilCtrl;
92 
93  if ($ilAccess->checkAccess("write", "", $this->obj->ref_id))
94  {
95  include_once("./Modules/Test/classes/class.ilTestArchiver.php");
96  $test_id = $this->obj->getId();
97  $archive_exp = new ilTestArchiver($test_id);
98 
99  require_once './Modules/Test/classes/class.ilTestScoring.php';
100  $scoring = new ilTestScoring($this->obj);
101  $best_solution = $scoring->calculateBestSolutionForTest();
102 
103  require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
104  $generator = new ilTestPDFGenerator();
105  $generator->generatePDF($best_solution, ilTestPDFGenerator::PDF_OUTPUT_FILE, 'Best_Solution.pdf');
106  $archive_exp->handInTestBestSolution($best_solution, 'Best_Solution.pdf');
107  unlink('Best_Solution.pdf');
108 
109  $archive_exp->updateTestArchive();
110  $archive_exp->compressTestArchive();
111  }
112  else
113  {
114  ilUtil::sendInfo("cannot_export_archive", TRUE);
115  }
116  $ilCtrl->redirectByClass('iltestexportgui');
117  }
Class ilTestPDFGenerator.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class ilTestScoring.
Class ilTestArchiver.
+ Here is the call graph for this function:

◆ listExportFiles()

ilTestExportGUI::listExportFiles ( )

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

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

120  {
121  global $tpl, $ilToolbar, $ilCtrl, $lng;
122 
123  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
124 
125  if(count($this->getFormats()) > 1)
126  {
127  foreach($this->getFormats() as $f)
128  {
129  $options[$f["key"]] = $f["txt"];
130  }
131  include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
132  $si = new ilSelectInputGUI($lng->txt("type"), "format");
133  $si->setOptions($options);
134  $ilToolbar->addInputItem($si, true);
135  $ilToolbar->addFormButton($lng->txt("exp_create_file"), "createExportFile");
136  }
137  else
138  {
139  $format = $this->getFormats();
140  $format = $format[0];
141  $ilToolbar->addFormButton($lng->txt("exp_create_file") . " (" . $format["txt"] . ")", "create_" . $format["key"]);
142  }
143 
144  require_once 'class.ilTestArchiver.php';
145  $archiver = new ilTestArchiver($this->getParentGUI()->object->getId());
146  $archive_dir = $archiver->getZipExportDirectory();
147  $archive_files = array();
148  if( file_exists($archive_dir) && is_dir($archive_dir) )
149  {
150  $archive_files = scandir($archive_dir);
151  }
152 
153  $export_dir = $this->obj->getExportDirectory();
154  $export_files = $this->obj->getExportFiles($export_dir);
155  $data = array();
156  if(count($export_files) > 0)
157  {
158  foreach($export_files as $exp_file)
159  {
160  $file_arr = explode("__", $exp_file);
161  array_push($data, array(
162  'file' => $exp_file,
163  'size' => filesize($export_dir . "/" . $exp_file),
164  'timestamp' => $file_arr[0]
165  ));
166  }
167  }
168 
169  if(count($archive_files) > 0)
170  {
171  foreach($archive_files as $exp_file)
172  {
173  if ($exp_file == '.' || $exp_file == '..')
174  {
175  continue;
176  }
177  $file_arr = explode("_", $exp_file);
178  array_push($data, array(
179  'file' => $exp_file,
180  'size' => filesize($archive_dir."/".$exp_file),
181  'timestamp' => $file_arr[4]
182  ));
183  }
184  }
185 
186  require_once 'Modules/Test/classes/tables/class.ilTestExportTableGUI.php';
187  $table = new ilTestExportTableGUI($this, 'listExportFiles', $this->obj);
188  $table->setSelectAllCheckbox("file");
189  foreach($this->getCustomColumns() as $c)
190  {
191  $table->addCustomColumn($c["txt"], $c["obj"], $c["func"]);
192  }
193 
194  foreach($this->getCustomMultiCommands() as $c)
195  {
196  $table->addCustomMultiCommand($c["txt"], "multi_".$c["func"]);
197  }
198 
199  $table->setData($data);
200  $tpl->setContent($table->getHTML());
201  }
This class represents a selection list property in a property form.
global $ilCtrl
Definition: ilias.php:18
getCustomColumns()
Get custom columns.
if(!is_array($argv)) $options
getZipExportDirectory()
Return the export directory, where zips are placed.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
getFormats()
Get formats.
getCustomMultiCommands()
Get custom multi commands.
Class ilTestArchiver.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
global $lng
Definition: privfeed.php:40
getParentGUI()
get parent gui
+ Here is the call graph for this function:

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