ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilWaitingListTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 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  protected $waiting_list = null;
38  protected $wait = array();
39 
47  public function __construct($a_parent_obj,$waiting_list,$show_content = true)
48  {
49  global $lng,$ilCtrl;
50 
51  $this->lng = $lng;
52  $this->lng->loadLanguageModule('grp');
53  $this->lng->loadLanguageModule('crs');
54  $this->ctrl = $ilCtrl;
55 
56  parent::__construct($a_parent_obj,'members');
57 
58  $this->setFormName('waiting');
59  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj,'members'));
60 
61  $this->addColumn('','f',"1");
62  $this->addColumn($this->lng->txt('lastname'),'name','20%');
63  $this->addColumn($this->lng->txt('login'),'login','10%');
64  $this->addColumn($this->lng->txt('application_date'),'sub_time',"60%");
65  $this->addColumn('','mail','10%');
66 
67  $this->addMultiCommand('assignFromWaitingList',$this->lng->txt('assign'));
68  $this->addMultiCommand('refuseFromList',$this->lng->txt('refuse'));
69  $this->addMultiCommand('sendMailToSelectedUsers',$this->lng->txt('crs_mem_send_mail'));
70 
71  $this->setPrefix('waiting');
72  $this->setSelectAllCheckbox('waiting');
73  $this->setRowTemplate("tpl.show_waiting_list_row.html","Services/Membership");
74 
75  if($show_content)
76  {
77  $this->enable('sort');
78  $this->enable('header');
79  $this->enable('numinfo');
80  $this->enable('select_all');
81  }
82  else
83  {
84  $this->disable('content');
85  $this->disable('header');
86  $this->disable('footer');
87  $this->disable('numinfo');
88  $this->disable('select_all');
89  }
90 
91  $this->waiting_list = $waiting_list;
92  }
93 
101  public function setUsers($a_sub)
102  {
103  $this->wait = $a_sub;
104  $this->readUserData();
105  }
106 
114  public function fillRow($a_set)
115  {
116  global $ilUser;
117 
118  include_once('./Services/Calendar/classes/class.ilDateTime.php');
119  include_once './Modules/Course/classes/class.ilObjCourseGrouping.php';
120 
121  if(!ilObjCourseGrouping::_checkGroupingDependencies($this->getParentObject()->object,$a_set['id']) and
123  {
124  $prefix = $this->getParentObject()->object->getType();
125  $this->tpl->setVariable('ALERT_MSG',
126  sprintf($this->lng->txt($prefix.'_lim_assigned'),
127  ilObject::_lookupTitle(current($ids))
128  ));
129 
130  }
131 
132  $this->tpl->setVariable('VAL_ID',$a_set['id']);
133  $this->tpl->setVariable('VAL_NAME',$a_set['name']);
134  $this->tpl->setVariable('VAL_SUBTIME',ilDatePresentation::formatDate(new ilDateTime($a_set['sub_time'],IL_CAL_UNIX)));
135  $this->tpl->setVariable('VAL_LOGIN',$a_set['login']);
136 
137  $this->ctrl->setParameterByClass(get_class($this->getParentObject()),'member_id',$a_set['id']);
138  $link = $this->ctrl->getLinkTargetByClass(get_class($this->getParentObject()),'sendMailToSelectedUsers');
139  $this->tpl->setVariable('MAIL_LINK',$link);
140  $this->tpl->setVariable('MAIL_TITLE',$this->lng->txt('crs_mem_send_mail'));
141  }
142 
150  public function readUserData()
151  {
152  foreach($this->wait as $usr_id => $usr_data)
153  {
154  $tmp_arr['id'] = $usr_id;
155  $tmp_arr['sub_time'] = $usr_data['time'];
156 
158  $tmp_arr['name'] = $name['lastname'].', '.$name['firstname'];
159  $tmp_arr['login'] = ''.ilObjUser::_lookupLogin($usr_id).'';
160 
161  $wait[] = $tmp_arr;
162  }
163  $this->setData($wait ? $wait: array());
164  }
165 
166 }
167 ?>