本文整理汇总了PHP中Doku_Form类的典型用法代码示例。如果您正苦于以下问题:PHP Doku_Form类的具体用法?PHP Doku_Form怎么用?PHP Doku_Form使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Doku_Form类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showTemplateSwitcher
/**
* Builds a select box with all available templates
* (unless excluded in 'excludeTemplates')
* or show only two templates for mobile switcher: standard plus mobile template
*
* @author Anika Henke <anika@selfthinker.org>
*/
public function showTemplateSwitcher()
{
global $conf;
global $ID;
global $ACT;
if ($ACT != 'show') {
return;
}
$mobileSwitch = $this->getConf('mobileSwitch');
$mobileTpl = $this->getConf('mobileTemplate');
if ($mobileSwitch && $mobileTpl) {
// templates for mobile switcher
$templates = array($mobileTpl => $this->getLang('switchMobile'), $this->origTpl => $this->getLang('switchFull'));
} else {
// all templates (minus excluded templates)
$excludeTemplates = array_map('trim', explode(",", $this->getConf('excludeTemplates')));
$templates = array_diff($this->getTemplates(), $excludeTemplates);
}
$form = new Doku_Form(array('id' => 'tpl__switcher', 'title' => $this->getLang('switchTpl'), 'action' => wl($ID)));
$form->addHidden('act', 'select');
$form->addElement(form_makeListboxField('tpl', $templates, $conf['template'], $this->getLang('template'), '', '', array('class' => 'quickselect')));
$form->addElement(form_makeButton('submit', '', $this->getLang('switch'), array('name' => 'switch')));
$out = '<div class="plugin_loadskin">';
$out .= $form->getForm();
$out .= '</div>';
return $out;
}
示例2: _render
function _render($act)
{
global $ID;
$form = new Doku_Form(array('id' => 'forcessllogin1', 'action' => 'https://' . $this->host() . DOKU_BASE . DOKU_SCRIPT, 'method' => 'get'));
$form->addHidden('id', $ID);
$form->addHidden('do', $act);
if ($this->getConf('cert')) {
if (strpos($this->getLang('certinfo'), '{{name}}') !== false) {
$form->addElement('<p>' . str_replace('{{name}}', $this->getConf('cert'), $this->getLang('certinfo')) . '</p>' . NL);
} else {
$form->addElement('<p>' . $this->getLang('certinfo') . " " . $this->getConf('cert') . '</p>' . NL);
}
}
if ($this->getConf('ca')) {
if (strpos($this->getLang('ca'), '{{name}}') !== false) {
$form->addElement('<p>' . str_replace('{{name}}', $this->getConf('ca'), $this->getLang('cainfo')) . '</p>' . NL);
} else {
$form->addElement('<p>' . $this->getLang('cainfo') . " <a href='" . $this->getConf('ca') . "'>" . $this->getConf('ca') . "</a></p>" . NL);
}
}
$form->addElement(form_makeButton('submit', '', $this->getLang('submit'), array('accesskey' => 'h', 'title' => $this->getLang('submittitle'), id => 'focus__this')));
$form->printForm();
$form = new Doku_Form(array('id' => 'forcessllogin2', 'method' => 'get'));
$form->addElement(form_makeButton('submit', '', $this->getLang('cancel'), array('accesskey' => 'c', 'title' => $this->getLang('canceltitle'))));
$form->printForm();
}
示例3: tplMetaDataForm
public function tplMetaDataForm(Doku_Event &$event)
{
if ($event->data != 'social_form') {
return;
}
global $ID;
echo '<div class="plugin_social">';
echo '<div class="form" id="pluginsocialform" >';
$form = new Doku_Form(array());
$form->addHidden('target', 'plugin_social');
$form->addHidden('id', $ID);
$form->addHidden('do', 'social_save');
foreach (helper_plugin_social_meta::$metaEditableKeys as $type => $values) {
$form->addElement('<div>');
$form->startFieldset($type);
foreach ($values as $value) {
$metadata = $this->helper->meta->getMetaData();
$name = $this->helper->meta->getMetaPropertyName($type, $value);
$form->addElement(form_makeTextField($name, $metadata[$name], $name, null, 'block'));
}
$form->endFieldset();
$form->addElement('</div>');
}
$form->addElement(form_makeButton('submit', null, $this->getLang('btnSave')));
html_form('', $form);
echo '</div>';
echo '</div>';
$event->preventDefault();
}
示例4: renderfield
/**
* Render the field as XHTML
*
* Outputs the represented field using the passed Doku_Form object.
* Additional parameters (CSS class & HTML name) are passed in $params.
*
* @params array $params Additional HTML specific parameters
* @params Doku_Form $form The target Doku_Form object
* @params int $formid unique identifier of the form which contains this field
*/
public function renderfield($params, Doku_Form $form, $formid)
{
$this->_handlePreload();
if (!$form->_infieldset) {
$form->startFieldset('');
}
if ($this->error) {
$params['class'] = 'bureaucracy_error';
}
$params = array_merge($this->opt, $params);
list($name, $entries, $value, $label, $id, $class) = $this->_parse_tpl(array('@@NAME@@', $params['args'], '@@VALUE@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@'), $params);
$value = in_array($value, $entries) ? $value : null;
$valueoffieldwithid = $value !== null ? $value : current($entries);
// label
$s = '<label';
$s .= ' class="radiolabel ' . $class . '"';
$s .= '><span>' . $label . '</span>';
$s .= '</label>';
$form->addElement($s);
// radio fields
foreach ($entries as $val) {
if ($value === $val) {
$attrs = array('checked' => 'checked');
} else {
$attrs = array();
}
if ($valueoffieldwithid === $val) {
$_id = $id;
//e.g. autofocus with 'focus__this' id
} else {
$_id = '';
}
$form->addElement(form_makeRadioField($name, $val, $val, $_id, $class, $attrs));
}
}
示例5: html
function html()
{
echo $this->locale_xhtml('intro_clean');
$form = new Doku_Form(array('method' => 'post'));
$form->addHidden('page', 'data_clean');
$form->addHidden('data_go', 'go');
$form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit_clean')));
$form->printForm();
}
示例6: renderfield
/**
* Render the field as XHTML
*
* Outputs the represented field using the passed Doku_Form object.
* Additional parameters (CSS class & HTML name) are passed in $params.
*
* @params array $params Additional HTML specific parameters
* @params Doku_Form $form The target Doku_Form object
*/
public function renderfield($params, Doku_Form $form)
{
$this->_handlePreload();
if (!$form->_infieldset) {
$form->startFieldset('');
}
if ($this->error) {
$params['class'] = 'bureaucracy_error';
}
$params = array_merge($this->opt, $params);
$form->addElement(call_user_func_array('form_makeListboxField', $this->_parse_tpl(array('@@NAME@@', $params['args'], '@@VALUE|' . $params['args'][0] . '@@', '@@DISPLAY@@', '', '@@CLASS@@'), $params)));
}
示例7: renderfield
/**
* Render the top of the fieldset as XHTML
*
* @params array $params Additional HTML specific parameters
* @params Doku_Form $form The target Doku_Form object
* @params int $formid unique identifier of the form which contains this field
*/
function renderfield($params, Doku_Form $form, $formid)
{
$form->startFieldset(hsc($this->getParam('display')));
if (isset($this->depends_on)) {
$dependencies = array_map('hsc', (array) $this->depends_on);
if (count($this->depends_on) > 1) {
$msg = 'Only edit this fieldset if ' . '“<span class="bureaucracy_depends_fname">%s</span>” ' . 'is set to “<span class="bureaucracy_depends_fvalue">%s</span>”.';
} else {
$msg = 'Only edit this fieldset if ' . '“<span class="bureaucracy_depends_fname">%s</span>” is set.';
}
$form->addElement('<p class="bureaucracy_depends">' . vsprintf($msg, $dependencies) . '</p>');
}
}
示例8: xhtml
public function xhtml($editor_id, $do)
{
$controls = '<div>';
if (!$this->read_only) {
$form = new Doku_Form(array('class' => 'editor_edit_form', 'editor' => $editor_id));
$form->addElement(form_makeButton('submit', '', 'edit'));
$controls .= $form->getForm();
$controls .= '<div class="editor_save_controls">';
$form = new Doku_Form(array('class' => 'editor_save_form', 'editor' => $editor_id));
$form->addElement(form_makeButton('submit', 'savecontent', 'save'));
$controls .= $form->getForm() . cancel_button() . '</div>';
}
return $controls . $this->editor_xhtml($editor_id, $do) . '</div>';
}
示例9: test_close_fieldset
function test_close_fieldset()
{
$form = new Doku_Form(array('id' => 'dw__testform', 'action' => '/test'));
$form->startFieldset('Test');
$form->addHidden('summary', 'changes &c');
$form->addElement(form_makeTextField('t', 'v', 'Text', 'text__id', 'block'));
$form->addElement(form_makeCheckboxField('r', '1', 'Check', 'check__id', 'simple'));
$form->addElement(form_makeButton('submit', 'save', 'Save', array('accesskey' => 's')));
$form->addElement(form_makeButton('submit', 'cancel', 'Cancel'));
ob_start();
$form->printForm();
$output = ob_get_contents();
ob_end_clean();
$this->assertEquals($this->_ignoreTagWS($output), $this->_ignoreTagWS($this->_realoutput()));
}
示例10: xhtml_action
function xhtml_action($action, $title, $hidden_fields = array(), $fields = array())
{
$hidden_fields['do'] = $action;
$name = preg_replace('/[^0-9A-Za-z_]+/', '_', $title);
$formID = "PROJECTS_{$name_form}";
$form = new Doku_Form(array('id' => $formID));
foreach ($hidden_fields as $name => $value) {
$form->addHidden($name, $value);
}
foreach ($fields as $field) {
$form->addElement($field);
}
$form->addElement("<a href=\"\" class=\"action_link\">{$title}</a>");
return '<span class="action">' . $form->getForm() . '</span>';
}
示例11: renderfield
/**
* Render the field as XHTML
*
* @params array $params Additional HTML specific parameters
* @params Doku_Form $form The target Doku_Form object
*/
public function renderfield($params, Doku_Form $form)
{
if (!syntax_plugin_bureaucracy_field_submit::$captcha_displayed) {
syntax_plugin_bureaucracy_field_submit::$captcha_displayed = true;
/** @var helper_plugin_captcha $helper */
$helper = null;
if (@is_dir(DOKU_PLUGIN . 'captcha')) {
$helper = plugin_load('helper', 'captcha');
}
if (!is_null($helper) && $helper->isEnabled()) {
$form->addElement($helper->getHTML());
}
}
$this->tpl = form_makeButton('submit', '', '@@DISPLAY|' . $this->getLang('submit') . '@@');
parent::renderfield($params, $form);
}
示例12: action_button
function action_button($button_name, $action = '', $hidden = NULL)
{
global $ID;
$form = new Doku_Form('Form_' . $button_name);
if (!$action) {
$action = $button_name;
}
$form->addHidden('do', $action);
if (is_array($hidden)) {
foreach ($hidden as $key => $value) {
$form->addHidden($key, $value);
}
}
$form->addElement(form_makeButton('submit', '', $button_name));
return $form->getForm();
}
示例13: renderfield
/**
* Creates the HTML for the field
*
* @param array $params
* @param Doku_Form $form
* @param int $formid
*/
public function renderfield($params, Doku_Form $form, $formid)
{
if (!$this->column) {
return;
}
// this is what parent does
$this->_handlePreload();
if (!$form->_infieldset) {
$form->startFieldset('');
}
if ($this->error) {
$params['class'] = 'bureaucracy_error';
}
// output the field
$value = new Value($this->column, $this->opt['value']);
$field = $this->makeField($value, $params['name']);
$form->addElement($field);
}
示例14: renderfield
/**
* Render the field as XHTML
*
* @params array $params Additional HTML specific parameters
* @params Doku_Form $form The target Doku_Form object
* @params int $formid unique identifier of the form which contains this field
*/
public function renderfield($params, Doku_Form $form, $formid)
{
if (!isset(helper_plugin_bureaucracy_fieldsubmit::$captcha_displayed[$formid])) {
helper_plugin_bureaucracy_fieldsubmit::$captcha_displayed[$formid] = true;
/** @var helper_plugin_captcha $helper */
$helper = null;
if (@is_dir(DOKU_PLUGIN . 'captcha')) {
$helper = plugin_load('helper', 'captcha');
}
if (!is_null($helper) && $helper->isEnabled()) {
$form->addElement($helper->getHTML());
}
}
$attr = array();
if (isset($this->opt['id'])) {
$attr['id'] = $this->opt['id'];
}
$this->tpl = form_makeButton('submit', '', '@@DISPLAY|' . $this->getLang('submit') . '@@', $attr);
parent::renderfield($params, $form, $formid);
}
示例15: html
function html()
{
$sqlite = $this->dthlp->_getDB();
if (!$sqlite) {
return false;
}
echo $this->locale_xhtml('admin_intro');
$sql = "SELECT * FROM aliases ORDER BY name";
$res = $sqlite->query($sql);
$rows = $sqlite->res2arr($res);
$form = new Doku_Form(array('method' => 'post'));
$form->addHidden('page', 'data_aliases');
$form->addElement('<table class="inline">' . '<tr>' . '<th>' . $this->getLang('name') . '</th>' . '<th>' . $this->getLang('type') . '</th>' . '<th>' . $this->getLang('prefix') . '</th>' . '<th>' . $this->getLang('postfix') . '</th>' . '<th>' . $this->getLang('enum') . '</th>' . '</tr>');
// add empty row for adding a new entry
$rows[] = array('name' => '', 'type' => '', 'prefix' => '', 'postfix' => '', 'enum' => '');
$cur = 0;
foreach ($rows as $row) {
$form->addElement('<tr>');
$form->addElement('<td>');
$form->addElement(form_makeTextField('d[' . $cur . '][name]', $row['name'], ''));
$form->addElement('</td>');
$form->addElement('<td>');
$form->addElement(form_makeMenuField('d[' . $cur . '][type]', array('', 'page', 'title', 'mail', 'url', 'dt', 'wiki'), $row['type'], ''));
$form->addElement('</td>');
$form->addElement('<td>');
$form->addElement(form_makeTextField('d[' . $cur . '][prefix]', $row['prefix'], ''));
$form->addElement('</td>');
$form->addElement('<td>');
$form->addElement(form_makeTextField('d[' . $cur . '][postfix]', $row['postfix'], ''));
$form->addElement('</td>');
$form->addElement('<td>');
$form->addElement(form_makeTextField('d[' . $cur . '][enum]', $row['enum'], ''));
$form->addElement('</td>');
$form->addElement('</tr>');
$cur++;
}
$form->addElement('</table>');
$form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
$form->printForm();
}