ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilECSReleasedContentTableGUI.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/Utilities/classes/class.ilFormat.php');
26 
36 {
37  protected $lng;
38  protected $ctrl;
39 
47  public function __construct($a_parent_obj,$a_parent_cmd = '')
48  {
49  global $lng,$ilCtrl;
50 
51  $this->lng = $lng;
52  $this->ctrl = $ilCtrl;
53 
54  parent::__construct($a_parent_obj,$a_parent_cmd);
55  $this->addColumn($this->lng->txt('title'),'title','40%');
56  #$this->addColumn($this->lng->txt('ecs_released_for'),'for','30%');
57  $this->addColumn($this->lng->txt('ecs_meta_data'),'md','40%');
58  $this->addColumn($this->lng->txt('last_update'),'last_update','10%');
59  $this->setRowTemplate('tpl.released_content_row.html','Services/WebServices/ECS');
60  $this->setDefaultOrderField('title');
61  $this->setDefaultOrderDirection('asc');
62  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
63 
64  }
65 
73  public function fillRow($a_set)
74  {
75  include_once('./Services/Link/classes/class.ilLink.php');
76 
77  $this->tpl->setVariable('VAL_TITLE',$a_set['title']);
78  $this->tpl->setVariable('VAL_LINK',ilLink::_getLink($a_set['ref_id'],'rcrs'));
79  $this->tpl->setVariable('VAL_DESC',$a_set['desc']);
80  $this->tpl->setVariable('VAL_REMOTE',$a_set['from']);
81  $this->tpl->setVariable('VAL_REMOTE_INFO',$a_set['from_info']);
82  $this->tpl->setVariable('TXT_EMAIL',$this->lng->txt('ecs_email'));
83  $this->tpl->setVariable('TXT_DNS',$this->lng->txt('ecs_dns'));
84  $this->tpl->setVariable('TXT_ABR',$this->lng->txt('ecs_abr'));
85  $this->tpl->setVariable('VAL_LAST_UPDATE',$a_set['last_update']);
86 
87 
88  $this->tpl->setVariable('TXT_TERM',$this->lng->txt('ecs_field_term'));
89  $this->tpl->setVariable('TXT_CRS_TYPE',$this->lng->txt('ecs_field_courseType'));
90  $this->tpl->setVariable('TXT_CRS_ID',$this->lng->txt('ecs_field_courseID'));
91  $this->tpl->setVariable('TXT_CREDITS',$this->lng->txt('ecs_field_credits'));
92  $this->tpl->setVariable('TXT_ROOM',$this->lng->txt('ecs_field_room'));
93  $this->tpl->setVariable('TXT_CYCLE',$this->lng->txt('ecs_field_cycle'));
94  $this->tpl->setVariable('TXT_SWS',$this->lng->txt('ecs_field_semester_hours'));
95  $this->tpl->setVariable('TXT_START',$this->lng->txt('ecs_field_begin'));
96  $this->tpl->setVariable('TXT_END',$this->lng->txt('ecs_field_end'));
97  $this->tpl->setVariable('TXT_LECTURER',$this->lng->txt('ecs_field_lecturer'));
98 
99 
100  $sid = array_pop($a_set['sids']);
101  include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
103 
104  include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
105  $values = ilECSUtils::getAdvancedMDValuesForObjId($a_set['obj_id']);
106 
107  if($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT,'lecturer'))
108  {
109  $this->tpl->setVariable('VAL_LECTURER',isset($values[$field]) ? $values[$field] : '--');
110  }
111  if($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT,'term'))
112  {
113  $this->tpl->setVariable('VAL_TERM',isset($values[$field]) ? $values[$field] : '--');
114  }
115  if($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT,'courseID'))
116  {
117  $this->tpl->setVariable('VAL_CRS_ID',isset($values[$field]) ? $values[$field] : '--');
118  }
119  if($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT,'courseType'))
120  {
121  $this->tpl->setVariable('VAL_CRS_TYPE',isset($values[$field]) ? $values[$field] : '--');
122  }
123  if($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT,'credits'))
124  {
125  $this->tpl->setVariable('VAL_CREDITS',isset($values[$field]) ? $values[$field] : '--');
126  }
127  if($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT,'semester_hours'))
128  {
129  $this->tpl->setVariable('VAL_SWS',isset($values[$field]) ? $values[$field] : '--');
130  }
131  if($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT,'room'))
132  {
133  $this->tpl->setVariable('VAL_ROOM',isset($values[$field]) ? $values[$field] : '--');
134  }
135  if($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT,'cycle'))
136  {
137  $this->tpl->setVariable('VAL_CYCLE',isset($values[$field]) ? $values[$field] : '--');
138  }
139  if($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT,'begin'))
140  {
141  $this->tpl->setVariable('VAL_START',isset($values[$field]) ? ilDatePresentation::formatDate(new ilDateTime($values[$field],IL_CAL_UNIX)) : '--');
142  }
143  if($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT,'end'))
144  {
145  $this->tpl->setVariable('VAL_END',isset($values[$field]) ? ilDatePresentation::formatDate(new ilDateTime($values[$field],IL_CAL_UNIX)) : '--');
146  }
147  }
148 
156  public function parse($a_obj_ids)
157  {
158  global $ilObjDataCache;
159 
160  $ilObjDataCache->preloadObjectCache($a_obj_ids);
161 
162  // read obj_ids
163  $obj_ids = array();
164  foreach($a_obj_ids as $obj_id)
165  {
166  $ref_ids = ilObject::_getAllReferences($obj_id);
167  $ref_id = current($ref_ids);
168 
169  $obj_ids[$ref_id] = $obj_id;
170  }
171 
172  foreach($obj_ids as $ref_id => $obj_id)
173  {
174  include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
175 
176  $tmp_arr['sids'] = ilECSExport::lookupServerIds($obj_id);
177  $tmp_arr['ref_id'] = $ref_id;
178  $tmp_arr['obj_id'] = $obj_id;
179  $tmp_arr['title'] = $ilObjDataCache->lookupTitle($obj_id);
180  $tmp_arr['desc'] = $ilObjDataCache->lookupDescription($obj_id);
181  $tmp_arr['md'] = '';
182  $tmp_arr['last_update'] = $ilObjDataCache->lookupLastUpdate($obj_id);
183  $content[] = $tmp_arr;
184  }
185  $this->setData($content ? $content : array());
186  }
187 
188 }
189 ?>