Merge "Eliminate dummy Language instances from being created"
[lhc/web/wiklou.git] / skins / Modern.php
1 <?php
2 /**
3 * Modern skin, derived from monobook template.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @todo document
21 * @file
22 * @ingroup Skins
23 */
24
25 if( !defined( 'MEDIAWIKI' ) )
26 die( -1 );
27
28 /**
29 * Inherit main code from SkinTemplate, set the CSS and template filter.
30 * @todo document
31 * @ingroup Skins
32 */
33 class SkinModern extends SkinTemplate {
34 var $skinname = 'modern', $stylename = 'modern',
35 $template = 'ModernTemplate', $useHeadElement = true;
36
37 /**
38 * @param $out OutputPage
39 */
40 function setupSkinUserCss( OutputPage $out ) {
41 parent::setupSkinUserCss( $out );
42 $out->addModuleStyles ('skins.modern');
43 }
44 }
45
46 /**
47 * @todo document
48 * @ingroup Skins
49 */
50 class ModernTemplate extends MonoBookTemplate {
51
52 /**
53 * Template filter callback for Modern skin.
54 * Takes an associative array of data set from a SkinTemplate-based
55 * class, and a wrapper for MediaWiki's localization database, and
56 * outputs a formatted page.
57 *
58 * @access private
59 */
60 function execute() {
61 // Suppress warnings to prevent notices about missing indexes in $this->data
62 wfSuppressWarnings();
63
64 $this->html( 'headelement' );
65 ?>
66
67 <!-- heading -->
68 <div id="mw_header"><h1 id="firstHeading" lang="<?php
69 $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageViewLanguage()->getCode();
70 $this->html( 'pageLanguage' );
71 ?>"><span dir="auto"><?php $this->html('title') ?></span></h1></div>
72
73 <div id="mw_main">
74 <div id="mw_contentwrapper">
75 <!-- navigation portlet -->
76 <?php $this->cactions(); ?>
77
78 <!-- content -->
79 <div id="mw_content" role="main">
80 <!-- contentholder does nothing by default, but it allows users to style the text inside
81 the content area without affecting the meaning of 'em' in #mw_content, which is used
82 for the margins -->
83 <div id="mw_contentholder" class="mw-body">
84 <div class='mw-topboxes'>
85 <div id="mw-js-message" style="display:none;"<?php $this->html('userlangattributes')?>></div>
86 <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div>
87 <?php if($this->data['newtalk'] ) {
88 ?><div class="usermessage mw-topbox"><?php $this->html('newtalk') ?></div>
89 <?php } ?>
90 <?php if($this->data['sitenotice']) {
91 ?><div class="mw-topbox" id="siteNotice"><?php $this->html('sitenotice') ?></div>
92 <?php } ?>
93 </div>
94
95 <div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html('subtitle') ?></div>
96
97 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
98 <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#mw_portlets"><?php $this->msg('jumptonavigation') ?></a><?php $this->msg( 'comma-separator' ) ?><a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
99
100 <?php $this->html('bodytext') ?>
101 <div class='mw_clear'></div>
102 <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
103 <?php $this->html ('dataAfterContent') ?>
104 </div><!-- mw_contentholder -->
105 </div><!-- mw_content -->
106 </div><!-- mw_contentwrapper -->
107
108 <div id="mw_portlets"<?php $this->html("userlangattributes") ?>>
109 <h2><?php $this->msg( 'navigation-heading' ) ?></h2>
110
111 <!-- portlets -->
112 <?php $this->renderPortals( $this->data['sidebar'] ); ?>
113
114 </div><!-- mw_portlets -->
115
116
117 </div><!-- main -->
118
119 <div class="mw_clear"></div>
120
121 <!-- personal portlet -->
122 <div class="portlet" id="p-personal" role="navigation">
123 <h3><?php $this->msg('personaltools') ?></h3>
124 <div class="pBody">
125 <ul>
126 <?php foreach($this->getPersonalTools() as $key => $item) { ?>
127 <?php echo $this->makeListItem($key, $item); ?>
128
129 <?php } ?>
130 </ul>
131 </div>
132 </div>
133
134
135 <!-- footer -->
136 <div id="footer" role="contentinfo"<?php $this->html('userlangattributes') ?>>
137 <ul id="f-list">
138 <?php
139 foreach( $this->getFooterLinks("flat") as $aLink ) {
140 if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
141 ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
142 <?php }
143 }
144 ?>
145 </ul>
146 <?php
147 foreach ( $this->getFooterIcons("nocopyright") as $blockName => $footerIcons ) { ?>
148 <div id="mw_<?php echo htmlspecialchars($blockName); ?>">
149 <?php
150 foreach ( $footerIcons as $icon ) { ?>
151 <?php echo $this->getSkin()->makeFooterIcon( $icon, 'withoutImage' ); ?>
152
153 <?php
154 } ?>
155 </div>
156 <?php
157 }
158 ?>
159 </div>
160
161 <?php $this->printTrail(); ?>
162 </body></html>
163 <?php
164 wfRestoreWarnings();
165 } // end of execute() method
166 } // end of class
167
168