Improve method documentation
[lhc/web/wiklou.git] / skins / Modern.php
1 <?php
2 /**
3 * Modern skin, derived from monobook template.
4 *
5 * @todo document
6 * @file
7 * @ingroup Skins
8 */
9
10 if( !defined( 'MEDIAWIKI' ) )
11 die( -1 );
12
13 require( dirname(__FILE__) . '/MonoBook.php' );
14
15 /**
16 * Inherit main code from SkinTemplate, set the CSS and template filter.
17 * @todo document
18 * @ingroup Skins
19 */
20 class SkinModern extends SkinTemplate {
21 var $skinname = 'modern', $stylename = 'modern',
22 $template = 'ModernTemplate', $useHeadElement = true;
23
24 function setupSkinUserCss( OutputPage $out ){
25 parent::setupSkinUserCss( $out );
26 $out->addModuleStyles ('skins.modern');
27 }
28 }
29
30 /**
31 * @todo document
32 * @ingroup Skins
33 */
34 class ModernTemplate extends MonoBookTemplate {
35
36 /**
37 * @var Skin
38 */
39 var $skin;
40 /**
41 * Template filter callback for Modern skin.
42 * Takes an associative array of data set from a SkinTemplate-based
43 * class, and a wrapper for MediaWiki's localization database, and
44 * outputs a formatted page.
45 *
46 * @access private
47 */
48 function execute() {
49 global $wgRequest;
50 $this->skin = $skin = $this->data['skin'];
51
52 // Suppress warnings to prevent notices about missing indexes in $this->data
53 wfSuppressWarnings();
54
55 $this->html( 'headelement' );
56 ?>
57
58 <!-- heading -->
59 <div id="mw_header"><h1 id="firstHeading"><?php $this->html('title') ?></h1></div>
60
61 <div id="mw_main">
62 <div id="mw_contentwrapper">
63 <!-- navigation portlet -->
64 <?php $this->cactions( $skin ); ?>
65
66 <!-- content -->
67 <div id="mw_content">
68 <!-- contentholder does nothing by default, but it allows users to style the text inside
69 the content area without affecting the meaning of 'em' in #mw_content, which is used
70 for the margins -->
71 <div id="mw_contentholder" <?php $this->html("specialpageattributes") ?>>
72 <div class='mw-topboxes'>
73 <div id="mw-js-message" style="display:none;"<?php $this->html('userlangattributes')?>></div>
74 <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div>
75 <?php if($this->data['newtalk'] ) {
76 ?><div class="usermessage mw-topbox"><?php $this->html('newtalk') ?></div>
77 <?php } ?>
78 <?php if($this->data['sitenotice']) {
79 ?><div class="mw-topbox" id="siteNotice"><?php $this->html('sitenotice') ?></div>
80 <?php } ?>
81 </div>
82
83 <div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html('subtitle') ?></div>
84
85 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
86 <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#mw_portlets"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
87
88 <?php $this->html('bodytext') ?>
89 <div class='mw_clear'></div>
90 <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
91 <?php $this->html ('dataAfterContent') ?>
92 </div><!-- mw_contentholder -->
93 </div><!-- mw_content -->
94 </div><!-- mw_contentwrapper -->
95
96 <div id="mw_portlets"<?php $this->html("userlangattributes") ?>>
97
98 <!-- portlets -->
99 <?php
100 $sidebar = $this->data['sidebar'];
101 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
102 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
103 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
104
105 foreach ($sidebar as $boxName => $cont) {
106 if ( $boxName == 'SEARCH' ) {
107 $this->searchBox();
108 } elseif ( $boxName == 'TOOLBOX' ) {
109 $this->toolbox();
110 } elseif ( $boxName == 'LANGUAGES' ) {
111 $this->languageBox();
112 } else {
113 $this->customBox( $boxName, $cont );
114 }
115 }
116 ?>
117
118 </div><!-- mw_portlets -->
119
120
121 </div><!-- main -->
122
123 <div class="mw_clear"></div>
124
125 <!-- personal portlet -->
126 <div class="portlet" id="p-personal">
127 <h5><?php $this->msg('personaltools') ?></h5>
128 <div class="pBody">
129 <ul>
130 <?php foreach($this->getPersonalTools() as $key => $item) { ?>
131 <?php echo $this->makeListItem($key, $item); ?>
132
133 <?php } ?>
134 </ul>
135 </div>
136 </div>
137
138
139 <!-- footer -->
140 <div id="footer"<?php $this->html('userlangattributes') ?>>
141 <ul id="f-list">
142 <?php
143 foreach( $this->getFooterLinks("flat") as $aLink ) {
144 if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
145 ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
146 <?php }
147 }
148 ?>
149 </ul>
150 <?php
151 foreach ( $this->getFooterIcons("nocopyright") as $blockName => $footerIcons ) { ?>
152 <div id="mw_<?php echo htmlspecialchars($blockName); ?>">
153 <?php
154 foreach ( $footerIcons as $icon ) { ?>
155 <?php echo $this->skin->makeFooterIcon( $icon, 'withoutImage' ); ?>
156
157 <?php
158 } ?>
159 </div>
160 <?php
161 }
162 ?>
163 </div>
164
165 <?php $this->printTrail(); ?>
166 </body></html>
167 <?php
168 wfRestoreWarnings();
169 } // end of execute() method
170 } // end of class
171
172