本文整理汇总了PHP中HTMLForm::addHeaderText方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::addHeaderText方法的具体用法?PHP HTMLForm::addHeaderText怎么用?PHP HTMLForm::addHeaderText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::addHeaderText方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$this->getOutput()->addModuleStyles('mediawiki.special.pagesWithProp');
$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'));
$propnames = array();
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->setSubmitCallback(array($this, 'onSubmit'));
$form->setWrapperLegendMsg('pageswithprop-legend');
$form->addHeaderText($this->msg('pageswithprop-text')->parseAsBlock());
$form->setSubmitTextMsg('pageswithprop-submit');
$form->prepareForm();
$form->displayForm(false);
if ($propname !== '' && $propname !== null) {
$form->trySubmit();
}
}
示例2: execute
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$this->getOutput()->addModuleStyles('mediawiki.special.pagesWithProp');
$request = $this->getRequest();
$propname = $request->getVal('propname', $par);
$propnames = $this->getExistingPropNames();
$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->setSubmitCallback(array($this, 'onSubmit'));
$form->setWrapperLegendMsg('pageswithprop-legend');
$form->addHeaderText($this->msg('pageswithprop-text')->parseAsBlock());
$form->setSubmitTextMsg('pageswithprop-submit');
$form->prepareForm();
$form->displayForm(false);
if ($propname !== '' && $propname !== null) {
$form->trySubmit();
}
}
示例3: getRawForm
/**
* Get a form for editing the watchlist in "raw" mode
*
* @return HTMLForm
*/
protected function getRawForm()
{
$titles = implode($this->getWatchlist(), "\n");
$fields = array('Titles' => array('type' => 'textarea', 'label-message' => 'watchlistedit-raw-titles', 'default' => $titles));
$form = new HTMLForm($fields, $this->getContext());
$form->setTitle($this->getTitle('raw'));
$form->setSubmitTextMsg('watchlistedit-raw-submit');
# Used message keys: 'accesskey-watchlistedit-raw-submit', 'tooltip-watchlistedit-raw-submit'
$form->setSubmitTooltip('watchlistedit-raw-submit');
$form->setWrapperLegendMsg('watchlistedit-raw-legend');
$form->addHeaderText($this->msg('watchlistedit-raw-explain')->parse());
$form->setSubmitCallback(array($this, 'submitRaw'));
return $form;
}
示例4: getClearForm
/**
* Get a form for clearing the watchlist
*
* @return HTMLForm
*/
protected function getClearForm()
{
$context = new DerivativeContext($this->getContext());
$context->setTitle($this->getPageTitle('clear'));
// Reset subpage
$form = new HTMLForm(array(), $context);
$form->setSubmitTextMsg('watchlistedit-clear-submit');
# Used message keys: 'accesskey-watchlistedit-clear-submit', 'tooltip-watchlistedit-clear-submit'
$form->setSubmitTooltip('watchlistedit-clear-submit');
$form->setWrapperLegendMsg('watchlistedit-clear-legend');
$form->addHeaderText($this->msg('watchlistedit-clear-explain')->parse());
$form->setSubmitCallback(array($this, 'submitClear'));
$form->setSubmitDestructive();
return $form;
}
示例5: alterForm
/**
* Customizes the HTMLForm a bit
*
* @param $form HTMLForm
*/
protected function alterForm(HTMLForm $form)
{
$form->setWrapperLegendMsg('blockip-legend');
$form->setHeaderText('');
$form->setSubmitCallback(array(__CLASS__, 'processUIForm'));
$msg = $this->alreadyBlocked ? 'ipb-change-block' : 'ipbsubmit';
$form->setSubmitTextMsg($msg);
# Don't need to do anything if the form has been posted
if (!$this->getRequest()->wasPosted() && $this->preErrors) {
$s = HTMLForm::formatErrors($this->preErrors);
if ($s) {
$form->addHeaderText(Html::rawElement('div', array('class' => 'error'), $s));
}
}
}
示例6: addRule
/**
* @return bool
*/
function addRule()
{
$this->setHeaders();
$this->getOutput()->setPagetitle($this->msg('openstackmanager-addrule'));
$project = $this->getRequest()->getText('project');
$region = $this->getRequest()->getText('region');
$groupid = $this->getRequest()->getText('groupid');
if (!$this->userLDAP->inRole('projectadmin', $project)) {
$this->notInRole('projectadmin', $project);
return false;
}
$securitygroup = $this->userNova->getSecurityGroup($groupid);
if (!$securitygroup) {
$this->getOutput()->addWikiMsg('openstackmanager-nonexistantsecuritygroup');
return false;
}
$group_keys = array('' => '');
$securityGroups = $this->userNova->getSecurityGroups();
foreach ($securityGroups as $securityGroup) {
$securityGroupName = $securityGroup->getGroupName();
$group_keys[$securityGroupName] = $securityGroupName;
}
$securityGroupInfo = array();
$securityGroupInfo['groupid'] = array('type' => 'hidden', 'default' => $groupid, 'name' => 'groupid');
$securityGroupInfo['project'] = array('type' => 'hidden', 'default' => $project, 'section' => 'rule/singlerule', 'name' => 'project');
$securityGroupInfo['region'] = array('type' => 'hidden', 'default' => $region, 'name' => 'region');
$securityGroupInfo['fromport'] = array('type' => 'text', 'label-message' => 'openstackmanager-securitygrouprule-fromport', 'default' => '', 'section' => 'rule/singlerule', 'name' => 'fromport');
$securityGroupInfo['toport'] = array('type' => 'text', 'label-message' => 'openstackmanager-securitygrouprule-toport', 'default' => '', 'section' => 'rule/singlerule', 'name' => 'toport');
$securityGroupInfo['protocol'] = array('type' => 'select', 'label-message' => 'openstackmanager-securitygrouprule-protocol', 'options' => array('' => '', 'icmp' => 'icmp', 'tcp' => 'tcp', 'udp' => 'udp'), 'section' => 'rule/singlerule', 'name' => 'protocol');
$securityGroupInfo['range'] = array('type' => 'text', 'label-message' => 'openstackmanager-securitygrouprule-ranges', 'help-message' => 'openstackmanager-securitygrouprule-ranges-help', 'default' => '', 'section' => 'rule/singlerule', 'name' => 'range');
$securityGroupInfo['group'] = array('type' => 'select', 'label-message' => 'openstackmanager-securitygrouprule-groups', 'help-message' => 'openstackmanager-securitygrouprule-groups-help', 'options' => $group_keys, 'section' => 'rule/group', 'name' => 'group');
$securityGroupInfo['action'] = array('type' => 'hidden', 'default' => 'addrule', 'name' => 'action');
$securityGroupForm = new HTMLForm($securityGroupInfo, $this->getContext(), 'openstackmanager-novasecuritygroup');
$securityGroupForm->addHeaderText($this->msg('openstackmanager-securitygrouprule-group-exclusive')->text(), 'rule');
$securityGroupForm->setSubmitID('novainstance-form-removerulesubmit');
$securityGroupForm->setSubmitCallback(array($this, 'tryAddRuleSubmit'));
$securityGroupForm->show();
return true;
}
开发者ID:valhallasw,项目名称:mediawiki-extensions-OpenStackManager,代码行数:42,代码来源:SpecialNovaSecurityGroup.php
示例7: alterForm
/**
* Customizes the HTMLForm a bit
*
* @param HTMLForm $form
*/
protected function alterForm(HTMLForm $form)
{
$form->setWrapperLegendMsg('blockip-legend');
$form->setHeaderText('');
$form->setSubmitDestructive();
$msg = $this->alreadyBlocked ? 'ipb-change-block' : 'ipbsubmit';
$form->setSubmitTextMsg($msg);
$this->addHelpLink('Help:Blocking users');
# Don't need to do anything if the form has been posted
if (!$this->getRequest()->wasPosted() && $this->preErrors) {
$s = $form->formatErrors($this->preErrors);
if ($s) {
$form->addHeaderText(Html::rawElement('div', array('class' => 'error'), $s));
}
}
}
示例8: getForm
/**
* Get the HTMLForm to control behaviour
* @return HTMLForm|null
*/
protected function getForm()
{
$this->fields = $this->getFormFields();
$form = new HTMLForm($this->fields, $this->getContext());
$form->setSubmitCallback(array($this, 'onSubmit'));
$form->setWrapperLegend($this->msg(strtolower($this->getName()) . '-legend'));
$form->addHeaderText($this->msg(strtolower($this->getName()) . '-text')->parseAsBlock());
// Retain query parameters (uselang etc)
$params = array_diff_key($this->getRequest()->getQueryValues(), array('title' => null));
$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
wfRunHooks("Special{$this->getName()}BeforeFormDisplay", array(&$form));
return $form;
}
示例9: getForm
/**
* Get the HTMLForm to control behavior
* @return HTMLForm|null
*/
protected function getForm()
{
$this->fields = $this->getFormFields();
$form = new HTMLForm($this->fields, $this->getContext(), $this->getMessagePrefix());
$form->setSubmitCallback(array($this, 'onSubmit'));
// If the form is a compact vertical form, then don't output this ugly
// fieldset surrounding it.
// XXX Special pages can setDisplayFormat to 'vform' in alterForm(), but that
// is called after this.
if (!$form->isVForm()) {
$form->setWrapperLegendMsg($this->getMessagePrefix() . '-legend');
}
$headerMsg = $this->msg($this->getMessagePrefix() . '-text');
if (!$headerMsg->isDisabled()) {
$form->addHeaderText($headerMsg->parseAsBlock());
}
// Retain query parameters (uselang etc)
$params = array_diff_key($this->getRequest()->getQueryValues(), array('title' => null));
$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
wfRunHooks('SpecialPageBeforeFormDisplay', array($this->getName(), &$form));
return $form;
}
示例10: createInstance
//.........这里部分代码省略.........
return false;
}
$instanceInfo = array();
$instanceInfo['instancename'] = array('type' => 'text', 'label-message' => 'openstackmanager-instancename', 'validation-callback' => array($this, 'validateText'), 'default' => '', 'section' => 'info', 'name' => 'instancename');
$instanceTypes = $this->userNova->getInstanceTypes();
$instanceType_keys = array();
foreach ($instanceTypes as $instanceType) {
$instanceTypeName = $instanceType->getInstanceTypeName();
if (in_array($instanceTypeName, $wgOpenStackManagerInstanceBannedInstanceTypes)) {
continue;
}
$instanceTypeId = $instanceType->getInstanceTypeId();
$cpus = $instanceType->getNumberOfCPUs();
$ram = $instanceType->getMemorySize();
$root_storage = $instanceType->getRootStorageSize();
$storage = $instanceType->getStorageSize();
// @todo FIXME: Hard coded parentheses.
$instanceLabel = $instanceTypeName . ' (' . $this->msg('openstackmanager-instancetypelabel', $cpus, $ram, $root_storage, $storage)->text() . ')';
$instanceType_keys[$instanceLabel] = $instanceTypeId;
}
$instanceInfo['instanceType'] = array('type' => 'select', 'label-message' => 'openstackmanager-instancetype', 'section' => 'info', 'options' => $instanceType_keys, 'name' => 'instanceType');
$instanceInfo['region'] = array('type' => 'hidden', 'default' => $region, 'name' => 'region');
# Image names can't be translated. Get the image, and make an array
# where the name points to itself as a value
$images = $this->userNova->getImages();
$image_keys = array();
$default = "";
foreach ($images as $image) {
if ($image->getImageState() !== "ACTIVE") {
continue;
}
$imageName = $image->getImageName();
if ($imageName === '') {
continue;
}
$showImage = $image->getImageMetadata('show');
if (!$showImage) {
continue;
}
$imageLabel = $imageName;
$isDefault = $image->getImageMetadata('default');
if ($isDefault) {
$default = $imageLabel;
}
$image_keys[$imageLabel] = $image->getImageId();
}
if (isset($image_keys[$default])) {
$default = $image_keys[$default];
}
$instanceInfo['imageType'] = array('type' => 'select', 'section' => 'info', 'options' => $image_keys, 'default' => $default, 'label-message' => 'openstackmanager-imagetype', 'name' => 'imageType');
# Keypair names can't be translated. Get the keys, and make an array
# where the name points to itself as a value
# TODO: get keypairs as the user, not the admin
# $keypairs = $this->userNova->getKeypairs();
# $keypair_keys = array();
# foreach ( array_keys( $keypairs ) as $keypair_key ) {
# $keypair_keys[$keypair_key] = $keypair_key;
# }
# $instanceInfo['keypair'] = array(
# 'type' => 'select',
# 'section' => 'info',
# 'options' => $keypair_keys,
# 'label-message' => 'keypair',
# );
#$domains = OpenStackNovaDomain::getAllDomains( 'local' );
#$domain_keys = array();
#foreach ( $domains as $domain ) {
# $domainname = $domain->getDomainName();
# $domain_keys[$domainname] = $domainname;
#}
#$instanceInfo['domain'] = array(
# 'type' => 'select',
# 'section' => 'info',
# 'options' => $domain_keys,
# 'label-message' => 'openstackmanager-dnsdomain',
# 'name' => 'domain',
#);
$securityGroups = $this->userNova->getSecurityGroups();
$group_keys = array();
$defaults = array();
foreach ($securityGroups as $securityGroup) {
if ($securityGroup->getProject() === $project) {
$securityGroupName = $securityGroup->getGroupName();
$group_keys[$securityGroupName] = $securityGroupName;
if ($securityGroupName === "default") {
$defaults["default"] = "default";
}
}
}
$instanceInfo['groups'] = array('type' => 'multiselect', 'section' => 'info', 'options' => $group_keys, 'default' => $defaults, 'label-message' => 'openstackmanager-securitygroups', 'name' => 'groups');
$instanceInfo['project'] = array('type' => 'hidden', 'default' => $project, 'name' => 'project');
$instanceInfo['action'] = array('type' => 'hidden', 'default' => 'create', 'name' => 'action');
$instanceForm = new HTMLForm($instanceInfo, $this->getContext(), 'openstackmanager-novainstance');
$instanceForm->addHeaderText($this->msg('openstackmanager-createinstancepuppetwarning')->text() . '<div class="mw-collapsible mw-collapsed">', 'puppetinfo');
$instanceForm->addFooterText('</div>', 'puppetinfo');
$instanceForm->setSubmitID('openstackmanager-novainstance-createinstancesubmit');
$instanceForm->setSubmitCallback(array($this, 'tryCreateSubmit'));
$instanceForm->show();
return true;
}
示例11: alterForm
protected function alterForm(HTMLForm $form)
{
$form->setId('mw-changeemail-form');
$form->setTableId('mw-changeemail-table');
$form->setSubmitTextMsg('changeemail-submit');
$form->addHiddenFields($this->getRequest()->getValues('returnto', 'returntoquery'));
$form->addHeaderText($this->msg('changeemail-header')->parseAsBlock());
if ($this->getConfig()->get('RequirePasswordforEmailChange')) {
$form->addHeaderText($this->msg('changeemail-passwordrequired')->parseAsBlock());
}
}
示例12: getRawForm
/**
* Get a form for editing the watchlist in "raw" mode
*
* @return HTMLForm
*/
protected function getRawForm()
{
$titles = implode($this->getWatchlist(), "\n");
$fields = array('Titles' => array('type' => 'textarea', 'label-message' => 'watchlistedit-raw-titles', 'default' => $titles));
$form = new HTMLForm($fields);
$form->setTitle($this->getTitle('raw'));
$form->setSubmitText(wfMessage('watchlistedit-raw-submit')->text());
$form->setWrapperLegend(wfMessage('watchlistedit-raw-legend')->text());
$form->addHeaderText(wfMessage('watchlistedit-raw-explain')->parse());
$form->setSubmitCallback(array($this, 'submitRaw'));
return $form;
}
示例13: doHeaderText
/**
* Add header text inside the form, just underneath where the errors would go
* @param $form HTMLForm
* @return void
*/
protected function doHeaderText(HTMLForm &$form)
{
global $wgRequest;
# Don't need to do anything if the form has been posted
if (!$wgRequest->wasPosted() && $this->preErrors) {
$s = HTMLForm::formatErrors($this->preErrors);
if ($s) {
$form->addHeaderText(Html::rawElement('div', array('class' => 'error'), $s));
}
}
}