当前位置: 首页>>代码示例>>PHP>>正文


PHP form::setup方法代码示例

本文整理汇总了PHP中form::setup方法的典型用法代码示例。如果您正苦于以下问题:PHP form::setup方法的具体用法?PHP form::setup怎么用?PHP form::setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在form的用法示例。


在下文中一共展示了form::setup方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($kirby, $dir)
 {
     static::$instance = $this;
     $this->kirby = $kirby;
     $this->site = $kirby->site();
     $this->roots = new Panel\Roots($dir);
     $this->urls = new Panel\Urls($kirby->urls()->index() . '/' . basename($dir));
     $this->load();
     // load all available routes
     $this->routes = array_merge($this->routes, require $this->roots->routes . DS . 'api.php');
     $this->routes = array_merge($this->routes, require $this->roots->routes . DS . 'views.php');
     // setup the blueprint root
     blueprint::$root = $this->kirby->roots()->blueprints();
     // setup the form plugin
     form::setup($this->roots->fields, $this->kirby->roots()->fields());
     // start the router
     $this->router = new Router($this->routes);
     // register router filters
     $this->router->filter('auth', function () use($kirby) {
         $user = $kirby->site()->user();
         if (!$user or !$user->hasPanelAccess()) {
             if ($user) {
                 $user->logout();
             }
             go('panel/login');
         }
     });
     // check for a completed installation
     $this->router->filter('isInstalled', function () use($kirby) {
         if ($kirby->site()->users()->count() == 0) {
             go('panel/install');
         }
     });
 }
开发者ID:DerZyklop,项目名称:gutesache.pxwrk.de,代码行数:34,代码来源:panel.php

示例2: form

 /**
  *
  */
 function show_form()
 {
     $form = new form('entry_form', null, './?mod=comment');
     $form->setup($this->msg);
     $form->addElement('text', 'sender_name', $this->msg['comment_sender'], array('size' => 40, 'maxlength' => '255'));
     $form->addElement('text', 'sender_email', $this->msg['comment_email'], array('size' => 40, 'maxlength' => '255'));
     $form->addElement('textarea', 'comment_text', $this->msg['comment_text'], array('rows' => 10, 'style' => 'width: 100%'));
     $form->addElement('submit', 'save', $this->msg['submit']);
     $form->addRule('sender_name', sprintf($this->msg['required_alert'], $this->msg['comment_sender']), 'required', null, 'client');
     $form->addRule('sender_email', sprintf($this->msg['required_alert'], $this->msg['comment_email']), 'required', null, 'client');
     $form->addRule('sender_email', $this->msg['email_invalid'], 'email', null, 'client');
     $form->addRule('comment_text', sprintf($this->msg['required_alert'], $this->msg['comment_text']), 'required', null, 'client');
     $msg = $this->msg[$this->status == 0 ? 'comment_welcome' : 'comment_sent'];
     $ret .= sprintf('<p>%1$s</p>' . LF, $msg);
     if ($this->status == 0) {
         $ret .= $form->toHtml();
     }
     return $ret;
 }
开发者ID:ajisantoso,项目名称:kateglo,代码行数:22,代码来源:class_proverb.php

示例3: array

 /**
  *
  */
 function show_search()
 {
     $operators = array('1' => $this->msg['search_1'], '2' => $this->msg['search_2'], '3' => $this->msg['search_3'], '4' => $this->msg['search_4'], '5' => $this->msg['search_5']);
     $form = new form('search_dict', 'get');
     $form->setup($msg);
     $form->addElement('hidden', 'mod', 'dictionary');
     $form->addElement('select', 'op', null, $operators);
     $form->addElement('text', 'phrase', $this->msg['phrase']);
     $form->addElement('select', 'lex', $this->msg['lex_class'], $this->db->get_row_assoc('SELECT lex_class, lex_class_name FROM lexical_class ORDER BY sort_order', 'lex_class', 'lex_class_name', $this->msg['all']));
     $form->addElement('select', 'type', $this->msg['phrase_type'], $this->db->get_row_assoc('SELECT phrase_type, phrase_type_name FROM phrase_type ORDER BY sort_order', 'phrase_type', 'phrase_type_name', $this->msg['all']));
     $form->addElement('select', 'src', $this->msg['ref_source'], $this->db->get_row_assoc('SELECT ref_source, ref_source_name
             FROM ref_source WHERE dictionary = 1', 'ref_source', 'ref_source_name', $this->msg['all']));
     $form->addElement('submit', 'srch', $this->msg['search_button']);
     $template = '<div class="search_param">%1$s: %2$s</div>' . LF;
     $ret .= $form->begin_form();
     $ret .= '<div class="panel panel-default">' . LF;
     $ret .= '<div class="panel-heading">' . $this->msg['search'] . '</div>' . LF;
     $ret .= '<div class="panel-body">' . LF;
     $ret .= sprintf($template, $this->msg['search_op'], $form->get_element('op'));
     $ret .= sprintf($template, $this->msg['phrase'], $form->get_element('phrase'));
     $ret .= sprintf($template, $this->msg['lex_class'], $form->get_element('lex'));
     $ret .= sprintf($template, $this->msg['phrase_type'], $form->get_element('type'));
     $ret .= sprintf($template, $this->msg['ref_source'], $form->get_element('src'));
     $ret .= $form->get_element('mod');
     $ret .= $form->get_element('srch');
     $ret .= '</div>' . LF;
     $ret .= '</div>' . LF;
     $ret .= $form->end_form();
     return $ret;
 }
开发者ID:ajisantoso,项目名称:kateglo,代码行数:33,代码来源:class_dictionary.php

示例4: show_header

/**
 * @return Search form HTML
 */
function show_header()
{
    global $msg, $auth, $db;
    global $_GET;
    $mods = array('dictionary' => $msg['dictionary'], 'glossary' => $msg['glossary'], 'proverb' => $msg['proverb']);
    $navMenu .= sprintf('<a href="./">%1$s</a>', $msg['home']);
    foreach ($mods as $key => $mod) {
        $navMenu .= '&nbsp;&nbsp;&nbsp;';
        $navMenu .= sprintf('<a href="./?mod=%1$s">%2$s</a>', $key, $mod);
    }
    $form = new form('search_form', 'get');
    $form->setup($msg);
    $form->addElement('text', 'phrase', $msg['enter_phrase'], array('size' => 20, 'maxlength' => 255));
    $form->addElement('select', 'mod', null, $mods);
    $form->addElement('submit', 'search', $msg['search_button']);
    $ret .= $form->begin_form();
    // logo
    $ret .= '<div id="header">' . LF;
    $ret .= '<table cellpadding="0" cellspacing="0" width="100%"><tr>' . LF;
    $ret .= '<td width="1%">' . LF;
    $ret .= '<a href="./"><img src="images/kateglo40.png" width="129" height="40" border="0" alt="Kateglo" title="Kateglo" /></a>' . LF;
    $ret .= '</td>' . LF;
    // search form
    $template = '<td style="padding-left:5px;">%1$s</td>' . LF;
    $ret .= '<td align="right"><table cellpadding="0" cellspacing="0"><tr>' . LF;
    $ret .= sprintf($template, $form->get_element('phrase'));
    $ret .= sprintf($template, $msg['search_in']);
    $ret .= sprintf($template, $form->get_element('mod'));
    $ret .= sprintf($template, $form->get_element('search'));
    $ret .= '</tr></table></td>' . LF;
    $ret .= '</tr></table>' . LF;
    $ret .= '</div>' . LF;
    // navigation
    $ret .= '<div id="navbar">' . LF;
    $ret .= '<table cellpadding="0" cellspacing="0" width="100%"><tr>' . LF;
    $ret .= '<td>' . LF;
    $ret .= $navMenu;
    $ret .= '</td>' . LF;
    $ret .= '<td align="right">' . LF;
    if ($auth->checkAuth()) {
        $ret .= sprintf('%3$s&nbsp;&nbsp;&nbsp;<a href="%5$s">%4$s</a>&nbsp;&nbsp;&nbsp;<a href="%2$s">%1$s</a>' . LF, $msg['logout'], './?mod=user&action=logout', $auth->getUsername(), $msg['change_pwd'], './?mod=user&action=password');
    } else {
        $ret .= sprintf('<a href="%2$s">%1$s</a>' . LF, $msg['login'], './?mod=user&action=login');
    }
    $ret .= '</td>' . LF;
    $ret .= '</tr></table>' . LF;
    $ret .= '</div>' . LF;
    $ret .= $form->end_form();
    return $ret;
}
开发者ID:mediasahabat,项目名称:kateglo,代码行数:53,代码来源:common.php

示例5: form

 /**
  *
  */
 function show_form()
 {
     $url_pattern = '/^http(s?):\\/\\/([\\w-]+\\.)+[\\w-]+(\\/[\\w-\\.\\/\\?\\+%&=]*)?$/';
     $form = new form('entry_form', null, './?mod=comment');
     $form->setup($this->msg);
     $form->addElement('text', 'sender_name', $this->msg['comment_sender'], array('size' => 40, 'maxlength' => '255'));
     $form->addElement('text', 'sender_email', $this->msg['comment_email'], array('size' => 40, 'maxlength' => '255'));
     $form->addElement('text', 'url', $this->msg['url'], array('size' => 40, 'maxlength' => '255'));
     $form->addElement('textarea', 'comment_text', $this->msg['comment_text'], array('rows' => 10, 'style' => 'width: 100%'));
     $form->addElement('submit', 'save', $this->msg['submit']);
     $form->addRule('sender_name', sprintf($this->msg['required_alert'], $this->msg['comment_sender']), 'required', null, 'client');
     $form->addRule('sender_email', sprintf($this->msg['required_alert'], $this->msg['comment_email']), 'required', null, 'client');
     $form->addRule('sender_email', $this->msg['email_invalid'], 'email', null, 'client');
     $form->addRule('url', $this->msg['url_invalid'], 'regex', $url_pattern, 'client');
     $form->addRule('comment_text', sprintf($this->msg['required_alert'], $this->msg['comment_text']), 'required', null, 'client');
     $form->setDefaults(array('url' => 'http://'));
     $msg = $this->msg[$this->status == 0 ? 'comment_welcome' : 'comment_sent'];
     $ret .= sprintf('<p>%1$s</p>' . LF, $msg);
     if ($this->status == 0) {
         $ret .= $form->toHtml();
     }
     return $ret;
 }
开发者ID:mediasahabat,项目名称:kateglo,代码行数:26,代码来源:class_comment.php

示例6: sprintf

 /**
  * Return HTML code of change password form
  */
 function change_password_form()
 {
     if ($this->auth->checkAuth()) {
         // welcome message
         $msg = $this->msg['pwd_welcome'];
         if ($this->status == PROCESS_FAILED) {
             $msg = $this->msg['pwd_chg_failed'] . ' ' . $msg;
         }
         if ($this->status == PROCESS_SUCCEED) {
             $msg = $this->msg['pwd_chg_succeed'];
         }
         $ret .= sprintf('<h1>' . $this->msg['change_pwd'] . '</h1>') . LF;
         $ret .= sprintf('<p>' . $msg . '</p>') . LF;
         // form
         if ($this->status != PROCESS_SUCCEED) {
             $form = new form('change_password_form', null, './?mod=user&action=password');
             $form->setup($this->msg);
             $form->addElement('password', 'pwd_current', $this->msg['pwd_current']);
             $form->addElement('password', 'pwd_new', $this->msg['pwd_new']);
             $form->addElement('password', 'pwd_retype', $this->msg['pwd_retype']);
             $form->addElement('submit', null, $this->msg['submit']);
             $form->addRule('pwd_current', sprintf($this->msg['required_alert'], $this->msg['pwd_current']), 'required', null, 'client');
             $form->addRule('pwd_new', sprintf($this->msg['required_alert'], $this->msg['pwd_new']), 'required', null, 'client');
             $form->addRule('pwd_retype', sprintf($this->msg['required_alert'], $this->msg['pwd_retype']), 'required', null, 'client');
             $form->addRule(array('pwd_new', 'pwd_retype'), $this->msg['pwd_nomatch'], 'compare', null, 'client');
             $ret .= $form->toHtml();
         }
         return $ret;
     }
     return $ret;
 }
开发者ID:ajisantoso,项目名称:kateglo,代码行数:34,代码来源:class_user.php

示例7: define

<?php

if (!defined('DS')) {
    define('DS', DIRECTORY_SEPARATOR);
}
// panel roots
root('panel', dirname(__DIR__));
root('panel.assets', root('panel') . DS . 'assets');
// app setup
root('panel.app', root('panel') . DS . 'app');
root('panel.app.languages', root('panel.app') . DS . 'languages');
root('panel.app.fields', root('panel.app') . DS . 'fields');
root('panel.app.lib', root('panel.app') . DS . 'lib');
root('panel.app.controllers', root('panel.app') . DS . 'controllers');
root('panel.app.models', root('panel.app') . DS . 'models');
root('panel.app.layouts', root('panel.app') . DS . 'layouts');
root('panel.app.views', root('panel.app') . DS . 'views');
root('panel.app.routes', root('panel.app') . DS . 'routes');
root('panel.app.snippets', root('panel.app') . DS . 'snippets');
// autoloader
load(array('app' => root('panel.app.lib') . DS . 'app.php', 'view' => root('panel.app.lib') . DS . 'view.php', 'controller' => root('panel.app.lib') . DS . 'controller.php', 'layout' => root('panel.app.lib') . DS . 'layout.php', 'snippet' => root('panel.app.lib') . DS . 'snippet.php', 'api' => root('panel.app.lib') . DS . 'api.php', 'pagedata' => root('panel.app.lib') . DS . 'pagedata.php', 'filedata' => root('panel.app.lib') . DS . 'filedata.php', 'installation' => root('panel.app.lib') . DS . 'installation.php', 'form' => root('panel.app.lib') . DS . 'form.php', 'fieldoptions' => root('panel.app.lib') . DS . 'fieldoptions.php', 'assets' => root('panel.app.lib') . DS . 'assets.php', 'history' => root('panel.app.lib') . DS . 'history.php', 'blueprint' => root('panel.app.lib') . DS . 'blueprint.php', 'blueprint\\pages' => root('panel.app.lib') . DS . 'blueprint' . DS . 'pages.php', 'blueprint\\files' => root('panel.app.lib') . DS . 'blueprint' . DS . 'files.php', 'blueprint\\fields' => root('panel.app.lib') . DS . 'blueprint' . DS . 'fields.php', 'blueprint\\field' => root('panel.app.lib') . DS . 'blueprint' . DS . 'field.php'));
// load all helper functions
require root('panel.app') . DS . 'helpers.php';
// setup the form plugin
form::setup(root('panel.app.fields'));
// panel upload defaults
c::set('panel.upload.accept', function ($file) {
    $types = array('image', 'video', 'audio', 'archive', 'document');
    return in_array($file->type(), $types);
});
开发者ID:kompuser,项目名称:panel,代码行数:30,代码来源:bootstrap.php

示例8: form

    /**
     *
     */
    function show_form()
    {
        $query = 'SELECT a.* FROM glossary a
			WHERE a.glo_uid = ' . $this->db->quote($_GET['uid']);
        $this->entry = $this->db->get_row($query);
        $is_new = is_array($this->entry) ? 0 : 1;
        $form = new form('entry_form', null, './' . $this->get_url_param());
        $form->setup($this->msg);
        $form->addElement('text', 'original', $this->msg['en'], array('size' => 40, 'maxlength' => '255'));
        $form->addElement('text', 'phrase', $this->msg['id'], array('size' => 40, 'maxlength' => '255'));
        $form->addElement('select', 'discipline', $this->msg['discipline'], $this->db->get_row_assoc('SELECT * FROM discipline ORDER BY discipline_name', 'discipline', 'discipline_name'));
        $form->addElement('select', 'ref_source', $this->msg['ref_source'], $this->db->get_row_assoc('SELECT * FROM ref_source WHERE glossary = 1', 'ref_source', 'ref_source_name'));
        $form->addElement('text', 'wpen', $this->msg['wpen'], array('size' => 40, 'maxlength' => '255'));
        $form->addElement('text', 'wpid', $this->msg['wpid'], array('size' => 40, 'maxlength' => '255'));
        $form->addElement('hidden', 'glo_uid');
        $form->addElement('hidden', 'is_new', $is_new);
        $form->addElement('submit', 'save', $this->msg['save']);
        $form->addRule('phrase', sprintf($this->msg['required_alert'], $this->msg['id']), 'required', null, 'client');
        $form->addRule('original', sprintf($this->msg['required_alert'], $this->msg['en']), 'required', null, 'client');
        $form->addRule('discipline', sprintf($this->msg['required_alert'], $this->msg['discipline']), 'required', null, 'client');
        $form->addRule('ref_source', sprintf($this->msg['required_alert'], $this->msg['ref_source']), 'required', null, 'client');
        $form->setDefaults($this->entry);
        $ret .= sprintf('<h1>%1$s</h1>' . LF, ($is_new ? $this->msg['new'] : $this->msg['edit']) . ' - ' . $this->msg['glossary']);
        $ret .= $form->toHtml();
        return $ret;
    }
开发者ID:mediasahabat,项目名称:kateglo,代码行数:29,代码来源:class_glossary.php

示例9: form

 /**
  *
  */
 function show_form()
 {
     $query = 'SELECT a.* FROM abbr_entry a
         WHERE a.abbr_idx = ' . $this->db->quote($_GET['uid']);
     $this->entry = $this->db->get_row($query);
     $is_new = is_array($this->entry) ? 0 : 1;
     $form = new form('entry_form', null, './' . $this->get_url_param());
     $form->setup($this->msg);
     $form->addElement('text', 'abbr_key', $this->msg['abbr_acr'], array('size' => 20, 'maxlength' => '20'));
     $form->addElement('text', 'abbr_id', $this->msg['abbr_id'], array('size' => 40, 'maxlength' => '4000'));
     $form->addElement('text', 'abbr_en', $this->msg['abbr_en'], array('size' => 40, 'maxlength' => '4000'));
     $form->addElement('text', 'abbr_type', $this->msg['phrase_type'], array('size' => 20, 'maxlength' => '255'));
     $form->addElement('text', 'lang', $this->msg['lang'], array('size' => 20, 'maxlength' => '255'));
     $form->addElement('text', 'redirect_to', $this->msg['actual_phrase'], array('size' => 20, 'maxlength' => '255'));
     $form->addElement('text', 'source', $this->msg['ref_source'], array('size' => 20, 'maxlength' => '255'));
     $form->addElement('text', 'url', $this->msg['url'], array('size' => 40, 'maxlength' => '255'));
     $form->addElement('textarea', 'notes', $this->msg['notes'], array('style' => 'width:100%'));
     $form->addElement('hidden', 'abbr_idx');
     $form->addElement('hidden', 'is_new', $is_new);
     $form->addElement('submit', 'save', $this->msg['save']);
     $form->addRule('abbr_key', sprintf($this->msg['required_alert'], $this->msg['abbr_key']), 'required', null, 'client');
     $form->setDefaults($this->entry);
     $ret .= sprintf('<h1>%1$s</h1>' . LF, ($is_new ? $this->msg['new'] : $this->msg['edit']) . ' - ' . $this->msg['abbr']);
     $ret .= $form->toHtml();
     return $ret;
 }
开发者ID:ajisantoso,项目名称:kateglo,代码行数:29,代码来源:class_abbr.php

示例10: array

 /**
  *
  */
 function show_search()
 {
     $operators = array('1' => $this->msg['search_1'], '2' => $this->msg['search_2'], '3' => $this->msg['search_3'], '4' => $this->msg['search_4'], '5' => $this->msg['search_5']);
     $form = new form('search_dict', 'get');
     $form->setup($msg);
     $form->addElement('hidden', 'mod', 'dictionary');
     $form->addElement('select', 'op', null, $operators);
     $form->addElement('text', 'phrase', $this->msg['phrase']);
     $form->addElement('select', 'lex', $this->msg['lex_class'], $this->db->get_row_assoc('SELECT lex_class, lex_class_name FROM lexical_class ORDER BY sort_order', 'lex_class', 'lex_class_name', $this->msg['all']));
     $form->addElement('select', 'type', $this->msg['phrase_type'], $this->db->get_row_assoc('SELECT phrase_type, phrase_type_name FROM phrase_type ORDER BY sort_order', 'phrase_type', 'phrase_type_name', $this->msg['all']));
     $form->addElement('submit', 'srch', $this->msg['search_button']);
     $template = '<span class="search_param">%1$s: %2$s</span>' . LF;
     $ret .= '<fieldset>' . LF;
     $ret .= '<legend>' . $this->msg['search'] . '</legend>' . LF;
     $ret .= $form->begin_form();
     $ret .= sprintf($template, $this->msg['search_op'], $form->get_element('op'));
     $ret .= sprintf($template, $this->msg['phrase'], $form->get_element('phrase'));
     $ret .= sprintf($template, $this->msg['lex_class'], $form->get_element('lex'));
     $ret .= sprintf($template, $this->msg['phrase_type'], $form->get_element('type'));
     $ret .= $form->get_element('mod');
     $ret .= $form->get_element('srch');
     $ret .= $form->end_form();
     $ret .= '</fieldset>' . LF;
     return $ret;
 }
开发者ID:mediasahabat,项目名称:kateglo,代码行数:28,代码来源:class_dictionary.php


注:本文中的form::setup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。