ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilECSCommunityTableGUI.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 include_once('Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php');
26 
36 {
37  protected $lng;
38  protected $ctrl;
39 
40  protected $part_settings = null;
41 
49  public function __construct($a_parent_obj,$a_parent_cmd = '',$cid = 0)
50  {
51  global $lng,$ilCtrl;
52 
53  $this->lng = $lng;
54  $this->ctrl = $ilCtrl;
55 
56  parent::__construct($a_parent_obj,$a_parent_cmd);
57  $this->addColumn('','mid',1);
58  $this->addColumn($this->lng->txt('ecs_participants'),'participants',"50%");
59  $this->addColumn($this->lng->txt('ecs_participants_infos'),'infos',"48%");
60  $this->addColumn($this->lng->txt('ecs_active_header'),'active',"2%");
61  $this->disable('form');
62  $this->setRowTemplate("tpl.participant_row.html","Services/WebServices/ECS");
63  $this->setDefaultOrderField('participants');
64  $this->setDefaultOrderDirection("desc");
65 
66  $this->part_settings = ilECSParticipantSettings::_getInstance();
67  }
68 
76  public function fillRow($a_set)
77  {
78  $this->tpl->setVariable('VAL_ID',$a_set['mid']);
79  $this->tpl->setVariable('VAL_CHECKED',$a_set['checked'] ? 'checked="checked"' : '');
80  $this->tpl->setVariable('VAL_TITLE',$a_set['participants']);
81  $this->tpl->setVariable('VAL_DESC',$a_set['description']);
82  $this->tpl->setVariable('VAL_EMAIL',$a_set['email']);
83  $this->tpl->setVariable('VAL_DNS',$a_set['dns']);
84  $this->tpl->setVariable('VAL_ABR',$a_set['abr']);
85  $this->tpl->setVariable('TXT_EMAIL',$this->lng->txt('ecs_email'));
86  $this->tpl->setVariable('TXT_DNS',$this->lng->txt('ecs_dns'));
87  $this->tpl->setVariable('TXT_ABR',$this->lng->txt('ecs_abr'));
88  $this->tpl->setVariable('TXT_ID',$this->lng->txt('ecs_unique_id'));
89 
90 
91 
92  if($a_set['checked'])
93  {
94  $this->tpl->setVariable('IMAGE_OK',ilUtil::getImagePath('icon_ok.gif'));
95  $this->tpl->setVariable('TXT_OK',$this->lng->txt('ecs_active'));
96  }
97  else
98  {
99  $this->tpl->setVariable('IMAGE_OK',ilUtil::getImagePath('icon_not_ok.gif'));
100  $this->tpl->setVariable('TXT_OK',$this->lng->txt('ecs_inactive'));
101  }
102  }
103 
111  public function parse($a_participants)
112  {
113  foreach($a_participants as $participant)
114  {
115  $tmp_arr['checked'] = $this->part_settings->isEnabled($participant->getMID());
116  $tmp_arr['mid'] = $participant->getMID();
117  $tmp_arr['participants'] = $participant->getParticipantName();
118  $tmp_arr['description'] = $participant->getDescription();
119  $tmp_arr['email'] = $participant->getEmail();
120  $tmp_arr['dns'] = $participant->getDNS();
121  $tmp_arr['abr'] = $participant->getAbbreviation();
122  $def[] = $tmp_arr;
123  }
124 
125  $this->setData($def ? $def : array());
126  }
127 
128 }
129 
130 
131 ?>