ILIAS  release_8 Revision v8.24
ilLPMarks Class Reference
+ Collaboration diagram for ilLPMarks:

Public Member Functions

 __construct (int $a_obj_id, int $a_usr_id)
 
 getUserId ()
 
 setMark (string $a_mark)
 
 getMark ()
 
 setComment (string $a_comment)
 
 getComment ()
 
 setCompleted (bool $a_status)
 
 getCompleted ()
 
 getStatusChanged ()
 
 getObjId ()
 
 update ()
 
 __read ()
 
 __add ()
 

Static Public Member Functions

static deleteObject (int $a_obj_id)
 
static _hasCompleted (int $a_usr_id, int $a_obj_id)
 
static getCompletionsOfUser (int $user_id, string $from, string $to)
 
static _lookupMark (int $a_usr_id, int $a_obj_id)
 
static _lookupComment (int $a_usr_id, int $a_obj_id)
 
static _deleteForUsers (int $a_obj_id, array $a_user_ids)
 
static _getAllUserIds (int $a_obj_id)
 

Protected Attributes

ilDBInterface $db
 
ilObjectDataCache $ilObjectDataCache
 
int $obj_id
 
int $usr_id
 
string $obj_type
 
bool $completed = false
 
string $comment = ''
 
string $mark = ''
 
string $status_changed = ''
 
 $has_entry = false
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilLPMarks::__construct ( int  $a_obj_id,
int  $a_usr_id 
)

Definition at line 46 of file class.ilLPMarks.php.

47 {
48 global $DIC;
49
50 $this->ilObjectDataCache = $DIC['ilObjDataCache'];
51 $this->db = $DIC->database();
52
53 $this->obj_id = $a_obj_id;
54 $this->usr_id = $a_usr_id;
55 $this->obj_type = $this->ilObjectDataCache->lookupType($this->obj_id);
56
57 $this->__read();
58 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28

References $DIC, __read(), and ilObjectDataCache\lookupType().

+ Here is the call graph for this function:

Member Function Documentation

◆ __add()

ilLPMarks::__add ( )

Definition at line 250 of file class.ilLPMarks.php.

250 : void
251 {
252 $query = "INSERT INTO ut_lp_marks (mark,u_comment, completed,obj_id,usr_id) " .
253 "VALUES( " .
254 $this->db->quote($this->getMark(), 'text') . ", " .
255 $this->db->quote($this->getComment(), 'text') . ", " .
256 $this->db->quote($this->getCompleted(), 'integer') . ", " .
257 $this->db->quote($this->getObjId(), 'integer') . ", " .
258 $this->db->quote($this->getUserId(), 'integer') . " " .
259 ")";
260 $res = $this->db->manipulate($query);
261 $this->has_entry = true;
262 }
$res
Definition: ltiservices.php:69
$query

References $query, and $res.

Referenced by update().

+ Here is the caller graph for this function:

◆ __read()

ilLPMarks::__read ( )

Definition at line 229 of file class.ilLPMarks.php.

229 : bool
230 {
231 $res = $this->db->query(
232 "SELECT * FROM ut_lp_marks " .
233 "WHERE obj_id = " . $this->db->quote(
234 $this->obj_id,
235 'integer'
236 ) . " " .
237 "AND usr_id = " . $this->db->quote($this->usr_id, 'integer')
238 );
239 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
240 $this->has_entry = true;
241 $this->completed = (int) $row->completed;
242 $this->comment = (string) $row->u_comment;
243 $this->mark = (string) $row->mark;
244 $this->status_changed = (string) $row->status_changed;
245 return true;
246 }
247 return false;
248 }

References $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by __construct().

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

◆ _deleteForUsers()

static ilLPMarks::_deleteForUsers ( int  $a_obj_id,
array  $a_user_ids 
)
static

Definition at line 264 of file class.ilLPMarks.php.

267 : void {
268 global $DIC;
269
270 $ilDB = $DIC['ilDB'];
271 $ilDB->manipulate(
272 "DELETE FROM ut_lp_marks" .
273 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
274 " AND " . $ilDB->in("usr_id", $a_user_ids, "", "integer")
275 );
276 }

Referenced by ilObjectLP\resetLPDataForUserIds().

+ Here is the caller graph for this function:

◆ _getAllUserIds()

static ilLPMarks::_getAllUserIds ( int  $a_obj_id)
static

Definition at line 278 of file class.ilLPMarks.php.

278 : array
279 {
280 global $DIC;
281
282 $ilDB = $DIC['ilDB'];
283
284 $res = array();
285 $set = $ilDB->query(
286 "SELECT usr_id FROM ut_lp_marks" .
287 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer")
288 );
289 while ($row = $ilDB->fetchAssoc($set)) {
290 $res[] = (int) $row["usr_id"];
291 }
292 return $res;
293 }

References $DIC, $ilDB, $res, and ILIAS\Repository\int().

Referenced by ilObjectLP\gatherLPUsers().

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

◆ _hasCompleted()

static ilLPMarks::_hasCompleted ( int  $a_usr_id,
int  $a_obj_id 
)
static

Definition at line 140 of file class.ilLPMarks.php.

140 : bool
141 {
142 global $DIC;
143
144 $ilDB = $DIC['ilDB'];
145
146 $query = "SELECT * FROM ut_lp_marks " .
147 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
148 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
149
150 $res = $ilDB->query($query);
151 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
152 return (bool) $row->completed;
153 }
154 return false;
155 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilContentPageKioskModeView\buildLearningProgressToggleControl(), and ilLearningModuleKioskModeView\maybeBuildLearningProgressToggleControl().

+ Here is the caller graph for this function:

◆ _lookupComment()

static ilLPMarks::_lookupComment ( int  $a_usr_id,
int  $a_obj_id 
)
static

Definition at line 211 of file class.ilLPMarks.php.

211 : string
212 {
213 global $DIC;
214
215 $ilDB = $DIC['ilDB'];
216
217 $query = "SELECT * FROM ut_lp_marks " .
218 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
219 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
220
221 $res = $ilDB->query($query);
222 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
223 return (string) $row->u_comment;
224 }
225 return '';
226 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilExGradesTableGUI\fillRow(), ilWikiContributorsTableGUI\fillRow(), and ilObjWikiGUI\infoScreen().

+ Here is the caller graph for this function:

◆ _lookupMark()

static ilLPMarks::_lookupMark ( int  $a_usr_id,
int  $a_obj_id 
)
static

Definition at line 194 of file class.ilLPMarks.php.

194 : string
195 {
196 global $DIC;
197
198 $ilDB = $DIC['ilDB'];
199
200 $query = "SELECT * FROM ut_lp_marks " .
201 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
202 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
203
204 $res = $ilDB->query($query);
205 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
206 return (string) $row->mark;
207 }
208 return '';
209 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjExercise\exportGradesExcel(), ilExGradesTableGUI\fillRow(), ilWikiContributorsTableGUI\fillRow(), ilObjWikiGUI\infoScreen(), and ilCertificateLPMarksHelper\lookUpMark().

+ Here is the caller graph for this function:

◆ deleteObject()

static ilLPMarks::deleteObject ( int  $a_obj_id)
static

Definition at line 60 of file class.ilLPMarks.php.

60 : void
61 {
62 global $DIC;
63
64 $ilDB = $DIC['ilDB'];
65
66 $query = "DELETE FROM ut_lp_marks " .
67 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer');
68 $res = $ilDB->manipulate($query);
69 }

References $DIC, $ilDB, $query, and $res.

Referenced by ilEventParticipants\_deleteByEvent(), and ilObjectLP\handleDelete().

+ Here is the caller graph for this function:

◆ getComment()

ilLPMarks::getComment ( )

Definition at line 91 of file class.ilLPMarks.php.

91 : string
92 {
93 return $this->comment;
94 }
string $comment

References $comment.

Referenced by update().

+ Here is the caller graph for this function:

◆ getCompleted()

ilLPMarks::getCompleted ( )

Definition at line 101 of file class.ilLPMarks.php.

101 : bool
102 {
103 return $this->completed;
104 }

References $completed.

Referenced by update().

+ Here is the caller graph for this function:

◆ getCompletionsOfUser()

static ilLPMarks::getCompletionsOfUser ( int  $user_id,
string  $from,
string  $to 
)
static

Definition at line 157 of file class.ilLPMarks.php.

161 : array {
162 global $DIC;
163
164 $ilDB = $DIC['ilDB'];
165
166 $query = "SELECT * FROM ut_lp_marks " .
167 "WHERE usr_id = " . $ilDB->quote($user_id, 'integer') .
168 " AND status = " . $ilDB->quote(
170 'integer'
171 ) .
172 " AND status_changed >= " . $ilDB->quote($from, "timestamp") .
173 " AND status_changed <= " . $ilDB->quote($to, "timestamp");
174
175 $set = $ilDB->query($query);
176 $completions = array();
177 while ($rec = $ilDB->fetchAssoc($set)) {
178 $completion = [
179 'obj_id' => (int) $rec['obj_id'],
180 'usr_id' => (int) $rec['usr_id'],
181 'completed' => (bool) $rec['completed'],
182 'mark' => (string) $rec['mark'],
183 'comment' => (string) $rec['u_comment'],
184 'status' => (int) $rec['status'],
185 'status_changed' => (string) $rec['status_changed'],
186 'status_dirty' => (int) $rec['status_changed'],
187 'percentage' => (int) $rec['percentage']
188 ];
189 $completions[] = $completion;
190 }
191 return $completions;
192 }
const LP_STATUS_COMPLETED_NUM

Referenced by ilTrackingLearningHistoryProvider\getEntries().

+ Here is the caller graph for this function:

◆ getMark()

ilLPMarks::getMark ( )

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

81 : string
82 {
83 return $this->mark;
84 }

References $mark.

Referenced by update().

+ Here is the caller graph for this function:

◆ getObjId()

ilLPMarks::getObjId ( )

Definition at line 111 of file class.ilLPMarks.php.

111 : int
112 {
113 return $this->obj_id;
114 }

References $obj_id.

Referenced by update().

+ Here is the caller graph for this function:

◆ getStatusChanged()

ilLPMarks::getStatusChanged ( )

Definition at line 106 of file class.ilLPMarks.php.

106 : string
107 {
109 }
string $status_changed

References $status_changed.

◆ getUserId()

ilLPMarks::getUserId ( )

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

71 : int
72 {
73 return $this->usr_id;
74 }

References $usr_id.

Referenced by update().

+ Here is the caller graph for this function:

◆ setComment()

ilLPMarks::setComment ( string  $a_comment)

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

86 : void
87 {
88 $this->comment = $a_comment;
89 }

References ILIAS\UI\examples\Symbol\Glyph\Comment\comment().

+ Here is the call graph for this function:

◆ setCompleted()

ilLPMarks::setCompleted ( bool  $a_status)

Definition at line 96 of file class.ilLPMarks.php.

96 : void
97 {
98 $this->completed = $a_status;
99 }

◆ setMark()

ilLPMarks::setMark ( string  $a_mark)

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

76 : void
77 {
78 $this->mark = $a_mark;
79 }

◆ update()

ilLPMarks::update ( )

Definition at line 116 of file class.ilLPMarks.php.

116 : void
117 {
118 if (!$this->has_entry) {
119 $this->__add();
120 }
121 $query = "UPDATE ut_lp_marks " .
122 "SET mark = " . $this->db->quote($this->getMark(), 'text') . ", " .
123 "u_comment = " . $this->db->quote(
124 $this->getComment(),
125 'text'
126 ) . ", " .
127 "completed = " . $this->db->quote(
128 $this->getCompleted(),
129 'integer'
130 ) . " " .
131 "WHERE obj_id = " . $this->db->quote(
132 $this->getObjId(),
133 'integer'
134 ) . " " .
135 "AND usr_id = " . $this->db->quote($this->getUserId(), 'integer');
136 $res = $this->db->manipulate($query);
137 }

References $query, $res, __add(), getComment(), getCompleted(), getMark(), getObjId(), and getUserId().

+ Here is the call graph for this function:

Field Documentation

◆ $comment

string ilLPMarks::$comment = ''
protected

Definition at line 40 of file class.ilLPMarks.php.

Referenced by getComment().

◆ $completed

bool ilLPMarks::$completed = false
protected

Definition at line 39 of file class.ilLPMarks.php.

Referenced by getCompleted().

◆ $db

ilDBInterface ilLPMarks::$db
protected

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

◆ $has_entry

ilLPMarks::$has_entry = false
protected

Definition at line 44 of file class.ilLPMarks.php.

◆ $ilObjectDataCache

ilObjectDataCache ilLPMarks::$ilObjectDataCache
protected

Definition at line 33 of file class.ilLPMarks.php.

◆ $mark

string ilLPMarks::$mark = ''
protected

Definition at line 41 of file class.ilLPMarks.php.

Referenced by getMark().

◆ $obj_id

int ilLPMarks::$obj_id
protected

Definition at line 35 of file class.ilLPMarks.php.

Referenced by getObjId().

◆ $obj_type

string ilLPMarks::$obj_type
protected

Definition at line 37 of file class.ilLPMarks.php.

◆ $status_changed

string ilLPMarks::$status_changed = ''
protected

Definition at line 42 of file class.ilLPMarks.php.

Referenced by getStatusChanged().

◆ $usr_id

int ilLPMarks::$usr_id
protected

Definition at line 36 of file class.ilLPMarks.php.

Referenced by getUserId().


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