ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
24include_once('Services/Table/classes/class.ilTable2GUI.php');
25
35{
36 protected $lng;
37 protected $ctrl;
38
46 public function __construct($a_parent_obj, $a_parent_cmd = '')
47 {
48 global $DIC;
49
50 $lng = $DIC['lng'];
51 $ilCtrl = $DIC['ilCtrl'];
52
53 $this->lng = $lng;
54 $this->ctrl = $ilCtrl;
55
56 parent::__construct($a_parent_obj, $a_parent_cmd);
57 $this->addColumn($this->lng->txt('title'), 'title', '40%');
58 #$this->addColumn($this->lng->txt('ecs_released_for'),'for','30%');
59 $this->addColumn($this->lng->txt('ecs_meta_data'), 'md', '40%');
60 $this->addColumn($this->lng->txt('last_update'), 'last_update', '10%');
61 $this->setRowTemplate('tpl.released_content_row.html', 'Services/WebServices/ECS');
62 $this->setDefaultOrderField('title');
63 $this->setDefaultOrderDirection('asc');
64 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
65 }
66
74 public function fillRow($a_set)
75 {
76 include_once('./Services/Link/classes/class.ilLink.php');
77
78 $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
79 $this->tpl->setVariable('VAL_LINK', ilLink::_getLink($a_set['ref_id'], 'rcrs'));
80 $this->tpl->setVariable('VAL_DESC', $a_set['desc']);
81 $this->tpl->setVariable('VAL_REMOTE', $a_set['from']);
82 $this->tpl->setVariable('VAL_REMOTE_INFO', $a_set['from_info']);
83 $this->tpl->setVariable('TXT_EMAIL', $this->lng->txt('ecs_email'));
84 $this->tpl->setVariable('TXT_DNS', $this->lng->txt('ecs_dns'));
85 $this->tpl->setVariable('TXT_ABR', $this->lng->txt('ecs_abr'));
86 $this->tpl->setVariable('VAL_LAST_UPDATE', $a_set['last_update']);
87
88
89 $this->tpl->setVariable('TXT_TERM', $this->lng->txt('ecs_field_term'));
90 $this->tpl->setVariable('TXT_CRS_TYPE', $this->lng->txt('ecs_field_courseType'));
91 $this->tpl->setVariable('TXT_CRS_ID', $this->lng->txt('ecs_field_courseID'));
92 $this->tpl->setVariable('TXT_CREDITS', $this->lng->txt('ecs_field_credits'));
93 $this->tpl->setVariable('TXT_ROOM', $this->lng->txt('ecs_field_room'));
94 $this->tpl->setVariable('TXT_CYCLE', $this->lng->txt('ecs_field_cycle'));
95 $this->tpl->setVariable('TXT_SWS', $this->lng->txt('ecs_field_semester_hours'));
96 $this->tpl->setVariable('TXT_START', $this->lng->txt('ecs_field_begin'));
97 $this->tpl->setVariable('TXT_END', $this->lng->txt('ecs_field_end'));
98 $this->tpl->setVariable('TXT_LECTURER', $this->lng->txt('ecs_field_lecturer'));
99
100
101 $sid = array_pop($a_set['sids']);
102 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
104
105 include_once "Services/WebServices/ECS/classes/class.ilECSUtils.php";
106 $values = ilECSUtils::getAdvancedMDValuesForObjId($a_set['obj_id']);
107
108 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'lecturer')) {
109 $this->tpl->setVariable('VAL_LECTURER', isset($values[$field]) ? $values[$field] : '--');
110 }
111 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'term')) {
112 $this->tpl->setVariable('VAL_TERM', isset($values[$field]) ? $values[$field] : '--');
113 }
114 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'courseID')) {
115 $this->tpl->setVariable('VAL_CRS_ID', isset($values[$field]) ? $values[$field] : '--');
116 }
117 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'courseType')) {
118 $this->tpl->setVariable('VAL_CRS_TYPE', isset($values[$field]) ? $values[$field] : '--');
119 }
120 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'credits')) {
121 $this->tpl->setVariable('VAL_CREDITS', isset($values[$field]) ? $values[$field] : '--');
122 }
123 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'semester_hours')) {
124 $this->tpl->setVariable('VAL_SWS', isset($values[$field]) ? $values[$field] : '--');
125 }
126 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'room')) {
127 $this->tpl->setVariable('VAL_ROOM', isset($values[$field]) ? $values[$field] : '--');
128 }
129 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'cycle')) {
130 $this->tpl->setVariable('VAL_CYCLE', isset($values[$field]) ? $values[$field] : '--');
131 }
132 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'begin')) {
133 $this->tpl->setVariable('VAL_START', isset($values[$field]) ? ilDatePresentation::formatDate(new ilDateTime($values[$field], IL_CAL_UNIX)) : '--');
134 }
135 if ($field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_EXPORT, 'end')) {
136 $this->tpl->setVariable('VAL_END', isset($values[$field]) ? ilDatePresentation::formatDate(new ilDateTime($values[$field], IL_CAL_UNIX)) : '--');
137 }
138 }
139
147 public function parse($a_obj_ids)
148 {
149 global $DIC;
150
151 $ilObjDataCache = $DIC['ilObjDataCache'];
152
153 $ilObjDataCache->preloadObjectCache($a_obj_ids);
154
155 // read obj_ids
156 $obj_ids = array();
157 foreach ($a_obj_ids as $obj_id) {
158 $ref_ids = ilObject::_getAllReferences($obj_id);
159 $ref_id = current($ref_ids);
160
161 $obj_ids[$ref_id] = $obj_id;
162 }
163
164 foreach ($obj_ids as $ref_id => $obj_id) {
165 include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
166
167 $tmp_arr['sids'] = ilECSExport::lookupServerIds($obj_id);
168 $tmp_arr['ref_id'] = $ref_id;
169 $tmp_arr['obj_id'] = $obj_id;
170 $tmp_arr['title'] = $ilObjDataCache->lookupTitle($obj_id);
171 $tmp_arr['desc'] = $ilObjDataCache->lookupDescription($obj_id);
172 $tmp_arr['md'] = '';
173 $tmp_arr['last_update'] = $ilObjDataCache->lookupLastUpdate($obj_id);
174 $content[] = $tmp_arr;
175 }
176 $this->setData($content ? $content : array());
177 }
178}
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
static getInstanceByServerId($a_server_id)
Get singleton instance.
static lookupServerIds($a_obj_id)
Lookup server ids of exported objects @global ilDB $ilDB.
__construct($a_parent_obj, $a_parent_cmd='')
constructor
static getAdvancedMDValuesForObjId($a_obj_id)
Get advanced metadata values for object id.
static _getAllReferences($a_id)
get all reference ids of object
Class ilTable2GUI.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46