19 declare(strict_types=1);
    54         $this->
ctrl = $DIC[
'ilCtrl'];
    55         $this->
lng = $DIC[
'lng'];
    56         $this->tpl = $DIC[
'tpl'];
    57         $this->
toolbar = $DIC[
'ilToolbar'];
    58         $this->
tabs = $DIC[
'ilTabs'];
    60         $this->post_wrapper = $DIC->http()->wrapper()->post();
    61         $this->request = $DIC->http()->request();
    63         $this->ui_factory = $DIC[
'ui.factory'];
    64         $this->ui_renderer = $DIC[
'ui.renderer'];
    70         $cmd = $this->
ctrl->getCmd(
'showMarkSchema');
    76         if (!$this->
object->canEditMarks()) {
    77             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'), 
true);
    78             $this->
ctrl->redirect($this, 
'showMarkSchema');
    87         $this->
object->getMarkSchema()->addMarkStep();
    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;
   127         $this->
object->getMarkSchema()->createSimpleSchema(
   128             $this->
lng->txt(
'failed_short'),
   129             $this->
lng->txt(
'failed_official'),
   132             $this->
lng->txt(
'passed_short'),
   133             $this->
lng->txt(
'passed_official'),
   137         $this->
object->getMarkSchema()->saveToDb($this->
object->getTestId());
   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());
   191             $result = $this->
object->checkMarks();
   193             $result = 
'mark_schema_invalid';
   196         if (is_string($result)) {
   197             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt($result), 
true);
   199             $this->
object->getMarkSchema()->saveToDb($this->
object->getMarkSchemaForeignId());
   200             $this->
object->onMarkSchemaSaved();
   201             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'), 
true);
   202             $this->
object->getMarkSchema()->flush();
   203             $this->
object->getMarkSchema()->loadFromDb($this->
object->getTestId());
   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
   238         $create_simple_schema_button = $this->ui_factory->button()->standard(
   239             $this->
lng->txt(
'tst_mark_reset_to_simple_mark_schema'),
   240             $confirmation_modal->getShowSignal()
   242         $this->
toolbar->addComponent($create_simple_schema_button);
   245         $this->
toolbar->addComponent($create_step_button);
   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);' 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
ilGlobalPageTemplate $tpl
 
populateToolbar(InterruptiveModal $confirmation_modal, string $mark_schema_id)
 
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
 
resetToSimpleMarkSchema()
 
withAdditionalOnLoadCode(Closure $binder)
 
populateMarkSchemaFormData()
 
RequestWrapper $post_wrapper
 
Interface RequestWrapper. 
 
ensureMarkSchemaCanBeEdited()
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
buildCreateStepButton(string $mark_schema_id)