ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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
229 return $form;
230 }
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 248 of file trait.StdObjProperties.php.

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

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

370 : ?int
371 {
372 $new_tpl_id = null;
373 if ($this->http->wrapper()->query()->has('didactic_template_id')) {
374 $new_tpl_id = $this->http->wrapper()->query()->retrieve(
375 'didactic_template_id',
376 $this->refinery->kindlyTo()->int()
377 );
378 $this->ctrl->saveParameterByClass(\ilDidacticTemplateGUI::class, "didactic_template_id", $new_tpl_id);
379 }
380 return $new_tpl_id;
381 }
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 341 of file trait.StdObjProperties.php.

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

◆ saveAdditionalFeatures()

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

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

235 : void {
236 // (local) custom metadata
238 if (in_array($key, $services)) {
239 \ilContainer::_writeContainerSetting($obj_id, $key, (string) $this->getData($key));
240 }
241 // taxonomies
243 if (in_array($key, $services)) {
244 \ilContainer::_writeContainerSetting($obj_id, $key, (string) $this->getData($key));
245 }
246 }
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.