35 protected \ilObjExercise
$exc;
39 protected \ilLanguage
$lng;
52 $this->exc_id = $this->exc->
getId();
65 public function canBeActivated(): bool
69 if ($ass->getPeerReview() || $ass->getAssignmentType()->usesTeams()) {
73 return !$this->hasAnySubmission();
81 public function getDeniedActivationReasons(): array
85 $has_peer_reviews =
false;
89 if ($ass->getPeerReview()) {
90 $has_peer_reviews =
true;
92 if ($ass->getAssignmentType()->usesTeams()) {
97 if ($this->hasAnySubmission()) {
100 if ($has_peer_reviews) {
112 return !$this->hasAnySubmission();
124 if ($this->hasAnySubmission()) {
143 return $this->exc->getNrMandatoryRandom();
146 protected function hasAnySubmission(): bool
150 if ($this->submission_repo->hasSubmissions($ass->getId())) {
163 $ass_of_user = $this->rand_ass_repo->getAssignmentsOfUser($this->
user->getId(), $this->exc_id);
164 if (count($ass_of_user) == 0) {
179 return $this->rand_ass_repo->getAssignmentsOfUser(
$user_id, $this->exc_id);
187 $this->rand_ass_repo->saveAssignmentsOfUser(
188 $this->
user->getId(),
190 $this->getAssignmentSelection()
202 $ass_ids = array_map(
function ($i) {
208 $j = rand(0, count($ass_ids) - 1);
209 $selected[] = current(array_splice($ass_ids, $j, 1));
Stores info about random assignments for users in exercises.
Manages random mandatory assignments of an exercise (business logic)
getTotalNumberOfAssignments()
isAssignmentVisible(int $ass_id, int $user_id)
Is assignment visible for user.
Submission SubmissionRepositoryInterface $submission_repo
getMandatoryAssignmentsOfUser(int $user_id)
Get mandatory assignments of user.
const DENIED_PEER_REVIEWS
needsStart()
Needs current user to start the exercise (by selecting the random assignments)?
const DENIED_TEAM_ASSIGNMENTS
getNumberOfMandatoryAssignments()
__construct(\ilObjExercise $exc, RandomAssignmentsDBRepository $rand_ass_repo, Submission\SubmissionRepositoryInterface $submission_repo, ?\ilObjUser $user=null, ?\ilLanguage $lng=null)
getDeniedDeactivationReasons()
Get reasons for denied deactivation.
RandomAssignmentsDBRepository $rand_ass_repo
getAssignmentSelection()
Get random assignment selection.
static getInstancesByExercise(int $a_exc_id)
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Submission repository Interface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))