source: extensions/hr_os/themeconf.inc.php @ 10826

Last change on this file since 10826 was 10826, checked in by flop25, 13 years ago

adding an admin page for the header based on P@t's work

File size: 2.5 KB
Line 
1<?php
2/*
3Theme Name: hr_os
4Version: auto
5Description: A theme with an horizontal menu everywhere and a simple modern design
6Theme URI: http://fr.piwigo.org/ext/extension_view.php?eid=503
7Author: flop25
8Author URI: http://www.planete-flop.fr
9*/
10$themeconf = array(
11  'name'                                        => 'hr_os',
12  'parent'        => 'default',
13  'icon_dir'      => 'themes/hr_os/icon',
14  'mime_icon_dir' => 'themes/hr_os/icon/mimetypes/',
15  'local_head'          => 'local_head.tpl',
16  'activable'                   => true,
17        'add_menu_on_public_pages'                      => true,        # activation
18        'Exclude'                               => array('theNBMPage','thePopuphelpPage',),     # Excluded pages
19);
20@include(PHPWG_ROOT_PATH. 'local/config/hr_os.inc.php');
21if (isset($conf['local_dir_site']))
22{
23  @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/hr_os.inc.php');
24}
25// thx to P@t
26add_event_handler('loc_begin_page_header', 'set_hr_os_header');
27
28function set_hr_os_header()
29{
30  global $page, $conf, $template;
31
32  $config = unserialize($conf['hr_os']);
33
34  if (isset($page['body_id']) and $page['body_id'] == 'theCategoryPage')
35  {
36    $header = isset($page['category']) ? $config['categories'] : $config['home'];
37  }
38  elseif (isset($page['body_id']) and $page['body_id'] == 'thePicturePage')
39  {
40    $header = $config['picture'];
41  }
42  else
43  {
44    $header = $config['other'];
45  }
46
47  $template->assign('display_hr_os_banner', $header);
48}
49
50// thx to Vdigital and his plugin spreadmenus
51if ( !function_exists( 'add_menu_on_public_pages' ) ) {
52        if ( defined('IN_ADMIN') and IN_ADMIN ) return false;
53        add_event_handler('loc_after_page_header', 'add_menu_on_public_pages', 20);
54
55        function  add_menu_on_public_pages() {
56          if ( function_exists( 'initialize_menu') ) return false; # The current page has already the menu
57          if ( !get_themeconf('add_menu_on_public_pages') ) return false; # The current page has already the menu
58          global $template, $page, $conf;
59          if ( isset($page['body_id']) and in_array($page['body_id'], get_themeconf('Exclude')) ) return false;
60
61          $template->set_filenames(array(
62                'add_menu_on_public_pages' => dirname(__FILE__) . '/template/add_menu_on_public_pages.tpl',
63          ));
64          include_once(PHPWG_ROOT_PATH.'include/menubar.inc.php');
65          $template->parse('add_menu_on_public_pages');
66         
67          if (is_admin())
68                {
69          $template->assign(
70        'U_ADMIN', get_root_url().'admin.php?page=picture_modify'
71      .'&amp;cat_id='.(isset($page['category']) ? $page['category']['id'] : '')
72      .( isset($page['image_id']) ? '&amp;image_id='.$page['image_id'] : '')
73      );
74                }
75         
76        }
77}
78?>
Note: See TracBrowser for help on using the repository browser.