Skip to content

Commit

Permalink
Refactroring
Browse files Browse the repository at this point in the history
  • Loading branch information
gvollbach committed Sep 18, 2023
1 parent da4fee3 commit 8ca27b6
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions Modules/Forum/classes/class.ilObjForumGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu
public ilObjectDataCache $ilObjDataCache;
public \ILIAS\DI\RBACServices $rbac;
public ilHelpGUI $ilHelp;
private Factory $factory;
private Renderer $renderer;

private int $selectedSorting;
private ilForumThreadSettingsSessionStorage $selected_post_storage;
Expand All @@ -96,6 +98,8 @@ public function __construct($data, int $id = 0, bool $call_by_reference = true,
$this->ilNavigationHistory = $DIC['ilNavigationHistory'];
$this->ilHelp = $DIC['ilHelp'];
$this->rbac = $DIC->rbac();
$this->factory = $DIC->ui()->factory();
$this->renderer = $DIC->ui()->renderer();

$this->type = 'frm';
parent::__construct($data, $id, $call_by_reference, false);
Expand Down Expand Up @@ -741,7 +745,7 @@ public function getContent(): string
$frm->setForumRefId($this->object->getRefId());
$frm->setMDB2Wherecondition('top_frm_fk = %s ', ['integer'], [$frm->getForumId()]);

$threadsTemplate = new ilTemplate(
/* $threadsTemplate = new ilTemplate(
'tpl.forums_threads_liste.html',
true,
true,
Expand Down Expand Up @@ -840,15 +844,23 @@ public function getContent(): string
$this->user,
$this->content_style_domain
);
$forwarder->setPresentationMode(ilForumPageCommandForwarder::PRESENTATION_MODE_PRESENTATION);
$forwarder->setPresentationMode(ilForumPageCommandForwarder::PRESENTATION_MODE_PRESENTATION);*/
$ref_id = $this->retrieveRefId();
$topicData = $frm->getOneTopic();
$tbl = new ilForumThreadObject(
$this,
$cmd,
$ref_id,
$topicData,
$this->is_moderator
);
$data_objects = $tbl->setMapper($frm)->fetchDataAnReturnObject();

global $DIC;
$f = $DIC->ui()->factory();
$renderer = $DIC->ui()->renderer();
$f = $this->factory;
$renderer = $this->renderer;
$thread_buffer = [];

if(is_array($data_objects) && count($data_objects) > 0) {
$thread_buffer = [];
foreach($data_objects as $thread) {
if(array_key_exists('thread', $thread)) {
/** @var ilForumTopic $current_thread */
Expand All @@ -869,9 +881,9 @@ public function getContent(): string
}
}

$std_list = $f->panel()->listing()->standard($this->object->getTitle(), array(
$std_list = $f->panel()->listing()->standard($this->object->getTitle(), [
$f->item()->group("", $thread_buffer)
));
]);

$this->tpl->setContent($renderer->render($std_list));
return '';
Expand Down

0 comments on commit 8ca27b6

Please sign in to comment.