[3572] | 1 | <?php /* |
---|
| 2 | Plugin Name: RV Menu Tree |
---|
[18955] | 3 | Version: 2.5.a |
---|
[3590] | 4 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=238 |
---|
[3572] | 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 | { |
---|
[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] | 31 | function 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 | ?> |
---|