ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
DownloadSanitationReportUserInteraction.php
Go to the documentation of this file.
1<?php
2
4
12use ilObjFile;
13
20{
21 const OPTION_DOWNLOAD = "download";
22 const OPTION_SANITIZE = "sanitize";
23
24
25 public function getInputTypes()
26 {
27 return [new ListType(IntegerValue::class)];
28 }
29
30
31 public function getOutputType()
32 {
33 return [];
34 }
35
36
37 public function getOptions(array $input)
38 {
39 return [
40 new UserInteractionOption("download", self::OPTION_DOWNLOAD),
41 // new UserInteractionOption("sanitize", self::OPTION_SANITIZE),
42 ];
43 }
44
45
46 public function interaction(array $input, Option $user_selected_option, Bucket $bucket)
47 {
52 $list = $input[0];
53
54 switch ($user_selected_option->getValue()) {
56 $output_delivery = new \ilPHPOutputDelivery();
57 $output_delivery->start($bucket->getTitle() . ".csv");
58 foreach ($list->getList() as $integer_value) {
59 $obj_id = $integer_value->getValue();
60 $file_object = new ilObjFile($obj_id, false);
61 echo $file_object->getFile() . "\n\r";
62 }
63 $output_delivery->stop();
64 break;
66 foreach ($list->getList() as $integer_value) {
67 $obj_id = $integer_value->getValue();
68 $file_object = new ilObjFile($obj_id, false);
69 $san = new FilePathSanitizer($file_object);
70 $san->sanitizeIfNeeded();
71 }
72 break;
73 }
74
75 return $list;
76 }
77}
An exception for terminatinating execution or to throw for unit testing.
Class ilObjFile.
interaction(array $input, Option $user_selected_option, Bucket $bucket)
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41