19 declare(strict_types=1);
29 $this->main_tpl = $DIC->ui()->mainTemplate();
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);
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);
74 $lng = $DIC->language();
79 "description" =>
$lng->
txt(
"dcl_id_description"),
83 "id" =>
"create_date",
84 "title" =>
$lng->
txt(
"dcl_creation_date"),
85 "description" =>
$lng->
txt(
"dcl_creation_date_description"),
89 "id" =>
"last_update",
90 "title" =>
$lng->
txt(
"dcl_last_update"),
91 "description" =>
$lng->
txt(
"dcl_last_update_description"),
96 "title" =>
$lng->
txt(
"dcl_owner"),
97 "description" =>
$lng->
txt(
"dcl_owner_description"),
101 "id" =>
"last_edit_by",
102 "title" =>
$lng->
txt(
"dcl_last_edited_by"),
103 "description" =>
$lng->
txt(
"dcl_last_edited_by_description"),
108 'title' =>
$lng->
txt(
'dcl_comments'),
109 'description' =>
$lng->
txt(
'dcl_comments_desc'),
118 foreach (self::_getStandardFieldsAsArray() as $array) {
121 $field->buildFromDBRecord($array);
122 $stdFields[] = $field;
135 $ilDB = $DIC[
'ilDB'];
142 'dcl_last_edited_by',
146 $identifiers .=
$ilDB->quote($id,
'text') .
',';
148 $identifiers = rtrim($identifiers,
',');
150 'SELECT value FROM lng_data WHERE identifier IN (' . $identifiers
154 while ($rec =
$ilDB->fetchAssoc($sql)) {
155 $titles[] = $rec[
'value'];
168 $ilDB = $DIC[
'ilDB'];
171 $identifiers .=
$ilDB->quote(
$id,
'text') .
',';
172 $identifiers = rtrim($identifiers,
',');
174 'SELECT value, identifier FROM lng_data WHERE identifier IN (' 178 while ($rec =
$ilDB->fetchAssoc($sql)) {
179 $titles[$rec[
'identifier']][] = $rec[
'value'];
192 foreach (self::_getStandardFieldsAsArray() as $field) {
193 if ($field[
"id"] == $field_id) {
207 return self::_getStandardFieldsAsArray()[
$id][
'datatype_id'];
224 string $direction =
"asc",
225 bool $sort_by_status =
false 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()},";
234 $select_str =
" record.{$this->getId()} AS field_{$this->getId()},";
237 $sql_obj->setSelectStatement($select_str);
238 $sql_obj->setJoinStatement($join_str);
240 if ($this->
getId() !==
"comments") {
241 $sql_obj->setOrderStatement(
"field_{$this->getId()} " . $direction);
255 $ilDB = $DIC[
'ilDB'];
257 $where_additions =
"";
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') .
") ";
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');
270 if (is_numeric($to)) {
271 $where_additions .=
" AND record.{$this->getId()} <= " 272 .
$ilDB->quote($to,
'integer');
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;
284 $where_additions .=
" AND (record.{$this->getId()} >= " 285 . strip_tags(
$ilDB->quote($date_from,
'date')) .
")";
288 $where_additions .=
" AND (record.{$this->getId()} <= " 289 . strip_tags(
$ilDB->quote($date_to,
'date')) .
")";
296 $sql_obj->setJoinStatement($join_str);
297 $sql_obj->setWhereStatement($where_additions);
304 if ($this->
getId() ==
'comments') {
313 if ($this->
getId() ==
'comments') {
317 return parent::hasNumericSorting();
323 return $this->
id !=
'comments' 329 parent::fillHeaderExcel($worksheet, $row, $col);
330 if ($this->
getId() ==
'owner') {
343 $value = $excel->
getCell($row, $col);
getRecordQueryFilterObject( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
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...
static _getNonImportableStandardFieldTitles()
static _getStandardFields(int $table_id)
static _lookupId($a_user_str)
getRecordQuerySortObject(string $direction="asc", bool $sort_by_status=false)
Returns a query-object for building the record-loader-sql-query.
static _getDatatypeForId(string $id)
gives you the datatype id of a specified standard field.
clone(ilDclStandardField $original_record)
setExportable(bool $exportable)
getTableId()
Get table id.
static _getImportableStandardFieldTitle()
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
static _getStandardFieldsAsArray()
static getTableCache(int $table_id=null)
getValueFromExcel(ilExcel $excel, int $row, int $col)
ilGlobalTemplateInterface $main_tpl
getCell(int $a_row, int $a_col)
Returns the value of a cell.
static _isStandardField($field_id)
updateTableFieldSetting()
update exportable and fieldorder
fillHeaderExcel(ilExcel $worksheet, int &$row, int &$col)
__construct(Container $dic, ilPlugin $plugin)
getDatatypeId()
Get datatype_id.