[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Ui/ -> PageConflict.php (source)

   1  <?php
   2  
   3  namespace dokuwiki\Ui;
   4  
   5  use dokuwiki\Form\Form;
   6  
   7  /**
   8   * DokuWiki Page Conflict Interface
   9   *
  10   * @package dokuwiki\Ui
  11   */
  12  class PageConflict extends Ui
  13  {
  14      protected $text;
  15      protected $summary;
  16  
  17      /** 
  18       * PageConflict Ui constructor
  19       *
  20       * @param string $text     wiki text
  21       * @param string $summary  edit summary
  22      */
  23      public function __construct($text = '', $summary = '')
  24      {
  25          $this->text    = $text;
  26          $this->summary = $summary;
  27      }
  28  
  29      /**
  30       * Show conflict form to ask whether save anyway or cancel the page edits
  31       *
  32       * @author   Andreas Gohr <andi@splitbrain.org>
  33       *
  34       * @return void
  35       */
  36      public function show()
  37      {
  38          global $ID;
  39          global $lang;
  40  
  41          // print intro
  42          print p_locale_xhtml('conflict');
  43  
  44          // create the form
  45          $form = new Form(['id' => 'dw__editform']);
  46          $form->addTagOpen('div')->addClass('no');
  47          $form->setHiddenField('id', $ID);
  48          $form->setHiddenField('wikitext', $this->text);
  49          $form->setHiddenField('summary', $this->summary);
  50  
  51          $form->addButton('do[save]', $lang['btn_save'] )->attrs(['type' => 'submit', 'accesskey' => 's']);
  52          $form->addButton('do[cancel]', $lang['btn_cancel'] )->attrs(['type' => 'submit']);
  53          $form->addTagClose('div');
  54  
  55          print $form->toHTML('Conflict');
  56  
  57          print '<br /><br /><br /><br />';
  58  
  59          (new Diff($this->text, false))->show();
  60      }
  61  
  62  }