ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.MetadataManager.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
26{
27 protected LOMServices $lom_services;
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}
getAuthorsFromLOM(int $obj_id, int $sub_id, string $type)
saveAuthorsInLOMIfNoLifecycleSet(int $obj_id, int $sub_id, string $type, string $author)
get(string $class_name)