ILIAS
Release_4_4_x_branch Revision 61816
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
class.ilDataCollectionStandardField.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
include_once
'./Modules/DataCollection/classes/class.ilDataCollectionField.php'
;
5
include_once
'./Modules/DataCollection/classes/class.ilDataCollectionDatatype.php'
;
6
18
class
ilDataCollectionStandardField
extends
ilDataCollectionField
19
{
20
/*
21
* doRead
22
*/
23
public
function
doRead
()
24
{
25
global
$ilLog
;
26
$message =
"Standard fields cannot be read from DB"
;
27
ilUtil::sendFailure
($message);
28
$ilLog->write(
"[ilDataCollectionStandardField] "
.$message);
29
}
30
31
/*
32
* doCreate
33
*/
34
public
function
doCreate
()
35
{
36
global
$ilLog
;
37
$message =
"Standard fields cannot be written to DB"
;
38
ilUtil::sendFailure
($message);
39
$ilLog->write(
"[ilDataCollectionStandardField] "
.$message);
40
}
41
42
/*
43
* doUpdate
44
*/
45
public
function
doUpdate
()
46
{
47
$this->
updateVisibility
();
48
$this->
updateFilterability
();
49
$this->
updateExportability
();
50
}
51
52
/*
53
* getLocked
54
*/
55
public
function
getLocked
()
56
{
57
return
true
;
58
}
59
60
/*
61
* _getStandardFieldsAsArray
62
*/
63
static
function
_getStandardFieldsAsArray
()
64
{
65
66
//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.
67
global
$lng
;
68
$stdfields = array(
69
array(
"id"
=>
"id"
,
"title"
=> $lng->txt(
"dcl_id"
),
"description"
=> $lng->txt(
"dcl_id_description"
),
"datatype_id"
=>
ilDataCollectionDatatype::INPUTFORMAT_NUMBER
,
"required"
=>
true
),
70
array(
"id"
=>
"create_date"
,
"title"
=> $lng->txt(
"dcl_creation_date"
),
"description"
=> $lng->txt(
"dcl_creation_date_description"
),
"datatype_id"
=>
ilDataCollectionDatatype::INPUTFORMAT_DATETIME
,
"required"
=>
true
),
71
array(
"id"
=>
"last_update"
,
"title"
=> $lng->txt(
"dcl_last_update"
),
"description"
=> $lng->txt(
"dcl_last_update_description"
),
"datatype_id"
=>
ilDataCollectionDatatype::INPUTFORMAT_DATETIME
,
"required"
=>
true
),
72
array(
"id"
=>
"owner"
,
"title"
=> $lng->txt(
"dcl_owner"
),
"description"
=> $lng->txt(
"dcl_owner_description"
),
"datatype_id"
=>
ilDataCollectionDatatype::INPUTFORMAT_TEXT
,
"required"
=>
true
),
73
array(
"id"
=>
"last_edit_by"
,
"title"
=> $lng->txt(
"dcl_last_edited_by"
),
"description"
=> $lng->txt(
"dcl_last_edited_by_description"
),
"datatype_id"
=>
ilDataCollectionDatatype::INPUTFORMAT_TEXT
,
"required"
=>
true
)
74
);
75
return
$stdfields;
76
}
77
78
/*
79
* _getStandardFields
80
*/
81
static
function
_getStandardFields
(
$table_id
)
82
{
83
$stdFields = array();
84
foreach
(self::_getStandardFieldsAsArray() as $array)
85
{
86
$array[
"table_id"
] =
$table_id
;
87
$array[
"datatype_id"
] =
self::_getDatatypeForId
($array[
"id"
]);
88
$field =
new
ilDataCollectionStandardField
();
89
$field->buildFromDBRecord($array);
90
array_push($stdFields, $field);
91
}
92
return
$stdFields;
93
}
94
95
/*
96
* _isStandardField
97
*/
98
static
function
_isStandardField
($field_id)
99
{
100
$return =
false
;
101
foreach
(self::_getStandardFieldsAsArray() as $field)
102
{
103
if
($field[
"id"
] == $field_id)
104
{
105
$return =
true
;
106
}
107
}
108
109
return
$return;
110
}
111
116
public
static
function
_getDatatypeForId
(
$id
)
117
{
118
switch
(
$id
)
119
{
120
case
'id'
:
121
return
ilDataCollectionDatatype::INPUTFORMAT_NUMBER
;
122
case
'owner'
;
123
return
ilDataCollectionDatatype::INPUTFORMAT_TEXT
;
124
case
'create_date'
:
125
return
ilDataCollectionDatatype::INPUTFORMAT_DATETIME
;
126
case
'last_edit_by'
:
127
return
ilDataCollectionDatatype::INPUTFORMAT_TEXT
;
128
case
'table_id'
:
129
return
ilDataCollectionDatatype::INPUTFORMAT_NUMBER
;
130
case
'last_update'
:
131
return
ilDataCollectionDatatype::INPUTFORMAT_DATETIME
;
132
}
133
return
NULL;
134
}
135
136
/*
137
* isStandardField
138
*/
139
public
function
isStandardField
()
140
{
141
return
true
;
142
}
143
144
/*
145
* isUnique
146
*/
147
public
function
isUnique
()
148
{
149
return
false
;
150
}
151
}
152
153
?>
Modules
DataCollection
classes
class.ilDataCollectionStandardField.php
Generated on Wed Apr 27 2016 20:01:12 for ILIAS by
1.8.1.2 (using
Doxyfile
)