carinfo.inc.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu();
  4. $where="WHERE uniacid=:uniacid ";
  5. if(!empty($_GPC['keywords'])){
  6. $op=$_GPC['keywords'];
  7. $where.=" and (start_place LIKE concat('%', :name,'%') or end_place LIKE concat('%', :name,'%'))";
  8. $data[':name']=$op;
  9. }
  10. if(!empty($_GPC['time'])){
  11. $start=strtotime($_GPC['time']['start']);
  12. $end=strtotime($_GPC['time']['end']);
  13. $where.=" and time >={$start} and time<={$end}";
  14. }
  15. $state=$_GPC['state'];
  16. $pageindex = max(1, intval($_GPC['page']));
  17. $pagesize=10;
  18. $type=isset($_GPC['type'])?$_GPC['type']:'all';
  19. $data[':uniacid']=$_W['uniacid'];
  20. if($type=='all'){
  21. $sql="select * from" . tablename("zhtc_car") .$where." order by top,time desc ";
  22. $total=pdo_fetchcolumn("select count(*) from " . tablename("zhtc_car") .$where,$data);
  23. }else{
  24. $where.= " and state=$state";
  25. $sql="select * from" . tablename("zhtc_car") .$where." order by top,time desc ";
  26. $total=pdo_fetchcolumn("select count(*) from " . tablename("zhtc_car") .$where,$data);
  27. }
  28. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  29. $list=pdo_fetchall($select_sql,$data);
  30. $pager = pagination($total, $pageindex, $pagesize);
  31. if($_GPC['op']=='delete'){
  32. $res=pdo_delete('zhtc_car',array('id'=>$_GPC['id']));
  33. if($res){
  34. message('删除成功!', $this->createWebUrl('carinfo'), 'success');
  35. }else{
  36. message('删除失败!','','error');
  37. }
  38. }
  39. if($_GPC['op']=='tg'){
  40. $res=pdo_update('zhtc_car',array('state'=>2,'sh_time'=>time()),array('id'=>$_GPC['id']));
  41. if($res){
  42. message('通过成功!', $this->createWebUrl('carinfo'), 'success');
  43. }else{
  44. message('通过失败!','','error');
  45. }
  46. }
  47. if($_GPC['op']=='jj'){
  48. $res=pdo_update('zhtc_car',array('state'=>3,'sh_time'=>time()),array('id'=>$_GPC['id']));
  49. if($res){
  50. message('拒绝成功!', $this->createWebUrl('carinfo'), 'success');
  51. }else{
  52. message('拒绝失败!','','error');
  53. }
  54. }
  55. include $this->template('web/carinfo');