source: extensions/Contact1menu/main.inc.php @ 11516

Last change on this file since 11516 was 9418, checked in by ddtddt, 13 years ago

[extensions] - Contact1menu - bug

File size: 1.3 KB
Line 
1<?php
2/*
3Plugin Name: Contact 1 menu
4Version: 1
5Description: Add contact as menu level 1
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=479
7Author: ddtddt
8Author URI:http://piwigo.org
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13define('C1M_DIR' , basename(dirname(__FILE__)));
14define('C1M_PATH' , PHPWG_PLUGINS_PATH . C1M_DIR . '/');
15
16
17add_event_handler('blockmanager_register_blocks', 'register_c1m_menubar_blocks');
18add_event_handler('blockmanager_apply', 'c1m_apply');
19
20function register_c1m_menubar_blocks( $menu_ref_arr )
21{
22  $menu = & $menu_ref_arr[0];
23  if ($menu->get_id() != 'menubar')
24    return;
25  $menu->register_block( new RegisteredBlock( 'mbContact', 'Contact', 'C1M'));
26}
27
28function c1m_apply($menu_ref_arr)
29{
30  global $template;
31
32 $menu = & $menu_ref_arr[0];
33 
34 load_language('plugin.lang', CF_PATH);
35     // Envoi des données au template
36            $template->assign   (
37                array   (
38        'C1MTITLE'     => l10n('contact_form_title'),
39        'C1MNAME'      => l10n('contact_form'),
40        'C1MURL' => get_root_url().'index.php?/contact',
41                                )                       );
42
43   
44    if (($block = $menu->get_block( 'mbContact' )) != null) {
45        $template->set_template_dir(C1M_PATH.'template/');
46        $block->template = 'menubar_contact.tpl';
47    }
48}
49
50
51?>
Note: See TracBrowser for help on using the repository browser.