56 $this->tabs_gui =& $ilTabs;
58 $this->content_gui =& $content_gui;
59 $this->content_obj =& $this->content_gui->object;
68 switch($this->ctrl->getNextClass($this))
70 case 'ilobjectcopygui':
71 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
74 $this->ctrl->forwardCommand($cp);
78 $cmd = $this->ctrl->getCmd();
79 if (!
$cmd = $this->ctrl->getCmd())
93 if(!$ilAccess->checkAccess(
"read",
'',$this->course_obj->getRefId()))
95 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),$ilErr->MESSAGE);
99 $this->is_tutor = $ilAccess->checkAccess(
'write',
'',$this->course_obj->getRefId());
100 $this->download_allowed = ($this->is_tutor or $this->course_obj->getArchiveType() == $this->course_obj->ARCHIVE_DOWNLOAD);
102 $this->course_obj->initCourseArchiveObject();
103 $this->course_obj->archives_obj->initCourseFilesObject();
106 $archives = $this->is_tutor ?
107 $this->course_obj->archives_obj->getArchives() :
108 $this->course_obj->archives_obj->getPublicArchives();
110 require_once(
"./Services/Table/classes/class.ilTableGUI.php");
114 $this->tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.table.html");
115 $this->tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.crs_archives_row.html",
'Modules/Course');
117 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
119 $tbl->setTitle($this->lng->txt(
"crs_header_archives"));
122 if($this->download_allowed or $this->is_tutor)
124 $header_names = array(
'',
125 $this->lng->txt(
"type"),
126 $this->lng->txt(
"crs_file_name"),
127 $this->lng->txt(
"crs_size"),
128 $this->lng->txt(
"crs_create_date"),
129 $this->lng->txt(
"crs_archive_lang"));
131 $header_vars = array(
"",
137 $column_width = array(
"1%",
"9%",
"30%",
"20%",
"20%",
"20%");
138 $this->tpl->setVariable(
"COLUMN_COUNTS",6);
142 $header_names = array($this->lng->txt(
"type"),
143 $this->lng->txt(
"crs_file_name"),
144 $this->lng->txt(
"crs_create_date"),
145 $this->lng->txt(
"crs_size"),
146 $this->lng->txt(
"crs_archive_lang"));
148 $header_vars = array(
"type",
153 $column_width = array(
"10%",
"30%",
"20%",
"20%",
"20%");
154 $this->tpl->setVariable(
"COLUMN_COUNTS",5);
157 $tbl->setHeaderNames($header_names);
158 $tbl->setHeaderVars($header_vars,
159 array(
"ref_id" => $this->course_obj->getRefId(),
161 "cmdClass" => strtolower(get_class($this))));
162 $tbl->setColumnWidth($column_width);
166 $tbl->setOrderColumn(
$_GET[
"sort_by"]);
167 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
168 $tbl->setLimit(
$_GET[
"limit"]);
169 $tbl->setOffset(
$_GET[
"offset"]);
170 $tbl->disable(
"sort");
172 if($this->download_allowed)
178 $this->tpl->setCurrentBlock(
"tbl_action_btn");
179 $this->tpl->setVariable(
"BTN_NAME",
"confirmDeleteArchives");
180 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
181 $this->tpl->parseCurrentBlock();
185 $this->tpl->setCurrentBlock(
"tbl_action_btn");
186 $this->tpl->setVariable(
"BTN_NAME",
"downloadArchives");
187 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"download"));
188 $this->tpl->parseCurrentBlock();
191 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
192 $tbl->setMaxCount(count($archives));
193 $archives = array_slice($archives,
$_GET[
'offset'],
$_GET[
'limit']);
196 if(!count($archives))
198 $this->tpl->setCurrentBlock(
"notfound");
199 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
200 $this->tpl->setVariable(
"NUM_COLS",6);
201 $this->tpl->parseCurrentBlock();
206 foreach($archives as $archive_data)
208 $this->tpl->setCurrentBlock(
"tbl_content");
212 if($this->download_allowed)
214 $this->tpl->setVariable(
"VAL_CHECK",
ilUtil::formCheckbox(0,
"archives[]",$archive_data[
'archive_id']));
217 switch($archive_data[
"archive_type"])
219 case $this->course_obj->archives_obj->ARCHIVE_XML:
220 $type = $this->lng->txt(
"crs_xml");
223 case $this->course_obj->archives_obj->ARCHIVE_HTML:
224 $type = $this->lng->txt(
"crs_html");
227 case $this->course_obj->archives_obj->ARCHIVE_PDF:
228 $type = $this->lng->txt(
"crs_pdf");
231 $this->tpl->setVariable(
"VAL_TYPE",$type);
234 if($archive_data[
'archive_type'] == $this->course_obj->archives_obj->ARCHIVE_HTML)
236 $link =
'<a href="'.$this->course_obj->archives_obj->course_files_obj->getOnlineLink($archive_data[
'archive_name']).
'"'.
237 ' target="_blank">'.$archive_data[
"archive_name"].
'</a>';
241 $link = $archive_data[
'archive_name'];
244 $this->tpl->setVariable(
"VAL_NAME",$link);
245 $this->tpl->setVariable(
"VAL_SIZE",$archive_data[
'archive_size']);
248 if($archive_data[
"archive_lang"])
250 $this->tpl->setVariable(
"VAL_LANG",$this->lng->txt(
'lang_'.$archive_data[
"archive_lang"]));
254 $this->tpl->setVariable(
"VAL_LANG",$this->lng->txt(
'crs_not_available'));
256 $this->tpl->parseCurrentBlock();
258 $this->tpl->parseCurrentBlock();
267 if(!$ilAccess->checkAccess(
"write",
'',$this->course_obj->getRefId()))
269 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),$ilErr->MESSAGE);
281 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.crs_confirm_delete_archives.html',
'Modules/Course');
282 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
283 $this->tpl->setVariable(
"TXT_ARCHIVE_NAME",$this->lng->txt(
'crs_file_name'));
285 $this->course_obj->initCourseArchiveObject();
288 foreach(
$_POST[
'archives'] as $archive_id)
290 $archive = $this->course_obj->archives_obj->getArchive($archive_id);
291 $this->tpl->setCurrentBlock(
"archives");
293 $this->tpl->setVariable(
"ARCHIVE_NAME",$archive[
'archive_name']);
295 $this->tpl->parseCurrentBlock();
298 $this->tpl->setVariable(
"DELETE",$this->lng->txt(
'delete'));
299 $this->tpl->setVariable(
"CANCEL",$this->lng->txt(
'cancel'));
309 if(!$ilAccess->checkAccess(
"write",
'',$this->course_obj->getRefId()))
311 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),$ilErr->MESSAGE);
320 $this->course_obj->initCourseArchiveObject();
321 foreach(
$_SESSION[
'crs_archives'] as $archive_id)
323 $this->course_obj->archives_obj->delete($archive_id);
340 include_once(
"./Services/Export/classes/class.ilSubItemSelectionTableGUI.php");
342 $this->course_obj->getRefId(),
"addXMLArchive",
343 $this->lng->txt(
"crs_add_archive_xml"));
344 $tpl->setContent($sel_table->getHTML());
352 if(!$ilAccess->checkAccess(
"write",
'',$this->course_obj->getRefId()))
354 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),
$ilErr->MESSAGE);
357 $this->course_obj->initCourseArchiveObject();
358 $this->course_obj->archives_obj->addXML(
$_POST[
"sel"]);
371 if(!$ilAccess->checkAccess(
"write",
'',$this->course_obj->getRefId()))
373 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),
$ilErr->MESSAGE);
376 foreach($this->lng->getInstalledLanguages() as $lang_code)
378 $actions[
"$lang_code"] = $this->lng->txt(
'lang_'.$lang_code);
380 if($this->lng->getLangKey() == $lang_code)
382 $selected = $lang_code;
386 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.crs_selectLanguage.html",
'Modules/Course');
388 $this->tpl->setVariable(
"LANGUAGE_SELECTION",$this->lng->txt(
'crs_archive_language_selection'));
389 $this->tpl->setVariable(
"LANGUAGE",$this->lng->txt(
'obj_lng'));
390 $this->tpl->setVariable(
"INFO_TXT",$this->lng->txt(
'crs_select_archive_language'));
391 $this->tpl->setVariable(
"SELECT_FORMACTION",$this->ctrl->getFormAction($this));
393 $this->tpl->setVariable(
"TXT_CANCEL",$this->lng->txt(
'cancel'));
394 $this->tpl->setVariable(
"TXT_SUBMIT",$this->lng->txt(
'crs_add_html_archive'));
404 if(!$ilAccess->checkAccess(
"write",
'',$this->course_obj->getRefId()))
406 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),
$ilErr->MESSAGE);
409 $this->course_obj->initCourseArchiveObject();
410 $this->course_obj->archives_obj->setLanguage(
$_POST[
'lang']);
411 $this->course_obj->archives_obj->addHTML();
424 if(!$ilAccess->checkAccess(
"read",
'',$this->course_obj->getRefId()))
426 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),
$ilErr->MESSAGE);
431 if(!count(
$_POST[
'archives']))
438 if(count(
$_POST[
'archives']) > 1)
446 $this->course_obj->initCourseArchiveObject();
448 $abs_path = $this->course_obj->archives_obj->getArchiveFile((
int)
$_POST[
'archives'][0]);
449 $basename = basename($abs_path);
461 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
479 $this->tpl->setCurrentBlock(
"btn_cell");
480 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"selectXMLArchiveItems"));
481 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"crs_add_archive_xml"));
482 $this->tpl->parseCurrentBlock();
484 $this->tpl->setCurrentBlock(
"btn_cell");
485 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"selectArchiveLanguage"));
486 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"crs_add_archive_html"));
487 $this->tpl->parseCurrentBlock();
496 if($this->content_obj->getType() ==
'crs')
499 $this->course_obj =& $this->content_obj;
503 $course_ref_id = $tree->checkForParentType($this->content_obj->getRefId(),
'crs');