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

117 lines
4.8 KiB
PHTML

<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('元数据评审');
$this->breadcrumb()->setSeparator(' > ');
?>
<style>
table thead tr th {background:#EBF2F6;color:#444;}
.high{background:#444;color:#FFF;}
</style>
<div class="row-fluid">
<div class="span2">
<?= $this->partial('sys/left.phtml'); ?>
</div>
<div class="span10">
<div>
<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="control-group">
<label class="control-label" for="east"></label>
<div class="controls">
<input type="text" id="east" name="data[east]" value="<?= isset($this->data['east']) ? $this->data['east']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="west">西</label>
<div class="controls">
<input type="text" id="west" name="data[west]" value="<?= isset($this->data['west']) ? $this->data['west']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="south"></label>
<div class="controls">
<input type="text" id="south" name="data[south]" value="<?= isset($this->data['south']) ? $this->data['south']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="north"></label>
<div class="controls">
<input type="text" id="north" name="data[north]" value="<?= isset($this->data['north']) ? $this->data['north']:"" ?>" />
</div>
</div>
<?php if(!isset($this->data['info'])) { ?>
<div class="control-group langid-label">
<label class="control-label" for="north">语言-名称</label>
<div class="controls">
<input type="text" id="north" name="data[info][1][langid]" value="" placeholder="语言id" />
<input type="text" id="north" name="data[info][1][label]" value="" placeholder="区域名称"/>
</div>
</div>
<?php }else{ ?>
<?php foreach($this->data['info'] as $k=>$v) { ?>
<div class="control-group langid-label">
<label class="control-label" for="north">语言-名称</label>
<div class="controls">
<input type="text" id="north" name="data[info][<?= $k ?>][langid]" value="<?= $v['langid'] ?>" placeholder="语言id" />
<input type="text" id="north" name="data[info][<?= $k ?>][label]" value="<?= $v['label'] ?>" placeholder="区域名称"/>
<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>
</div>
</div>
<?php } } ?>
<div class="control-group">
<label class="control-label" for="north"></label>
<div class="controls">
<a href="javascript:void(0);" onclick="addInput()">+ 再添加一条</a>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="submit" value="1" />
<?php if(!empty($this->id)) { ?>
<input type="hidden" name="id" value=" <?=$this->id?> " />
<?php } ?>
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div><!-- span9 -->
</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="control-group langid-label">'
+' <label class="control-label" for="north">语言-名称</label>'
+' <div class="controls">'
+' <input type="text" id="north" name="data[info]['+index+'][langid]" value="" placeholder="语言id" />'
+' <input type="text" id="north" name="data[info]['+index+'][label]" value="" placeholder="区域名称"/>'
+' <a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>'
+' </div>'
+'</div>';
return html;
}
function RmInput(e){
$e = $(e);
$e.parent('div').parent('div').remove();
}
</script>