ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilExAssignmentTeamTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
11{
15 protected $access;
16
17 protected $mode; // [int]
18 protected $team; // [ilExAssignmentTeam]
19 protected $read_only; // [bool]
20 protected $parent_ref_id; // [int]
21
26
27 const MODE_ADD = 1;
28 const MODE_EDIT = 2;
29
42 public function __construct($a_parent_obj, $a_parent_cmd, $a_mode, $a_parent_ref_id, ilExAssignmentTeam $a_team, $a_read_only = false)
43 {
44 global $DIC;
45
46 $this->ctrl = $DIC->ctrl();
47 $this->access = $DIC->access();
48 $ilCtrl = $DIC->ctrl();
49
51 $user = $DIC->user();
52 $this->edit_permission = (bool) $access->checkAccessOfUser($user->getId(), "edit", "", $a_parent_ref_id);
53
54 $this->mode = $a_mode;
55 $this->team = $a_team;
56 $this->read_only = (bool) $a_read_only;
57 $this->parent_ref_id = $a_parent_ref_id;
58
59 parent::__construct($a_parent_obj, $a_parent_cmd);
60
61 if (!$this->read_only) {
62 $this->addColumn("", "", 1);
63 }
64 $this->addColumn($this->lng->txt("name"), "name");
65
66 $this->setDefaultOrderField("name");
67
68 $this->setRowTemplate("tpl.exc_team_member_row.html", "Modules/Exercise");
69 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
70
71 if (!$this->read_only) {
72 if ($this->mode == self::MODE_ADD) {
73 $this->setTitle($this->lng->txt("exc_team_member_container_add"));
74 $this->addMultiCommand("addTeamMemberContainerAction", $this->lng->txt("add"));
75 } else {
76 $this->setTitle($this->lng->txt("exc_team_members"));
77 $this->addMultiCommand("confirmRemoveTeamMember", $this->lng->txt("remove"));
78 }
79 }
80
81 $this->getItems();
82 }
83
87 protected function getItems()
88 {
89 if ($this->mode == self::MODE_ADD) {
90 $assigned = $this->team->getMembersOfAllTeams();
91 } else {
92 $assigned = array();
93 $this->member_ids = $this->team->getMembers();
94 }
95
96 $data = array();
97 foreach ($this->member_ids as $id) {
98 if (!in_array($id, $assigned)) {
99 $data[] = array("id" => $id,
100 "name" => ilUserUtil::getNamePresentation($id, false, false, "", $this->edit_permission));
101 }
102 }
103
104 $this->setData($data);
105 }
106
112 protected function fillRow($a_set)
113 {
114 $ilAccess = $this->access;
115
116 if (!$this->read_only) {
117 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
118 }
119 $this->tpl->setVariable("TXT_NAME", $a_set["name"]);
120
121 // #18327
122 if (!$ilAccess->checkAccessOfUser($a_set["id"], "read", "", $this->parent_ref_id) &&
123 is_array($info = $ilAccess->getInfo())) {
124 $this->tpl->setCurrentBlock('access_warning');
125 $this->tpl->setVariable('PARENT_ACCESS', $info[0]["text"]);
126 $this->tpl->parseCurrentBlock();
127 }
128 }
129}
An exception for terminatinating execution or to throw for unit testing.
List all team members of an assignment.
__construct($a_parent_obj, $a_parent_cmd, $a_mode, $a_parent_ref_id, ilExAssignmentTeam $a_team, $a_read_only=false)
Constructor.
Exercise assignment team.
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc