31 protected \ILIAS\Exercise\InternalGUIService
$gui;
32 protected \ILIAS\Exercise\InternalDomainService
$domain;
56 $this->
toolbar = $DIC->toolbar();
57 $this->
user = $DIC->user();
58 $ilCtrl =
$DIC->ctrl();
59 $ilTabs =
$DIC->tabs();
63 $this->exercise = $a_exercise;
64 $this->submission = $a_submission;
68 $this->
ctrl = $ilCtrl;
69 $this->tabs_gui = $ilTabs;
73 $this->request =
$DIC->exercise()->internal()->gui()->request();
74 $this->requested_team_ids = $this->request->getTeamIds();
75 $this->domain =
$DIC->exercise()->internal()->domain();
76 $this->gui =
$DIC->exercise()->internal()->gui();
87 $cmd = $ilCtrl->getCmd(
"submissionScreenTeam");
89 if (!$this->assignment->hasTeam() ||
90 !$this->submission->canView()) {
93 $this->team = $this->submission->getTeam();
95 if (!$this->submission->isTutor()) {
97 $this->tabs_gui->activateTab(
"team");
101 case 'ilrepositorysearchgui':
102 $this->
ctrl->setReturn($this,
'submissionScreenTeam');
104 if (!$this->submission->isTutor()) {
107 $rep_search->setTitle($this->
lng->txt(
"exc_team_member_add"));
108 $rep_search->setCallback($this,
'addTeamMemberActionObject');
109 $this->
ctrl->forwardCommand($rep_search);
113 $this->{$cmd .
"Object"}();
125 $ilCtrl =
$DIC->ctrl();
126 $gui =
$DIC->exercise()->internal()->gui();
134 $team_members = $a_submission->
getTeam()->getMembers();
135 if ($team_members !== []) {
137 foreach ($team_members as $member_id) {
149 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionTeamGUI"),
"confirmDeleteTeam")
151 $team .=
" " . $link->render();
155 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionTeamGUI"),
"submissionScreenTeam")
160 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionTeamGUI"),
"submissionScreenTeamLog")
163 $team .=
"<br><br>" . $link->render();
168 if (!$state->hasSubmissionEnded()) {
170 $team_info =
$lng->
txt(
"exc_no_team_yet_notice");
172 $team_info =
'<span class="warning">' .
$lng->
txt(
"exc_no_team_yet_notice") .
'</span>';
176 $button =
$gui->button(
178 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionTeamGUI"),
"createTeam")
181 $team_info .=
" " . $button->render();
183 $team_info .=
'<div class="ilFormInfo">' .
$lng->
txt(
"exc_no_team_yet_info") .
'</div>';
185 $team_info .=
'<div class="ilFormInfo">' .
$lng->
txt(
"exc_no_team_yet_info_tutor") .
'</div>';
188 $team_info =
'<span class="warning">' .
$lng->
txt(
"exc_create_team_times_up_warning") .
'</span>';
197 $submission = $this->submission;
198 $f = $this->gui->ui()->factory();
199 $ilCtrl = $this->ctrl;
206 $state = $this->domain->assignment()->state($submission->
getAssignment()->getId(), $submission->
getUserId());
208 $team_members = $submission->
getTeam()->getMembers();
209 if ($team_members !== []) {
211 foreach ($team_members as $member_id) {
215 $team = implode(
"; ", $team);
221 $button =
$f->button()->standard(
222 $this->
lng->txt(
"exc_delete_team"),
223 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionTeamGUI"),
"confirmDeleteTeam")
230 $button =
$f->button()->standard(
231 $this->
lng->txt(
"exc_manage_team"),
232 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionTeamGUI"),
"submissionScreenTeam")
239 $button =
$f->button()->standard(
240 $this->
lng->txt(
"exc_team_log"),
241 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionTeamGUI"),
"submissionScreenTeamLog")
248 $builder->addProperty(
250 $lng->txt(
"exc_team_members"),
255 if (!$state->hasSubmissionEnded()) {
257 $team_info = $this->
lng->txt(
"exc_no_team_yet_notice");
259 $team_info =
'<span class="warning">' . $this->
lng->txt(
"exc_no_team_yet_notice") .
'</span>';
263 $button =
$f->button()->primary(
264 $this->
lng->txt(
"exc_create_team"),
265 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionTeamGUI"),
"createTeam")
267 $builder->setMainAction(
271 $team_info .=
'<div class="ilFormInfo">' .
$lng->txt(
"exc_no_team_yet_info") .
'</div>';
273 $team_info .=
'<div class="ilFormInfo">' .
$lng->txt(
"exc_no_team_yet_info_tutor") .
'</div>';
276 $team_info =
$lng->txt(
"exc_create_team_times_up_warning");
279 $builder->addProperty(
281 $lng->txt(
"exc_team_members"),
289 $this->
ctrl->returnToParent($this);
296 $ilTabs =
$DIC->tabs();
297 $ilCtrl =
$DIC->ctrl();
302 $lng->txt(
"exc_team"),
303 $ilCtrl->getLinkTargetByClass(
"ilExSubmissionTeamGUI",
"submissionScreenTeam")
308 $lng->txt(
"exc_team_log"),
309 $ilCtrl->getLinkTargetByClass(
"ilExSubmissionTeamGUI",
"submissionScreenTeamLog")
315 return (($this->submission->canSubmit() &&
316 !$this->submission->getAssignment()->getTeamTutor()) ||
317 $this->submission->isTutor());
325 $ilToolbar = $this->toolbar;
328 $read_only = !$this->canEditTeam();
330 if ($this->submission->getAssignment()->afterDeadlineStrict(
false)) {
331 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"));
332 } elseif (!$read_only) {
333 $add_search = $this->submission->isTutor();
339 'auto_complete_name' => $this->
lng->txt(
'user'),
340 'submit_name' => $this->lng->txt(
'add'),
341 'add_search' => $add_search,
342 'add_from_container' => $this->exercise->getRefId()
345 } elseif ($this->submission->getAssignment()->getTeamTutor()) {
346 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exc_no_team_yet_info_tutor"));
351 "submissionScreenTeam",
353 $this->exercise->getRefId(),
358 $this->tpl->setContent($tbl->getHTML());
365 array $a_user_ids = array()
367 if (!$this->canEditTeam()) {
368 $this->
ctrl->redirect($this,
"submissionScreenTeam");
371 if ($a_user_ids === []) {
372 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"));
379 if ($this->team->addTeamMember(
$user_id, $this->exercise->getRefId())) {
383 if (!$this->exercise->members_obj->isAssigned(
$user_id)) {
384 $this->exercise->members_obj->assignMember(
$user_id);
388 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exc_members_already_assigned_team"),
true);
392 if ($new_users !== []) {
394 $this->exercise->processExerciseStatus(
396 $this->team->getMembers(),
397 $this->submission->hasSubmitted(),
398 $this->submission->validatePeerReviews()
401 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
404 $this->
ctrl->redirect($this,
"submissionScreenTeam");
412 $this->confirmRemoveTeamMemberObject(
true);
419 bool $a_full_delete =
false
421 $ilUser = $this->
user;
424 if (!$this->submission->isTutor()) {
425 $ids = $a_full_delete ? $this->team->getMembers() : $this->requested_team_ids;
429 $this->
ctrl->redirect($this,
"submissionScreenTeam");
432 $ids = $this->requested_team_ids;
434 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"select_one"),
true);
435 $this->returnToParentObject();
439 $members = $this->team->getMembers();
440 if (count($members) <= count($ids)) {
441 if (count($members) == 1 && $members[0] == $ilUser->getId()) {
443 $this->removeTeamMemberObject($a_full_delete);
446 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exc_team_at_least_one"),
true);
447 $this->
ctrl->redirect($this,
"submissionScreenTeam");
452 $cgui->setFormAction($this->
ctrl->getFormAction($this));
453 $cgui->setHeaderText($this->
lng->txt(
"exc_team_member_remove_sure"));
454 $cgui->setConfirm($this->
lng->txt(
"remove"),
"removeTeamMember");
455 $cgui->setCancel($this->
lng->txt(
"cancel"), $this->submission->isTutor()
457 :
"submissionScreenTeam");
459 $subs = $this->domain->submission($this->assignment->getId())
460 ->getSubmissionsOfUser($this->submission->getUserId());
462 foreach ($ids as
$id) {
464 foreach ($subs as $sub) {
465 if ($sub->getUserId() ===
$id) {
466 $details[] = $sub->getTitle();
470 if ($details !== []) {
471 $uname .=
": " . implode(
", ", $details);
473 $cgui->addItem(
"id[]",
$id, $uname);
483 bool $a_full_delete =
false
485 $ilUser = $this->
user;
487 $cancel_cmd = $this->submission->isTutor()
489 :
"submissionScreenTeam";
492 if ($a_full_delete) {
493 $ids = $this->team->getMembers();
495 $ids = $this->requested_team_ids;
497 $ids = array_filter(array_map(
'intval', $ids));
499 if ([] === $ids && !$this->canEditTeam()) {
500 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"select_one"),
true);
501 $this->
ctrl->redirect($this, $cancel_cmd);
504 $team_deleted = $a_full_delete;
505 if (!$team_deleted) {
506 $members = $this->team->getMembers();
507 if (count($members) <= count($ids)) {
508 if (count($members) == 1 && $members[0] == $ilUser->getId()) {
509 $team_deleted =
true;
511 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exc_team_at_least_one"),
true);
512 $this->
ctrl->redirect($this, $cancel_cmd);
518 $this->team->removeTeamMember(
$user_id, $this->exercise->getRefId());
522 $this->exercise->processExerciseStatus(
528 if (!$team_deleted) {
530 $this->exercise->processExerciseStatus(
532 $this->team->getMembers(),
533 $this->submission->hasSubmitted(),
534 $this->submission->validatePeerReviews()
538 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
539 if (!$team_deleted) {
540 $this->
ctrl->redirect($this, $cancel_cmd);
542 $this->
ctrl->redirect($this,
"returnToParent");
548 $this->tabs_gui->activateTab(
"log");
552 "submissionScreenTeamLog",
556 $this->tpl->setContent($tbl->getHTML());
562 $this->assignment->getId(),
563 $this->submission->getUserId(),
566 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
567 $this->returnToParentObject();
573 $this->tpl->setContent($tbl->getHTML());
583 $ilUser = $this->user;
586 $form->setTitle(
$lng->txt(
"exc_team_assignment_adopt_user"));
587 $form->setFormAction($ctrl->
getFormAction($this,
"createAdoptedTeam"));
590 $teams->setValue(-1);
592 $teams->addOption(
new ilRadioOption(
$lng->txt(
"exc_team_assignment_adopt_none_user"), -1));
597 foreach ($options as
$id => $item) {
600 foreach ($item[
"user_team"] as
$user_id) {
603 if (array_key_exists(
$user_id, $current_map)) {
604 $members[
$user_id] .=
" (" .
$lng->txt(
"exc_team_assignment_adopt_already_assigned") .
")";
610 $members = implode(
"<br />", $members);
612 $option->setInfo($members);
614 $option->setDisabled(
true);
616 $teams->addOption($option);
619 $form->addItem($teams);
621 $form->addCommandButton(
"createAdoptedTeam",
$lng->txt(
"save"));
622 $form->addCommandButton(
"returnToParent",
$lng->txt(
"cancel"));
629 $ilCtrl = $this->ctrl;
630 $ilUser = $this->user;
633 if ($this->submission->canSubmit()) {
635 if ($options !== []) {
636 $form = $this->getAdoptForm();
644 if (!$this->exercise->members_obj->isAssigned($ilUser->getId())) {
645 $this->exercise->members_obj->assignMember($ilUser->getId());
648 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
651 $ilCtrl->redirect($this,
"returnToParent");
659 $ilCtrl = $this->ctrl;
660 $ilUser = $this->user;
663 $form = $this->getAdoptForm();
665 if ($this->submission->canSubmit()) {
666 $src_ass_id = $form->getInput(
"ass_adpt");
667 if ($src_ass_id > 0) {
673 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"settings_saved"),
true);
676 $ilCtrl->redirect($this,
"returnToParent");
685 $user_login = $this->request->getUserLogin();
686 if ($user_login ==
"") {
687 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_no_search_string'));
688 $this->submissionScreenTeamObject();
692 $users = explode(
',', $user_login);
695 foreach ($users as $user) {
699 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'user_not_known'));
700 $this->submissionScreenTeamObject();
707 $this->addTeamMemberActionObject($user_ids);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Exercise gui request wrapper.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
getFormAction(object $a_gui_obj, ?string $a_fallback_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
getNextClass($a_gui_class=null)
@inheritDoc
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAssignmentTeamMap(int $a_ass_id)
static adoptTeams(int $a_source_ass_id, int $a_target_ass_id, ?int $a_user_id=null, ?int $a_exc_ref_id=null)
static getAdoptableTeamAssignments(int $a_exercise_id, ?int $a_exclude_ass_id=null, ?int $a_user_id=null)
static getTeamId(int $a_assignment_id, int $a_user_id, bool $a_create_on_demand=false)
createAdoptedTeamObject()
array $requested_team_ids
ilGlobalTemplateInterface $tpl
submissionScreenTeamLogObject()
getAdoptForm()
Get Adopt form.
buildSubmissionPropertiesAndActions(\ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI $builder)
confirmDeleteTeamObject()
removeTeamMemberObject(bool $a_full_delete=false)
addTeamMemberActionObject(array $a_user_ids=array())
confirmRemoveTeamMemberObject(bool $a_full_delete=false)
ILIAS Exercise InternalGUIService $gui
submissionScreenTeamObject()
Displays a form which allows members to manage team uploads.
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
addUserFromAutoCompleteObject()
Add user as member.
createSingleMemberTeamObject()
ilExAssignment $assignment
ILIAS Exercise InternalDomainService $domain
ilExSubmission $submission
Exercise submission //TODO: This class has many static methods related to delivered "files".
getLastSubmission()
TODO -> get rid of getTableUserWhere and move to repository class Get the date of the last submission...
static getInstanceByIds(int $a_ass_id, int $a_user_id=0)
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
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...
static _lookupId(string|array $a_user_str)
This class represents an option in a radio group.
static fillAutoCompleteToolbar(object $parent_object, ?ilToolbarGUI $toolbar=null, array $a_options=[], bool $a_sticky=false)
array( auto_complete_name = $lng->txt('user'), auto_complete_size = 15, user_type = array(ilCoursePar...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const PRIVACY_MODE_RESPECT_USER_SETTING
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setContent(string $a_html)
Sets content for standard template.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
if(!file_exists('../ilias.ini.php'))