inzx.inc.php 1.9 KB

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