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
RevLine 
[3572]1<?php /*
2Plugin Name: RV Menu Tree
[18955]3Version: 2.5.a
[3590]4Plugin URI: http://piwigo.org/ext/extension_view.php?eid=238
[3572]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{
[6389]14        add_event_handler('blockmanager_apply', 'rv_mt_menubar_categories');
[3572]15
[6408]16        if ($expand or $filter)
[3572]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
[6389]31function rv_mt_menubar_categories($menu_ref_arr)
[3572]32{
[6389]33        $menu = & $menu_ref_arr[0];
[3572]34
[6389]35        if (($block = $menu->get_block('mbCategories')) != null)
[3572]36        {
[6408]37                global $template, $page;
[3572]38
[7814]39                $rvmt_base_name  = basename(dirname(__FILE__));
40                $template->set_template_dir(PHPWG_ROOT_PATH.'plugins/'.$rvmt_base_name.'/template/');
[6413]41                $template->assign(array(
[7814]42                        'RVMT_BASE_NAME' => $rvmt_base_name,
[6413]43                        'RVMT_UPPER_IDS' => isset($page['category']['uppercats']) ? array_flip( explode(',', $page['category']['uppercats'])) : null,
[6389]44                        )
45                );
[6413]46                $block->template = 'rv_menutree_categories.tpl';
[3572]47        }
48}
49?>
Note: See TracBrowser for help on using the repository browser.