/**
  * @since 2.5
  *
  * @return string
  */
 public function getForm()
 {
     $this->htmlFormRenderer->setName('buildtables')->setMethod('get')->addHiddenField('action', 'updatetables')->addHeader('h2', $this->getMessage('smw_smwadmin_db'));
     if ($this->enabledSetupStore) {
         $this->htmlFormRenderer->addParagraph($this->getMessage('smw_smwadmin_dbdocu'))->addHiddenField('udsure', 'yes')->addSubmitButton($this->getMessage('smw_smwadmin_dbbutton'));
     } else {
         $this->htmlFormRenderer->addParagraph($this->getMessage('smw-smwadmin-dbsetup-disabled'));
     }
     return $this->htmlFormRenderer->getForm() . Html::element('p', array(), '');
 }
 public function testCheckbox()
 {
     $title = $this->getMockBuilder('\\Title')->disableOriginalConstructor()->getMock();
     $message = $this->getMockBuilder('\\Message')->disableOriginalConstructor()->getMock();
     $message->expects($this->any())->method('text')->will($this->returnValue('SomeText'));
     $messageBuilder = $this->getMockBuilder('\\SMW\\MediaWiki\\MessageBuilder')->disableOriginalConstructor()->getMock();
     $messageBuilder->expects($this->any())->method('getMessage')->will($this->returnValue($message));
     $instance = new HtmlFormRenderer($title, $messageBuilder);
     $instance->setName('checkboxForm')->addHeader('invalidLevel', 'someHeader')->withFieldset()->setMethod('post')->setActionUrl('http://example.org/foo')->addCheckbox('checkboxLabel', 'checkboxName', true, 'checkBoxId');
     $expected = array('<form id="smw-form-checkboxForm" name="checkboxForm" method="post" action="http://example.org/foo">', '<h2>someHeader</h2>', '<fieldset id="smw-form-fieldset-checkboxForm">', '<input name="checkboxName" type="checkbox" value="1" checked="checked" id="checkboxName" class="smw-form-checkbox" />', '<label for="checkboxName" class="smw-form-checkbox">checkboxLabel</label>');
     $this->stringValidator->assertThatStringContains($expected, $instance->getForm());
 }
 /**
  * @since 2.5
  *
  * @return string
  */
 public function getForm()
 {
     $refreshjob = $this->getRefreshJob();
     $this->htmlFormRenderer->setName('refreshwiki')->setMethod('post')->addHiddenField('action', 'refreshstore')->addHeader('h2', $this->getMessage('smw_smwadmin_datarefresh'));
     if (!$this->enabledRefreshStore) {
         $this->htmlFormRenderer->addParagraph($this->getMessage('smw-smwadmin-datarefresh-disabled'));
     } else {
         $this->htmlFormRenderer->addParagraph($this->getMessage('smw_smwadmin_datarefreshdocu'));
     }
     if ($refreshjob !== null) {
         $prog = $refreshjob->getProgress();
         $progressBar = Html::rawElement('div', array('style' => 'float: left; background: #DDDDDD; border: 1px solid grey; width: 300px;'), Html::rawElement('div', array('style' => 'background: #AAF; width: ' . round($prog * 300) . 'px; height: 20px; '), ''));
         $this->htmlFormRenderer->addParagraph($this->getMessage('smw_smwadmin_datarefreshprogress'))->addParagraph($progressBar . '&#160;' . round($prog * 100, 4) . '%')->addLineBreak();
         if ($this->enabledRefreshStore) {
             $this->htmlFormRenderer->addSubmitButton($this->getMessage('smw_smwadmin_datarefreshstop'))->addCheckbox($this->getMessage('smw_smwadmin_datarefreshstopconfirm'), 'rfsure', 'stop');
         }
     } elseif ($this->enabledRefreshStore) {
         $this->htmlFormRenderer->addHiddenField('rfsure', 'yes')->addSubmitButton($this->getMessage('smw_smwadmin_datarefreshbutton'));
     }
     return $this->htmlFormRenderer->getForm() . Html::element('p', array(), '');
 }