ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilExcMandatoryAssignmentManager.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
13{
17 protected $exc;
18
22 protected $exc_id;
23
27 protected $user;
28
33
38 {
39 $this->exc = $exc;
40 $this->exc_id = $this->exc->getId();
41 $this->rand_ass_manager = $rand_ass_manager;
42 $this->assignments = ilExAssignment::getInstancesByExercise($exc->getId());
43
44 $this->set_to_mandatory_assignments = array_filter($this->assignments, function ($i) {
46 if ($i->getMandatory()) {
47 return true;
48 }
49 return false;
50 });
51 }
52
59 public function getMandatoryAssignmentsOfUser(int $user_id)
60 {
61 if ($this->rand_ass_manager->isActivated()) {
62 return $this->rand_ass_manager->getMandatoryAssignmentsOfUser($user_id);
63 }
64 $r = array_map(function ($i) {
66 return $i->getId();
67 }, $this->set_to_mandatory_assignments);
68 return $r;
69 }
70
78 public function isMandatoryForUser(int $ass_id, int $user_id)
79 {
80 return (in_array($ass_id, $this->getMandatoryAssignmentsOfUser($user_id)));
81 }
82}
An exception for terminatinating execution or to throw for unit testing.
static getInstancesByExercise($a_exc_id)
Manages random mandatory assignments of an exercise.
isMandatoryForUser(int $ass_id, int $user_id)
Is assignment mandatory for a user?
Manages random mandatory assignments of an exercise.
Class ilObjExercise.
$i
Definition: metadata.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc