ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjectCustomUserFieldHistory Class Reference

Editing history for object custom user fields. More...

+ Collaboration diagram for ilObjectCustomUserFieldHistory:

Public Member Functions

 __construct (int $a_obj_id, int $a_user_id)
 
 setUpdateUser (int $a_id)
 
 getUpdateUser ()
 
 setEditingTime (ilDateTime $dt)
 
 getEditingTime ()
 
 save ()
 
 delete ()
 

Static Public Member Functions

static lookupEntriesByObjectId (int $a_obj_id)
 

Protected Member Functions

 read ()
 

Protected Attributes

ilDBInterface $db
 

Private Attributes

int $obj_id = 0
 
int $user_id = 0
 
int $update_user = 0
 
ilDateTime $editing_time = null
 

Detailed Description

Editing history for object custom user fields.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 26 of file class.ilObjectCustomUserFieldHistory.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectCustomUserFieldHistory::__construct ( int  $a_obj_id,
int  $a_user_id 
)

Definition at line 34 of file class.ilObjectCustomUserFieldHistory.php.

35 {
36 global $DIC;
37
38 $this->db = $DIC->database();
39 $this->obj_id = $a_obj_id;
40 $this->user_id = $a_user_id;
41 $this->read();
42 }
global $DIC
Definition: shib_login.php:26

References $DIC, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilObjectCustomUserFieldHistory::delete ( )

Definition at line 102 of file class.ilObjectCustomUserFieldHistory.php.

102 : void
103 {
104 $query = 'DELETE FROM obj_user_data_hist ' .
105 'WHERE obj_id = ' . $this->db->quote($this->obj_id, 'integer') . ' ' .
106 'AND usr_id = ' . $this->db->quote($this->user_id, 'integer');
107 $this->db->manipulate($query);
108 }

◆ getEditingTime()

ilObjectCustomUserFieldHistory::getEditingTime ( )

Definition at line 81 of file class.ilObjectCustomUserFieldHistory.php.

82 {
84 }
@classDescription Date and time handling

References $editing_time.

◆ getUpdateUser()

ilObjectCustomUserFieldHistory::getUpdateUser ( )

Definition at line 71 of file class.ilObjectCustomUserFieldHistory.php.

References $update_user.

Referenced by save().

+ Here is the caller graph for this function:

◆ lookupEntriesByObjectId()

static ilObjectCustomUserFieldHistory::lookupEntriesByObjectId ( int  $a_obj_id)
static
Returns
array<int, array<{update_user: int, editing_time: ilDateTime}>>
Exceptions
ilDateTimeException

Definition at line 48 of file class.ilObjectCustomUserFieldHistory.php.

48 : array
49 {
50 global $DIC;
51
52 $ilDB = $DIC['ilDB'];
53
54 $query = 'SELECT * FROM obj_user_data_hist ' .
55 'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
56 $res = $ilDB->query($query);
57
58 $users = array();
59 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
60 $users[(int) $row->usr_id]['update_user'] = (int) $row->update_user;
61 $users[(int) $row->usr_id]['editing_time'] = new ilDateTime($row->editing_time, IL_CAL_DATETIME, ilTimeZone::UTC);
62 }
63 return $users;
64 }
const IL_CAL_DATETIME
$res
Definition: ltiservices.php:69

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, IL_CAL_DATETIME, ILIAS\Repository\int(), and ilTimeZone\UTC.

Referenced by ilCourseParticipantsTableGUI\parse(), ilGroupParticipantsTableGUI\parse(), ilSubscriberTableGUI\readSubscriberData(), and ilWaitingListTableGUI\readUserData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilObjectCustomUserFieldHistory::read ( )
protected

Definition at line 110 of file class.ilObjectCustomUserFieldHistory.php.

110 : void
111 {
112 $query = 'SELECT * FROM obj_user_data_hist ' .
113 'WHERE obj_id = ' . $this->db->quote($this->obj_id, 'integer') . ' ' .
114 'AND usr_id = ' . $this->db->quote($this->user_id, 'integer');
115 $res = $this->db->query($query);
116 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
117 $this->setEditingTime(new ilDateTime($row->editing_time, IL_CAL_DATETIME, ilTimeZone::UTC));
118 $this->setUpdateUser((int) $row->update_user);
119 }
120 }

References $res, ilDBConstants\FETCHMODE_OBJECT, IL_CAL_DATETIME, setEditingTime(), setUpdateUser(), and ilTimeZone\UTC.

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilObjectCustomUserFieldHistory::save ( )

Definition at line 86 of file class.ilObjectCustomUserFieldHistory.php.

86 : void
87 {
88 $this->delete();
89 $query = 'INSERT INTO obj_user_data_hist (obj_id, usr_id, update_user, editing_time) ' .
90 'VALUES( ' .
91 $this->db->quote($this->obj_id, 'integer') . ', ' .
92 $this->db->quote($this->user_id, 'integer') . ', ' .
93 $this->db->quote($this->getUpdateUser(), 'integer') . ', ' .
94 $this->db->quote(
95 $this->getEditingTime()->get(IL_CAL_DATETIME, '', ilTimeZone::UTC),
97 ) . ' ' .
98 ')';
99 $this->db->manipulate($query);
100 }

References getUpdateUser(), IL_CAL_DATETIME, ilDBConstants\T_TIMESTAMP, and ilTimeZone\UTC.

+ Here is the call graph for this function:

◆ setEditingTime()

ilObjectCustomUserFieldHistory::setEditingTime ( ilDateTime  $dt)

Definition at line 76 of file class.ilObjectCustomUserFieldHistory.php.

76 : void
77 {
78 $this->editing_time = $dt;
79 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUpdateUser()

ilObjectCustomUserFieldHistory::setUpdateUser ( int  $a_id)

Definition at line 66 of file class.ilObjectCustomUserFieldHistory.php.

66 : void
67 {
68 $this->update_user = $a_id;
69 }

Referenced by read().

+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilObjectCustomUserFieldHistory::$db
protected

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

◆ $editing_time

ilDateTime ilObjectCustomUserFieldHistory::$editing_time = null
private

Definition at line 31 of file class.ilObjectCustomUserFieldHistory.php.

Referenced by getEditingTime().

◆ $obj_id

int ilObjectCustomUserFieldHistory::$obj_id = 0
private

Definition at line 28 of file class.ilObjectCustomUserFieldHistory.php.

◆ $update_user

int ilObjectCustomUserFieldHistory::$update_user = 0
private

Definition at line 30 of file class.ilObjectCustomUserFieldHistory.php.

Referenced by getUpdateUser().

◆ $user_id

int ilObjectCustomUserFieldHistory::$user_id = 0
private

Definition at line 29 of file class.ilObjectCustomUserFieldHistory.php.


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