本文整理汇总了PHP中Form::date方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::date方法的具体用法?PHP Form::date怎么用?PHP Form::date使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form
的用法示例。
在下文中一共展示了Form::date方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDate
/**
* @covers Form::date
*/
public function testDate()
{
$dateBox = $this->myForm->date('date_input');
$this->assertInstanceOf('Datebox', $dateBox);
$this->assertEquals('date_input', $dateBox->getName());
$this->assertSame($this->myForm, $dateBox->getForm());
}
示例2: datetime
function datetime($name, $value)
{
$values = split(" ", $value);
$return = Form::date($name, $values[0]);
$return .= " - ";
$return .= Form::time($name, $values[1]);
return $return;
}
示例3: datetime
function datetime($field, $value, $fieldinfo)
{
extract($fieldinfo);
//错误提示
$errortips = $this->fields[$field]['errortips'];
if ($minlength) {
//验证规则
$this->formValidateRules['info[' . $field . ']'] = array("required" => true);
//验证不通过提示
$this->formValidateMessages['info[' . $field . ']'] = array("required" => $errortips ? $errortips : $name . "不能为空!");
}
extract(unserialize($fieldinfo['setting']));
$isdatetime = 0;
$timesystem = 0;
//时间格式
if ($fieldtype == 'int') {
//整数 显示格式
if (!$value && $defaulttype) {
$value = time();
}
//整数 显示格式
$format_txt = $format == 'm-d' ? 'm-d' : $format;
if ($format == 'Y-m-d Ah:i:s') {
$format_txt = 'Y-m-d h:i:s';
}
$value = date($format_txt, $value);
$isdatetime = strlen($format) > 6 ? 1 : 0;
if ($format == 'Y-m-d Ah:i:s') {
$timesystem = 0;
} else {
$timesystem = 1;
}
} elseif ($fieldtype == 'datetime') {
$isdatetime = 1;
$timesystem = 1;
} elseif ($fieldtype == 'datetime_a') {
$isdatetime = 1;
$timesystem = 0;
}
return Form::date("info[{$field}]", $value, $isdatetime, 1, 'true', $timesystem);
}
示例4: datetime
/**
* 日期时间字段类型表单组合处理
* @param type $field 字段名
* @param type $value 字段内容
* @param type $fieldinfo 字段配置
* @return type
*/
function datetime($field, $value, $fieldinfo)
{
//错误提示
$errortips = $fieldinfo['errortips'];
if ($fieldinfo['minlength']) {
//验证规则
$this->formValidateRules['info[' . $field . ']'] = array("required" => true);
//验证不通过提示
$this->formValidateMessages['info[' . $field . ']'] = array("required" => $errortips ? $errortips : $fieldinfo['name'] . "不能为空!");
}
$setting = unserialize($fieldinfo['setting']);
$isdatetime = 0;
$timesystem = 0;
//时间格式
if ($setting['fieldtype'] == 'int') {
//整数 显示格式
if (empty($value) && $setting['defaulttype']) {
$value = time();
}
//整数 显示格式
$format_txt = $setting['format'] == 'm-d' ? 'm-d' : $setting['format'];
if ($setting['format'] == 'Y-m-d Ah:i:s') {
$format_txt = 'Y-m-d h:i:s';
}
$value = $value ? date($format_txt, $value) : '';
$isdatetime = strlen($setting['format']) > 6 ? 1 : 0;
if ($setting['format'] == 'Y-m-d Ah:i:s') {
$timesystem = 0;
} else {
$timesystem = 1;
}
} elseif ($setting['fieldtype'] == 'datetime') {
$isdatetime = 1;
$timesystem = 1;
} elseif ($setting['fieldtype'] == 'datetime_a') {
$isdatetime = 1;
$timesystem = 0;
}
return \Form::date("info[{$field}]", $value, $isdatetime, 1, 'true', $timesystem);
}
示例5: date
<tr>
<th width="110">推荐位标题</th>
<td><input type="text" name="data[title]" class="input" value="{$data['title']}" id="title" size="40">
</input></td>
</tr>
<tr>
<th>推荐位图片</th>
<td><?php
echo form::images('thumb', 'thumb', $data['thumb'], 'content');
?>
</td>
</tr>
<tr>
<th>推荐时间</th>
<td><?php
echo Form::date('data[inputtime]', date('Y-m-d H:i:s', $data['inputtime']), 1);
?>
</td>
</tr>
<tr>
<th>描述</th>
<td><textarea name="data[description]" rows="2" cols="20" id="description" class="inputtext" style="height:200px;width:100%;">{$data['description']}</textarea></td>
</tr>
<tr>
<th>原文章修改时同步?</th>
<td>
<input name="synedit" value="0" type="radio" <if condition=" $synedit == '0' "> checked="checked"</if>>
启用
<input name="synedit" value="1" type="radio" <if condition=" $synedit == '1' "> checked="checked"</if>>
关闭 </td>
</tr>
示例6: datetime
public function datetime($field, $value, $fieldinfo)
{
extract(string2array($fieldinfo['setting']));
$isdatetime = 0;
$timesystem = 0;
if ($fieldtype == 'int') {
if (!$value) {
$value = TIME;
}
$format_txt = $format == 'm-d' ? 'm-d' : $format;
if ($format == 'Y-m-d Ah:i:s') {
$format_txt = 'Y-m-d h:i:s';
}
$value = date($format_txt, $value);
$isdatetime = strlen($format) > 6 ? 1 : 0;
if ($format == 'Y-m-d Ah:i:s') {
$timesystem = 0;
} else {
$timesystem = 1;
}
} elseif ($fieldtype == 'datetime') {
$isdatetime = 1;
$timesystem = 1;
} elseif ($fieldtype == 'datetime_a') {
$isdatetime = 1;
$timesystem = 0;
}
return Form::date("info[{$field}]", $value, $isdatetime, 1, 'true', $timesystem);
}
示例7: U
<div class="pad_10">
<form action="<?php
echo U('admin/ipbanned/add');
?>
" method="post"
name="myform" id="myform">
<table width="100%" cellpadding="2" cellspacing="1" class="table_form">
<tr>
<th width="60">IP :</th>
<td><input type="text" name="info[ip]" id="ip" size="25"></td>
</tr>
<tr>
<th><?php
echo L('deblocking_time');
?>
:</th>
<td><?php
echo Form::date('info[expires]', '', '');
?>
</td>
</tr>
<input type="submit" name="dosubmit" id="dosubmit" class="dialog"
value=" <?php
echo L('submit');
?>
">
</table>
</form>
</div>
</body></html>
示例8:
<body>
<div id="container">
<div id="form_inscription">
<h2>Signin</h2>
<?php
echo Form::open(array('action' => 'UsersController@create'));
echo Form::label('username', 'Pseudo');
echo Form::text('username');
echo Form::label('password', 'mot de passe');
echo Form::password('password');
echo Form::label('lastname', 'Nom');
echo Form::text('lastname');
echo Form::label('firstname', 'Prenom');
echo Form::text('firstname');
echo Form::label('birthdate', 'Date de naissance');
echo Form::date('birthdate');
echo Form::label('email', 'E-Mail Address');
echo Form::email('email', 'test@gmail.com');
echo Form::submit('s\'inscrire');
echo Form::close();
?>
<?php
echo Html::link('/login', 'se connecter');
?>
</div>
@if ($errors->any())
<div id="erreurs">
@foreach ( $errors->all() as $error )
<p>{{ $error }}</p>
@endforeach
示例9: date
/**
* Método que genera un input date
*
* @param type $field Nombre del input
* @param type $attrs Atributos del input
* @param type $value Valor por defecto
* @param type $label Detalle de la etiqueta label
* @param type $help Descripción del campo
* @return string
*/
public static function date($field, $attrs = null, $value = null, $label = '', $help = '')
{
//Tomo los nuevos atributos definidos en las clases
$attrs = self::_getAttrsClass($attrs, 'date');
//Armo el input
$input = self::getControls();
if (self::$_style == 'form-search' or self::$_style == 'form-inline') {
$attrs['placeholder'] = $label;
}
//Verifico si está definida la máscara mask-date
if (!preg_match("/\\bmask-date\\b/i", $attrs['class'])) {
$attrs['class'] = 'mask-date ' . $attrs['class'];
}
//Armo el input del form
if (!IS_DESKTOP) {
$input .= '<div class="input-group date">';
$input .= parent::date($field, $attrs, $value);
} else {
$tmp = self::_getFieldName($field);
$input .= '<div class="input-group date datepicker" id="dp_' . $tmp['id'] . '">';
//Verifico si está definida la clase input-date
if (!preg_match("/\\binput-date\\b/i", $attrs['class']) && !preg_match("/\\binput-datetime\\b/i", $attrs['class'])) {
$attrs['class'] = 'input-date ' . $attrs['class'];
}
$attrs['class'] = 'js-datepicker ' . $attrs['class'];
$input .= parent::text($field, $attrs, $value);
}
$input .= '<span class="input-group-addon"><i class="fa fa-calendar"></i></span>';
$input .= '</div>';
//Verifico si el formato del formulario muestra el help
if (self::$_help_block) {
$input .= self::help($help);
}
//Cierro el controls
$input .= self::getControls();
if (!self::$_help_block) {
return $input . PHP_EOL;
}
//Verifico si tiene un label
$label = $label && self::$_show_label ? self::label($label, $field, null, $attrs['class']) : '';
return '<div class="form-group">' . $label . $input . '</div>' . PHP_EOL;
}
示例10: L
<th><?php
echo L('fromdate');
?>
:</th>
<td><?php
echo Form::date('subject[fromdate]', date('Y-m-d', TIME), '');
?>
</td>
</tr>
<tr>
<th><?php
echo L('todate');
?>
:</th>
<td><?php
echo Form::date('subject[todate]', date('Y-m-d', TIME + 2592000), '');
?>
</td>
</tr>
<tr>
<th><?php
echo L('vote_description');
?>
</th>
<td><textarea name="subject[description]" id="description" cols="60"
rows="6"></textarea></td>
</tr>
<tr>
<th><?php
示例11: L
echo L('startdate');
?>
:</th>
<td><?php
echo Form::date('announce[starttime]', $an_info['starttime']);
?>
</td>
</tr>
<tr>
<th><?php
echo L('enddate');
?>
:</th>
<td><?php
$an_info['endtime'] = $an_info['endtime'] == '0000-00-00' ? '' : $an_info['endtime'];
echo Form::date('announce[endtime]', $an_info['endtime']);
?>
</td>
</tr>
<tr>
<th><?php
echo L('announce_content');
?>
</th>
<td><textarea name="announce[content]" id="content"><?php
echo $an_info['content'];
?>
</textarea>
<?php
echo Form::editor('content', 'basic');
?>
示例12: init
/**
* 按照模型搜索
*/
public function init()
{
$grouplist = S('member/grouplist');
$_groupid = cookie('_groupid');
if (empty($_groupid)) {
$_groupid = 1;
}
if (!isset($grouplist[$_groupid]['allowsearch'])) {
if ($_groupid == 1) {
showmessage(L('guest_not_allowsearch'));
} else {
showmessage('');
}
}
if (!isset($_GET['catid'])) {
showmessage(L('missing_part_parameters'));
}
$catid = intval($_GET['catid']);
$this->categorys = S('common/category_content');
if (!isset($this->categorys[$catid])) {
showmessage(L('missing_part_parameters'));
}
if (isset($_GET['info']['catid']) && $_GET['info']['catid']) {
$catid = intval($_GET['info']['catid']);
} else {
$_GET['info']['catid'] = 0;
}
$modelid = $this->categorys[$catid]['modelid'];
$modelid = intval($modelid);
if (!$modelid) {
showmessage(L('illegal_parameters'));
}
// 搜索间隔
$minrefreshtime = S('common/common');
$minrefreshtime = intval($minrefreshtime['minrefreshtime']);
$minrefreshtime = $minrefreshtime ? $minrefreshtime : 5;
if (cookie('search_cookie') && cookie('search_cookie') > TIME - 2) {
showmessage(L('search_minrefreshtime', array('min' => $minrefreshtime)), 'index.php?app=content&controller=search&catid=' . $catid, $minrefreshtime * 1280);
} else {
cookie('search_cookie', TIME + 2);
}
// 搜索间隔
$CATEGORYS = $this->categorys;
// 产生表单
$fields = S('model/model_field_' . $modelid);
$forminfos = array();
foreach ($fields as $field => $r) {
if ($r['issearch']) {
if ($r['formtype'] == 'catid') {
$r['form'] = Form::select_category('', $_GET['info']['catid'], 'name="info[catid]"', L('please_select_category'), $modelid, 0, 1);
} elseif ($r['formtype'] == 'number') {
$r['form'] = "<input type='text' name='{$field}_start' id='{$field}_start' value='' size=5 class='input-text'/> - <input type='text' name='{$field}_end' id='{$field}_start' value='' size=5 class='input-text'/>";
} elseif ($r['formtype'] == 'datetime') {
$r['form'] = Form::date("info[{$field}]");
} elseif ($r['formtype'] == 'box') {
$options = explode("\n", $r['options']);
foreach ($options as $_k) {
$v = explode("|", $_k);
$option[$v[1]] = $v[0];
}
switch ($r['boxtype']) {
case 'radio':
$string = Form::radio($option, $value, "name='info[{$field}]' id='{$field}'");
break;
case 'checkbox':
$string = Form::radio($option, $value, "name='info[{$field}]' id='{$field}'");
break;
case 'select':
$string = Form::select($option, $value, "name='info[{$field}]' id='{$field}'");
break;
case 'multiple':
$string = Form::select($option, $value, "name='info[{$field}]' id='{$field}'");
break;
}
$r['form'] = $string;
} elseif ($r['formtype'] == 'typeid') {
$types = S('common/type_content');
$types_array = array(L('no_limit'));
foreach ($types as $_k => $_v) {
if ($modelid == $_v['modelid']) {
$types_array[$_k] = $_v['name'];
}
}
$r['form'] = Form::select($types_array, 0, "name='info[{$field}]' id='{$field}'");
} elseif ($r['formtype'] == 'linkage') {
$setting = string2array($r['setting']);
$value = $_GET['info'][$field];
$r['form'] = menu_linkage($setting['linkageid'], $field, $value);
} elseif (in_array($r['formtype'], array('text', 'keyword', 'textarea', 'editor', 'title', 'author', 'omnipotent'))) {
$value = safe_replace($_GET['info'][$field]);
$r['form'] = "<input type='text' name='info[{$field}]' id='{$field}' value='" . $value . "' class='input-text search-text'/>";
} else {
continue;
}
$forminfos[$field] = $r;
}
}
//.........这里部分代码省略.........
示例13: __
echo Form::label('author_name', __('Author'), array('class' => 'control-label'));
?>
<?php
echo Form::input('author_name', $post->user->name, array('class' => 'form-control'), 'autocomplete/user');
?>
</div>
<div class="form-group <?php
echo isset($errors['author_date']) ? 'has-error' : '';
?>
">
<?php
echo Form::label('author_date', __('Date'), array('class' => 'control-label'));
?>
<?php
echo Form::date('author_date', $post->created, array('class' => 'form-control'));
?>
</div>
</div>
</div>
<div class="panel-footer">
<div id="major-publishing-actions" class="row">
<?php
if ($post->loaded()) {
?>
<div id="delete-action" class="btn btn-default pull-left">
<i class="fa fa-trash-o"></i>
<?php
echo HTML::anchor($post->delete_url . URL::query($destination), __('Move to Trash'), array('class' => 'submitdelete'));
?>
示例14: L
echo L('submit_start_update');
?>
" onclick="myform.type.value='lastinput';myform.submit();"></td>
</tr>
<tr>
<td><?php
echo L('update_time_from');
?>
<?php
echo Form::date('fromdate');
?>
<?php
echo L('to');
?>
<?php
echo Form::date('todate');
echo L('in_information');
?>
<input type="button" name="dosubmit3" value=" <?php
echo L('submit_start_update');
?>
" class="btn btn-primary btn-sm"onclick="myform.type.value='date';myform.submit();"></td>
</tr>
<tr>
<td><?php
echo L('update_id_from');
?>
<input type="text" name="fromid" value="0" size="8"> <?php
echo L('to');
?>
<input type="text" name="toid" size="8"> <?php
示例15: __
<div class="row1">
<?php
echo Form::label('name', __('site.name'));
echo Form::text('name', Input::get('name'), array('class' => 'wide'));
?>
</div>
<div class="row1">
<?php
echo Form::label('po_num', __('site.po_num'));
echo Form::text('po_num', Input::get('po_num'), array('class' => 'wide'));
?>
</div>
<div class="row1">
<?php
echo Form::label('pd_date', __('site.pd_date'));
echo Form::date('pd_date', Input::get('pd_date'), array('class' => 'wide'));
?>
</div>
<div class="row1">
<?php
echo Form::label('description', __('site.description'));
echo Form::textarea('description', Input::get('description'), array('class' => 'wide'));
?>
</div>
<div class="row1 submit">
<?php
echo Form::submit(__('site.add_document'), array('name' => 'submit', 'class' => 'btn btn-primary'));
?>
</div>
<?php