Skip to content

Commit

Permalink
Export: forum, export options
Browse files Browse the repository at this point in the history
  • Loading branch information
chlulei committed Oct 17, 2024
1 parent 83298b3 commit 1ef5b08
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 13 deletions.
100 changes: 100 additions & 0 deletions components/ILIAS/Forum/classes/class.ilForumExportOptionHTML.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

declare(strict_types=1);

use ILIAS\Export\ExportHandler\Consumer\ExportOption\BasicHandler as ilBasicExportOption;
use ILIAS\Export\ExportHandler\I\Consumer\Context\HandlerInterface as ilExportHandlerConsumerContextInterface;
use ILIAS\DI\Container;
use ILIAS\Data\ObjectId;

class ilForumExportOptionHTML extends ilBasicExportOption
{
protected ilLanguage $lng;
protected ilCtrlInterface $ctrl;

public function init(Container $DIC): void
{
$this->lng = $DIC->language();
$this->ctrl = $DIC->ctrl();
}

public function getExportType(): string
{
return 'html';
}

public function getExportOptionId(): string
{
return 'frm_exp_option_html';
}

public function getSupportedRepositoryObjectTypes(): array
{
return ['frm'];
}

public function getLabel(): string
{
$this->lng->loadLanguageModule('exp');
return $this->lng->txt('exp_html');
}

public function onExportOptionSelected(ilExportHandlerConsumerContextInterface $context): void
{
$fex_gui = new ilForumExportGUI();
$fex_gui->exportHTML();
$this->ctrl->redirectByClass(ilObjForumGUI::class, 'export');
}

public function onDeleteFiles(
ilExportHandlerConsumerContextInterface $context,
\ILIAS\Export\ExportHandler\I\Consumer\File\Identifier\CollectionInterface $file_identifiers
): void {
# Direct download on export creation, no local files
}

public function onDownloadFiles(
ilExportHandlerConsumerContextInterface $context,
\ILIAS\Export\ExportHandler\I\Consumer\File\Identifier\CollectionInterface $file_identifiers
): void {
# Direct download on export creation, no local files
}

public function onDownloadWithLink(
\ILIAS\Data\ReferenceId $reference_id,
\ILIAS\Export\ExportHandler\I\Consumer\File\Identifier\HandlerInterface $file_identifier
): void {
# Direct download on export creation, no local files
}

public function getFiles(
ilExportHandlerConsumerContextInterface $context
): \ILIAS\Export\ExportHandler\I\Info\File\CollectionInterface {
# Direct download on export creation, no local files
return $context->fileCollectionBuilder()->collection();
}

public function getFileSelection(
ilExportHandlerConsumerContextInterface $context,
\ILIAS\Export\ExportHandler\I\Consumer\File\Identifier\CollectionInterface $file_identifiers
): \ILIAS\Export\ExportHandler\I\Info\File\CollectionInterface {
# Direct download on export creation, no local files
return $context->fileCollectionBuilder()->collection();
}
}
15 changes: 2 additions & 13 deletions components/ILIAS/Forum/classes/class.ilObjForumGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,17 +483,6 @@ public function executeCommand(): void
case strtolower(ilExportGUI::class):
$this->tabs_gui->activateTab('export');
$exp = new ilExportGUI($this);
$exp->addFormat('html');
$exp->addFormat('xml');
if ($cmd === 'createExportFile') {
if ($this->http->wrapper()->post()->has('format')) {
$format = $this->http->wrapper()->post()->retrieve('format', $this->refinery->kindlyTo()->string());
if ($format === 'html') {
$fex_gui = new ilForumExportGUI();
$fex_gui->exportHTML();
}
}
}
$this->ctrl->forwardCommand($exp);
break;

Expand Down Expand Up @@ -805,14 +794,14 @@ private function renderThreadOverview(ilForumThreadObjectTableGUI $tbl, ilForum
}

$found_threads = false;
if(count($top_group) > 0) {
if (count($top_group) > 0) {
$top_threads = $this->factory->item()->group($this->lng->txt('top_thema'), $top_group);
$found_threads = true;
} else {
$top_threads = $this->factory->item()->group('', $top_group);
}

if(count($thread_group) > 0) {
if (count($thread_group) > 0) {
$normal_threads = $this->factory->item()->group($this->lng->txt('thema'), $thread_group);
$found_threads = true;
} else {
Expand Down

0 comments on commit 1ef5b08

Please sign in to comment.