ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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)
 
 checkValidity ($value, ?int $record_id)
 
 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...
 
 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)
 
 checkValidity ($value, ?int $record_id)
 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...
 
 checkUniqueProp (ilPropertyFormGUI $form)
 
 checkUnique ($value, ?int $record_id)
 
 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_UNIQUE = "unique"
 
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
 
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 21 of file class.ilDclTextFieldModel.php.

Member Function Documentation

◆ areEqual()

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

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

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

◆ checkFieldCreationInput()

ilDclTextFieldModel::checkFieldCreationInput ( ilPropertyFormGUI  $form)

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

References ilDclBaseFieldModel\checkUniqueProp().

77  : bool
78  {
79  return parent::checkFieldCreationInput($form) && $this->checkUniqueProp($form);
80  }
checkUniqueProp(ilPropertyFormGUI $form)
+ Here is the call graph for this function:

◆ checkRegexAndLength()

ilDclTextFieldModel::checkRegexAndLength ( string  $value)
protected

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

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

Referenced by checkValidity().

96  : void
97  {
98  if ($this->getProperty(ilDclBaseFieldModel::PROP_LENGTH) < $this->strlen($value)) {
100  }
101 
104  if (substr($regex, 0, 1) != "/") {
105  $regex = "/" . $regex;
106  }
107  if (substr($regex, -1) != "/") {
108  $regex .= "/";
109  }
110 
111  try {
112  $preg_match = preg_match($regex, $value);
113  } catch (ErrorException) {
115  }
116 
117  if ($preg_match === false) {
119  }
120  }
121  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 144 of file class.ilDclTextFieldModel.php.

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

144  : void
145  {
146  foreach ($titles as $k => $title) {
147  if (!mb_detect_encoding($title, "UTF-8", true) == "UTF-8") {
148  $title = mb_convert_encoding($title, 'UTF-8', 'ISO-8859-1');
149  }
150  if ($title == $this->getTitle()) {
151  $import_fields[$k] = $this;
152  if ($this->hasProperty(ilDclBaseFieldModel::PROP_URL) && $titles[$k + 1] == $this->getTitle() . '_title') {
153  unset($titles[$k + 1]);
154  }
155  }
156  }
157  }
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 
)

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

References checkRegexAndLength(), ilDclBaseFieldModel\checkUnique(), and ilDclInputException\NOT_URL.

Referenced by checkValidityFromForm().

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

◆ checkValidityFromForm()

ilDclTextFieldModel::checkValidityFromForm ( ilPropertyFormGUI $form,
?int  $record_id 
)
Exceptions
ilDclInputException

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

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

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

◆ fillHeaderExcel()

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

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

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

135  : void
136  {
137  parent::fillHeaderExcel($worksheet, $row, $col);
139  $worksheet->setCell($row, $col, $this->getTitle() . '_title');
140  $col++;
141  }
142  }
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 26 of file class.ilDclTextFieldModel.php.

References ilDclBaseFieldModel\getId().

30  $join_str
31  = "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 = "
32  . $this->db->quote($this->getId(), 'integer') . ") ";
33  $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 "
34  . $this->db->quote("%$filter_value%", 'text') . ") ";
35 
36  $sql_obj = new ilDclRecordQueryObject();
37  $sql_obj->setJoinStatement($join_str);
38 
39  return $sql_obj;
40  }
+ Here is the call graph for this function:

◆ getValidFieldProperties()

◆ strlen()

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

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

Referenced by checkRegexAndLength().

123  : int
124  {
125  switch (true) {
126  case function_exists('mb_strlen'):
127  return mb_strlen($value, $encoding);
128  case function_exists('iconv_strlen'):
129  return iconv_strlen($value, $encoding);
130  default:
131  return strlen($value);
132  }
133  }
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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: