61 public function __construct($a_expl_id, $a_parent_obj, $a_parent_cmd)
65 parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd);
70 $this->tpl = $DIC->ui()->mainTemplate();
71 $this->ctrl = $DIC->ctrl();
74 $this->max_entries = (int) $frm->getPageHits();
84 $this->root_node = $firstNode;
85 $this->root_node->
setIsRead($this->root_node->isRead($this->root_node->getPosAuthorId()));
88 $this->ctrl->setParameter($this->parent_obj,
'thr_pk', $this->thread->getId());
96 $result = parent::isNodeClickable($a_node);
101 return $this->root_node->getId() != $a_node[
'pos_pk'];
110 if (null === $this->root_node) {
111 $this->root_node = $this->thread->getFirstPostNode();
115 'pos_pk' => $this->root_node->getId(),
116 'pos_subject' => $this->root_node->getSubject(),
117 'pos_author_id' => $this->root_node->getPosAuthorId(),
118 'pos_display_user_id' => $this->root_node->getDisplayUserId(),
119 'pos_usr_alias' => $this->root_node->getUserAlias(),
120 'pos_date' => $this->root_node->getCreateDate(),
121 'import_name' => $this->root_node->getImportName(),
122 'post_read' => $this->root_node->isPostRead()
132 return new ilTemplate(
'tpl.tree_node_content.html',
true,
true,
'Modules/Forum');
140 if ($this->preloaded) {
141 if (isset($this->preloaded_children[$a_parent_node_id])) {
142 return $this->preloaded_children[$a_parent_node_id];
148 return $this->thread->getNestedSetPostChildren($a_parent_node_id, 1);
156 $this->preloaded_children = array();
157 $this->node_id_to_parent_node_id_map = array();
159 $children = $this->thread->getNestedSetPostChildren($this->root_node->getId());
161 array_walk($children,
function (&$a_node,
$key) {
162 $this->node_id_to_parent_node_id_map[(int) $a_node[
'pos_pk']] = (
int) $a_node[
'parent_pos'];
163 $this->preloaded_children[(int) $a_node[
'parent_pos']][$a_node[
'pos_pk']] = $a_node;
166 $this->preloaded =
true;
176 $tpl->setCurrentBlock(
'node-content-block');
177 $tpl->setVariable(
'TITLE', $a_node[
'pos_subject']);
179 $tpl->parseCurrentBlock();
181 if ($this->root_node->getId() == $a_node[
'pos_pk']) {
187 $tpl->setCurrentBlock(
'unlinked-node-content-block');
189 $tpl->setVariable(
'AUTHOR', $authorinfo->getAuthorShortName());
191 $tpl->parseCurrentBlock();
202 $node_title_classes = array(
'ilForumTreeTitle');
204 if ($this->root_node->getId() == $node_config[
'pos_pk']) {
205 return $node_title_classes;
208 if (isset($node_config[
'post_read']) && !$node_config[
'post_read']) {
209 $node_title_classes[] =
'ilForumTreeTitleUnread';
212 return $node_title_classes;
220 return 'ilForumTreeUnlinkedContent';
228 $this->ctrl->setParameter($this->parent_obj,
'backurl', null);
229 $this->ctrl->setParameter($this->parent_obj,
'pos_pk', $a_node[
'pos_pk']);
231 if (isset($a_node[
'counter'])) {
232 $this->ctrl->setParameter($this->parent_obj,
'offset', floor($a_node[
'counter'] / $this->max_entries) * $this->max_entries);
235 if (isset($a_node[
'post_read']) && $a_node[
'post_read']) {
236 return $this->ctrl->getLinkTarget($this->parent_obj, $this->parent_cmd, $a_node[
'pos_pk']);
238 return $this->ctrl->getLinkTarget($this->parent_obj,
'markPostRead', $a_node[
'pos_pk']);
248 if (isset($this->authorInformation[(
int) $node[
'pos_pk']])) {
249 return $this->authorInformation[(int) $node[
'pos_pk']];
253 $node[
'pos_author_id'],
254 $node[
'pos_display_user_id'],
255 $node[
'pos_usr_alias'],
265 return $a_node[
'pos_pk'];
273 if ($this->root_node->getId() == $a_node[
'pos_pk']) {
274 return ilObject::_getIcon(0,
'tiny',
'frm');
285 if (isset(
$_GET[
'post_created_below']) && (
int)
$_GET[
'post_created_below'] > 0) {
286 $parent = (int)
$_GET[
'post_created_below'];
289 }
while ($parent = $this->node_id_to_parent_node_id_map[$parent]);
291 $this->store->set(
"on_" . $this->
id, serialize(array_unique(array_merge($this->open_nodes, $this->custom_open_nodes))));
302 $html = parent::getHTML();
304 $this->tpl->addOnLoadCode(
'il.ForumExplorer.init(' . json_encode(array(
305 'selectors' => array(
311 $this->tpl->addJavascript($this->js_explorer_frm_path);
Class Forum core functions for forum.
getNodeContent($a_node)
{}
Class ilForumExplorerGUI.
setSkipRootNode($a_val)
Set skip root node.
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour) ...
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
getUnlinkedNodeContentClass()
getChildsOfNode($a_parent_node_id)
{}
special template class to simplify handling of ITX/PEAR
setThread(ilForumTopic $thread, ilForumPost $firstNode)
getNodeTemplateInstance()
Factory method for a new instance of a node template.
getAuthorInformationByNode(array $node)
__construct($a_expl_id, $a_parent_obj, $a_parent_cmd)
{}
getNodeTitleClasses(array $node_config)
getContainerId()
Get container id.
$node_id_to_parent_node_id_map