video.inc.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu();
  4. //$list=pdo_getall('zhtc_video',array('uniacid'=>$_W['uniacid']),array(),'','time ASC');
  5. $where=" WHERE a.uniacid=:uniacid ";
  6. $data[':uniacid']=$_W['uniacid'];
  7. if(!empty($_GPC['keywords'])){
  8. $where.=" and a.title LIKE concat('%', :name,'%') ";
  9. $data[':name']=$_GPC['keywords'];
  10. }
  11. if(!empty($_GPC['time'])){
  12. $start=strtotime($_GPC['time']['start']);
  13. $end=strtotime($_GPC['time']['end']);
  14. $where.=" and unix_timestamp(a.time) >={$start} and unix_timestamp(a.time)<={$end} ";
  15. }
  16. $pageindex = max(1, intval($_GPC['page']));
  17. $pagesize=10;
  18. $sql="select a.*,b.type_name from " . tablename("zhtc_video") . " a" . " left join " . tablename("zhtc_videotype") . " b on a.type_id=b.id ".$where."order by a.num asc,a.time DESC ";
  19. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  20. $list = pdo_fetchall($select_sql,$data);
  21. $total=pdo_fetchcolumn("select count(*) from " . tablename("zhtc_video") . " a" . " left join " . tablename("zhtc_videotype") . " b on a.type_id=b.id ".$where,$data);
  22. $pager = pagination($total, $pageindex, $pagesize);
  23. //$list=pdo_fetchall($sql,$data);
  24. if($_GPC['op']=='delete'){
  25. $res=pdo_delete('zhtc_video',array('id'=>$_GPC['id']));
  26. if($res){
  27. message('删除成功!', $this->createWebUrl('video'), 'success');
  28. }else{
  29. message('删除失败!','','error');
  30. }
  31. }
  32. // if($_GPC['state']){
  33. // $data['state']=$_GPC['state'];
  34. // $res=pdo_update('zhtc_video',$data,array('id'=>$_GPC['id']));
  35. // if($res){
  36. // message('编辑成功!', $this->createWebUrl('video'), 'success');
  37. // }else{
  38. // message('编辑失败!','','error');
  39. // }
  40. // }
  41. include $this->template('web/video');