ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilDclStandardField Class Reference
+ Inheritance diagram for ilDclStandardField:
+ Collaboration diagram for ilDclStandardField:

Public Member Functions

 __construct ($a_id=0)
 
 doRead ()
 
 doCreate ()
 
 doUpdate ()
 
 clone (ilDclStandardField $original_record)
 
 getLocked ()
 
 isStandardField ()
 
 isUnique ()
 
 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 ()
 
 hasNumericSorting ()
 
 allowFilterInListView ()
 
 fillHeaderExcel (ilExcel $worksheet, int &$row, int &$col)
 
 getValueFromExcel (ilExcel $excel, int $row, int $col)
 
 afterClone ($records)
 
- 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...
 

Static Public Member Functions

static _getStandardFieldsAsArray ()
 
static _getStandardFields (int $table_id)
 
static _getNonImportableStandardFieldTitles ()
 
static _getImportableStandardFieldTitle ()
 
static _isStandardField ($field_id)
 
static _getDatatypeForId (string $id)
 gives you the datatype id of a specified standard field. More...
 
- 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)
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 

Additional Inherited Members

- 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 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)
 
- 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 21 of file class.ilDclStandardField.php.

Constructor & Destructor Documentation

◆ __construct()

ilDclStandardField::__construct (   $a_id = 0)

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

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

26  {
27  parent::__construct($a_id);
28  global $DIC;
29  $this->main_tpl = $DIC->ui()->mainTemplate();
30  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _getDatatypeForId()

static ilDclStandardField::_getDatatypeForId ( string  $id)
static

gives you the datatype id of a specified standard field.

Parameters
string$idthe id of the standardfield eg. "create_date"

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

References ilDclBaseFieldModel\$id.

Referenced by ilDclBaseFieldModel\getDatatypeId(), and ilDclTableViewFieldSetting\getFieldObject().

205  : ?int
206  {
207  return self::_getStandardFieldsAsArray()[$id]['datatype_id'];
208  }
+ Here is the caller graph for this function:

◆ _getImportableStandardFieldTitle()

static ilDclStandardField::_getImportableStandardFieldTitle ( )
static
Returns
array all possible titles of importable (excel import) standardfields (atm exclusively owner), in all languages;

Definition at line 165 of file class.ilDclStandardField.php.

References $DIC, ilDclBaseFieldModel\$id, and $ilDB.

Referenced by ilDclContentImporter\getImportFieldsFromTitles().

165  : array
166  {
167  global $DIC;
168  $ilDB = $DIC['ilDB'];
169  $identifiers = '';
170  $id = 'dcl_owner';
171  $identifiers .= $ilDB->quote($id, 'text') . ',';
172  $identifiers = rtrim($identifiers, ',');
173  $sql = $ilDB->query(
174  'SELECT value, identifier FROM lng_data WHERE identifier IN ('
175  . $identifiers . ')'
176  );
177  $titles = [];
178  while ($rec = $ilDB->fetchAssoc($sql)) {
179  $titles[$rec['identifier']][] = $rec['value'];
180  }
181 
182  return $titles;
183  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getNonImportableStandardFieldTitles()

static ilDclStandardField::_getNonImportableStandardFieldTitles ( )
static
Returns
array all possible titles of non-importable (excel import) standardfields (atm all except owner), in all languages;

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

References $DIC, ilDclBaseFieldModel\$id, and $ilDB.

Referenced by ilDclContentImporter\getImportFieldsFromTitles().

132  : array
133  {
134  global $DIC;
135  $ilDB = $DIC['ilDB'];
136  $identifiers = '';
137  foreach (
138  [
139  'dcl_id',
140  'dcl_creation_date',
141  'dcl_last_update',
142  'dcl_last_edited_by',
143  'dcl_comments',
144  ] as $id
145  ) {
146  $identifiers .= $ilDB->quote($id, 'text') . ',';
147  }
148  $identifiers = rtrim($identifiers, ',');
149  $sql = $ilDB->query(
150  'SELECT value FROM lng_data WHERE identifier IN (' . $identifiers
151  . ')'
152  );
153  $titles = [];
154  while ($rec = $ilDB->fetchAssoc($sql)) {
155  $titles[] = $rec['value'];
156  }
157 
158  return $titles;
159  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getStandardFields()

static ilDclStandardField::_getStandardFields ( int  $table_id)
static

Definition at line 115 of file class.ilDclStandardField.php.

References ilDclBaseFieldModel\$table_id.

Referenced by ilDclTable\getFieldsForFormula().

115  : array
116  {
117  $stdFields = [];
118  foreach (self::_getStandardFieldsAsArray() as $array) {
119  $array["table_id"] = $table_id;
120  $field = new ilDclStandardField();
121  $field->buildFromDBRecord($array);
122  $stdFields[] = $field;
123  }
124 
125  return $stdFields;
126  }
+ Here is the caller graph for this function:

◆ _getStandardFieldsAsArray()

static ilDclStandardField::_getStandardFieldsAsArray ( )
static

Definition at line 69 of file class.ilDclStandardField.php.

References $DIC, ilDclBaseFieldModel\$lng, ilDclDatatype\INPUTFORMAT_DATETIME, ilDclDatatype\INPUTFORMAT_NUMBER, ilDclDatatype\INPUTFORMAT_TEXT, and ilLanguage\txt().

69  : array
70  {
71 
72  //TODO: this isn't particularly pretty especially as $lng is used in the model. On the long run the standard fields should be refactored into "normal" fields.
73  global $DIC;
74  $lng = $DIC->language();
75  return [
76  "id" => [
77  "id" => "id",
78  "title" => $lng->txt("dcl_id"),
79  "description" => $lng->txt("dcl_id_description"),
80  "datatype_id" => ilDclDatatype::INPUTFORMAT_NUMBER
81  ],
82  "create_date" => [
83  "id" => "create_date",
84  "title" => $lng->txt("dcl_creation_date"),
85  "description" => $lng->txt("dcl_creation_date_description"),
87  ],
88  "last_update" => [
89  "id" => "last_update",
90  "title" => $lng->txt("dcl_last_update"),
91  "description" => $lng->txt("dcl_last_update_description"),
93  ],
94  "owner" => [
95  "id" => "owner",
96  "title" => $lng->txt("dcl_owner"),
97  "description" => $lng->txt("dcl_owner_description"),
98  "datatype_id" => ilDclDatatype::INPUTFORMAT_TEXT
99  ],
100  "last_edit_by" => [
101  "id" => "last_edit_by",
102  "title" => $lng->txt("dcl_last_edited_by"),
103  "description" => $lng->txt("dcl_last_edited_by_description"),
104  "datatype_id" => ilDclDatatype::INPUTFORMAT_TEXT
105  ],
106  'comments' => [
107  'id' => 'comments',
108  'title' => $lng->txt('dcl_comments'),
109  'description' => $lng->txt('dcl_comments_desc'),
110  'datatype_id' => ilDclDatatype::INPUTFORMAT_TEXT
111  ],
112  ];
113  }
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...
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ _isStandardField()

static ilDclStandardField::_isStandardField (   $field_id)
static

◆ afterClone()

ilDclStandardField::afterClone (   $records)
Parameters
$records

Definition at line 355 of file class.ilDclStandardField.php.

356  {
357  }

◆ allowFilterInListView()

ilDclStandardField::allowFilterInListView ( )

Definition at line 320 of file class.ilDclStandardField.php.

References ilDclCache\getTableCache(), and ilDclBaseFieldModel\getTableId().

320  : bool
321  {
322  //comments are filterable if they are enabled in the tables settings
323  return $this->id != 'comments'
324  || ilDclCache::getTableCache($this->getTableId())->getPublicCommentsEnabled();
325  }
static getTableCache(?int $table_id=null)
+ Here is the call graph for this function:

◆ clone()

ilDclStandardField::clone ( ilDclStandardField  $original_record)

◆ doCreate()

ilDclStandardField::doCreate ( )

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

References $DIC, and $message.

41  : void
42  {
43  global $DIC;
44  $ilLog = $DIC['ilLog'];
45  $message = "Standard fields cannot be written to DB";
46  $this->main_tpl->setOnScreenMessage('failure', $message);
47  $ilLog->write("[ilDclStandardField] " . $message);
48  }
global $DIC
Definition: shib_login.php:22
$message
Definition: xapiexit.php:31

◆ doRead()

ilDclStandardField::doRead ( )

Definition at line 32 of file class.ilDclStandardField.php.

References $DIC, and $message.

32  : void
33  {
34  global $DIC;
35  $ilLog = $DIC['ilLog'];
36  $message = "Standard fields cannot be read from DB";
37  $this->main_tpl->setOnScreenMessage('failure', $message);
38  $ilLog->write("[ilDclStandardField] " . $message);
39  }
global $DIC
Definition: shib_login.php:22
$message
Definition: xapiexit.php:31

◆ doUpdate()

ilDclStandardField::doUpdate ( )

Definition at line 50 of file class.ilDclStandardField.php.

References ilDclBaseFieldModel\updateTableFieldSetting().

Referenced by clone().

50  : void
51  {
52  $this->updateTableFieldSetting();
53  }
updateTableFieldSetting()
update exportable and fieldorder
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillHeaderExcel()

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

Definition at line 327 of file class.ilDclStandardField.php.

References $DIC, ilDclBaseFieldModel\$lng, ilDclBaseFieldModel\getId(), ilExcel\setCell(), and ilLanguage\txt().

327  : void
328  {
329  parent::fillHeaderExcel($worksheet, $row, $col);
330  if ($this->getId() == 'owner') {
331  global $DIC;
332  $lng = $DIC['lng'];
333  $worksheet->setCell($row, $col, $lng->txt("dcl_owner_name"));
334  $col++;
335  }
336  }
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...
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ getLocked()

ilDclStandardField::getLocked ( )

Definition at line 64 of file class.ilDclStandardField.php.

64  : bool
65  {
66  return true;
67  }

◆ getRecordQueryFilterObject()

ilDclStandardField::getRecordQueryFilterObject (   $filter_value = "",
?ilDclBaseFieldModel  $sort_field = null 
)

Returns a query-object for building the record-loader-sql-query.

Definition at line 250 of file class.ilDclStandardField.php.

References $DIC, $ilDB, ilDclBaseFieldModel\getDatatypeId(), ilDclDatatype\INPUTFORMAT_DATETIME, ilDclDatatype\INPUTFORMAT_NUMBER, ilDclDatatype\INPUTFORMAT_TEXT, and null.

254  global $DIC;
255  $ilDB = $DIC['ilDB'];
256 
257  $where_additions = "";
258  $join_str = "";
260  $join_str = "INNER JOIN usr_data AS filter_usr_data_{$this->getId()} ON (filter_usr_data_{$this->getId()}.usr_id = record.{$this->getId()} AND filter_usr_data_{$this->getId()}.login LIKE "
261  . $ilDB->quote("%$filter_value%", 'text') . ") ";
262  } else {
264  $from = (isset($filter_value['from'])) ? $filter_value['from'] : null;
265  $to = (isset($filter_value['to'])) ? $filter_value['to'] : null;
266  if (is_numeric($from)) {
267  $where_additions .= " AND record.{$this->getId()} >= "
268  . $ilDB->quote($from, 'integer');
269  }
270  if (is_numeric($to)) {
271  $where_additions .= " AND record.{$this->getId()} <= "
272  . $ilDB->quote($to, 'integer');
273  }
274  } else {
276  $date_from = (isset($filter_value['from'])
277  && is_object($filter_value['from'])) ? $filter_value['from'] : null;
278  $date_to = (isset($filter_value['to'])
279  && is_object($filter_value['to'])) ? $filter_value['to'] : null;
280 
281  // db->quote(.. date) at some point invokes ilDate->_toString, which adds a <br /> to the string,
282  // that's why strip_tags is used
283  if ($date_from) {
284  $where_additions .= " AND (record.{$this->getId()} >= "
285  . strip_tags($ilDB->quote($date_from, 'date')) . ")";
286  }
287  if ($date_to) {
288  $where_additions .= " AND (record.{$this->getId()} <= "
289  . strip_tags($ilDB->quote($date_to, 'date')) . ")";
290  }
291  }
292  }
293  }
294 
295  $sql_obj = new ilDclRecordQueryObject();
296  $sql_obj->setJoinStatement($join_str);
297  $sql_obj->setWhereStatement($where_additions);
298 
299  return $sql_obj;
300  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
getDatatypeId()
Get datatype_id.
+ Here is the call graph for this function:

◆ getRecordQuerySortObject()

ilDclStandardField::getRecordQuerySortObject ( string  $direction = "asc",
bool  $sort_by_status = false 
)

Returns a query-object for building the record-loader-sql-query.

Definition at line 223 of file class.ilDclStandardField.php.

References ilDclBaseFieldModel\getId().

227  $sql_obj = new ilDclRecordQueryObject();
228 
229  $join_str = "";
230  if ($this->getId() == 'owner' || $this->getId() == 'last_edit_by') {
231  $join_str = "LEFT JOIN usr_data AS sort_usr_data_{$this->getId()} ON (sort_usr_data_{$this->getId()}.usr_id = record.{$this->getId()})";
232  $select_str = " sort_usr_data_{$this->getId()}.login AS field_{$this->getId()},";
233  } else {
234  $select_str = " record.{$this->getId()} AS field_{$this->getId()},";
235  }
236 
237  $sql_obj->setSelectStatement($select_str);
238  $sql_obj->setJoinStatement($join_str);
239 
240  if ($this->getId() !== "comments") {
241  $sql_obj->setOrderStatement("field_{$this->getId()} " . $direction);
242  }
243 
244  return $sql_obj;
245  }
+ Here is the call graph for this function:

◆ getSortField()

ilDclStandardField::getSortField ( )

Definition at line 302 of file class.ilDclStandardField.php.

References ilDclBaseFieldModel\getId(), and ilDclBaseFieldModel\getTitle().

302  : string
303  {
304  if ($this->getId() == 'comments') {
305  return 'n_comments';
306  } else {
307  return $this->getTitle();
308  }
309  }
+ Here is the call graph for this function:

◆ getValueFromExcel()

ilDclStandardField::getValueFromExcel ( ilExcel  $excel,
int  $row,
int  $col 
)
Returns
string|int

Definition at line 341 of file class.ilDclStandardField.php.

References ilObjUser\_lookupId(), and ilExcel\getCell().

342  {
343  $value = $excel->getCell($row, $col);
344  switch ($this->id) {
345  case 'owner':
346  return ilObjUser::_lookupId($value);
347  default:
348  return $value;
349  }
350  }
static _lookupId($a_user_str)
getCell(int $a_row, int $a_col)
Returns the value of a cell.
+ Here is the call graph for this function:

◆ hasNumericSorting()

ilDclStandardField::hasNumericSorting ( )

Definition at line 311 of file class.ilDclStandardField.php.

References ilDclBaseFieldModel\getId().

311  : bool
312  {
313  if ($this->getId() == 'comments') {
314  return true;
315  }
316 
317  return parent::hasNumericSorting();
318  }
+ Here is the call graph for this function:

◆ isStandardField()

ilDclStandardField::isStandardField ( )

Definition at line 210 of file class.ilDclStandardField.php.

210  : bool
211  {
212  return true;
213  }

◆ isUnique()

ilDclStandardField::isUnique ( )

Definition at line 215 of file class.ilDclStandardField.php.

Referenced by clone().

215  : bool
216  {
217  return false;
218  }
+ Here is the caller graph for this function:

Field Documentation

◆ $main_tpl

ilGlobalTemplateInterface ilDclStandardField::$main_tpl
private

Definition at line 23 of file class.ilDclStandardField.php.


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