19 declare(strict_types=1);
37 ControlledRepo $controlled_repo,
38 StandardRepo $standard_repo
47 switch ($vocabulary->
type()) {
49 $this->standard_repo->activateVocabulary($vocabulary->
slot());
52 case Type::CONTROLLED_STRING:
53 case Type::CONTROLLED_VOCAB_VALUE:
54 $this->controlled_repo->setActiveForVocabulary(
68 if (!$this->infos->isDeactivatable($vocabulary)) {
69 throw new \ilMDVocabulariesException(
'Vocabulary cannot be deactivated.');
72 switch ($vocabulary->
type()) {
74 $this->standard_repo->deactivateVocabulary($vocabulary->
slot());
77 case Type::CONTROLLED_STRING:
78 case Type::CONTROLLED_VOCAB_VALUE:
79 $this->controlled_repo->setActiveForVocabulary(
93 if (!$this->infos->isCustomInputApplicable($vocabulary)) {
94 throw new \ilMDVocabulariesException(
'Custom input is not applicable for vocabulary.');
97 switch ($vocabulary->
type()) {
98 case Type::CONTROLLED_STRING:
99 $this->controlled_repo->setCustomInputsAllowedForVocabulary(
106 case Type::CONTROLLED_VOCAB_VALUE:
116 !$this->infos->isCustomInputApplicable($vocabulary) ||
117 !$this->infos->canDisallowCustomInput($vocabulary)
119 throw new \ilMDVocabulariesException(
'Custom input cannot be disallowed for vocabulary.');
122 switch ($vocabulary->
type()) {
123 case Type::CONTROLLED_STRING:
124 $this->controlled_repo->setCustomInputsAllowedForVocabulary(
131 case Type::CONTROLLED_VOCAB_VALUE:
140 if (!$this->infos->canBeDeleted($vocabulary)) {
141 throw new \ilMDVocabulariesException(
'Vocabulary cannot be deleted.');
144 switch ($vocabulary->type()) {
145 case Type::CONTROLLED_STRING:
146 case Type::CONTROLLED_VOCAB_VALUE:
147 $this->controlled_repo->deleteVocabulary($vocabulary->id());