ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilCalendarSharedListTableGUI.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/Calendar/classes/class.ilCalendarShared.php');
26 
35 {
36  protected $calendar_id;
37 
45  public function __construct($parent_obj,$parent_cmd)
46  {
47  global $ilCtrl;
48 
49  parent::__construct($parent_obj,$parent_cmd);
50 
51  $this->setRowTemplate('tpl.calendar_shared_list_row.html','Services/Calendar');
52  $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
53 
54  $this->addColumn('','id','1px');
55  $this->addColumn($this->lng->txt('type'),'type','1px');
56  $this->addColumn($this->lng->txt('title'),'title','20%');
57 
58  $this->addMultiCommand('shareDeassign',$this->lng->txt('cal_unshare_cal'));
59  $this->setPrefix('shared');
60  $this->setSelectAllCheckbox('obj_ids');
61  }
62 
70  public function setCalendarId($a_calendar_id)
71  {
72  $this->calendar_id = $a_calendar_id;
73  }
74 
81  public function fillRow($a_set)
82  {
83  $this->tpl->setVariable('VAL_ID',$a_set['obj_id']);
84  $this->tpl->setVariable('NAME',$a_set['title']);
85 
86  if(strlen($a_set['description']))
87  {
88  $this->tpl->setVariable('DESCRIPTION',$a_set['description']);
89  }
90 
91  $this->tpl->setVariable('TYPE_IMG',ilUtil::getImagePath('icon_'.$a_set['type'].'_s.png'));
92  $this->tpl->setVariable('ALT_IMG',$this->lng->txt('obj_'.$a_set['type']));
93 
94  }
95 
102  public function parse()
103  {
104  $this->shared_obj = new ilCalendarShared($this->calendar_id);
105 
106  $items = array();
107  foreach($this->shared_obj->getShared() as $item)
108  {
109  switch($item['obj_type'])
110  {
112  $data['type'] = 'usr';
113 
114  $name = ilObjUser::_lookupName($item['obj_id']);
115  $data['title'] = $name['lastname'].', '.$name['firstname'];
116  $data['description'] = '';
117  break;
118 
119 
121  $data['type'] = 'role';
122  $data['title'] = ilObject::_lookupTitle($item['obj_id']);
123  $data['description'] = ilObject::_lookupDescription($item['obj_id']);
124  break;
125  }
126  $data['obj_id'] = $item['obj_id'];
127  $data['create_date'] = $item['create_date'];
128 
129  $items[] = $data;
130  }
131  $this->setData($items ? $items : array());
132  return true;
133  }
134 
135 
136 
137 
138 }
139 ?>