ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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
4include_once './Services/Table/classes/class.ilTable2GUI.php';
5
13{
14 protected $mode; // [int]
15 protected $team_id; // [int]
16 protected $assignment; // [ilExAssignment]
17 protected $member_ids; // [array]
18 protected $read_only; // [bool]
19
20 const MODE_ADD = 1;
21 const MODE_EDIT = 2;
22
34 public function __construct($a_parent_obj, $a_parent_cmd, $a_mode, $a_team_id, ilExAssignment $a_assignment, array $a_member_ids = null, $a_read_only = false)
35 {
36 global $ilCtrl;
37
38 $this->mode = $a_mode;
39 $this->team_id = $a_team_id;
40 $this->assignment = $a_assignment;
41 $this->member_ids = $a_member_ids;
42 $this->read_only = (bool)$a_read_only;
43
44 parent::__construct($a_parent_obj, $a_parent_cmd);
45
46 if(!$this->read_only)
47 {
48 $this->addColumn("", "", 1);
49 }
50 $this->addColumn($this->lng->txt("name"), "name");
51
52 $this->setDefaultOrderField("name");
53
54 $this->setRowTemplate("tpl.exc_team_member_row.html", "Modules/Exercise");
55 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
56
57 if(!$this->read_only)
58 {
59 if($this->mode == self::MODE_ADD)
60 {
61 $this->setTitle($this->lng->txt("exc_team_member_container_add"));
62 $this->addMultiCommand("addTeamMemberContainerAction", $this->lng->txt("add"));
63 }
64 else
65 {
66 $this->setTitle($this->lng->txt("exc_team_members"));
67 $this->addMultiCommand("confirmRemoveTeamMember", $this->lng->txt("remove"));
68 }
69 }
70
71 $this->getItems();
72 }
73
77 protected function getItems()
78 {
79 if($this->mode == self::MODE_ADD)
80 {
81 $assigned = $this->assignment->getMembersOfAllTeams();
82 }
83 else
84 {
85 $assigned = array();
86 $this->member_ids = $this->assignment->getTeamMembers($this->team_id);
87 }
88
89 include_once "Services/User/classes/class.ilUserUtil.php";
90
91 $data = array();
92 foreach($this->member_ids as $id)
93 {
94 if(!in_array($id, $assigned))
95 {
96 $data[] = array("id" => $id,
97 "name" => ilUserUtil::getNamePresentation($id, false, false, "", true));
98 }
99 }
100
101 $this->setData($data);
102 }
103
109 protected function fillRow($a_set)
110 {
111 if(!$this->read_only)
112 {
113 $this->tpl->setVariable("VAL_ID", $a_set["id"]);
114 }
115 $this->tpl->setVariable("TXT_NAME", $a_set["name"]);
116 }
117}
118
119?>
List all team members of an assignment.
__construct($a_parent_obj, $a_parent_cmd, $a_mode, $a_team_id, ilExAssignment $a_assignment, array $a_member_ids=null, $a_read_only=false)
Constructor.
Exercise assignment.
Class ilTable2GUI.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
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.
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)
Default behaviour is:
global $ilCtrl
Definition: ilias.php:18