ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilAssNestedOrderingElementsInputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilAssNestedOrderingElementsInputGUI:
+ Collaboration diagram for ilAssNestedOrderingElementsInputGUI:

Public Member Functions

 __construct (ilAssOrderingFormValuesObjectsConverter $converter, $postVar)
 
 setInteractionEnabled (bool $interaction_enabled)
 
 setNestingEnabled (bool $nesting_enabled)
 
 setElementList (ilAssOrderingElementList $elementList)
 
 getElementList (int $questionId)
 
 prepareReprintable (assQuestion $question)
 
 getContext ()
 
 setContext (string $context)
 
 getUniquePrefix ()
 
 setUniquePrefix (int $unique_prefix)
 
 setOrderingType (int $ordering_type)
 
 getOrderingType ()
 
 setElementImagePath (string $element_image_path)
 
 getElementImagePath ()
 
 setThumbPrefix (string $thumbnail_filename_prefix)
 
 getThumbPrefix ()
 
 setShowCorrectnessIconsEnabled (bool $show_correctness_icons_enabled)
 
 isShowCorrectnessIconsEnabled ()
 
 getCorrectnessTrueElementList ()
 
 setCorrectnessTrueElementList (ilAssOrderingElementList $correctness_true_element_list)
 
 isPostSubmit ($data)
 
 render (string $a_mode='')
 
 onCheckInput ()
 
 getHTML ()
 
- Public Member Functions inherited from ilIdentifiedMultiValuesInputGUI
 __construct ($a_title="", $a_postvar="")
 
 getElementAddCmd ()
 
 setElementAddCmd (string $element_add_cmd)
 
 getElementRemoveCmd ()
 
 setElementRemoveCmd (string $element_remove_cmd)
 
 getElementMoveUpCommand ()
 
 setElementMoveUpCommand (string $element_move_up_cmd)
 
 getElementMoveDownCommand ()
 
 setElementMoveDownCommand (string $element_move_down_cmd)
 
 setValues ($values)
 
 getValues ()
 
 setValue ($value)
 
 getValue ()
 
 setMultiValues (array $values)
 
 getMultiValues ()
 
 setIdentifiedMultiValues ($values)
 
 getIdentifiedMultiValues ()
 
 setValueByArray (array $a_values)
 
 getInput ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 onCheckInput ()
 
 prepareReprintable (assQuestion $question)
 
- Public Member Functions inherited from ilTextInputGUI
 __construct (string $a_title="", string $a_postvar="")
 
 setValue ($a_value)
 
 getValue ()
 
 setValidationFailureMessage (string $a_msg)
 
 getValidationFailureMessage ()
 
 setValidationRegexp (string $a_value)
 
 getValidationRegexp ()
 
 setMaxLength (?int $a_maxlength)
 
 getMaxLength ()
 
 setSize (int $a_size)
 
 setInlineStyle (string $a_style)
 
 getInlineStyle ()
 
 setCssClass (string $a_class)
 
 getCssClass ()
 
 setValueByArray (array $a_values)
 
 getSize ()
 
 setSuffix (string $a_value)
 
 getSuffix ()
 
 setInputType (string $a_type)
 set input type More...
 
 getInputType ()
 
 setSubmitFormOnEnter (bool $a_val)
 
 getSubmitFormOnEnter ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 getDataSource ()
 
 setDataSource (string $href, ?string $a_delimiter=null)
 
 setDataSourceSubmitOnSelection (bool $a_stat)
 
 getDataSourceSubmitOnSelection ()
 
 setDataSourceSubmitUrl (string $a_url)
 
 getDataSourceSubmitUrl ()
 
 setMultiValues (array $a_values)
 
 render (string $a_mode="")
 
 insert (ilTemplate $a_tpl)
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 
 setDisableHtmlAutoComplete (bool $autocomplete)
 
 isHtmlAutoCompleteDisabled ()
 
 getPostValueForComparison ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem (ilFormPropertyGUI $a_item)
 
 getSubItems ()
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 
- Public Member Functions inherited from ilTableFilterItem
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 

Data Fields

const CONTEXT_QUESTION_PREVIEW = 'QuestionPreview'
 
const CONTEXT_CORRECT_SOLUTION_PRESENTATION = 'CorrectSolutionPresent'
 
const CONTEXT_USER_SOLUTION_PRESENTATION = 'UserSolutionPresent'
 
const CONTEXT_USER_SOLUTION_SUBMISSION = 'UserSolutionSubmit'
 
- Data Fields inherited from ilIdentifiedMultiValuesInputGUI
const ELEMENT_DEFAULT_ADD_CMD = 'addElement'
 
const ELEMENT_DEFAULT_REMOVE_CMD = 'removeElement'
 
const ELEMENT_DEFAULT_MOVE_UP_CMD = 'moveUpElement'
 
const ELEMENT_DEFAULT_MOVE_DOWN_CMD = 'moveDownElement'
 

Private Member Functions

 getGlobalTpl ()
 
 initListTemplate ()
 
 getCorrectness (int $identifier)
 
 getCorrectnessIcon ($correctness)
 
 getItemTemplate ()
 
 getThumbnailFilename ($element)
 
 getThumbnailSource ($element)
 
 getItemHtml (array $element, string $identifier, string $content_post_var, string $position_post_var, string $indentation_post_var)
 
 renderListItem (array $value, string $identifier, string $children)
 
 renderMainList ()
 
 addIdentifierToValues (array $values)
 
 buildHierarchicalTreeFromDBValues (array $values)
 
 buildHTMLView (array $array, \Closure $sort_closure)
 
 initializePlayerJS ()
 

Private Attributes

const POSTVAR_CONTENT = 'content'
 
const POSTVAR_POSITION = 'position'
 
const POSTVAR_INDENTATION = 'indentation'
 
const DEFAULT_THUMBNAIL_PREFIX = 'thumb.'
 
string $context = null
 
int $unique_prefix = null
 
int $ordering_type = null
 
string $thumbnail_filename_prefix = self::DEFAULT_THUMBNAIL_PREFIX
 
string $element_image_path = null
 
bool $show_correctness_icons_enabled = false
 
ilAssOrderingElementList $correctness_true_element_list = null
 
bool $interaction_enabled = true
 
bool $nesting_enabled = true
 
ilTemplate $list_tpl = null
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilIdentifiedMultiValuesInputGUI
 getMultiValueSubFieldId ($identifier, $sub_field_index)
 
 getMultiValuePosIndexedFieldId ($identifier, $position_index)
 
 getMultiValuePosIndexedSubFieldId ($identifier, $sub_field_index, $position_index)
 
 getFieldIdFromPostVar ($temp_post_var)
 
 getPostVarSubField ($sub_field_index)
 
 getMultiValuePostVarSubField ($identifier, $sub_field_index)
 
 getMultiValuePostVarSubFieldPosIndexed ($identifier, $sub_field_index, $position_index)
 
 getMultiValuePostVarPosIndexed ($identifier, $positionIndex)
 
 getMultiValuePostVar ($identifier)
 
 buildMultiValueSubmitVar ($identifier, $position_index, $submit_cmd)
 
 setIdentifiedMultiValuesByArray ($a_values)
 
 prepareMultiValuesInput ($values)
 
 prepareMultiValuesSubmit ($values)
 
 getFormValuesManipulators ()
 
 addFormValuesManipulator (ilFormValuesManipulator $manipulator)
 
 getSubFieldCompletedPostVar ($subFieldIndex, $elem_post_var)
 
- Protected Member Functions inherited from ilFormPropertyGUI
 symbol ()
 
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 
- Protected Attributes inherited from ilIdentifiedMultiValuesInputGUI
string $element_add_cmd = self::ELEMENT_DEFAULT_ADD_CMD
 
string $element_remove_cmd = self::ELEMENT_DEFAULT_REMOVE_CMD
 
string $element_move_up_cmd = self::ELEMENT_DEFAULT_MOVE_UP_CMD
 
string $element_move_down_cmd = self::ELEMENT_DEFAULT_MOVE_DOWN_CMD
 
 $identified_multi_values = []
 
 $formValuesManipulationChain = []
 
- Protected Attributes inherited from ilTextInputGUI
 $value = null
 
int $maxlength = 200
 
int $size = 40
 
string $validationRegexp = ""
 
string $validationFailureMessage = ''
 
string $suffix = ""
 
string $style_css = ""
 
string $css_class = ""
 
string $ajax_datasource = ""
 
string $ajax_datasource_delimiter = null
 
bool $ajax_datasource_commit = false
 
string $ajax_datasource_commit_url = ""
 
bool $submit_form_on_enter = false
 
bool $autocomplete_disabled = false
 
string $input_type = ""
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
array $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 22 of file class.ilAssNestedOrderingElementsInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssNestedOrderingElementsInputGUI::__construct ( ilAssOrderingFormValuesObjectsConverter  $converter,
  $postVar 
)

Definition at line 49 of file class.ilAssNestedOrderingElementsInputGUI.php.

50 {
51 global $DIC;
52 $this->ui_factory = $DIC['ui.factory'];
53 $this->ui_renderer = $DIC['ui.renderer'];
54 $manipulator = new ilAssOrderingDefaultElementFallback();
55 $this->addFormValuesManipulator($manipulator);
56
57 parent::__construct('', $postVar);
58
59 $this->addFormValuesManipulator($converter);
60 }
addFormValuesManipulator(ilFormValuesManipulator $manipulator)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ilIdentifiedMultiValuesInputGUI\addFormValuesManipulator().

+ Here is the call graph for this function:

Member Function Documentation

◆ addIdentifierToValues()

ilAssNestedOrderingElementsInputGUI::addIdentifierToValues ( array  $values)
private

Definition at line 320 of file class.ilAssNestedOrderingElementsInputGUI.php.

320 : array
321 {
322 foreach (array_keys($values) as $k) {
323 $values[$k]['identifier'] = str_replace(assOrderingQuestionGUI::F_NESTED_IDENTIFIER_PREFIX, '', $k);
324 }
325 return $values;
326 }

References assOrderingQuestionGUI\F_NESTED_IDENTIFIER_PREFIX.

◆ buildHierarchicalTreeFromDBValues()

ilAssNestedOrderingElementsInputGUI::buildHierarchicalTreeFromDBValues ( array  $values)
private

Definition at line 328 of file class.ilAssNestedOrderingElementsInputGUI.php.

328 : array
329 {
330 $values_with_parent = [];
331 $levels_array = [];
332 foreach ($values as $k => $v) {
333 $v['parent'] = null;
334 $v['children'] = [];
335
336 if ($v['ordering_indentation'] > 0) {
337 $v['parent'] = $levels_array[$v['ordering_indentation'] - 1];
338 }
339 $levels_array[$v['ordering_indentation']] = $k;
340 $values_with_parent[$k] = $v;
341 }
342
343 uasort(
344 $values_with_parent,
345 static fn(array $a, array $b): int => $b['ordering_indentation'] - $a['ordering_indentation']
346 );
347
348 foreach (array_keys($values_with_parent) as $k) {
349 $v = $values_with_parent[$k];
350 if ($v['parent'] !== null) {
351 $values_with_parent[$v['parent']]['children'][$k] = $v;
352 }
353 }
354
355 return array_filter(
356 $values_with_parent,
357 static fn(array $v): bool => $v['ordering_indentation'] === 0
358 );
359 }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, and Vendor\Package\$b.

◆ buildHTMLView()

ilAssNestedOrderingElementsInputGUI::buildHTMLView ( array  $array,
\Closure  $sort_closure 
)
private

Definition at line 361 of file class.ilAssNestedOrderingElementsInputGUI.php.

361 : string
362 {
363 usort($array, $sort_closure);
364 return array_reduce(
365 $array,
366 function (string $c, array $v) use ($sort_closure): string {
367 $children = '';
368 if ($this->nesting_enabled && $v['children'] !== []) {
369 $children = $this->buildHTMLView($v['children'], $sort_closure);
370 }
371 $c .= $this->renderListItem($v, $v['identifier'], $children);
372 return $c;
373 },
374 ''
375 );
376 }
renderListItem(array $value, string $identifier, string $children)
$c
Definition: deliver.php:25

References $c.

◆ getContext()

ilAssNestedOrderingElementsInputGUI::getContext ( )

Definition at line 103 of file class.ilAssNestedOrderingElementsInputGUI.php.

References $context.

◆ getCorrectness()

ilAssNestedOrderingElementsInputGUI::getCorrectness ( int  $identifier)
private

Definition at line 173 of file class.ilAssNestedOrderingElementsInputGUI.php.

173 : bool
174 {
175 return $this->getCorrectnessTrueElementList()->elementExistByRandomIdentifier($identifier);
176 }

References getCorrectnessTrueElementList().

+ Here is the call graph for this function:

◆ getCorrectnessIcon()

ilAssNestedOrderingElementsInputGUI::getCorrectnessIcon (   $correctness)
private

Definition at line 178 of file class.ilAssNestedOrderingElementsInputGUI.php.

178 : string
179 {
180 $icon_name = 'standard/icon_not_ok.svg';
181 $label = $this->lng->txt("answer_is_wrong");
182 if ($correctness === 'correct') {
183 $icon_name = 'standard/icon_ok.svg';
184 $label = $this->lng->txt("answer_is_right");
185 }
186 $path = ilUtil::getImagePath($icon_name);
187 $icon = $this->ui_factory->symbol()->icon()->custom(
188 $path,
189 $label
190 );
191 return $this->ui_renderer->render($icon);
192 }
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
$path
Definition: ltiservices.php:30

References $path, ilUtil\getImagePath(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getCorrectnessTrueElementList()

ilAssNestedOrderingElementsInputGUI::getCorrectnessTrueElementList ( )

◆ getElementImagePath()

ilAssNestedOrderingElementsInputGUI::getElementImagePath ( )

Definition at line 138 of file class.ilAssNestedOrderingElementsInputGUI.php.

References $element_image_path.

Referenced by getThumbnailSource().

+ Here is the caller graph for this function:

◆ getElementList()

ilAssNestedOrderingElementsInputGUI::getElementList ( int  $questionId)

Definition at line 87 of file class.ilAssNestedOrderingElementsInputGUI.php.

References ilAssOrderingElementList\buildInstance(), and ilIdentifiedMultiValuesInputGUI\getIdentifiedMultiValues().

Referenced by prepareReprintable().

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

◆ getGlobalTpl()

ilAssNestedOrderingElementsInputGUI::getGlobalTpl ( )
private

Definition at line 72 of file class.ilAssNestedOrderingElementsInputGUI.php.

73 {
74 return isset($GLOBALS['DIC']) ? $GLOBALS['DIC']['tpl'] : $GLOBALS['tpl'];
75 }
$GLOBALS["DIC"]
Definition: wac.php:54

References $GLOBALS.

◆ getHTML()

ilAssNestedOrderingElementsInputGUI::getHTML ( )

Definition at line 392 of file class.ilAssNestedOrderingElementsInputGUI.php.

392 : string
393 {
394 return $this->render();
395 }

◆ getItemHtml()

ilAssNestedOrderingElementsInputGUI::getItemHtml ( array  $element,
string  $identifier,
string  $content_post_var,
string  $position_post_var,
string  $indentation_post_var 
)
private

Definition at line 209 of file class.ilAssNestedOrderingElementsInputGUI.php.

215 : string {
216 $tpl = $this->getItemTemplate();
217
218 switch ($this->getOrderingType()) {
221
222 $tpl->setCurrentBlock('item_text');
223 $tpl->setVariable('ITEM_CONTENT', ilLegacyFormElementsUtil::prepareFormOutput($element['content']));
224 $tpl->parseCurrentBlock();
225 break;
226
229
230 $tpl->setCurrentBlock('item_image');
231 $tpl->setVariable('ITEM_SOURCE', $this->getThumbnailSource($element));
232 $tpl->setVariable('ITEM_CONTENT', $this->getThumbnailFilename($element));
233 $tpl->parseCurrentBlock();
234 break;
235 }
236
237 if ($this->isShowCorrectnessIconsEnabled()) {
238 $correctness = 'not_correct';
239 if ($this->getCorrectness($identifier)) {
240 $correctness = 'correct';
241 }
242 $tpl->setCurrentBlock('correctness_icon');
243
244 $tpl->setVariable('ICON_OK', $this->getCorrectnessIcon($correctness));
245 $tpl->parseCurrentBlock();
246 }
247
248 $tpl->setCurrentBlock('item');
249 $tpl->setVariable('ITEM_CONTENT_POSTVAR', $content_post_var);
250 $tpl->setVariable('ITEM_CONTENT', ilLegacyFormElementsUtil::prepareFormOutput($element['content']));
251 $tpl->setVariable('ITEM_POSITION_POSTVAR', $position_post_var);
252 $tpl->setVariable('ITEM_POSITION', $element['ordering_position']);
253 $tpl->setVariable('ITEM_INDENTATION_POSTVAR', $indentation_post_var);
254 $tpl->setVariable('ITEM_INDENTATION', $element['ordering_indentation']);
255 $tpl->parseCurrentBlock();
256
257 return $tpl->get();
258 }
static prepareFormOutput($a_str, bool $a_strip=false)

References getThumbnailFilename(), getThumbnailSource(), assOrderingQuestion\OQ_NESTED_PICTURES, assOrderingQuestion\OQ_NESTED_TERMS, assOrderingQuestion\OQ_PICTURES, assOrderingQuestion\OQ_TERMS, and ilLegacyFormElementsUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ getItemTemplate()

ilAssNestedOrderingElementsInputGUI::getItemTemplate ( )
private

Definition at line 194 of file class.ilAssNestedOrderingElementsInputGUI.php.

194 : ilTemplate
195 {
196 return new ilTemplate('tpl.prop_ass_nested_order_elem.html', true, true, 'components/ILIAS/TestQuestionPool');
197 }
special template class to simplify handling of ITX/PEAR

◆ getOrderingType()

ilAssNestedOrderingElementsInputGUI::getOrderingType ( )

◆ getThumbnailFilename()

ilAssNestedOrderingElementsInputGUI::getThumbnailFilename (   $element)
private

Definition at line 199 of file class.ilAssNestedOrderingElementsInputGUI.php.

199 : string
200 {
201 return $this->getThumbPrefix() . $element['content'];
202 }

References getThumbPrefix().

Referenced by getItemHtml(), and getThumbnailSource().

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

◆ getThumbnailSource()

ilAssNestedOrderingElementsInputGUI::getThumbnailSource (   $element)
private

Definition at line 204 of file class.ilAssNestedOrderingElementsInputGUI.php.

204 : string
205 {
206 return $this->getElementImagePath() . $this->getThumbnailFilename($element);
207 }

References getElementImagePath(), and getThumbnailFilename().

Referenced by getItemHtml().

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

◆ getThumbPrefix()

ilAssNestedOrderingElementsInputGUI::getThumbPrefix ( )

Definition at line 148 of file class.ilAssNestedOrderingElementsInputGUI.php.

References $thumbnail_filename_prefix.

Referenced by getThumbnailFilename().

+ Here is the caller graph for this function:

◆ getUniquePrefix()

ilAssNestedOrderingElementsInputGUI::getUniquePrefix ( )

◆ initializePlayerJS()

ilAssNestedOrderingElementsInputGUI::initializePlayerJS ( )
private

Definition at line 397 of file class.ilAssNestedOrderingElementsInputGUI.php.

397 : void
398 {
399 $this->getGlobalTpl()->addJavascript('assets/js/orderingvertical.js');
400 $this->getGlobalTpl()->addOnLoadCode(
401 'il.test.orderingvertical.init(document.querySelector("#nestable_ordering"));'
402 );
403 }

◆ initListTemplate()

ilAssNestedOrderingElementsInputGUI::initListTemplate ( )
private

Definition at line 77 of file class.ilAssNestedOrderingElementsInputGUI.php.

77 : void
78 {
79 $this->list_tpl = new ilTemplate('tpl.prop_nested_ordering_list.html', true, true, 'components/ILIAS/TestQuestionPool');
80 }

◆ isPostSubmit()

ilAssNestedOrderingElementsInputGUI::isPostSubmit (   $data)

Definition at line 260 of file class.ilAssNestedOrderingElementsInputGUI.php.

260 : bool
261 {
262 if (!is_array($data)) {
263 return false;
264 }
265
266 if (!isset($data[$this->getPostVar()])) {
267 return false;
268 }
269
270 if (!count($data[$this->getPostVar()])) {
271 return false;
272 }
273
274 return true;
275 }

References $data.

◆ isShowCorrectnessIconsEnabled()

ilAssNestedOrderingElementsInputGUI::isShowCorrectnessIconsEnabled ( )

◆ onCheckInput()

ilAssNestedOrderingElementsInputGUI::onCheckInput ( )

Reimplemented from ilIdentifiedMultiValuesInputGUI.

Definition at line 387 of file class.ilAssNestedOrderingElementsInputGUI.php.

387 : bool
388 {
389 return true;
390 }

◆ prepareReprintable()

ilAssNestedOrderingElementsInputGUI::prepareReprintable ( assQuestion  $question)

Reimplemented from ilIdentifiedMultiValuesInputGUI.

Definition at line 92 of file class.ilAssNestedOrderingElementsInputGUI.php.

92 : void
93 {
94 $elementList = $this->getElementList($question->getId());
95
96 $elementList->completeContentsFromElementList(
97 $question->getOrderingElementList()
98 );
99
100 $this->setElementList($elementList);
101 }

References getElementList(), assQuestion\getId(), and setElementList().

+ Here is the call graph for this function:

◆ render()

ilAssNestedOrderingElementsInputGUI::render ( string  $a_mode = '')

Reimplemented from ilTextInputGUI.

Definition at line 378 of file class.ilAssNestedOrderingElementsInputGUI.php.

378 : string
379 {
380 if ($this->interaction_enabled) {
381 $this->initializePlayerJS();
382 }
383
384 return $this->renderMainList();
385 }

◆ renderListItem()

ilAssNestedOrderingElementsInputGUI::renderListItem ( array  $value,
string  $identifier,
string  $children 
)
private

Definition at line 277 of file class.ilAssNestedOrderingElementsInputGUI.php.

277 : string
278 {
279 $list_item_tpl = new ilTemplate('tpl.prop_nested_ordering_list_item.html', true, true, 'components/ILIAS/TestQuestionPool');
280 $content_post_var = $this->getMultiValuePostVarSubField($identifier, self::POSTVAR_CONTENT);
281 $position_post_var = $this->getMultiValuePostVarSubField($identifier, self::POSTVAR_POSITION);
282 $indentation_post_var = $this->getMultiValuePostVarSubField($identifier, self::POSTVAR_INDENTATION);
283
284 $list_item_tpl->setVariable('LIST_ITEM_VALUE', $this->getItemHtml(
285 $value,
286 $identifier,
287 $content_post_var,
288 $position_post_var,
289 $indentation_post_var
290 ));
291
292 if ($this->nesting_enabled) {
293 $list_item_tpl->setCurrentBlock('nested_list');
294 $list_item_tpl->setVariable('SUB_LIST', $children);
295 $list_item_tpl->parseCurrentBlock();
296 }
297 return $list_item_tpl->get();
298 }
getItemHtml(array $element, string $identifier, string $content_post_var, string $position_post_var, string $indentation_post_var)
getMultiValuePostVarSubField($identifier, $sub_field_index)

◆ renderMainList()

ilAssNestedOrderingElementsInputGUI::renderMainList ( )
private

Definition at line 300 of file class.ilAssNestedOrderingElementsInputGUI.php.

300 : string
301 {
302 $this->initListTemplate();
303
304 $values = $this->addIdentifierToValues($this->getIdentifiedMultiValues());
305 if ($this->nesting_enabled) {
306 $values = $this->buildHierarchicalTreeFromDBValues($values);
307 }
308
309 $this->list_tpl->setVariable(
310 'LIST_ITEMS',
311 $this->buildHTMLView(
312 $values,
313 static fn(array $a, array $b): int => $a['ordering_position'] - $b['ordering_position']
314 )
315 );
316
317 return $this->list_tpl->get();
318 }

References Vendor\Package\$a, and Vendor\Package\$b.

◆ setContext()

ilAssNestedOrderingElementsInputGUI::setContext ( string  $context)

Definition at line 108 of file class.ilAssNestedOrderingElementsInputGUI.php.

108 : void
109 {
110 $this->context = $context;
111 }

References $context.

◆ setCorrectnessTrueElementList()

ilAssNestedOrderingElementsInputGUI::setCorrectnessTrueElementList ( ilAssOrderingElementList  $correctness_true_element_list)

Definition at line 168 of file class.ilAssNestedOrderingElementsInputGUI.php.

168 : void
169 {
170 $this->correctness_true_element_list = $correctness_true_element_list;
171 }

References $correctness_true_element_list.

◆ setElementImagePath()

ilAssNestedOrderingElementsInputGUI::setElementImagePath ( string  $element_image_path)

Definition at line 133 of file class.ilAssNestedOrderingElementsInputGUI.php.

133 : void
134 {
135 $this->element_image_path = $element_image_path;
136 }

References $element_image_path.

◆ setElementList()

ilAssNestedOrderingElementsInputGUI::setElementList ( ilAssOrderingElementList  $elementList)

Definition at line 82 of file class.ilAssNestedOrderingElementsInputGUI.php.

References ilAssOrderingElementList\getRandomIdentifierIndexedElements(), and ilIdentifiedMultiValuesInputGUI\setIdentifiedMultiValues().

Referenced by prepareReprintable().

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

◆ setInteractionEnabled()

ilAssNestedOrderingElementsInputGUI::setInteractionEnabled ( bool  $interaction_enabled)

Definition at line 62 of file class.ilAssNestedOrderingElementsInputGUI.php.

62 : void
63 {
64 $this->interaction_enabled = $interaction_enabled;
65 }

References $interaction_enabled.

◆ setNestingEnabled()

ilAssNestedOrderingElementsInputGUI::setNestingEnabled ( bool  $nesting_enabled)

Definition at line 67 of file class.ilAssNestedOrderingElementsInputGUI.php.

67 : void
68 {
69 $this->nesting_enabled = $nesting_enabled;
70 }

References $nesting_enabled.

◆ setOrderingType()

ilAssNestedOrderingElementsInputGUI::setOrderingType ( int  $ordering_type)

Definition at line 123 of file class.ilAssNestedOrderingElementsInputGUI.php.

123 : void
124 {
125 $this->ordering_type = $ordering_type;
126 }

References $ordering_type.

◆ setShowCorrectnessIconsEnabled()

ilAssNestedOrderingElementsInputGUI::setShowCorrectnessIconsEnabled ( bool  $show_correctness_icons_enabled)

Definition at line 153 of file class.ilAssNestedOrderingElementsInputGUI.php.

153 : void
154 {
155 $this->show_correctness_icons_enabled = $show_correctness_icons_enabled;
156 }

References $show_correctness_icons_enabled.

◆ setThumbPrefix()

ilAssNestedOrderingElementsInputGUI::setThumbPrefix ( string  $thumbnail_filename_prefix)

Definition at line 143 of file class.ilAssNestedOrderingElementsInputGUI.php.

143 : void
144 {
145 $this->thumbnail_filename_prefix = $thumbnail_filename_prefix;
146 }

References $thumbnail_filename_prefix.

◆ setUniquePrefix()

ilAssNestedOrderingElementsInputGUI::setUniquePrefix ( int  $unique_prefix)

Definition at line 118 of file class.ilAssNestedOrderingElementsInputGUI.php.

118 : void
119 {
120 $this->unique_prefix = $unique_prefix;
121 }

References $unique_prefix.

Field Documentation

◆ $context

string ilAssNestedOrderingElementsInputGUI::$context = null
private

Definition at line 35 of file class.ilAssNestedOrderingElementsInputGUI.php.

Referenced by getContext(), and setContext().

◆ $correctness_true_element_list

ilAssOrderingElementList ilAssNestedOrderingElementsInputGUI::$correctness_true_element_list = null
private

◆ $element_image_path

string ilAssNestedOrderingElementsInputGUI::$element_image_path = null
private

◆ $interaction_enabled

bool ilAssNestedOrderingElementsInputGUI::$interaction_enabled = true
private

Definition at line 42 of file class.ilAssNestedOrderingElementsInputGUI.php.

Referenced by setInteractionEnabled().

◆ $list_tpl

ilTemplate ilAssNestedOrderingElementsInputGUI::$list_tpl = null
private

◆ $nesting_enabled

bool ilAssNestedOrderingElementsInputGUI::$nesting_enabled = true
private

Definition at line 43 of file class.ilAssNestedOrderingElementsInputGUI.php.

Referenced by setNestingEnabled().

◆ $ordering_type

int ilAssNestedOrderingElementsInputGUI::$ordering_type = null
private

◆ $show_correctness_icons_enabled

bool ilAssNestedOrderingElementsInputGUI::$show_correctness_icons_enabled = false
private

◆ $thumbnail_filename_prefix

string ilAssNestedOrderingElementsInputGUI::$thumbnail_filename_prefix = self::DEFAULT_THUMBNAIL_PREFIX
private

Definition at line 38 of file class.ilAssNestedOrderingElementsInputGUI.php.

Referenced by getThumbPrefix(), and setThumbPrefix().

◆ $ui_factory

UIFactory ilAssNestedOrderingElementsInputGUI::$ui_factory
private

◆ $ui_renderer

UIRenderer ilAssNestedOrderingElementsInputGUI::$ui_renderer
private

◆ $unique_prefix

int ilAssNestedOrderingElementsInputGUI::$unique_prefix = null
private

◆ CONTEXT_CORRECT_SOLUTION_PRESENTATION

const ilAssNestedOrderingElementsInputGUI::CONTEXT_CORRECT_SOLUTION_PRESENTATION = 'CorrectSolutionPresent'

◆ CONTEXT_QUESTION_PREVIEW

const ilAssNestedOrderingElementsInputGUI::CONTEXT_QUESTION_PREVIEW = 'QuestionPreview'

◆ CONTEXT_USER_SOLUTION_PRESENTATION

const ilAssNestedOrderingElementsInputGUI::CONTEXT_USER_SOLUTION_PRESENTATION = 'UserSolutionPresent'

◆ CONTEXT_USER_SOLUTION_SUBMISSION

const ilAssNestedOrderingElementsInputGUI::CONTEXT_USER_SOLUTION_SUBMISSION = 'UserSolutionSubmit'

◆ DEFAULT_THUMBNAIL_PREFIX

const ilAssNestedOrderingElementsInputGUI::DEFAULT_THUMBNAIL_PREFIX = 'thumb.'
private

◆ POSTVAR_CONTENT

const ilAssNestedOrderingElementsInputGUI::POSTVAR_CONTENT = 'content'
private

◆ POSTVAR_INDENTATION

const ilAssNestedOrderingElementsInputGUI::POSTVAR_INDENTATION = 'indentation'
private

◆ POSTVAR_POSITION

const ilAssNestedOrderingElementsInputGUI::POSTVAR_POSITION = 'position'
private

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