source: extensions/rv_menutree/trunk/main.inc.php @ 21189

Last change on this file since 21189 was 18955, checked in by rvelices, 12 years ago

rv_db_integrity, menutree and tscroller versions for piwigo 2.5

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 1.4 KB
Line 
1<?php /*
2Plugin Name: RV Menu Tree
3Version: 2.5.a
4Plugin URI: http://piwigo.org/ext/extension_view.php?eid=238
5Description: Replaces the categories in the menu bar with a nicer one (javascript).
6Author: rvelices
7Author URI: http://www.modusoptimus.com
8*/
9
10add_event_handler('get_categories_menu_sql_where', 'rv_mt_get_categories_menu_sql_where', EVENT_HANDLER_PRIORITY_NEUTRAL, 3 );
11
12function rv_mt_get_categories_menu_sql_where($where, $expand, $filter)
13{
14        add_event_handler('blockmanager_apply', 'rv_mt_menubar_categories');
15
16        if ($expand or $filter)
17                return $where;
18
19        global $page;
20        if ( !isset($page['category']) )
21                $where = 'id_uppercat IS NULL OR uppercats REGEXP \'^[0-9]+,[0-9]+$\'';
22        else
23        {
24                $where = 'id_uppercat is NULL
25  OR uppercats LIKE "'.$page['category']['upper_names'][0]['id'].',%"
26  OR uppercats REGEXP \'^[0-9]+,[0-9]+$\'';
27        }
28        return $where;
29}
30
31function rv_mt_menubar_categories($menu_ref_arr)
32{
33        $menu = & $menu_ref_arr[0];
34
35        if (($block = $menu->get_block('mbCategories')) != null)
36        {
37                global $template, $page;
38
39                $rvmt_base_name  = basename(dirname(__FILE__));
40                $template->set_template_dir(PHPWG_ROOT_PATH.'plugins/'.$rvmt_base_name.'/template/');
41                $template->assign(array(
42                        'RVMT_BASE_NAME' => $rvmt_base_name,
43                        'RVMT_UPPER_IDS' => isset($page['category']['uppercats']) ? array_flip( explode(',', $page['category']['uppercats'])) : null,
44                        )
45                );
46                $block->template = 'rv_menutree_categories.tpl';
47        }
48}
49?>
Note: See TracBrowser for help on using the repository browser.