51 $this->db = $DIC->database();
53 $this->obj_id = $a_obj_id;
54 $this->usr_id = $a_usr_id;
66 $query =
"DELETE FROM ut_lp_marks " .
67 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
76 public function setMark(
string $a_mark): void
78 $this->mark = $a_mark;
98 $this->completed = $a_status;
118 if (!$this->has_entry) {
121 $query =
"UPDATE ut_lp_marks " .
122 "SET mark = " . $this->db->quote($this->
getMark(),
'text') .
", " .
123 "u_comment = " . $this->db->quote(
127 "completed = " . $this->db->quote(
131 "WHERE obj_id = " . $this->db->quote(
135 "AND usr_id = " . $this->db->quote($this->
getUserId(),
'integer');
144 $ilDB = $DIC[
'ilDB'];
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');
152 return (
bool) $row->completed;
164 $ilDB = $DIC[
'ilDB'];
166 $query =
"SELECT * FROM ut_lp_marks " .
167 "WHERE usr_id = " .
$ilDB->quote($user_id,
'integer') .
168 " AND status = " .
$ilDB->quote(
172 " AND status_changed >= " .
$ilDB->quote($from,
"timestamp") .
173 " AND status_changed <= " .
$ilDB->quote($to,
"timestamp");
176 $completions = array();
177 while ($rec =
$ilDB->fetchAssoc($set)) {
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']
189 $completions[] = $completion;
194 public static function _lookupMark(
int $a_usr_id,
int $a_obj_id): string
198 $ilDB = $DIC[
'ilDB'];
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');
206 return (
string) $row->mark;
215 $ilDB = $DIC[
'ilDB'];
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');
223 return (
string) $row->u_comment;
231 $res = $this->db->query(
232 "SELECT * FROM ut_lp_marks " .
233 "WHERE obj_id = " . $this->db->quote(
237 "AND usr_id = " . $this->db->quote($this->usr_id,
'integer')
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;
252 $query =
"INSERT INTO ut_lp_marks (mark,u_comment, completed,obj_id,usr_id) " .
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') .
" " .
261 $this->has_entry =
true;
270 $ilDB = $DIC[
'ilDB'];
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")
282 $ilDB = $DIC[
'ilDB'];
286 "SELECT usr_id FROM ut_lp_marks" .
287 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer")
289 while ($row =
$ilDB->fetchAssoc($set)) {
const LP_STATUS_COMPLETED_NUM
static _lookupComment(int $a_usr_id, int $a_obj_id)
ilObjectDataCache $ilObjectDataCache
static _getAllUserIds(int $a_obj_id)
static getCompletionsOfUser(int $user_id, string $from, string $to)
__construct(int $a_obj_id, int $a_usr_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _hasCompleted(int $a_usr_id, int $a_obj_id)
static deleteObject(int $a_obj_id)
static _deleteForUsers(int $a_obj_id, array $a_user_ids)
static _lookupMark(int $a_usr_id, int $a_obj_id)
setComment(string $a_comment)
setCompleted(bool $a_status)