ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ILIAS\MetaData\OERHarvester\Publisher\Publisher Class Reference
+ Inheritance diagram for ILIAS\MetaData\OERHarvester\Publisher\Publisher:
+ Collaboration diagram for ILIAS\MetaData\OERHarvester\Publisher\Publisher:

Public Member Functions

 __construct (protected ExposedRecordsRepository $exposed_repo, protected ResourceStatusRepository $status_repo, protected RepoObjectHandler $repo_object_handler, protected ExportHandler $export_handler, protected PublishingSettings $publishing_settings, protected SimpleDCXMLWriter $xml_writer, protected ilAccess $access)
 
 block (int $obj_id)
 
 checkPermissionsForBlock (int $ref_id, string $type, int $obj_id)
 
 unblock (int $obj_id)
 
 checkPermissionsForUnblock (int $ref_id, string $type, int $obj_id)
 
 publish (int $obj_id, string $type)
 
 checkPermissionsForPublish (int $ref_id, string $type, int $obj_id)
 
 withdraw (int $obj_id)
 
 checkPermissionsForWithdraw (int $ref_id, string $type, int $obj_id)
 
 submit (int $obj_id)
 
 checkPermissionsForSubmit (int $ref_id, string $type, int $obj_id)
 
 accept (int $obj_id, string $type)
 
 checkPermissionsForAccept (int $ref_id, string $type, int $obj_id)
 
 reject (int $obj_id)
 
 checkPermissionsForReject (int $ref_id, string $type, int $obj_id)
 
 block (int $obj_id)
 
 checkPermissionsForBlock (int $ref_id, string $type, int $obj_id)
 
 unblock (int $obj_id)
 
 checkPermissionsForUnblock (int $ref_id, string $type, int $obj_id)
 
 publish (int $obj_id, string $type)
 
 checkPermissionsForPublish (int $ref_id, string $type, int $obj_id)
 
 withdraw (int $obj_id)
 
 checkPermissionsForWithdraw (int $ref_id, string $type, int $obj_id)
 
 submit (int $obj_id)
 
 checkPermissionsForSubmit (int $ref_id, string $type, int $obj_id)
 
 accept (int $obj_id, string $type)
 
 checkPermissionsForAccept (int $ref_id, string $type, int $obj_id)
 
 reject (int $obj_id)
 
 checkPermissionsForReject (int $ref_id, string $type, int $obj_id)
 

Protected Member Functions

 harvestObject (int $obj_id, int $target_ref_id)
 
 publishObjectToOAIPMH (int $obj_id, string $type, int $ref_id)
 
 deleteReferenceIfOthersExist (int $ref_id)
 
 buildIdentifier (int $obj_id, string $type)
 

Detailed Description

Definition at line 32 of file Publisher.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::__construct ( protected ExposedRecordsRepository  $exposed_repo,
protected ResourceStatusRepository  $status_repo,
protected RepoObjectHandler  $repo_object_handler,
protected ExportHandler  $export_handler,
protected PublishingSettings  $publishing_settings,
protected SimpleDCXMLWriter  $xml_writer,
protected ilAccess  $access 
)

Definition at line 34 of file Publisher.php.

42 {
43 }

Member Function Documentation

◆ accept()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::accept ( int  $obj_id,
string  $type 
)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 112 of file Publisher.php.

112 : void
113 {
114 $harvested_ref_id = $this->status_repo->getHarvestRefID($obj_id);
115
116 $publishing_ref_id = $this->publishing_settings->getContainerRefIDForPublishing();
117 $ref_id_in_publishing = $this->repo_object_handler->referenceObjectInTargetContainer($obj_id, $publishing_ref_id);
118 $this->status_repo->setHarvestRefID($obj_id, $ref_id_in_publishing);
119
120 $this->deleteReferenceIfOthersExist($harvested_ref_id);
121
122 $this->publishObjectToOAIPMH($obj_id, $type, $ref_id_in_publishing);
123 }
publishObjectToOAIPMH(int $obj_id, string $type, int $ref_id)
Definition: Publisher.php:166

References ILIAS\MetaData\OERHarvester\Publisher\Publisher\deleteReferenceIfOthersExist(), and ILIAS\MetaData\OERHarvester\Publisher\Publisher\publishObjectToOAIPMH().

+ Here is the call graph for this function:

◆ block()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::block ( int  $obj_id)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 45 of file Publisher.php.

45 : void
46 {
47 $this->status_repo->setHarvestingBlocked($obj_id, true);
48 }

Referenced by ILIAS\MetaData\OERHarvester\Publisher\Publisher\reject(), and ILIAS\MetaData\OERHarvester\Publisher\Publisher\withdraw().

+ Here is the caller graph for this function:

◆ buildIdentifier()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::buildIdentifier ( int  $obj_id,
string  $type 
)
protected

Definition at line 196 of file Publisher.php.

196 : string
197 {
198 return 'il__' . $type . '_' . $obj_id;
199 }

Referenced by ILIAS\MetaData\OERHarvester\Publisher\Publisher\publishObjectToOAIPMH().

+ Here is the caller graph for this function:

◆ checkPermissionsForAccept()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::checkPermissionsForAccept ( int  $ref_id,
string  $type,
int  $obj_id 
)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 125 of file Publisher.php.

125 : bool
126 {
127 $publishing_ref_id = $this->publishing_settings->getContainerRefIDForPublishing();
128 $harvested_ref_id = $this->status_repo->getHarvestRefID($obj_id);
129 return $this->access->checkAccess('write', '', $ref_id, $type, $obj_id) &&
130 $this->access->checkAccess('delete', '', $harvested_ref_id, $type, $obj_id) &&
131 $this->access->checkAccess('create_' . $type, '', $publishing_ref_id);
132 }
$ref_id
Definition: ltiauth.php:66

References ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ checkPermissionsForBlock()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::checkPermissionsForBlock ( int  $ref_id,
string  $type,
int  $obj_id 
)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 50 of file Publisher.php.

50 : bool
51 {
52 return $this->access->checkAccess('write', '', $ref_id, $type, $obj_id);
53 }

References ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ checkPermissionsForPublish()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::checkPermissionsForPublish ( int  $ref_id,
string  $type,
int  $obj_id 
)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 72 of file Publisher.php.

72 : bool
73 {
74 $target_ref_id = $this->publishing_settings->getContainerRefIDForPublishing();
75 return $this->access->checkAccess('write', '', $ref_id, $type, $obj_id) &&
76 $this->access->checkAccess('create_' . $type, '', $target_ref_id);
77 }

References ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ checkPermissionsForReject()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::checkPermissionsForReject ( int  $ref_id,
string  $type,
int  $obj_id 
)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 145 of file Publisher.php.

145 : bool
146 {
147 $harvested_ref_id = $this->status_repo->getHarvestRefID($obj_id);
148 return $this->access->checkAccess('write', '', $ref_id, $type, $obj_id) &&
149 $this->access->checkAccess('delete', '', $harvested_ref_id, $type, $obj_id);
150 }

References ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ checkPermissionsForSubmit()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::checkPermissionsForSubmit ( int  $ref_id,
string  $type,
int  $obj_id 
)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 105 of file Publisher.php.

105 : bool
106 {
107 $target_ref_id = $this->publishing_settings->getContainerRefIDForEditorialStep();
108 return $this->access->checkAccess('write', '', $ref_id, $type, $obj_id) &&
109 $this->access->checkAccess('create_' . $type, '', $target_ref_id);
110 }

References ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ checkPermissionsForUnblock()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::checkPermissionsForUnblock ( int  $ref_id,
string  $type,
int  $obj_id 
)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 60 of file Publisher.php.

60 : bool
61 {
62 return $this->access->checkAccess('write', '', $ref_id, $type, $obj_id);
63 }

References ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ checkPermissionsForWithdraw()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::checkPermissionsForWithdraw ( int  $ref_id,
string  $type,
int  $obj_id 
)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 92 of file Publisher.php.

92 : bool
93 {
94 $harvested_ref_id = $this->status_repo->getHarvestRefID($obj_id);
95 return $this->access->checkAccess('write', '', $ref_id, $type, $obj_id) &&
96 $this->access->checkAccess('delete', '', $harvested_ref_id, $type, $obj_id);
97 }

References ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ deleteReferenceIfOthersExist()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::deleteReferenceIfOthersExist ( int  $ref_id)
protected

Definition at line 188 of file Publisher.php.

188 : void
189 {
190 if ($this->repo_object_handler->isOnlyReference($ref_id)) {
191 return;
192 }
193 $this->repo_object_handler->deleteReference($ref_id);
194 }

References $ref_id.

Referenced by ILIAS\MetaData\OERHarvester\Publisher\Publisher\accept(), ILIAS\MetaData\OERHarvester\Publisher\Publisher\reject(), and ILIAS\MetaData\OERHarvester\Publisher\Publisher\withdraw().

+ Here is the caller graph for this function:

◆ harvestObject()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::harvestObject ( int  $obj_id,
int  $target_ref_id 
)
protected

Definition at line 152 of file Publisher.php.

152 : int
153 {
154 $new_ref_id = $this->repo_object_handler->referenceObjectInTargetContainer(
155 $obj_id,
156 $target_ref_id
157 );
158 $this->status_repo->setHarvestRefID($obj_id, $new_ref_id);
159
160 if (!$this->export_handler->hasPublicAccessExport($obj_id)) {
161 $this->export_handler->createPublicAccessExport($obj_id);
162 }
163 return $new_ref_id;
164 }

Referenced by ILIAS\MetaData\OERHarvester\Publisher\Publisher\publish(), and ILIAS\MetaData\OERHarvester\Publisher\Publisher\submit().

+ Here is the caller graph for this function:

◆ publish()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::publish ( int  $obj_id,
string  $type 
)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 65 of file Publisher.php.

65 : void
66 {
67 $target_ref_id = $this->publishing_settings->getContainerRefIDForPublishing();
68 $new_ref_id = $this->harvestObject($obj_id, $target_ref_id);
69 $this->publishObjectToOAIPMH($obj_id, $type, $new_ref_id);
70 }
harvestObject(int $obj_id, int $target_ref_id)
Definition: Publisher.php:152

References ILIAS\MetaData\OERHarvester\Publisher\Publisher\harvestObject(), and ILIAS\MetaData\OERHarvester\Publisher\Publisher\publishObjectToOAIPMH().

+ Here is the call graph for this function:

◆ publishObjectToOAIPMH()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::publishObjectToOAIPMH ( int  $obj_id,
string  $type,
int  $ref_id 
)
protected

Definition at line 166 of file Publisher.php.

166 : void
167 {
168 $simple_dc_xml = $this->xml_writer->writeSimpleDCMetaData(
169 $obj_id,
170 $ref_id,
171 $type
172 );
173 if ($this->exposed_repo->doesRecordExistForObjID($obj_id)) {
174 $this->exposed_repo->updateRecord(
175 $obj_id,
176 false,
177 $simple_dc_xml
178 );
179 } else {
180 $this->exposed_repo->createRecord(
181 $obj_id,
182 $this->buildIdentifier($obj_id, $type),
183 $simple_dc_xml
184 );
185 }
186 }
buildIdentifier(int $obj_id, string $type)
Definition: Publisher.php:196

References $ref_id, and ILIAS\MetaData\OERHarvester\Publisher\Publisher\buildIdentifier().

Referenced by ILIAS\MetaData\OERHarvester\Publisher\Publisher\accept(), and ILIAS\MetaData\OERHarvester\Publisher\Publisher\publish().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reject()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::reject ( int  $obj_id)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 134 of file Publisher.php.

134 : void
135 {
136 $ref_id = $this->status_repo->getHarvestRefID($obj_id);
138 $this->status_repo->deleteHarvestRefID($obj_id);
139
140 if ($this->publishing_settings->isAutomaticPublishingEnabled()) {
141 $this->block($obj_id);
142 }
143 }

References $ref_id, ILIAS\MetaData\OERHarvester\Publisher\Publisher\block(), and ILIAS\MetaData\OERHarvester\Publisher\Publisher\deleteReferenceIfOthersExist().

+ Here is the call graph for this function:

◆ submit()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::submit ( int  $obj_id)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 99 of file Publisher.php.

99 : void
100 {
101 $target_ref_id = $this->publishing_settings->getContainerRefIDForEditorialStep();
102 $this->harvestObject($obj_id, $target_ref_id);
103 }

References ILIAS\MetaData\OERHarvester\Publisher\Publisher\harvestObject().

+ Here is the call graph for this function:

◆ unblock()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::unblock ( int  $obj_id)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 55 of file Publisher.php.

55 : void
56 {
57 $this->status_repo->setHarvestingBlocked($obj_id, false);
58 }

◆ withdraw()

ILIAS\MetaData\OERHarvester\Publisher\Publisher::withdraw ( int  $obj_id)

Implements ILIAS\MetaData\OERHarvester\Publisher\PublisherInterface.

Definition at line 79 of file Publisher.php.

79 : void
80 {
81 $this->exposed_repo->updateRecord($obj_id, true, null);
82
83 $ref_id = $this->status_repo->getHarvestRefID($obj_id);
85 $this->status_repo->deleteHarvestRefID($obj_id);
86
87 if ($this->publishing_settings->isAutomaticPublishingEnabled()) {
88 $this->block($obj_id);
89 }
90 }

References $ref_id, ILIAS\MetaData\OERHarvester\Publisher\Publisher\block(), and ILIAS\MetaData\OERHarvester\Publisher\Publisher\deleteReferenceIfOthersExist().

+ Here is the call graph for this function:

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