Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MigrateTranslatablePageSpecialPage.php
1<?php
2declare( strict_types = 1 );
3
4namespace MediaWiki\Extension\Translate\PageTranslation;
5
6use FormatJson;
7use Html;
8use SpecialPage;
9
15class MigrateTranslatablePageSpecialPage extends SpecialPage {
16 public function __construct() {
17 parent::__construct( 'PageMigration', 'pagetranslation' );
18 }
19
20 protected function getGroupName() {
21 return 'translation';
22 }
23
24 public function getDescription() {
25 return $this->msg( 'pagemigration' )->text();
26 }
27
28 public function execute( $par ) {
29 $output = $this->getOutput();
30 $this->setHeaders();
31 $this->checkPermissions();
32 $this->addHelpLink( 'Help:Extension:Translate/Page translation administration' );
33 $this->outputHeader( 'pagemigration-summary' );
34 $output->addModules( 'ext.translate.special.pagemigration' );
35 $output->addModuleStyles( [
36 'ext.translate.specialpages.styles',
37 'jquery.uls.grid'
38 ] );
39
40 # Do stuff
41 # ...
42 $out = '';
43 $out .= Html::openElement( 'div', [ 'class' => 'mw-tpm-sp-container grid' ] );
44 $out .= Html::openElement( 'div', [ 'class' => 'mw-tpm-sp-error row',
45 'id' => 'mw-tpm-sp-error-div' ] );
46 $out .= Html::element( 'div',
47 [ 'class' => 'mw-tpm-sp-error__message five columns hide' ] );
48 $out .= Html::closeElement( 'div' );
49 $out .= Html::openElement( 'form', [ 'class' => 'mw-tpm-sp-form row',
50 'id' => 'mw-tpm-sp-primary-form', 'action' => '' ] );
51 $out .= Html::element( 'input', [ 'id' => 'pm-summary', 'type' => 'hidden',
52 'value' => $this->msg( 'pm-summary-import' )->inContentLanguage()->text() ] );
53 $out .= "\n";
54 $out .= Html::element( 'input', [ 'id' => 'title', 'class' => 'mw-searchInput mw-ui-input',
55 'data-mw-searchsuggest' => FormatJson::encode( [
56 'wrapAsLink' => false
57 ] ), 'placeholder' => $this->msg( 'pm-pagetitle-placeholder' )->text() ] );
58 $out .= "\n";
59 $out .= Html::element( 'input', [ 'id' => 'action-import',
60 'class' => 'mw-ui-button mw-ui-progressive', 'type' => 'button',
61 'value' => $this->msg( 'pm-import-button-label' )->text() ] );
62 $out .= "\n";
63 $out .= Html::element( 'input', [ 'id' => 'action-save',
64 'class' => 'mw-ui-button mw-ui-progressive hide', 'type' => 'button',
65 'value' => $this->msg( 'pm-savepages-button-label' )->text() ] );
66 $out .= "\n";
67 $out .= Html::element( 'input', [ 'id' => 'action-cancel',
68 'class' => 'mw-ui-button mw-ui-quiet hide', 'type' => 'button',
69 'value' => $this->msg( 'pm-cancel-button-label' )->text() ] );
70 $out .= Html::closeElement( 'form' );
71 $out .= Html::element( 'div', [ 'class' => 'mw-tpm-sp-instructions hide' ] );
72 $out .= Html::rawElement( 'div', [ 'class' => 'mw-tpm-sp-unit-listing' ] );
73 $out .= Html::closeElement( 'div' );
74
75 $output->addHTML( $out );
76 $output->addHTML(
77 Html::errorBox(
78 $this->msg( 'tux-nojs' )->plain(),
79 '',
80 'tux-nojs'
81 )
82 );
83 }
84}
Contains code for Special:PageMigration to migrate to page transation.