initial version
[BeagleSkin.git] / Beagle.php
blob23ceb8367732b2b525376dfbaf308408ffd0333d
1 <?php
2 /*
3 * Copyright (c) 2015 Marcin Cieślak (saper.info)
4 *
5 * This file is part of Beagle Skin for Mediawiki.
6 *
7 * Beagle skin is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * Beagle is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Beagle. If not, see <http://www.gnu.org/licenses/>.
22 /**
23 * Inherit main code from SkinTemplate, set the CSS and template filter.
24 * @ingroup Skins
26 class SkinBeagle extends SkinTemplate {
27 var $skinname = 'beagle', $stylename = 'beagle',
28 $template = 'BeagleTemplate', $useHeadElement = true;
30 public function initPage( OutputPage $out ) {
31 parent::initPage( $out );
33 /**
34 * Add CSS via ResourceLoader
36 * @param $out OutputPage
38 function setupSkinUserCss( OutputPage $out ) {
39 parent::setupSkinUserCss( $out );
40 $out->addModuleStyles( array(
41 'skins.beagle.css'
42 ) );
47 /**
48 * @todo document
49 * @addtogroup Skins
51 class BeagleTemplate extends BaseTemplate {
52 function execute() {
53 $skin = $this->getSkin();
54 $body = $this->data['bodycontent'];
56 $skin_path = $this->data['stylepath'].'/'.$this->data['stylename'];
58 // Suppress warnings to prevent notices about missing indexes in $this->data
59 wfSuppressWarnings();
61 // Output HTML Page
62 $this->html( 'headelement' );
63 $dd = $this->data;
64 unset( $dd[ 'headelement' ] );
65 unset( $dd[ 'bodycontent' ] );
66 unset( $dd[ 'skin' ] );
67 wfDebugLog( 'BeagleSkin', var_export( $dd, TRUE ) );
69 ?><!-- START main page container -->
70 <div id="pagecontainer">
72 <!-- START subsection header and subnav -->
73 <div id="header">
74 <h1>Beagle</h1>
75 </div>
76 <hr class="clear spacing" />
78 <?php
79 $sidebar = $this->getSidebar();
80 $content = $sidebar[ 'navigation' ][ 'content' ];
82 if ( is_array( $content ) ) : ?>
83 <ul id="nav-top"><?php
84 foreach( $content as $item ) {
85 print $this->makeListItem( $item[ 'id' ], $item );
86 } ?>
87 <li class="cheat"></li>
88 </ul><?php
89 endif; ?>
90 <div id="content">
92 <div id="content-body">
93 <div id="articleBody">
95 <a name="top" id="contentTop"></a>
96 <?php if( $this->data[ 'sitenotice' ]) : ?>
97 <div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div><?php endif; ?>
98 <div id="articleContent">
99 <div id="contentSub"><?php $this->html( 'subtitle' ) ?></div>
100 <?php if ( $this->data[ 'undelete' ] ) : ?>
101 <div id="contentSub2"><?php $this->html('undelete') ?></div>
102 <?php endif; ?>
103 <?php if ( $this->data[ 'newtalk' ] ) : ?>
104 <div id="usermessage"><?php $this->html('newtalk') ?></div>
105 <?php endif; ?>
106 <?php if($this->data['showjumplinks']) : ?>
107 <div id="jump-to-nav"><?php $this->msg( 'jumpto' ) ?> <a href="#nav_top"><?php $this->msg( 'jumptonavigation' ) ?></a>, <a href="#searchInput"><?php $this->msg( 'jumptosearch' ) ?></a></div>
108 <?php endif; ?>
109 <!-- START content -->
110 <?php $this->html( 'bodytext' ); ?>
111 <?php if( $this->data[ 'catlinks' ] ) { $this->html( 'catlinks' ); } ?>
113 <!-- END content -->
114 </div><!-- aricleContent -->
115 </div><!-- articleBody -->
116 </div><!-- content-body -->
117 <hr class="clear" />
118 <div id="article-info">
119 <?php if( $this->data[ 'lastmod' ] ) : ?>
120 <?php $this->html( 'lastmod' ) ?>
121 <?php endif; ?>
122 <?php if( $this->data[ 'viewcount' ] ) : ?>
123 <?php $this->html( 'viewcount' ) ?>
124 <?php endif; ?>
126 </div>
127 </div><!-- content -->
128 <hr class="clear dotted spacing" />
129 <?php $this->html( 'dataAfterContent' ); ?>
131 <ul class="nav-bottom">
132 <?php foreach( $this->getPersonalTools() as $key => $action ) {
133 print "\t" . $this->makeListItem( $key, $action ) . "\n";
134 } ?>
135 </ul>
137 <ul class="nav-bottom">
138 <?php foreach( $this->data[ 'content_actions' ] as $key => $action ) {
139 print "\t" . $this->makeListItem( $key, $action ) . "\n";
140 } ?>
141 </ul>
142 <?php if ( $this->data['language_urls'] ): ?>
143 <ul class="nav-bottom">
144 <?php foreach ( $this->data['language_urls'] as $key => $langLink ) {
145 print "\t" . $this->makeListItem( $key, $langLink ) . "\n";
146 } ?>
147 </ul>
148 <?php endif; ?>
150 <div class="searchForm">
151 <form id="searchForm" class="searchForm" name="searchForm" action="<?php $this->text('searchaction') ?>">
152 <input type="hidden" name="title" value="<?php $this->text( 'searchtitle' ) ?>" />
153 <?php print $this->makeSearchInput(); ?>
155 <?php print $this->makeSearchButton( 'go' ); ?>
157 <?php print $this->makeSearchButton( 'fulltext' ); ?>
159 </form>
160 </div>
162 <?php if( $this->data['notspecialpage'] ): ?>
163 <ul class="nav-bottom">
164 <?php
165 foreach( array( 'whatlinkshere', 'recentchanges', 'recentchangeslinked', 'upload', 'specialpages' ) as $special ) {
166 $d = array();
167 if ( $special === 'recentchanges' ) {
168 $d[ 'id' ] = 'nn-recentchanges';
169 $d[ 'text' ] = $this->getMsg( 'recentchanges' );
170 $rc = $this->getMsg( 'recentchanges-url' )->inContentLanguage()->text();
171 $title = Title::newFromText( $rc );
172 if ( $title ) {
173 $d[ 'href' ] = $title->getLinkURL();
174 } else {
175 unset($d);
177 } else {
178 $d = $this->data[ 'nav_urls' ][ $special ];
181 if ( $d )
182 print "\t" . $this->makeListItem( $special, $d ) . "\n";
183 }; ?>
184 </ul>
185 <?php endif; ?>
187 <div class="poweredby"><?php if ( $this->data['poweredbyico'] ) : ?>
188 <span id="footer-poweredbyico"><?php $this->html( 'poweredbyico' ) ?></span>
189 <?php endif; ?>
190 </div>
192 <div>
193 <hr class="clear dotted spacing" />
194 </div>
195 <?php $this->html( 'reporttime' ) ?>
196 <?php if ( $this->data['debug'] ): ?>
197 <!-- Debug output:
198 <?php $this->text( 'debug' ); ?>
201 <?php endif;
203 $this->printTrail(); ?>
204 </div>
206 </body>
207 </html><?php
208 wfRestoreWarnings();