Пример #1
0
/**
 * Override or insert PHPTemplate variables into the templates.
 */
function rootcandy_preprocess_page(&$vars)
{
    // get secondary links
    $vars['tabs2'] = menu_secondary_local_tasks();
    // color.module integration
    if (module_exists('color')) {
        _color_page_alter($vars);
    }
    // notify users that they can change settings in theme settings
    $admin_theme = variable_get('admin_theme', 'garland');
    if (arg(0) == 'admin' and arg(1) == 'settings' and arg(2) == 'admin' and ($admin_theme == 'rootcandy' or $admin_theme == 'rootcandy_fixed' or $admin_theme == 'rootcandy_dark')) {
        $message = t('Thank you for using RootCandy.<br />Did you know, that Root Candy has advanced settings (Theme-specific settings fieldset)? You can change these settings at <a href="@configure-page">theme configuration page</a>.', array('@configure-page' => url('admin/build/themes/settings/' . $admin_theme)));
        $vars['messages'] .= '<div class="messages rootcandy">' . $message . '</div>';
        // display a warning message if the theme has not been enabled
        global $theme_info;
        if (!$theme_info->status) {
            $warning_message = t('RootCandy theme has not been enabled. You won\'t be able to see theme updates on update page! Please enable the theme on <a href="@themes-page">themes page</a>.', array('@themes-page' => url('admin/build/themes')));
            $vars['messages'] .= '<div class="messages warning">' . $warning_message . '</div>';
        }
    }
    if (arg(0) == 'admin' || ((arg(0) == 'node' and is_numeric(arg(1)) and arg(2) == 'edit') || (arg(0) == 'node' and arg(1) == 'add'))) {
        $vars['go_home'] = '<a href="' . url() . '">' . t('Go Back to Homepage') . '</a>';
    }
    // get theme settings
    $vars['hide_header'] = theme_get_setting('rootcandy_header_display');
    $vars['hide_panel'] = theme_get_setting('rootcandy_hide_panel');
    // append legal notice
    if (!theme_get_setting('rootcandy_hide_author')) {
        $vars['closure'] .= '<div id="legal-notice">Theme created by <a href="http://sotak.co.uk" rel="external">Marek Sotak</a></div>';
    }
    $vars['hide_content'] = '';
    // check whether help is disabled
    if (theme_get_setting('rootcandy_help_display')) {
        unset($vars['help']);
    }
    // dashboard
    if (arg(0) == 'admin' and !arg(1)) {
        if (!theme_get_setting('rootcandy_dashboard_display')) {
            $vars['dashboard'] = 1;
            // display help and messages in regions
            switch (theme_get_setting('rootcandy_dashboard_help')) {
                case 'left':
                    $vars['dashboard_left'] = $vars['help'] . $vars['dashboard_left'];
                    unset($vars['help']);
                    break;
                case 'right':
                    $vars['dashboard_right'] = $vars['help'] . $vars['dashboard_right'];
                    unset($vars['help']);
                    break;
            }
            switch (theme_get_setting('rootcandy_dashboard_messages')) {
                case 'left':
                    $vars['dashboard_left'] = $vars['messages'] . $vars['dashboard_left'];
                    unset($vars['messages']);
                    break;
                case 'right':
                    $vars['dashboard_right'] = $vars['messages'] . $vars['dashboard_right'];
                    unset($vars['messages']);
                    break;
            }
        }
        if (theme_get_setting('rootcandy_dashboard_content_display')) {
            $vars['hide_content'] = theme_get_setting('rootcandy_dashboard_content_display');
        }
    }
    $vars['panel_navigation'] = '<a id="open" class="open" href="#"><span class="panel-open">' . t('Open Panel') . '</span></a>';
    $vars['panel_navigation'] .= '<a id="close" style="display: none;" class="close" href="#"><span class="panel-close">' . t('Close Panel') . '</span></a>';
    $rootcandy_nav = _rootcandy_admin_navigation();
    $vars['rootcandy_navigation'] = $rootcandy_nav['navigation'];
    // get admin links into the region
    if (arg(0) == 'admin' and arg(2)) {
        $menu = menu_navigation_links($rootcandy_nav['menu'], $rootcandy_nav['level']);
        $menu_links = _rootcandy_links($menu, array('id' => 'rootcandy-menu'));
        if ($vars['language']->direction) {
            $vars['admin_right'] = $menu_links . $vars['admin_right'];
        } else {
            $vars['admin_left'] = $menu_links . $vars['admin_left'];
        }
    }
    $vars['body_class'] = rootcandy_body_class($vars['admin_left'], $vars['admin_right']);
    $icons_disabled = theme_get_setting('rootcandy_navigation_icons');
    $rootcandy_navigation_class = array();
    if (!$icons_disabled) {
        $rootcandy_navigation_class[] = 'i' . theme_get_setting('rootcandy_navigation_icons_size');
    }
    if (!$vars['hide_header']) {
        $rootcandy_navigation_class[] = 'header-on';
    }
    $vars['rootcandy_navigation_class'] = '';
    if ($rootcandy_navigation_class) {
        $vars['rootcandy_navigation_class'] .= ' ' . implode(' ', $rootcandy_navigation_class);
    }
    global $user;
    if ($user->uid) {
        $links[] = '<a href="' . url('user') . '" class="user-name">' . $user->name . '</a>';
        $links[] = '<a href="' . url('logout') . '">' . t('Logout') . '</a>';
        $links = implode(' | ', $links);
        $vars['rootcandy_user_links'] = $links;
    }
}
Пример #2
0
</title>
    <?php 
print $head;
?>
    <?php 
print $styles;
?>
    <?php 
print $scripts;
?>
  </head>
  <?php 
// get admin links into the region
if (arg(0) == 'admin' and arg(2)) {
    $menu = menu_navigation_links('navigation', 2);
    $menu_links = _rootcandy_links($menu, array('id' => 'rootcandy-menu'));
    if ($language->direction) {
        $admin_right = $menu_links . $admin_right;
    } else {
        $admin_left = $menu_links . $admin_left;
    }
}
?>
  <body<?php 
print rootcandy_body_class($admin_left, $admin_right);
?>
>

<!-- Layout -->
    <div id="page-wrapper"><div id="page-wrapper-content">
      <?php