Definition at line 34 of file class.ilMarkSchemaGUI.php.
◆ addMarkStep()
ilMarkSchemaGUI::addMarkStep |
( |
| ) |
|
|
protected |
◆ buildCreateStepButton()
ilMarkSchemaGUI::buildCreateStepButton |
( |
string |
$mark_schema_id | ) |
|
|
private |
Definition at line 248 of file class.ilMarkSchemaGUI.php.
References $id, ILIAS\Repository\lng(), and ILIAS\UI\Implementation\Component\withAdditionalOnLoadCode().
Referenced by populateToolbar().
250 return $this->ui_factory->button()->standard(
251 $this->
lng->txt(
'tst_mark_create_new_mark_step'),
254 fn(
string $id):
string =>
255 "{$id}.addEventListener('click', " 257 .
' e.preventDefault();' 258 .
' e.target.name = "cmd[addMarkStep]";' 259 .
" let form = document.getElementById('form_{$mark_schema_id}');" 260 .
' let submitter = e.target.cloneNode();' 261 .
' submitter.style.visibility = "hidden";' 262 .
' form.appendChild(submitter);' 263 .
' form.requestSubmit(submitter);'
withAdditionalOnLoadCode(Closure $binder)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
◆ deleteMarkSteps()
ilMarkSchemaGUI::deleteMarkSteps |
( |
| ) |
|
|
protected |
Definition at line 141 of file class.ilMarkSchemaGUI.php.
References ensureMarkSchemaCanBeEdited(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ILIAS\Repository\refinery(), and showMarkSchema().
143 $marks_trafo = $this->
refinery->custom()->transformation(
144 function ($vs): ?array {
145 if ($vs === null || !is_array($vs)) {
151 $deleted_mark_steps = null;
152 if ($this->post_wrapper->has(
'marks')) {
153 $deleted_mark_steps = $this->post_wrapper->retrieve(
160 if (!isset($deleted_mark_steps) || !is_array($deleted_mark_steps)) {
166 $schema = clone $this->
object->getMarkSchema();
167 $schema->deleteMarkSteps($deleted_mark_steps);
168 $check_result = $schema->checkMarks();
169 if (is_string($check_result)) {
170 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($check_result),
true);
176 if (!empty($deleted_mark_steps)) {
177 $this->
object->getMarkSchema()->deleteMarkSteps($deleted_mark_steps);
179 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'tst_delete_missing_mark'));
181 $this->
object->getMarkSchema()->saveToDb($this->
object->getTestId());
ensureMarkSchemaCanBeEdited()
◆ ensureMarkSchemaCanBeEdited()
ilMarkSchemaGUI::ensureMarkSchemaCanBeEdited |
( |
| ) |
|
|
protected |
◆ executeCommand()
ilMarkSchemaGUI::executeCommand |
( |
| ) |
|
◆ populateMarkSchemaFormData()
ilMarkSchemaGUI::populateMarkSchemaFormData |
( |
| ) |
|
|
protected |
Definition at line 91 of file class.ilMarkSchemaGUI.php.
References ILIAS\LTI\ToolProvider\$key, and ilUtil\stripSlashes().
Referenced by addMarkStep(), and saveMarks().
93 $no_save_error =
true;
94 $this->
object->getMarkSchema()->flush();
95 $postdata = $this->request->getParsedBody();
96 foreach ($postdata as
$key => $value) {
97 if (preg_match(
'/mark_short_(\d+)/',
$key, $matches)) {
99 if (isset($postdata[
"passed_$matches[1]"])) {
103 $percentage = str_replace(
',',
'.',
ilUtil::stripSlashes($postdata[
"mark_percentage_$matches[1]"]));
104 if (!is_numeric($percentage)
105 || (
float) $percentage < 0.0
106 || (
float) $percentage > 100.0) {
108 $no_save_error =
false;
111 $this->
object->getMarkSchema()->addMarkStep(
120 return $no_save_error;
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
◆ populateToolbar()
ilMarkSchemaGUI::populateToolbar |
( |
InterruptiveModal |
$confirmation_modal, |
|
|
string |
$mark_schema_id |
|
) |
| |
|
private |
◆ resetToSimpleMarkSchema()
ilMarkSchemaGUI::resetToSimpleMarkSchema |
( |
| ) |
|
|
protected |
◆ saveMarks()
ilMarkSchemaGUI::saveMarks |
( |
| ) |
|
|
protected |
◆ showMarkSchema()
ilMarkSchemaGUI::showMarkSchema |
( |
| ) |
|
|
protected |
Definition at line 209 of file class.ilMarkSchemaGUI.php.
References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), populateToolbar(), and ILIAS\Repository\toolbar().
Referenced by addMarkStep(), deleteMarkSteps(), resetToSimpleMarkSchema(), and saveMarks().
211 if (!$this->
object->canEditMarks()) {
212 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'cannot_edit_marks'));
215 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this,
'showMarkSchema'));
218 $mark_schema_table->setShowRowsSelector(
false);
220 $rendered_modal =
'';
221 if ($this->
object->canEditMarks()) {
222 $confirmation_modal = $this->ui_factory->modal()->interruptive(
223 $this->
lng->txt(
'tst_mark_reset_to_simple_mark_schema'),
224 $this->
lng->txt(
'tst_mark_reset_to_simple_mark_schema_confirmation'),
225 $this->
ctrl->getFormAction($this,
'resetToSimpleMarkSchema')
226 )->withActionButtonLabel($this->
lng->txt(
'tst_mark_reset_to_simple_mark_schema'));
227 $this->
populateToolbar($confirmation_modal, $mark_schema_table->getId());
228 $rendered_modal = $this->ui_renderer->render($confirmation_modal);
231 $this->tpl->setContent(
232 $mark_schema_table->getHTML() . $rendered_modal
populateToolbar(InterruptiveModal $confirmation_modal, string $mark_schema_id)
◆ $ctrl
◆ $lng
◆ $object
◆ $post_wrapper
◆ $refinery
Refinery ilMarkSchemaGUI::$refinery |
|
private |
◆ $request
Request ilMarkSchemaGUI::$request |
|
private |
◆ $tabs
◆ $toolbar
◆ $tpl
◆ $ui_factory
UIFactory ilMarkSchemaGUI::$ui_factory |
|
protected |
◆ $ui_renderer
UIRenderer ilMarkSchemaGUI::$ui_renderer |
|
protected |
The documentation for this class was generated from the following file: