1 | <?php /* |
---|
2 | Plugin Name: RV Menu Tree |
---|
3 | Version: 2.5.a |
---|
4 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=238 |
---|
5 | Description: Replaces the categories in the menu bar with a nicer one (javascript). |
---|
6 | Author: rvelices |
---|
7 | Author URI: http://www.modusoptimus.com |
---|
8 | */ |
---|
9 | |
---|
10 | add_event_handler('get_categories_menu_sql_where', 'rv_mt_get_categories_menu_sql_where', EVENT_HANDLER_PRIORITY_NEUTRAL, 3 ); |
---|
11 | |
---|
12 | function 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 | |
---|
31 | function 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 | ?> |
---|