ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 {
14  protected $mode; // [int]
15  protected $team; // [ilExAssignmentTeam]
16  protected $read_only; // [bool]
17  protected $parent_ref_id; // [int]
18 
19  const MODE_ADD = 1;
20  const MODE_EDIT = 2;
21 
34  public function __construct($a_parent_obj, $a_parent_cmd, $a_mode, $a_parent_ref_id, ilExAssignmentTeam $a_team, $a_read_only = false)
35  {
36  global $ilCtrl;
37 
38  $this->mode = $a_mode;
39  $this->team = $a_team;
40  $this->read_only = (bool)$a_read_only;
41  $this->parent_ref_id = $a_parent_ref_id;
42 
43  parent::__construct($a_parent_obj, $a_parent_cmd);
44 
45  if(!$this->read_only)
46  {
47  $this->addColumn("", "", 1);
48  }
49  $this->addColumn($this->lng->txt("name"), "name");
50 
51  $this->setDefaultOrderField("name");
52 
53  $this->setRowTemplate("tpl.exc_team_member_row.html", "Modules/Exercise");
54  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
55 
56  if(!$this->read_only)
57  {
58  if($this->mode == self::MODE_ADD)
59  {
60  $this->setTitle($this->lng->txt("exc_team_member_container_add"));
61  $this->addMultiCommand("addTeamMemberContainerAction", $this->lng->txt("add"));
62  }
63  else
64  {
65  $this->setTitle($this->lng->txt("exc_team_members"));
66  $this->addMultiCommand("confirmRemoveTeamMember", $this->lng->txt("remove"));
67  }
68  }
69 
70  $this->getItems();
71  }
72 
76  protected function getItems()
77  {
78  if($this->mode == self::MODE_ADD)
79  {
80  $assigned = $this->team->getMembersOfAllTeams();
81  }
82  else
83  {
84  $assigned = array();
85  $this->member_ids = $this->team->getMembers();
86  }
87 
88  include_once "Services/User/classes/class.ilUserUtil.php";
89 
90  $data = array();
91  foreach($this->member_ids as $id)
92  {
93  if(!in_array($id, $assigned))
94  {
95  $data[] = array("id" => $id,
96  "name" => ilUserUtil::getNamePresentation($id, false, false, "", true));
97  }
98  }
99 
100  $this->setData($data);
101  }
102 
108  protected function fillRow($a_set)
109  {
110  global $ilAccess;
111 
112  if(!$this->read_only)
113  {
114  $this->tpl->setVariable("VAL_ID", $a_set["id"]);
115  }
116  $this->tpl->setVariable("TXT_NAME", $a_set["name"]);
117 
118  // #18327
119  if(!$ilAccess->checkAccessOfUser($a_set["id"], "read","", $this->parent_ref_id) &&
120  is_array($info = $ilAccess->getInfo()))
121  {
122  $this->tpl->setCurrentBlock('access_warning');
123  $this->tpl->setVariable('PARENT_ACCESS', $info[0]["text"]);
124  $this->tpl->parseCurrentBlock();
125  }
126  }
127 }
128 
129 ?>
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
$info
Definition: example_052.php:80
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)
Default behaviour is:
Class ilTable2GUI.
List all team members of an assignment.
addMultiCommand($a_cmd, $a_text)
Add Command button.
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.