ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Repository\Form Namespace Reference

Data Structures

class  FormAdapterGUI
 
class  NotEmpty
 

Functions

 initStdObjProperties (Container $DIC)
 
 addStdTitleAndDescription (int $obj_id, string $type)
 
 addStdTitle (int $obj_id, string $type)
 
 saveStdTitleAndDescription (int $obj_id, string $type)
 
 saveStdTitle (int $obj_id, string $type)
 
 addStdTile (int $obj_id, string $type)
 
 saveStdTile (int $obj_id, string $type)
 
 addOnline (int $obj_id, string $type)
 
 saveOnline (int $obj_id, string $type)
 
 addStdAvailability (int $ref_id, $visibility_info="")
 
 saveStdAvailability (int $ref_id)
 
 addAdditionalFeatures (int $obj_id, array $services)
 
 saveAdditionalFeatures (int $obj_id, array $services)
 
 addDidacticTemplates (string $type, int $ref_id, bool $creation_mode, array $additional_template_options=[])
 
 buildDidacticTemplateOptions (string $type, int $ref_id, array $additional_template_options=[])
 
 redirectToDidacticConfirmationIfChanged (int $ref_id, string $type, string $gui_class, array $additional_template_options=[])
 
 getDidacticTemplateIdFromRequest ()
 

Variables

trait StdObjProperties
 

Function Documentation

◆ addAdditionalFeatures()

ILIAS\Repository\Form\addAdditionalFeatures ( int  $obj_id,
array  $services 
)

Definition at line 191 of file trait.StdObjProperties.php.

194 : self {
195 global $DIC;
196
197 $lng = $DIC->language();
198
199 $lng->loadLanguageModule("obj");
200
201 $form = $this->section("add", $lng->txt("obj_features"));
202
203 // (local) custom metadata
204 if (in_array(\ilObjectServiceSettingsGUI::CUSTOM_METADATA, $services)) {
205 $form = $this->checkbox(
207 $lng->txt('obj_tool_setting_custom_metadata'),
208 $lng->txt('obj_tool_setting_custom_metadata_info'),
210 $obj_id,
212 )
213 );
214 }
215
216 // taxonomies
217 if (in_array(\ilObjectServiceSettingsGUI::TAXONOMIES, $services)) {
218 $form = $this->checkbox(
220 $lng->txt('obj_tool_setting_taxonomies'),
221 "",
223 $obj_id,
225 )
226 );
227 }
228
229
230 return $form;
231 }
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26

◆ addDidacticTemplates()

ILIAS\Repository\Form\addDidacticTemplates ( string  $type,
int  $ref_id,
bool  $creation_mode,
array  $additional_template_options = [] 
)

Definition at line 249 of file trait.StdObjProperties.php.

254 : self {
255 list($existing_exclusive, $options) = $this->buildDidacticTemplateOptions(
256 $type,
257 $ref_id,
258 $additional_template_options
259 );
260 if (sizeof($options) < 2) {
261 return $this;
262 }
263
264 // workaround for containers in edit mode
265 if (!$creation_mode) {
267
268 if (!in_array(
269 $current_value,
270 array_keys($options)
271 ) || ($existing_exclusive && $current_value == "dtpl_0")) {
272 //add or rename actual value to not available
273 $options[$current_value] = [$this->lng->txt('not_available')];
274 }
275 } else {
276 if ($existing_exclusive) {
277 //if an exclusive template exists use the second template as default value - Whatever the f*** that means!
278 $keys = array_keys($options);
279 $current_value = $keys[1];
280 } else {
281 $current_value = 'dtpl_0';
282 }
283 }
284
285 $form = $this->radio(
286 'didactic_type',
287 $this->lng->txt('type'),
288 "",
289 $current_value
290 );
291
292 foreach ($options as $id => $data) {
293 /*
294 if ($existing_exclusive && $id == 'dtpl_0') {
295 //set default disabled if an exclusive template exists
296 $option->setDisabled(true);
297 }*/
298 $form = $this->radioOption(
299 (string) $id,
300 $data[0] ?? '',
301 $data[1] ?? ''
302 );
303 }
304 return $form;
305 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$ref_id
Definition: ltiauth.php:66
buildDidacticTemplateOptions(string $type, int $ref_id, array $additional_template_options=[])

◆ addOnline()

ILIAS\Repository\Form\addOnline ( int  $obj_id,
string  $type 
)

Definition at line 110 of file trait.StdObjProperties.php.

114 $obj_prop = $this->object_prop->getFor($obj_id, $type);
115 $input = $obj_prop->getPropertyIsOnline()
116 ->toForm($this->lng, $this->ui->factory()->input()->field(), $this->refinery);
117 $this->addField("is_online", $input, true);
118 return $this;
119 }

Referenced by ILIAS\BookingManager\Settings\SettingsGUI\getEditForm().

+ Here is the caller graph for this function:

◆ addStdAvailability()

ILIAS\Repository\Form\addStdAvailability ( int  $ref_id,
  $visibility_info = "" 
)

Definition at line 129 of file trait.StdObjProperties.php.

129 : self
130 {
133 $start = $end = $visibility = null;
134 if (($activation["timing_type"] ?? null) === \ilObjectActivation::TIMINGS_ACTIVATION) {
135 $start = (int) $activation["timing_start"];
136 $end = (int) $activation["timing_end"];
137 $visibility = (bool) $activation["visible"];
138 }
139 $enabled = ($end > 0) || ($start > 0);
140 $form = $this
141 ->optional(
142 "limited",
143 $lng->txt("rep_time_based_availability"),
144 "",
145 $enabled
146 )
147 ->dateTimeDuration(
148 "availability",
149 $this->lng->txt("rep_time_period"),
150 "",
151 new \ilDateTime($start, IL_CAL_UNIX),
152 new \ilDateTime($end, IL_CAL_UNIX)
153 )
154 ->checkbox(
155 "visibility",
156 $this->lng->txt("rep_activation_limited_visibility"),
157 $visibility_info,
158 $visibility
159 )
160 ->end();
161 return $form;
162 }
const IL_CAL_UNIX
static getItem(int $ref_id)

References $lng, $ref_id, ilObjectActivation\getItem(), IL_CAL_UNIX, ILIAS\Repository\int(), ILIAS\Repository\lng(), and ilObjectActivation\TIMINGS_ACTIVATION.

+ Here is the call graph for this function:

◆ addStdTile()

ILIAS\Repository\Form\addStdTile ( int  $obj_id,
string  $type 
)

Definition at line 88 of file trait.StdObjProperties.php.

92 $obj_prop = $this->object_prop->getFor($obj_id, $type);
93 $input = $obj_prop->getPropertyTileImage()
94 ->toForm($this->lng, $this->ui->factory()->input()->field(), $this->refinery);
95 $this->addField("tile", $input, true);
96 return $this;
97 }

Referenced by ILIAS\BookingManager\Settings\SettingsGUI\getEditForm().

+ Here is the caller graph for this function:

◆ addStdTitle()

ILIAS\Repository\Form\addStdTitle ( int  $obj_id,
string  $type 
)

Definition at line 50 of file trait.StdObjProperties.php.

54 $obj_prop = $this->object_prop->getFor($obj_id, $type);
55 $inputs = $obj_prop
56 ->getPropertyTitleAndDescription()
57 ->toForm($this->lng, $this->ui->factory()->input()->field(), $this->refinery)->getInputs();
58 $this->addField("title", $inputs[0]);
59 return $this;
60 }

◆ addStdTitleAndDescription()

ILIAS\Repository\Form\addStdTitleAndDescription ( int  $obj_id,
string  $type 
)

Definition at line 37 of file trait.StdObjProperties.php.

41 $obj_prop = $this->object_prop->getFor($obj_id, $type);
42 $inputs = $obj_prop
43 ->getPropertyTitleAndDescription()
44 ->toForm($this->lng, $this->ui->factory()->input()->field(), $this->refinery)->getInputs();
45 $this->addField("title", $inputs[0]);
46 $this->addField("description", $inputs[1]);
47 return $this;
48 }

Referenced by ILIAS\BookingManager\Settings\SettingsGUI\getEditForm().

+ Here is the caller graph for this function:

◆ buildDidacticTemplateOptions()

ILIAS\Repository\Form\buildDidacticTemplateOptions ( string  $type,
int  $ref_id,
array  $additional_template_options = [] 
)
private

Definition at line 307 of file trait.StdObjProperties.php.

311 : array {
312 $this->lng->loadLanguageModule('didactic');
313 $existing_exclusive = false;
314 $options = [];
315 $options['dtpl_0'] = [
316 $this->lng->txt('didactic_default_type'),
317 sprintf(
318 $this->lng->txt('didactic_default_type_info'),
319 $this->lng->txt('objs_' . $type)
320 )
321 ];
322
323 $templates = \ilDidacticTemplateSettings::getInstanceByObjectType($type)->getTemplates();
324 if ($templates) {
325 foreach ($templates as $template) {
326 if ($template->isEffective((int) $ref_id)) {
327 $options["dtpl_" . $template->getId()] = [
328 $template->getPresentationTitle(),
329 $template->getPresentationDescription()
330 ];
331
332 if ($template->isExclusive()) {
333 $existing_exclusive = true;
334 }
335 }
336 }
337 }
338
339 return [$existing_exclusive, array_merge($options, $additional_template_options)];
340 }
static getInstanceByObjectType(string $a_obj_type)

References $ref_id.

◆ getDidacticTemplateIdFromRequest()

ILIAS\Repository\Form\getDidacticTemplateIdFromRequest ( )

Definition at line 371 of file trait.StdObjProperties.php.

371 : ?int
372 {
373 $new_tpl_id = null;
374 if ($this->http->wrapper()->query()->has('didactic_template_id')) {
375 $new_tpl_id = $this->http->wrapper()->query()->retrieve(
376 'didactic_template_id',
377 $this->refinery->kindlyTo()->int()
378 );
379 $this->ctrl->saveParameterByClass(\ilDidacticTemplateGUI::class, "didactic_template_id", $new_tpl_id);
380 }
381 return $new_tpl_id;
382 }
static http()
Fetches the global http state from ILIAS.

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by ILIAS\BookingManager\Settings\SettingsGUI\executeCommand(), and ILIAS\Glossary\Settings\SettingsGUI\executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initStdObjProperties()

ILIAS\Repository\Form\initStdObjProperties ( Container  $DIC)
protected

Definition at line 32 of file trait.StdObjProperties.php.

33 {
34 $this->object_prop = LocalDIC::dic()['properties.aggregator'];
35 }

References ILIAS\ILIASObject\LocalDIC\dic().

Referenced by ILIAS\Repository\Form\FormAdapterGUI\__construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectToDidacticConfirmationIfChanged()

ILIAS\Repository\Form\redirectToDidacticConfirmationIfChanged ( int  $ref_id,
string  $type,
string  $gui_class,
array  $additional_template_options = [] 
)

Definition at line 342 of file trait.StdObjProperties.php.

347 : void {
348 list($existing_exclusive, $options) = $this->buildDidacticTemplateOptions(
349 $type,
350 $ref_id,
351 $additional_template_options
352 );
353
354 if (sizeof($options) < 2) {
355 return;
356 }
357
359 $ref_id
360 );
361 $new_tpl_id = (int) substr($this->getData('didactic_type'), 5);
362
363 if ($new_tpl_id !== $current_tpl_id) {
364 // redirect to didactic template confirmation
365 $this->ctrl->setParameterByClass(\ilDidacticTemplateGUI::class, "didactic_template_id", $new_tpl_id);
366 $this->ctrl->redirectByClass([$gui_class, \ilDidacticTemplateGUI::class], "confirmTemplateSwitch");
367 return;
368 }
369 }

◆ saveAdditionalFeatures()

ILIAS\Repository\Form\saveAdditionalFeatures ( int  $obj_id,
array  $services 
)

Definition at line 233 of file trait.StdObjProperties.php.

236 : void {
237 // (local) custom metadata
239 if (in_array($key, $services)) {
240 \ilContainer::_writeContainerSetting($obj_id, $key, (string) $this->getData($key));
241 }
242 // taxonomies
244 if (in_array($key, $services)) {
245 \ilContainer::_writeContainerSetting($obj_id, $key, (string) $this->getData($key));
246 }
247 }
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)

References ilContainer\_writeContainerSetting().

+ Here is the call graph for this function:

◆ saveOnline()

ILIAS\Repository\Form\saveOnline ( int  $obj_id,
string  $type 
)

Definition at line 121 of file trait.StdObjProperties.php.

124 : void {
125 $obj_prop = $this->object_prop->getFor($obj_id, $type);
126 $obj_prop->storePropertyIsOnline($this->getData("is_online"));
127 }

◆ saveStdAvailability()

ILIAS\Repository\Form\saveStdAvailability ( int  $ref_id)

Definition at line 164 of file trait.StdObjProperties.php.

164 : void
165 {
166 $item = new \ilObjectActivation();
167 if (!$this->getData("limited")) {
168 $item->setTimingType(\ilObjectActivation::TIMINGS_DEACTIVATED);
169 } else {
170 $avail = $this->getData("availability");
171 $from = $to = null;
172 if (!is_null($avail) && !is_null($avail[0])) {
173 $from = $avail[0]->getUnixTime();
174 }
175 if (!is_null($avail) && !is_null($avail[1])) {
176 $to = $avail[1]->getUnixTime();
177 }
178 if ($from > 0 || $to > 0) {
179 $item->setTimingType(\ilObjectActivation::TIMINGS_ACTIVATION);
180 $item->setTimingStart($from);
181 $item->setTimingEnd($to);
182 $item->toggleVisible($this->getData("visibility"));
183 } else {
184 $item->setTimingType(\ilObjectActivation::TIMINGS_DEACTIVATED);
185 }
186 }
187 $item->update($ref_id);
188 }

References $ref_id, ilObjectActivation\TIMINGS_ACTIVATION, and ilObjectActivation\TIMINGS_DEACTIVATED.

◆ saveStdTile()

ILIAS\Repository\Form\saveStdTile ( int  $obj_id,
string  $type 
)

Definition at line 99 of file trait.StdObjProperties.php.

102 : void {
103 $obj_prop = $this->object_prop->getFor($obj_id, $type);
104 $tile = $this->getData("tile");
105 if (!is_null($tile)) {
106 $obj_prop->storePropertyTileImage($this->getData("tile"));
107 }
108 }

◆ saveStdTitle()

ILIAS\Repository\Form\saveStdTitle ( int  $obj_id,
string  $type 
)

Definition at line 75 of file trait.StdObjProperties.php.

78 : void {
79 $obj_prop = $this->object_prop->getFor($obj_id, $type);
80 $obj_prop->storePropertyTitleAndDescription(
82 $this->getData("title"),
83 ""
84 )
85 );
86 }

◆ saveStdTitleAndDescription()

ILIAS\Repository\Form\saveStdTitleAndDescription ( int  $obj_id,
string  $type 
)

Definition at line 62 of file trait.StdObjProperties.php.

65 : void {
66 $obj_prop = $this->object_prop->getFor($obj_id, $type);
67 $obj_prop->storePropertyTitleAndDescription(
69 $this->getData("title"),
70 $this->getData("description")
71 )
72 );
73 }

Variable Documentation

◆ StdObjProperties

trait ILIAS::Repository::Form\StdObjProperties
Initial value:
{
protected \ILIAS\ILIASObject\Properties\Aggregator $object_prop

Definition at line 28 of file trait.StdObjProperties.php.