ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjFileUnzipRecursiveDelegate Class Reference

Class ilObjFileUnzipRecursiveDelegate. More...

+ Inheritance diagram for ilObjFileUnzipRecursiveDelegate:
+ Collaboration diagram for ilObjFileUnzipRecursiveDelegate:

Public Member Functions

 handle (int $parent_id, array $post_data, UploadResult $result, ilObjFileGUI $gui)
 
- Public Member Functions inherited from ilObjFileAbstractZipDelegate
 __construct (object $access_checker, int $node_type, ilTree $tree)
 ilObjFileAbstractZipDelegate constructor. More...
 
 getUploadedSuffixes ()
 
 handle (int $parent_id, array $post_data, UploadResult $result, ilObjFileGUI $gui)
 
 getUploadedSuffixes ()
 

Protected Member Functions

 getPossibleContainer (int $parent_id)
 
- Protected Member Functions inherited from ilObjFileAbstractZipDelegate
 createSurroundingContainer (UploadResult $result, int $parent_id)
 
 tearDown ()
 
 initZip (UploadResult $result)
 
 isInWorkspace ()
 
 createContainer (string $original_path, int $parent_id)
 
 createFile (string $original_path, int $parent_id)
 
 getNextPath ()
 
 hasMultipleRootEntriesInZip ()
 

Additional Inherited Members

- Protected Attributes inherited from ilObjFileAbstractZipDelegate
 $access_handler
 
 $node_type
 
 $tree
 
 $path_map = []
 
 $zip
 
 $uploaded_suffixes = []
 
 $create_base_container_for_multiple_root_entries = false
 @description Unzip on operating systems may behave differently when unzipping if there are only one or more root nodes in the zip. More...
 

Detailed Description

Member Function Documentation

◆ getPossibleContainer()

ilObjFileUnzipRecursiveDelegate::getPossibleContainer ( int  $parent_id)
protected

Definition at line 11 of file class.ilObjFileUnzipRecursiveDelegate.php.

11 : ilObject
12 {
13 if (!$this->isInWorkspace()) {
14 $type = ilObject::_lookupType($parent_id, true);
15 } else {
16 $type = ilObject::_lookupType($this->tree->lookupObjectId($parent_id), false);
17 }
18
19 switch ($type) {
20 // workspace structure
21 case 'wfld':
22 case 'wsrt':
23 return new ilObjWorkspaceFolder();
24 case 'cat':
25 case 'root':
26 return new ilObjCategory();
27 case 'fold':
28 case 'crs':
29 default:
30 return new ilObjFolder();
31 }
32 }
Class ilObjCategory.
Class ilObjFolder.
Class ilObjWorkspaceFolder.
Class ilObject Basic functions for all objects.
static _lookupType($a_id, $a_reference=false)
lookup object type
$type

References $type, ilObject\_lookupType(), and ilObjFileAbstractZipDelegate\isInWorkspace().

+ Here is the call graph for this function:

◆ handle()

ilObjFileUnzipRecursiveDelegate::handle ( int  $parent_id,
array  $post_data,
UploadResult  $result,
ilObjFileGUI  $gui 
)

Implements ilObjUploadDelegateInterface.

Definition at line 34 of file class.ilObjFileUnzipRecursiveDelegate.php.

40 $this->initZip($result);
41
42 $base_node_id = $parent_id;
43
44 // Create Base Container if needed
45 if ($this->create_base_container_for_multiple_root_entries && $this->hasMultipleRootEntriesInZip()) {
46 $base_node_id = $this->createSurroundingContainer($result, $parent_id);
47 }
48
49 $this->path_map['./'] = $base_node_id;
50
51 foreach ($this->getNextPath() as $original_path) {
52 $dir_name = dirname($original_path) . '/';
53 $parent_id_of_iteration = (int) ($this->path_map[$dir_name] ?? $parent_id);
54 $is_dir = substr($original_path, -1) === DIRECTORY_SEPARATOR;
55
56 if ($is_dir) {
57 $obj = $this->createContainer($original_path, $parent_id_of_iteration);
58 $i = $this->isInWorkspace() ? $obj->getRefId() : $obj->getRefId();
59 $this->path_map[$original_path] = (int) $i;
60 } else {
61 $this->createFile($original_path, $parent_id_of_iteration);
62 }
63 }
64
65 $this->tearDown();
66
68 $response->error = null;
69 return $response;
70 }
createSurroundingContainer(UploadResult $result, int $parent_id)
createContainer(string $original_path, int $parent_id)
createFile(string $original_path, int $parent_id)
Class ilObjFileUploadResponse.
$i
Definition: metadata.php:24
$response

References ilObjFileAbstractZipDelegate\createSurroundingContainer().

+ Here is the call graph for this function:

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