19declare(strict_types=1);
71 $definition->setActiveLanguages($field_translations->getActivatedLanguages($this->getFieldId(),
true));
72 $definition->setDefaultLanguage($field_translations->getDefaultLanguage());
100 $this->multi = $a_value;
115 $this->
setMaxLength(isset($a_def[
"max"]) ? (
int) $a_def[
"max"] :
null);
116 $this->
setMulti((
bool) ($a_def[self::KEY_MULTI] ??
false));
117 $multilingual_values = (bool) ($a_def[
'multilingual_values'] ??
true);
125 self::KEY_MULTI => $this->
isMulti(),
156 bool $a_disabled =
false,
167 $max->setSuffix(
$lng->
txt(
"characters"));
168 $max->setMinValue(1);
169 $max->setMaxValue(4000);
178 $max->setDisabled(
true);
179 $multi->setDisabled(
true);
182 if (!count($record_translations->getTranslations())) {
186 $lng->
txt(
'md_adv_text_multi_val'),
189 $multilingual_values->setInfo(
$lng->
txt(
'md_adv_text_multi_val_info'));
191 $multilingual_values->setValue(
"1");
192 $a_form->
addItem($multilingual_values);
203 $this->setMaxLength(($max !==
"" && $max !==
null) ? (
int) $max :
null);
204 $this->setMulti((
bool) $a_form->
getInput(self::KEY_MULTI));
205 $this->setMultilingualValueSupport((
bool) $a_form->
getInput(
'multilingual'));
214 $a_writer->
xmlElement(
'FieldValue', array(
"id" =>
"max"), $this->getMaxLength());
215 $a_writer->
xmlElement(
'FieldValue', array(
"id" => self::KEY_MULTI), $this->isMulti());
216 $a_writer->
xmlElement(
'FieldValue', [
'id' =>
'multilingual_values'], $this->isMultilingualValueSupport());
221 if ($a_key ===
"max") {
222 $this->setMaxLength($a_value !==
"" ? (
int) $a_value :
null);
224 if ($a_key === self::KEY_MULTI) {
225 $this->setMulti((
bool) $a_value);
227 if ($a_key ==
'multilingual_values') {
228 $this->setMultilingualValueSupport(
229 $a_value !=
'' ?
true :
false
234 public function getValueForXML(
ilADT $element): string
239 $translations = $element->getTranslations();
240 $serialized_values = [];
241 foreach ($translations as $lang_key => $translation) {
242 $serialized_values[] = $lang_key . self::XML_SEPARATOR_TRANSLATION . $translation;
244 return implode(self::XML_SEPARATOR_TRANSLATIONS, $serialized_values);
253 if (strpos($a_cdata, self::XML_SEPARATOR_TRANSLATION) ===
false) {
254 $this->getADT()->setText($a_cdata);
256 $this->getADT()->setTranslation($record->getDefaultLanguage(), $a_cdata);
260 $translations = explode(self::XML_SEPARATOR_TRANSLATIONS, $a_cdata);
261 foreach ($translations as $translation) {
262 $parts = explode(self::XML_SEPARATOR_TRANSLATION, $translation);
270 public function importFromECS(
string $a_ecs_type, $a_value,
string $a_sub_id): bool
273 switch ($a_ecs_type) {
275 $value = implode(
',', (array) $a_value);
279 $value = (
int) $a_value;
283 $value = (string) $a_value;
288 $value = $a_value->{
'get' . ucfirst($a_sub_id)}();
293 if (trim((
string) $value)) {
294 $this->getADT()->setText(is_null($value) ?
null : (
string) $value);
303 $this->
logger->warning(
'Passed ' . get_class($a_bridge));
306 $a_bridge->setMulti($this->isMulti());
311 return (
string) $a_adt_search->getADT()->getText();
323 foreach ($a_records as $record) {
324 if ($record[
"sub_type"] ==
"-") {
326 $obj_ids[$record[
"obj_id"]] = $record;
330 $sql =
"SELECT obj_id,type" .
331 " FROM object_data" .
332 " WHERE " .
$ilDB->in(
"obj_id", array_keys($obj_ids),
false,
"integer") .
333 " AND " .
$ilDB->in(
"type", $a_object_types,
false,
"text");
334 $set =
$ilDB->query($sql);
335 while ($row =
$ilDB->fetchAssoc($set)) {
336 $row[
"found"] = array();
337 foreach ($obj_ids[(
int) $row[
"obj_id"]] as $field => $value) {
338 if (substr($field, 0, 5) ==
"found") {
339 $row[
"found"][$field] = $value;
351 array $a_object_types,
353 string $a_search_type
357 $condition = $a_adt_search->getSQLCondition(
360 $a_parser->getQuotedWords()
365 $this->getADT()->getType(),
370 if (isset($objects) && count($objects)) {
371 return $this->parseSearchObjects($objects, $a_object_types);
ADT Active Record by type helper class This class expects a valid primary for all actions!
static find(string $a_table, string $a_type, int $a_field_id, string $a_condition, ?string $a_additional_fields=null)
Find entries.
ADT definition base class.
const TYPE_LOCALIZED_TEXT
Class ilADTLocalizedTextDBBridge.
ADT search bridge base class.
importValueFromXML(string $a_cdata)
searchObjects(ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, string $a_locate, string $a_search_type)
Search objects.
parseSearchObjects(array $a_records, array $a_object_types)
Add object-data needed for global search to AMD search results.
importXMLProperty(string $a_key, string $a_value)
Import property from XML.
const XML_SEPARATOR_TRANSLATIONS
setMultilingualValueSupport(bool $multilingual_value_support)
getFieldDefinitionForTableGUI(string $content_language)
Parse properties for table gui.
importFieldDefinition(array $a_def)
Import (type-specific) field definition from DB.
importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form, string $language='')
Import custom post values from definition form.
addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
Add input elements to definition form.
importFromECS(string $a_ecs_type, $a_value, string $a_sub_id)
Import meta data from ECS.
getFieldDefinition()
Get (type-specific) field definition.
prepareElementForEditor(ilADTFormBridge $a_bridge)
Prepare editor form elements.
bool $multilingual_value_support
addPropertiesToXML(ilXmlWriter $a_writer)
Add (type-specific) properties to xml export.
isMultilingualValueSupport()
const XML_SEPARATOR_TRANSLATION
getSearchQueryParserValue(ilADTSearchBridge $a_adt_search)
Get value for search query parser.
setMaxLength(?int $max_length)
getADTDefinition()
Get ADT definition instance.
getRecordId()
Get record id.
static getInstanceByRecordId(int $record_id)
static getInstanceByRecordId(int $record_id)
static _getInstanceByRecordId(int $a_record_id)
Representation of ECS EContent Time Place.
loadLanguageModule(string $a_module)
Load language module.
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts