Jump to content


[request] tree menù forum


  • You cannot reply to this topic
No replies to this topic

#1 il saggio

    Advanced Member

  • Members
  • PipPipPip
  • 39 posts

Posted 19 January 2009 - 12:16 PM

there is a block for a tree menù with the forum category?

<?php

/*
+---------------------------------------------
| Plugins for IPB Portal
| by ntd1712 (ntd1712@hotmail.com)
| Copyright (c) 2006
----------------------------------------------
| Date started: Feb 11, 2006
| Release data: Feb 11, 2006
+---------------------------------------------
*/

/**
* Portal Plug In Module
* This module adds more custom blocks for portal
* Each class name MUST be in the format of:
* ppi_{file_name_minus_dot_php}
*/

class ppi_custom_blocks
{
	var $ipsclass;
	var $portal_object = array();

	/*-------------------------------------------------------------------------*/
	// INIT
	/*-------------------------------------------------------------------------*/

	function init()
	{
		//
	}

	/*-------------------------------------------------------------------------*/
 	// CUSTOM BLOCKS
	/*-------------------------------------------------------------------------*/
 	
	# Forums Listing
	function forums_list()
	{
		if( ! $this->ipsclass->vars['forums_list'] ) return FALSE;
		return $this->ipsclass->compiled_templates['skin_uportal']->tmpl_forums_list( $this->forums_forum_tree() );
	}

	// forums_forum_tree
	function forums_forum_tree()
	{
		$collapsed_ids = ','.$this->ipsclass->my_getcookie('collapseprefs').',';
		$cache = $this->ipsclass->forums->forum_cache;

		if( is_array($cache['root']) && count($cache['root']) )
		{
			foreach( $cache['root'] as $id => $forum_data )
			{
				if ( $forum_data['sub_can_post'] || ( is_array($cache[ $forum_data['id'] ]) && count($cache[ $forum_data['id'] ]) ) )
				{
					$forum_data['div_fo'] = 'none';
					$forum_data['div_fc'] = 'show';

					if( strstr($collapsed_ids, ','.$forum_data['id'].',') )
					{
						$forum_data['div_fo'] = 'show';
						$forum_data['div_fc'] = 'none';
					}

					$depth_guide = "<div style='padding-top:1px; padding-bottom:2px;'>  <img src='style_images/portal_img/c_item.gif' border='0' alt='' />";

					$tree_string .= "<div style=\"padding-top:1px; padding-bottom:2px; display:{$forum_data['div_fc']};\" id=\"fc_{$forum_data['id']}\">";
					$tree_string .= "<a href=\"java script:togglecategory({$forum_data['id']},0);\"><img src='style_images/portal_img/c_col.gif' border='0' alt='' /></a> <a href='{$this->ipsclass->base_url}showforum=".$forum_data['id']."'><b>".$forum_data['name']."</b></a></div>";
					$tree_string .= "<div style=\"display:{$forum_data['div_fo']};\" id=\"fo_{$forum_data['id']}\">";
					$tree_string .= "<div style='padding-top:1px; padding-bottom:2px;'><a href=\"java script:togglecategory({$forum_data['id']},1);\"><img src='style_images/portal_img/c_exp.gif' border='0' alt='' /></a> <a href='{$this->ipsclass->base_url}showforum=".$forum_data['id']."'><b>".$forum_data['name']."</b></a></div>";

					if( is_array($cache[ $forum_data['id'] ]) )
					{
						foreach( $cache[ $forum_data['id'] ] as $id => $forum_data )
						{
							if ( $forum_data['sub_can_post'] || ( is_array($cache[ $forum_data['id'] ]) && count($cache[ $forum_data['id'] ]) ) )
							{
								$tree_string .= "<div style='padding-top:1px; padding-bottom:2px;'>  <img src='style_images/portal_img/c_item.gif' border='0' alt='' /><a href='{$this->ipsclass->base_url}showforum=".$forum_data['id']."'>".$forum_data['name']."</a></div>";
								$tree_string = $this->forums_forum_tree_internal( $forum_data['id'], $tree_string, $depth_guide );
							}
						}
					}

					$tree_string .= "</div>";
				}
			}
		}

		return $tree_string;
	}

	// forums_forum_tree_internal
	function forums_forum_tree_internal($root_id,$tree_string="",$depth_guide="")
	{
		$cache = $this->ipsclass->forums->forum_cache;
		if( is_array($cache[$root_id]) && count($cache[$root_id]) )
		{
			foreach( $cache[$root_id] as $id => $forum_data )
			{
				if ( $forum_data['sub_can_post'] || ( is_array($cache[ $forum_data['id'] ]) && count($cache[ $forum_data['id'] ]) ) )
				{
					$tree_string .= $depth_guide." <a href='{$this->ipsclass->base_url}showforum=".$forum_data['id']."'>".$forum_data['name']."</a></div>";
					$tree_string = $this->forums_forum_tree_internal( $forum_data['id'], $tree_string, $depth_guide );
				}
			}
		}

		return $tree_string;
	}
}

?>

	<div class='tablepad'>$list</div>
 <!--::forums_list::-->






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users