58 $ilDB = $DIC->database();
59 $lng = $DIC->language();
60 $tree = $DIC->repositoryTree();
66 $this->event_id = $a_event_id;
72 $this->user_id = $a_usr_id;
76 return $this->user_id;
80 $this->mark = $a_mark;
96 $this->participated = $a_status;
104 $this->registered = $a_status;
116 $this->excused = $a_stat;
135 if (!is_array($this->participants) || !array_key_exists($a_usr_id, $this->participants)) {
136 $event_part = new \ilEventParticipants($this->event_id);
137 $event_part->setUserId($a_usr_id);
138 $event_part->setMark(
'');
139 $event_part->setComment(
'');
140 $event_part->setNotificationEnabled(
false);
141 $event_part->setParticipated(
false);
142 $event_part->setRegistered(
false);
143 $event_part->setContact(
false);
144 $event_part->setExcused($a_status);
145 $event_part->updateUser();
152 $this->db->manipulate(
$query);
161 $this->contact = (int) $a_status;
185 $this->notificationEnabled = (bool) $value;
192 $ilDB = $DIC[
'ilDB'];
194 $query =
"DELETE FROM event_participants " .
195 "WHERE event_id = " .
$ilDB->quote($this->
getEventId(),
'integer') .
" " .
196 "AND usr_id = " .
$ilDB->quote($this->
getUserId(),
'integer') .
" ";
199 $query =
"INSERT INTO event_participants (event_id,usr_id,registered,participated,contact,notification_enabled, excused " .
211 include_once
"Services/Tracking/classes/class.ilLPMarks.php";
214 $lp_mark->setMark($this->
getMark());
218 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
230 return $this->participants[$a_usr_id] ? $this->participants[$a_usr_id] : array();
235 return $this->participants ? $this->participants : array();
240 return $this->participants[$a_usr_id][
'registered'] ? true :
false;
245 return $this->participants[$a_usr_id][
'participated'] ? true :
false;
254 return $this->participants[$a_usr_id][
'excused'] ? true :
false;
265 return $this->participants[$a_usr_id][
'contact'] ? true :
false;
278 $ilDB = $DIC[
'ilDB'];
280 $query =
"SELECT * FROM event_participants " .
281 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" " .
282 "AND usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" ";
284 if (
$res->numRows()) {
285 $query =
"UPDATE event_participants " .
286 "SET participated = " .
$ilDB->quote($a_status,
'integer') .
" " .
287 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" " .
288 "AND usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" ";
291 $query =
"INSERT INTO event_participants (registered,participated,event_id,usr_id) " .
293 $ilDB->quote(0,
'integer') .
", " .
294 $ilDB->quote($a_status,
'integer') .
", " .
295 $ilDB->quote($a_event_id,
'integer') .
", " .
296 $ilDB->quote($a_usr_id,
'integer') .
" " .
302 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
312 $ilDB = $DIC[
'ilDB'];
314 $query =
"SELECT * FROM event_participants " .
315 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" " .
316 "AND registered = " .
$ilDB->quote(1,
'integer');
319 $user_ids[] = $row->usr_id;
321 return $user_ids ? $user_ids : array();
328 $ilDB = $DIC[
'ilDB'];
330 $query =
"SELECT * FROM event_participants " .
331 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" " .
332 "AND participated = 1";
335 $user_ids[$row->usr_id] = $row->usr_id;
337 return $user_ids ? $user_ids : array();
344 $ilDB = $DIC[
'ilDB'];
346 $query =
"SELECT participated FROM event_participants " .
347 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" " .
348 "AND usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" ";
351 return (
bool) $rec[
"participated"];
360 $ilDB = $DIC[
'ilDB'];
362 $query =
"SELECT * FROM event_participants " .
363 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" " .
364 "AND usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" ";
367 return (
bool) $row->registered;
372 public static function _register($a_usr_id, $a_event_id)
376 $ilDB = $DIC[
'ilDB'];
378 $query =
"SELECT * FROM event_participants " .
379 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" " .
380 "AND usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" ";
382 if (
$res->numRows()) {
383 $query =
"UPDATE event_participants " .
384 "SET registered = '1' " .
385 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" " .
386 "AND usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" ";
389 $query =
"INSERT INTO event_participants (registered,participated,event_id,usr_id) " .
393 $ilDB->quote($a_event_id,
'integer') .
", " .
394 $ilDB->quote($a_usr_id,
'integer') .
" " .
400 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
405 public function register($a_usr_id)
414 $ilDB = $DIC[
'ilDB'];
416 $query =
"SELECT * FROM event_participants " .
417 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" " .
418 "AND usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" ";
420 if (
$res->numRows()) {
421 $query =
"UPDATE event_participants " .
422 "SET registered = 0 " .
423 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" " .
424 "AND usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" ";
427 $query =
"INSERT INTO event_participants (registered,participated,event_id,usr_id) " .
431 $ilDB->quote($a_event_id,
'integer') .
", " .
432 $ilDB->quote($a_usr_id,
'integer') .
" " .
438 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
441 self::handleAutoFill($a_event_id);
452 include_once
"Services/Tracking/classes/class.ilLPMarks.php";
453 $lp_mark =
new ilLPMarks($a_event_id, $a_usr_id);
454 return $lp_mark->getMark();
459 include_once
"Services/Tracking/classes/class.ilLPMarks.php";
460 $lp_mark =
new ilLPMarks($a_event_id, $a_usr_id);
461 return $lp_mark->getComment();
471 $this->event_id = $a_event_id;
478 $ilDB = $DIC[
'ilDB'];
480 $query =
"DELETE FROM event_participants " .
481 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" ";
484 include_once
"Services/Tracking/classes/class.ilLPMarks.php";
493 $ilDB = $DIC[
'ilDB'];
495 $query =
"DELETE FROM event_participants " .
496 "WHERE usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" ";
507 $ilDB = $DIC[
'ilDB'];
509 $query =
"SELECT * FROM event_participants " .
514 $tree = $DIC->repositoryTree();
516 $parentRecipients = [];
517 $parentParticipants = [];
520 if (
true ===
$session->isRegistrationNotificationEnabled()) {
522 $parentRefId =
$tree->checkForParentType($refIdArray[0],
'grp');
524 $parentRefId =
$tree->checkForParentType($refIdArray[0],
'crs');
528 $parentRecipients = $participants->getNotificationRecipients();
529 $parentParticipants = $participants->getParticipants();
534 $this->participants[$row->usr_id][
'usr_id'] = $row->usr_id;
535 $this->participants[$row->usr_id][
'registered'] = $row->registered;
536 $this->participants[$row->usr_id][
'participated'] = $row->participated;
537 $this->participants[$row->usr_id][
'excused'] = $row->excused;
538 $this->participants[$row->usr_id][
'contact'] = $row->contact;
541 $this->participants[$row->usr_id][
'mark'] = $lp_mark->getMark();
542 $this->participants[$row->usr_id][
'comment'] = $lp_mark->getComment();
543 $this->participants[$row->usr_id][
'notification_enabled'] =
false;
544 if (in_array($row->usr_id, $parentRecipients)) {
545 $this->participants[$row->usr_id][
'notification_enabled'] =
true;
548 if ($row->registered) {
549 $this->registered[] = $row->usr_id;
551 if ($row->participated) {
552 $this->participated[] = $row->usr_id;
556 foreach ($parentParticipants as $usr_id) {
557 if (isset($this->participants[$usr_id])) {
560 $this->participants[$usr_id][
'usr_id'] = $usr_id;
561 $this->participants[$usr_id][
'registered'] =
false;
562 $this->participants[$usr_id][
'participated'] =
false;
563 $this->participants[$usr_id][
'excused'] =
false;
564 $this->participants[$usr_id][
'contact'] =
false;
566 $this->participants[$usr_id][
'mark'] = $lp_mark->getMark();
567 $this->participants[$usr_id][
'comment'] = $lp_mark->getComment();
568 $this->participants[$usr_id][
'notification_enabled'] =
false;
569 if (in_array($usr_id, $parentRecipients)) {
570 $this->participants[$usr_id][
'notification_enabled'] =
true;
584 $sess->handleAutoFill();
static _getRegistered($a_event_id)
static _getParticipated($a_event_id)
const NOTIFICATION_INHERIT_OPTION
updateParticipation($a_usr_id, $a_status)
static _unregister($a_usr_id, $a_event_id)
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _lookupMark($a_event_id, $a_usr_id)
static _isRegistered($a_usr_id, $a_event_id)
static _getAllReferences($a_id)
get all reference ids of object
static _hasParticipated($a_usr_id, $a_event_id)
static getInstance($a_ref_id)
Get instance by ref_id.
foreach($_POST as $key=> $value) $res
static _deleteByUser($a_usr_id)
isContact($a_usr_id)
Check if user is contact.
static _register($a_usr_id, $a_event_id)
static _deleteByEvent($a_event_id)
setNotificationEnabled($value)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
_lookupComment($a_event_id, $a_usr_id)
hasParticipated($a_usr_id)
setParticipated($a_status)
static handleAutoFill($a_obj_id)
Trigger auto-fill from waiting list.
static deleteObject($a_obj_id)
Delete object.
updateExcusedForUser(int $a_usr_id, bool $a_status)
Update excused status.
__construct($a_event_id)
Constructor.
static _updateParticipation($a_usr_id, $a_event_id, $a_status)