ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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)
 
 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_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 70 of file class.ilDclTextFieldModel.php.

70  : bool
71  {
72  return parent::areEqual($value_1['link'] ?? $value_1, $value_2['link'] ?? $value_2);
73  }

◆ checkRegexAndLength()

ilDclTextFieldModel::checkRegexAndLength ( string  $value)
protected

Definition at line 88 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().

88  : void
89  {
90  if ($this->getProperty(ilDclBaseFieldModel::PROP_LENGTH) < $this->strlen($value)) {
92  }
93 
94  if ($this->getProperty(ilDclBaseFieldModel::PROP_REGEX) != null) {
96  if (substr($regex, 0, 1) != "/") {
97  $regex = "/" . $regex;
98  }
99  if (substr($regex, -1) != "/") {
100  $regex .= "/";
101  }
102 
103  try {
104  $preg_match = preg_match($regex, $value);
105  } catch (ErrorException) {
107  }
108 
109  if ($preg_match === false) {
111  }
112  }
113  }
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 136 of file class.ilDclTextFieldModel.php.

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

136  : void
137  {
138  foreach ($titles as $k => $title) {
139  if (!mb_detect_encoding($title, "UTF-8", true) == "UTF-8") {
140  $title = mb_convert_encoding($title, 'UTF-8', 'ISO-8859-1');
141  }
142  if ($title == $this->getTitle()) {
143  $import_fields[$k] = $this;
144  if ($this->hasProperty(ilDclBaseFieldModel::PROP_URL) && $titles[$k + 1] == $this->getTitle() . '_title') {
145  unset($titles[$k + 1]);
146  }
147  }
148  }
149  }
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 57 of file class.ilDclTextFieldModel.php.

References checkRegexAndLength(), and ilDclInputException\NOT_URL.

Referenced by checkValidityFromForm().

57  : bool
58  {
59  if (isset($value['link'])) {
60  $value = $value['link'];
61  $link = (substr($value, 0, 3) === 'www') ? 'https://' . $value : $value;
62  if (!filter_var($link, FILTER_VALIDATE_URL) && !filter_var($link, FILTER_VALIDATE_EMAIL) && $link != '') {
64  }
65  }
66  $this->checkRegexAndLength($value);
67  return parent::checkValidity($value, $record_id);
68  }
+ 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 
)
Exceptions
ilDclInputException

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

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

44  : void
45  {
47  $value = [
48  'link' => $form->getInput("field_" . $this->getId()),
49  'title' => $form->getInput("field_" . $this->getId() . "_title"),
50  ];
51  } else {
52  $value = $form->getInput('field_' . $this->getId());
53  }
54  $this->checkValidity($value, $record_id);
55  }
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 127 of file class.ilDclTextFieldModel.php.

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

127  : void
128  {
129  parent::fillHeaderExcel($worksheet, $row, $col);
131  $worksheet->setCell($row, $col, $this->getTitle() . '_title');
132  $col++;
133  }
134  }
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
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 115 of file class.ilDclTextFieldModel.php.

Referenced by checkRegexAndLength().

115  : int
116  {
117  switch (true) {
118  case function_exists('mb_strlen'):
119  return mb_strlen($value, $encoding);
120  case function_exists('iconv_strlen'):
121  return iconv_strlen($value, $encoding);
122  default:
123  return strlen($value);
124  }
125  }
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: