ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjFileUnzipFlatProcessor Class Reference

Class ilObjFileUnzipFlatProcessor. More...

+ Inheritance diagram for ilObjFileUnzipFlatProcessor:
+ Collaboration diagram for ilObjFileUnzipFlatProcessor:

Public Member Functions

 process (ResourceIdentification $rid, array $options=[])
 Processes a given resource for the given arguments. More...
 
- Public Member Functions inherited from ilObjFileAbstractZipProcessor
 __construct (ResourceStakeholder $stakeholder, ilObjFileGUI $gui_object, Services $storage, ilFileServicesSettings $settings, $tree)
 
- Public Member Functions inherited from ilObjFileAbstractProcessor
 __construct (ResourceStakeholder $stakeholder, ilObjFileGUI $gui_object, Services $storage, ilFileServicesSettings $settings)
 
 getInvalidFileNames ()
 

Additional Inherited Members

- Data Fields inherited from ilObjFileProcessorInterface
const OPTION_FILENAME = 'title'
 
const OPTION_DESCRIPTION = 'description'
 
const OPTIONS
 
- Protected Member Functions inherited from ilObjFileAbstractZipProcessor
 createSurroundingContainer (ResourceIdentification $rid)
 
 createContainerObj (string $dir_name, int $parent_id, array $options=[])
 Creates a container object depending on the parent's node type and returns it. More...
 
 openZip (ResourceIdentification $rid)
 Opens the zip archive of the given resource. More...
 
 getZipFiles ()
 Yields the file-paths of the currently open zip-archive. More...
 
 hasMultipleRootEntriesInZip ()
 
 getZipDirectories ()
 Yields the directory-paths of the currently open zip-archive. More...
 
 storeZippedFile (string $file_path)
 Creates an IRSS resource from the given filepath. More...
 
 closeZip ()
 Closes the currently open zip-archive. More...
 
 isWorkspace ()
 Returns whether the current context is workspace. More...
 
- Protected Member Functions inherited from ilObjFileAbstractProcessor
 createFileObj (ResourceIdentification $rid, int $parent_id, array $options=[], bool $create_reference=false)
 Creates an ilObjFile instance for the provided information. More...
 
 applyOptions (ilObject $obj, array $options)
 Apply provided options to the given object. More...
 
- Protected Attributes inherited from ilObjFileAbstractZipProcessor
bool $create_base_container_for_multiple_root_entries = false
 Unzip on operating systems may behave differently when unzipping if there are only one or more root nodes in the zip. More...
 
- Protected Attributes inherited from ilObjFileAbstractProcessor
ilFileServicesPolicy $policy
 
ilFileServicesSettings $settings
 
ilCountPDFPages $page_counter
 
Services $storage
 
ResourceStakeholder $stakeholder
 
ilObjFileGUI $gui_object
 
array $invalid_file_names = []
 

Detailed Description

Member Function Documentation

◆ process()

ilObjFileUnzipFlatProcessor::process ( ResourceIdentification  $rid,
array  $options = [] 
)

Processes a given resource for the given arguments.

Parameters
array<string,mixed>$options
See also
ilObjFileProcessorInterface::OPTIONS

Implements ilObjFileProcessorInterface.

Definition at line 28 of file class.ilObjFileUnzipFlatProcessor.php.

References ilObjFileAbstractZipProcessor\closeZip(), ilObjFileAbstractProcessor\createFileObj(), ilObjFileAbstractZipProcessor\createSurroundingContainer(), ilObjFileAbstractZipProcessor\getZipFiles(), ilObjFileAbstractZipProcessor\openZip(), and ilObjFileAbstractZipProcessor\storeZippedFile().

28  : void
29  {
30  $this->openZip($rid);
31 
32  $parent_id = $this->gui_object->getParentId();
33  // Create Base Container if needed
34  $files = iterator_to_array($this->getZipFiles());
35  $multiple_files = count($files) > 1;
36  if ($this->create_base_container_for_multiple_root_entries && $multiple_files) {
37  $parent_id = $this->createSurroundingContainer($rid);
38  }
39 
40  foreach ($files as $file_path) {
41  if (substr($file_path, -1) !== DIRECTORY_SEPARATOR) {
42  $rid = $this->storeZippedFile($file_path);
43  // $options is ignored, as flat-unzip stores the content directly
44  // within the provided parent object.
45 
46  $this->createFileObj($rid, $parent_id, [], true);
47  }
48  }
49 
50  $this->closeZip();
51  }
getZipFiles()
Yields the file-paths of the currently open zip-archive.
createSurroundingContainer(ResourceIdentification $rid)
createFileObj(ResourceIdentification $rid, int $parent_id, array $options=[], bool $create_reference=false)
Creates an ilObjFile instance for the provided information.
storeZippedFile(string $file_path)
Creates an IRSS resource from the given filepath.
closeZip()
Closes the currently open zip-archive.
openZip(ResourceIdentification $rid)
Opens the zip archive of the given resource.
+ Here is the call graph for this function:

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