ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MetaData\Vocabularies\Dispatch\Actions Class Reference
+ Inheritance diagram for ILIAS\MetaData\Vocabularies\Dispatch\Actions:
+ Collaboration diagram for ILIAS\MetaData\Vocabularies\Dispatch\Actions:

Public Member Functions

 __construct (InfosInterface $infos, ControlledRepo $controlled_repo, StandardRepo $standard_repo)
 
 activate (VocabularyInterface $vocabulary)
 
 deactivate (VocabularyInterface $vocabulary)
 
 allowCustomInput (VocabularyInterface $vocabulary)
 
 disallowCustomInput (VocabularyInterface $vocabulary)
 
 delete (VocabularyInterface $vocabulary)
 
 activate (VocabularyInterface $vocabulary)
 
 deactivate (VocabularyInterface $vocabulary)
 
 allowCustomInput (VocabularyInterface $vocabulary)
 
 disallowCustomInput (VocabularyInterface $vocabulary)
 
 delete (VocabularyInterface $vocabulary)
 

Protected Attributes

InfosInterface $infos
 
ControlledRepo $controlled_repo
 
StandardRepo $standard_repo
 

Detailed Description

Definition at line 29 of file Actions.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\Vocabularies\Dispatch\Actions::__construct ( InfosInterface  $infos,
ControlledRepo  $controlled_repo,
StandardRepo  $standard_repo 
)

Member Function Documentation

◆ activate()

ILIAS\MetaData\Vocabularies\Dispatch\Actions::activate ( VocabularyInterface  $vocabulary)

Implements ILIAS\MetaData\Vocabularies\Dispatch\ActionsInterface.

Definition at line 45 of file Actions.php.

45 : void
46 {
47 switch ($vocabulary->type()) {
48 case Type::STANDARD:
49 $this->standard_repo->activateVocabulary($vocabulary->slot());
50 break;
51
52 case Type::CONTROLLED_STRING:
53 case Type::CONTROLLED_VOCAB_VALUE:
54 $this->controlled_repo->setActiveForVocabulary(
55 $vocabulary->id(),
56 true
57 );
58 break;
59
60 default:
61 case Type::COPYRIGHT:
62 break;
63 }
64 }

References ILIAS\MetaData\Vocabularies\COPYRIGHT, ILIAS\MetaData\Vocabularies\VocabularyInterface\id(), ILIAS\MetaData\Vocabularies\VocabularyInterface\slot(), and ILIAS\MetaData\Vocabularies\VocabularyInterface\type().

+ Here is the call graph for this function:

◆ allowCustomInput()

ILIAS\MetaData\Vocabularies\Dispatch\Actions::allowCustomInput ( VocabularyInterface  $vocabulary)

Implements ILIAS\MetaData\Vocabularies\Dispatch\ActionsInterface.

Definition at line 91 of file Actions.php.

91 : void
92 {
93 if (!$this->infos->isCustomInputApplicable($vocabulary)) {
94 throw new \ilMDVocabulariesException('Custom input is not applicable for vocabulary.');
95 }
96
97 switch ($vocabulary->type()) {
98 case Type::CONTROLLED_STRING:
99 $this->controlled_repo->setCustomInputsAllowedForVocabulary(
100 $vocabulary->id(),
101 true
102 );
103 break;
104
105 default:
106 case Type::CONTROLLED_VOCAB_VALUE:
107 case Type::STANDARD:
108 case Type::COPYRIGHT:
109 break;
110 }
111 }

References ILIAS\MetaData\Vocabularies\COPYRIGHT, ILIAS\MetaData\Vocabularies\VocabularyInterface\id(), and ILIAS\MetaData\Vocabularies\VocabularyInterface\type().

+ Here is the call graph for this function:

◆ deactivate()

ILIAS\MetaData\Vocabularies\Dispatch\Actions::deactivate ( VocabularyInterface  $vocabulary)

Implements ILIAS\MetaData\Vocabularies\Dispatch\ActionsInterface.

Definition at line 66 of file Actions.php.

66 : void
67 {
68 if (!$this->infos->isDeactivatable($vocabulary)) {
69 throw new \ilMDVocabulariesException('Vocabulary cannot be deactivated.');
70 }
71
72 switch ($vocabulary->type()) {
73 case Type::STANDARD:
74 $this->standard_repo->deactivateVocabulary($vocabulary->slot());
75 break;
76
77 case Type::CONTROLLED_STRING:
78 case Type::CONTROLLED_VOCAB_VALUE:
79 $this->controlled_repo->setActiveForVocabulary(
80 $vocabulary->id(),
81 false
82 );
83 break;
84
85 default:
86 case Type::COPYRIGHT:
87 break;
88 }
89 }

References ILIAS\MetaData\Vocabularies\COPYRIGHT, ILIAS\MetaData\Vocabularies\VocabularyInterface\id(), ILIAS\MetaData\Vocabularies\VocabularyInterface\slot(), and ILIAS\MetaData\Vocabularies\VocabularyInterface\type().

+ Here is the call graph for this function:

◆ delete()

ILIAS\MetaData\Vocabularies\Dispatch\Actions::delete ( VocabularyInterface  $vocabulary)

Implements ILIAS\MetaData\Vocabularies\Dispatch\ActionsInterface.

Definition at line 138 of file Actions.php.

138 : void
139 {
140 if (!$this->infos->canBeDeleted($vocabulary)) {
141 throw new \ilMDVocabulariesException('Vocabulary cannot be deleted.');
142 }
143
144 switch ($vocabulary->type()) {
145 case Type::CONTROLLED_STRING:
146 case Type::CONTROLLED_VOCAB_VALUE:
147 $this->controlled_repo->deleteVocabulary($vocabulary->id());
148 break;
149
150 default:
151 case Type::STANDARD:
152 case Type::COPYRIGHT:
153 break;
154 }
155 }

References ILIAS\MetaData\Vocabularies\COPYRIGHT.

◆ disallowCustomInput()

ILIAS\MetaData\Vocabularies\Dispatch\Actions::disallowCustomInput ( VocabularyInterface  $vocabulary)

Implements ILIAS\MetaData\Vocabularies\Dispatch\ActionsInterface.

Definition at line 113 of file Actions.php.

113 : void
114 {
115 if (
116 !$this->infos->isCustomInputApplicable($vocabulary) ||
117 !$this->infos->canDisallowCustomInput($vocabulary)
118 ) {
119 throw new \ilMDVocabulariesException('Custom input cannot be disallowed for vocabulary.');
120 }
121
122 switch ($vocabulary->type()) {
123 case Type::CONTROLLED_STRING:
124 $this->controlled_repo->setCustomInputsAllowedForVocabulary(
125 $vocabulary->id(),
126 false
127 );
128 break;
129
130 default:
131 case Type::CONTROLLED_VOCAB_VALUE:
132 case Type::STANDARD:
133 case Type::COPYRIGHT:
134 break;
135 }
136 }

References ILIAS\MetaData\Vocabularies\COPYRIGHT, ILIAS\MetaData\Vocabularies\VocabularyInterface\id(), and ILIAS\MetaData\Vocabularies\VocabularyInterface\type().

+ Here is the call graph for this function:

Field Documentation

◆ $controlled_repo

ControlledRepo ILIAS\MetaData\Vocabularies\Dispatch\Actions::$controlled_repo
protected

◆ $infos

InfosInterface ILIAS\MetaData\Vocabularies\Dispatch\Actions::$infos
protected

◆ $standard_repo

StandardRepo ILIAS\MetaData\Vocabularies\Dispatch\Actions::$standard_repo
protected

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