Example #1
0
 /**
  * @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());
 }
Example #2
0
 function datetime($name, $value)
 {
     $values = split(" ", $value);
     $return = Form::date($name, $values[0]);
     $return .= " - ";
     $return .= Form::time($name, $values[1]);
     return $return;
 }
Example #3
0
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);
}
Example #4
0
/**
 * 日期时间字段类型表单组合处理
 * @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);
}
        <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>
Example #6
0
 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);
 }
Example #7
0
<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>
Example #8
0
	<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', '*****@*****.**');
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
Example #9
0
 /**
  * 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;
 }
Example #10
0
				<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 
Example #11
0
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');
?>
Example #12
0
 /**
  * 按照模型搜索
  */
 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;
         }
     }
     // -----------
     if (isset($_GET['dosubmit'])) {
         $this->db->set_model($modelid);
         $tablename = $this->db->table_name;
         $page = max(intval($_GET['page']), 1);
         $sql = "SELECT * FROM `{$tablename}` a,`{$tablename}_data` b WHERE a.id=b.id AND a.status=99";
         $sql_count = "SELECT COUNT(*) AS num FROM `{$tablename}` a,`{$tablename}_data` b WHERE a.id=b.id AND a.status=99";
         // 构造搜索SQL
         $where = '';
         foreach ($fields as $field => $r) {
             if ($r['issearch']) {
                 $table_nickname = $r['issystem'] ? 'a' : 'b';
                 if ($r['formtype'] == 'catid') {
                     if ($_GET['info']['catid']) {
                         $where .= " AND {$table_nickname}.catid='{$catid}'";
                     }
                 } elseif ($r['formtype'] == 'number') {
                     $start = "{$field}_start";
                     $end = "{$field}_end";
                     if ($_GET[$start]) {
                         $start = intval($_GET[$start]);
                         $where .= " AND {$table_nickname}.{$field}>'{$start}'";
                     }
                     if ($_GET[$end]) {
                         $end = intval($_GET[$end]);
                         $where .= " AND {$table_nickname}.{$field}<'{$end}'";
                     }
                 } elseif ($r['formtype'] == 'datetime') {
                     if ($_GET['info'][$field]) {
                         $start = strtotime($_GET['info'][$field]);
                         if ($start) {
                             $where .= " AND {$table_nickname}.{$field}>'{$start}'";
                         }
                     }
                 } elseif ($r['formtype'] == 'box') {
                     if ($_GET['info'][$field]) {
                         $field_value = safe_replace($_GET['info'][$field]);
                         switch ($r['boxtype']) {
                             case 'radio':
                                 $where .= " AND {$table_nickname}.`{$field}`='{$field_value}'";
                                 break;
                             case 'checkbox':
                                 $where .= " AND {$table_nickname}.`{$field}` LIKE '%,{$field_value},%'";
                                 break;
                             case 'select':
                                 $where .= " AND {$table_nickname}.`{$field}`='{$field_value}'";
                                 break;
                             case 'multiple':
                                 $where .= " AND {$table_nickname}.`{$field}` LIKE '%,{$field_value},%'";
                                 break;
                         }
                     }
                 } elseif ($r['formtype'] == 'typeid') {
                     if ($_GET['info'][$field]) {
                         $typeid = intval($_GET['info'][$field]);
                         $where .= " AND {$table_nickname}.`{$field}`='{$typeid}'";
                     }
                 } elseif ($r['formtype'] == 'linkage') {
                     if ($_GET['info'][$field]) {
                         $linkage = intval($_GET['info'][$field]);
                         $where .= " AND {$table_nickname}.`{$field}`='{$linkage}'";
                     }
                 } elseif (in_array($r['formtype'], array('text', 'keyword', 'textarea', 'editor', 'title', 'author', 'omnipotent'))) {
                     if ($_GET['info'][$field]) {
                         $keywords = safe_replace($_GET['info'][$field]);
                         $where .= " AND {$table_nickname}.`{$field}` LIKE '%{$keywords}%'";
                     }
                 } else {
                     continue;
                 }
             }
         }
         // -----------
         if ($where == '') {
             showmessage(L('please_enter_content_to_search'));
         }
         $pagesize = 20;
         $offset = intval($pagesize * ($page - 1));
         $sql_count .= $where;
         $this->db->query($sql_count);
         $total = $this->db->fetch_array();
         $total = $total[0]['num'];
         if ($total != 0) {
             $sql .= $where;
             $order = '';
             $order = $_GET['orderby'] == 'a.id DESC' ? 'a.id DESC' : 'a.id ASC';
             $sql .= ' ORDER BY ' . $order;
             $sql .= " LIMIT {$offset},{$pagesize}";
             $this->db->query($sql);
             $datas = $this->db->fetch_array();
             $pages = Page::pages($total, $page, $pagesize);
         } else {
             $datas = array();
             $pages = '';
         }
     }
     $SEO = seo($catid, $keywords);
     include template('content', 'search');
 }
Example #13
0
    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'));
        ?>
Example #14
0
    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 
Example #15
0
                    <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 
Example #16
0
	</div>

 	<div id="new_option"></div>

	</td>
    </tr>


    <tr>
		<th><?php echo L('fromdate')?>:</th>
		<td><?php echo Form::date('subject[fromdate]',$fromdate)?></td>
	</tr>
	<tr>
		<th><?php echo L('todate')?> :</th>
		<td><?php echo Form::date('subject[todate]',$todate)?></td>
	</tr>
    <tr>
      <th> <?php echo L('vote_description')?> </th>
      <td><textarea name="subject[description]" id="description" cols="60" rows="6"><?php echo $description;?></textarea></td>
    </tr>


    <tr>
		<th><?php echo L('allowview')?>:</th>
		<td><input name="subject[allowview]" type="radio" value="1" <?php echo $allowview?'checked':''?>>&nbsp;<?php echo L('allow')?>&nbsp;&nbsp;<input name="subject[allowview]" type="radio" value="0" <?php echo $allowview?'':'checked'?>>&nbsp;<?php echo L('not_allow')?></td>
	</tr>
	<tr>
		<th><?php echo L('allowguest')?>:</th>
		<td><input name="subject[allowguest]" type="radio" value="1" <?php echo $allowguest?'checked':''?>>&nbsp;<?php echo L('yes')?>&nbsp;&nbsp;<input name="subject[allowguest]" type="radio" value="0" <?php echo $allowguest?'':'checked'?>>&nbsp;<?php echo L('no')?></td>
	</tr>
Example #17
0
<?php

Html::macro("configForm", function ($type, $model, $field, $showDesc = false, $selectArray = null, $multiple = false) {
    if ($type == "text") {
        $b = Form::text($field, $model->{$field}, ['placeholder' => trans_choice('admin.' . $field, 1), 'id' => $field]);
    } else {
        if ($type == "textarea") {
            $b = Form::textarea($field, $model->{$field}, ['placeholder' => trans_choice('admin.' . $field, 1), 'id' => $field]);
        } else {
            if ($type == "email") {
                $b = Form::email($field, $model->{$field}, ['placeholder' => trans_choice('admin.' . $field, 1), 'id' => $field]);
            } else {
                if ($type == "date") {
                    $b = Form::date($field, $model->{$field}, ['placeholder' => trans_choice('admin.' . $field, 1), 'id' => $field]);
                } else {
                    if ($type == "time") {
                        $b = Form::time($field, $model->{$field}, ['placeholder' => trans_choice('admin.' . $field, 1), 'id' => $field]);
                    } else {
                        if ($type == "url") {
                            $b = Form::url($field, $model->{$field}, ['placeholder' => trans_choice('admin.' . $field, 1), 'id' => $field]);
                        } else {
                            if ($type == "number") {
                                $b = Form::number($field, $model->{$field}, ['placeholder' => trans_choice('admin.' . $field, 1), 'id' => $field]);
                            } else {
                                if ($type == "color") {
                                    $b = Form::color($field, $model->{$field}, ['placeholder' => trans_choice('admin.' . $field, 1), 'id' => 'colorpicker']);
                                    $b .= Form::text($field, $model->{$field}, ['placeholder' => trans_choice('admin.' . $field, 1), 'id' => $field]);
                                } else {
                                    if ($type == "select" && !$multiple) {
                                        $b = Form::select($field, $selectArray, $model->{$field}, ['id' => $field]);
                                    } else {
Example #18
0
            $options['checked'] = 'checked';
        }
        $input = '<div class="checkbox">' . Form::input($type, $name, 1, $options) . '</div>';
    } else {
        if ($type == 'static') {
            $value = Form::getValueAttribute($name, $value);
            $input = '<p class="form-control-static">' . $value . '</p>';
        } else {
            $input = Form::$type($name, $value, $options);
        }
    }
    $data = array('label' => Form::label($name, $title, array('class' => 'col-sm-3 control-label')), 'input' => $input, 'field' => $name);
    return View::make('macros/form_control', $data);
});
Form::macro('date', function ($name, $value = null, $options = array()) {
    $value = Form::getValueAttribute($name, $value);
    if (is_object($value) && 'Carbon\\Carbon' == get_class($value)) {
        $value = $value->toDateString();
    }
    return Form::input('date', $name, $value, $options);
});
Form::macro('time', function ($name, $value = null, $options = array()) {
    $value = Form::getValueAttribute($name, $value);
    if (is_object($value) && 'Carbon\\Carbon' == get_class($value)) {
        $value = $value->format('H:i');
    }
    return Form::input('time', $name, $value, array('class' => 'span2'));
});
Form::macro('datetime', function ($name, $value = null, $options = array()) {
    return Form::date($name, $value, $options) . Form::time($name, $value, $options);
});
Example #19
0
		<th><?php 
echo L('line_time');
?>
:</th>
		<td><?php 
echo Form::date('poster[startdate]', date('Y-m-d H:i:s', $info['startdate']), 1);
?>
</td>
	</tr>
	<tr>
		<th><?php 
echo L('down_time');
?>
:</th>
		<td><?php 
echo Form::date('poster[enddate]', date('Y-m-d H:i:s', $info['enddate']), 1);
?>
</td>
	</tr>
	</tbody>
	</table><?php 
if (array_key_exists('images', $setting['type'])) {
    ?>
<div class="pad-10" id="imagesdiv" style="display:<?php 
    if ($info['type'] == 'flash') {
        ?>
none;<?php 
    }
    ?>
">
	<fieldset>
Example #20
0
 /**
  * Test the compilation of form date
  * 
  * @group laravel
  */
 public function testFormDate()
 {
     $form1 = Form::input('date', 'foo');
     $form2 = Form::date('foo');
     $form3 = Form::date('foo', 'foobar');
     $form4 = Form::date('foo', null, array('class' => 'span2'));
     $this->assertEquals('<input type="date" name="foo" id="foo">', $form1);
     $this->assertEquals($form1, $form2);
     $this->assertEquals('<input type="date" name="foo" value="foobar" id="foo">', $form3);
     $this->assertEquals('<input class="span2" type="date" name="foo" id="foo">', $form4);
 }
Example #21
0
 public function datetime($field, $value, $fieldinfo)
 {
     extract(string2array($fieldinfo['setting']));
     $isdatetime = 0;
     if ($fieldtype == 'int') {
         if (!$value) {
             $value = TIME;
         }
         $format_txt = $format == 'm-d' ? 'm-d' : $format;
         $value = date($format_txt, $value);
         $isdatetime = strlen($format) > 6 ? 1 : 0;
     } elseif ($fieldtype == 'datetime') {
         $isdatetime = 1;
     }
     return Form::date("info[{$field}]", $value, $isdatetime, 1);
 }
Example #22
0
 /**
  * 修改会员
  */
 public function edit()
 {
     if (isset($_POST['dosubmit'])) {
         $memberinfo = $info = array();
         $basicinfo['userid'] = $_POST['info']['userid'];
         $basicinfo['username'] = $_POST['info']['username'];
         $basicinfo['mobile'] = $_POST['info']['mobile'];
         $basicinfo['nickname'] = $_POST['info']['nickname'];
         $basicinfo['email'] = $_POST['info']['email'];
         $basicinfo['point'] = $_POST['info']['point'];
         $basicinfo['password'] = $_POST['info']['password'];
         $basicinfo['groupid'] = $_POST['info']['groupid'];
         $basicinfo['modelid'] = $_POST['info']['modelid'];
         $basicinfo['vip'] = isset($_POST['info']['vip']) ? intval($_POST['info']['vip']) : 0;
         $basicinfo['overduedate'] = isset($_POST['info']['overduedate']) && !empty($_POST['info']['overduedate']) ? strtotime($_POST['info']['overduedate']) : 0;
         // 会员基本信息
         $info = $this->_checkuserinfo($basicinfo, 1);
         // 会员模型信息
         $modelinfo = array_diff($_POST['info'], $info);
         // 过滤vip过期时间
         unset($modelinfo['overduedate']);
         unset($modelinfo['pwdconfirm']);
         $userid = $info['userid'];
         $userinfo = $this->db->getby_userid($userid);
         if (empty($userinfo)) {
             showmessage(L('user_not_exist') . L('or') . L('no_permission'), HTTP_REFERER);
         }
         // 删除用户头像
         if (!empty($_POST['delavatar'])) {
             if (ucenter_exists()) {
                 Loader::lib('member:uc_client')->uc_user_deleteavatar($userinfo['ucenterid']);
             } else {
                 $dir1 = ceil($userinfo['userid'] / 10000);
                 $dir2 = ceil($userinfo['userid'] % 10000 / 1000);
                 // 图片存储文件夹
                 $avatarfile = DATA_PATH . 'avatar/';
                 $dir = $avatarfile . $dir1 . '/' . $dir2 . '/' . $userinfo['userid'] . '/';
                 $this->db->where(array('userid' => $userinfo['userid']))->update(array('avatar' => 0));
                 if (file_exists($dir)) {
                     if ($handle = opendir($dir)) {
                         while (false !== ($file = readdir($handle))) {
                             if ($file !== '.' && $file !== '..') {
                                 @unlink($dir . $file);
                             }
                         }
                         closedir($handle);
                         @rmdir($dir);
                     }
                 }
             }
         }
         if (ucenter_exists()) {
             $res = Loader::lib('member:uc_client')->uc_user_edit($info['username'], '', $info['password'], $info['email'], 1);
             if ($res < 0) {
                 showmessage(L('ucenter_operation_failure'), HTTP_REFERER);
             }
         }
         unset($info['userid']);
         unset($info['username']);
         // 如果密码不为空,修改用户密码。
         if (isset($info['password']) && !empty($info['password'])) {
             $info['password'] = password($info['password'], $userinfo['encrypt']);
         } else {
             unset($info['password']);
         }
         $this->db->where(array('userid' => $userid))->update($info);
         require_once CACHE_MODEL_PATH . 'member_input.php';
         require_once CACHE_MODEL_PATH . 'member_update.php';
         $member_input = new member_input($basicinfo['modelid']);
         $modelinfo = $member_input->get($modelinfo);
         // 更新模型表,方法更新了$this->table
         $this->db->set_model($info['modelid']);
         $userinfo = $this->db->getby_userid($userid);
         if ($userinfo) {
             if ($modelinfo) {
                 $this->db->where(array('userid' => $userid))->update($modelinfo);
             }
         } else {
             $modelinfo['userid'] = $userid;
             $this->db->insert($modelinfo);
         }
         showmessage(L('operation_success'), U('member/member/manage'), '', 'edit');
     } else {
         $show_header = $show_scroll = true;
         $userid = isset($_GET['userid']) ? $_GET['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER);
         // 会员组缓存
         $group_cache = S('member/grouplist');
         foreach ($group_cache as $_key => $_value) {
             $grouplist[$_key] = $_value['name'];
         }
         // 会员模型缓存
         $member_model_cache = S('common/member_model');
         foreach ($member_model_cache as $_key => $_value) {
             $modellist[$_key] = $_value['name'];
         }
         $memberinfo = $this->db->getby_userid($userid);
         if (empty($memberinfo)) {
             showmessage(L('user_not_exist') . L('or') . L('no_permission'), HTTP_REFERER);
         }
         $memberinfo['avatar'] = get_memberavatar($memberinfo['userid'], 90);
         $modelid = isset($_GET['modelid']) ? $_GET['modelid'] : $memberinfo['modelid'];
         // 获取会员模型表单
         require CACHE_MODEL_PATH . 'member_form.php';
         $member_form = new member_form($modelid);
         $form_overdudate = Form::date('info[overduedate]', isset($memberinfo['overduedate']) && !empty($memberinfo['overduedate']) ? date('Y-m-d H:i:s', $memberinfo['overduedate']) : '', 1);
         $this->db->set_model($modelid);
         $membermodelinfo = $this->db->getby_userid($userid);
         $forminfos = $forminfos_arr = $member_form->get($membermodelinfo);
         // 万能字段过滤
         foreach ($forminfos as $field => $info) {
             if ($info['isomnipotent']) {
                 unset($forminfos[$field]);
             } else {
                 if ($info['formtype'] == 'omnipotent') {
                     foreach ($forminfos_arr as $_fm => $_fm_value) {
                         if ($_fm_value['isomnipotent']) {
                             $info['form'] = str_replace('{' . $_fm . '}', $_fm_value['form'], $info['form']);
                         }
                     }
                     $forminfos[$field]['form'] = $info['form'];
                 }
             }
         }
         $show_dialog = 1;
         include $this->view('member_edit');
     }
 }
Example #23
0
echo L('username');
?>
:  <input type="text" value="<?php 
echo $username;
?>
" class="input-text" name="search[username]">  <?php 
echo L('time');
?>
:  <?php 
echo Form::date('search[start_time]', $start_time, '');
?>
 <?php 
echo L('to');
?>
   <?php 
echo Form::date('search[end_time]', $end_time, '');
?>
    <input type="submit" value="<?php 
echo L('search');
?>
" class="btn btn-primary btn-sm"name="dosubmit">
		</div>
		</td>
		</tr>
    </tbody>
</table>
</form>
<form name="myform" action="?app=message&controller=message&action=delete" method="post" onsubmit="checkuid();return false;">
<div class="table-list">
<table class="table table-striped">
	<thead>
Example #24
0
?>
: <input type="text" value="<?php 
echo $username;
?>
" class="input-text" name="username">
		<?php 
echo L('from');
?>
  <?php 
echo Form::date('starttime', Format::date($starttime));
?>
 <?php 
echo L('to');
?>
   <?php 
echo Form::date('endtime', Format::date($endtime));
?>

		<?php 
echo Form::select(array('' => L('op'), '1' => L('username'), '2' => L('userid')), $op_type, 'name="op_type"');
?>
:
		<input type="text" value="<?php 
echo $op;
?>
" class="input-text" name="op">
		<?php 
echo Form::select(array('' => L('expenditure_patterns'), '1' => L('money'), '2' => L('point')), $type, 'name="type"');
?>
		<input type="submit" value="<?php 
echo L('search');
Example #25
0
                    <div class="row1">
                        <?php 
echo Form::label('name', __('site.name'));
echo Form::text('name', Input::get('name') != '' ? Input::get('name') : $document->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') != '' ? Input::get('po_num') : $document->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') != '' ? Input::get('pd_date') : $document->pd_date, array('class' => 'wide'));
?>
                    </div>                    
                    <div class="row1">
                        <?php 
echo Form::label('description', __('site.description'));
echo Form::textarea('description', Input::get('description') != '' ? Input::get('description') : $document->description, array('class' => 'wide'));
?>
                    </div>
                <div class="row1 submit">
                    <?php 
echo Form::submit(__('site.edit_document'), array('name' => 'submit', 'class' => 'btn btn-primary'));
?>
                </div>

                <?php 
Example #26
0
?>
</h6>
	 <input type="text" name="data[author]" value="" size="30">
	<h6> <?php 
echo L('islink');
?>
</h6>
	 <input type="text" name="linkurl" id="linkurl" value="" size="30" maxlength="255" disabled> <input name="info[islink]" type="checkbox" id="islink" value="1" onclick="ruselinkurl();" > <font color="red"><?php 
echo L('islink');
?>
</font>
	<h6> <?php 
echo L('inputtime');
?>
</h6> <?php 
echo Form::date('info[inputtime]', Format::date(TIME, 1), 1);
?>
	<h6> <?php 
echo L('template_style');
?>
</h6> <?php 
echo Form::select($template_list, $style, 'name="data[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'));
?>
	<h6> <?php 
echo L('show_template');
?>
</h6> <span id="show_template"><script type="text/javascript">$.getJSON('?app=admin&controller=category&action=public_tpl_file_list&style=<?php 
echo $style;
?>
&application=special&templates=show&id=<?php 
echo $show_template;
Example #27
0
		<th><?php 
echo L('line_time');
?>
:</th>
		<td><?php 
echo Form::date('poster[startdate]', date('Y-m-d H:i:s', TIME), 1);
?>
</td>
	</tr>
	<tr>
		<th><?php 
echo L('down_time');
?>
:</th>
		<td><?php 
echo Form::date('poster[enddate]', '', 1);
?>
</td>
	</tr>
	</tbody>
	</table><?php 
if (array_key_exists('images', $setting['type'])) {
    ?>
<div class="pad-10" id="imagesdiv" style="display:">
	<fieldset>
	<legend><?php 
    echo L('photo_setting');
    ?>
</legend>
	<?php 
    if ($setting['num'] > 1) {
Example #28
0
?>
" size="25"> <div class="bk10"></div>
<span id="catids"></span>&nbsp;&nbsp;
				<?php 
echo L('input_time');
?>
:
				<?php 
$start_f = $_GET['start_time'] ? $_GET['start_time'] : Format::date(TIME - 2592000);
$end_f = $_GET['end_time'] ? $_GET['end_time'] : Format::date(TIME + 86400);
?>
				<?php 
echo Form::date('start_time', $start_f, 1);
?>
 - <?php 
echo Form::date('end_time', $end_f, 1);
?>
				 <input type="submit" name="search" class="btn btn-primary btn-sm"value="<?php 
echo L('search');
?>
" />
	</div>
		</td>
		</tr>
    </tbody>
</table>
</form>
</div>
<div class="table-list">
<form name="myform" id="myform" action="?app=special&controller=special&action=import&specialid=<?php 
echo $_GET['specialid'];
                        <div class="col1">
                        <?php 
echo Form::label('document', __('site.document'));
echo Form::text('document', Input::get('document') != '' ? Input::get('document') : '');
?>
                        </div>   
                        <div class="col1">
                        <?php 
echo Form::label('po_num', __('site.po_num'));
echo Form::text('po_num', Input::get('po_num') != '' ? Input::get('po_num') : '');
?>
                        </div>         
                        <div class="col1">
                        <?php 
echo Form::label('pd_date', __('site.pd_date'));
echo Form::date('pd_date', Input::get('pd_date') != '' ? Input::get('pd_date') : '');
?>
                        </div>                                           
                    </div>>                    
                </div>
                <div class="right">
                    <div class="row1">
                        <?php 
echo Form::label('code', __('site.code'));
echo Form::text('code', $values['code'], array('class' => 'half', 'id' => 'code'));
?>
                    </div>
                    <div class="row1">
                        <div class="col1">
                        <?php 
echo Form::label('doc_number', __('site.doc_number'));
Example #30
0
:<input
								type="text" value="<?php 
echo $this->admin_username;
?>
"
								class="input-text" name="search[username]" size='10'>  <?php 
echo L('times');
?>
  <?php 
echo Form::date('search[start_time]', '', '1');
?>
 <?php 
echo L('to');
?>
   <?php 
echo Form::date('search[end_time]', '', '1');
?>
    <input
								type="submit" value="<?php 
echo L('determine_search');
?>
"
								class="btn btn-primary btn-sm"name="dosubmit">
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<input type="button" class="btn btn-primary btn-sm"name="del_log_4"
								value="<?php 
echo L('removed_data');
?>
"
								onclick="location='?app=admin&controller=loginlog&action=delete&week=4&menuid=<?php 
echo $_GET['menuid'];