ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAdvancedMDFieldDefinitionInteger Class Reference

AMD field type integer. More...

+ Inheritance diagram for ilAdvancedMDFieldDefinitionInteger:
+ Collaboration diagram for ilAdvancedMDFieldDefinitionInteger:

Public Member Functions

 getType ()
 
 isFilterSupported ()
 
 getSuffixTranslations ()
 
 setSuffixTranslation (string $language, string $suffix)
 
 setSuffixTranslations (array $suffix_translations)
 
 setMin (?int $a_value)
 
 getMin ()
 
 setMax (?int $a_value)
 
 getMax ()
 
 setSuffix (?string $a_value)
 
 getSuffix ()
 
 getFieldDefinitionForTableGUI (string $content_language)
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form, string $language='')
 
 importXMLProperty (string $a_key, string $a_value)
 
 getValueForXML (ilADT $element)
 
 importValueFromXML (string $a_cdata)
 
- Public Member Functions inherited from ilAdvancedMDFieldDefinition
 __construct (GenericData $generic_data, string $language='')
 
 getType ()
 Get type. More...
 
 useDefaultLanguageMode (string $language)
 Check if default language mode has to be used: no language given or language equals default language. More...
 
 getTypeTitle ()
 
 getADTDefinition ()
 Get ADT definition instance. More...
 
 getADT ()
 
 getFieldId ()
 Get field_id. More...
 
 setRecordId (int $a_id)
 Set record id. More...
 
 getRecordId ()
 Get record id. More...
 
 setImportId (string $a_id_string)
 Set import id. More...
 
 getImportId ()
 Get import id. More...
 
 setPosition (int $a_pos)
 Set position. More...
 
 getPosition ()
 Get position. More...
 
 setTitle (string $a_title)
 Get title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription (string $a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 isSearchSupported ()
 Is search supported at all. More...
 
 isFilterSupported ()
 Is search by filter supported. More...
 
 setSearchable (bool $a_status)
 Toggle searchable. More...
 
 isSearchable ()
 Is searchable. More...
 
 setRequired (bool $a_status)
 Toggle required. More...
 
 isRequired ()
 Is required field. More...
 
 getFieldDefinitionForTableGUI (string $content_language)
 Parse properties for table gui. More...
 
 addToFieldDefinitionForm (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions, string $language='')
 Add input elements to definition form. More...
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form, string $language='')
 Import custom post values from definition form. More...
 
 importDefinitionFormPostValues (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions, string $active_language)
 Import post values from definition form. More...
 
 importDefinitionFormPostValuesNeedsConfirmation ()
 
 prepareCustomDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 prepareDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 generateImportId (int $a_field_id)
 Generate unique record id. More...
 
 save (bool $keep_pos_and_import_id=false, bool $keep_import_id=false)
 Create new field entry. More...
 
 update ()
 Update field entry. More...
 
 delete ()
 Delete field entry. More...
 
 toXML (ilXmlWriter $a_writer)
 To Xml. More...
 
 importXMLProperty (string $a_key, string $a_value)
 Import property from XML. More...
 
 getValueForXML (ilADT $element)
 Parse ADT value for xml (export) More...
 
 importValueFromXML (string $a_cdata)
 Import value from xml. More...
 
 importFromECS (string $a_ecs_type, $a_value, string $a_sub_id)
 Import meta data from ECS. More...
 
 prepareElementForEditor (ilADTFormBridge $a_bridge)
 Prepare editor form elements. More...
 
 getSearchQueryParserValue (ilADTSearchBridge $a_adt_search)
 Get value for search query parser. More...
 
 getSearchValueSerialized (ilADTSearchBridge $a_adt_search)
 
 setSearchValueSerialized (ilADTSearchBridge $a_adt_search, $a_value)
 Set value from search persistence. More...
 
 searchSubObjects (ilADTSearchBridge $a_adt_search, int $a_obj_id, string $sub_obj_type)
 
 searchObjects (ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, string $a_locate, string $a_search_type)
 Search objects. More...
 
 getLuceneSearchString ($a_value)
 Get search string in lucene syntax. More...
 
 prepareElementForSearch (ilADTSearchBridge $a_bridge)
 Prepare search form elements. More...
 
 _clone (int $a_new_record_id)
 Clone field definition. More...
 
 hasComplexOptions ()
 
 getComplexOptionsOverview (object $a_parent_gui, string $parent_cmd)
 

Protected Member Functions

 initADTDefinition ()
 
 importFieldDefinition (array $a_def)
 
 getFieldDefinition ()
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 
- Protected Member Functions inherited from ilAdvancedMDFieldDefinition
 initADTDefinition ()
 Init adt instance. More...
 
 setADT (ilADT $a_adt)
 Set ADT instance. More...
 
 importFieldDefinition (array $a_def)
 Import (type-specific) field definition from DB. More...
 
 getFieldDefinition ()
 Get (type-specific) field definition. More...
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
 Add custom input elements to definition form. More...
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 Add (type-specific) properties to xml export. More...
 
 parseSearchObjects (array $a_records, array $a_object_types)
 Add object-data needed for global search to AMD search results. More...
 

Protected Attributes

int $min = null
 
int $max = null
 
string $suffix = null
 
 $suffix_translations = []
 
- Protected Attributes inherited from ilAdvancedMDFieldDefinition
GenericData $generic_data
 
ilADTDefinition $adt_def = null
 
ilADT $adt = null
 
string $language = ''
 
ilDBInterface $db
 
ilLanguage $lng
 
ilLogger $logger
 
GlobalHttpState $http
 
RefineryFactory $refinery
 

Additional Inherited Members

- Static Public Member Functions inherited from ilAdvancedMDFieldDefinition
static getInstance (?int $a_field_id, ?int $a_type=null, string $language='')
 
static exists (int $a_field_id)
 
static getInstanceByTypeString (string $a_type)
 Get instance by type string (used by import) More...
 
static getInstancesByRecordId ( $a_record_id, $a_only_searchable=false, string $language='')
 Get definitions by record id. More...
 
static getInstancesByObjType ($a_obj_type, $a_active_only=true)
 
static getInstanceByImportId (string $a_import_id)
 
static getSearchableDefinitionIds ()
 Get searchable definition ids (performance is key) More...
 
static getADTGroupForDefinitions (array $a_defs)
 Init ADTGroup for definitions. More...
 
static getValidTypes ()
 Get all valid types. More...
 
static isValidType (int $a_type)
 
- Data Fields inherited from ilAdvancedMDFieldDefinition
const TYPE_SELECT = 1
 TODO: put this in when minimum php version is set to 8.2. More...
 
const TYPE_TEXT = 2
 
const TYPE_DATE = 3
 
const TYPE_DATETIME = 4
 
const TYPE_INTEGER = 5
 
const TYPE_FLOAT = 6
 
const TYPE_LOCATION = 7
 
const TYPE_SELECT_MULTI = 8
 
const TYPE_ADDRESS = 99
 
const TYPE_EXTERNAL_LINK = 9
 
const TYPE_INTERNAL_LINK = 10
 
- Static Protected Member Functions inherited from ilAdvancedMDFieldDefinition
static getInstanceWithData (GenericData $generic_data, string $language='')
 
static getTypeString (int $a_type)
 Get type as string. More...
 

Detailed Description

AMD field type integer.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 26 of file class.ilAdvancedMDFieldDefinitionInteger.php.

Member Function Documentation

◆ addCustomFieldToDefinitionForm()

ilAdvancedMDFieldDefinitionInteger::addCustomFieldToDefinitionForm ( ilPropertyFormGUI  $a_form,
bool  $a_disabled = false,
string  $language = '' 
)
protected

Definition at line 153 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References ilAdvancedMDFieldDefinition\$language, ilAdvancedMDRecord\_getInstanceByRecordId(), ilPropertyFormGUI\addItem(), getMax(), getMin(), ilAdvancedMDFieldDefinition\getRecordId(), getSuffix(), getSuffixTranslations(), ILIAS\Repository\lng(), ilNumberInputGUI\setValue(), and ilAdvancedMDFieldDefinition\useDefaultLanguageMode().

157  : void {
158  $min = new ilNumberInputGUI($this->lng->txt("md_adv_number_min"), "min");
159  $min->setValue((string) $this->getMin());
160  $min->setSize(10);
161  $a_form->addItem($min);
162 
163  $max = new ilNumberInputGUI($this->lng->txt("md_adv_number_max"), "max");
164  $max->setValue((string) $this->getMax());
165  $max->setSize(10);
166  $a_form->addItem($max);
167 
168  $suffix = new ilTextInputGUI($this->lng->txt("md_adv_number_suffix"), "suffix");
169  if ($this->useDefaultLanguageMode($language)) {
170  $suffix->setValue($this->getSuffix());
171  } else {
172  $default_language = ilAdvancedMDRecord::_getInstanceByRecordId(
173  $this->getRecordId()
174  )->getDefaultLanguage();
175  $suffix->setInfo($default_language . ': ' . $this->getSuffix());
176  $suffix->setValue($this->getSuffixTranslations()[$language] ?? '');
177  }
178  $suffix->setSize(10);
179  $a_form->addItem($suffix);
180 
181  if ($a_disabled) {
182  $min->setDisabled(true);
183  $max->setDisabled(true);
184  $suffix->setDisabled(true);
185  }
186  }
static _getInstanceByRecordId(int $a_record_id)
This class represents a number property in a property form.
useDefaultLanguageMode(string $language)
Check if default language mode has to be used: no language given or language equals default language...
+ Here is the call graph for this function:

◆ addPropertiesToXML()

ilAdvancedMDFieldDefinitionInteger::addPropertiesToXML ( ilXmlWriter  $a_writer)
protected

Definition at line 205 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References getMax(), getMin(), getSuffix(), getSuffixTranslations(), and ilXmlWriter\xmlElement().

205  : void
206  {
207  $a_writer->xmlElement('FieldValue', array("id" => "min"), $this->getMin());
208  $a_writer->xmlElement('FieldValue', array("id" => "max"), $this->getMax());
209  $a_writer->xmlElement('FieldValue', array("id" => "suffix"), $this->getSuffix());
210 
211  foreach ($this->getSuffixTranslations() as $lang_key => $suffix) {
212  $a_writer->xmlElement('FieldValue', ['id' => 'suffix_' . $lang_key], $suffix);
213  }
214  }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:

◆ getFieldDefinition()

ilAdvancedMDFieldDefinitionInteger::getFieldDefinition ( )
protected

Definition at line 122 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References getMax(), getMin(), getSuffix(), and getSuffixTranslations().

122  : array
123  {
124  return array(
125  "min" => $this->getMin(),
126  "max" => $this->getMax(),
127  "suffix" => $this->getSuffix(),
128  'suffix_translations' => $this->getSuffixTranslations()
129  );
130  }
+ Here is the call graph for this function:

◆ getFieldDefinitionForTableGUI()

ilAdvancedMDFieldDefinitionInteger::getFieldDefinitionForTableGUI ( string  $content_language)

Definition at line 132 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References $res, $suffix, getMax(), getMin(), getSuffix(), getSuffixTranslations(), ILIAS\Repository\lng(), null, and ilAdvancedMDFieldDefinition\useDefaultLanguageMode().

132  : array
133  {
134  $res = [];
135 
136  if ($this->getMin() !== null) {
137  $res[$this->lng->txt("md_adv_number_min")] = $this->getMin();
138  }
139  if ($this->getMax() !== null) {
140  $res[$this->lng->txt("md_adv_number_max")] = $this->getMax();
141  }
142  if ($this->getSuffix()) {
143  if ($this->useDefaultLanguageMode($content_language)) {
144  $suffix = $this->getSuffix();
145  } else {
146  $suffix = $this->getSuffixTranslations()[$content_language] ?? '';
147  }
148  $res[$this->lng->txt("md_adv_number_suffix")] = $suffix;
149  }
150  return $res;
151  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
useDefaultLanguageMode(string $language)
Check if default language mode has to be used: no language given or language equals default language...
+ Here is the call graph for this function:

◆ getMax()

ilAdvancedMDFieldDefinitionInteger::getMax ( )

◆ getMin()

ilAdvancedMDFieldDefinitionInteger::getMin ( )

◆ getSuffix()

ilAdvancedMDFieldDefinitionInteger::getSuffix ( )

◆ getSuffixTranslations()

ilAdvancedMDFieldDefinitionInteger::getSuffixTranslations ( )

◆ getType()

ilAdvancedMDFieldDefinitionInteger::getType ( )

Definition at line 38 of file class.ilAdvancedMDFieldDefinitionInteger.php.

38  : int
39  {
40  return self::TYPE_INTEGER;
41  }

◆ getValueForXML()

ilAdvancedMDFieldDefinitionInteger::getValueForXML ( ilADT  $element)

Definition at line 237 of file class.ilAdvancedMDFieldDefinitionInteger.php.

237  : string
238  {
239  return (string) $element->getNumber();
240  }

◆ importCustomDefinitionFormPostValues()

ilAdvancedMDFieldDefinitionInteger::importCustomDefinitionFormPostValues ( ilPropertyFormGUI  $a_form,
string  $language = '' 
)

Definition at line 188 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References ilAdvancedMDFieldDefinition\$language, ilPropertyFormGUI\getInput(), null, setMax(), setMin(), setSuffix(), setSuffixTranslation(), and ilAdvancedMDFieldDefinition\useDefaultLanguageMode().

188  : void
189  {
190  $min = $a_form->getInput("min");
191  $this->setMin(($min !== "" && !is_null($min)) ? (int) $min : null);
192 
193  $max = $a_form->getInput("max");
194  $this->setMax(($max !== "" && !is_null($max)) ? (int) $max : null);
195 
196  if ($this->useDefaultLanguageMode($language)) {
197  $suffix = $a_form->getInput("suffix");
198  $this->setSuffix(($suffix !== "") ? $suffix : null);
199  } else {
200  $suffix = $a_form->getInput('suffix');
202  }
203  }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
useDefaultLanguageMode(string $language)
Check if default language mode has to be used: no language given or language equals default language...
+ Here is the call graph for this function:

◆ importFieldDefinition()

ilAdvancedMDFieldDefinitionInteger::importFieldDefinition ( array  $a_def)
protected

Definition at line 114 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References null, setMax(), setMin(), setSuffix(), and setSuffixTranslations().

114  : void
115  {
116  $this->setMin(isset($a_def["min"]) ? (int) $a_def["min"] : null);
117  $this->setMax(isset($a_def["max"]) ? (int) $a_def["max"] : null);
118  $this->setSuffix($a_def["suffix"] ?? null);
119  $this->setSuffixTranslations($a_def['suffix_translations'] ?? []);
120  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ importValueFromXML()

ilAdvancedMDFieldDefinitionInteger::importValueFromXML ( string  $a_cdata)

Definition at line 242 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References ilAdvancedMDFieldDefinition\getADT().

242  : void
243  {
244  $this->getADT()->setNumber($a_cdata);
245  }
+ Here is the call graph for this function:

◆ importXMLProperty()

ilAdvancedMDFieldDefinitionInteger::importXMLProperty ( string  $a_key,
string  $a_value 
)

Definition at line 216 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References $parts, null, setMax(), setMin(), setSuffix(), and setSuffixTranslation().

216  : void
217  {
218  if ($a_key == "min") {
219  $this->setMin($a_value != "" ? (int) $a_value : null);
220  return;
221  }
222  if ($a_key == "max") {
223  $this->setMax($a_value != "" ? (int) $a_value : null);
224  return;
225  }
226  if ($a_key == "suffix") {
227  $this->setSuffix($a_value != "" ? $a_value : null);
228  return;
229  }
230 
231  $parts = explode('_', $a_key);
232  if (isset($parts[0]) && $parts[0] == 'suffix') {
233  $this->setSuffixTranslation($parts[1], $a_value);
234  }
235  }
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ initADTDefinition()

ilAdvancedMDFieldDefinitionInteger::initADTDefinition ( )
protected

Definition at line 66 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References ilADTFactory\getInstance(), getMax(), getMin(), getSuffix(), getSuffixTranslations(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

67  {
68  $def = ilADTFactory::getInstance()->getDefinitionInstanceByType('Integer');
69  $def->setMin($this->getMin());
70  $def->setMax($this->getMax());
71  $def->setSuffix((string) ($this->getSuffixTranslations()[$this->language] ?? $this->getSuffix()));
72  return $def;
73  }
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
ADT definition base class.
+ Here is the call graph for this function:

◆ isFilterSupported()

ilAdvancedMDFieldDefinitionInteger::isFilterSupported ( )

Definition at line 43 of file class.ilAdvancedMDFieldDefinitionInteger.php.

43  : bool
44  {
45  return false;
46  }

◆ setMax()

ilAdvancedMDFieldDefinitionInteger::setMax ( ?int  $a_value)

Definition at line 88 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References null.

Referenced by importCustomDefinitionFormPostValues(), importFieldDefinition(), and importXMLProperty().

88  : void
89  {
90  if ($a_value !== null) {
91  $a_value = $a_value;
92  }
93  $this->max = $a_value;
94  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ setMin()

ilAdvancedMDFieldDefinitionInteger::setMin ( ?int  $a_value)

Definition at line 75 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References null.

Referenced by importCustomDefinitionFormPostValues(), importFieldDefinition(), and importXMLProperty().

75  : void
76  {
77  if ($a_value !== null) {
78  $a_value = $a_value;
79  }
80  $this->min = $a_value;
81  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ setSuffix()

ilAdvancedMDFieldDefinitionInteger::setSuffix ( ?string  $a_value)

Definition at line 101 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References null.

Referenced by importCustomDefinitionFormPostValues(), importFieldDefinition(), and importXMLProperty().

101  : void
102  {
103  if ($a_value !== null) {
104  $a_value = trim($a_value);
105  }
106  $this->suffix = $a_value;
107  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ setSuffixTranslation()

ilAdvancedMDFieldDefinitionInteger::setSuffixTranslation ( string  $language,
string  $suffix 
)

Definition at line 56 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References ilAdvancedMDFieldDefinition\$language, and $suffix.

Referenced by importCustomDefinitionFormPostValues(), and importXMLProperty().

+ Here is the caller graph for this function:

◆ setSuffixTranslations()

ilAdvancedMDFieldDefinitionInteger::setSuffixTranslations ( array  $suffix_translations)

Definition at line 61 of file class.ilAdvancedMDFieldDefinitionInteger.php.

References $suffix_translations.

Referenced by importFieldDefinition().

61  : void
62  {
63  $this->suffix_translations = $suffix_translations;
64  }
+ Here is the caller graph for this function:

Field Documentation

◆ $max

int ilAdvancedMDFieldDefinitionInteger::$max = null
protected

Definition at line 29 of file class.ilAdvancedMDFieldDefinitionInteger.php.

Referenced by getMax().

◆ $min

int ilAdvancedMDFieldDefinitionInteger::$min = null
protected

Definition at line 28 of file class.ilAdvancedMDFieldDefinitionInteger.php.

Referenced by getMin().

◆ $suffix

string ilAdvancedMDFieldDefinitionInteger::$suffix = null
protected

◆ $suffix_translations

ilAdvancedMDFieldDefinitionInteger::$suffix_translations = []
protected

The documentation for this class was generated from the following file: