ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilDclTextFieldModel Class Reference
+ Inheritance diagram for ilDclTextFieldModel:
+ Collaboration diagram for ilDclTextFieldModel:

Public Member Functions

 getRecordQueryFilterObject ( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
 
 checkValidityFromForm (ilPropertyFormGUI &$form, ?int $record_id=null)
 
 checkValidity ($value, ?int $record_id=null)
 
 checkFieldCreationInput (ilPropertyFormGUI $form)
 
 getValidFieldProperties ()
 
 strlen (string $value, string $encoding='UTF-8')
 
 fillHeaderExcel (ilExcel $worksheet, int &$row, int &$col)
 
 checkTitlesForImport (array &$titles, array &$import_fields)
 
- Public Member Functions inherited from ilDclBaseFieldModel
 __construct (int $a_id=0)
 
 setId ($a_id)
 Set field id. More...
 
 getId ()
 Get field id. More...
 
 setTableId (int $a_id)
 Set table id. More...
 
 getTableId ()
 Get table id. More...
 
 setTitle (string $a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription (string $a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setDatatypeId (int $a_id)
 Set datatype id. More...
 
 getDatatypeId ()
 Get datatype_id. More...
 
 isUnique ()
 
 setUnique (?bool $unique)
 
 getDatatype ()
 
 getDatatypeTitle ()
 
 getPresentationTitle ()
 
 getPresentationDescription ()
 
 getStorageLocation ()
 Get storage location for the model. More...
 
 getExportable ()
 
 toArray ()
 
 isStandardField ()
 
 doRead ()
 
 buildFromDBRecord (array $rec)
 Builds model from db record. More...
 
 doCreate ()
 
 doUpdate ()
 
 updateProperties ()
 Update properties of this field in Database. More...
 
 doDelete ()
 Remove field and properties. More...
 
 getViewSettings ()
 
 getViewSetting (int $tableview_id)
 
 getOrder ()
 
 setOrder (int $order)
 
 hasProperty (string $key)
 Checks if a certain property for a field is set. More...
 
 getProperty (string $key)
 
 getPropertyInstance (string $key)
 
 setProperty (string $key, $value)
 
 getValidFieldProperties ()
 Returns all valid properties for a field-type. More...
 
 checkValidityFromForm (ilPropertyFormGUI &$form, ?int $record_id=null)
 
 checkValidity ($value, ?int $record_id=null)
 Check if input is valid. More...
 
 cloneStructure (int $original_id)
 
 afterClone (array $records)
 
 cloneProperties (ilDclBaseFieldModel $originalField)
 
 setExportable (bool $exportable)
 
 allowFilterInListView ()
 
 getRecordQuerySortObject (string $direction="asc", bool $sort_by_status=false)
 Returns a query-object for building the record-loader-sql-query. More...
 
 getRecordQueryFilterObject ( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
 Returns a query-object for building the record-loader-sql-query. More...
 
 getSortField ()
 Returns the sort-field id. More...
 
 hasNumericSorting ()
 Set to true, when the sorting should be handled numerical. More...
 
 checkFieldCreationInput (ilPropertyFormGUI $form)
 Checks input of specific fields befor saving. More...
 
 getStorageLocationOverride ()
 
 setStorageLocationOverride (?int $storage_location_override)
 
 fillHeaderExcel (ilExcel $worksheet, int &$row, int &$col)
 
 checkTitlesForImport (array &$titles, array &$import_fields)
 
 storePropertiesFromForm (ilPropertyFormGUI $form)
 called when saving the 'edit field' form More...
 
 fillPropertiesForm (ilPropertyFormGUI &$form)
 called to fill the 'edit field' form More...
 
 isConfirmationRequired (ilPropertyFormGUI $form)
 called by ilDclFieldEditGUI when updating field properties if you overwrite this method, remember to also overwrite getConfirmationGUI More...
 
 getConfirmationGUI (ilPropertyFormGUI $form)
 called by ilDclFieldEditGUI if isConfirmationRequired returns true More...
 

Protected Member Functions

 areEqual ($value_1, $value_2)
 
 checkRegexAndLength (string $value)
 
- Protected Member Functions inherited from ilDclBaseFieldModel
 loadDatatype ()
 Load datatype for model. More...
 
 loadTableFieldSetting ()
 loadTableFieldSetting More...
 
 addToTableViews ()
 create ilDclTableViewFieldSettings for this field in each tableview More...
 
 updateTableFieldSetting ()
 update exportable and fieldorder More...
 
 loadProperties ()
 Get all properties of a field. More...
 
 areEqual ($value_1, $value_2)
 
 normalizeValue (mixed $value)
 

Additional Inherited Members

- Static Public Member Functions inherited from ilDclBaseFieldModel
static _getTitleInvalidChars (bool $a_as_regex=true)
 All valid chars for filed titles. More...
 
static _getFieldIdByTitle (string $title, int $table_id)
 
- Data Fields inherited from ilDclBaseFieldModel
const PROP_LENGTH = "lenght"
 General properties. More...
 
const PROP_REGEX = "regex"
 
const PROP_REFERENCE = "table_id"
 
const PROP_URL = "url"
 
const PROP_TEXTAREA = "text_area"
 
const PROP_REFERENCE_LINK = "reference_link"
 
const PROP_WIDTH = "width"
 
const PROP_HEIGHT = "height"
 
const PROP_LEARNING_PROGRESS = "learning_progress"
 
const PROP_ILIAS_REFERENCE_LINK = "ILIAS_reference_link"
 
const PROP_N_REFERENCE = "multiple_selection"
 
const PROP_FORMULA_EXPRESSION = "expression"
 
const PROP_DISPLAY_COPY_LINK_ACTION_MENU = "display_action_menu"
 
const PROP_LINK_DETAIL_PAGE_TEXT = "link_detail_page_text"
 
const PROP_LINK_DETAIL_PAGE_MOB = "link_detail_page_mob"
 
const PROP_SUPPORTED_FILE_TYPES = "supported_file_types"
 
const PROP_PLUGIN_HOOK_NAME = "plugin_hook_name"
 
const EDIT_VIEW = 2
 
const EXPORTABLE_VIEW = 4
 
- Protected Attributes inherited from ilDclBaseFieldModel
string $id = ""
 
int $table_id = 0
 
string $title = ""
 
string $description = ""
 
int $datatype_id = 0
 
int $order = null
 
bool $unique = false
 
array $property = []
 
bool $exportable = false
 
ilDclDatatype $datatype = null
 
int $storage_location_override = null
 With this property the datatype-storage-location can be overwritten. More...
 
ilDBInterface $db
 
ilLanguage $lng
 

Detailed Description

Definition at line 20 of file class.ilDclTextFieldModel.php.

Member Function Documentation

◆ areEqual()

ilDclTextFieldModel::areEqual (   $value_1,
  $value_2 
)
protected

Definition at line 67 of file class.ilDclTextFieldModel.php.

67  : bool
68  {
69  return parent::areEqual($value_1['link'] ?? $value_1, $value_2['link'] ?? $value_2);
70  }

◆ checkFieldCreationInput()

ilDclTextFieldModel::checkFieldCreationInput ( ilPropertyFormGUI  $form)

Definition at line 72 of file class.ilDclTextFieldModel.php.

References ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ILIAS\Repository\lng(), ilDclBaseFieldModel\PROP_LENGTH, and ilDclBaseFieldModel\PROP_TEXTAREA.

72  : bool
73  {
74  $return = true;
75  if ((int) $form->getInput('prop_' . ilDclBaseFieldModel::PROP_LENGTH) > 200 && !$form->getInput('prop_' . ilDclBaseFieldModel::PROP_TEXTAREA)) {
76  $inputObj = $form->getItemByPostVar('prop_' . ilDclBaseFieldModel::PROP_LENGTH);
77  $inputObj->setAlert($this->lng->txt("form_msg_value_too_high"));
78  $return = false;
79  }
80 
81  return $return;
82  }
getItemByPostVar(string $a_post_var)
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-...
const PROP_LENGTH
General properties.
+ Here is the call graph for this function:

◆ checkRegexAndLength()

ilDclTextFieldModel::checkRegexAndLength ( string  $value)
protected

Definition at line 98 of file class.ilDclTextFieldModel.php.

References ilDclBaseFieldModel\getProperty(), ilDclInputException\LENGTH_EXCEPTION, ilDclBaseFieldModel\PROP_LENGTH, ilDclBaseFieldModel\PROP_REGEX, ilDclInputException\REGEX_CONFIG_EXCEPTION, ilDclInputException\REGEX_EXCEPTION, and strlen().

Referenced by checkValidity().

98  : void
99  {
100  if ($this->getProperty(ilDclBaseFieldModel::PROP_LENGTH) < $this->strlen($value)
101  && is_numeric($this->getProperty(ilDclBaseFieldModel::PROP_LENGTH))
102  ) {
104  }
105 
106  if ($this->getProperty(ilDclBaseFieldModel::PROP_REGEX) != null) {
108  if (substr($regex, 0, 1) != "/") {
109  $regex = "/" . $regex;
110  }
111  if (substr($regex, -1) != "/") {
112  $regex .= "/";
113  }
114 
115  try {
116  $preg_match = preg_match($regex, $value);
117  } catch (ErrorException) {
119  }
120 
121  if ($preg_match === false) {
123  }
124  }
125  }
strlen(string $value, string $encoding='UTF-8')
const PROP_LENGTH
General properties.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkTitlesForImport()

ilDclTextFieldModel::checkTitlesForImport ( array &  $titles,
array &  $import_fields 
)

Definition at line 148 of file class.ilDclTextFieldModel.php.

References ilDclBaseFieldModel\$title, ilDclBaseFieldModel\getTitle(), ilDclBaseFieldModel\hasProperty(), and ilDclBaseFieldModel\PROP_URL.

148  : void
149  {
150  foreach ($titles as $k => $title) {
151  if (!mb_detect_encoding($title, "UTF-8", true) == "UTF-8") {
152  $title = mb_convert_encoding($title, 'UTF-8', 'ISO-8859-1');
153  }
154  if ($title == $this->getTitle()) {
155  $import_fields[$k] = $this;
156  if ($this->hasProperty(ilDclBaseFieldModel::PROP_URL) && $titles[$k + 1] == $this->getTitle() . '_title') {
157  unset($titles[$k + 1]);
158  }
159  }
160  }
161  }
hasProperty(string $key)
Checks if a certain property for a field is set.
+ Here is the call graph for this function:

◆ checkValidity()

ilDclTextFieldModel::checkValidity (   $value,
?int  $record_id = null 
)

Definition at line 54 of file class.ilDclTextFieldModel.php.

References checkRegexAndLength(), and ilDclInputException\NOT_URL.

Referenced by checkValidityFromForm().

54  : bool
55  {
56  if (isset($value['link'])) {
57  $value = $value['link'];
58  $link = (substr($value, 0, 3) === 'www') ? 'https://' . $value : $value;
59  if (!filter_var($link, FILTER_VALIDATE_URL) && !filter_var($link, FILTER_VALIDATE_EMAIL) && $link != '') {
61  }
62  }
63  $this->checkRegexAndLength($value);
64  return parent::checkValidity($value, $record_id);
65  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkValidityFromForm()

ilDclTextFieldModel::checkValidityFromForm ( ilPropertyFormGUI $form,
?int  $record_id = null 
)

Definition at line 41 of file class.ilDclTextFieldModel.php.

References checkValidity(), ilDclBaseFieldModel\getId(), ilPropertyFormGUI\getInput(), ilDclBaseFieldModel\getProperty(), and ilDclBaseFieldModel\PROP_URL.

41  : void
42  {
44  $value = [
45  'link' => $form->getInput("field_" . $this->getId()),
46  'title' => $form->getInput("field_" . $this->getId() . "_title"),
47  ];
48  } else {
49  $value = $form->getInput('field_' . $this->getId());
50  }
51  $this->checkValidity($value, $record_id);
52  }
checkValidity($value, ?int $record_id=null)
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-...
+ Here is the call graph for this function:

◆ fillHeaderExcel()

ilDclTextFieldModel::fillHeaderExcel ( ilExcel  $worksheet,
int &  $row,
int &  $col 
)

Definition at line 139 of file class.ilDclTextFieldModel.php.

References ilDclBaseFieldModel\getProperty(), ilDclBaseFieldModel\getTitle(), ilDclBaseFieldModel\PROP_URL, and ilExcel\setCell().

139  : void
140  {
141  parent::fillHeaderExcel($worksheet, $row, $col);
143  $worksheet->setCell($row, $col, $this->getTitle() . '_title');
144  $col++;
145  }
146  }
setCell(int $a_row, int $a_col, $a_value, ?string $a_datatype=null)
Set cell value.
+ Here is the call graph for this function:

◆ getRecordQueryFilterObject()

ilDclTextFieldModel::getRecordQueryFilterObject (   $filter_value = "",
?ilDclBaseFieldModel  $sort_field = null 
)
Parameters
string | int$filter_value

Definition at line 25 of file class.ilDclTextFieldModel.php.

References ilDclBaseFieldModel\getId().

29  $join_str
30  = "INNER JOIN il_dcl_record_field AS filter_record_field_{$this->getId()} ON (filter_record_field_{$this->getId()}.record_id = record.id AND filter_record_field_{$this->getId()}.field_id = "
31  . $this->db->quote($this->getId(), 'integer') . ") ";
32  $join_str .= "INNER JOIN il_dcl_stloc{$this->getStorageLocation()}_value AS filter_stloc_{$this->getId()} ON (filter_stloc_{$this->getId()}.record_field_id = filter_record_field_{$this->getId()}.id AND filter_stloc_{$this->getId()}.value LIKE "
33  . $this->db->quote("%$filter_value%", 'text') . ") ";
34 
35  $sql_obj = new ilDclRecordQueryObject();
36  $sql_obj->setJoinStatement($join_str);
37 
38  return $sql_obj;
39  }
+ Here is the call graph for this function:

◆ getValidFieldProperties()

◆ strlen()

ilDclTextFieldModel::strlen ( string  $value,
string  $encoding = 'UTF-8' 
)

Definition at line 127 of file class.ilDclTextFieldModel.php.

Referenced by checkRegexAndLength().

127  : int
128  {
129  switch (true) {
130  case function_exists('mb_strlen'):
131  return mb_strlen($value, $encoding);
132  case function_exists('iconv_strlen'):
133  return iconv_strlen($value, $encoding);
134  default:
135  return strlen($value);
136  }
137  }
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'vtt', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
strlen(string $value, string $encoding='UTF-8')
+ Here is the caller graph for this function:

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