ILIAS  Release_4_2_x_branch Revision 61807
 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 $subscribers = array();
38 
46  public function __construct($a_parent_obj,$show_content = true)
47  {
48  global $lng,$ilCtrl;
49 
50  $this->lng = $lng;
51  $this->lng->loadLanguageModule('grp');
52  $this->lng->loadLanguageModule('crs');
53  $this->ctrl = $ilCtrl;
54 
55  parent::__construct($a_parent_obj,'members');
56 
57  $this->setFormName('subscribers');
58  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj,'members'));
59 
60  $this->addColumn('','f',"1");
61  $this->addColumn($this->lng->txt('lastname'),'name','20%');
62  $this->addColumn($this->lng->txt('login'),'login','10%');
63  $this->addColumn($this->lng->txt('application_date'),'sub_time',"15%");
64  $this->addColumn($this->lng->txt('subject'),'subject','45%');
65  $this->addColumn('','mail','10%');
66 
67  $this->addMultiCommand('assignSubscribers',$this->lng->txt('assign'));
68  $this->addMultiCommand('refuseSubscribers',$this->lng->txt('refuse'));
69  $this->addMultiCommand('sendMailToSelectedUsers',$this->lng->txt('crs_mem_send_mail'));
70 
71 
72  $this->setPrefix('subscribers');
73  $this->setSelectAllCheckbox('subscribers');
74  $this->setRowTemplate("tpl.show_subscribers_row.html","Services/Membership");
75 
76  if($show_content)
77  {
78  $this->enable('sort');
79  $this->enable('header');
80  $this->enable('numinfo');
81  $this->enable('select_all');
82  }
83  else
84  {
85  $this->disable('content');
86  $this->disable('header');
87  $this->disable('footer');
88  $this->disable('numinfo');
89  $this->disable('select_all');
90  }
91  }
92 
100  public function fillRow($a_set)
101  {
102  global $ilUser;
103 
104 
105  include_once './Modules/Course/classes/class.ilObjCourseGrouping.php';
106  if(!ilObjCourseGrouping::_checkGroupingDependencies($this->getParentObject()->object,$a_set['id']) and
108  {
109  $prefix = $this->getParentObject()->object->getType();
110  $this->tpl->setVariable('ALERT_MSG',
111  sprintf($this->lng->txt($prefix.'_lim_assigned'),
112  ilObject::_lookupTitle(current($ids))
113  ));
114 
115  }
116 
117  $this->tpl->setVariable('VAL_ID',$a_set['id']);
118  $this->tpl->setVariable('VAL_NAME',$a_set['name']);
119  $this->tpl->setVariable('VAL_SUBTIME',ilDatePresentation::formatDate(new ilDateTime($a_set['sub_time'],IL_CAL_UNIX)));
120  $this->tpl->setVariable('VAL_LOGIN',$a_set['login']);
121 
122  $this->ctrl->setParameterByClass(get_class($this->getParentObject()),'member_id',$a_set['id']);
123  $link = $this->ctrl->getLinkTargetByClass(get_class($this->getParentObject()),'sendMailToSelectedUsers');
124  $this->tpl->setVariable('MAIL_LINK',$link);
125  $this->tpl->setVariable('MAIL_TITLE',$this->lng->txt('crs_mem_send_mail'));
126 
127 
128  if(strlen($a_set['subject']))
129  {
130  $this->tpl->setVariable('VAL_SUBJECT','"'.$a_set['subject'].'"');
131 
132  }
133  }
134 
142  public function readSubscriberData()
143  {
144  include_once './Services/Membership/classes/class.ilParticipants.php';
145 
146  $sub_data = ilParticipants::lookupSubscribersData($this->getParentObject()->object->getId());
147  foreach($sub_data as $usr_id => $data)
148  {
149  $tmp_arr['id'] = $usr_id;
150  $tmp_arr['sub_time'] = $data['time'];
151  $tmp_arr['subject'] = $data['subject'];
152 
154  $tmp_arr['name'] = $name['lastname'].', '.$name['firstname'];
155  $tmp_arr['login'] = ''.ilObjUser::_lookupLogin($usr_id).'';
156 
157  $subscribers[] = $tmp_arr;
158  }
159  $this->setData($subscribers ? $subscribers : array());
160  }
161 
162 }
163 ?>