Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@

class ilDclFormulaFieldModel extends ilDclBaseFieldModel
{
public const SUPPORTED_FIELDS = [
ilDclDatatype::INPUTFORMAT_NUMBER,
ilDclDatatype::INPUTFORMAT_TEXT,
ilDclDatatype::INPUTFORMAT_BOOLEAN,
ilDclDatatype::INPUTFORMAT_DATETIME,
];

/**
* Returns a query-object for building the record-loader-sql-query
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ public function getHTML(bool $link = true, array $options = []): string
$html = (is_array($value) && isset($value['link'])) ? $value['link'] : nl2br((string) $value);
}

if (!$html) {
$html = "";
}

return $html;
}

Expand Down
27 changes: 10 additions & 17 deletions Modules/DataCollection/classes/Table/class.ilDclTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

declare(strict_types=1);

use ILIAS\Modules\DataCollection\Fields\Formula\FormulaParser\Token\Tokenizer;

class ilDclTable
{
protected int $id = 0;
Expand Down Expand Up @@ -528,23 +530,14 @@ public function getFirstTableViewId(int $ref_id, int $user_id = 0, bool $with_de
*/
public function getFieldsForFormula(): array
{
$unsupported = [
ilDclDatatype::INPUTFORMAT_ILIAS_REF,
ilDclDatatype::INPUTFORMAT_FORMULA,
ilDclDatatype::INPUTFORMAT_MOB,
ilDclDatatype::INPUTFORMAT_REFERENCELIST,
ilDclDatatype::INPUTFORMAT_REFERENCE,
ilDclDatatype::INPUTFORMAT_FILEUPLOAD,
ilDclDatatype::INPUTFORMAT_RATING,
];

$this->loadCustomFields();
$return = $this->getStandardFields();
/**
* @var $field ilDclBaseFieldModel
*/
foreach ($this->fields as $field) {
if (!in_array($field->getDatatypeId(), $unsupported)) {
$syntax_chars = array_merge(Tokenizer::$operators, Tokenizer::$functions, ['(', ')', ',']);
foreach ($this->getFields() as $field) {
if (in_array($field->getDatatypeId(), ilDclFormulaFieldModel::SUPPORTED_FIELDS)) {
foreach ($syntax_chars as $element) {
if (str_contains($field->getTitle(), $element)) {
continue 2;
}
}
$return[] = $field;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function sendNotification($a_action, $a_table_id, $a_record_id = null): v
$message .= $this->prepareMessageText($t);
}
$message .= "------------------------------------\n";
$message .= $ulng->txt('dcl_changed_by') . ": " . $user->getFullname() . " " . ilUserUtil::getNamePresentation($user->getId())
$message .= $ulng->txt('dcl_changed_by') . ": " . ilUserUtil::getNamePresentation($user->getId())
. "\n\n";
$message .= $ulng->txt('dcl_change_notification_link') . ": " . $link . "\n\n";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<tr class="{CSS_ROW}" id="{ID}">
<td class="name">{TITLE}</td>
<td class="std">
<input style="margin-top: -3px; vertical-align: middle" type="radio" id="v_{FIELD_ID}"
name="RadioGroup_{FIELD_ID}" value="VisibleCreate_{FIELD_ID}" {HIDDEN} {IS_VISIBLE}>
<label style="margin-top: 4px; margin-right: 10px" for="v_{FIELD_ID}" {HIDDEN}>{TEXT_VISIBLE}</label>
<input style="margin-top: -3px; vertical-align: middle" type="radio" id="rv_{FIELD_ID}"
name="RadioGroup_{FIELD_ID}" value="RequiredCreate_{FIELD_ID}" {HIDDEN} {IS_REQUIRED}>
<label style="margin-top: 4px; margin-right: 10px" for="rv_{FIELD_ID}" {HIDDEN}>{TEXT_REQUIRED_VISIBLE}</label>
<input style="margin-top: -3px; vertical-align: middle" type="radio" id="lv_{FIELD_ID}"
name="RadioGroup_{FIELD_ID}" value="LockedCreate_{FIELD_ID}" {HIDDEN} {IS_LOCKED}>
<label style="margin-top: 4px; margin-right: 10px" for="lv_{FIELD_ID}" {HIDDEN}>{TEXT_LOCKED_VISIBLE}</label>
<input style="margin-top: -3px; vertical-align: middle" type="radio" id="nv_{FIELD_ID}"
name="RadioGroup_{FIELD_ID}" value="NotVisibleCreate_{FIELD_ID}" {HIDDEN} {IS_NOT_VISIBLE}>
<label for="nv_{FIELD_ID}" {HIDDEN}>{TEXT_NOT_VISIBLE}</label>
<td class="std" style="display: flex;gap: 14px";>
<label for="v_{FIELD_ID}" {HIDDEN}>
<input type="radio" id="v_{FIELD_ID}" name="RadioGroup_{FIELD_ID}" value="VisibleCreate_{FIELD_ID}" {HIDDEN} {IS_VISIBLE}>
{TEXT_VISIBLE}
</label>
<label for="rv_{FIELD_ID}" {HIDDEN}>
<input type="radio" id="rv_{FIELD_ID}" name="RadioGroup_{FIELD_ID}" value="RequiredCreate_{FIELD_ID}" {HIDDEN} {IS_REQUIRED}>
{TEXT_REQUIRED_VISIBLE}
</label>
<label for="lv_{FIELD_ID}" {HIDDEN}>
<input type="radio" id="lv_{FIELD_ID}" name="RadioGroup_{FIELD_ID}" value="LockedCreate_{FIELD_ID}" {HIDDEN} {IS_LOCKED}>
{TEXT_LOCKED_VISIBLE}
</label>
<label for="nv_{FIELD_ID}" {HIDDEN}>
<input type="radio" id="nv_{FIELD_ID}" name="RadioGroup_{FIELD_ID}" value="NotVisibleCreate_{FIELD_ID}" {HIDDEN} {IS_NOT_VISIBLE}>
{TEXT_NOT_VISIBLE}
</label>
</td>
<td class="std">
{EXTRA_INPUT}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@

<tr class="{CSS_ROW}" id="{ID}">
<td class="name">{TITLE}</td>
<td class="std">
<input style="margin-top: -3px; vertical-align: middle" type="radio" id="v_{FIELD_ID}"
name="RadioGroup_{FIELD_ID}" value="VisibleEdit_{FIELD_ID}" {HIDDEN} {IS_VISIBLE}>
<label style="margin-top: 4px; margin-right: 10px" for="v_{FIELD_ID}" {HIDDEN}>{TEXT_VISIBLE}</label>
<input style="margin-top: -3px; vertical-align: middle" type="radio" id="rv_{FIELD_ID}"
name="RadioGroup_{FIELD_ID}" value="RequiredEdit_{FIELD_ID}" {HIDDEN} {IS_REQUIRED}>
<label style="margin-top: 4px; margin-right: 10px" for="rv_{FIELD_ID}" {HIDDEN}>{TEXT_REQUIRED_VISIBLE}</label>
<input style="margin-top: -3px; vertical-align: middle" type="radio" id="lv_{FIELD_ID}"
name="RadioGroup_{FIELD_ID}" value="LockedEdit_{FIELD_ID}" {HIDDEN} {IS_LOCKED}>
<label style="margin-top: 4px; margin-right: 10px" for="lv_{FIELD_ID}" {HIDDEN}>{TEXT_LOCKED_VISIBLE}</label>
<input style="margin-top: -3px; vertical-align: middle" type="radio" id="nv_{FIELD_ID}"
name="RadioGroup_{FIELD_ID}" value="NotVisibleEdit_{FIELD_ID}" {HIDDEN} {IS_NOT_VISIBLE}>
<label style="margin-top: 4px; margin-right: 10px" for="nv_{FIELD_ID}" {HIDDEN}>{TEXT_NOT_VISIBLE}</label>
<td class="std" style="display: flex;gap: 14px";>
<label for="v_{FIELD_ID}" {HIDDEN}>
<input type="radio" id="v_{FIELD_ID}" name="RadioGroup_{FIELD_ID}" value="VisibleEdit_{FIELD_ID}" {HIDDEN} {IS_VISIBLE}>
{TEXT_VISIBLE}
</label>
<label for="rv_{FIELD_ID}" {HIDDEN}>
<input type="radio" id="rv_{FIELD_ID}" name="RadioGroup_{FIELD_ID}" value="RequiredEdit_{FIELD_ID}" {HIDDEN} {IS_REQUIRED}>
{TEXT_REQUIRED_VISIBLE}
</label>
<label for="lv_{FIELD_ID}" {HIDDEN}>
<input type="radio" id="lv_{FIELD_ID}" name="RadioGroup_{FIELD_ID}" value="LockedEdit_{FIELD_ID}" {HIDDEN} {IS_LOCKED}>
{TEXT_LOCKED_VISIBLE}
</label>
<label for="nv_{FIELD_ID}" {HIDDEN}>
<input type="radio" id="nv_{FIELD_ID}" name="RadioGroup_{FIELD_ID}" value="NotVisibleEdit_{FIELD_ID}" {HIDDEN} {IS_NOT_VISIBLE}>
{TEXT_NOT_VISIBLE}
</label>
</td>
</tr>

2 changes: 1 addition & 1 deletion lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -8720,7 +8720,7 @@ dcl#:#dcl_plugin_hooks#:#Verfügbare Erweiterungen
dcl#:#dcl_plugin_no_hooks_available#:#Keine aktiven Field-Type Plugins gefunden.
dcl#:#dcl_prev_record#:#Vorheriger Eintrag
dcl#:#dcl_prop_expression#:#Ausdruck
dcl#:#dcl_prop_expression_info#:#Gültige Operatoren: <b>%s</b><br>Unterstützte Funktionen: <b>%s</b><br>Verwenden Sie Klammern <b>"(", ")"</b> zum Gruppieren von Ausdrücken.<br>Zeichenketten und Platzhalter verbinden mit &: <b>"Das Resultat ist " & [[Int 1]] * [[Int 2]]</b><br>Verwenden der Funktionen: <b>SUM([[Int 1]];[[Int 2]])</b><br>Beim verwenden von Datums-Feldern und Zahlen-Feldern in einer Formel, weden die Zahlen-Feldern als Sekunden betrachtet und müssen bspw. mit 86400 multipliziert werden.<br><br>Gültige Felder (auf den Titel klicken um als Platzhalter in Ausdruck einzufügen):<br>%s
dcl#:#dcl_prop_expression_info#:#Gültige Operatoren: <b>%s</b><br>Unterstützte Funktionen: <b>%s</b><br>Verwenden Sie Klammern <b>"(", ")"</b> zum Gruppieren von Ausdrücken.<br>Zeichenketten und Platzhalter verbinden mit &: <b>"Das Resultat ist " & [[Int 1]] * [[Int 2]]</b><br>Verwenden der Funktionen: <b>SUM([[Int 1]];[[Int 2]])</b><br><br>Gültige Felder (auf den Titel klicken um als Platzhalter in Ausdruck einzufügen):<br>%<br><b>(Erlaubte Felder sind Checkbox, Zahl, Text und Datum die keine Formular-sensitiven Zeichen im Titel enthalten)<b>
dcl#:#dcl_public_comments#:#Kommentare
dcl#:#dcl_public_comments_desc#:#Benutzer können Datensätze dieser Tabelle kommentieren.
dcl#:#dcl_rating#:#Bewertung
Expand Down
2 changes: 1 addition & 1 deletion lang/ilias_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -8720,7 +8720,7 @@ dcl#:#dcl_plugin_hooks#:#Available Plugins
dcl#:#dcl_plugin_no_hooks_available#:#No active field-type plugins found
dcl#:#dcl_prev_record#:#Previous Entry
dcl#:#dcl_prop_expression#:#Expression
dcl#:#dcl_prop_expression_info#:#Supported operators: <b>%s</b><br>Supported functions: <b>%s</b><br>Use brackets <b>‘(’, ‘)’</b> to group calculations.<br>Concatenate strings and placeholders with &: <b>‘The result is ’ & [[Int 1]] * [[Int2]]</b><br>Using functions: <b>SUM([[Int 1]];[[Int 2]])</b><br>When using date fields and number fields in a formula, the number fields are considered seconds and must be multiplied by 86400, for example.<br><br>Available fields (click on title to copy field inside expression):<br>%s
dcl#:#dcl_prop_expression_info#:#Supported operators: <b>%s</b><br>Supported functions: <b>%s</b><br>Use brackets <b>‘(’, ‘)’</b> to group calculations.<br>Concatenate strings and placeholders with &: <b>‘The result is ’ & [[Int 1]] * [[Int2]]</b><br>Using functions: <b>SUM([[Int 1]];[[Int 2]])</b><br><br>Allowed fields (click on title to copy field inside expression):<br>%s<br><b>(Allowed fields are boolean, number, text and date that dont contain formular-sensitive chars inside their title)<b>
dcl#:#dcl_public_comments#:#Activate Public Comments
dcl#:#dcl_public_comments_desc#:#Users can comment on entries of the table.
dcl#:#dcl_rating#:#Rating
Expand Down