ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
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 190 of file trait.StdObjProperties.php.

193 : self {
194 global $DIC;
195
196 $lng = $DIC->language();
197
198 $lng->loadLanguageModule("obj");
199
200 $form = $this->section("add", $lng->txt("obj_features"));
201
202 // (local) custom metadata
203 if (in_array(\ilObjectServiceSettingsGUI::CUSTOM_METADATA, $services)) {
204 $form = $this->checkbox(
206 $lng->txt('obj_tool_setting_custom_metadata'),
207 $lng->txt('obj_tool_setting_custom_metadata_info'),
209 $obj_id,
211 )
212 );
213 }
214
215 // taxonomies
216 if (in_array(\ilObjectServiceSettingsGUI::TAXONOMIES, $services)) {
217 $form = $this->checkbox(
219 $lng->txt('obj_tool_setting_taxonomies'),
220 "",
222 $obj_id,
224 )
225 );
226 }
227
228 if (\in_array(\ilObjectServiceSettingsGUI::ORGU_POSITION_ACCESS, $services, true)) {
229 $position_settings = \ilOrgUnitGlobalSettings::getInstance()->getObjectPositionSettingsByType(
230 \ilObject::_lookupType($obj_id)
231 );
232 if ($position_settings->isActive()) {
233 $form = $this->checkbox(
235 $lng->txt('obj_orgunit_positions'),
236 $lng->txt('obj_orgunit_positions_info'),
237 \ilOrgUnitGlobalSettings::getInstance()->isPositionAccessActiveForObject($obj_id),
238 !$position_settings->isChangeableForObject()
239 );
240 }
241 }
242
243 return $form;
244 }
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
static _lookupType(int $id, bool $reference=false)
global $lng
Definition: privfeed.php:26
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 273 of file trait.StdObjProperties.php.

278 : self {
279 list($existing_exclusive, $options) = $this->buildDidacticTemplateOptions(
280 $type,
281 $ref_id,
282 $additional_template_options
283 );
284 if (sizeof($options) < 2) {
285 return $this;
286 }
287
288 // workaround for containers in edit mode
289 if (!$creation_mode) {
291
292 if (!in_array(
293 $current_value,
294 array_keys($options)
295 ) || ($existing_exclusive && $current_value == "dtpl_0")) {
296 //add or rename actual value to not available
297 $options[$current_value] = [$this->lng->txt('not_available')];
298 }
299 } else {
300 if ($existing_exclusive) {
301 //if an exclusive template exists use the second template as default value - Whatever the f*** that means!
302 $keys = array_keys($options);
303 $current_value = $keys[1];
304 } else {
305 $current_value = 'dtpl_0';
306 }
307 }
308
309 $form = $this->radio(
310 'didactic_type',
311 $this->lng->txt('type'),
312 "",
313 $current_value
314 );
315
316 foreach ($options as $id => $data) {
317 /*
318 if ($existing_exclusive && $id == 'dtpl_0') {
319 //set default disabled if an exclusive template exists
320 $option->setDisabled(true);
321 }*/
322 $form = $this->radioOption(
323 (string) $id,
324 $data[0] ?? '',
325 $data[1] ?? ''
326 );
327 }
328 return $form;
329 }
$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 109 of file trait.StdObjProperties.php.

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

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 128 of file trait.StdObjProperties.php.

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

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

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 49 of file trait.StdObjProperties.php.

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

◆ addStdTitleAndDescription()

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

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

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

Referenced by ILIAS\BookingManager\Settings\SettingsGUI\getEditForm(), and ilGuidedTourAdminGUI\getSettingsForm().

+ 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 331 of file trait.StdObjProperties.php.

335 : array {
336 $this->lng->loadLanguageModule('didactic');
337 $existing_exclusive = false;
338 $options = [];
339 $options['dtpl_0'] = [
340 $this->lng->txt('didactic_default_type'),
341 sprintf(
342 $this->lng->txt('didactic_default_type_info'),
343 $this->lng->txt('objs_' . $type)
344 )
345 ];
346
347 $templates = \ilDidacticTemplateSettings::getInstanceByObjectType($type)->getTemplates();
348 if ($templates) {
349 foreach ($templates as $template) {
350 if ($template->isEffective((int) $ref_id)) {
351 $options["dtpl_" . $template->getId()] = [
352 $template->getPresentationTitle(),
353 $template->getPresentationDescription()
354 ];
355
356 if ($template->isExclusive()) {
357 $existing_exclusive = true;
358 }
359 }
360 }
361 }
362
363 return [$existing_exclusive, array_merge($options, $additional_template_options)];
364 }
static getInstanceByObjectType(string $a_obj_type)

References ILIAS\UI\Implementation\Component\Input\Field\$options, and $ref_id.

◆ getDidacticTemplateIdFromRequest()

ILIAS\Repository\Form\getDidacticTemplateIdFromRequest ( )

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

395 : ?int
396 {
397 $new_tpl_id = null;
398 if ($this->http->wrapper()->query()->has('didactic_template_id')) {
399 $new_tpl_id = $this->http->wrapper()->query()->retrieve(
400 'didactic_template_id',
401 $this->refinery->kindlyTo()->int()
402 );
403 $this->ctrl->saveParameterByClass(\ilDidacticTemplateGUI::class, "didactic_template_id", $new_tpl_id);
404 }
405 return $new_tpl_id;
406 }
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 31 of file trait.StdObjProperties.php.

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

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 366 of file trait.StdObjProperties.php.

371 : void {
372 list($existing_exclusive, $options) = $this->buildDidacticTemplateOptions(
373 $type,
374 $ref_id,
375 $additional_template_options
376 );
377
378 if (sizeof($options) < 2) {
379 return;
380 }
381
383 $ref_id
384 );
385 $new_tpl_id = (int) substr($this->getData('didactic_type'), 5);
386
387 if ($new_tpl_id !== $current_tpl_id) {
388 // redirect to didactic template confirmation
389 $this->ctrl->setParameterByClass(\ilDidacticTemplateGUI::class, "didactic_template_id", $new_tpl_id);
390 $this->ctrl->redirectByClass([$gui_class, \ilDidacticTemplateGUI::class], "confirmTemplateSwitch");
391 return;
392 }
393 }

◆ saveAdditionalFeatures()

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

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

249 : void {
250 // (local) custom metadata
252 if (in_array($key, $services)) {
253 \ilContainer::_writeContainerSetting($obj_id, $key, (string) $this->getData($key));
254 }
255 // taxonomies
257 if (in_array($key, $services)) {
258 \ilContainer::_writeContainerSetting($obj_id, $key, (string) $this->getData($key));
259 }
260 // extended user access
261 if (\in_array(\ilObjectServiceSettingsGUI::ORGU_POSITION_ACCESS, $services, true)) {
262 $position_settings = \ilOrgUnitGlobalSettings::getInstance()->getObjectPositionSettingsByType(
263 \ilObject::_lookupType($obj_id)
264 );
265 if ($position_settings->isActive() && $position_settings->isChangeableForObject()) {
266 $orgu_object_settings = new \ilOrgUnitObjectPositionSetting($obj_id);
267 $orgu_object_settings->setActive($this->getData(\ilObjectServiceSettingsGUI::ORGU_POSITION_ACCESS));
268 $orgu_object_settings->update();
269 }
270 }
271 }
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 120 of file trait.StdObjProperties.php.

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

◆ saveStdAvailability()

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

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

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

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

◆ saveStdTile()

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

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

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

◆ saveStdTitle()

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

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

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

◆ saveStdTitleAndDescription()

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

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

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

Variable Documentation

◆ StdObjProperties

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

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