ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjFileAbstractProcessor Class Reference

Class ilObjFileAbstractProcessorInterface. More...

+ Inheritance diagram for ilObjFileAbstractProcessor:
+ Collaboration diagram for ilObjFileAbstractProcessor:

Public Member Functions

 __construct (ResourceStakeholder $stakeholder, ilObjFileGUI $gui_object, Services $storage, ilFileServicesSettings $settings)
 
 getInvalidFileNames ()
 
- Public Member Functions inherited from ilObjFileProcessorInterface
 process (ResourceIdentification $rid, string $title=null, string $description=null, int $copyright_id=null)
 Processes a given resource for the given arguments. More...
 

Protected Member Functions

 createFileObj (ResourceIdentification $rid, int $parent_id, string $title=null, string $description=null, int $copyright_id=null, bool $create_reference=false)
 Creates an ilObjFile instance for the provided information. More...
 

Protected Attributes

ilFileServicesPolicy $policy
 
ilFileServicesSettings $settings
 
ilCountPDFPages $page_counter
 
Services $storage
 
ResourceStakeholder $stakeholder
 
ilObjFileGUI $gui_object
 
array $invalid_file_names = []
 

Detailed Description

Class ilObjFileAbstractProcessorInterface.

Author
Thibeau Fuhrer thf@s.nosp@m.tude.nosp@m.r-rai.nosp@m.mann.nosp@m..ch

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

Constructor & Destructor Documentation

◆ __construct()

ilObjFileAbstractProcessor::__construct ( ResourceStakeholder  $stakeholder,
ilObjFileGUI  $gui_object,
Services  $storage,
ilFileServicesSettings  $settings 
)

Definition at line 38 of file class.ilObjFileAbstractProcessor.php.

References $gui_object, $settings, $stakeholder, $storage, and ILIAS\Repository\settings().

43  {
44  $this->storage = $storage;
45  $this->stakeholder = $stakeholder;
46  $this->gui_object = $gui_object;
47  $this->page_counter = new ilCountPDFPages();
48  $this->settings = $settings;
49  $this->policy = new ilFileServicesPolicy($this->settings);
50  }
Class ilFileServicesPolicy.
Class ilCountPDFPages.
+ Here is the call graph for this function:

Member Function Documentation

◆ createFileObj()

ilObjFileAbstractProcessor::createFileObj ( ResourceIdentification  $rid,
int  $parent_id,
string  $title = null,
string  $description = null,
int  $copyright_id = null,
bool  $create_reference = false 
)
protected

Creates an ilObjFile instance for the provided information.

See also
ilObjFileAbstractProcessorInterface::OPTIONS

Definition at line 56 of file class.ilObjFileAbstractProcessor.php.

Referenced by ilObjFileProcessor\process(), ilObjFileUnzipFlatProcessor\process(), and ilObjFileUnzipRecursiveProcessor\process().

63  : ilObjFile {
64  $revision = $this->storage->manage()->getCurrentRevision($rid);
65  $file_obj = new ilObjFile();
66  $file_obj->setResourceId($rid);
67  if ($this->page_counter->isAvailable()) {
68  $file_obj->setPageCount($this->page_counter->extractAmountOfPagesByRID($rid) ?? 0);
69  }
70 
71  $file_name = $revision->getInformation()->getTitle();
72  $title = $file_obj->appendSuffixToTitle(
73  $title ?? $file_name,
74  $file_name
75  );
76 
77  $revision->setTitle($title);
78  $this->storage->manage()->updateRevision($revision);
79 
80  if (!$this->policy->isValidExtension($revision->getInformation()->getSuffix())) {
81  $this->invalid_file_names[] = $title;
82  }
83  $file_obj->setTitle($title);
84  if ($description !== null) {
85  $file_obj->setDescription($description);
86  }
87  $file_obj->setVersion($revision->getVersionNumber());
88  $file_obj->setCopyrightID($copyright_id);
89 
90  $file_obj->create();
91 
92  if ($create_reference) {
93  $file_obj->createReference();
94  }
95 
96  $file_obj->processAutoRating();
97  $this->gui_object->putObjectInTree($file_obj, $parent_id);
98 
99  return $file_obj;
100  }
Class ilObjFile.
+ Here is the caller graph for this function:

◆ getInvalidFileNames()

ilObjFileAbstractProcessor::getInvalidFileNames ( )

Definition at line 102 of file class.ilObjFileAbstractProcessor.php.

References $invalid_file_names.

102  : array
103  {
105  }

Field Documentation

◆ $gui_object

ilObjFileGUI ilObjFileAbstractProcessor::$gui_object
protected

Definition at line 35 of file class.ilObjFileAbstractProcessor.php.

Referenced by __construct().

◆ $invalid_file_names

array ilObjFileAbstractProcessor::$invalid_file_names = []
protected

Definition at line 36 of file class.ilObjFileAbstractProcessor.php.

Referenced by getInvalidFileNames().

◆ $page_counter

ilCountPDFPages ilObjFileAbstractProcessor::$page_counter
protected

Definition at line 32 of file class.ilObjFileAbstractProcessor.php.

◆ $policy

ilFileServicesPolicy ilObjFileAbstractProcessor::$policy
protected

Definition at line 30 of file class.ilObjFileAbstractProcessor.php.

◆ $settings

ilFileServicesSettings ilObjFileAbstractProcessor::$settings
protected

Definition at line 31 of file class.ilObjFileAbstractProcessor.php.

Referenced by __construct().

◆ $stakeholder

ResourceStakeholder ilObjFileAbstractProcessor::$stakeholder
protected

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

Referenced by __construct().

◆ $storage

Services ilObjFileAbstractProcessor::$storage
protected

Definition at line 33 of file class.ilObjFileAbstractProcessor.php.

Referenced by __construct().


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