ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilForumExplorer Class Reference

Class ilForumExplorer class for explorer view of forum posts. More...

+ Inheritance diagram for ilForumExplorer:
+ Collaboration diagram for ilForumExplorer:

Public Member Functions

 ilForumExplorer ($a_target, ilForumTopic $a_thread, $a_ref_id)
 Constructor public.
 setOutput ($a_parent, $a_depth=1)
 Creates output for explorer view in admin menue recursive method public.
 getOutput ()
 Creates output recursive method public.
 formatObject (&$tpl, $a_node_id, $a_option, $key)
 Creates output recursive method private.
 formatHeader (&$tpl)
 method to create a forum system specific header public
 createTarget ($a_type, $a_node_id)
 Creates Get Parameter private.
 setExpand ($a_node_id)
 set the expand option this value is stored in a SESSION variable to save it different view (lo view, frm view,...) private
 __readThreadSubject ()
- Public Member Functions inherited from ilExplorer
 ilExplorer ($a_target)
 Constructor public.
 initItemCounter ($a_number)
 Init item counter.
 setTitle ($a_val)
 Set title.
 getTitle ()
 Get title.
 setRoot ($a_root_id)
 Set root node.
 getRoot ()
 get root id
 setOrderColumn ($a_column)
 set the order column public
 setOrderDirection ($a_direction)
 set the order direction public
 setTargetGet ($a_target_get)
 set the varname in Get-string public
 setParamsGet ($a_params_get)
 set additional params to be passed in Get-string public
 setExpandTarget ($a_exp_target)
 target script for expand icons
 setFrameUpdater ($a_up_frame, $a_up_script, $a_params="")
 Set Explorer Updater.
 highlightNode ($a_id)
 set highlighted node
 checkPermissions ($a_check)
 check permissions via rbac
 setSessionExpandVariable ($a_var_name="expand")
 set name of expand session variable
 outputIcons ($a_icons)
 output icons
 setClickable ($a_type, $a_clickable)
 (de-)activates links for a certain object type
 isVisible ($a_ref_id, $a_type)
 isClickable ($a_type, $a_ref_id=0)
 check if links for certain object type are activated
 setPostSort ($a_sort)
 process post sorting
 setFilterMode ($a_mode=IL_FM_NEGATIVE)
 set filter mode
 getFilterMode ()
 get filter mode
 setUseStandardFrame ($a_val)
 Set use standard frame.
 getUseStandardFrame ()
 Get use standard explorer frame.
 setOutput ($a_parent_id, $a_depth=1, $a_obj_id=0, $a_highlighted_subtree=false)
 Creates output for explorer view in admin menue recursive method public.
 modifyChilds ($a_parent_id, $a_objects)
 showChilds ($a_parent_id)
 determines wether the childs of an object should be shown or not note: this standard implementation always returns true but it could be overwritten by derived classes (e.g.
 forceExpanded ($a_obj_id)
 force expansion of node
 handleListEndTags (&$a_tpl_tree, $a_cur_depth, $a_item_depth)
 handle list end tags ( and )
 handleListStartTags (&$a_tpl_tree, $a_cur_depth, $a_item_depth)
 handle list start tags (
 formatHeader (&$tpl, $a_obj_id, $a_option)
 Creates output for header (is empty here but can be overwritten in derived classes)
 getImage ($a_name, $a_type="", $a_obj_id="")
 get image path (may be overwritten by derived classes)
 getImageAlt ($a_default_text, $a_type="", $a_obj_id="")
 get image alt text
 getNodeStyleClass ($a_id, $a_type)
 get style class for node
 buildLinkTarget ($a_node_id, $a_type)
 get link target (may be overwritten by derived classes)
 buildOnClick ($a_node_id, $a_type, $a_title)
 get onclick event handling (may be overwritten by derived classes)
 buildTitle ($a_title, $a_id, $a_type)
 standard implementation for title, may be overwritten by derived classes
 buildDescription ($a_desc, $a_id, $a_type)
 standard implementation for description, may be overwritten by derived classes
 buildSelect ($a_node_id, $a_type)
 standard implementation for adding an option select box between image and title
 buildFrameTarget ($a_type, $a_child=0, $a_obj_id=0)
 get frame target (may be overwritten by derived classes)
 createTarget ($a_type, $a_node_id, $a_highlighted_subtree=false)
 Creates Get Parameter private.
 setFrameTarget ($a_target)
 set target frame or not frame?
 createLines ($a_depth)
 Creates lines for explorer view private.
 is_in_array ($a_start, $a_depth)
 DESCRIPTION MISSING private.
 getIndex ($a_data)
 get index of format_options array from specific ref_id,parent_id private
 addFilter ($a_item)
 adds item to the filter public
 delFilter ($a_item)
 removes item from the filter public
 forceExpandAll ($a_mode, $a_show_minus=true)
 force expandAll.
 setFiltered ($a_bool)
 active/deactivate the filter public
 checkFilter ($a_item)
 check if item is in filter private
 sortNodes ($a_nodes, $a_parent_obj_id)
 sort nodes and put adm object to the end of sorted array private

Data Fields

 $thread_id
 $thread_subject
 $root_id
 $forum
- Data Fields inherited from ilExplorer
 $ilias
 $output
 $format_options
 $tree
 $target
 $target_get
 $params_get
 $expanded
 $order_column
 $order_direction = "asc"
 $expand_target
 $rbac_check
 $output_icons
 $expand_variable
 $is_clickable
 $post_sort
 $filtered = false
 $filter_mode
 $expand_all = false
 $root_id = null
 $use_standard_frame = false

Private Attributes

 $objProperties = null
 ilForumProperties object private
 $objCurrentTopic = null

Detailed Description

Class ilForumExplorer class for explorer view of forum posts.

Author
Stefan Meyer smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Version
Id:
class.ilForumExplorer.php 21088 2009-08-15 22:51:43Z akill

Definition at line 37 of file class.ilForumExplorer.php.

Member Function Documentation

ilForumExplorer::__readThreadSubject ( )

Definition at line 442 of file class.ilForumExplorer.php.

References $ilDB.

Referenced by ilForumExplorer().

{
global $ilDB;
$this->thread_subject = $this->objCurrentTopic->getSubject();
}

+ Here is the caller graph for this function:

ilForumExplorer::createTarget (   $a_type,
  $a_node_id 
)

Creates Get Parameter private.

Parameters
string
integer
Returns
string

Definition at line 385 of file class.ilForumExplorer.php.

{
if (!isset($a_type) or !is_string($a_type) or !isset($a_node_id))
{
$this->ilias->raiseError(get_class($this)."::createTarget(): Missing parameter or wrong datatype! ".
"type: ".$a_type." node_id:".$a_node_id,$this->ilias->error_obj->WARNING);
}
list($tmp,$get) = explode("?",$this->target);
// SET expand parameter:
// positive if object is expanded
// negative if object is compressed
$a_node_id = $a_type == '+' ? $a_node_id : -(int) $a_node_id;
return $_SERVER["PATH_INFO"]."?".$get."&fexpand=".$a_node_id;
}
ilForumExplorer::formatHeader ( $tpl)

method to create a forum system specific header public

Parameters
integerobj_id
integerarray options
Returns
string

Definition at line 353 of file class.ilForumExplorer.php.

References $ilDB, ilExplorer\$ilias, $lng, $tpl, and ilUtil\getImagePath().

{
global $lng, $ilias, $ilDB;
$frm = new ilForum();
$frm->setMDB2WhereCondition('thr_pk = %s ', array('integer'), array($this->thread_id));
$threadData = $frm->getOneThread();
$tpl->setCurrentBlock("icon");
$tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_frm_s.gif"));
$tpl->setVariable("TXT_ALT_IMG", $lng->txt("obj_frm"));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("link");
$tpl->setVariable("TITLE", $a_option["title"]." ".$lng->txt("forums_thread").": ".$threadData["thr_subject"]);
//$tpl->setVariable("DESC", $lng->txt("from").": ".$a_option["loginname"]." [".$this->forum->convertDate($a_option["date"])."]");
$tpl->setVariable("TARGET","target=content");
$tpl->setVariable("LINK_TARGET",$this->target);
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("list_item");
$tpl->parseCurrentBlock();
$tpl->touchBlock("element");
}

+ Here is the call graph for this function:

ilForumExplorer::formatObject ( $tpl,
  $a_node_id,
  $a_option,
  $key 
)

Creates output recursive method private.

Parameters
integer
array
Returns
string

Reimplemented from ilExplorer.

Definition at line 244 of file class.ilForumExplorer.php.

References $key, $lng, ilExplorer\$target, $thread_id, $tpl, and ilUtil\getImagePath().

Referenced by getOutput().

{
global $lng,$ilUser;
if (!isset($a_node_id) or !is_array($a_option))
{
$this->ilias->raiseError(get_class($this)."::formatObject(): Missing parameter or wrong datatype! ".
"node_id: ".$a_node_id." options:".var_dump($a_option),$this->ilias->error_obj->WARNING);
}
if ($key == 0)
{
$tpl->setCurrentBlock("icon");
$tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_frm_s.gif"));
$tpl->setVariable("TXT_ALT_IMG", $lng->txt("obj_frm"));
$tpl->parseCurrentBlock();
}
/*
foreach ($a_option["tab"] as $picture)
{
if ($picture == 'plus')
{
$target = $this->createTarget('+',$a_node_id);
$tpl->setCurrentBlock("expander");
$tpl->setVariable("LINK_TARGET_EXPANDER", $target);
$tpl->setVariable("IMGPATH", ilUtil::getImagePath("browser/blank.gif"));
$tpl->parseCurrentBlock();
}
if ($picture == 'minus')
{
$target = $this->createTarget('-',$a_node_id);
$tpl->setCurrentBlock("expander");
$tpl->setVariable("LINK_TARGET_EXPANDER", $target);
$tpl->setVariable("IMGPATH", ilUtil::getImagePath("browser/blank.gif"));
$tpl->parseCurrentBlock();
}
if ($picture == 'blank' or $picture == 'winkel'
or $picture == 'hoch' or $picture == 'quer' or $picture == 'ecke')
{
$picture = 'blank';
$target = $_SERVER["REQUEST_URI"];
$tpl->setCurrentBlock("expander");
$tpl->setVariable("LINK_TARGET_EXPANDER", $target);
$tpl->setVariable("IMGPATH", ilUtil::getImagePath("browser/".$picture.".gif"));
//$tpl->setVariable("TXT_ALT_IMG", $lng->txt($a_option["desc"]));
$tpl->parseCurrentBlock();
}
}*/
$target = (strpos($this->target, "?") === false) ?
$this->target."?" : $this->target."&";
$tpl->setCurrentBlock("link");
$tpl->setVariable("LINK_TARGET", $target.$this->target_get."=".$a_node_id."#".$a_node_id);
#$a_option["title"] = strlen($a_option["title"]) <= FULLNAME_MAXLENGTH
# ? $a_option["title"]
# : substr($a_option["title"],0,FULLNAME_MAXLENGTH)."...";
if ($key == 0)
{
$tpl->setVariable("TITLE", "<strong>".$a_option["title"]."</strong>");
}
else
{
$tpl->setVariable("TITLE", $a_option["title"]);
}
if($ilUser->getId() == ANONYMOUS_USER_ID ||
$this->forum_obj->isRead($ilUser->getId(),$a_node_id))
{
$tpl->setVariable("A_CLASS",'class="postread"');
}
else
{
if($this->forum_obj->isNew($ilUser->getId(),$this->thread_id,$a_node_id))
{
$tpl->setVariable("A_CLASS",'class="postnew"');
}
else
{
$tpl->setVariable("A_CLASS",'class="postunread"');
}
$tpl->setVariable("ONCLICK",'onClick="this.className=\'postread\';"');
}
if ($this->frame_target != "")
{
$tpl->setVariable("TARGET", " target=\"".$this->frame_target."\"");
}
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("list_item");
$tpl->parseCurrentBlock();
$tpl->touchBlock("element");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilForumExplorer::getOutput ( )

Creates output recursive method public.

Returns
string

Reimplemented from ilExplorer.

Definition at line 189 of file class.ilForumExplorer.php.

References $key, $tpl, ilExplorer\createLines(), formatObject(), ilExplorer\handleListEndTags(), and ilExplorer\handleListStartTags().

{
global $tpl;
$first_node = $this->objCurrentTopic->getFirstPostNode();
$this->objCurrentTopic->setOrderField('frm_posts_tree.rgt');
$subtree_nodes = $this->objCurrentTopic->getPostTree($first_node);
if (count($subtree_nodes))
{
$this->format_options[0]['tab'] = array();
$depth = $this->forum->getPostMaximumDepth($this->thread_id);
for ($i = 0; $i < $depth; ++$i)
{
$this->createLines($i);
}
}
$tpl->addBlockFile('EXPLORER_TOP', 'exp_top', 'tpl.explorer_top.html');
// set global body class
$tpl->setBodyClass("il_Explorer");
$tpl_tree = new ilTemplate('tpl.tree.html', true, true);
if (count($subtree_nodes))
{
$cur_depth = -1;
foreach ($this->format_options as $key => $options)
{
// end tags
$this->handleListEndTags($tpl_tree, $cur_depth, $options['depth']);
// start tags
$this->handleListStartTags($tpl_tree, $cur_depth, $options['depth']);
$cur_depth = $options['depth'];
$this->formatObject($tpl_tree, $options['child'], $options, $key);
}
$this->handleListEndTags($tpl_tree, $cur_depth, -1);
}
return $tpl_tree->get();
}

+ Here is the call graph for this function:

ilForumExplorer::ilForumExplorer (   $a_target,
ilForumTopic  $a_thread,
  $a_ref_id 
)

Constructor public.

Parameters
stringscriptname

Definition at line 75 of file class.ilForumExplorer.php.

References $lng, __readThreadSubject(), ilForumTopic\getId(), ilForumProperties\getInstance(), ilObjectFactory\getInstanceByRefId(), and ilExplorer\ilExplorer().

{
global $lng;
$lng->loadLanguageModule('forum');
parent::ilExplorer($a_target);
$this->forum = new ilForum();
$this->forum_obj =& ilObjectFactory::getInstanceByRefId($a_ref_id);
$this->objProperties = ilForumProperties::getInstance($this->forum_obj->getId());
$this->objCurrentTopic = $a_thread;
$this->thread_id = $this->objCurrentTopic->getId();
$this->root_id = $this->objCurrentTopic->getFirstPostNode()->getId();
// max length of user fullname which is shown in explorer view
define(FULLNAME_MAXLENGTH, 16);
}

+ Here is the call graph for this function:

ilForumExplorer::setExpand (   $a_node_id)

set the expand option this value is stored in a SESSION variable to save it different view (lo view, frm view,...) private

Parameters
stringpipe-separated integer

Reimplemented from ilExplorer.

Definition at line 408 of file class.ilForumExplorer.php.

References $_SESSION, and $key.

{
$first_node = $this->objCurrentTopic->getFirstPostNode();
$_SESSION['fexpand'] = $_SESSION['fexpand'] ? $_SESSION['fexpand'] : array();
// if isn't set create session variable
if (empty($_SESSION['fexpand']) or !in_array($first_node->getId(), $_SESSION['fexpand']))
{
$all_nodes = $this->objCurrentTopic->getPostTree($first_node);
$tmp_array = array();
foreach ($all_nodes as $node)
{
$tmp_array[] = $node->getId();
}
$_SESSION['fexpand'] = array_merge($tmp_array, $_SESSION['fexpand']);
}
// if $_get['expand'] is positive => expand this node
if ($a_node_id > 0 && !in_array($a_node_id, $_SESSION['fexpand']))
{
array_push($_SESSION['fexpand'], $a_node_id);
}
// if $_get['expand'] is negative => compress this node
if ($a_node_id < 0)
{
$key = array_keys($_SESSION['fexpand'], -(int) $a_node_id);
unset($_SESSION['fexpand'][$key[0]]);
}
$this->expanded = $_SESSION['fexpand'];
}
ilForumExplorer::setOutput (   $a_parent,
  $a_depth = 1 
)

Creates output for explorer view in admin menue recursive method public.

Parameters
integerparent_node_id where to start from (default=0, 'root')
integerdepth level where to start (default=1)
Returns
string

Definition at line 106 of file class.ilForumExplorer.php.

References $_GET, $key, $lng, $tab, $title, ilForum\_isModerator(), and ilExplorer\getIndex().

{
global $lng,$ilUser;
static $counter = 0;
if (is_numeric($a_parent) && $objects = $this->objCurrentTopic->getPostChilds($a_parent, 'explorer'))
{
$tab = ++$a_depth - 2;
foreach ($objects as $key => $object)
{
if ($object['child'] != $this->root_id)
{
$parent_index = $this->getIndex($object);
}
$this->format_options[$counter]['parent'] = $object['parent'];
$this->format_options[$counter]['child'] = $object['child'];
$title = "<span style=\"white-space:nowrap;\" class=\"small\">".stripslashes($object['subject'])."</span>".
"<div style=\"white-space:nowrap; margin-bottom:5px;\" class=\"small\">";
if ($this->objProperties->isAnonymized())
{
if ($object['alias'] != '') $title .= stripslashes($object['alias']);
else $title .= $lng->txt('forums_anonymous');
}
else
{
$title .= stripslashes($object['loginname']);
}
$title .= ", ".$this->forum->convertDate($object['date'])."</div>";
$this->format_options[$counter]['title'] = $title;
$this->format_options[$counter]['type'] = $object['type'];
$this->format_options[$counter]['desc'] = 'forums_the_'.$object['type'];
$this->format_options[$counter]['depth'] = $tab;
$this->format_options[$counter]['container'] = false;
$this->format_options[$counter]['visible'] = true;
if (!$object['status'] && !ilForum::_isModerator($_GET['ref_id'], $ilUser->getId()))
{
$this->format_options[$counter]['visible'] = false;
}
// Create prefix array
for ($i = 0; $i < $tab; ++$i)
{
$this->format_options[$counter]['tab'][] = 'blank';
}
// only if parent is expanded and visible, object is visible
if ($object['child'] != $this->root_id && (!in_array($object['parent'], $this->expanded)
|| !$this->format_options[$parent_index]['visible']))
{
$this->format_options[$counter]['visible'] = true;
}
// if object exists parent is container
if ($object['child'] != $this->root_id)
{
$this->format_options[$parent_index]['container'] = true;
if (in_array($object['parent'], $this->expanded))
{
$this->format_options[$parent_index]['tab'][($tab - 2)] = 'minus';
}
else
{
$this->format_options[$parent_index]['tab'][($tab - 2)] = 'minus';
}
}
++$counter;
// Recursive
$this->setOutput($object['child'], $a_depth);
} //foreach
} //if
} //function

+ Here is the call graph for this function:

Field Documentation

ilForumExplorer::$forum

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

ilForumExplorer::$objCurrentTopic = null
private

Definition at line 68 of file class.ilForumExplorer.php.

ilForumExplorer::$objProperties = null
private

ilForumProperties object private

Definition at line 66 of file class.ilForumExplorer.php.

ilForumExplorer::$root_id

Definition at line 53 of file class.ilForumExplorer.php.

ilForumExplorer::$thread_id

Definition at line 44 of file class.ilForumExplorer.php.

Referenced by formatObject().

ilForumExplorer::$thread_subject

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


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