westdc-zf1/application/admin/views/scripts/data/attachments.phtml

122 lines
4.7 KiB
PHTML

<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('数据管理');
$this->headScript()->appendFile('/static/js/jquery-1.7.2.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="row">
<div class="hidden-sm hidden-xs col-md-2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="col-md-10 col-sm-12">
<?php if ($this->msg or $this->messages) :?>
<div id="message" class="alert alert-info">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<div class="form-group">
<a class="btn btn-primary btn-sm" href="/admin/data/attachments/add/1">上传新附件</a>
<a class="btn btn-primary btn-sm" href="attachments/search/my">查看我的附件</a>
</div>
<div class="input-group form-group" id="datalist">
<form action="" method="get" class="search_form input-group">
<input class="form-control" type="text" name="keyword" value="<?php echo $this->keyword; ?>" placeholder="搜索关键字" />
<input type="hidden" name="search" value='1' />
<span class="input-group-btn"><button class="btn btn-default" type="submit" class="searchbtn" >搜索</button></span>
</form>
</div>
<?php if (count($this->paginator)): ?>
<form method="get" action="/admin/data/md/att/1/addatts/1">
<table class="stylized table table-bordered table-striped table-hover">
<thead><tr>
<?php
if(!empty($this->uuid))
echo '<th width="40">选择</th>';
?>
<th width="5%">ID</th>
<th width="45%">上传文件名</th>
<th width="5%">类型</th>
<th width="5%">大小</th>
<th width="8%">下载次数</th>
<th width="16%">上传时间</th>
<th width="28%">操作</th>
</tr></thead>
<tbody id="list">
<?php $autoindex=0;?>
<?php foreach ($this->paginator as $item): ?>
<?php $autoindex++;?>
<tr id="att_<?php echo $item['id'];?>">
<?php
if(!empty($this->uuid))
echo '<td><input type="checkbox" value="'.$item['id'].'" name="ids[]" /></td>';
?>
<td><?php echo $item['id'];?></td>
<td><?php echo $item['realname'] ;?></td>
<td><?php
if($item['filetype']=='image') echo '图片' ;
if($item['filetype']=='file') echo '文件' ;
if($item['filetype']=='media') echo '多媒体' ;
if($item['filetype']=='reviewatt') echo '评审附件' ;
if($item['filetype']=='md') echo "数据文件";
if($item['filetype']=='literature')echo "文献";
if($item['filetype']=='document') echo "文档";
?></td>
<td><?php if($item['filesize']<1048576) echo round(($item['filesize']/1024),2).'KB'; else echo round(($item['filesize']/1024/1024),2).'MB'; ?></td>
<td><?= $item['downtimes']; ?></td>
<td><?= date('Y-m-d H:i:s',strtotime($item['ts_created'])); ?></td>
<td>
<a href="/admin/data/attachments/edit/<?= $item['id']; ?>">编辑</a> |
<a href="javascript:delatt(<?= $item['id']; ?>);" onclick="return confirm('是否确定删除该附件?')">删除</a> |
<a href="/service/attach/id/<?= $item['id']; ?>">下载</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php
if(!empty($this->uuid))
echo '<input type="hidden" name="uuid" value="'.$this->uuid.'" /><input type="hidden" name="submit" value="1" /><input type="submit" value="将已选择的附件添加到《'.$this->mdtitle.'》" />';
?>
</form>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<script>
function delatt(id){
$.ajax({
'type': "POST",
'url': "/admin/data/attachments/",
'data': 'delete='+id,
'success': function(data){
if(data==null){Alert('遇到错误,请重试');return false;}
if(data.error!=null){Alert(data.error);return false;}
if(data.status==1){$('#att_'+id).fadeOut("slow");}
},
'beforeSend':function(){},
'complete':function(){},
'timeout': 20000,
'dataType': 'json',
'error': function(){Alert('处理中出现问题,请重试');}
});
}
function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4>'+html+'</h4>'});
}
$("#list tr").mouseover(function(){$(this).addClass("high")}).mouseout(function(){$(this).removeClass("high")})
</script>