|
From: <dac...@us...> - 2007-09-02 03:58:50
|
Revision: 46
http://thevr.svn.sourceforge.net/thevr/?rev=46&view=rev
Author: dachebodt
Date: 2007-09-01 20:58:50 -0700 (Sat, 01 Sep 2007)
Log Message:
-----------
added main_menu_block
Added Paths:
-----------
mods/cms/trunk/modules/blocks/blocks/cms_main_menu.php
Added: mods/cms/trunk/modules/blocks/blocks/cms_main_menu.php
===================================================================
--- mods/cms/trunk/modules/blocks/blocks/cms_main_menu.php (rev 0)
+++ mods/cms/trunk/modules/blocks/blocks/cms_main_menu.php 2007-09-02 03:58:50 UTC (rev 46)
@@ -0,0 +1,145 @@
+<?php
+/**
+*
+* @package blocks
+* @version $Id: cms_calendar.php,v 1.38 2006/11/24 14:58:07 acydburn Exp $
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+function main_menu_block($data)
+{
+ global $mtemplate, $module, $phpbb_root_path, $phpEx, $user;
+
+ $current_id = $right_id = false;
+ $module_url = append_sid("{$phpbb_root_path}index.$phpEx");
+
+ // Make sure the module_url has a question mark set, effectively determining the delimiter to use
+ $delim = (strpos($module_url, '?') === false) ? '?' : '&';
+
+ $current_padding = $current_depth = 0;
+ $linear_offset = 'l_block1';
+ $tabular_offset = 't_block2';
+
+ // Generate the list of modules, we'll do this in two ways ...
+ // 1) In a linear fashion
+ // 2) In a combined tabbed + linear fashion ... tabs for the categories
+ // and a linear list for subcategories/items
+ foreach ($module->module_ary as $row_id => $item_ary)
+ {
+ // Skip hidden modules
+ if (!$item_ary['display'])
+ {
+ continue;
+ }
+
+ // Skip branch
+ if ($right_id !== false)
+ {
+ if ($item_ary['left'] < $right_id)
+ {
+ continue;
+ }
+
+ $right_id = false;
+ }
+
+ // Category with no members on their way down (we have to check every level)
+ if (!$item_ary['name'])
+ {
+ $empty_category = true;
+
+ // We go through the branch and look for an activated module
+ foreach (array_slice($module->module_ary, $row_id + 1) as $temp_row)
+ {
+ if ($temp_row['left'] > $item_ary['left'] && $temp_row['left'] < $item_ary['right'])
+ {
+ // Module there and displayed?
+ if ($temp_row['name'] && $temp_row['display'])
+ {
+ $empty_category = false;
+ break;
+ }
+ continue;
+ }
+ break;
+ }
+
+ // Skip the branch
+ if ($empty_category)
+ {
+ $right_id = $item_ary['right'];
+ continue;
+ }
+ }
+
+ // Select first id we can get
+ if (!$current_id && (in_array($item_ary['id'], array_keys($module->module_cache['parents'])) || $item_ary['id'] == $module->p_id))
+ {
+ $current_id = $item_ary['id'];
+ }
+
+ $depth = $item_ary['depth'];
+
+ if ($depth > $current_depth)
+ {
+ $linear_offset = $linear_offset . '.l_block' . ($depth + 1);
+ $tabular_offset = ($depth + 1 > 2) ? $tabular_offset . '.t_block' . ($depth + 1) : $tabular_offset;
+ }
+ else if ($depth < $current_depth)
+ {
+ for ($i = $current_depth - $depth; $i > 0; $i--)
+ {
+ $linear_offset = substr($linear_offset, 0, strrpos($linear_offset, '.'));
+ $tabular_offset = ($i + $depth > 1) ? substr($tabular_offset, 0, strrpos($tabular_offset, '.')) : $tabular_offset;
+ }
+ }
+
+ $u_title = $module_url . $delim . 'i=' . (($item_ary['cat']) ? $item_ary['id'] : $item_ary['name'] . (($item_ary['is_duplicate']) ? '&icat=' . $current_id : '') . '&mode=' . $item_ary['mode']);
+
+ // Was not allowed in categories before - /*!$item_ary['cat'] && */
+ $u_title .= (isset($item_ary['url_extra'])) ? $item_ary['url_extra'] : '';
+
+ // Only output a categories items if it's currently selected
+ if (!$depth || ($depth && (in_array($item_ary['parent'], array_values($module->module_cache['parents'])) || $item_ary['parent'] == $module->p_parent)))
+ {
+ $use_tabular_offset = (!$depth) ? 't_block1' : $tabular_offset;
+
+ $tpl_ary = array(
+ 'L_TITLE' => $item_ary['lang'],
+ 'S_SELECTED' => (in_array($item_ary['id'], array_keys($module->module_cache['parents'])) || $item_ary['id'] == $module->p_id) ? true : false,
+ 'U_TITLE' => $u_title
+ );
+
+ $mtemplate->assign_block_vars($use_tabular_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER)));
+ }
+
+ $tpl_ary = array(
+ 'L_TITLE' => $item_ary['lang'],
+ 'S_SELECTED' => (in_array($item_ary['id'], array_keys($module->module_cache['parents'])) || $item_ary['id'] == $module->p_id) ? true : false,
+ 'U_TITLE' => $u_title
+ );
+
+ $mtemplate->assign_block_vars($linear_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER)));
+
+ $current_depth = $depth;
+ }
+
+ $mtemplate->set_filenames(array(
+ 'content' => 'block_main_menu.html')
+ );
+
+ $block['TITLE'] = $user->lang['MENU'];
+ $block['CONTENT'] = $mtemplate->assign_display('content');
+
+ return $block;
+}
+
+function calendar_block_config()
+{
+ $block_config = array();
+
+ return $block_config;
+}
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|