ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilCmiXapiLP.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
30 class ilCmiXapiLP extends ilObjectLP
31 {
32  public const MOVEON_COMPLETED = 'Completed';
33  public const MOVEON_PASSED = 'Passed';
34  public const MOVEON_COMPLETED_OR_PASSED = 'CompletedOrPassed';
35  public const MOVEON_COMPLETED_AND_PASSED = 'CompletedAndPassed';
36  public const MOVEON_NOT_APPLICABLE = 'NotApplicable';
37 
38  public function initModeOptions(ilRadioGroupInputGUI $modeRadio): void
39  {
40  global $DIC; /* @var \ILIAS\DI\Container $DIC */
41  $modeCompleted = new ilRadioOption(
42  $DIC->language()->txt('cmix_lp_mode_deactivated'),
44  );
45  $modeCompleted->setInfo($DIC->language()->txt('cmix_lp_mode_deactivated_info'));
46  $modeRadio->addOption($modeCompleted);
47 
48  $modeCompleted = new ilRadioOption(
49  $DIC->language()->txt('cmix_lp_mode_when_completed'),
51  );
52  $modeCompleted->setInfo($DIC->language()->txt('cmix_lp_mode_when_completed_info'));
53  $modeRadio->addOption($modeCompleted);
54  $modeCompletedFailed = new ilCheckboxInputGUI(
55  $DIC->language()->txt('cmix_lp_mode_with_failed'),
56  'modus_' . ilLPObjSettings::LP_MODE_CMIX_COMPLETED . '_failed'
57  );
58  $modeCompletedFailed->setInfo($DIC->language()->txt('cmix_lp_mode_with_failed_info'));
59  $modeCompleted->addSubItem($modeCompletedFailed);
60 
61  $modePassed = new ilRadioOption(
62  $DIC->language()->txt('cmix_lp_mode_when_passed'),
64  );
65  $modePassed->setInfo($DIC->language()->txt('cmix_lp_mode_when_passed_info'));
66  $modeRadio->addOption($modePassed);
67  $modePassedFailed = new ilCheckboxInputGUI(
68  $DIC->language()->txt('cmix_lp_mode_with_failed'),
69  'modus_' . ilLPObjSettings::LP_MODE_CMIX_PASSED . '_failed'
70  );
71  $modePassedFailed->setInfo($DIC->language()->txt('cmix_lp_mode_with_failed_info'));
72  $modePassed->addSubItem($modePassedFailed);
73 
74  $modePassedOrCompleted = new ilRadioOption(
75  $DIC->language()->txt('cmix_lp_mode_when_passed_or_completed'),
77  );
78  $modePassedOrCompleted->setInfo($DIC->language()->txt('cmix_lp_mode_when_passed_or_completed_info'));
79  $modeRadio->addOption($modePassedOrCompleted);
80  $modePassedOrCompletedFailed = new ilCheckboxInputGUI(
81  $DIC->language()->txt('cmix_lp_mode_with_failed'),
83  );
84  $modePassedOrCompletedFailed->setInfo($DIC->language()->txt('cmix_lp_mode_with_failed_info'));
85  $modePassedOrCompleted->addSubItem($modePassedOrCompletedFailed);
86 
87  switch ($this->getCurrentMode()) {
90  break;
92  $modeRadio->setValue((string) ilLPObjSettings::LP_MODE_CMIX_COMPLETED);
93  $modeCompletedFailed->setChecked(true);
94  break;
96  $modeRadio->setValue((string) ilLPObjSettings::LP_MODE_CMIX_PASSED);
97  break;
99  $modeRadio->setValue((string) ilLPObjSettings::LP_MODE_CMIX_PASSED);
100  $modePassedFailed->setChecked(true);
101  break;
104  break;
106  $modeRadio->setValue((string) ilLPObjSettings::LP_MODE_CMIX_COMPLETED_OR_PASSED);
107  $modePassedOrCompletedFailed->setChecked(true);
108  break;
109  }
110  }
111 
112  public function fetchModeOption(ilPropertyFormGUI $form): int
113  {
114  $mainMode = (int) $form->getInput('modus');
115  $failedOpt = (int) $form->getInput('modus_' . $mainMode . '_failed');
116 
117  if ($failedOpt) {
118  switch ($mainMode) {
121 
124 
127  }
128  }
129 
130  return $mainMode;
131  }
132 
133  public function getDefaultMode(): int
134  {
136  }
137 
138  public function getValidModes(): array
139  {
140  return array(
148  );
149  }
150 }
This class represents an option in a radio group.
initModeOptions(ilRadioGroupInputGUI $modeRadio)
const MOVEON_COMPLETED_AND_PASSED
const MOVEON_NOT_APPLICABLE
addOption(ilRadioOption $a_option)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
fetchModeOption(ilPropertyFormGUI $form)
This class represents a property in a property form.
global $DIC
Definition: shib_login.php:22
const LP_MODE_CMIX_COMPL_OR_PASSED_WITH_FAILED
const MOVEON_COMPLETED_OR_PASSED