This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
More...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.
If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning This class methods for maintain history enties for objects
- Author
- Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Definition at line 24 of file class.ilHistory.php.
◆ _changeUserId()
static ilHistory::_changeUserId |
( |
int |
$a_hist_entry_id, |
|
|
int |
$new_user_id |
|
) |
| |
|
static |
Changes the user id of the specified history entry.
Definition at line 250 of file class.ilHistory.php.
References $DIC, and $ilDB.
254 $ilDB = $DIC->database();
258 array(
"usr_id" => array(
"integer", $new_user_id)),
259 array(
"id" => array(
"integer", $a_hist_entry_id))
◆ _compareHistArray()
static ilHistory::_compareHistArray |
( |
array |
$a, |
|
|
array |
$b |
|
) |
| |
|
static |
◆ _copyEntriesForObject()
static ilHistory::_copyEntriesForObject |
( |
int |
$a_src_id, |
|
|
int |
$a_dst_id |
|
) |
| |
|
static |
copy all history entries for an object
Definition at line 192 of file class.ilHistory.php.
References $DIC, $id, $ilDB, and ilUtil\now().
196 $ilDB = $DIC->database();
198 $q =
"SELECT * FROM history WHERE obj_id = " .
199 $ilDB->quote($a_src_id,
"integer");
200 $r =
$ilDB->query($q);
202 while ($row =
$ilDB->fetchObject($r)) {
204 $ilDB->insert(
"history", array(
205 "id" => array(
"integer",
$id),
206 "obj_id" => array(
"integer", $a_dst_id),
207 "obj_type" => array(
"text", $row->obj_type),
208 "action" => array(
"text", $row->action),
210 "usr_id" => array(
"integer", $row->usr_id),
211 "info_params" => array(
"text", $row->info_params),
212 "user_comment" => array(
"clob", $row->user_comment)
static now()
Return current timestamp in Y-m-d H:i:s format.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
◆ _createEntry()
static ilHistory::_createEntry |
( |
int |
$a_obj_id, |
|
|
string |
$a_action, |
|
|
array |
$a_info_params = [] , |
|
|
string |
$a_obj_type = "" , |
|
|
string |
$a_user_comment = "" , |
|
|
bool |
$a_update_last = false |
|
) |
| |
|
static |
Creates a new history entry for an object.
The information text parameters have to be separated by comma. The information text has to be stored in a langage variable "hist_<object_type>_<action>". This text can contain placeholders %1, %2, ... for each parameter. The placehoders are replaced by the parameters in ilHistoryTableGUI.
Please note that the object type must be specified, if the object is not derived from ilObject.
- Parameters
-
int | $a_obj_id | object id |
string | $a_action | |
array | $a_info_params | information parameters |
string | $a_obj_type | object type (must only be set, if object is not in object_data table) |
string | $a_user_comment | |
bool | $a_update_last | |
Definition at line 42 of file class.ilHistory.php.
References $DIC, $id, $ilDB, $ilUser, ILIAS\LTI\ToolProvider\$key, $param, ilObject\_lookupType(), and ilUtil\now().
Referenced by ilPageEditorGUI\addChangeComment(), ilObjContentObjectGUI\confirmedDelete(), ilLMObject\create(), ilWebLinkDatabaseRepository\createItem(), ilWebLinkDatabaseRepository\createList(), ilWebLinkDatabaseRepository\deleteItemByLinkID(), ilWebLinkDatabaseRepository\deleteList(), ilObjContentObject\executeDragDrop(), ilLMPageObjectGUI\updateHistory(), ilWebLinkDatabaseRepository\updateItem(), and ilWebLinkDatabaseRepository\updateList().
52 $ilDB = $DIC->database();
55 if ($a_obj_type ==
"") {
59 if (is_array($a_info_params)) {
61 $a_info_params[
$key] = str_replace(
",",
",",
$param);
63 $a_info_params = implode(
",", $a_info_params);
67 $last_entry_sql =
"SELECT * FROM history WHERE " .
68 " obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" AND " .
69 " obj_type = " .
$ilDB->quote($a_obj_type,
"text") .
" ORDER BY hdate DESC";
70 $last_entry_set =
$ilDB->query($last_entry_sql);
71 $last_entry =
$ilDB->fetchAssoc($last_entry_set);
77 if (($a_user_comment !=
"" && $last_entry[
"user_comment"] !=
"")
78 || !$a_update_last || $a_action != $last_entry[
"action"]
79 ||
$ilUser->getId() != $last_entry[
"usr_id"]) {
81 $ilDB->insert(
"history", array(
82 "id" => array(
"integer",
$id),
83 "obj_id" => array(
"integer", $a_obj_id),
84 "obj_type" => array(
"text", $a_obj_type),
85 "action" => array(
"text", $a_action),
87 "usr_id" => array(
"integer",
$ilUser->getId()),
88 "info_params" => array(
"text", $a_info_params),
89 "user_comment" => array(
"clob", $a_user_comment)
95 if ($a_user_comment !=
"") {
96 $fields[
"user_comment"] = array(
"clob", $a_user_comment);
99 $ilDB->update(
"history", $fields, array(
100 "id" => array(
"integer", $last_entry[
"id"])
static now()
Return current timestamp in Y-m-d H:i:s format.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static _lookupType(int $id, bool $reference=false)
◆ _getEntriesForObject()
static ilHistory::_getEntriesForObject |
( |
int |
$a_obj_id, |
|
|
string |
$a_obj_type = "" |
|
) |
| |
|
static |
get all history entries for an object
- Parameters
-
int | $a_obj_id | |
string | $a_obj_type | |
- Returns
- array array of history entries (arrays with keys "date", "user_id", "obj_id", "action", "info_params")
Definition at line 111 of file class.ilHistory.php.
References $DIC, $ilDB, $query, and ilObject\_lookupType().
Referenced by ilECSFileSettings\buildJson(), ilHistoryTableGUI\getDataFromDb(), and ilFileObjectToStorageDirectory\getHistoryData().
117 $ilDB = $DIC->database();
119 if ($a_obj_type ==
"") {
122 $query =
"SELECT * FROM history WHERE obj_id = " .
123 $ilDB->quote($a_obj_id,
"integer") .
" AND " .
124 "obj_type = " .
$ilDB->quote($a_obj_type,
"text") .
125 " ORDER BY hdate DESC";
128 $hist_items = array();
129 while ($hist_rec =
$ilDB->fetchAssoc($hist_set)) {
130 $hist_items[] = array(
"date" => $hist_rec[
"hdate"],
131 "user_id" => $hist_rec[
"usr_id"],
132 "obj_id" => $hist_rec[
"obj_id"],
133 "obj_type" => $hist_rec[
"obj_type"],
134 "action" => $hist_rec[
"action"],
135 "info_params" => $hist_rec[
"info_params"],
136 "user_comment" => $hist_rec[
"user_comment"],
137 "hist_entry_id" => $hist_rec[
"id"]);
140 if ($a_obj_type ==
"lm") {
141 $query =
"SELECT h.*, l.title as title FROM history h, lm_data l WHERE " .
142 " l.lm_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" AND " .
143 " l.obj_id = h.obj_id AND " .
144 " (h.obj_type=" .
$ilDB->quote($a_obj_type .
":pg",
"text") .
" OR h.obj_type=" .
$ilDB->quote($a_obj_type .
":st",
"text") .
") " .
145 " ORDER BY h.hdate DESC";
148 while ($hist_rec =
$ilDB->fetchAssoc($hist_set)) {
149 $hist_items[] = array(
"date" => $hist_rec[
"hdate"],
150 "user_id" => $hist_rec[
"usr_id"],
151 "obj_id" => $hist_rec[
"obj_id"],
152 "obj_type" => $hist_rec[
"obj_type"],
153 "action" => $hist_rec[
"action"],
154 "info_params" => $hist_rec[
"info_params"],
155 "user_comment" => $hist_rec[
"user_comment"],
156 "hist_entry_id" => $hist_rec[
"id"],
157 "title" => $hist_rec[
"title"]);
159 usort($hist_items, array(
"ilHistory",
"_compareHistArray"));
160 $hist_items2 = array_reverse($hist_items);
static _lookupType(int $id, bool $reference=false)
◆ _getEntryByHistoryID()
static ilHistory::_getEntryByHistoryID |
( |
int |
$a_hist_entry_id | ) |
|
|
static |
returns a single history entry
Definition at line 220 of file class.ilHistory.php.
References $DIC, and $ilDB.
224 $ilDB = $DIC->database();
226 $q =
"SELECT * FROM history WHERE id = " .
227 $ilDB->quote($a_hist_entry_id,
"integer");
228 $r =
$ilDB->query($q);
230 return $ilDB->fetchAssoc($r);
◆ _removeEntriesForObject()
static ilHistory::_removeEntriesForObject |
( |
int |
$a_obj_id | ) |
|
|
static |
◆ _removeEntryByHistoryID()
static ilHistory::_removeEntryByHistoryID |
( |
int |
$a_hist_entry_id | ) |
|
|
static |
Removes a single entry from the history.
Definition at line 236 of file class.ilHistory.php.
References $DIC, and $ilDB.
240 $ilDB = $DIC->database();
242 $q =
"DELETE FROM history WHERE id = " .
243 $ilDB->quote($a_hist_entry_id,
"integer");
244 $ilDB->manipulate($q);
The documentation for this class was generated from the following file: