ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
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 25 of file class.ilLPMarks.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

42 {
43 global $DIC;
44
45 $this->ilObjectDataCache = $DIC['ilObjDataCache'];
46 $this->db = $DIC->database();
47
48 $this->obj_id = $a_obj_id;
49 $this->usr_id = $a_usr_id;
50 $this->obj_type = $this->ilObjectDataCache->lookupType($this->obj_id);
51
52 $this->__read();
53 }
class ilObjectDataCache
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __add()

ilLPMarks::__add ( )

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

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

References $res.

Referenced by update().

+ Here is the caller graph for this function:

◆ __read()

ilLPMarks::__read ( )

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

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

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 259 of file class.ilLPMarks.php.

262 : void {
263 global $DIC;
264
265 $ilDB = $DIC['ilDB'];
266 $ilDB->manipulate(
267 "DELETE FROM ut_lp_marks" .
268 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
269 " AND " . $ilDB->in("usr_id", $a_user_ids, "", "integer")
270 );
271 }

Referenced by ilObjectLP\resetLPDataForUserIds().

+ Here is the caller graph for this function:

◆ _getAllUserIds()

static ilLPMarks::_getAllUserIds ( int  $a_obj_id)
static

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

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

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 135 of file class.ilLPMarks.php.

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

References $DIC, $ilDB, $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 206 of file class.ilLPMarks.php.

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

References $DIC, $ilDB, $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 189 of file class.ilLPMarks.php.

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

References $DIC, $ilDB, $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 55 of file class.ilLPMarks.php.

55 : void
56 {
57 global $DIC;
58
59 $ilDB = $DIC['ilDB'];
60
61 $query = "DELETE FROM ut_lp_marks " .
62 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer');
63 $res = $ilDB->manipulate($query);
64 }

References $DIC, $ilDB, and $res.

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

+ Here is the caller graph for this function:

◆ getComment()

ilLPMarks::getComment ( )

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

86 : string
87 {
88 return $this->comment;
89 }
string $comment

References $comment.

Referenced by update().

+ Here is the caller graph for this function:

◆ getCompleted()

ilLPMarks::getCompleted ( )

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

96 : bool
97 {
98 return $this->completed;
99 }

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 152 of file class.ilLPMarks.php.

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

Referenced by ilTrackingLearningHistoryProvider\getEntries().

+ Here is the caller graph for this function:

◆ getMark()

ilLPMarks::getMark ( )

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

76 : string
77 {
78 return $this->mark;
79 }

References $mark.

Referenced by update().

+ Here is the caller graph for this function:

◆ getObjId()

ilLPMarks::getObjId ( )

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

106 : int
107 {
108 return $this->obj_id;
109 }

References $obj_id.

Referenced by update().

+ Here is the caller graph for this function:

◆ getStatusChanged()

ilLPMarks::getStatusChanged ( )

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

101 : string
102 {
104 }
string $status_changed

References $status_changed.

◆ getUserId()

ilLPMarks::getUserId ( )

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

66 : int
67 {
68 return $this->usr_id;
69 }

References $usr_id.

Referenced by update().

+ Here is the caller graph for this function:

◆ setComment()

ilLPMarks::setComment ( string  $a_comment)

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

81 : void
82 {
83 $this->comment = $a_comment;
84 }

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 91 of file class.ilLPMarks.php.

91 : void
92 {
93 $this->completed = $a_status;
94 }

◆ setMark()

ilLPMarks::setMark ( string  $a_mark)

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

71 : void
72 {
73 $this->mark = $a_mark;
74 }

◆ update()

ilLPMarks::update ( )

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

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

References $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 35 of file class.ilLPMarks.php.

Referenced by getComment().

◆ $completed

bool ilLPMarks::$completed = false
protected

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

Referenced by getCompleted().

◆ $db

ilDBInterface ilLPMarks::$db
protected

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

◆ $has_entry

ilLPMarks::$has_entry = false
protected

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

◆ $ilObjectDataCache

ilObjectDataCache ilLPMarks::$ilObjectDataCache
protected

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

◆ $mark

string ilLPMarks::$mark = ''
protected

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

Referenced by getMark().

◆ $obj_id

int ilLPMarks::$obj_id
protected

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

Referenced by getObjId().

◆ $obj_type

string ilLPMarks::$obj_type
protected

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

◆ $status_changed

string ilLPMarks::$status_changed = ''
protected

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

Referenced by getStatusChanged().

◆ $usr_id

int ilLPMarks::$usr_id
protected

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

Referenced by getUserId().


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