ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
4 include_once './Services/Table/classes/class.ilTable2GUI.php';
5 
13 {
17  protected $access;
18 
19  protected $mode; // [int]
20  protected $team; // [ilExAssignmentTeam]
21  protected $read_only; // [bool]
22  protected $parent_ref_id; // [int]
23 
27  protected $edit_permission;
28 
29  const MODE_ADD = 1;
30  const MODE_EDIT = 2;
31 
44  public function __construct($a_parent_obj, $a_parent_cmd, $a_mode, $a_parent_ref_id, ilExAssignmentTeam $a_team, $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 = (bool) $access->checkAccessOfUser($user->getId(), "edit", "", $a_parent_ref_id);
55 
56  $this->mode = $a_mode;
57  $this->team = $a_team;
58  $this->read_only = (bool) $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", "Modules/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 
89  protected function getItems()
90  {
91  if ($this->mode == self::MODE_ADD) {
92  $assigned = $this->team->getMembersOfAllTeams();
93  } else {
94  $assigned = array();
95  $this->member_ids = $this->team->getMembers();
96  }
97 
98  include_once "Services/User/classes/class.ilUserUtil.php";
99 
100  $data = array();
101  foreach ($this->member_ids as $id) {
102  if (!in_array($id, $assigned)) {
103  $data[] = array("id" => $id,
104  "name" => ilUserUtil::getNamePresentation($id, false, false, "", $this->edit_permission));
105  }
106  }
107 
108  $this->setData($data);
109  }
110 
116  protected function fillRow($a_set)
117  {
118  $ilAccess = $this->access;
119 
120  if (!$this->read_only) {
121  $this->tpl->setVariable("VAL_ID", $a_set["id"]);
122  }
123  $this->tpl->setVariable("TXT_NAME", $a_set["name"]);
124 
125  // #18327
126  if (!$ilAccess->checkAccessOfUser($a_set["id"], "read", "", $this->parent_ref_id) &&
127  is_array($info = $ilAccess->getInfo())) {
128  $this->tpl->setCurrentBlock('access_warning');
129  $this->tpl->setVariable('PARENT_ACCESS', $info[0]["text"]);
130  $this->tpl->parseCurrentBlock();
131  }
132  }
133 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
Exercise assignment team.
__construct($a_parent_obj, $a_parent_cmd, $a_mode, $a_parent_ref_id, ilExAssignmentTeam $a_team, $a_read_only=false)
Constructor.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
List all team members of an assignment.
addMultiCommand($a_cmd, $a_text)
Add Command button.
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:
$user
Definition: migrateto20.php:57
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
$info
Definition: index.php:5