Projet

Général

Profil

Paste
Télécharger (16,3 ko) Statistiques
| Branche: | Révision:

root / htmltest / sites / all / themes / mayo / templates / page.tpl.php @ 6c38d829

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
  $page_width = theme_get_setting('page_width');
73
  if (empty($page_width)) $page_width = '90%';
74
  if (arg(0) == "admin") $page_width = '100%'; // admin page
75
  $page_wrapper_style = 'width: ' . $page_width . ';';
76
  $base_vmargin = theme_get_setting('base_vmargin');
77
  if (arg(0) == "admin") $base_vmargin = '0px'; // admin page
78
  if (empty($base_vmargin)) $base_vmargin = '0px';
79
  $page_wrapper_style .= ' margin-top: ' . $base_vmargin . '; margin-bottom: ' . $base_vmargin . ';';
80

    
81
  $page_style = '';
82
  $main_style = '';
83
  $layout_style = theme_get_setting('layout_style');
84
  $page_margin = theme_get_setting('page_margin');
85
  if (empty($page_margin)) $page_margin = '0px';
86
  if (arg(0) == "admin") $page_margin = '20px'; // admin page
87
  if ($layout_style == 1) {
88
    $page_style = 'padding: ' . $page_margin . ';';
89
  }
90
  else {
91
    $main_style = 'padding: 0px ' . $page_margin . ';';
92
  }
93

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

    
111
  $header_watermark_style = '';
112
  $header_watermark = theme_get_setting('header_watermark');
113
  if($header_watermark) {
114
    $header_watermark_style = 'background-image: url(/' . drupal_get_path('theme', 'mayo') . '/images/pat-' . $header_watermark . '.png);';
115
  }
116

    
117
  $logo_style = '';
118
  $logo_left_margin = theme_get_setting('logo_left_margin');
119
  if (empty($logo_left_margin)) $logo_left_margin = '0px';
120
  $logo_top_margin = theme_get_setting('logo_top_margin');
121
  if (empty($logo_top_margin)) $logo_top_margin = '0px';
122
  $logo_style = 'padding-left: ' . $logo_left_margin . '; padding-top: ' . $logo_top_margin . ';';
123

    
124
  $sitename_style = '';
125
  $sitename_left_margin = theme_get_setting('sitename_left_margin');
126
  if (empty($sitename_left_margin)) $sitename_left_margin = '0px';
127
  $sitename_top_margin = theme_get_setting('sitename_top_margin');
128
  if (empty($sitename_top_margin)) $sitename_top_margin = '0px';
129
  $sitename_style = 'padding-left: ' . $sitename_left_margin . '; padding-top: ' . $sitename_top_margin . ';';
130

    
131
  $searchbox_style = '';
132
  $searchbox_right_margin = theme_get_setting('searchbox_right_margin');
133
  if (empty($searchbox_right_margin)) $searchbox_right_margin = '0px';
134
  $searchbox_top_margin = theme_get_setting('searchbox_top_margin');
135
  if (empty($searchbox_top_margin)) $searchbox_top_margin = '0px';
136
  $searchbox_style = 'padding-right: ' . $searchbox_right_margin . '; padding-top: ' . $searchbox_top_margin . ';';
137

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

    
141
  $sb_layout_style = theme_get_setting('sidebar_layout_style');
142
  $sb_first_width = theme_get_setting('sidebar_first_width');
143
  if (empty($sb_first_width)) $sb_first_width = '25%';
144
  $sb_first_style = 'width: ' . $sb_first_width . ';';
145
  $sb_second_width = theme_get_setting('sidebar_second_width');
146
  if (empty($sb_second_width)) $sb_second_width = '25%';
147
  $sb_second_style = 'width: ' . $sb_second_width . ';';
148

    
149
  $content_width = 100;
150
  if ($page['sidebar_first']) {
151
    $content_width -= intval(preg_replace('/%/', '', $sb_first_width));
152
  }
153
  if ($page['sidebar_second']) {
154
    $content_width -= intval(preg_replace('/%/', '', $sb_second_width));
155
  }
156
  $content_style = 'width: ' . $content_width . '%;';
157

    
158
  $margins = mayo_get_margins($page['content'], $page['sidebar_first'], $page['sidebar_second']);
159
  $content_section_style = $margins['content'];
160
  $sb_first_section_style = $margins['sb_first'];
161
  $sb_second_section_style = $margins['sb_second'];
162

    
163
  if (theme_get_setting('header_fontsizer')) {
164
    drupal_add_js(drupal_get_path('theme', 'mayo') . '/js/mayo-fontsize.js');
165
  }
166
  if ($page['top_column_first'] ||
167
      $page['top_column_second'] ||
168
      $page['top_column_third'] ||
169
      $page['top_column_fourth'] ||
170
      $page['bottom_column_first'] ||
171
      $page['bottom_column_second'] ||
172
      $page['bottom_column_third'] ||
173
      $page['bottom_column_fourth']) {
174
    drupal_add_js(drupal_get_path('theme', 'mayo') . '/js/mayo-columns.js');
175
  }
176
?>
177

    
178
<div id="page-wrapper" style="<?php echo $page_wrapper_style; ?>">
179
  <div id="page" style="<?php echo $page_style; ?>">
180

    
181
    <div id="header" style="<?php echo $header_style; ?>">
182
    <div id="header-watermark" style="<?php echo $header_watermark_style; ?>">
183
    <div class="section clearfix">
184

    
185
      <?php if ($logo): ?>
186
        <div id="logo" style="<?php echo $logo_style; ?>">
187
        <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home">
188
          <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
189
        </a>
190
        </div> <!-- /#logo -->
191
      <?php endif; ?>
192

    
193
      <?php if ($site_name || $site_slogan): ?>
194
        <div id="name-and-slogan" style="<?php echo $sitename_style; ?>">
195
          <?php if ($site_name): ?>
196
            <?php if ($title): ?>
197
              <div id="site-name"><strong>
198
                <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
199
              </strong></div>
200
            <?php else: /* Use h1 when the content title is empty */ ?>
201
              <h1 id="site-name">
202
                <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
203
              </h1>
204
            <?php endif; ?>
205
          <?php endif; ?>
206

    
207
          <?php if ($site_slogan): ?>
208
            <div id="site-slogan"><?php print $site_slogan; ?></div>
209
          <?php endif; ?>
210
        </div> <!-- /#name-and-slogan -->
211
      <?php endif; ?>
212

    
213
      <?php if ((theme_get_setting('header_searchbox')) && function_exists('search_box')) { ?>
214
        <div id="header-searchbox" style="<?php echo $searchbox_style; ?>">
215
      <?php  $output_form = drupal_get_form('search_block_form'); print render($output_form); ?>
216
        </div>
217
      <?php } ?>
218

    
219
      <?php if (theme_get_setting('header_fontsizer')) { ?>
220
        <div id="header-fontsizer" style="<?php echo $fontsizer_style; ?>">
221
        <a href="#" class="decreaseFont" title="Decrease text size"></a>
222
        <a href="#" class="resetFont"    title="Restore default text size"></a>
223
        <a href="#" class="increaseFont" title="Increase text size"></a>
224
        </div>
225
      <?php } ?>
226

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

    
229
      <?php print render($page['header']); ?>
230

    
231
    </div> <!-- /.section -->
232
    </div> <!-- /#header-watermark -->
233
    </div> <!-- /#header -->
234

    
235
    <?php if ($main_menu || $secondary_menu) { ?>
236
      <div id="navigation"><div class="section">
237
        <?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix')))); ?>
238
        <?php print theme('links__system_secondary_menu', array('links' => $secondary_menu, 'attributes' => array('id' => 'secondary-menu', 'class' => array('links', 'inline', 'clearfix')))); ?>
239
      </div></div> <!-- /.section, /#navigation -->
240
    <?php } ?>
241

    
242
    <div class="clearfix cfie"></div>
243

    
244
    <!-- for nice_menus, superfish -->
245
    <?php if ($page['menubar']) { ?>
246
    <div id="menubar" class="menubar clearfix">
247
      <?php print render($page['menubar']); ?>
248
    </div>
249
    <?php } ?>
250
    <?php if ($page['submenubar']) { ?>
251
    <div id="submenubar" class="menubar clearfix">
252
      <?php print render($page['submenubar']); ?>
253
    </div>
254
    <?php } ?>
255

    
256
    <!-- space between menus and contents -->
257
    <div class="spacer clearfix cfie"></div>
258

    
259

    
260
    <div id="main-wrapper">
261
    <div id="main" class="clearfix" style="<?php echo $main_style; ?>">
262

    
263
      <?php print $messages; ?>
264

    
265
      <?php if ($page['banner_top']) { ?>
266
      <div id="banner-top" class="banner clearfix"><?php print render($page['banner_top']); ?></div>
267
      <div class="spacer clearfix cfie"></div>
268
      <?php } ?>
269

    
270
      <?php if ($page['top_column_first'] | $page['top_column_second'] |
271
              $page['top_column_third'] | $page['top_column_fourth']) { ?>
272
      <div id="top-wrapper">
273
        <div id="top-columns" class="clearfix">
274
        <?php print mayo_build_columns( array(
275
            $page['top_column_first'],
276
            $page['top_column_second'],
277
            $page['top_column_third'],
278
            $page['top_column_fourth'],
279
          ));
280
        ?>
281
        </div> <!--/#top-columns -->
282
      </div> <!-- /#top-wrapper -->
283
      <?php } ?>
284

    
285
      <div class="clearfix cfie"></div>
286

    
287

    
288
      <!-- sidebars (left) -->
289
      <?php if (($page['sidebar_first']) && ($sb_layout_style != 3)){ ?>
290
        <div id="sidebar-first" class="column sidebar" style="<?php echo $sb_first_style; ?>"><div class="section" style="<?php echo $sb_first_section_style; ?>">
291
          <?php print render($page['sidebar_first']); ?>
292
        </div></div> <!-- /.section, /#sidebar-first -->
293
      <?php } ?>
294
      <?php if (($page['sidebar_second']) && ($sb_layout_style == 2)) { ?>
295
        <div id="sidebar-second" class="column sidebar" style="<?php echo $sb_second_style; ?>"><div class="section" style="<?php echo $sb_second_section_style; ?>">
296
          <?php print render($page['sidebar_second']); ?>
297
        </div></div> <!-- /.section, /#sidebar-second -->
298
      <?php } ?>
299

    
300

    
301
      <!-- main content -->
302
      <div id="content" class="column" style="<?php echo $content_style; ?>"><div class="section" style="<?php echo $content_section_style; ?>">
303

    
304
        <?php if ($page['highlighted']) { ?>
305
          <div id="highlighted"><?php print render($page['highlighted']); ?></div>
306
        <?php } ?>
307

    
308
        <?php if ($breadcrumb && theme_get_setting('display_breadcrumb')) { ?>
309
          <div id="breadcrumb"><?php print $breadcrumb; ?></div>
310
        <?php } ?>
311

    
312
        <a id="main-content"></a>
313
        <?php print render($title_prefix); ?>
314
        <?php if ($title): ?><h1 class="title" id="page-title"><?php print $title; ?></h1><?php endif; ?>
315
        <?php print render($title_suffix); ?>
316
        <?php if ($tabs): ?><div class="tabs"><?php print render($tabs); ?></div><?php endif; ?>
317
        <?php print render($page['help']); ?>
318
        <?php if ($action_links): ?><ul class="action-links"><?php print render($action_links); ?></ul><?php endif; ?>
319
        <?php print render($page['content']); ?>
320
        <?php print $feed_icons; ?>
321

    
322
      </div></div> <!-- /.section, /#content -->
323

    
324

    
325
      <!-- sidebars (right) -->
326
      <?php if (($page['sidebar_first']) && ($sb_layout_style == 3)) { ?>
327
        <div id="sidebar-first-r" class="column sidebar" style="<?php echo $sb_first_style; ?>"><div class="section" style="<?php echo $sb_first_section_style; ?>">
328
          <?php print render($page['sidebar_first']); ?>
329
        </div></div> <!-- /.section, /#sidebar-first -->
330
      <?php } ?>
331
      <?php if (($page['sidebar_second']) && ($sb_layout_style != 2)) { ?>
332
        <div id="sidebar-second-r" class="column sidebar" style="<?php echo $sb_second_style; ?>"><div class="section" style="<?php echo $sb_second_section_style; ?>">
333
          <?php print render($page['sidebar_second']); ?>
334
        </div></div> <!-- /.section, /#sidebar-second -->
335
      <?php } ?>
336

    
337

    
338
      <div class="clearfix cfie"></div>
339

    
340
      <?php if ($page['bottom_column_first'] | $page['bottom_column_second'] |
341
              $page['bottom_column_third'] | $page['bottom_column_fourth']) { ?>
342
      <div id="bottom-wrapper">
343
        <div id="bottom-columns" class="clearfix">
344
        <?php print mayo_build_columns( array(
345
            $page['bottom_column_first'],
346
            $page['bottom_column_second'],
347
            $page['bottom_column_third'],
348
            $page['bottom_column_fourth'],
349
          ));
350
        ?>
351
        </div> <!--/#bottom-columns -->
352
      </div> <!-- /#bottom-wrapper -->
353
      <?php } ?>
354

    
355
      <div class="clearfix cfie"></div>
356

    
357

    
358
      <?php if ($page['banner_bottom']) { ?>
359
      <div id="spacer" class="clearfix cfie"></div>
360
      <div id="banner-bottom" class="banner clearfix"><?php print render($page['banner_bottom']); ?></div>
361
      <?php } ?>
362

    
363
    </div> <!-- /#main -->
364
    </div> <!-- /#main-wrapper -->
365

    
366
    <!-- space between contents and footer -->
367
    <div id="spacer" class="clearfix cfie"></div>
368

    
369
    <div id="footer-wrapper">
370
      <?php if ($page['footer_column_first'] | $page['footer_column_second'] |
371
              $page['footer_column_third'] | $page['footer_column_fourth']) { ?>
372
      <div id="footer-columns" class="clearfix">
373
      <?php print mayo_build_columns( array(
374
          $page['footer_column_first'],
375
          $page['footer_column_second'],
376
          $page['footer_column_third'],
377
          $page['footer_column_fourth'],
378
        ));
379
      ?>
380
      </div> <!--/#footer-columns -->
381
      <?php } ?>
382

    
383
      <?php if ($page['footer']) { ?>
384
      <div id="footer"><div class="section">
385
        <?php print render($page['footer']); ?>
386
      </div></div> <!-- /.section, /#footer -->
387
      <?php } ?>
388

    
389
    </div> <!-- /#footer-wrapper -->
390

    
391

    
392
  </div> <!-- /#page -->
393
</div> <!-- /#page-wrapper -->