Exemplo n.º 1
0
 /**
  * Get the HTMLForm to control behavior
  * @return HTMLForm|null
  */
 protected function getForm()
 {
     $this->fields = $this->getFormFields();
     // Give hooks a chance to alter the form, adding extra fields or text etc
     Hooks::run('ActionModifyFormFields', array($this->getName(), &$this->fields, $this->page));
     $form = new HTMLForm($this->fields, $this->getContext(), $this->getName());
     $form->setSubmitCallback(array($this, 'onSubmit'));
     $title = $this->getTitle();
     $form->setAction($title->getLocalURL(array('action' => $this->getName())));
     // Retain query parameters (uselang etc)
     $params = array_diff_key($this->getRequest()->getQueryValues(), array('action' => null, 'title' => null));
     if ($params) {
         $form->addHiddenField('redirectparams', wfArrayToCgi($params));
     }
     $form->addPreText($this->preText());
     $form->addPostText($this->postText());
     $this->alterForm($form);
     // Give hooks a chance to alter the form, adding extra fields or text etc
     Hooks::run('ActionBeforeFormDisplay', array($this->getName(), &$form, $this->page));
     return $form;
 }
 function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $request = $this->getRequest();
     $propname = $request->getVal('propname', $par);
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select('page_props', 'pp_propname', '', __METHOD__, array('DISTINCT', 'ORDER BY' => 'pp_propname'));
     foreach ($res as $row) {
         $propnames[$row->pp_propname] = $row->pp_propname;
     }
     $form = new HTMLForm(array('propname' => array('type' => 'selectorother', 'name' => 'propname', 'options' => $propnames, 'default' => $propname, 'label-message' => 'pageswithprop-prop', 'required' => true)), $this->getContext());
     $form->setMethod('get');
     $form->setAction($this->getTitle()->getFullUrl());
     $form->setSubmitCallback(array($this, 'onSubmit'));
     $form->setWrapperLegend($this->msg('pageswithprop-legend'));
     $form->addHeaderText($this->msg('pageswithprop-text')->parseAsBlock());
     $form->setSubmitTextMsg('pageswithprop-submit');
     $form->prepareForm();
     $form->displayForm(false);
     if ($propname !== '' && $propname !== null) {
         $form->trySubmit();
     }
 }
Exemplo n.º 3
0
 protected function showActivateDeactivateForm($tag, $activate)
 {
     $actionStr = $activate ? 'activate' : 'deactivate';
     $user = $this->getUser();
     if (!$user->isAllowed('managechangetags')) {
         throw new PermissionsError('managechangetags');
     }
     $out = $this->getOutput();
     // tags-activate-title, tags-deactivate-title
     $out->setPageTitle($this->msg("tags-{$actionStr}-title"));
     $out->addBacklinkSubtitle($this->getPageTitle());
     // is it possible to do this?
     $func = $activate ? 'canActivateTag' : 'canDeactivateTag';
     $result = ChangeTags::$func($tag, $user);
     if (!$result->isGood()) {
         $out->addWikiText("<div class=\"error\">\n" . $result->getWikiText() . "\n</div>");
         if (!$result->isOK()) {
             return;
         }
     }
     // tags-activate-question, tags-deactivate-question
     $preText = $this->msg("tags-{$actionStr}-question", $tag)->parseAsBlock();
     $fields = [];
     // tags-activate-reason, tags-deactivate-reason
     $fields['Reason'] = ['type' => 'text', 'label' => $this->msg("tags-{$actionStr}-reason")->plain(), 'size' => 50];
     $fields['HiddenTag'] = ['type' => 'hidden', 'name' => 'tag', 'default' => $tag, 'required' => true];
     $form = new HTMLForm($fields, $this->getContext());
     $form->setAction($this->getPageTitle($actionStr)->getLocalURL());
     $form->tagAction = $actionStr;
     $form->setSubmitCallback([$this, 'processTagForm']);
     // tags-activate-submit, tags-deactivate-submit
     $form->setSubmitTextMsg("tags-{$actionStr}-submit");
     $form->addPreText($preText);
     $form->show();
 }
 function alterForm(HTMLForm $form)
 {
     $form->setMethod('GET');
     $form->setAction($this->getPageTitle()->getLocalURL());
     $form->setSubmitText($this->msg('centralauth-rename-viewprogress')->text());
 }
Exemplo n.º 5
0
require './HTMLRadio.php';
require './HTMLAnchor.php';
?>

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
$form = new HTMLForm('form_1');
$divNome = new HTMLDIV('d_nome');
$form->setMethod('POST');
$form->setAction($_SERVER['SCRIPT_NAME']);
$label = new HTMLLabel('Nome', 'i_nome');
$inputNome = new HTMLInput('text', 'i_nome');
$inputNome->addAttribute('value', "Evandro Pereira de Lacerda");
$inputNome->addAttribute('size', 60);
$text = new HTMLTextNode('Nome');
$label->addChild($inputNome);
$divNome->addChild($label);
//***************************************************
$divNascimento = new HTMLDIV('d_nasc');
$labelNascimento = new HTMLLabel("Data de Nascimento", 'i_nasc');
$nascimento = new HTMLInput('date', 'i_nasc');
$nascimento->addAttribute('size', 25);
$nascimento->addClass('input_n');
$nascimento->addClass('input_md');
$labelNascimento->addChild($nascimento);