29     public function __construct(
string $a_title = 
"", 
string $a_postvar = 
"")
    32         $this->post = $this->
http->wrapper()->post();
    33         $this->query = $this->
http->wrapper()->query();
    42         $this->value = $a_value;
    51         if (isset($editOrOpen[
'author'])) {
    52             $json = json_decode($this->post->retrieve(
    54                 $this->refinery->kindlyTo()->string()
    55             ), 
true, 512, JSON_THROW_ON_ERROR);
    63         $this->value_combination = 
$value;
    72         if (isset($editOrOpen[
'author'])) {
    73             return json_decode($this->post->retrieve(
    74                 "gap_json_combination_post",
    75                 $this->refinery->kindlyTo()->string()
    76             ), 
true, 512, JSON_THROW_ON_ERROR);
    86                 if ($row[
'row_id'] == 0) {
    87                     $return_array[$row[
'cid']][0][] = $row[
'gap_fi'];
    89                 $return_array[$row[
'cid']][1][$row[
'row_id']][] = $row[
'answer'];
    90                 $return_array[$row[
'cid']][2][$row[
'row_id']] = $row[
'points']; 
   102         $json = self::stripSlashesRecursive(
   104                 $this->post->retrieve(
   106                     $this->refinery->kindlyTo()->string()
   114         $gap = self::stripSlashesRecursive($this->
raw(
'gap'));
   115         $gaps_used_in_combination = [];
   116         if ($this->post->has(
'gap_combination')) {
   117             $gapCombination = $this->post->retrieve(
   119                 $this->
refinery->kindlyTo()->recordOf(
   130             $gapCombinationValues = $this->post->retrieve(
   131                 "gap_combination_values",
   132                 $this->
refinery->kindlyTo()->listOf(
   139             $gap_with_points = [];
   141             for ($i = 0, $iMax = count($gapCombination[
'select']); $i < $iMax; $i++) {
   142                 foreach ($gapCombination[
'select'][$i] as $key => $item) {
   143                     if ($item == 
'none_selected_minus_one') {
   146                     $gaps_used_in_combination[$item] = $item;
   147                     $check_points_for_best_scoring = 
false;
   148                     foreach ($gapCombinationValues[$i] as $index => $answeritems) {
   149                         foreach ($answeritems as $answeritem) {
   150                             if ($answeritem == 
'none_selected_minus_one') {
   154                         $points = $gapCombination[
'points'][$i][$index];
   156                             $check_points_for_best_scoring = 
true;
   159                     if (!$check_points_for_best_scoring) {
   166         if (is_array($gap)) {
   167             foreach ($gap as $key => $item) {
   169                 $gapsize = $this->
raw(
'gap_' . $key . 
'_gapsize');
   171                 $json[0][$key][
'text_field_length'] = $gapsize > 0 ? $gapsize : 
'';
   173                 $select_at_least_on_positive = 
false;
   175                     $gapText = self::stripSlashesRecursive($this->
raw(
'gap_' . $key), 
false);
   176                     foreach ($gapText[
'answer'] as $row => $answer) {
   177                         if (!isset($answer) || $answer == 
'') {
   182                     if (array_key_exists(
'points', $gapText)) {
   183                         foreach ($gapText[
'points'] as $row => $points) {
   184                             $points = str_replace(
',', 
'.', $points);
   185                             if (isset($points) && $points != 
'' && is_numeric($points)) {
   186                                 $points_sum += $points;
   188                                     $select_at_least_on_positive = 
true;
   194                         if (isset($gap_with_points) && is_array($gap_with_points) && array_key_exists($key, $gap_with_points)) {
   195                             $points_sum += $gap_with_points[$key];
   197                         if ($points_sum <= 0) {
   198                             if (!array_key_exists($key, $gaps_used_in_combination) && (!$getType == 
'select' || $select_at_least_on_positive == 
false)) {
   208                     $eval->suppress_errors = 
true;
   210                     $mark_errors = [
'answer' => 
false, 
'lower' => 
false, 
'upper' => 
false, 
'points' => 
false];
   211                     foreach ([  
'answer' => 
'_numeric',
   212                                     'lower' => 
'_numeric_lower',
   213                                     'upper' => 
'_numeric_upper',
   214                                     'points' => 
'_numeric_points'] as $part => $suffix) {
   216                         $val = str_replace(
',', 
'.', $val);
   217                         if ($eval->e($val) === 
false) {
   218                             $mark_errors[$part] = 
true;
   222                         if ($part == 
'points') {
   227                     if (isset($gap_with_points) && is_array($gap_with_points) && array_key_exists($key, $gap_with_points)) {
   228                         $points += $gap_with_points[$key];
   231                     if (!isset($points) || $points == 
'' || !is_numeric($points) || $points == 0) {
   232                         if (!array_key_exists($key, $gaps_used_in_combination)) {
   237                     $json[0][$key][
"values"][0][
"error"] = $mark_errors;
   252     public function insert(
ilTemplate $template): 
void   257         $glyph_factory = $DIC->ui()->factory()->symbol()->glyph();
   260         $cloze_settings_js = 
'ClozeSettings = {'   261             . 
' gaps_php             : ' . json_encode([$this->
getValue()])
   264             . 
',unused_gaps_comb     : []'   265             . 
',outofbound_text      : ' . 
'"' . 
$lng->
txt(
'out_of_range') . 
'"'   266             . 
',inrange_text      : ' . 
'"' . 
$lng->
txt(
'in_range') . 
'"'   267             . 
',combination_error    : ' . 
'"' . 
$lng->
txt(
'please_select') . 
'"'   268             . 
',combination_text     : ' . 
'"' . 
$lng->
txt(
'gap_combination') . 
'"'   269             . 
',copy_of_combination  : ' . 
'"' . 
$lng->
txt(
'copy_of') . 
' ' . 
$lng->
txt(
'gap_combination') . 
'"'   270             . 
',gap_in_more_than_one : ' . 
'""'   271             . 
',gap_text             : ' . 
'"' . 
$lng->
txt(
'gap') . 
'"'   272             . 
',ok_text              : ' . 
'"' . 
$lng->
txt(
'ok') . 
'"'   273             . 
',cancel_text          : ' . 
'"' . 
$lng->
txt(
'cancel') . 
'"'   276         $DIC->ui()->mainTemplate()->addOnLoadCode(
   278             . 
'ClozeQuestionGapBuilder.Init();'   280         $DIC->ui()->mainTemplate()->addJavascript(
   281             'assets/js/clozeQuestionGapBuilder.js'   284         $custom_template = 
new ilTemplate(
'tpl.il_as_cloze_gap_builder.html', 
true, 
true, 
'components/ILIAS/TestQuestionPool');
   285         $custom_template->setVariable(
'GAP_JSON', json_encode([$this->
getValue()]));
   286         $custom_template->setVariable(
'GAP', 
$lng->
txt(
'gap'));
   287         $custom_template->setVariable(
'GAP_COMBINATION_JSON', json_encode($this->
getValueCombination()));
   288         $custom_template->setVariable(
'TEXT_GAP', 
$lng->
txt(
'text_gap'));
   289         $custom_template->setVariable(
'SELECT_GAP', 
$lng->
txt(
'select_gap'));
   290         $custom_template->setVariable(
'NUMERIC_GAP', 
$lng->
txt(
'numeric_gap'));
   291         $custom_template->setVariable(
'GAP_SIZE', 
$lng->
txt(
'cloze_fixed_textlength'));
   292         $custom_template->setVariable(
'GAP_SIZE_INFO', 
$lng->
txt(
'cloze_gap_size_info'));
   293         $custom_template->setVariable(
'ANSWER_TEXT', 
$lng->
txt(
'answer_text'));
   294         $custom_template->setVariable(
'ANSWER_BYLINE', 
$lng->
txt(
'cloze_answer_text_info'));
   295         $custom_template->setVariable(
'POINTS', 
$lng->
txt(
'points'));
   296         $custom_template->setVariable(
'VALUE', 
$lng->
txt(
'value'));
   297         $custom_template->setVariable(
'UPPER_BOUND', 
$lng->
txt(
'range_upper_limit'));
   298         $custom_template->setVariable(
'LOWER_BOUND', 
$lng->
txt(
'range_lower_limit'));
   299         $custom_template->setVariable(
'ACTIONS', 
$lng->
txt(
'actions'));
   300         $custom_template->setVariable(
'REMOVE_GAP', 
$lng->
txt(
'remove_gap'));
   301         $custom_template->setVariable(
'SHUFFLE_ANSWERS', 
$lng->
txt(
'shuffle_answers'));
   302         $custom_template->setVariable(
'POINTS_ERROR', 
$lng->
txt(
'enter_enough_positive_points'));
   303         $custom_template->setVariable(
'MISSING_VALUE', 
$lng->
txt(
'msg_input_is_required'));
   304         $custom_template->setVariable(
'NOT_A_FORMULA', 
$lng->
txt(
'err_no_formula'));
   305         $custom_template->setVariable(
'NOT_A_NUMBER', 
$lng->
txt(
'err_no_numeric_value'));
   306         $custom_template->setVariable(
'CLOSE', 
$lng->
txt(
'close'));
   307         $custom_template->setVariable(
'DELETE_GAP', 
$lng->
txt(
'are_you_sure'));
   308         $custom_template->setVariable(
'PLEASE_SELECT', 
$lng->
txt(
'please_select'));
   309         $custom_template->setVariable(
'BEST_POSSIBLE_SOLUTION_HEADER', 
$lng->
txt(
'tst_best_solution_is'));
   310         $custom_template->setVariable(
'BEST_POSSIBLE_SOLUTION', 
$lng->
txt(
'value'));
   311         $custom_template->setVariable(
'MAX_POINTS', 
$lng->
txt(
'max_points'));
   312         $custom_template->setVariable(
'TYPE', 
$lng->
txt(
'type'));
   313         $custom_template->setVariable(
'VALUES', 
$lng->
txt(
'values'));
   314         $custom_template->setVariable(
'GAP_COMBINATION', 
$lng->
txt(
'gap_combination'));
   315         $custom_template->setVariable(
'COPY', 
$lng->
txt(
'copy_of'));
   316         $custom_template->setVariable(
'ADD_BUTTON', 
$renderer->render(
   317             $glyph_factory->add()->withAction(
'#')
   319         $custom_template->setVariable(
'REMOVE_BUTTON', 
$renderer->render(
   320             $glyph_factory->remove()->withAction(
'#')
   323         $template->
setVariable(
'PROP_GENERIC', $custom_template->get());
   333         if (is_array($a_data)) {
   334             foreach ($a_data as $k => $v) {
   336                     $a_data[$k] = self::stripSlashesRecursive($v, $a_strip_html, $a_allow);
   342             if ($a_data != null) {
 
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
 
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
 
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
 
static http()
Fetches the global http state from ILIAS. 
 
setVariable($variable, $value='')
Sets a variable value. 
 
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
 
__construct(Container $dic, ilPlugin $plugin)
 
Class ArrayBasedRequestWrapper.