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)) {
69 case 'ilobjectcopygui':
70 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
73 $this->ctrl->forwardCommand($cp);
77 $cmd = $this->ctrl->getCmd();
78 if (!$cmd = $this->ctrl->getCmd()) {
91 if (!$ilAccess->checkAccess(
"read",
'', $this->course_obj->getRefId())) {
92 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'), $ilErr->MESSAGE);
96 $this->is_tutor = $ilAccess->checkAccess(
'write',
'', $this->course_obj->getRefId());
97 $this->download_allowed = ($this->is_tutor or $this->course_obj->getArchiveType() == $this->course_obj->ARCHIVE_DOWNLOAD);
99 $this->course_obj->initCourseArchiveObject();
100 $this->course_obj->archives_obj->initCourseFilesObject();
103 $archives = $this->is_tutor ?
104 $this->course_obj->archives_obj->getArchives() :
105 $this->course_obj->archives_obj->getPublicArchives();
107 require_once(
"./Services/Table/classes/class.ilTableGUI.php");
111 $this->tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.table.html");
112 $this->tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.crs_archives_row.html",
'Modules/Course');
114 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
116 $tbl->setTitle($this->lng->txt(
"crs_header_archives"));
119 if ($this->download_allowed or $this->is_tutor) {
120 $header_names =
array(
'',
121 $this->lng->txt(
"type"),
122 $this->lng->txt(
"crs_file_name"),
123 $this->lng->txt(
"crs_size"),
124 $this->lng->txt(
"crs_create_date"),
125 $this->lng->txt(
"crs_archive_lang"));
127 $header_vars =
array(
"",
133 $column_width =
array(
"1%",
"9%",
"30%",
"20%",
"20%",
"20%");
134 $this->tpl->setVariable(
"COLUMN_COUNTS", 6);
136 $header_names =
array($this->lng->txt(
"type"),
137 $this->lng->txt(
"crs_file_name"),
138 $this->lng->txt(
"crs_create_date"),
139 $this->lng->txt(
"crs_size"),
140 $this->lng->txt(
"crs_archive_lang"));
142 $header_vars =
array(
"type",
147 $column_width =
array(
"10%",
"30%",
"20%",
"20%",
"20%");
148 $this->tpl->setVariable(
"COLUMN_COUNTS", 5);
151 $tbl->setHeaderNames($header_names);
154 array(
"ref_id" => $this->course_obj->getRefId(),
156 "cmdClass" => strtolower(get_class($this)))
158 $tbl->setColumnWidth($column_width);
163 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
166 $tbl->disable(
"sort");
168 if ($this->download_allowed) {
170 if ($this->is_tutor) {
172 $this->tpl->setCurrentBlock(
"tbl_action_btn");
173 $this->tpl->setVariable(
"BTN_NAME",
"confirmDeleteArchives");
174 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
175 $this->tpl->parseCurrentBlock();
179 $this->tpl->setCurrentBlock(
"tbl_action_btn");
180 $this->tpl->setVariable(
"BTN_NAME",
"downloadArchives");
181 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"download"));
182 $this->tpl->parseCurrentBlock();
185 $tbl->setFooter(
"tblfooter", $this->lng->txt(
"previous"), $this->lng->txt(
"next"));
186 $tbl->setMaxCount(count($archives));
187 $archives = array_slice($archives,
$_GET[
'offset'],
$_GET[
'limit']);
190 if (!count($archives)) {
191 $this->tpl->setCurrentBlock(
"notfound");
192 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
193 $this->tpl->setVariable(
"NUM_COLS", 6);
194 $this->tpl->parseCurrentBlock();
199 foreach ($archives as $archive_data) {
200 $this->tpl->setCurrentBlock(
"tbl_content");
204 if ($this->download_allowed) {
205 $this->tpl->setVariable(
"VAL_CHECK",
ilUtil::formCheckbox(0,
"archives[]", $archive_data[
'archive_id']));
208 switch ($archive_data[
"archive_type"]) {
209 case $this->course_obj->archives_obj->ARCHIVE_XML:
210 $type = $this->lng->txt(
"crs_xml");
213 case $this->course_obj->archives_obj->ARCHIVE_HTML:
214 $type = $this->lng->txt(
"crs_html");
217 case $this->course_obj->archives_obj->ARCHIVE_PDF:
218 $type = $this->lng->txt(
"crs_pdf");
221 $this->tpl->setVariable(
"VAL_TYPE",
$type);
224 if ($archive_data[
'archive_type'] == $this->course_obj->archives_obj->ARCHIVE_HTML) {
225 $link =
'<a href="' . $this->course_obj->archives_obj->course_files_obj->getOnlineLink($archive_data[
'archive_name']) .
'"' .
226 ' target="_blank">' . $archive_data[
"archive_name"] .
'</a>';
228 $link = $archive_data[
'archive_name'];
231 $this->tpl->setVariable(
"VAL_NAME", $link);
232 $this->tpl->setVariable(
"VAL_SIZE", $archive_data[
'archive_size']);
235 if ($archive_data[
"archive_lang"]) {
236 $this->tpl->setVariable(
"VAL_LANG", $this->lng->txt(
'lang_' . $archive_data[
"archive_lang"]));
238 $this->tpl->setVariable(
"VAL_LANG", $this->lng->txt(
'crs_not_available'));
240 $this->tpl->parseCurrentBlock();
242 $this->tpl->parseCurrentBlock();
251 if (!$ilAccess->checkAccess(
"write",
'', $this->course_obj->getRefId())) {
252 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'), $ilErr->MESSAGE);
255 if (!
$_POST[
'archives']) {
263 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.crs_confirm_delete_archives.html',
'Modules/Course');
264 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
265 $this->tpl->setVariable(
"TXT_ARCHIVE_NAME", $this->lng->txt(
'crs_file_name'));
267 $this->course_obj->initCourseArchiveObject();
270 foreach (
$_POST[
'archives'] as $archive_id) {
271 $archive = $this->course_obj->archives_obj->getArchive($archive_id);
272 $this->tpl->setCurrentBlock(
"archives");
274 $this->tpl->setVariable(
"ARCHIVE_NAME", $archive[
'archive_name']);
276 $this->tpl->parseCurrentBlock();
279 $this->tpl->setVariable(
"DELETE", $this->lng->txt(
'delete'));
280 $this->tpl->setVariable(
"CANCEL", $this->lng->txt(
'cancel'));
285 public function delete()
290 if (!$ilAccess->checkAccess(
"write",
'', $this->course_obj->getRefId())) {
291 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'), $ilErr->MESSAGE);
299 $this->course_obj->initCourseArchiveObject();
300 foreach (
$_SESSION[
'crs_archives'] as $archive_id) {
301 $this->course_obj->archives_obj->delete($archive_id);
318 include_once(
"./Services/Export/classes/class.ilSubItemSelectionTableGUI.php");
321 "selectXMlArchiveItems",
322 $this->course_obj->getRefId(),
324 $this->lng->txt(
"crs_add_archive_xml")
326 $tpl->setContent($sel_table->getHTML());
334 if (!$ilAccess->checkAccess(
"write",
'', $this->course_obj->getRefId())) {
335 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),
$ilErr->MESSAGE);
338 $this->course_obj->initCourseArchiveObject();
339 $this->course_obj->archives_obj->addXML(
$_POST[
"sel"]);
352 if (!$ilAccess->checkAccess(
"write",
'', $this->course_obj->getRefId())) {
353 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),
$ilErr->MESSAGE);
356 foreach ($this->lng->getInstalledLanguages() as $lang_code) {
357 $actions[
"$lang_code"] = $this->lng->txt(
'lang_' . $lang_code);
359 if ($this->lng->getLangKey() == $lang_code) {
360 $selected = $lang_code;
364 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.crs_selectLanguage.html",
'Modules/Course');
366 $this->tpl->setVariable(
"LANGUAGE_SELECTION", $this->lng->txt(
'crs_archive_language_selection'));
367 $this->tpl->setVariable(
"LANGUAGE", $this->lng->txt(
'obj_lng'));
368 $this->tpl->setVariable(
"INFO_TXT", $this->lng->txt(
'crs_select_archive_language'));
369 $this->tpl->setVariable(
"SELECT_FORMACTION", $this->ctrl->getFormAction($this));
371 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
'cancel'));
372 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
'crs_add_html_archive'));
382 if (!$ilAccess->checkAccess(
"write",
'', $this->course_obj->getRefId())) {
383 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),
$ilErr->MESSAGE);
386 $this->course_obj->initCourseArchiveObject();
387 $this->course_obj->archives_obj->setLanguage(
$_POST[
'lang']);
388 $this->course_obj->archives_obj->addHTML();
401 if (!$ilAccess->checkAccess(
"read",
'', $this->course_obj->getRefId())) {
402 $ilErr->raiseError($this->lng->txt(
'msg_no_perm_write'),
$ilErr->MESSAGE);
407 if (!count(
$_POST[
'archives'])) {
413 if (count(
$_POST[
'archives']) > 1) {
420 $this->course_obj->initCourseArchiveObject();
422 $abs_path = $this->course_obj->archives_obj->getArchiveFile((
int)
$_POST[
'archives'][0]);
423 $basename = basename($abs_path);
431 if (!$this->is_tutor) {
434 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
451 $this->tpl->setCurrentBlock(
"btn_cell");
452 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"selectXMLArchiveItems"));
453 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"crs_add_archive_xml"));
454 $this->tpl->parseCurrentBlock();
456 $this->tpl->setCurrentBlock(
"btn_cell");
457 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"selectArchiveLanguage"));
458 $this->tpl->setVariable(
"BTN_TXT", $this->lng->txt(
"crs_add_archive_html"));
459 $this->tpl->parseCurrentBlock();
468 if ($this->content_obj->getType() ==
'crs') {
470 $this->course_obj =&$this->content_obj;
472 $course_ref_id = $tree->checkForParentType($this->content_obj->getRefId(),
'crs');
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
GUI class for the workflow of copying objects.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
__construct($content_gui)
Constructor public.
selectXMLArchiveItems()
Select items for archive.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Select subitems for export.
Class ilCourseArchivesGUI.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.