Projet

Général

Profil

Paste
Télécharger (14,6 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / mayo / templates / page.tpl.php @ 70a4c29b

1
<?php
2

    
3
/**
4
 * @file
5
 * Default theme implementation to display a single Drupal page.
6
 *
7
 * Available variables:
8
 *
9
 * General utility variables:
10
 * - $base_path: The base URL path of the Drupal installation. At the very
11
 *   least, this will always default to /.
12
 * - $directory: The directory the template is located in, e.g. modules/system
13
 *   or themes/bartik.
14
 * - $is_front: TRUE if the current page is the front page.
15
 * - $logged_in: TRUE if the user is registered and signed in.
16
 * - $is_admin: TRUE if the user has permission to access administration pages.
17
 *
18
 * Site identity:
19
 * - $front_page: The URL of the front page. Use this instead of $base_path,
20
 *   when linking to the front page. This includes the language domain or
21
 *   prefix.
22
 * - $logo: The path to the logo image, as defined in theme configuration.
23
 * - $site_name: The name of the site, empty when display has been disabled
24
 *   in theme settings.
25
 * - $site_slogan: The slogan of the site, empty when display has been disabled
26
 *   in theme settings.
27
 *
28
 * Navigation:
29
 * - $main_menu (array): An array containing the Main menu links for the
30
 *   site, if they have been configured.
31
 * - $secondary_menu (array): An array containing the Secondary menu links for
32
 *   the site, if they have been configured.
33
 * - $breadcrumb: The breadcrumb trail for the current page.
34
 *
35
 * Page content (in order of occurrence in the default page.tpl.php):
36
 * - $title_prefix (array): An array containing additional output populated by
37
 *   modules, intended to be displayed in front of the main title tag that
38
 *   appears in the template.
39
 * - $title: The page title, for use in the actual HTML content.
40
 * - $title_suffix (array): An array containing additional output populated by
41
 *   modules, intended to be displayed after the main title tag that appears in
42
 *   the template.
43
 * - $messages: HTML for status and error messages. Should be displayed
44
 *   prominently.
45
 * - $tabs (array): Tabs linking to any sub-pages beneath the current page
46
 *   (e.g., the view and edit tabs when displaying a node).
47
 * - $action_links (array): Actions local to the page, such as 'Add menu' on the
48
 *   menu administration interface.
49
 * - $feed_icons: A string of all feed icons for the current page.
50
 * - $node: The node object, if there is an automatically-loaded node
51
 *   associated with the page, and the node ID is the second argument
52
 *   in the page's path (e.g. node/12345 and node/12345/revisions, but not
53
 *   comment/reply/12345).
54
 *
55
 * Regions:
56
 * - $page['help']: Dynamic help text, mostly for admin pages.
57
 * - $page['highlighted']: Items for the highlighted content region.
58
 * - $page['content']: The main content of the current page.
59
 * - $page['sidebar_first']: Items for the first sidebar.
60
 * - $page['sidebar_second']: Items for the second sidebar.
61
 * - $page['header']: Items for the header region.
62
 * - $page['footer']: Items for the footer region.
63
 *
64
 * @see template_preprocess()
65
 * @see template_preprocess_page()
66
 * @see template_process()
67
 */
68
?>
69

    
70
<?php
71
  $page_wrapper_style = '';
72
  $base_vmargin = theme_get_setting('base_vmargin');
73
  if (arg(0) == "admin") $base_vmargin = '0px'; // admin page
74
  if (empty($base_vmargin)) $base_vmargin = '0px';
75
  $page_wrapper_style .= ' margin-top: ' . $base_vmargin . '; margin-bottom: ' . $base_vmargin . ';';
76

    
77
  $page_style = '';
78
  $main_style = '';
79
  $layout_style = theme_get_setting('layout_style');
80
  $page_margin = theme_get_setting('page_margin');
81
  if (empty($page_margin)) $page_margin = '0px';
82
  if (arg(0) == "admin") $page_margin = '20px'; // admin page
83
  if ($layout_style == 1) {
84
    $page_style = 'padding: ' . $page_margin . ';';
85
  }
86
  else {
87
    $main_style = 'padding: 0px ' . $page_margin . '; box-sizing: border-box;';
88
  }
89

    
90
  $header_style = '';
91
  $header_height = theme_get_setting('header_height');
92
  if (!empty($header_height)) $header_style .= 'height: ' . $header_height . ';';
93
  $header_bg_file = check_url(theme_get_setting('header_bg_file'));
94
  if ($header_bg_file) {
95
    $header_style .= 'filter:;background: url(' . $header_bg_file . ') repeat ';
96
    $header_style .= theme_get_setting('header_bg_alignment') . ';';
97
  }
98
  if ($layout_style == 2 || $header_bg_file) {
99
    // no header margin, so skip header borders to make it nicer
100
    $header_style .= 'border: none;';
101
  }
102
  else {
103
    $header_border_width = theme_get_setting('header_border_width');
104
    $header_style .= 'border-width: ' . $header_border_width . ';';
105
  }
106

    
107
  $header_watermark_style = '';
108
  $header_watermark = theme_get_setting('header_watermark');
109
  if($header_watermark) {
110
    $header_watermark_style = 'background-image: url(' . file_create_url(drupal_get_path('theme', 'mayo') . '/images/pat-' . $header_watermark . '.png') . ');';
111
  }
112

    
113
  $logo_style = '';
114
  $logo_left_margin = theme_get_setting('logo_left_margin');
115
  if (empty($logo_left_margin)) $logo_left_margin = '0px';
116
  $logo_top_margin = theme_get_setting('logo_top_margin');
117
  if (empty($logo_top_margin)) $logo_top_margin = '0px';
118
  $logo_style = 'margin-left: ' . $logo_left_margin . '; margin-top: ' . $logo_top_margin . ';';
119

    
120
  $sitename_style = '';
121
  $sitename_left_margin = theme_get_setting('sitename_left_margin');
122
  if (empty($sitename_left_margin)) $sitename_left_margin = '0px';
123
  $sitename_top_margin = theme_get_setting('sitename_top_margin');
124
  if (empty($sitename_top_margin)) $sitename_top_margin = '0px';
125
  $sitename_style = 'margin-left: ' . $sitename_left_margin . '; margin-top: ' . $sitename_top_margin . ';';
126

    
127
  $searchbox_style = '';
128
  $searchbox_right_margin = theme_get_setting('searchbox_right_margin');
129
  if (empty($searchbox_right_margin)) $searchbox_right_margin = '0px';
130
  $searchbox_top_margin = theme_get_setting('searchbox_top_margin');
131
  if (empty($searchbox_top_margin)) $searchbox_top_margin = '0px';
132
  $searchbox_style = 'margin-right: ' . $searchbox_right_margin . '; margin-top: ' . $searchbox_top_margin . ';';
133

    
134
  $menubar_style = '';
135
  $menubar_bg_value = theme_get_setting('menubar_bg_value');
136
  if (theme_get_setting('menubar_background') == 1) $menubar_style = ' style=" background-color: ' . $menubar_bg_value . ';"';
137

    
138
  $fontsizer_top_margin = (intval($searchbox_top_margin) + 3) . 'px';
139
  $fontsizer_style = 'margin-top: ' . $fontsizer_top_margin . ';';
140

    
141
  if (theme_get_setting('header_fontsizer')) {
142
    drupal_add_js(drupal_get_path('theme', 'mayo') . '/js/mayo-fontsize.js');
143
  }
144
  if ($page['top_column_first'] ||
145
      $page['top_column_second'] ||
146
      $page['top_column_third'] ||
147
      $page['top_column_fourth'] ||
148
      $page['bottom_column_first'] ||
149
      $page['bottom_column_second'] ||
150
      $page['bottom_column_third'] ||
151
      $page['bottom_column_fourth'] ||
152
      $page['footer_column_first'] ||
153
      $page['footer_column_second'] ||
154
      $page['footer_column_third'] ||
155
      $page['footer_column_fourth']) {
156
    drupal_add_js(drupal_get_path('theme', 'mayo') . '/js/mayo-columns.js',
157
      array('type'=>'file',
158
        'scope'=>'footer',
159
      ));
160
  }
161
?>
162

    
163
<div id="page-wrapper" style="<?php echo $page_wrapper_style; ?>">
164
  <div id="page" style="<?php echo $page_style; ?>">
165

    
166
    <div id="header" style="<?php echo $header_style; ?>">
167
    <div id="header-watermark" style="<?php echo $header_watermark_style; ?>">
168
    <div class="section clearfix">
169

    
170
      <?php if ($logo): ?>
171
        <div id="logo" style="<?php echo $logo_style; ?>">
172
        <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home">
173
          <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
174
        </a>
175
        </div> <!-- /#logo -->
176
      <?php endif; ?>
177

    
178
      <?php if ($site_name || $site_slogan): ?>
179
        <div id="name-and-slogan" style="<?php echo $sitename_style; ?>">
180
          <?php if ($site_name): ?>
181
            <?php if ($title): ?>
182
              <div id="site-name"><strong>
183
                <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
184
              </strong></div>
185
            <?php else: /* Use h1 when the content title is empty */ ?>
186
              <h1 id="site-name">
187
                <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
188
              </h1>
189
            <?php endif; ?>
190
          <?php endif; ?>
191

    
192
          <?php if ($site_slogan): ?>
193
            <div id="site-slogan"><?php print $site_slogan; ?></div>
194
          <?php endif; ?>
195
        </div> <!-- /#name-and-slogan -->
196
      <?php endif; ?>
197

    
198
      <?php if ((theme_get_setting('header_searchbox')) && function_exists('search_box')) { ?>
199
        <div id="header-searchbox" style="<?php echo $searchbox_style; ?>">
200
      <?php  $output_form = drupal_get_form('search_block_form'); print render($output_form); ?>
201
        </div>
202
      <?php } ?>
203

    
204
      <?php if (theme_get_setting('header_fontsizer')) { ?>
205
        <div id="header-fontsizer" style="<?php echo $fontsizer_style; ?>">
206
        <a href="#" class="decreaseFont" title="Decrease text size"></a>
207
        <a href="#" class="resetFont"    title="Restore default text size"></a>
208
        <a href="#" class="increaseFont" title="Increase text size"></a>
209
        </div>
210
      <?php } ?>
211

    
212
      <div class="clearfix cfie"></div>
213

    
214
      <?php print render($page['header']); ?>
215

    
216
    </div> <!-- /.section -->
217
    </div> <!-- /#header-watermark -->
218
    </div> <!-- /#header -->
219

    
220
    <?php if ($main_menu || $secondary_menu) { ?>
221
      <div id="navigation"><div class="section">
222
        <?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix')))); ?>
223
        <?php print theme('links__system_secondary_menu', array('links' => $secondary_menu, 'attributes' => array('id' => 'secondary-menu', 'class' => array('links', 'inline', 'clearfix')))); ?>
224
      </div></div> <!-- /.section, /#navigation -->
225
    <?php } ?>
226

    
227
    <div class="clearfix cfie"></div>
228

    
229
    <!-- for nice_menus, superfish -->
230
    <?php if ($page['menubar']) { ?>
231
    <div id="menubar" class="menubar clearfix"<?php if(!empty($menubar_style)) echo $menubar_style; ?>>
232
      <?php print render($page['menubar']); ?>
233
    </div>
234
    <?php } ?>
235
    <?php if ($page['submenubar']) { ?>
236
    <div id="submenubar" class="menubar clearfix">
237
      <?php print render($page['submenubar']); ?>
238
    </div>
239
    <?php } ?>
240

    
241
    <!-- space between menus and contents -->
242
    <div class="spacer clearfix cfie"></div>
243

    
244

    
245
    <div id="main-wrapper">
246
    <div id="main" class="clearfix" style="<?php echo $main_style; ?>">
247

    
248
      <?php print $messages; ?>
249

    
250
      <?php if ($page['banner_top']) { ?>
251
      <div id="banner-top" class="banner clearfix"><?php print render($page['banner_top']); ?></div>
252
      <div class="spacer clearfix cfie"></div>
253
      <?php } ?>
254

    
255
      <?php if ($page['top_column_first'] | $page['top_column_second'] |
256
              $page['top_column_third'] | $page['top_column_fourth']) { ?>
257
      <div id="top-wrapper">
258
        <div id="top-columns" class="clearfix">
259
        <?php print mayo_build_columns( array(
260
            $page['top_column_first'],
261
            $page['top_column_second'],
262
            $page['top_column_third'],
263
            $page['top_column_fourth'],
264
          ));
265
        ?>
266
        </div> <!--/#top-columns -->
267
      </div> <!-- /#top-wrapper -->
268
      <?php } ?>
269

    
270
      <div class="clearfix cfie"></div>
271

    
272

    
273
      <!-- main content -->
274
      <div id="content" class="column"><div class="section">
275

    
276
        <?php if ($page['highlighted']) { ?>
277
          <div id="highlighted"><?php print render($page['highlighted']); ?></div>
278
        <?php } ?>
279

    
280
        <?php if ($breadcrumb && theme_get_setting('display_breadcrumb')) { ?>
281
          <div id="breadcrumb"><?php print $breadcrumb; ?></div>
282
        <?php } ?>
283

    
284
        <a id="main-content"></a>
285
        <?php print render($title_prefix); ?>
286
        <?php if ($title): ?><h1 class="title" id="page-title"><?php print $title; ?></h1><?php endif; ?>
287
        <?php print render($title_suffix); ?>
288
        <?php if ($tabs): ?><div class="tabs clearfix"><?php print render($tabs); ?></div><?php endif; ?>
289
        <?php print render($page['help']); ?>
290
        <?php if ($action_links): ?><ul class="action-links"><?php print render($action_links); ?></ul><?php endif; ?>
291
        <?php print render($page['content']); ?>
292
        <?php print $feed_icons; ?>
293

    
294
      </div></div> <!-- /.section, /#content -->
295

    
296
      <!-- sidebar (first) -->
297
      <?php if ($page['sidebar_first']){ ?>
298
        <div id="sidebar-first" class="column sidebar"><div class="section">
299
          <?php print render($page['sidebar_first']); ?>
300
        </div></div> <!-- /.section, /#sidebar-first -->
301
      <?php } ?>
302

    
303
      <!-- sidebar (second) -->
304
            <?php if ($page['sidebar_second']) { ?>
305
        <div id="sidebar-second" class="column sidebar"><div class="section">
306
          <?php print render($page['sidebar_second']); ?>
307
        </div></div> <!-- /.section, /#sidebar-second -->
308
      <?php } ?>
309

    
310

    
311
      <div class="clearfix cfie"></div>
312

    
313
      <?php if ($page['bottom_column_first'] | $page['bottom_column_second'] |
314
              $page['bottom_column_third'] | $page['bottom_column_fourth']) { ?>
315
      <div id="bottom-wrapper">
316
        <div id="bottom-columns" class="clearfix">
317
        <?php print mayo_build_columns( array(
318
            $page['bottom_column_first'],
319
            $page['bottom_column_second'],
320
            $page['bottom_column_third'],
321
            $page['bottom_column_fourth'],
322
          ));
323
        ?>
324
        </div> <!--/#bottom-columns -->
325
      </div> <!-- /#bottom-wrapper -->
326
      <?php } ?>
327

    
328
      <div class="clearfix cfie"></div>
329

    
330

    
331
      <?php if ($page['banner_bottom']) { ?>
332
      <div id="spacer" class="clearfix cfie"></div>
333
      <div id="banner-bottom" class="banner clearfix"><?php print render($page['banner_bottom']); ?></div>
334
      <?php } ?>
335

    
336
    </div> <!-- /#main -->
337
    </div> <!-- /#main-wrapper -->
338

    
339
    <!-- space between contents and footer -->
340
    <div id="spacer" class="clearfix cfie"></div>
341

    
342
    <div id="footer-wrapper">
343
      <?php if ($page['footer_column_first'] | $page['footer_column_second'] |
344
              $page['footer_column_third'] | $page['footer_column_fourth']) { ?>
345
      <div id="footer-columns" class="clearfix">
346
      <?php print mayo_build_columns( array(
347
          $page['footer_column_first'],
348
          $page['footer_column_second'],
349
          $page['footer_column_third'],
350
          $page['footer_column_fourth'],
351
        ));
352
      ?>
353
      </div> <!--/#footer-columns -->
354
      <?php } ?>
355

    
356
      <?php if ($page['footer']) { ?>
357
      <div id="footer"><div class="section">
358
        <?php print render($page['footer']); ?>
359
      </div></div> <!-- /.section, /#footer -->
360
      <?php } ?>
361

    
362
    </div> <!-- /#footer-wrapper -->
363
  </div> <!-- /#page -->
364
</div> <!-- /#page-wrapper -->