ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMilestoneResponsiblesTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2008 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("Services/Table/classes/class.ilTable2GUI.php");
25 
26 
36 {
37 
38  function ilMilestoneResponsiblesTableGUI($a_parent_obj, $a_parent_cmd = "",
39  $a_grp_id, $a_app_id)
40  {
41  global $ilCtrl, $lng;
42 
43  parent::__construct($a_parent_obj, $a_parent_cmd);
44 
45  $this->grp_id = $a_grp_id;
46  $this->app_id = $a_app_id;
47 
48  $this->addColumn("", "", "1");
49  $this->addColumn($lng->txt("user"), "", "100%");
50  $this->setRowTemplate("tpl.ms_responsible_users_row.html",
51  "Services/Calendar");
52  $this->setEnableHeader(true);
53  $this->setDefaultOrderField("lastname");
54  $this->setMaxCount(9999);
55  $ilCtrl->setParameter($a_parent_obj, "app_id", $this->app_id);
56  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
58  $this->setTitle($lng->txt("cal_ms_users_responsible"));
59  $this->addMultiCommand(
60  "saveMilestoneResponsibleUsers", $lng->txt("cal_save_responsible_users"));
61  }
62 
67  {
68  $participants = array();
69  if ($this->app_id > 0)
70  {
71  include_once("./Services/Calendar/classes/class.ilCalendarEntry.php");
72  $app = new ilCalendarEntry($this->app_id);
73  $resp_users = $app->readResponsibleUsers();
74  foreach($resp_users as $v)
75  {
76  $n = ilObjUser::_lookupName($v["user_id"]);
77  $participants[$v["user_id"]] = array_merge($n, array("type" => "non-member"));
78  $this->resp_users[] = $v["user_id"];
79  }
80  }
81 
82  include_once('./Modules/Group/classes/class.ilGroupParticipants.php');
83  $part = ilGroupParticipants::_getInstanceByObjId($this->grp_id);
84  $admins = $part->getAdmins();
85  $members = $part->getMembers();
86  foreach($members as $v)
87  {
89  $participants[$v] = array_merge($n, array("type" => "member"));
90  }
91  foreach($admins as $v)
92  {
94  $participants[$v] = array_merge($n, array("type" => "admin"));
95  }
96  $this->setData($participants);
97  }
98 
103  protected function fillRow($a_set)
104  {
105  global $lng, $ilCtrl;
106 
107  if (is_array($this->resp_users) && in_array($a_set["user_id"], $this->resp_users))
108  {
109  $this->tpl->setVariable("CHECKED", ' checked="checked" ');
110  }
111  $this->tpl->setVariable("USER_ID", $a_set["user_id"]);
112  $this->tpl->setVariable("TXT_FIRSTNAME", $a_set["firstname"]);
113  $this->tpl->setVariable("TXT_LASTNAME", $a_set["lastname"]);
114  $this->tpl->setVariable("TXT_LOGIN", ilObjUser::_lookupLogin($a_set["user_id"]));
115  }
116 
117 }
118 ?>