<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link href="skin/css/style.css" rel="stylesheet" type="text/css" />
<title>添加采集项目</title>
<script src="skin/js/common.js" type="text/javascript"></script>
<script src="skin/js/main.js" type="text/javascript"></script>
<style type="text/css">
input {
	height:12px;
}
.txt {
	width:250px;
}
.tb2 td {
	padding:2px 5px 2px 5px;
	height:25px;
	text-align:left;
}
.tb2 .thc {
	text-align:center;
	line-height:30px;
	background-color: #F5F7F8;
	font-size:18px;
	font-weight:bold;
	color:#000
}
.tb2 .thr {
	text-align:center;
	height:20px
}
.label {
	padding:0;
	width:150px;
	text-align:right;
	border-right:1px solid #DEEFFA;
}
.rb1 {
	height:22px
}
.red {
	color:red
}
.blue {
	color:blue
}
form, fieldset {
	margin:0;
	padding:0
}
.tb td {
	text-align:left;
}
</style>
</head>
<body>
<?php
$numPerPage=30;
$page = isset($page) ? intval($page) : 1;
if($page==0) $page=1;
$whereStr=" where 1=1";
if (!empty($inbase)){
if ($inbase=='true')
$whereStr.=" and v_inbase ='1'";
elseif($inbase=='false')
$whereStr.=" and v_inbase ='0'";
}
if (!empty($type)){
if ($type=='false') $whereStr.=" and tid in (0)"; else $whereStr.=" and tid in (".getTypeId($type).")";
}

if (!empty($keyword)) $whereStr.=" and v_name like '%".$keyword."%' or v_actor like '%".$keyword."%' ";
if (!empty($playfrom)) $whereStr.=" and v_playdata like '%".$playfrom."$$%' ";
$whereorder = str_replace("where and","where",$whereStr);

$csqlStr="select count(*) as dd from `duomi_co_data` ".$whereorder;

$row = $dsql->GetOne($csqlStr);
if(is_array($row)){
$TotalResult = $row['dd'];
}else{
$TotalResult = 0;
}
$TotalPage = ceil($TotalResult/$numPerPage);
if ($page>$TotalPage) $page=$TotalPage;
$limitstart = ($page-1) * $numPerPage;
if($limitstart<0) $limitstart=0;
$sqlStr="select v_id,v_name,v_inbase,v_state,tid,tname,v_addtime,v_playdata from duomi_co_data ".$whereorder." order by v_addtime desc limit $limitstart,$numPerPage";
$iMode="智能采集";
if(strpos($cfg_gatherset,'0')!==false)$iMode.='[分类识别]';
if(strpos($cfg_gatherset,'1')!==false)$iMode.='[不添加新影片]';
if(strpos($cfg_gatherset,'2')!==false)$iMode.='[只更新影片地址及状态]';
$urlstr = "?action=tempdatabase&type=$type&keyword=$keyword&playfrom=$playfrom&inbase=$inbase";
?>
<div class="r_main">
  <div class="r_content">
    <div class="r_content_1">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tb_style">
        <tr class="thead">
          <th colspan="5">&nbsp;<font color="#000000">管理临时库： </font><a href="?action=tempdatabase&inbase=true">显示已入库的</a> | <a href="?action=tempdatabase&inbase=false">显示未入库的</a> | <a href="?action=tempdatabase&type=false">显示未分类的</a> | <a href="?action=tempdatabase">显示所有</a></th>
          <th colspan="4">入库方式：<span class=red><?php echo $iMode;?></span> <a href="admin_config.php#rule">更改设置</a></th>
        </tr>
        <form action="?action=tempdatabase" method="post">
          <tr>
            <td align="left" colspan="9" height="40"> 关键字
              <input name="keyword" type="text" id="keyword" size="20">
              <select name="type" id="type">
                <option value="">请选择数据分类</option>
                <?php makeTypeOption(0,"&nbsp;|&nbsp;")?>
              </select>
              <input type="submit" name="selectBtn"  value="查 询..." class="rb1" />
              &nbsp;
              <select onchange="self.location.href='?action=tempdatabase&type='+this.options[this.selectedIndex].value">
                <option value="">按数据分类查看</option>
                <?php makeTypeOption(0,"&nbsp;|&nbsp;")?>
              </select>
              <select id='m_playfrom' name='m_playfrom' style="width:120px" onChange="self.location.href='?action=tempdatabase&playfrom='+this.options[this.selectedIndex].value">
                <option value=''>按视频来源查看</option>
                <?php echo makePlayerSelect("");?>
              </select></td>
          </tr>
        </form>
        <?php
if($TotalResult==0){
    if(!empty($keyword)){
    echo "<tr align='center'><td>关键字  <font color=red>\"".$keyword."\"</font>   没有记录</td></tr>";
    }
    }
else{
	if(!empty($keyword)){
?>
        <tr >
          <td colspan="9">关键字 <font color=red> <?php echo $keyword;?> </font> 的记录如下</td>
        </tr>
        <?php
        }
}
?>
        <tr>
          <td height="30" width="5%" bgcolor="#FFFFFF" class="td_btop3">编号</td>
          <td bgcolor="#FFFFFF" class="td_btop3">影片名称</td>
          <td width="8%" bgcolor="#FFFFFF" class="td_btop3">状态</td>
          <td width="10%" bgcolor="#FFFFFF" class="td_btop3">播放器</td>
          <td width="10%" bgcolor="#FFFFFF" class="td_btop3">绑定分类</td>
          <td width="10%" bgcolor="#FFFFFF" class="td_btop3">采集分类名</td>
          <td width="15%" bgcolor="#FFFFFF" class="td_btop3">采集时间</td>
          <td width="10%" colspan="2" align="center" bgcolor="#FFFFFF" class="td_btop3">操作</td>
        </tr>
        <form method="post" name="tempdataform" action="?action=delallTempData">
          <?php
$dsql->SetQuery($sqlStr);
$dsql->Execute('temp_video_list');
while($row=$dsql->GetObject('temp_video_list'))
{
$v_id=$row->v_id;
?>
          <tr>
            <td height="30" class="td_border"><input type="checkbox" value="<?php echo $v_id;?>" name="e_id[]" class="checkbox" />
              <?php echo $v_id;?></td>
            <td class="td_border"><?php echo $row->v_name;?></td>
            <td class="td_border"><?php if($row->v_inbase) echo "已入库"; else echo "未入库";?></td>
            <td class="td_border">&nbsp;<?php echo getFromStr($row->v_playdata);?></td>
            <td class="td_border"><?php if($row->tid!=0) echo getTypeName($row->tid); else echo "<font color=red>没找到相关分类</font>";?></td>
            <td class="td_border">&nbsp;<?php echo $row->tname;?></td>
            <td class="td_border"><span title="<?php echo MyDate('Y-m-d H:i:s',$row->v_addtime);?>"><?php echo isCurrentDay($row->v_addtime);?></span></td>
            <td colspan="2" align="center" class="td_border"><a href="?action=editVideo&id=<?php echo $v_id;?>">编辑</a> <a href="?action=delTempData&id=<?php echo $v_id;?>" onClick="return confirm('确定要删除吗')">删除</a></td>
          </tr>
          <?php }?>
          <tr>
            <td height="30" colspan="9" class="td_border">全选
              <input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(this.checked,'input','e_id[]')" />
              反选
              <input type="checkbox" name="chkothers" id="chkothers" class="checkbox" onclick="checkOthers('input','e_id[]')" />
              &nbsp;&nbsp;
              <input type="submit" value="批量删除" onclick="if(confirm('确定要批量删除吗')){return true}else{return false}" class="rb1" />
              <!--span class=red>没找到相关分类全导入到</span-->
              <select name="type" id="type">
                <option value="">请选择数据分类</option>
                <?php makeTypeOption(0,"&nbsp;|&nbsp;")?>
              </select>
              &nbsp;
              <input type="submit" value="导入选中影片" onclick="this.form.action='?action=import';" class="rb1" style="width:85px"/>
              &nbsp;
              <input type="submit" value="导入全部影片" onclick="this.form.action='?action=import&smode=all';" class="rb1" style="width:85px"/>
              &nbsp;
              <input type="submit" value="导入未入库" onclick="this.form.action='?action=import&smode=noinbase';" class="rb1" style="width:85px"/></td>
          </tr>
          <tr>
            <td height="30" colspan="9" class="td_border"><div class="cuspages" style="float:right">
                <div class="pages">页次<?php echo $page;?>/<?php echo $TotalPage;?> 每页<?php echo $numPerPage;?> &nbsp;&nbsp; 总收录数据条<?php echo $TotalResult;?> <a href="<?php echo $urlstr ?>&page=1">首页</a> <a href="<?php echo $urlstr ?>&page=<?php echo ($page-1);?>">上一页</a> <a href="<?php echo $urlstr ?>&page=<?php echo ($page+1);?>">下一页</a> <a href="<?php echo $urlstr ?>&page=<?php echo $TotalPage;?>">尾页</a> 转到
                  <input type="text" class="txt" id="toPage" value="1" style="width:30px"/>
                  <input type="button" value="跳转" onclick="location.href='<?php echo $urlstr ?>&page='+$('toPage').value" class="rb1">
                </div>
              </div>
              入库方式：<span class=red><?php echo $iMode;?></span> &nbsp;&nbsp;<a href="?action=delallTempData&do=all" onclick="if(confirm('确定要删除所有吗')){return true;}else{return false;}"><u>清空临时库</u></a></td>
          </tr>
        </form>
      </table>
    </div>
  </div>
</div>
<?php viewFoot();?>
</body>
</html>
