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);
73 $lng = $DIC->language();
78 "description" =>
$lng->
txt(
"dcl_id_description"),
82 "id" =>
"create_date",
83 "title" =>
$lng->
txt(
"dcl_creation_date"),
84 "description" =>
$lng->
txt(
"dcl_creation_date_description"),
88 "id" =>
"last_update",
89 "title" =>
$lng->
txt(
"dcl_last_update"),
90 "description" =>
$lng->
txt(
"dcl_last_update_description"),
95 "title" =>
$lng->
txt(
"dcl_owner"),
96 "description" =>
$lng->
txt(
"dcl_owner_description"),
100 "id" =>
"last_edit_by",
101 "title" =>
$lng->
txt(
"dcl_last_edited_by"),
102 "description" =>
$lng->
txt(
"dcl_last_edited_by_description"),
107 'title' =>
$lng->
txt(
'dcl_comments'),
108 'description' =>
$lng->
txt(
'dcl_comments_desc'),
117 foreach (self::_getStandardFieldsAsArray() as $array) {
120 $field->buildFromDBRecord($array);
121 $stdFields[] = $field;
134 $ilDB = $DIC[
'ilDB'];
141 'dcl_last_edited_by',
145 $identifiers .=
$ilDB->quote($id,
'text') .
',';
147 $identifiers = rtrim($identifiers,
',');
149 'SELECT value FROM lng_data WHERE identifier IN (' . $identifiers
153 while ($rec =
$ilDB->fetchAssoc($sql)) {
154 $titles[] = $rec[
'value'];
167 $ilDB = $DIC[
'ilDB'];
170 $identifiers .=
$ilDB->quote(
$id,
'text') .
',';
171 $identifiers = rtrim($identifiers,
',');
173 'SELECT value, identifier FROM lng_data WHERE identifier IN (' 177 while ($rec =
$ilDB->fetchAssoc($sql)) {
178 $titles[$rec[
'identifier']][] = $rec[
'value'];
191 foreach (self::_getStandardFieldsAsArray() as $field) {
192 if ($field[
"id"] == $field_id) {
206 return self::_getStandardFieldsAsArray()[
$id][
'datatype_id'];
218 string $direction =
"asc",
219 bool $sort_by_status =
false 224 if ($this->
getId() ==
'owner' || $this->
getId() ==
'last_edit_by') {
225 $join_str =
"LEFT JOIN usr_data AS sort_usr_data_{$this->getId()} ON (sort_usr_data_{$this->getId()}.usr_id = record.{$this->getId()})";
226 $select_str =
" sort_usr_data_{$this->getId()}.login AS field_{$this->getId()},";
228 $select_str =
" record.{$this->getId()} AS field_{$this->getId()},";
231 $sql_obj->setSelectStatement($select_str);
232 $sql_obj->setJoinStatement($join_str);
234 if ($this->
getId() !==
"comments") {
235 $sql_obj->setOrderStatement(
"field_{$this->getId()} " . $direction);
249 $ilDB = $DIC[
'ilDB'];
251 $where_additions =
"";
254 $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 " 255 .
$ilDB->quote(
"%$filter_value%",
'text') .
") ";
258 $from = (isset($filter_value[
'from'])) ? $filter_value[
'from'] :
null;
259 $to = (isset($filter_value[
'to'])) ? $filter_value[
'to'] :
null;
260 if (is_numeric($from)) {
261 $where_additions .=
" AND record.{$this->getId()} >= " 262 .
$ilDB->quote($from,
'integer');
264 if (is_numeric($to)) {
265 $where_additions .=
" AND record.{$this->getId()} <= " 266 .
$ilDB->quote($to,
'integer');
270 $date_from = (isset($filter_value[
'from'])
271 && is_object($filter_value[
'from'])) ? $filter_value[
'from'] :
null;
272 $date_to = (isset($filter_value[
'to'])
273 && is_object($filter_value[
'to'])) ? $filter_value[
'to'] :
null;
278 $where_additions .=
" AND (record.{$this->getId()} >= " 279 . strip_tags(
$ilDB->quote($date_from,
'date')) .
")";
282 $where_additions .=
" AND (record.{$this->getId()} <= " 283 . strip_tags(
$ilDB->quote($date_to,
'date')) .
")";
290 $sql_obj->setJoinStatement($join_str);
291 $sql_obj->setWhereStatement($where_additions);
298 if ($this->
getId() ==
'comments') {
307 if ($this->
getId() ==
'comments') {
311 return parent::hasNumericSorting();
317 return $this->
id !=
'comments' 323 parent::fillHeaderExcel($worksheet, $row, $col);
324 if ($this->
getId() ==
'owner') {
337 $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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _getImportableStandardFieldTitle()
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
static _getStandardFieldsAsArray()
getValueFromExcel(ilExcel $excel, int $row, int $col)
ilGlobalTemplateInterface $main_tpl
static getTableCache(?int $table_id=null)
const INPUTFORMAT_DATETIME
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.