ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
MetadataHandler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 public function getEditForm(
26 string $type,
27 int $id,
28 string $subtype,
29 int $sub_id,
30 string $form_action,
31 string $submit_command,
32 string $submit_label
34 $md = $this->initMetaData($type, $id, $subtype, $sub_id, \ilAdvancedMDRecordGUI::MODE_EDITOR);
35 return new EditForm($md, false, $form_action, $submit_command, $submit_label);
36 }
37
38 public function getDisabledEditForm(
39 string $type,
40 int $id,
41 string $subtype,
42 int $sub_id
44 $md = $this->initMetaData($type, $id, $subtype, $sub_id, \ilAdvancedMDRecordGUI::MODE_EDITOR);
45 return new EditForm($md, true, '', '', '');
46 }
47
48 public function copyValues(
49 string $from_type,
50 int $from_id,
51 string $to_type,
52 int $to_id,
53 string $subtype
54 ): void {
55 // assign talk series type to adv md records of the template
56 foreach (\ilAdvancedMDRecord::_getSelectedRecordsByObject(
57 $from_type,
58 $from_id,
59 $subtype,
60 false
61 ) as $rec) {
62 if (!$rec->isAssignedObjectType($to_type, $subtype)) {
63 $rec->appendAssignedObjectType(
64 $to_type,
65 $subtype,
66 true
67 );
68 $rec->update();
69 }
70 }
71
73 $to_id,
74 $subtype,
76 );
77
79 0,
80 $from_id,
81 $to_id,
82 $subtype
83 );
84 }
85
86 public function attachSelectionToForm(
87 string $type,
88 int $id,
89 string $subtype,
90 int $sub_id,
92 ): void {
93 $md = $this->initMetaData($type, $id, $subtype, $sub_id, \ilAdvancedMDRecordGUI::MODE_REC_SELECTION);
94 $md->setPropertyForm($form);
95 $md->parse();
96 }
97
98 public function saveSelectionFromForm(
99 string $type,
100 int $id,
101 string $subtype,
102 int $sub_id,
103 \ilPropertyFormGUI $form
104 ): void {
105 $md = $this->initMetaData($type, $id, $subtype, $sub_id, \ilAdvancedMDRecordGUI::MODE_REC_SELECTION);
106 $md->setPropertyForm($form);
107 $md->saveSelection();
108 }
109
110 protected function initMetaData(
111 string $type,
112 int $id,
113 string $subtype,
114 int $sub_id,
115 int $mode
117 $md = new \ilAdvancedMDRecordGUI(
118 $mode,
119 $type,
120 $id,
121 $subtype,
122 $sub_id,
123 false
124 );
125 return $md;
126 }
127}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
copyValues(string $from_type, int $from_id, string $to_type, int $to_id, string $subtype)
saveSelectionFromForm(string $type, int $id, string $subtype, int $sub_id, \ilPropertyFormGUI $form)
initMetaData(string $type, int $id, string $subtype, int $sub_id, int $mode)
getDisabledEditForm(string $type, int $id, string $subtype, int $sub_id)
getEditForm(string $type, int $id, string $subtype, int $sub_id, string $form_action, string $submit_command, string $submit_label)
attachSelectionToForm(string $type, int $id, string $subtype, int $sub_id, \ilPropertyFormGUI $form)
static getObjRecSelection(int $a_obj_id, string $a_sub_type="")
Get repository object record selection.
static saveObjRecSelection(int $a_obj_id, string $a_sub_type="", ?array $a_records=null, bool $a_delete_before=true)
Save repository object record selection.
static _cloneValues(int $copy_id, int $a_source_id, int $a_target_id, ?string $a_sub_type=null, ?int $a_source_sub_id=null, ?int $a_target_sub_id=null)
Clone Advanced Meta Data.
This class represents a property form user interface.