28e918ee0046835e51cac334e35e964f961d1962
[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 /**
30 * Inherit main code from SkinTemplate, set the CSS and template filter.
31 * @todo document
32 * @ingroup Skins
33 */
34 class SkinModern extends SkinTemplate {
35 public $skinname = 'modern';
36 public $stylename = 'modern';
37 public $template = 'ModernTemplate';
38 public $useHeadElement = true;
39
40 /**
41 * @param OutputPage $out
42 */
43 function setupSkinUserCss( OutputPage $out ) {
44 parent::setupSkinUserCss( $out );
45 $out->addModuleStyles( 'skins.modern' );
46 }
47 }
48
49 /**
50 * @todo document
51 * @ingroup Skins
52 */
53 class ModernTemplate extends MonoBookTemplate {
54
55 /**
56 * Template filter callback for Modern skin.
57 * Takes an associative array of data set from a SkinTemplate-based
58 * class, and a wrapper for MediaWiki's localization database, and
59 * outputs a formatted page.
60 *
61 * @access private
62 */
63 function execute() {
64 // Suppress warnings to prevent notices about missing indexes in $this->data
65 wfSuppressWarnings();
66
67 $this->html( 'headelement' );
68 ?>
69
70 <!-- heading -->
71 <div id="mw_header"><h1 id="firstHeading" lang="<?php
72 $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode();
73 $this->text( 'pageLanguage' );
74 ?>"><span dir="auto"><?php $this->html( 'title' ) ?></span></h1></div>
75
76 <div id="mw_main">
77 <div id="mw_contentwrapper">
78 <!-- navigation portlet -->
79 <?php $this->cactions(); ?>
80
81 <!-- content -->
82 <div id="mw_content" role="main">
83 <!-- contentholder does nothing by default, but it allows users to style the text inside
84 the content area without affecting the meaning of 'em' in #mw_content, which is used
85 for the margins -->
86 <div id="mw_contentholder" class="mw-body">
87 <div class='mw-topboxes'>
88 <div id="mw-js-message" style="display:none;"<?php $this->html( 'userlangattributes' ) ?>></div>
89 <div class="mw-topbox" id="siteSub"><?php $this->msg( 'tagline' ) ?></div>
90 <?php
91 if ( $this->data['newtalk'] ) {
92 ?><div class="usermessage mw-topbox"><?php $this->html( 'newtalk' ) ?></div>
93 <?php
94 }
95 ?>
96 <?php
97 if ( $this->data['sitenotice'] ) {
98 ?><div class="mw-topbox" id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
99 <?php
100 }
101 ?>
102 </div>
103
104 <div id="contentSub"<?php
105 $this->html( 'userlangattributes' )
106 ?>><?php
107 $this->html( 'subtitle' )
108 ?></div>
109
110 <?php
111 if ( $this->data['undelete'] ) {
112 ?><div id="contentSub2"><?php $this->html( 'undelete' ) ?></div><?php
113 }
114 ?>
115 <div id="jump-to-nav"><?php $this->msg( 'jumpto' ) ?>
116 <a href="#mw_portlets"><?php
117 $this->msg( 'jumptonavigation' ) ?></a><?php $this->msg( 'comma-separator' )
118 ?>
119 <a href="#searchInput"><?php $this->msg( 'jumptosearch' ) ?></a>
120 </div>
121
122 <?php $this->html( 'bodytext' ) ?>
123 <div class='mw_clear'></div>
124 <?php
125 if ( $this->data['catlinks'] ) {
126 $this->html( 'catlinks' );
127 }
128 ?>
129 <?php $this->html( 'dataAfterContent' ) ?>
130 </div><!-- mw_contentholder -->
131 </div><!-- mw_content -->
132 </div><!-- mw_contentwrapper -->
133
134 <div id="mw_portlets"<?php $this->html( "userlangattributes" ) ?>>
135 <h2><?php $this->msg( 'navigation-heading' ) ?></h2>
136
137 <!-- portlets -->
138 <?php $this->renderPortals( $this->data['sidebar'] ); ?>
139
140 </div><!-- mw_portlets -->
141
142
143 </div><!-- main -->
144
145 <div class="mw_clear"></div>
146
147 <!-- personal portlet -->
148 <div class="portlet" id="p-personal" role="navigation">
149 <h3><?php $this->msg( 'personaltools' ) ?></h3>
150 <div class="pBody">
151 <ul>
152 <?php
153 foreach ( $this->getPersonalTools() as $key => $item ) { ?>
154 <?php echo $this->makeListItem( $key, $item ); ?>
155
156 <?php
157 }
158 ?>
159 </ul>
160 </div>
161 </div>
162
163
164 <!-- footer -->
165 <div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>>
166 <ul id="f-list">
167 <?php
168 foreach ( $this->getFooterLinks( "flat" ) as $aLink ) {
169 if ( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
170 ?> <li id="<?php echo $aLink ?>"><?php $this->html( $aLink ) ?></li>
171 <?php
172 }
173 }
174 ?>
175 </ul>
176 <?php
177 foreach ( $this->getFooterIcons( "nocopyright" ) as $blockName => $footerIcons ) { ?>
178 <div id="mw_<?php echo htmlspecialchars( $blockName ); ?>">
179 <?php
180 foreach ( $footerIcons as $icon ) { ?>
181 <?php echo $this->getSkin()->makeFooterIcon( $icon, 'withoutImage' ); ?>
182
183 <?php
184 } ?>
185 </div>
186 <?php
187 }
188 ?>
189 </div>
190
191 <?php $this->printTrail(); ?>
192 </body></html>
193 <?php
194 wfRestoreWarnings();
195 } // end of execute() method
196 } // end of class
197
198