19declare(strict_types=1);
77 private readonly \
ilCtrl $ctrl,
78 private readonly HTTPServices
$http,
82 private readonly UuidFactory $uuid_factory,
83 private readonly
Factory $presentation_factory,
86 private readonly
int $parent_obj_id,
113 return $this->presentation_factory->getUIFactory();
119 $this->tabs_gui->clearTargets();
120 $this->tabs_gui->setBackTarget(
121 $this->
lng->txt(
'cancel'),
122 $this->buildEditAnswerFormBackUrl()->buildURI()->__toString()
129 string $language_variable
131 $this->tabs_gui->addSubTab(
133 $this->
lng->txt($language_variable),
146 $this->tabs_gui->activateSubTab($sub_action);
152 return $this->presentation_factory;
158 return $this->url_builder;
165 $clone = clone $this;
166 if ($clone->sub_action_token ===
null) {
169 $clone->sub_action_token
170 ] = $this->url_builder->acquireParameter(
171 self::QUERY_PARAMETER_NAME_SPACE,
172 self::TOKEN_STRING_SUB_ACTION
175 $clone->url_builder = $clone->url_builder
176 ->withParameter($clone->sub_action_token, $sub_action);
183 $clone = clone $this;
184 $clone->default_sub_action =
true;
191 if ($this->default_sub_action) {
195 $sub_action_token = $this->sub_action_token;
196 if ($sub_action_token ===
null) {
197 [,$sub_action_token] = $this->url_builder->acquireParameter(
198 self::QUERY_PARAMETER_NAME_SPACE,
199 self::TOKEN_STRING_SUB_ACTION
203 return $this->retrieveStringValueForToken(
205 self::TOKEN_STRING_SUB_ACTION
212 return $this->editability;
218 return $this->required_capabilities->isMarkingRequired();
228 $this->required_capabilities->getRequiredFormStepActions()
235 return $this->is_in_creation_context;
241 if ($this->answer_form_properties !==
null) {
242 return $this->answer_form_properties->getAnswerFormId();
245 $answer_form_id_token = $this->answer_form_id_token;
246 if ($answer_form_id_token ===
null) {
247 [,$answer_form_id_token] = $this->url_builder->acquireParameter(
248 self::QUERY_PARAMETER_NAME_SPACE,
249 self::TOKEN_STRING_ANSWER_FORM_ID
252 return $this->
http->wrapper()->query()->retrieve(
253 $answer_form_id_token->
getName(),
254 $this->refinery->byTrying([
255 $this->refinery->custom()->transformation(
256 $this->buildRetrieveUuidClosure()
258 $this->refinery->always(
null)
266 return $this->answer_form_properties;
273 $clone = clone $this;
274 $clone->answer_form_properties = $properties;
281 return $this->table_row_token;
290 if ($this->table_row_ids ===
null) {
291 $this->table_row_ids = $this->
http->wrapper()->query()->retrieve(
292 $this->table_row_token->getName(),
293 $this->refinery->byTrying([
294 $this->refinery->kindlyTo()->listOf(
295 $this->refinery->custom()->transformation(
296 fn($v):
string => $v !==
''
297 ? $this->
refinery->kindlyTo()->string()->transform($v)
298 :
throw new \UnexpectedValueException()
306 return $this->table_row_ids;
312 $clone = clone $this;
313 $clone->table_row_ids = $clone->getTableRowIds();
314 $clone->url_builder = $this->url_builder
315 ->withParameter($this->table_row_token, $clone->table_row_ids);
322 $this->
ctrl->redirectToURL(
329 foreach ($this->required_capabilities
330 ->getRequiredPageMigrationProviders() as $provider) {
331 $provider->runPageMigrations();
336 bool $is_in_creation_context
338 $clone = clone $this;
339 $clone->is_in_creation_context = $is_in_creation_context;
345 return $this->parent_obj_id;
350 $action_token = $this->action_token;
351 if ($action_token ===
null) {
352 [,$action_token] = $this->url_builder->acquireParameter(
353 self::QUERY_PARAMETER_NAME_SPACE,
354 self::TOKEN_STRING_ACTION
357 return $this->retrieveStringValueForToken($action_token);
363 $clone = clone $this;
364 if ($clone->action_token ===
null) {
368 ] = $this->url_builder->acquireParameter(
369 self::QUERY_PARAMETER_NAME_SPACE,
370 self::TOKEN_STRING_ACTION
373 $clone->url_builder = $clone->url_builder
374 ->withParameter($clone->action_token, $action);
381 $clone = clone $this;
382 $clone->url_builder = $this->url_builder
383 ->withParameter($this->question_id_token, $question_id->
toString());
390 $clone = clone $this;
391 if ($clone->type_hash_token ===
null) {
394 $clone->type_hash_token
395 ] = $this->url_builder->acquireParameter(
396 self::QUERY_PARAMETER_NAME_SPACE,
397 self::TOKEN_STRING_TYPE_HASH
401 $clone->url_builder = $clone->url_builder
402 ->withParameter($clone->type_hash_token, $type_hash);
409 $clone = clone $this;
410 if ($clone->answer_form_id_token ===
null) {
413 $clone->answer_form_id_token
414 ] = $this->url_builder->acquireParameter(
415 self::QUERY_PARAMETER_NAME_SPACE,
416 self::TOKEN_STRING_ANSWER_FORM_ID
419 $clone->url_builder = $clone->url_builder->withParameter(
420 $clone->answer_form_id_token,
428 $clone = clone $this;
429 if ($clone->create_mode_token ===
null) {
432 $clone->create_mode_token
433 ] = $this->url_builder->acquireParameter(
434 self::QUERY_PARAMETER_NAME_SPACE,
435 self::TOKEN_STRING_CREATE_MODE
439 $clone->url_builder = $clone->url_builder
440 ->withParameter($clone->create_mode_token,
'1');
448 $clone = clone $this;
449 if ($clone->form_start_sub_action_token ===
null) {
452 $clone->form_start_sub_action_token
453 ] = $this->url_builder->acquireParameter(
454 self::QUERY_PARAMETER_NAME_SPACE,
455 self::TOKEN_STRING_FORM_START_SUB_ACTION
459 $clone->url_builder = $clone->url_builder
461 $clone->form_start_sub_action_token,
470 return $this->withFormStartSubActionParameter(
471 $this->getFormStartSubAction()
477 return $this->
http->wrapper()->query()->retrieve(
478 $this->question_id_token->getName(),
479 $this->refinery->byTrying([
480 $this->refinery->custom()->transformation(
481 $this->buildRetrieveUuidClosure()
483 $this->refinery->always(
null)
495 return $this->
http->wrapper()->query()->retrieve(
496 $this->table_row_token->getName(),
497 $this->refinery->byTrying([
498 $this->refinery->custom()->transformation(
499 fn($v):
string => $v === [
'ALL_OBJECTS']
501 :
throw new \UnexpectedValueException()
503 $this->
refinery->kindlyTo()->listOf(
504 $this->refinery->custom()->transformation(
505 $this->buildRetrieveUuidClosure()
508 $this->refinery->always(
null)
510 ) ?? $this->
http->wrapper()->post()->retrieve(
511 self::INTERRUPTIVE_ITEMS_KEY,
512 $this->
refinery->kindlyTo()->listOf(
513 $this->refinery->custom()->transformation(
514 $this->buildRetrieveUuidClosure()
517 $this->refinery->always(
null)
523 $type_hash_token = $this->type_hash_token;
524 if ($type_hash_token ===
null) {
525 [,$type_hash_token] = $this->url_builder->acquireParameter(
526 self::QUERY_PARAMETER_NAME_SPACE,
527 self::TOKEN_STRING_TYPE_HASH
530 return $this->retrieveStringValueForToken($type_hash_token);
535 $form_start_command_token = $this->form_start_sub_action_token;
536 if ($form_start_command_token ===
null) {
537 [,$form_start_command_token] = $this->url_builder->acquireParameter(
538 self::QUERY_PARAMETER_NAME_SPACE,
539 self::TOKEN_STRING_FORM_START_SUB_ACTION
542 return $this->retrieveStringValueForToken($form_start_command_token);
547 $create_mode_token = $this->create_mode_token;
548 if ($create_mode_token ===
null) {
549 [, $create_mode_token] = $this->url_builder->acquireParameter(
550 self::QUERY_PARAMETER_NAME_SPACE,
551 self::TOKEN_STRING_CREATE_MODE
555 return $this->
http->wrapper()->query()->has(
565 array $additional_actions
567 $this->tabs_gui->addTab(
568 self::TAB_ID_ANSWER_FORM,
569 $this->
lng->txt(
'answer_form'),
570 $this->withDefaultSubAction()->getUrlBuilder()->buildURI()->__toString()
573 foreach ($additional_actions as $action) {
581 $this->tabs_gui->addSubTab(
582 self::TAB_ID_ANSWER_FORM,
583 $this->
lng->txt(
'overview'),
584 $this->withDefaultSubAction()->getUrlBuilder()->buildURI()->__toString()
587 $this->tabs_gui->activateTab(self::TAB_ID_ANSWER_FORM);
588 $this->tabs_gui->activateSubTab(self::TAB_ID_ANSWER_FORM);
593 $this->setQuestionIdParamterForPageEditorCmds($this->getQuestionId());
599 $this->setQuestionIdParamterForPageEditorCmds($question_id);
601 $this->
ctrl->setParameterByClass(
602 \QstsQuestionPageGUI::class,
603 self::PARAMETER_STRING_HIER_ID,
607 [, $create_mode_token] = $this->url_builder->acquireParameter(
608 self::QUERY_PARAMETER_NAME_SPACE,
609 self::TOKEN_STRING_CREATE_MODE
612 $this->
ctrl->setParameterByClass(
613 \QstsQuestionPageGUI::class,
621 return $this->
http->wrapper()->query()->has(
622 $this->buildURLBuilderTokenForCreateAndNew()->getName()
629 self::QUERY_PARAMETER_NAME_SPACE,
630 self::TOKEN_STRING_CREATE_AND_NEW
637 $this->
ctrl->setParameterByClass(
639 $this->question_id_token->getName(),
646 if (!$this->is_in_creation_context) {
647 return $this->withDefaultSubAction()->getUrlBuilder();
650 if (!$this->isCreateModeSimple()) {
653 ILIAS_HTTP_PATH .
'/' . $this->
ctrl->getLinkTargetByClass(
654 \QstsQuestionPageGUI::class,
661 return $this->withActionParameter(
662 Edit::ACTION_DELETE_QUESTIONS
663 )->withSubActionParameter(
664 Edit::ACTION_DELETE_QUESTIONS
665 )->getUrlBuilder()->withParameter(
666 $this->table_row_token,
667 [$this->getQuestionId()->
toString()]
676 $this->table_row_token,
677 $this->question_id_token
680 self::QUERY_PARAMETER_NAME_SPACE,
681 self::TOKEN_STRING_TABLE_ROW_ID,
682 self::TOKEN_STRING_QUESTION_ID
689 return $this->
http->wrapper()->query()->retrieve(
691 $this->buildStringTrafo()
698 $this->
refinery->kindlyTo()->string(),
699 $this->refinery->always(
'')
705 return fn($v):
Uuid => is_string($v)
706 ? $this->uuid_factory->fromString($v)
707 :
throw new \UnexpectedValueException();
Builds a Color from either hex- or rgb values.
The scope of this class is split ilias-conform URI's into components.
setEditAnswerFormTabs(array $additional_actions)
const string TOKEN_STRING_ACTION
const string TOKEN_STRING_CREATE_MODE
activateEditAnswerFormSubTab(string $sub_action)
URLBuilderToken $create_mode_token
URLBuilderToken $action_token
withAnswerFormTypeHashParameter(string $type_hash)
withPreservedTableRowIdsParameter()
withAnswerFormProperties(Properties $properties)
const string TOKEN_STRING_QUESTION_ID
__construct(private readonly \ilCtrl $ctrl, private readonly HTTPServices $http, private readonly Refinery $refinery, private readonly Language $lng, private readonly \ilTabsGUI $tabs_gui, private readonly UuidFactory $uuid_factory, private readonly Factory $presentation_factory, private readonly Editability $editability, private readonly RequiredCapabilities $required_capabilities, private readonly int $parent_obj_id, URI $base_uri)
retrieveStringValueForToken(URLBuilderToken $token)
getAnswerFormProperties()
const string TOKEN_STRING_TYPE_HASH
redirectTo(URLBuilder $target)
const string TOKEN_STRING_TABLE_ROW_ID
withIsInCreationContext(bool $is_in_creation_context)
bool $is_in_creation_context
URLBuilderToken $form_start_sub_action_token
buildRetrieveUuidClosure()
const string PARAMETER_STRING_HIER_ID
withPreservedFormStartSubActionParameter()
readonly URLBuilderToken $table_row_token
withFormStartSubActionParameter(string $sub_action)
const string TOKEN_STRING_SUB_ACTION
const string INTERRUPTIVE_ITEMS_KEY
acquireURLBuilderAndParameters(URI $base_uri)
Properties $answer_form_properties
buildEditAnswerFormBackUrl()
const string TOKEN_STRING_CREATE_AND_NEW
buildURLBuilderTokenForCreateAndNew()
URLBuilderToken $type_hash_token
const array QUERY_PARAMETER_NAME_SPACE
setQuestionIdParamterForPageEditorCmds(Uuid $question_id)
setParamtersForSimpleCreateCmd(Uuid $question_id)
readonly URLBuilderToken $question_id_token
URLBuilderToken $sub_action_token
addEditAnswerFormSubTab(string $sub_action, string $language_variable)
const string TOKEN_STRING_FORM_START_SUB_ACTION
getAnswerFormId()
Returns the answer form id of the current context either from the answer form properties,...
withCreateModeParameter()
const string TOKEN_STRING_ANSWER_FORM_ID
withSubActionParameter(string $sub_action)
URLBuilderToken $answer_form_id_token
const string TAB_ID_ANSWER_FORM
withQuestionIdParameter(Uuid $question_id)
preserveParametersForPageEditorCmds()
getAnswerFormTableActionsForRequiredCapabilities()
withActionParameter(string $action)
getQuestionIds()
This function will either return the QuestionIds from the $_GET parameter for row ids OR from an Inte...
withAnswerFormIdParameter(Uuid $answer_form_id)
setEditAnswerFormBackTarget()
getName()
Get the full name of the token including its namespace.
buildURI()
Get a URI representation of the full URL including query string and fragment/hash.
@ilCtrl_Calls QstsQuestionPageGUI: ilPageEditorGUI, ilEditClipboardGUI @ilCtrl_Calls QstsQuestionPage...
Class ilCtrl provides processing control methods.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'vtt', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
toString()
Converts this UUID into a string representation.
readonly HttpService $http
static http()
Fetches the global http state from ILIAS.