-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWikiToLearnSkin.php
1438 lines (1372 loc) · 64.4 KB
/
WikiToLearnSkin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* SQL Performance
* Right now Neverland does around 30 SQL queries for each page generation, this skin does around 46 queries per page render.
* 4 of these queries are done by generatePreviousAndNext
* 8 by the executeBreadcrumb function //TODO: improve performance
* The others by the hasCategory, getMessage and around the code
* Both hasCategory and getMessage were optimized to save some queries on average each.
* I don't know how big of an issue this is but if someone wants to investigate please do.
*/
require_once("HelperFunctions.php");
/**
* Skin file for skin WikiToLearnSkin
*
* @file
* @ingroup Skins
*/
/**
* Add the skin configuration settings to Special:Preferences.
*
* @param $user Object: current User object
* @param $defaultPreferences Object: Preferences object
* @return Boolean: true
*/
class WikiToLearnSkinHooks
{
public static function onGetPreferences( $user, &$defaultPreferences )
{
$default_font = ($user->getOption( 'skin-font' )!== null) ? $user->getOption( 'skin-font' ) : 'open-sans' ;
$defaultPreferences['skin-font'] = [
'label-message' => 'prefs-skin-font-label',
'type' => 'radio',
'options' => array(
'Default (Open Sans) ' => 'open-sans',
'Computer Modern Bright' => 'computer-modern-bright',
'Computer Modern Serif' => 'computer-modern-serif',
'Computer Modern Sans Serif' => 'computer-modern-sans-serif'
),
'default' => $default_font,
'section' => 'rendering/skin-font'
];
return true;
}
}
/**
* SkinTemplate class for WikiToLearnSkin skin
* @ingroup Skins
*/
class SkinWikiToLearnSkin extends SkinTemplate
{
var $skinname = 'wikitolearnskin', $stylename = 'WikiToLearnSkin',
$template = 'WikiToLearnSkinTemplate', $useHeadElement = true;
/**
* This function adds JavaScript via ResourceLoader
*
* Use this function if your skin has a JS file or files.
* Otherwise you won't need this function and you can safely delete it.
*
* @param OutputPage $out
*/
public function initPage( OutputPage $out )
{
global $wiki_domain;
if (getenv('WTL_PRODUCTION') === 1) {
$out->addHeadItem( "script", "<script async src='//www.google-analytics.com/analytics.js'></script>" );
}
parent::initPage( $out );
$out->addMeta( 'viewport', 'width=device-width, initial-scale=1' );
$out->addMeta( 'http:X-UA-Compatible', 'IE=edge' );
$out->addModules( 'skin.wikitolearn.js' );
$out->addModules('ext.courseEditor.publish');
if($out->getTitle()->isMainPage() ||
$this->getSkin()->getTitle()->getFullText() == wfMessage('wikitolearnskin-join-page') //join page
){
$out->addMeta("description", wfMessage('wikitolearnskin-meta-tag-description')->escaped());
$out->addMeta("twitter:description", wfMessage('wikitolearnskin-meta-tag-description')->escaped());
$this->addMetaProperty($out, "og:description", wfMessage('wikitolearnskin-meta-tag-description')->escaped());
$out->addMeta("twitter:title", "WikiToLearn - collaborative textbooks");
$this->addMetaProperty($out, "og:title", "WikiToLearn - collaborative textbooks");
}else{
$displayTitle = getDisplayTitle($out->getTitle(), $out->getHTMLTitle());
$out->addMeta("twitter:title", $displayTitle);
$this->addMetaProperty($out, "og:title", $displayTitle);
$this->addMetaProperty($out, "og:type", "article");
}
$this->addMetaProperty($out, "og:site_name", "WikiToLearn");
$out->addMeta("twitter:card",'summary');
$out->addMeta("twitter:site", '@WikiToLearn');
$out->addMeta("twitter:image", "http://www." . $wiki_domain . "/assets/v1/img/wikitolearn.jpg");
$this->addMetaProperty($out, "og:image", "http://www." . $wiki_domain . "/assets/v1/img/wikitolearn.jpg");
$this->addMetaProperty($out, "og:image:width", "500");
$this->addMetaProperty($out, "og:image:height", "500");
}
private function addMetaProperty($out, $property, $content){
$property = htmlspecialchars($property);
$content = htmlspecialchars($content);
$out->addHeadItem($property, "<meta property='$property' content='$content'/>");
}
/**
* Add CSS via ResourceLoader
*
* @param $out OutputPage
*/
function setupSkinUserCss( OutputPage $out )
{
parent::setupSkinUserCss( $out );
global $wgUser;
if ($wgUser->getOption( 'skin-font' ) !== 'open-sans' && !empty($wgUser->getOption( 'skin-font' ))) {
// If one of Computer Modern fonts get selected, add the web fonts
// Select which resource loader's module to load based on the selected preference
switch ($wgUser->getOption( 'skin-font' )) {
case 'computer-modern-bright':
$out->addModuleStyles( 'computer-modern-bright.wikitolearnskin' );
MWDebug::Log('Got Here');
break;
case 'computer-modern-serif':
$out->addModuleStyles( 'computer-modern-serif.wikitolearnskin' );
break;
case 'computer-modern-sans-serif':
$out->addModuleStyles( 'computer-modern-sans-serif.wikitolearnskin' );
break;
default:
$out->addModuleStyles( 'computer-modern-bright.wikitolearnskin' );
break;
}
} else {
$out->addModuleStyles( 'open-sans.wikitolearnskin' );
}
$out->addStyle("WikiToLearnSkin/bower_components/font-awesome/css/font-awesome.min.css");
$out->addModuleStyles( 'skin.wikitolearn' );
}
}
/**
* BaseTemplate class for WikiToLearnSkin skin
*
* @ingroup Skins
*/
class WikiToLearnSkinTemplate extends BaseTemplate {
/**
* Print the attributes given the string
* @param string $string
* @return string the attributes as a string
*/
public function getAttributesFromString($string)
{
return Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( $string ) );
}
/**
* Outputs the entire contents of the page
*/
public function execute()
{
//Declare useful variables for the whole template functions
global $wgOut, $wgRequest, $wgUser, $wgSupportedLanguages, $wiki_domain,
$wiki, $wgPiwikURL, $wgPiwikIDSite, $wgGoogleAnalyticsAccount,
$wgGoogleAnalyticsAnonymizeIP;
$this->skin = $this->getSkin();
$this->namespaceId = $wgOut->getTitle()->getNamespace();
$this->pageTitle = $wgOut->getTitle();
$this->user = $wgUser;
$this->contentNavigation = $this->data['content_navigation'];
$this->toolBox = $this->getToolbox();
$this->supportedLanguages = $wgSupportedLanguages;
$this->domain = $wiki_domain;
self::prepareOverrideMessages();
if($this->namespaceId != NS_SPECIAL && $this->namespaceId != NS_MEDIA){
$wikiPage = WikiPage::factory($this->pageTitle);
$this->pageText = $wikiPage->getText();
self::prepareCategory();
}
$this->html( 'headelement' );
$this->executeCookies(); ?>
<?php
$this->executeHeader();
if ($wiki != 'meta' && //TODO: allow configurable variable
$wiki != 'pool' &&
$this->getSkin()->getTitle()->isMainPage() &&
!$wgRequest->getText("action")) { //if an action is set we don't render the home page
MWDebug::log('Generating Homepage');
$this->executeHome();
} else if($this->isJoinPage()){
$this->executeJoinPage();
} else {
MWDebug::log('Generating Content page');
$this->executeContentPage();
}
$this->executeFooter();
if (getenv('WTL_PRODUCTION') == 1) {
setAnalytics($piwik = false, $wgPiwikURL, $wgPiwikIDSite, $wgGoogleAnalyticsAccount,
$wgGoogleAnalyticsAnonymizeIP);
}
$this->printTrail();
?>
</body>
</html>
<?php }
public function executeCookies() {
global $wiki_domain; ?>
<link rel="stylesheet" type="text/css" href="/skins/WikiToLearnSkin/bower_components/cookieconsent/build/cookieconsent.min.css">
<script type="text/javascript" src="/skins/WikiToLearnSkin/bower_components/cookieconsent/build/cookieconsent.min.js" async></script>
<script>
window.addEventListener("load", function(){
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "#ffffff",
"text": "#333333"
},
"button": {
"background": "#69b140",
"text": "#ffffff"
}
},
"content": {
"message":"<?php echo wfMessage('wikitolearnskin-cookies-text'); ?>",
"dismiss":"<?php echo wfMessage('wikitolearnskin-cookies-dismiss'); ?>",
"learnMore":"<?php echo wfMessage('wikitolearnskin-cookies-learn-more'); ?>",
"domain": "<?php echo $wiki_domain ?>"
}
})});
</script>
<?php
}
public function executeHeader() {
global $wiki, $wiki_domain?>
<header class="header">
<div class="header__wrapper" >
<div class="logo">
<a href="/">
<img class="logo__img" src="<?php echo $this->getImagePath("images/wikitolearn-logo.png") ?>">
<img class="logo__text" src="<?php echo $this->getImagePath("images/name.svg") ?>">
<?php
if (strpos($wiki_domain, 'wikitolearn-test.org') !== false)
echo "<span class='logo__subtitle'>dev</span>";
?>
</a>
</div>
<nav class="nav">
<span class="nav__search nav__<?php echo self::getAnonClass(); ?>">
<form id="searchForm" action="<?php $this->text( 'wgScript' ); ?>" autocomplete="off">
<input type="hidden" name="title" value="<?php $this->text( 'searchtitle' ) ?>" />
<?php echo $this->makeSearchInput( array( 'id' => 'searchInput' ) ); ?>
<button type="submit" class="nav__search-button">
<i class="fa fa-search"></i>
</button>
</form>
</span>
<a href="<?php echo $this->getMessage('wikitolearnskin-navbar-about-link'); ?>" class="nav__link nav__link--hover-red">
<?php echo $this->getMessage('wikitolearnskin-navbar-about'); ?>
</a>
<a href="//join.<?php echo $wiki_domain ."/" . $wiki ?>" class="nav__link nav__link--hover-yellow">
<?php echo $this->getMessage('wikitolearnskin-navbar-contribute'); ?>
</a>
<!-- -->
<div class="dropdown dropdown--more-links">
<a class="nav__link nav__link--hover-green" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<?php echo $this->getMessage('wikitolearnskin-navbar-tools'); ?>
</a>
<div class="dropdown-menu left">
<a href="<?php echo $this->getMessage('wikitolearnskin-navbar-tools-guide-link'); ?>" class="dropdown-item">
<i class="fa fa-fw fa-question-circle"></i> <?php echo $this->getMessage('wikitolearnskin-navbar-tools-guide'); ?>
</a>
<?php
$collectionTools = array_get($this->data['sidebar'], 'coll-print_export');
if(!is_null($collectionTools)) { ?>
<a href="<?php echo $collectionTools[0]['href'] ?>" class="dropdown-item">
<i class="fa fa-fw fa-book"></i> <?php echo $collectionTools[0]['text'] ?>
</a>
<?php } ?>
<div class="dropdown-divider"></div>
<a href="<?php echo wfMessage('wikitolearnskin-navbar-tools-chat-link')->plain(); ?>" class="dropdown-item">
<i class="fa fa-fw fa-comments"></i> <?php echo $this->getMessage('wikitolearnskin-navbar-tools-chat'); ?>
</a>
<a href="<?php echo $this->getMessage('wikitolearnskin-navbar-tools-community-portal-link'); ?>" class="dropdown-item">
<i class="fa fa-fw fa-users"></i> <?php echo $this->getMessage('wikitolearnskin-navbar-tools-community-portal'); ?>
</a>
<a href="<?php echo $this->getMessage('wikitolearnskin-navbar-tools-reports-link'); ?>" class="dropdown-item">
<i class="fa fa-fw fa-bar-chart"></i> <?php echo $this->getMessage('wikitolearnskin-navbar-tools-reports'); ?>
</a>
</div>
</div>
<?php
$user = $this->skin->getUser();
?>
<?php if($user->isAnon()){ ?>
<div class="nav__desktop-login">
<a href="<?php echo $this->skin->makeSpecialUrl('UserLogin'); ?>" class="nav__link nav__link--login nav__link--hover-mwblue dropdown-item">
<?php echo wfMessage( 'wikitolearnskin-navbar-login' ) ?>
</a>
<a href="<?php echo $this->skin->makeSpecialUrl('CreateAccount'); ?>" class="nav__link nav__link--createaccount nav__link--hover-mwblue dropdown-item">
<?php echo wfMessage( 'wikitolearnskin-navbar-createaccount' ) ?>
</a>
</div>
<div class="dropdown dropdown--mobile-login">
<a data-toggle="dropdown" id="dropdownMobileLogin" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-user"></i>
<i class="fa fa-angle-down"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMobileLogin">
<a href="<?php echo $this->skin->makeSpecialUrl('UserLogin'); ?>" class="nav__link nav__link--login nav__link--hover-mwblue dropdown-item">
<?php echo wfMessage( 'wikitolearnskin-navbar-login' ) ?>
</a>
<a href="<?php echo $this->skin->makeSpecialUrl('CreateAccount'); ?>" class="nav__link nav__link--createaccount nav__link--hover-mwblue dropdown-item">
<?php echo wfMessage( 'wikitolearnskin-navbar-createaccount' ) ?>
</a>
</div>
</div>
<?php } else { ?>
<div class="dropdown dropdown--personal-tools">
<a class="nav__link nav__link--hamburger nav__link--hover-mwblue" href="#" id="dropdownToolbox" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span><?php echo $user->getName() ?></span>
<i class="fa fa-bars"></i>
</a>
<div class="dropdown-menu dropdown--user-menu left" aria-labelledby="dropdownToolbox">
<?php
$toolbar = $this->getPersonalTools();
unset($toolbar['notifications-alert']);
unset($toolbar['notifications-notice']);
unset($toolbar['notifications-message']);
unset($toolbar['newmessages']);
foreach ( $toolbar as $key => $tool ) {
$tool['class'] = 'dropdown-item';
echo $this->makeListItem( $key, $tool, ["tag" => "span"] );
//$personalToolsCount++;
}
?>
<span class="dropdown-item languages__selector hidden-sm-up"><?php ?></span>
<hr class="languages__divider hidden-sm-up"></hr>
<div class="languages--mobile hidden-sm-up">
<span class="dropdown-item"><?php echo wfMessage( "wikitolearnskin-navbar-language-selector" );?></span>
<?php echo self::generateLanguageSelectorItems(); ?>
</div>
</div>
</div>
<div class="dropdown dropdown--notifications">
<a id="notifications" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-bell"></i> <span class="badge-count" class="badge" style="display:none;"> <i class="fa fa-angle-down"></i>
</a>
<div class="dropdown-menu" aria-labelledby="notifications">
<div class="dropdown-header">
<span class="dropdown--notifications__notifications-count"><?php echo wfMessage('notifications') ?> <span class="badge-count" class="badge" style="display:none;"></span></span>
<span>
<a href="#" id="mark-all-read-button" style="display:none;"><?php echo wfMessage('echo-mark-all-as-read') ?></a>
</span>
</div>
<div class="dropdown-divider"></div>
<div id="notifications-widget">
</div>
<div class="dropdown-divider"></div>
<div class="dropdown-footer">
<a id="notifications-view-all"><?php echo wfMessage('echo-overlay-link') ?></a>
</div>
</div>
</div>
<?php } ?>
<div class="dropdown dropdown--languages dropdown--languages__desktop languages__<?php echo self::getAnonClass(); ?>">
<a class="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-globe"></i> <i class="fa fa-angle-down"></i>
</a>
<div class="dropdown-menu left">
<?php self::generateLanguageSelectorItems(); ?>
</div>
</div>
</nav>
</div>
</header>
<?php }
public function executeHome() {
global $wiki_domain, $wiki;
?>
<main class="page page-home">
<section class="title">
<h1>
<?php echo $this->getMessage('wikitolearnskin-home-claim', false); ?>
</h1>
</section>
<section class="departments">
<ul class="departments__content">
<?php
$departmentsCount = intval($this->getMessage("wikitolearnskin-departments-count"));
echo "<div class='departments__row'>";
for($i = 1; $i < ($departmentsCount+1); $i++){
self::makeDepartment(
$this->getMessage("wikitolearnskin-departments-$i-name"),
$this->getImagePath( $this->getMessage("wikitolearnskin-departments-$i-image") ),
$this->getMessage("wikitolearnskin-departments-$i-link"),
$this->getMessage("wikitolearnskin-departments-$i-status")
);
if($i==(round($departmentsCount/2)) && $departmentsCount>5){
echo "</div>";
echo "<div class='departments__row'>";
}
}
echo "</div>";
echo '<div class="clearfix"></div>';
?>
</ul>
</section>
<section class="howto">
<div class="howto__content">
<div class="howto__left">
<div class="howto__point" data-image-name="edit">
<div class="howto__title">
<i class="fa fa-pencil text-wtl--red"></i>
<?php echo $this->getMessage('wikitolearnskin-home-howto-edit-title'); ?>
</div>
<div class="howto__description">
<?php echo $this->getMessage('wikitolearnskin-home-howto-edit-description'); ?>
</div>
</div>
<div class="howto__point howto__point--faded" data-image-name="book">
<div class="howto__title">
<i class="fa fa-book text-wtl--yellow"></i>
<?php echo $this->getMessage('wikitolearnskin-home-howto-book-title'); ?>
</div>
<div class="howto__description">
<?php echo $this->getMessage('wikitolearnskin-home-howto-book-description'); ?>
</div>
</div>
<div class="howto__point howto__point--faded" data-image-name="awards">
<div class="howto__title">
<i class="fa fa-star text-wtl--green"></i>
<?php echo $this->getMessage('wikitolearnskin-home-howto-awards-title'); ?>
</div>
<div class="howto__description">
<?php echo $this->getMessage('wikitolearnskin-home-howto-awards-description'); ?>
</div>
</div>
</div>
<div class="howto__right">
</div>
</div>
</section>
<section class="media">
<div class="media__content">
<div class="media__videocolumn">
<div class="media__videowrapper">
<iframe class="media__video" src="<?php echo $this->getMessage('wikitolearnskin-media-video-url'); ?>" allowfullscreen></iframe>
</div>
</div>
<div class="media__description">
<div class="join-us__content">
<h3 class="join-us__text">
<?php echo $this->getMessage('wikitolearnskin-media-text'); ?>
</h3>
<div class="join-us__stats">
<div class="stats__wrapper">
<?php
echo "<i class='fa fa-file-text-o'></i> <span class='stats__count'>" . wfMessage('createacct-benefit-head2')->text() . "</span> " . wfMessage('createacct-benefit-body2')->text();
echo " <br/>";
echo "<i class='fa fa-user'></i> <span class='stats__count'>" . wfMessage('createacct-benefit-head3')->text() . "</span> " . wfMessage('createacct-benefit-body3')->text();
echo " <br/>";
echo "<i class='fa fa-pencil'></i> <span class='stats__count'>" . wfMessage('createacct-benefit-head1')->text() . "</span> " . wfMessage('createacct-benefit-body1')->text();
?>
</div>
<br>
<?php echo "<a class='join-us__report' href=". $this->getMessage('wikitolearnskin-latest-report-link'). ">" . $this->getMessage('wikitolearnskin-latest-report-text') . "</a>"; ?>
</div>
<a href="//join.<?php echo $wiki_domain ."/" . $wiki ?>" class="join-us__link"><?php echo $this->getMessage('wikitolearnskin-join-us-button'); ?></a>
</div>
</div>
</div>
</section>
<section class="testimonials">
<div class="testimonials__content">
<div class="testimonial">
<div class="testimonial__link">
<img class="testimonial__image" src="<?php echo $this->getImagePath( $this->getMessage('wikitolearnskin-testimonials-first-image-path') ); ?>" alt="<?php echo $this->getMessage('wikitolearnskin-testimonials-first-name'); ?>">
</div>
<div class="testimonial__body">
<blockquote class="testimonial__quote">
<?php echo $this->getMessage('wikitolearnskin-testimonials-first-quote'); ?>
</blockquote>
<footer class="testimonial__footer">
<cite> <?php echo $this->getMessage('wikitolearnskin-testimonials-first-name'); ?></cite>
</footer>
</div>
</div>
<div class="testimonial">
<div class="testimonial__link">
<img class="testimonial__image" src="<?php echo $this->getImagePath( $this->getMessage('wikitolearnskin-testimonials-second-image-path') ); ?>" alt="<?php echo $this->getMessage('wikitolearnskin-testimonials-second-name'); ?>">
</div>
<div class="testimonial__body">
<blockquote class="testimonial__quote">
<?php echo $this->getMessage('wikitolearnskin-testimonials-second-quote'); ?>
</blockquote>
<footer class="testimonial__footer">
<cite><?php echo $this->getMessage('wikitolearnskin-testimonials-second-name'); ?></cite>
</footer>
</div>
</div>
<div class="testimonial">
<div class="testimonial__link">
<img class="testimonial__image" src="<?php echo $this->getImagePath( $this->getMessage('wikitolearnskin-testimonials-third-image-path') ); ?>" alt="<?php echo $this->getMessage('wikitolearnskin-testimonials-third-name'); ?>">
</div>
<div class="testimonial__body">
<blockquote class="testimonial__quote">
<?php echo $this->getMessage('wikitolearnskin-testimonials-third-quote'); ?>
</blockquote>
<footer class="testimonial__footer">
<cite><?php echo $this->getMessage('wikitolearnskin-testimonials-third-name'); ?></cite>
</footer>
</div>
</div>
<!--<a href="<?php echo wfMessage('wikitolearnskin-read-more-stories-button-link')->plain(); ?>" class="testimonials__read-more"><?php echo wfMessage('wikitolearnskin-read-more-stories-button'); ?></a>-->
</div>
</section>
<section class="contributors">
<div class="contributors__content">
<h3 class="contributors__title"><?php echo wfMessage('wikitolearnskin-contributions-from'); ?></h3>
<ul class="contributors__list">
<?php
for ($i=1; $i < 7; $i++) { ?>
<a target="_blank" href="<?php echo $this->getMessage("wikitolearnskin-contributors-$i-link"); ?>" rel="nofollow" class="contributors__item"><img src="<?php echo $this->getImagePath($this->getMessage("wikitolearnskin-contributors-$i-image")); ?>" alt=""></a>
<?php } ?>
</ul>
</div>
</section>
<!--
<section class="sponsors">
<h3 class="sponsors__title">On the press</h3>
<ul class="sponsors__list">
<div class="row">
<li class="sponsors__item">
<img src="<?php echo $this->getSkin()->getSkinStylePath( 'images/sponsor1.png'); ?>">
</li>
<li class="sponsors__item">
<img src="<?php echo $this->getSkin()->getSkinStylePath( 'images/sponsor2.png'); ?>">
</li>
<li class="sponsors__item">
<img src="<?php echo $this->getSkin()->getSkinStylePath( 'images/sponsor3.png'); ?>">
</li>
<li class="sponsors__item">
<img src="<?php echo $this->getSkin()->getSkinStylePath( 'images/sponsor4.png'); ?>">
</li>
</div>
<div class="row">
<li class="sponsors__item">
<img src="<?php echo $this->getSkin()->getSkinStylePath( 'images/sponsor1.png'); ?>">
</li>
<li class="sponsors__item">
<img src="<?php echo $this->getSkin()->getSkinStylePath( 'images/sponsor2.png'); ?>">
</li>
<li class="sponsors__item">
<img src="<?php echo $this->getSkin()->getSkinStylePath( 'images/sponsor3.png'); ?>">
</li>
<li class="sponsors__item">
<img src="<?php echo $this->getSkin()->getSkinStylePath( 'images/sponsor4.png'); ?>">
</li>
</div>
</ul>
</section>
-->
</main>
<?php }
public function executeContentPage() {
$displayTitle = getDisplayTitle($this->pageTitle, $this->get('title'));
?>
<main class="page page--article <?php echo self::getAnonClass(); ?>">
<?php if ( $this->data['sitenotice'] ) { ?>
<div class="sitenotice__wrapper">
<div class="sitenotice__content"> <!-- The CSS class used in Monobook and Vector, if you want to follow a similar design -->
<?php $this->html( 'sitenotice' ); ?>
</div>
</div>
<?php } ?>
<div class="article__wrapper">
<?php self::executeBreadcrumb($this->pageTitle); //build the breadcrumb?>
<div class="article__main"> <!-- This is needed to wrap the "sheet" and the tools so we can display them one next to another-->
<div class="article__sheet"> <!-- This is needed to wrap the content (rectangular sheet and the bottom navigations button (so they don't overlap the tools) -->
<article class="article__content mw-body">
<h1 class="article__title">
<?php echo $displayTitle; ?>
</h1>
<?php if ( $this->data['subtitle'] ) { ?>
<div class="article__contentSub" id="contentSub">
<?php //$this->html('subtitle'); ?>
</div>
<?php } ?>
<?php if ( $this->data['undelete'] ) { ?>
<div class="article__contentSub2" id="contentSub2">
<?php $this->html( 'undelete' ); ?>
</div>
<?php } ?>
<div id="content"> <!-- #content tells visauleditor where to put itself: under the title -->
<div class="article__text" id="bodyContent">
<?php $this->html( 'bodytext' ); ?>
</div>
<div class="article__categories">
<?php $this->html( 'catlinks' ); ?>
</div>
<div class="article__dataAfterContent">
<?php $this->html( 'dataAfterContent' ); ?>
</div>
</div> <!-- Here the real content begins -->
</article>
<?php self::executePreviousNext(); //build previos and next ?>
</div>
<?php self::executePageTools() //build the tools?>
</div>
</div>
</main>
<?php }
public function executeFooter() {
global $wiki, $wiki_domain;
?>
<footer class="footer">
<ul class="footer__list">
<li class="footer__logo">
<img src="/skins/WikiToLearnSkin/images/wikitolearn-logo.png">
</li>
<li class="footer__wikitolearn">
<h4>WikiToLearn</h4>
<ul class="footer__wikitolearn-list">
<li>
<a href="<?php echo $this->getMessage("wikitolearnskin-navbar-about-link"); ?>"><i class="fa fa-info-circle"> </i><?php echo $this->getMessage("wikitolearnskin-navbar-about"); ?></a>
</li>
<li>
<a href="//join.<?php echo $wiki_domain ."/" . $wiki ?>"><i class="fa fa-check-square-o"> </i><?php echo $this->getMessage("wikitolearnskin-navbar-contribute"); ?></a>
</li>
<li>
<a href="<?php echo $this->getMessage("wikitolearnskin-footer-academic-link"); ?>"><i class="fa fa-university"> </i><?php echo $this->getMessage("wikitolearnskin-footer-academic"); ?></a>
</li>
<li>
<a href="<?php echo $this->getMessage("wikitolearnskin-footer-license-link"); ?>"><i class="fa fa-copyright"> </i><?php echo $this->getMessage("wikitolearnskin-footer-license"); ?></a>
</li>
<li>
<a href="<?php echo "//www." . $wiki_domain . "/privacy.html" ?>"><i class="fa fa-lock"> </i><?php echo $this->getMessage("wikitolearnskin-footer-privacy-policy"); ?></a>
</li>
</ul>
<h4 class="footer__second-heading"><?php echo $this->getMessage('wikitolearnskin-footer-hosted-by'); ?></h4>
<ul class="footer__second-list">
<li>
<a rel="nofollow" href="http://www.garr.it/">GARR</a>
</li>
<li>
<a rel="nofollow" href="https://www.neodigit.net/">Neodigit</a>
</li>
</ul>
</li>
<li class="footer__tools clearfix">
<h4><?php echo $this->getMessage("wikitolearnskin-footer-tools"); ?></h4>
<ul class="footer__tools-list">
<li>
<a href="<?php echo $this->getMessage("wikitolearnskin-navbar-tools-guide-link"); ?>"><i class="fa fa-question-circle"> </i><?php echo $this->getMessage("wikitolearnskin-navbar-tools-guide"); ?></a>
</li>
<!--<li>
<a href="<?php echo wfMessage("wikitolearnskin-navbar-tools-createbook-link")->plain(); ?>"><i class="fa fa-book"> </i><?php echo wfMessage("wikitolearnskin-navbar-tools-createbook"); ?></a>
</li>-->
<li><hr /></li>
<li>
<a href="<?php echo $this->getMessage("wikitolearnskin-navbar-tools-chat-link"); ?>"><i class="fa fa-comments"> </i><?php echo $this->getMessage("wikitolearnskin-navbar-tools-chat"); ?></a>
</li>
<li>
<a href="<?php echo $this->getMessage("wikitolearnskin-navbar-tools-community-portal-link"); ?>"><i class="fa fa-users"> </i><?php echo $this->getMessage("wikitolearnskin-navbar-tools-community-portal"); ?></a>
</li>
<li>
<a href="<?php echo $this->getMessage("wikitolearnskin-navbar-tools-reports-link"); ?>"><i class="fa fa-bar-chart"> </i><?php echo $this->getMessage("wikitolearnskin-navbar-tools-reports"); ?></a>
</li>
<hr>
<li>
<?php
$linkObj = Title::newFromText("Special:RecentChanges");
echo Linker::linkKnown($linkObj, $this->getMessage("wikitolearnskin-footer-changes")); ?>
</li>
<li>
<?php
$linkObj = Title::newFromText("Special:SpecialPages");
echo Linker::linkKnown($linkObj, $this->getMessage("wikitolearnskin-footer-special-pages")); ?>
</li>
</ul>
</li>
<li class="footer__social">
<h4>
<?php echo $this->getMessage("wikitolearnskin-footer-keep-in-touch"); ?>
</h4>
<ul class="social-icons">
<li>
<a href="https://www.facebook.com/WikiToLearn" class="fa fa-facebook fa-2x" aria-hidden="true"></a>
</li>
<li>
<a href="https://twitter.com/wikitolearn" class="fa fa-twitter fa-2x" aria-hidden="true"></a>
</li>
<li>
<a href="https://telegram.me/WikiToLearnNews" class="fa fa-telegram fa-2x" aria-hidden="true"></a>
</li>
<li>
<a href="https://www.linkedin.com/company/wikitolearn" class="fa fa-linkedin fa-2x" aria-hidden="true"></a>
</li>
</ul>
<ul>
<li><a href="mailto:info@wikitolearn.org">info@wikitolearn.org</a></li>
<li>
<a href="<?php echo $this->getMessage("wikitolearnskin-footer-chat-link"); ?>"><?php echo $this->getMessage("wikitolearnskin-footer-chat-text"); ?></a>
</li>
<li>
<a href="<?php echo $this->getMessage("wikitolearnskin-footer-blog-link"); ?>"><?php echo $this->getMessage("wikitolearnskin-footer-blog-text"); ?></a>
</li>
</ul>
</li>
</ul>
</footer>
<?php }
public function executeJoinPage() { ?>
<main class="page page-join">
<section class="first-steps">
<div class="first-steps__content">
<h1 class="first-steps__title"><?php echo $this->getMessage('wikitolearnskin-join-title')?></h1>
<div class="steps">
<div class="step">
<div class="step__image">
<img src="/skins/WikiToLearnSkin/images/join/social.png" alt="">
</div>
<div class="step__content">
<h3><?php echo $this->getMessage('wikitolearnskin-join-step-account-title')?></h3>
<p><?php echo $this->getMessage('wikitolearnskin-join-step-account-content', false)?></p>
</div>
<a class="step__button" href="<?php echo $this->skin->makeSpecialUrl('CreateAccount'); ?>"><?php echo $this->getMessage('wikitolearnskin-join-step-account-button-text'); ?></a>
</div>
<div class="step">
<div class="step__image">
<img src="/skins/WikiToLearnSkin/images/join/guide.png" alt="">
</div>
<div class="step__content">
<h3><?php echo $this->getMessage('wikitolearnskin-join-step-guide-title'); ?></h3>
<p><?php echo $this->getMessage('wikitolearnskin-join-step-guide-content', false); ?></p>
</div>
<a class="step__button" href="<?php echo $this->getMessage('wikitolearnskin-join-step-guide-button-link'); ?>"><?php echo $this->getMessage('wikitolearnskin-join-step-guide-button-text'); ?></a>
</div>
<div class="step">
<div class="step__image">
<img src="/skins/WikiToLearnSkin/images/join/chat.png" alt="">
</div>
<div class="step__content">
<h3><?php echo $this->getMessage('wikitolearnskin-join-step-chat-title'); ?></h3>
<p><?php echo $this->getMessage('wikitolearnskin-join-step-chat-content', false); ?></p>
</div>
<a class="step__button" href="<?php echo $this->getMessage('wikitolearnskin-join-step-chat-button-link'); ?>"><?php echo $this->getMessage('wikitolearnskin-join-step-chat-button-text'); ?></a>
</div>
</div>
</div>
</section>
<section class="why">
<div class="why__content">
<h2 class="why__title"><?php echo $this->getMessage('wikitolearnskin-join-why-join');?></h2>
<div class="reason">
<div class="reason__image" style="background-image:url(/skins/WikiToLearnSkin/images/join/student.png);"></div>
<div class="reason__content">
<h2 class="reason__title"><?php echo $this->getMessage('wikitolearnskin-join-student');?></h2>
<div class="reason__text">
<?php echo $this->getMessage('wikitolearnskin-join-student-text');?>
</div>
<div class="reason__more">
<a href="<?php echo $this->getMessage('wikitolearnskin-join-student-link');?>"><?php echo $this->getMessage('wikitolearnskin-join-read-more');?></a>
</div>
</div>
</div>
<div class="reason">
<div class="reason__image hidden-md-up" style="background-image:url(/skins/WikiToLearnSkin/images/join/teacher.png);"></div>
<div class="reason__content">
<h2 class="reason__title"><?php echo $this->getMessage('wikitolearnskin-join-professor');?></h2>
<div class="reason__text">
<?php echo $this->getMessage('wikitolearnskin-join-professor-text');?>
</div>
<div class="reason__more">
<a href="<?php echo $this->getMessage('wikitolearnskin-join-professor-link');?>"><?php echo $this->getMessage('wikitolearnskin-join-read-more'); ?></a>
</div>
</div>
<div class="reason__image hidden-sm-down" style="background-image:url(/skins/WikiToLearnSkin/images/join/teacher.png);"></div>
</div>
<div class="reason">
<div class="reason__image" style="background-image:url(/skins/WikiToLearnSkin/images/join/other.png);"></div>
<div class="reason__content">
<h2 class="reason__title"><?php echo $this->getMessage('wikitolearnskin-join-other'); ?></h2>
<div class="reason__text">
<?php echo $this->getMessage('wikitolearnskin-join-other-text'); ?>
</div>
<div class="reason__more">
<a href="<?php echo $this->getMessage('wikitolearnskin-join-other-link');?>"><?php echo $this->getMessage('wikitolearnskin-join-read-more'); ?></a>
</div>
</div>
</div>
</div>
</section>
<!--<section class="create-account">
<div class="create-account__content">
<a href="<?php echo $this->skin->makeSpecialUrl('CreateAccount'); ?>"><?php echo $this->getMessage('wikitolearnskin-join-create-account'); ?></a>
</div>
</section>-->
</main>
<?php }
/*
* Wrapper for generating and printing all kinds of breadcrumbs
*/
public function executeBreadcrumb($pageTitle){
$fullTitle = $pageTitle->getText();
$titleComponents = explode("/", $fullTitle);
$partialLink = $pageTitle->getNsText() . ":";
if(count($titleComponents) > 1) {
echo '<div class="article__breadcrumb">';
echo '<div class="breadcrumb">';
if ($this->namespaceId === NS_COURSE) {
$this->executeCourseBreadcrumb($titleComponents, $partialLink);
}elseif ($this->namespaceId === NS_USER) {
$this->executeUserBreadcrumb($titleComponents, $partialLink);
}else {
$this->executeStandardBreadcrumb($titleComponents, $partialLink);
}
echo "</div>";
echo '</div>';
}
}
/**
* Generete the breadcrumb for all namespaces except NS_USER and NS_COURSE
* @param string[] $titleComponents the subtokens composed the title
* @param string $partialLink the partial link from which to build the links
*/
public function executeStandardBreadcrumb($titleComponents, $partialLink){
for ($i = 0; $i < sizeof($titleComponents); $i++) {
$titleComponent = $titleComponents[$i];
$partialLink .= $titleComponent;
$linkObj = Title::newFromText($partialLink);
$link = Linker::linkKnown($linkObj, htmlspecialchars( $titleComponent ), ["class" => "breadcrumb__item"]);
echo $link;
if($i !== (sizeof($titleComponents) - 1)) { //we don't add the slash on last link
echo "<span class='breadcrumb__divider'> <i class='fa fa-angle-right'></i> </span>";
}
$partialLink .= "/";
}
}
/**
* Generete the HTML for the breadcrumb in NS_USER exploting
* executeCourseBreadcrumb() method for the common part after the
* userpage link.
* @param string[] $titleComponents the subtokens composed the title
* @param string $partialLink the partial link from which to build the links
*/
public function executeUserBreadcrumb($titleComponents, $partialLink){
$userPage = array_shift($titleComponents);
$partialLink .= $userPage;
$linkObj = Title::newFromText($partialLink);
$link = Linker::linkKnown($linkObj, htmlspecialchars( $userPage ), ["class" => "breadcrumb__item"]);
echo ($link);
echo "<span class='breadcrumb__divider'> <i class='fa fa-angle-right'></i> </span>";
self::executeCourseBreadcrumb($titleComponents, $partialLink . "/");
}
/**
* Generete the HTML of the breadcrumb for pages that follow the Course
* structure. We want to provide dropdowns within breadcrumb in these pages.
* Courses are allowed in NS_COURSE and NS_USER.
* @param string[] $titleComponents the subtokens composed the title
* @param string $partialLink the partial link from which to build the links
*/
// FIXME: This function it's a mess! Should be refactored, but it works!
public function executeCourseBreadcrumb($titleComponents, $partialLink) {
$partialLink .= $titleComponents[0];
$subpages = CourseEditorUtils::getLevelsTwo($partialLink);
$linkObj = Title::newFromText($partialLink);
$link = Linker::linkKnown($linkObj, htmlspecialchars( $titleComponents[0] ), ["class" => "breadcrumb__item"]);
echo $link;
if (count($subpages) !== 0 && count($titleComponents) > 1){
self::buildBreadcrumbDropdown($subpages, $partialLink);
}
switch (count($titleComponents)) {
case 2:
$linkObj = Title::newFromText($partialLink . "/" . $titleComponents[1]);
$link = Linker::linkKnown($linkObj, htmlspecialchars( $titleComponents[1] ), ["class" => "breadcrumb__item"]);
echo $link;
break;
case 3:
$partialLink .= "/" . $titleComponents[1];
$linkObj = Title::newFromText($partialLink);
$link = Linker::linkKnown($linkObj, htmlspecialchars( $titleComponents[1] ), ["class" => "breadcrumb__item"]);
echo $link;
$subpages = CourseEditorUtils::getLevelsThree($partialLink);
if (sizeof($subpages) !== 0){
self::buildBreadcrumbDropdown($subpages, $partialLink);
}
$linkObj = Title::newFromText($partialLink . "/" . $titleComponents[2]);
$link = Linker::linkKnown($linkObj, htmlspecialchars( $titleComponents[2] ), ["class" => "breadcrumb__item"]);
echo $link;
break;
default:
break;
}
}
/**
* Utility to build the dropdowns in the breadcrumb
* @param string[] $titleComponents the subtokens composed the title
* @param string $partialLink the partial link from which to build the links
*/
private function buildBreadcrumbDropdown($subpages, $partialLink){
?>
<div class="dropdown breadcrumb__dropdown">
<span href="#" class="dropdown__toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-angle-right"></i>
</span>
<div class="dropdown-menu">
<?php
foreach ($subpages as $subpage){
$subpageLink = Skin::makeUrl($partialLink . '/' . $subpage);
if($subpageLink === $this->pageTitle->getLocalURL()){
$additionalClass = "active";
} else {
$additionalClass = "";
}
?>
<a class="dropdown-item <?php echo $additionalClass ?>" href="<?php echo $subpageLink ?>"><?php echo $subpage ?></a>
<?php
}
?>
</div>
</div>
<?php
}
/**
* Generate a WikiToLearn's version of tools related to page.
* These tools are composed by classic 'views' tools (view, edit, history...)
* some 'collection' tools (Download as PDF, Download plain text..),
* and advaced tools.
*/
public function executePageTools() {
$namespace = $this->namespaceId;
switch ($namespace) {
case NS_MAIN:
self::executeMainPageTools();
break;
case NS_COURSE: case NS_USER: //they have the same actions
self::executeCoursePageTools();
break;
case NS_TEMPLATE: case NS_PROJECT:
self::executeSecondaryNamespacePageTools();
break;
default:
break; //nothing on purpose
}
}
private function executeMainPageTools(){
echo '<div class="article__tools">';
echo '<div id="tools_container">';
if(self::userHasEnoughRights()){ //only allow admin to see the visual editor edit button on these pages
self::makeEditTool();
}
if(self::pageHasCategory("Department")){ //on departments show discussion
self::makeDisussionTool();
}
if(self::userHasEnoughRights()){
self::makeAdvancedTools();
}
echo '</div>';
echo '</div>';
}
private function executeCoursePageTools(){
$namespace = $this->namespaceId;
echo '<div class="article__tools">';
echo '<div id="tools_container">';
if(self::pageHasCategory("CourseRoot")) {
self::makeEditCourseRootTool();
self::makeDisussionTool();
self::makeDownloadCourseTool();
if(self::userHasEnoughRights()){
if($namespace === NS_USER){
echo '<div class="tool--divider"></div>';