ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilExAssignmentTeamTableGUI.php
Go to the documentation of this file.
1<?php
2
26{
27 public const MODE_ADD = 1;
28 public const MODE_EDIT = 2;
29
31 protected int $mode;
33 protected bool $read_only;
34 protected int $parent_ref_id;
35 protected bool $edit_permission;
36 protected array $member_ids;
37
38 public function __construct(
39 object $a_parent_obj,
40 string $a_parent_cmd,
41 int $a_mode,
42 int $a_parent_ref_id,
43 ilExAssignmentTeam $a_team,
44 bool $a_read_only = false
45 ) {
46 global $DIC;
47
48 $this->ctrl = $DIC->ctrl();
49 $this->access = $DIC->access();
50 $ilCtrl = $DIC->ctrl();
51
53 $user = $DIC->user();
54 $this->edit_permission = $access->checkAccessOfUser($user->getId(), "edit", "", $a_parent_ref_id);
55
56 $this->mode = $a_mode;
57 $this->team = $a_team;
58 $this->read_only = $a_read_only;
59 $this->parent_ref_id = $a_parent_ref_id;
60
61 parent::__construct($a_parent_obj, $a_parent_cmd);
62
63 if (!$this->read_only) {
64 $this->addColumn("", "", 1);
65 }
66 $this->addColumn($this->lng->txt("name"), "name");
67
68 $this->setDefaultOrderField("name");
69
70 $this->setRowTemplate("tpl.exc_team_member_row.html", "components/ILIAS/Exercise");
71 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
72
73 if (!$this->read_only) {
74 if ($this->mode == self::MODE_ADD) {
75 $this->setTitle($this->lng->txt("exc_team_member_container_add"));
76 $this->addMultiCommand("addTeamMemberContainerAction", $this->lng->txt("add"));
77 } else {
78 $this->setTitle($this->lng->txt("exc_team_members"));
79 $this->addMultiCommand("confirmRemoveTeamMember", $this->lng->txt("remove"));
80 }
81 }
82
83 $this->getItems();
84 }
85
86 protected function getItems(): void
87 {
88 if ($this->mode == self::MODE_ADD) {
89 $assigned = $this->team->getMembersOfAllTeams();
90 } else {
91 $assigned = array();
92 $this->member_ids = $this->team->getMembers();
93 }
94
95 $data = array();
96 foreach ($this->member_ids as $id) {
97 if (!in_array($id, $assigned)) {
98 $data[] = array("id" => $id,
99 "name" => ilUserUtil::getNamePresentation($id, false, false, "", $this->edit_permission));
100 }
101 }
102
103 $this->setData($data);
104 }
105
106 protected function fillRow(array $a_set): void
107 {
108 $ilAccess = $this->access;
109
110 if (!$this->read_only) {
111 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
112 }
113 $this->tpl->setVariable("TXT_NAME", $a_set["name"]);
114
115 // #18327
116 if (!$ilAccess->checkAccessOfUser($a_set["id"], "read", "", $this->parent_ref_id) &&
117 is_array($info = $ilAccess->getInfo())) {
118 $this->tpl->setCurrentBlock('access_warning');
119 $this->tpl->setVariable('PARENT_ACCESS', $info[0]["text"]);
120 $this->tpl->parseCurrentBlock();
121 }
122 }
123}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillRow(array $a_set)
Standard Version of Fill Row.
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_mode, int $a_parent_ref_id, ilExAssignmentTeam $a_team, bool $a_read_only=false)
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...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
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:
$info
Definition: entry_point.php:21
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26