ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilForumExplorerGUI Class Reference

Class ilForumExplorerGUI. More...

+ Inheritance diagram for ilForumExplorerGUI:
+ Collaboration diagram for ilForumExplorerGUI:

Public Member Functions

 getThread ()
 
 setThread ($thread)
 
 getRootNode ()
 {Get root node.Please note that the class does not make any requirements how nodes are represented (array or object)
Returns
mixed root node object/array
} More...
 
 getChildsOfNode ($a_parent_node_id)
 {Get childs of node.
Parameters
string$a_parent_idparent node id
Returns
array childs
} More...
 
 preloadChildren ()
 
 getNodeContent ($a_node)
 {Get content of a node.
Parameters
mixed$a_nodenode array or object
Returns
string content of the node
} More...
 
 getNodeHref ($a_node)
 {Get href for node.
Parameters
mixed$a_nodenode object/array
Returns
string href attribute
} More...
 
 getNodeId ($a_node)
 {Get id of a node.
Parameters
mixed$a_nodenode array or object
Returns
string id of node
} More...
 
 getNodeIcon ($a_node)
 {Get node icon path.
Parameters
mixed$a_nodenode object/array
Returns
string image file path
} More...
 
 getHTML ()
 {Get HTML.} More...
 
- Public Member Functions inherited from ilExplorerBaseGUI
 __construct ($a_expl_id, $a_parent_obj, $a_parent_cmd)
 Constructor. More...
 
 getRootNode ()
 Get root node. More...
 
 getChildsOfNode ($a_parent_node_id)
 Get childs of node. More...
 
 getNodeContent ($a_node)
 Get content of a node. More...
 
 getNodeId ($a_node)
 Get id of a node. More...
 
 getNodeHref ($a_node)
 Get href for node. More...
 
 nodeHasVisibleChilds ($a_node)
 Node has childs? More...
 
 sortChilds ($a_childs, $a_parent_node_id)
 Sort childs. More...
 
 getNodeIcon ($a_node)
 Get node icon path. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getNodeTarget ($a_node)
 Get node target (frame) attribute. More...
 
 getNodeOnClick ($a_node)
 Get node onclick attribute. More...
 
 isNodeVisible ($a_node)
 Is node visible? More...
 
 isNodeHighlighted ($a_node)
 Is node highlighted? More...
 
 isNodeClickable ($a_node)
 Is node clickable? More...
 
 getId ()
 Get id of explorer element. More...
 
 setSkipRootNode ($a_val)
 Set skip root node. More...
 
 getSkipRootNode ()
 Get skip root node. More...
 
 setAjax ($a_val)
 Set ajax. More...
 
 getAjax ()
 Get ajax. More...
 
 setSecondaryHighlightedNodes ($a_val)
 Set secondary (background) highlighted nodes. More...
 
 getSecondaryHighlightedNodes ()
 Get secondary (background) highlighted nodes. More...
 
 setNodeOpen ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setSelectMode ($a_postvar, $a_multi=false)
 Set select mode (to deactivate, pass an empty string as postvar) More...
 
 setNodeSelected ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setOfflineMode ($a_val)
 Set offline mode. More...
 
 getOfflineMode ()
 Get offline mode. More...
 
 handleCommand ()
 Handle explorer internal command. More...
 
 getContainerId ()
 Get container id. More...
 
 openNode ()
 Open node. More...
 
 closeNode ()
 Close node. More...
 
 getNodeAsync ()
 Get node asynchronously. More...
 
 beforeRendering ()
 Before rendering. More...
 
 getOnLoadCode ()
 Get on load code. More...
 
 getHTML ()
 Get HTML. More...
 
 renderNode ($a_node, $tpl)
 Render node. More...
 
 renderChilds ($a_node_id, $tpl)
 Render childs. More...
 
 getDomNodeIdForNodeId ($a_node_id)
 Get DOM node id for node id. More...
 
 getNodeIdForDomNodeId ($a_dom_node_id)
 Get node id for dom node id. More...
 
 listItemStart ($tpl, $a_node)
 List item start. More...
 
 listItemEnd ($tpl)
 List item end. More...
 
 listStart ($tpl)
 List start. More...
 
 listEnd ($tpl)
 List end. More...
 
 isNodeOnclickEnabled ()
 
 setNodeOnclickEnabled ($nodeOnclickEnabled)
 
 isEnableDnd ()
 
 setEnableDnd ($enable_dnd)
 Enable Drag & Drop functionality. More...
 

Protected Member Functions

 getNodeTemplateInstance ()
 Factory method for a new instance of a node template. More...
 
 getNodeTitleClasses (array $node_config)
 
 getUnlinkedNodeContentClass ()
 
- Protected Member Functions inherited from ilExplorerBaseGUI
 isNodeSelectable ($a_node)
 Is node selectable? More...
 
 getNodeToggleOnClick ($a_node)
 Get onclick attribute for node toggling. More...
 
 getSelectOnClick ($a_node)
 Get onclick attribute for selecting radio/checkbox. More...
 
 getJSTreePlugins ()
 

Protected Attributes

 $js_explorer_frm_path = './Modules/Forum/js/ilForumExplorer.js'
 
 $thread
 
 $max_entries = PHP_INT_MAX
 
 $tpl
 
 $ctrl
 
 $preloaded = false
 
 $preloaded_children = array()
 
 $node_id_to_parent_node_id_map = array()
 
 $root_node = null
 
- Protected Attributes inherited from ilExplorerBaseGUI
 $skip_root_node = false
 
 $ajax = false
 
 $custom_open_nodes = array()
 
 $selected_nodes = array()
 
 $select_postvar = ""
 
 $offline_mode = false
 
 $sec_highl_nodes = array()
 
 $enable_dnd = false
 

Additional Inherited Members

- Static Public Member Functions inherited from ilExplorerBaseGUI
static getLocalExplorerJsPath ()
 Get local path of explorer js. More...
 
static getLocalJsTreeJsPath ()
 Get local path of jsTree js. More...
 
static createHTMLExportDirs ($a_target_dir)
 Create html export directories. More...
 
static init ()
 Init JS. More...
 
- Static Protected Attributes inherited from ilExplorerBaseGUI
static $js_tree_path = "./Services/UIComponent/Explorer2/lib/jstree-v.pre1.0/jquery.jstree.js"
 
static $js_expl_path = "./Services/UIComponent/Explorer2/js/Explorer2.js"
 

Detailed Description

Class ilForumExplorerGUI.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 10 of file class.ilForumExplorerGUI.php.

Member Function Documentation

◆ getChildsOfNode()

ilForumExplorerGUI::getChildsOfNode (   $a_parent_node_id)

{Get childs of node.

Parameters
string$a_parent_idparent node id
Returns
array childs
}

Reimplemented from ilExplorerBaseGUI.

Definition at line 133 of file class.ilForumExplorerGUI.php.

134 {
135 if($this->preloaded)
136 {
137 if(isset($this->preloaded_children[$a_parent_node_id]))
138 {
139 return $this->preloaded_children[$a_parent_node_id];
140 }
141 }
142
143 return $this->thread->getNestedSetPostChildren($a_parent_node_id, 1);
144 }

◆ getHTML()

ilForumExplorerGUI::getHTML ( )

{Get HTML.}

Reimplemented from ilExplorerBaseGUI.

Definition at line 259 of file class.ilForumExplorerGUI.php.

260 {
261 $this->preloadChildren();
262
263 if(isset($_GET['post_created_below']) && (int)$_GET['post_created_below'] > 0)
264 {
265 $parent = (int)$_GET['post_created_below'];
266 do
267 {
268 $this->setNodeOpen((int)$parent);
269 }
270 while($parent = $this->node_id_to_parent_node_id_map[$parent]);
271 }
272
273 $html = parent::getHTML();
274
275 $this->tpl->addOnLoadCode('il.ForumExplorer.init(' . json_encode(array(
276 'selectors' => array(
277 'container' => '#' . $this->getContainerId(),
278 'unlinked_content' => '.' . $this->getUnlinkedNodeContentClass()
279 )
280 )) . ');');
281
282 $this->tpl->addJavascript($this->js_explorer_frm_path);
283
284 return $html;
285 }
$_GET["client_id"]
getContainerId()
Get container id.
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour)
$html
Definition: example_001.php:87

References $_GET, $html, ilExplorerBaseGUI\getContainerId(), getUnlinkedNodeContentClass(), preloadChildren(), and ilExplorerBaseGUI\setNodeOpen().

+ Here is the call graph for this function:

◆ getNodeContent()

ilForumExplorerGUI::getNodeContent (   $a_node)

{Get content of a node.

Parameters
mixed$a_nodenode array or object
Returns
string content of the node
}

Reimplemented from ilExplorerBaseGUI.

Definition at line 167 of file class.ilForumExplorerGUI.php.

168 {
169 $tpl = $this->getNodeTemplateInstance();
170
171 $tpl->setCurrentBlock('node-content-block');
172 $tpl->setVariable('TITLE', $a_node['pos_subject']);
173 $tpl->setVariable('TITLE_CLASSES', implode(' ', $this->getNodeTitleClasses($a_node)));
174 $tpl->parseCurrentBlock();
175
176 require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php';
177 $authorinfo = new ilForumAuthorInformation(
178 $a_node['pos_author_id'],
179 $a_node['pos_display_user_id'],
180 $a_node['pos_usr_alias'],
181 $a_node['import_name']
182 );
183
184 $tpl->setCurrentBlock('unlinked-node-content-block');
185 $tpl->setVariable('UNLINKED_CONTENT_CLASS', $this->getUnlinkedNodeContentClass());
186 $tpl->setVariable('AUTHOR', $authorinfo->getAuthorShortName());
187 $tpl->setVariable('DATE', ilDatePresentation::formatDate(new ilDateTime($a_node['pos_date'], IL_CAL_DATETIME)));
188 $tpl->parseCurrentBlock();
189
190 return $tpl->get();
191 }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
getNodeTemplateInstance()
Factory method for a new instance of a node template.
getNodeTitleClasses(array $node_config)

References $tpl, ilDatePresentation\formatDate(), getNodeTemplateInstance(), getNodeTitleClasses(), getUnlinkedNodeContentClass(), and IL_CAL_DATETIME.

+ Here is the call graph for this function:

◆ getNodeHref()

ilForumExplorerGUI::getNodeHref (   $a_node)

{Get href for node.

Parameters
mixed$a_nodenode object/array
Returns
string href attribute
}

Reimplemented from ilExplorerBaseGUI.

Definition at line 220 of file class.ilForumExplorerGUI.php.

221 {
222 $this->ctrl->setParameter($this->parent_obj, 'backurl', null);
223 $this->ctrl->setParameter($this->parent_obj, 'pos_pk', $a_node['pos_pk']);
224
225 if(isset($a_node['counter']))
226 {
227 $this->ctrl->setParameter($this->parent_obj, 'offset', floor($a_node['counter'] / $this->max_entries) * $this->max_entries);
228 }
229
230 if(isset($a_node['post_read']) && $a_node['post_read'])
231 {
232 return $this->ctrl->getLinkTarget($this->parent_obj, $this->parent_cmd, $a_node['pos_pk']);
233 }
234 else
235 {
236 return $this->ctrl->getLinkTarget($this->parent_obj, 'markPostRead', $a_node['pos_pk']);
237 }
238 }

◆ getNodeIcon()

ilForumExplorerGUI::getNodeIcon (   $a_node)

{Get node icon path.

Parameters
mixed$a_nodenode object/array
Returns
string image file path
}

Reimplemented from ilExplorerBaseGUI.

Definition at line 251 of file class.ilForumExplorerGUI.php.

252 {
253 return ilObject::_getIcon(0, 'tiny', 'frm');
254 }
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.

References ilObject\_getIcon().

+ Here is the call graph for this function:

◆ getNodeId()

ilForumExplorerGUI::getNodeId (   $a_node)

{Get id of a node.

Parameters
mixed$a_nodenode array or object
Returns
string id of node
}

Reimplemented from ilExplorerBaseGUI.

Definition at line 243 of file class.ilForumExplorerGUI.php.

244 {
245 return $a_node['pos_pk'];
246 }

◆ getNodeTemplateInstance()

ilForumExplorerGUI::getNodeTemplateInstance ( )
protected

Factory method for a new instance of a node template.

Returns
ilTemplate

Definition at line 126 of file class.ilForumExplorerGUI.php.

126 {
127 return new ilTemplate('tpl.tree_node_content.html', true, true, 'Modules/Forum');
128 }
special template class to simplify handling of ITX/PEAR

Referenced by getNodeContent().

+ Here is the caller graph for this function:

◆ getNodeTitleClasses()

ilForumExplorerGUI::getNodeTitleClasses ( array  $node_config)
protected
Parameters
array$node_config
Returns
array

Definition at line 197 of file class.ilForumExplorerGUI.php.

198 {
199 $node_title_classes = array('ilForumTreeTitle');
200
201 if(isset($node_config['post_read']) && !$node_config['post_read'])
202 {
203 $node_title_classes[] = 'ilForumTreeTitleUnread';
204 }
205
206 return $node_title_classes;
207 }

Referenced by getNodeContent().

+ Here is the caller graph for this function:

◆ getRootNode()

ilForumExplorerGUI::getRootNode ( )

{Get root node.Please note that the class does not make any requirements how nodes are represented (array or object)

Returns
mixed root node object/array
}

Reimplemented from ilExplorerBaseGUI.

Definition at line 103 of file class.ilForumExplorerGUI.php.

104 {
105 if(null === $this->root_node)
106 {
107 $this->root_node = $this->thread->getFirstPostNode();
108 }
109
110 return array(
111 'pos_pk' => $this->root_node->getId(),
112 'pos_subject' => $this->root_node->getSubject(),
113 'pos_author_id' => $this->root_node->getPosAuthorId(),
114 'pos_display_user_id' => $this->root_node->getDisplayUserId(),
115 'pos_usr_alias' => $this->root_node->getUserAlias(),
116 'pos_date' => $this->root_node->getCreateDate(),
117 'import_name' => $this->root_node->getImportName(),
118 'post_read' => $this->root_node->isPostRead()
119 );
120 }

◆ getThread()

ilForumExplorerGUI::getThread ( )
Returns
ilForumTopic

Definition at line 83 of file class.ilForumExplorerGUI.php.

References $thread.

◆ getUnlinkedNodeContentClass()

ilForumExplorerGUI::getUnlinkedNodeContentClass ( )
protected
Returns
string

Definition at line 212 of file class.ilForumExplorerGUI.php.

213 {
214 return 'ilForumTreeUnlinkedContent';
215 }

Referenced by getHTML(), and getNodeContent().

+ Here is the caller graph for this function:

◆ preloadChildren()

ilForumExplorerGUI::preloadChildren ( )

Definition at line 149 of file class.ilForumExplorerGUI.php.

150 {
151 $this->preloaded_children = array();
152 $this->node_id_to_parent_node_id_map = array();
153
154 $children = $this->thread->getNestedSetPostChildren($this->root_node->getId());
155
156 array_walk($children, function(&$a_node, $key) {
157 $this->node_id_to_parent_node_id_map[(int)$a_node['pos_pk']] = (int)$a_node['parent_pos'];
158 $this->preloaded_children[(int)$a_node['parent_pos']][$a_node['pos_pk']] = $a_node;
159 });
160
161 $this->preloaded = true;
162 }

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ setThread()

ilForumExplorerGUI::setThread (   $thread)
Parameters
ilForumTopic$thread

Definition at line 91 of file class.ilForumExplorerGUI.php.

92 {
93 $this->thread = $thread;
94 $this->root_node = $thread->getFirstPostNode();
95 $this->root_node->setIsRead($this->root_node->isRead($this->root_node->getPosAuthorId()));
96
97 $this->ctrl->setParameter($this->parent_obj, 'thr_pk', $this->thread->getId());
98 }

References $thread.

Field Documentation

◆ $ctrl

ilForumExplorerGUI::$ctrl
protected

Definition at line 35 of file class.ilForumExplorerGUI.php.

◆ $js_explorer_frm_path

ilForumExplorerGUI::$js_explorer_frm_path = './Modules/Forum/js/ilForumExplorer.js'
protected

Definition at line 15 of file class.ilForumExplorerGUI.php.

◆ $max_entries

ilForumExplorerGUI::$max_entries = PHP_INT_MAX
protected

Definition at line 25 of file class.ilForumExplorerGUI.php.

◆ $node_id_to_parent_node_id_map

ilForumExplorerGUI::$node_id_to_parent_node_id_map = array()
protected

Definition at line 50 of file class.ilForumExplorerGUI.php.

◆ $preloaded

ilForumExplorerGUI::$preloaded = false
protected

Definition at line 40 of file class.ilForumExplorerGUI.php.

◆ $preloaded_children

ilForumExplorerGUI::$preloaded_children = array()
protected

Definition at line 45 of file class.ilForumExplorerGUI.php.

◆ $root_node

ilForumExplorerGUI::$root_node = null
protected

Definition at line 55 of file class.ilForumExplorerGUI.php.

◆ $thread

ilForumExplorerGUI::$thread
protected

Definition at line 20 of file class.ilForumExplorerGUI.php.

Referenced by getThread(), and setThread().

◆ $tpl

ilForumExplorerGUI::$tpl
protected

Definition at line 30 of file class.ilForumExplorerGUI.php.

Referenced by getNodeContent().


The documentation for this class was generated from the following file: