ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSubscriberTableGUI.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 $participants = null;
38  protected $subscribers = array();
39 
47  public function __construct($a_parent_obj,$participants,$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('subscribers');
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',"15%");
65  $this->addColumn($this->lng->txt('subject'),'subject','45%');
66  $this->addColumn('','mail','10%');
67 
68  $this->addMultiCommand('assignSubscribers',$this->lng->txt('assign'));
69  $this->addMultiCommand('refuseSubscribers',$this->lng->txt('refuse'));
70  $this->addMultiCommand('sendMailToSelectedUsers',$this->lng->txt('crs_mem_send_mail'));
71 
72 
73  $this->setPrefix('subscribers');
74  $this->setSelectAllCheckbox('subscribers');
75  $this->setRowTemplate("tpl.show_subscribers_row.html","Services/Membership");
76 
77  if($show_content)
78  {
79  $this->enable('sort');
80  $this->enable('header');
81  $this->enable('numinfo');
82  $this->enable('select_all');
83  }
84  else
85  {
86  $this->disable('content');
87  $this->disable('header');
88  $this->disable('footer');
89  $this->disable('numinfo');
90  $this->disable('select_all');
91  }
92 
93  $this->participants = $participants;
94  }
95 
103  public function setSubscribers($a_sub)
104  {
105  $this->subscribers = $a_sub;
106  $this->readSubscriberData();
107  }
108 
116  public function fillRow($a_set)
117  {
118  global $ilUser;
119 
120 
121  include_once './Modules/Course/classes/class.ilObjCourseGrouping.php';
122  if(!ilObjCourseGrouping::_checkGroupingDependencies($this->getParentObject()->object,$a_set['id']) and
124  {
125  $prefix = $this->getParentObject()->object->getType();
126  $this->tpl->setVariable('ALERT_MSG',
127  sprintf($this->lng->txt($prefix.'_lim_assigned'),
128  ilObject::_lookupTitle(current($ids))
129  ));
130 
131  }
132 
133  $this->tpl->setVariable('VAL_ID',$a_set['id']);
134  $this->tpl->setVariable('VAL_NAME',$a_set['name']);
135  $this->tpl->setVariable('VAL_SUBTIME',ilDatePresentation::formatDate(new ilDateTime($a_set['sub_time'],IL_CAL_UNIX)));
136  $this->tpl->setVariable('VAL_LOGIN',$a_set['login']);
137 
138  $this->ctrl->setParameterByClass(get_class($this->getParentObject()),'member_id',$a_set['id']);
139  $link = $this->ctrl->getLinkTargetByClass(get_class($this->getParentObject()),'sendMailToSelectedUsers');
140  $this->tpl->setVariable('MAIL_LINK',$link);
141  $this->tpl->setVariable('MAIL_TITLE',$this->lng->txt('crs_mem_send_mail'));
142 
143 
144  if(strlen($a_set['subject']))
145  {
146  $this->tpl->setVariable('VAL_SUBJECT','"'.$a_set['subject'].'"');
147 
148  }
149  }
150 
158  public function readSubscriberData()
159  {
160  foreach($this->subscribers as $usr_id)
161  {
162 
163  $data = $this->participants->getSubscriberData($usr_id);
164 
165  $tmp_arr['id'] = $usr_id;
166  $tmp_arr['sub_time'] = $data['time'];
167  $tmp_arr['subject'] = $data['subject'];
168 
169  $name = ilObjUser::_lookupName($usr_id);
170  $tmp_arr['name'] = $name['lastname'].', '.$name['firstname'];
171  $tmp_arr['login'] = ''.ilObjUser::_lookupLogin($usr_id).'';
172 
173  $subscribers[] = $tmp_arr;
174  }
175  $this->setData($subscribers ? $subscribers : array());
176  }
177 
178 }
179 ?>