westdc-zf1/application/admin/views/scripts/sys/regions-add.phtml

122 lines
6.0 KiB
PHTML

<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('元数据评审');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="row">
<div class="hidden-sm hidden-xs col-md-2">
<?= $this->partial('sys/left.phtml'); ?>
</div>
<div class="col-md-10 col-sm-12">
<div class="form-group">
<ul class="nav nav-tabs">
<li><a href="/admin/sys/regions">浏览所有</a></li>
<li class="active"><a href="/admin/sys/regions">添加</a></li>
</ul>
</div>
<?php if (!empty($this->error)) :?>
<?= $this->error ;?>
<?php endif; ?>
<form method="post" action="" class="form-horizontal">
<div class="form-group">
<label class="col-md-2 col-sm-2 col-xs-3 control-label" for="east"></label>
<div class="col-md-2 col-sm-4 col-xs-4">
<input type="text" id="east" name="data[east]" class="form-control" value="<?= isset($this->data['east']) ? $this->data['east']:"" ?>" />
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 col-xs-3 control-label" for="west">西</label>
<div class="col-md-2 col-sm-4 col-xs-4">
<input type="text" id="west" name="data[west]" class="form-control" value="<?= isset($this->data['west']) ? $this->data['west']:"" ?>" />
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 col-xs-3 control-label" for="south"></label>
<div class="col-md-2 col-sm-4 col-xs-4">
<input type="text" id="south" name="data[south]" class="form-control" value="<?= isset($this->data['south']) ? $this->data['south']:"" ?>" />
</div>
</div>
<div class="form-group">
<label class="col-md-2 col-sm-2 col-xs-3 control-label" for="north"></label>
<div class="col-md-2 col-sm-4 col-xs-4">
<input type="text" id="north" name="data[north]" class="form-control" value="<?= isset($this->data['north']) ? $this->data['north']:"" ?>" />
</div>
</div>
<?php if(!isset($this->data['info'])) { ?>
<div class="form-group langid-label">
<label class="col-md-2 col-sm-2 col-xs-3 control-label" for="north">语言-名称</label>
<div class="col-md-2 col-sm-4 col-xs-4">
<input type="text" id="north" name="data[info][1][langid]" value="" placeholder="语言id" class="form-control"/>
</div>
<div class="col-md-2 col-sm-4 col-xs-4 row-no-padding-left">
<input type="text" id="north" name="data[info][1][label]" value="" placeholder="区域名称" class="form-control"/>
</div>
</div>
<?php }else{ ?>
<?php foreach($this->data['info'] as $k=>$v) { ?>
<div class="form-group langid-label">
<label class="col-md-2 col-sm-2 col-xs-3 control-label" for="north">语言-名称</label>
<div class="col-md-2 col-sm-4 col-xs-4">
<input class="form-control" type="text" id="north" name="data[info][<?= $k ?>][langid]" value="<?= $v['langid'] ?>" placeholder="语言id" />
</div>
<div class="col-md-2 col-sm-4 col-xs-4 row-no-padding-left">
<input class="form-control" type="text" id="north" name="data[info][<?= $k ?>][label]" value="<?= $v['label'] ?>" placeholder="区域名称" />
</div>
<div class="col-md-1 col-sm-1 col-xs-1 form-control-static"><a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a></div>
</div>
<?php } } ?>
<div class="form-group">
<label class="col-md-2 col-sm-2 col-xs-3 control-label" for="north"></label>
<div class="col-md-2 col-sm-4 col-xs-4 form-control-static">
<a class="btn btn-success btn-sm" href="javascript:void(0);" onclick="addInput()">+ 再添加一条</a>
</div>
</div>
<div class="form-group">
<div class="col-md-2 col-sm-4 col-xs-4">
<input type="hidden" name="submit" value="1" />
<?php if(!empty($this->id)) { ?>
<input type="hidden" name="id" value=" <?=$this->id?> " />
<?php } ?>
</div>
<div class="col-md-2 col-sm-4 col-xs-4">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
<script>
function addInput()
{
$('.langid-label').last().after(makeLabel());
}
function makeLabel(){
var now_index = $('.langid-label').length;
var index = now_index + 1;
html = '<div class="form-group langid-label">'
+' <label class="col-md-2 col-sm-2 col-xs-3 control-label" for="north">语言-名称</label>'
+' <div class="col-md-2 col-sm-4 col-xs-4">'
+' <input type="text" id="north" name="data[info]['+index+'][langid]" value="" placeholder="语言id" class="form-control"/>'
+' </div>'
+' <div class="col-md-2 col-sm-4 col-xs-4 row-no-padding-left">'
+' <input type="text" id="north" name="data[info]['+index+'][label]" value="" placeholder="区域名称" class="form-control"/>'
+' </div>'
+' <div class="col-md-1 col-sm-1 col-xs-1 form-control-static">'
+' <a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>'
+' </div'
+' </div>'
+'</div>';
return html;
}
function RmInput(e){
$e = $(e);
$e.parent('div').parent('div').remove();
}
</script>