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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilExcAssMemberStateRepository:

Public Member Functions

 __construct (?ilDBInterface $db=null)
 
 getSubmitableAssignmentIdsOfUser (array $exc_ids, int $user_id)
 Get all assignments for a user where the user may hand in submissions. More...
 
 getAssignmentIdsWithGradingNeeded (array $exc_ids)
 Get assignments with open gradings. More...
 
 getAssignmentIdsWithPeerFeedbackNeeded (array $exc_ids, int $user_id)
 Get all assignments for a user where the user may hand in submissions. More...
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

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 determines assignment member state information directly on the persistence layer. Thus its procedures are fast but may not include/respect all higher application logic of the assignment state of members

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilExcAssMemberStateRepository::__construct ( ?ilDBInterface  $db = null)

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

31 {
32 global $DIC;
33
34 $this->db = (is_null($db))
35 ? $DIC->database()
36 : $db;
37 }
global $DIC
Definition: shib_login.php:26

References $db, and $DIC.

Member Function Documentation

◆ getAssignmentIdsWithGradingNeeded()

ilExcAssMemberStateRepository::getAssignmentIdsWithGradingNeeded ( array  $exc_ids)

Get assignments with open gradings.

Parameters
int[]$exc_idsexercises the user is "tutor" of
Returns
int[]

Definition at line 78 of file class.ilExcAssMemberStateRepository.php.

78 : array
79 {
80 $db = $this->db;
81
82 $set = $db->queryF(
83 'SELECT ass.id, COUNT(*) open_grading FROM exc_mem_ass_status st LEFT JOIN exc_assignment ass
84 ON (st.ass_id = ass.id)
85 WHERE ' . $db->in("ass.exc_id", $exc_ids, false, "integer") . '
86 AND st.status = %s
87 AND st.returned = %s
88 GROUP BY (ass.id)',
89 array("text","integer"),
90 array("notgraded", 1)
91 );
92 $open_gradings = [];
93 while ($rec = $db->fetchAssoc($set)) {
94 $open_gradings[$rec["id"]] = (int) $rec["open_grading"];
95 }
96 return $open_gradings;
97 }
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
in(string $field, array $values, bool $negate=false, string $type="")

References ilDBInterface\fetchAssoc(), ilDBInterface\in(), ILIAS\Repository\int(), and ilDBInterface\queryF().

+ Here is the call graph for this function:

◆ getAssignmentIdsWithPeerFeedbackNeeded()

ilExcAssMemberStateRepository::getAssignmentIdsWithPeerFeedbackNeeded ( array  $exc_ids,
int  $user_id 
)

Get all assignments for a user where the user may hand in submissions.

Parameters
int[]$exc_idsexercises the user is "member" in
Returns
int[]

Definition at line 105 of file class.ilExcAssMemberStateRepository.php.

108 : array {
109 $db = $this->db;
110
111 // peer groups exist
112 $set = $db->queryF(
113 'SELECT ass.id, count(*) nr_given, ass.peer_dl, ass.peer_min, max(idl.tstamp) maxidl, max(peer.tstamp) maxpeer
114 FROM exc_assignment ass
115 LEFT JOIN exc_assignment_peer peer ON (ass.id = peer.ass_id)
116 LEFT JOIN exc_idl idl ON (ass.id = idl.ass_id)
117 WHERE ' . $db->in("ass.exc_id", $exc_ids, false, "integer") . '
118 AND ass.deadline_mode = %s
119 AND ass.time_stamp < %s
120 AND (ass.deadline2 < %s OR ass.deadline2 IS NULL)
121 AND ass.peer = %s
122 AND (peer.giver_id = %s)
123 AND (ass.peer_dl > %s OR ass.peer_dl IS NULL)
124 AND (peer.is_valid = %s)
125 GROUP BY (ass.id)
126 HAVING (ass.peer_min > nr_given) AND (maxidl < %s OR maxidl IS NULL)
127 ',
128 array("integer", "integer", "integer", "integer", "integer", "integer", "integer", "integer"),
129 array(0, time(), time(), 1, $user_id, time(), 1, time())
130 );
131 $ids = [];
132 while ($rec = $db->fetchAssoc($set)) {
133 $ids[] = $rec["id"];
134 }
135
136 // peer groups do not exist
137 $set = $db->queryF(
138 'SELECT ass.id, count(*) nr_given, ass.peer_dl, ass.peer_min, max(idl.tstamp) maxidl, max(peer.tstamp) maxpeer
139 FROM exc_assignment ass
140 LEFT JOIN exc_assignment_peer peer ON (ass.id = peer.ass_id)
141 LEFT JOIN exc_idl idl ON (ass.id = idl.ass_id)
142 WHERE ' . $db->in("ass.exc_id", $exc_ids, false, "integer") . '
143 AND ass.deadline_mode = %s
144 AND ass.time_stamp < %s
145 AND (ass.deadline2 < %s OR ass.deadline2 IS NULL)
146 AND ass.peer = %s
147 AND (peer.giver_id IS NULL)
148 AND (ass.peer_dl > %s OR ass.peer_dl IS NULL)
149 AND (peer.tstamp IS NULL)
150 GROUP BY (ass.id)
151 HAVING (maxpeer IS NULL) AND (maxidl < %s OR maxidl IS NULL)
152 ',
153 array("integer", "integer", "integer", "integer", "integer", "integer"),
154 array(0, time(), time(), 1, time(), time())
155 );
156 while ($rec = $db->fetchAssoc($set)) {
157 $ids[] = $rec["id"];
158 }
159
160 return $ids;
161 }

◆ getSubmitableAssignmentIdsOfUser()

ilExcAssMemberStateRepository::getSubmitableAssignmentIdsOfUser ( array  $exc_ids,
int  $user_id 
)

Get all assignments for a user where the user may hand in submissions.

Parameters
int[]$exc_idsexercises the user is "member" in
Returns
int[]

Definition at line 45 of file class.ilExcAssMemberStateRepository.php.

48 : array {
49 $db = $this->db;
50 $set = $db->queryF(
51 'SELECT ass.id FROM exc_assignment ass LEFT JOIN exc_idl idl
52 ON (ass.id = idl.ass_id AND idl.member_id = %s)
53 WHERE ' . $db->in("ass.exc_id", $exc_ids, false, "integer") . '
54 AND (( ass.deadline_mode = %s
55 AND (ass.start_time IS NULL OR ass.start_time < %s )
56 AND (ass.time_stamp IS NULL OR ass.time_stamp > %s OR ass.deadline2 > %s OR idl.tstamp > %s))
57 ) OR (
58 ass.deadline_mode = %s
59 AND (idl.starting_ts > 0)
60 AND (idl.starting_ts + (ass.relative_deadline * 24 * 60 * 60) > %s)
61 )',
62 array("integer", "integer", "integer", "integer", "integer", "integer", "integer", "integer"),
63 array($user_id, 0, time(), time(), time(), time(), 1, time())
64 );
65 $ids = [];
66 while ($rec = $db->fetchAssoc($set)) {
67 $ids[] = $rec["id"];
68 }
69 return $ids;
70 }

Field Documentation

◆ $db

ilDBInterface ilExcAssMemberStateRepository::$db
protected

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

Referenced by __construct().


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