ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjFileAbstractProcessor Class Reference

Class ilObjFileAbstractProcessorInterface. More...

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

Public Member Functions

 __construct (protected ResourceStakeholder $stakeholder, protected ilObjFileGUI $gui_object, protected Services $storage, protected ilFileServicesSettings $settings)
 
 getInvalidFileNames ()
 
- Public Member Functions inherited from ilObjFileProcessorInterface
 process (ResourceIdentification $rid, ?string $title=null, ?string $description=null, ?string $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, ?string $copyright_id=null, bool $create_reference=false)
 Creates an ilObjFile instance for the provided information. More...
 

Protected Attributes

ilFileServicesPolicy $policy
 
ilCountPDFPages $page_counter
 
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 ( protected ResourceStakeholder  $stakeholder,
protected ilObjFileGUI  $gui_object,
protected Services  $storage,
protected ilFileServicesSettings  $settings 
)

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

39 {
40 $this->page_counter = new ilCountPDFPages();
41 $this->policy = new ilFileServicesPolicy($this->settings);
42 }
Class ilCountPDFPages.
Class ilFileServicesPolicy.

References ILIAS\Repository\settings().

+ 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,
?string  $copyright_id = null,
bool  $create_reference = false 
)
protected

Creates an ilObjFile instance for the provided information.

See also
ilObjFileAbstractProcessorInterface::OPTIONS

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

55 : ilObjFile {
56 $revision = $this->storage->manage()->getCurrentRevision($rid);
57 $file_obj = new ilObjFile();
58 $file_obj->setResourceId($rid);
59 if ($this->page_counter->isAvailable()) {
60 $file_obj->setPageCount($this->page_counter->extractAmountOfPagesByRID($rid) ?? 0);
61 }
62
63 $file_name = $revision->getInformation()->getTitle();
64 $title = $file_obj->appendSuffixToTitle(
65 $title ?? $file_name,
66 $file_name
67 );
68
69 $revision->setTitle($title);
70 $this->storage->manage()->updateRevision($revision);
71
72 if (!$this->policy->isValidExtension($revision->getInformation()->getSuffix())) {
73 $this->invalid_file_names[] = $title;
74 }
75 $file_obj->setTitle($title);
76 if ($description !== null) {
77 $file_obj->setDescription($description);
78 }
79 $file_obj->setVersion($revision->getVersionNumber());
80 $file_obj->setCopyrightID($copyright_id);
81
82 $file_obj->create();
83
84 if ($create_reference) {
85 $file_obj->createReference();
86 }
87
88 $file_obj->processAutoRating();
89 $this->gui_object->putObjectInTree($file_obj, $parent_id);
90
91 return $file_obj;
92 }
Class ilObjFile.

◆ getInvalidFileNames()

ilObjFileAbstractProcessor::getInvalidFileNames ( )

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

Field Documentation

◆ $invalid_file_names

array ilObjFileAbstractProcessor::$invalid_file_names = []
protected

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

◆ $page_counter

ilCountPDFPages ilObjFileAbstractProcessor::$page_counter
protected

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

◆ $policy

ilFileServicesPolicy ilObjFileAbstractProcessor::$policy
protected

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


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