本文整理汇总了PHP中form::field方法的典型用法代码示例。如果您正苦于以下问题:PHP form::field方法的具体用法?PHP form::field怎么用?PHP form::field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类form
的用法示例。
在下文中一共展示了form::field方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onDefault
public function onDefault()
{
if (form::isPostBack()) {
$post = array();
$post['username'] = request::post('username');
$post['password'] = request::post('password');
$post['logintime'] = time();
$user = zotop::model('zotop.user');
$data = $user->read($post['username'], 'username');
//zotop::dump($data);
if ($data == false) {
msg::error('登陆失败', zotop::t('账户名称`{$username}`不存在,请检查!', array('username' => $post['username'])));
}
zotop::user($data);
msg::success('登陆成功', '登陆成功,系统正在加载中', 'reload', 2);
}
if (zotop::user() != null) {
zotop::redirect('zotop/index');
}
$header['title'] = '用户登录';
$header['js'] = url::module() . '/admin/js/login.js';
$header['body']['class'] = "login";
page::header($header);
block::header(array('id' => 'LoginWindow', 'title' => '用户登录'));
form::header(array('title' => '', 'description' => '请输入用户名和密码', 'class' => 'small'));
form::field(array('type' => 'text', 'label' => zotop::t('帐 户(U)'), 'name' => 'username', 'value' => zotop::user('username'), 'valid' => 'required:true'));
form::field(array('type' => 'password', 'label' => zotop::t('密 码(P)'), 'name' => 'password', 'value' => ''));
form::buttons(array('type' => 'submit', 'value' => '登 陆'), array('type' => 'button', 'name' => 'options', 'value' => '选 项'));
form::footer();
block::footer();
page::footer();
}
示例2: gui
public function gui()
{
if ($this->status) {
dcPage::success(__('Content successfully imported.'));
}
echo '<form action="' . $this->getURL(true) . '" method="post">' . '<p>' . sprintf(__('Add a feed content to the current blog: <strong>%s</strong>.'), html::escapeHTML($this->core->blog->name)) . '</p>' . '<p><label for="feed_url">' . __('Feed URL:') . '</label>' . form::field('feed_url', 50, 300, html::escapeHTML($this->feed_url)) . '</p>' . '<p>' . $this->core->formNonce() . form::hidden(array('do'), 1) . '<input type="submit" value="' . __('Import') . '" /></p>' . '</form>';
}
示例3: onDefault
public function onDefault()
{
if (form::isPostBack()) {
msg::error('开发中', '数据保存开发中,请稍后……');
}
$header['title'] = '系统设置';
page::header($header);
page::top();
page::navbar($this->navbar(), 'main');
form::header();
block::header('网站基本信息');
form::field(array('type' => 'text', 'label' => zotop::t('网站名称'), 'name' => 'zotop.site.title', 'value' => zotop::config('zotop.site.title'), 'description' => zotop::t('网站名称,将显示在标题和导航中')));
form::field(array('type' => 'text', 'label' => zotop::t('网站域名'), 'name' => 'zotop.site.domain', 'value' => zotop::config('zotop.site.domain'), 'description' => zotop::t('网站域名地址,不包含http://,如:www.zotop.com')));
form::field(array('type' => 'text', 'label' => zotop::t('备案信息'), 'name' => 'zotop.site.icp', 'value' => zotop::config('zotop.site.icp'), 'description' => zotop::t('页面底部可以显示 ICP 备案信息,如果网站已备案,在此输入您的授权码,它将显示在页面底部,如果没有请留空')));
form::field(array('type' => 'select', 'options' => array('0' => '不显示', '1' => '显示'), 'label' => zotop::t('授权信息'), 'name' => 'zotop.site.license', 'value' => zotop::config('zotop.site.license'), 'description' => zotop::t('页脚部位显示程序官方网站链接')));
form::field(array('type' => 'textarea', 'label' => zotop::t('网站简介'), 'name' => 'zotop.site.about', 'value' => zotop::config('zotop.site.about')));
block::footer();
block::header('联系信息设置');
form::field(array('type' => 'text', 'label' => zotop::t('公司名称'), 'name' => 'zotop.site.title', 'value' => '', 'description' => zotop::t('网站隶属的公司或者组织名称')));
form::field(array('type' => 'textarea', 'label' => zotop::t('网站简介'), 'name' => 'zotop.site.about', 'value' => ''));
block::footer();
form::buttons(array('type' => 'submit'), array('type' => 'back'));
form::footer();
page::bottom();
page::footer();
}
示例4: add
public function add($id = '/')
{
$page = $this->page($id);
$blueprint = blueprint::find($page);
$templates = $blueprint->pages()->template();
$options = array();
$back = array('subpages' => purl('subpages/index/' . $page->id()), 'page' => purl($page, 'show'));
$form = app::form('pages.add');
$form->save = l('add');
$form->back = a::get($back, get('to'));
foreach ($templates as $template) {
$options[$template->name()] = $template->title();
}
$select = form::field('select', array('name' => 'template', 'label' => l('pages.add.template.label'), 'options' => $options, 'required' => true));
if ($templates->count() == 1) {
$select->readonly = true;
$select->value = $templates->first()->name();
}
$form->fields()->append('template', $select);
if (api::maxPages($page, $blueprint->pages()->max())) {
$form->fields = array('info' => form::field('info', array('label' => 'pages.add.error.max.headline', 'text' => 'pages.add.error.max.text')));
$form->save = false;
$form->centered = true;
}
return view('pages/add', array('page' => $page, 'form' => $form));
}
示例5: gui
public function gui()
{
if ($this->status) {
echo '<p class="message">' . __('Content successfully imported.') . '</p>';
}
echo '<h3>' . __('Import from a feed') . '</h3>' . '<p>' . sprintf(__('This will import a feed (RSS or Atom) a as new content in the current blog: %s.'), '<strong>' . html::escapeHTML($this->core->blog->name) . '</strong>') . '</p>' . '<form action="' . $this->getURL(true) . '" method="post">' . '<fieldset>' . $this->core->formNonce() . form::hidden(array('do'), 1) . '<p><label>' . __('Feed URL:') . ' ' . form::field('feed_url', 40, 300, html::escapeHTML($this->feed_url)) . '</label></p>' . '<p><input type="submit" value="' . __('Send') . '" /></p>' . '</fieldset>' . '</form>';
}
示例6: settingLine
function settingLine($id, $s, $ns, $field_name, $strong_label)
{
if ($s['type'] == 'boolean') {
$field = form::combo(array($field_name . '[' . $ns . '][' . $id . ']', $field_name . '_' . $id), array(__('yes') => 1, __('no') => 0), $s['value']);
} else {
$field = form::field(array($field_name . '[' . $ns . '][' . $id . ']', $field_name . '_' . $id), 40, null, html::escapeHTML($s['value']));
}
$slabel = $strong_label ? '<strong>%s</strong>' : '%s';
return '<tr>' . '<td><label for="s_' . $id . '">' . sprintf($slabel, html::escapeHTML($id)) . '</label></td>' . '<td>' . $field . '</td>' . '<td>' . $s['type'] . '</td>' . '<td>' . html::escapeHTML($s['label']) . '</td>' . '</tr>';
}
示例7: onSend
public function onSend()
{
$header['title'] = '发送短消息';
dialog::header($header);
form::header(array('title' => '', 'description' => '请输入收信人的账户并输入短消息内容', 'class' => 'small'));
form::field(array('type' => 'text', 'label' => zotop::t('收信人'), 'name' => 'sendto', 'value' => '', 'description' => '请输入收信人的账户名称,多个账户之间请用’逗号‘隔开'));
form::field(array('type' => 'textarea', 'label' => zotop::t('内 容'), 'name' => 'content', 'value' => ''));
form::buttons(array('type' => 'submit', 'value' => '发 送'), array('type' => 'button', 'name' => 'close', 'value' => '取消', 'class' => 'zotop-dialog-close'));
form::footer();
dialog::footer();
}
示例8: actionAttrs
public function actionAttrs($type = '')
{
if (empty($type)) {
return false;
}
$field = zotop::model('system.config');
$attrs = $field->getControlAttrs($type);
foreach ($attrs as $attr) {
form::field($attr);
}
}
示例9: item
public static function item($attrs, $template = '')
{
$description = array_take('description', $attrs);
$label = array_take('label', $attrs);
$str = empty($template) ? form::template() : $template;
$str = str_replace('{$field:label}', html::label($label, $attrs['name']), $str);
$str = str_replace('{$field:required}', form::required($attrs['valid']), $str);
$str = str_replace('{$field:description}', form::description($description), $str);
$str = str_replace('{$field:controller}', form::field($attrs), $str);
return $str;
}
示例10: getLinks
/**
* Pager Links
*
* Returns pager links
*
* @return string
*/
public function getLinks()
{
$this->setURL();
$htmlFirst = $this->getLink("first", sprintf($this->page_url, 1), "images/pagination/first.png", "images/pagination/no-first.png", __('First page'), $this->env > 1);
$htmlPrev = $this->getLink("prev", sprintf($this->page_url, $this->env - 1), "images/pagination/previous.png", "images/pagination/no-previous.png", __('Previous page'), $this->env > 1);
$htmlNext = $this->getLink("next", sprintf($this->page_url, $this->env + 1), "images/pagination/next.png", "images/pagination/no-next.png", __('Next page'), $this->env < $this->nb_pages);
$htmlLast = $this->getLink("last", sprintf($this->page_url, $this->nb_pages), "images/pagination/last.png", "images/pagination/no-last.png", __('Last page'), $this->env < $this->nb_pages);
$htmlCurrent = '<li class="active"><strong>' . sprintf(__('Page %s / %s'), $this->env, $this->nb_pages) . '</strong></li>';
$htmlDirect = $this->nb_pages > 1 ? sprintf('<li class="direct-access">' . __('Direct access page %s'), form::field(array($this->var_page), 3, 10)) . '<input type="submit" value="' . __('ok') . '" class="reset" ' . 'name="ok" />' . $this->form_hidden . '</li>' : '';
$res = '<form action="' . $this->form_action . '" method="get">' . '<div class="pager"><ul>' . $htmlFirst . $htmlPrev . $htmlCurrent . $htmlNext . $htmlLast . $htmlDirect . '</ul>' . '</div>' . '</form>';
return $this->nb_elements > 0 ? $res : '';
}
示例11: onImage
public function onImage()
{
$header['title'] = '上传图片';
$header['js'][] = url::module() . '/admin/js/upload.js';
dialog::header($header);
dialog::navbar($this->navbar(), 'upload');
form::header(array('title' => '', 'description' => '请选择本机图片并上传', 'class' => 'small'));
form::field(array('type' => 'text', 'label' => zotop::t('图片地址'), 'name' => 'image', 'value' => 'http://www.baidu.com/logo.gif', 'description' => '请输入图片地址测试赋值'));
form::field(array('type' => 'textarea', 'label' => zotop::t('图片说明'), 'name' => 'content', 'value' => ''));
form::buttons(array('id' => 'UploadImages', 'type' => 'submit', 'value' => '上传图片'), array('type' => 'button', 'value' => zotop::t('取消'), 'class' => 'zotop-dialog-close'));
form::footer();
dialog::footer();
}
示例12: content
public function content()
{
if (is_array($this->value())) {
$timestamp = strtotime($this->result());
} else {
$timestamp = strtotime($this->value());
}
$date = form::field('date', array('name' => $this->name() . '[date]', 'value' => $timestamp ? date('Y-m-d', $timestamp) : null, 'format' => a::get($this->date, 'format', 'YYYY-MM-DD'), 'id' => 'form-field-' . $this->name() . '-date'));
$time = form::field('time', array('name' => $this->name() . '[time]', 'value' => $timestamp ? date('H:i', $timestamp) : null, 'format' => a::get($this->time, 'format', 24), 'interval' => a::get($this->time, 'interval', 60), 'id' => 'form-field-' . $this->name() . '-time'));
$grid = '<div class="field-grid">';
$grid .= '<div class="field-grid-item field-grid-item-1-2">' . $date->content() . '</div>';
$grid .= '<div class="field-grid-item field-grid-item-1-2">' . $time->content() . '</div>';
$grid .= '</div>';
return $grid;
}
示例13: postLine
private function postLine($count, $checked)
{
$img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
$sts_class = '';
switch ($this->rs->post_status) {
case 1:
$img_status = sprintf($img, __('Published'), 'check-on.png');
$sts_class = 'sts-online';
break;
case 0:
$img_status = sprintf($img, __('Unpublished'), 'check-off.png');
$sts_class = 'sts-offline';
break;
case -1:
$img_status = sprintf($img, __('Scheduled'), 'scheduled.png');
$sts_class = 'sts-scheduled';
break;
case -2:
$img_status = sprintf($img, __('Pending'), 'check-wrn.png');
$sts_class = 'sts-pending';
break;
}
$protected = '';
if ($this->rs->post_password) {
$protected = sprintf($img, __('Protected'), 'locker.png');
}
$selected = '';
if ($this->rs->post_selected) {
$selected = sprintf($img, __('Hidden'), 'hidden.png');
}
$attach = '';
$nb_media = $this->rs->countMedia();
if ($nb_media > 0) {
$attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments');
$attach = sprintf($img, sprintf($attach_str, $nb_media), 'attach.png');
}
$res = '<tr class="line ' . ($this->rs->post_status != 1 ? 'offline ' : '') . $sts_class . '"' . ' id="p' . $this->rs->post_id . '">';
$cols = array('position' => '<td class="nowrap handle minimal">' . form::field(array('order[' . $this->rs->post_id . ']'), 2, 3, $count + 1, 'position', '', false, 'title="' . sprintf(__('position of %s'), html::escapeHTML($this->rs->post_title)) . '"') . '</td>', 'check' => '<td class="nowrap">' . form::checkbox(array('entries[]'), $this->rs->post_id, $checked, '', '', !$this->rs->isEditable(), 'title="' . __('Select this page') . '"') . '</td>', 'title' => '<td class="maximal" scope="row"><a href="' . $this->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id) . '">' . html::escapeHTML($this->rs->post_title) . '</a></td>', 'date' => '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '</td>', 'author' => '<td class="nowrap">' . $this->rs->user_id . '</td>', 'comments' => '<td class="nowrap count">' . $this->rs->nb_comment . '</td>', 'trackbacks' => '<td class="nowrap count">' . $this->rs->nb_trackback . '</td>', 'status' => '<td class="nowrap status">' . $img_status . ' ' . $selected . ' ' . $protected . ' ' . $attach . '</td>');
$cols = new ArrayObject($cols);
$this->core->callBehavior('adminPagesListValue', $this->core, $this->rs, $cols);
$res .= implode(iterator_to_array($cols));
$res .= '</tr>';
return $res;
}
示例14: onEdit
public function onEdit($file)
{
if (form::isPostBack()) {
$content = request::post('source');
msg::success('保存测试', '测试,继续编辑或者返回' . zotop::dump($content, true), 'reload');
}
$source = file::read(ROOT . $file);
$page['title'] = '文件编辑器';
page::header($page);
page::top();
page::navbar($this->navbar());
form::header(array('class' => 'sourceEditor'));
form::field(array('type' => 'label', 'label' => zotop::t('文件名称'), 'name' => 'filename', 'value' => $file, 'valid' => '', 'description' => zotop::t('')));
form::field(array('type' => 'source', 'label' => zotop::t('文件内容'), 'name' => 'source', 'value' => $source, 'valid' => 'required:true', 'description' => zotop::t('')));
form::buttons(array('type' => 'submit', 'value' => '保存文件'), array('type' => 'back'));
form::footer();
page::bottom();
page::footer();
}
示例15: content
public function content()
{
if (is_array($this->value())) {
$timestamp = strtotime($this->result());
} else {
$timestamp = strtotime($this->value());
}
$dateDefault = a::get($this->date, 'default', $this->required() ? 'now' : false);
$timeDefault = a::get($this->time, 'default', $this->required() ? 'now' : false);
$dateValue = $timestamp ? date('Y-m-d', $timestamp) : $dateDefault;
$timeValue = $timestamp ? date('H:i', $timestamp) : $timeDefault;
$date = form::field('date', array('name' => $this->name() . '[date]', 'value' => $dateValue, 'format' => a::get($this->date, 'format', 'YYYY-MM-DD'), 'id' => 'form-field-' . $this->name() . '-date', 'required' => $this->required(), 'readonly' => $this->readonly(), 'disabled' => $this->disabled()));
$time = form::field('time', array('name' => $this->name() . '[time]', 'value' => $timeValue, 'format' => a::get($this->time, 'format', 24), 'interval' => a::get($this->time, 'interval', 60), 'id' => 'form-field-' . $this->name() . '-time', 'required' => $this->required(), 'readonly' => $this->readonly(), 'disabled' => $this->disabled()));
$grid = '<div class="field-grid">';
$grid .= '<div class="field-grid-item field-grid-item-1-2">' . $date->content() . '</div>';
$grid .= '<div class="field-grid-item field-grid-item-1-2">' . $time->content() . '</div>';
$grid .= '</div>';
return $grid;
}