ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilForumExplorerGUI Class Reference

Class ilForumExplorerGUI. More...

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

Public Member Functions

 __construct ($a_expl_id, $a_parent_obj, $a_parent_cmd)
 {} More...
 
 getThread ()
 
 setThread ($thread)
 
 getRootNode ()
 {} More...
 
 getChildsOfNode ($a_parent_node_id)
 {} More...
 
 preloadChildren ()
 
 getNodeContent ($a_node)
 {} More...
 
 getNodeHref ($a_node)
 {} More...
 
 getNodeId ($a_node)
 {} More...
 
 getNodeIcon ($a_node)
 {} More...
 
 getHTML ()
 {} More...
 
- Public Member Functions inherited from ilExplorerBaseGUI
 __construct ($a_expl_id, $a_parent_obj, $a_parent_cmd)
 Constructor. More...
 
 setMainTemplate (ilTemplate $a_main_tpl=null)
 Set main template (that is responsible for adding js/css) 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
 $log
 
 $ctrl
 
 $tpl
 
 $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 ($a_main_tpl=null)
 Init JS. More...
 
- Static Protected Attributes inherited from ilExplorerBaseGUI
static $js_tree_path = "./libs/bower/bower_components/jstree/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.

Constructor & Destructor Documentation

◆ __construct()

ilForumExplorerGUI::__construct (   $a_expl_id,
  $a_parent_obj,
  $a_parent_cmd 
)

{}

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

References $DIC, ilExplorerBaseGUI\setAjax(), and ilExplorerBaseGUI\setSkipRootNode().

61  {
62  global $DIC;
63 
64  parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd);
65 
66  $this->setSkipRootNode(false);
67  $this->setAjax(true);
68 
69  $this->tpl = $DIC->ui()->mainTemplate();
70  $this->ctrl = $DIC->ctrl();
71 
72  $frm = new ilForum();
73  $this->max_entries = (int) $frm->getPageHits();
74  }
Class Forum core functions for forum.
global $DIC
Definition: saml.php:7
setSkipRootNode($a_val)
Set skip root node.
+ Here is the call graph for this function:

Member Function Documentation

◆ getChildsOfNode()

ilForumExplorerGUI::getChildsOfNode (   $a_parent_node_id)

{}

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

130  {
131  if ($this->preloaded) {
132  if (isset($this->preloaded_children[$a_parent_node_id])) {
133  return $this->preloaded_children[$a_parent_node_id];
134  }
135  }
136 
137  return $this->thread->getNestedSetPostChildren($a_parent_node_id, 1);
138  }

◆ getHTML()

ilForumExplorerGUI::getHTML ( )

{}

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

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

249  {
250  $this->preloadChildren();
251 
252  if (isset($_GET['post_created_below']) && (int) $_GET['post_created_below'] > 0) {
253  $parent = (int) $_GET['post_created_below'];
254  do {
255  $this->setNodeOpen((int) $parent);
256  } while ($parent = $this->node_id_to_parent_node_id_map[$parent]);
257  }
258 
259  $html = parent::getHTML();
260 
261  $this->tpl->addOnLoadCode('il.ForumExplorer.init(' . json_encode(array(
262  'selectors' => array(
263  'container' => '#' . $this->getContainerId(),
264  'unlinked_content' => '.' . $this->getUnlinkedNodeContentClass()
265  )
266  )) . ');');
267 
268  $this->tpl->addJavascript($this->js_explorer_frm_path);
269 
270  return $html;
271  }
$_GET["client_id"]
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour) ...
Create styles array
The data for the language used.
$html
Definition: example_001.php:87
getContainerId()
Get container id.
+ Here is the call graph for this function:

◆ getNodeContent()

ilForumExplorerGUI::getNodeContent (   $a_node)

{}

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

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

162  {
163  $tpl = $this->getNodeTemplateInstance();
164 
165  $tpl->setCurrentBlock('node-content-block');
166  $tpl->setVariable('TITLE', $a_node['pos_subject']);
167  $tpl->setVariable('TITLE_CLASSES', implode(' ', $this->getNodeTitleClasses($a_node)));
168  $tpl->parseCurrentBlock();
169 
170  require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php';
171  $authorinfo = new ilForumAuthorInformation(
172  $a_node['pos_author_id'],
173  $a_node['pos_display_user_id'],
174  $a_node['pos_usr_alias'],
175  $a_node['import_name']
176  );
177 
178  $tpl->setCurrentBlock('unlinked-node-content-block');
179  $tpl->setVariable('UNLINKED_CONTENT_CLASS', $this->getUnlinkedNodeContentClass());
180  $tpl->setVariable('AUTHOR', $authorinfo->getAuthorShortName());
181  $tpl->setVariable('DATE', ilDatePresentation::formatDate(new ilDateTime($a_node['pos_date'], IL_CAL_DATETIME)));
182  $tpl->parseCurrentBlock();
183 
184  return $tpl->get();
185  }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
Date and time handling
getNodeTemplateInstance()
Factory method for a new instance of a node template.
getNodeTitleClasses(array $node_config)
+ Here is the call graph for this function:

◆ getNodeHref()

ilForumExplorerGUI::getNodeHref (   $a_node)

{}

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

214  {
215  $this->ctrl->setParameter($this->parent_obj, 'backurl', null);
216  $this->ctrl->setParameter($this->parent_obj, 'pos_pk', $a_node['pos_pk']);
217 
218  if (isset($a_node['counter'])) {
219  $this->ctrl->setParameter($this->parent_obj, 'offset', floor($a_node['counter'] / $this->max_entries) * $this->max_entries);
220  }
221 
222  if (isset($a_node['post_read']) && $a_node['post_read']) {
223  return $this->ctrl->getLinkTarget($this->parent_obj, $this->parent_cmd, $a_node['pos_pk']);
224  } else {
225  return $this->ctrl->getLinkTarget($this->parent_obj, 'markPostRead', $a_node['pos_pk']);
226  }
227  }

◆ getNodeIcon()

ilForumExplorerGUI::getNodeIcon (   $a_node)

{}

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

References ilObject\_getIcon().

241  {
242  return ilObject::_getIcon(0, 'tiny', 'frm');
243  }
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
+ Here is the call graph for this function:

◆ getNodeId()

ilForumExplorerGUI::getNodeId (   $a_node)

{}

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

233  {
234  return $a_node['pos_pk'];
235  }

◆ getNodeTemplateInstance()

ilForumExplorerGUI::getNodeTemplateInstance ( )
protected

Factory method for a new instance of a node template.

Returns
ilTemplate

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

Referenced by getNodeContent().

122  {
123  return new ilTemplate('tpl.tree_node_content.html', true, true, 'Modules/Forum');
124  }
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ getNodeTitleClasses()

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

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

References array.

Referenced by getNodeContent().

192  {
193  $node_title_classes = array('ilForumTreeTitle');
194 
195  if (isset($node_config['post_read']) && !$node_config['post_read']) {
196  $node_title_classes[] = 'ilForumTreeTitleUnread';
197  }
198 
199  return $node_title_classes;
200  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getRootNode()

ilForumExplorerGUI::getRootNode ( )

{}

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

References array.

100  {
101  if (null === $this->root_node) {
102  $this->root_node = $this->thread->getFirstPostNode();
103  }
104 
105  return array(
106  'pos_pk' => $this->root_node->getId(),
107  'pos_subject' => $this->root_node->getSubject(),
108  'pos_author_id' => $this->root_node->getPosAuthorId(),
109  'pos_display_user_id' => $this->root_node->getDisplayUserId(),
110  'pos_usr_alias' => $this->root_node->getUserAlias(),
111  'pos_date' => $this->root_node->getCreateDate(),
112  'import_name' => $this->root_node->getImportName(),
113  'post_read' => $this->root_node->isPostRead()
114  );
115  }
Create styles array
The data for the language used.

◆ getThread()

ilForumExplorerGUI::getThread ( )
Returns
ilForumTopic

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

References $thread.

80  {
81  return $this->thread;
82  }

◆ getUnlinkedNodeContentClass()

ilForumExplorerGUI::getUnlinkedNodeContentClass ( )
protected
Returns
string

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

Referenced by getHTML(), and getNodeContent().

206  {
207  return 'ilForumTreeUnlinkedContent';
208  }
+ Here is the caller graph for this function:

◆ preloadChildren()

ilForumExplorerGUI::preloadChildren ( )

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

References $key, and array.

Referenced by getHTML().

144  {
145  $this->preloaded_children = array();
146  $this->node_id_to_parent_node_id_map = array();
147 
148  $children = $this->thread->getNestedSetPostChildren($this->root_node->getId());
149 
150  array_walk($children, function (&$a_node, $key) {
151  $this->node_id_to_parent_node_id_map[(int) $a_node['pos_pk']] = (int) $a_node['parent_pos'];
152  $this->preloaded_children[(int) $a_node['parent_pos']][$a_node['pos_pk']] = $a_node;
153  });
154 
155  $this->preloaded = true;
156  }
Create styles array
The data for the language used.
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

◆ setThread()

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

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

References $thread.

Referenced by ilObjForumGUI\getForumObjects().

88  {
89  $this->thread = $thread;
90  $this->root_node = $thread->getFirstPostNode();
91  $this->root_node->setIsRead($this->root_node->isRead($this->root_node->getPosAuthorId()));
92 
93  $this->ctrl->setParameter($this->parent_obj, 'thr_pk', $this->thread->getId());
94  }
+ Here is the caller graph for this function:

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: