ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.MetadataManager.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 
26 {
28 
29  public function __construct(LOMServices $lom_services)
30  {
31  $this->lom_services = $lom_services;
32  }
33 
34  public function getAuthorsFromLOM(
35  int $obj_id,
36  int $sub_id,
37  string $type
38  ): string {
39  $path_to_authors = $this->lom_services->paths()->authors();
40  $author_data = $this->lom_services->read($obj_id, $sub_id, $type, $path_to_authors)
41  ->allData($path_to_authors);
42 
43  return $this->lom_services->dataHelper()->makePresentableAsList(',', ...$author_data);
44  }
45 
47  int $obj_id,
48  int $sub_id,
49  string $type,
50  string $author
51  ): void {
52  $path_to_lifecycle = $this->lom_services->paths()->custom()->withNextStep('lifeCycle')->get();
53  $path_to_authors = $this->lom_services->paths()->authors();
54 
55  $reader = $this->lom_services->read($obj_id, $sub_id, $type, $path_to_lifecycle);
56  if (!is_null($reader->allData($path_to_lifecycle)->current())) {
57  return;
58  }
59 
60  $this->lom_services->manipulate($obj_id, $sub_id, $type)
61  ->prepareCreateOrUpdate($path_to_authors, $author)
62  ->execute();
63  }
64 }
saveAuthorsInLOMIfNoLifecycleSet(int $obj_id, int $sub_id, string $type, string $author)
getAuthorsFromLOM(int $obj_id, int $sub_id, string $type)