activity.inc.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu();
  4. $where=" where a.uniacid=:uniacid";
  5. $data[':uniacid']=$_W['uniacid'];
  6. $type=pdo_getall('zhtc_acttype',array('uniacid'=>$_W['uniacid']));
  7. if(isset($_GPC['keywords'])){
  8. $where.=" and a.title LIKE concat('%', :name,'%') ";
  9. $data[':name']=$_GPC['keywords'];
  10. $type='all';
  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. if($_GPC['type_id']>0){
  18. $where.=" and a.type_id=".$_GPC['type_id'];
  19. }
  20. $pageindex = max(1, intval($_GPC['page']));
  21. $pagesize=10;
  22. $sql="select a.*,b.type_name from".tablename('zhtc_activity') ." a" . " left join " . tablename("zhtc_acttype") . " b on b.id=a.type_id ".$where." order by a. num asc";
  23. $total=pdo_fetchcolumn("select count(*) from".tablename('zhtc_activity')." a" . " left join " . tablename("zhtc_acttype") . " b on b.id=a.type_id ".$where,$data);
  24. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  25. $list=pdo_fetchall($select_sql,$data);
  26. $pager = pagination($total, $pageindex, $pagesize);
  27. if($_GPC['op']=='delete'){
  28. $res=pdo_delete('zhtc_activity',array('id'=>$_GPC['id']));
  29. // pdo_delete('zhtc_joinlist')
  30. if($res){
  31. message('删除成功!', $this->createWebUrl('activity'), 'success');
  32. }else{
  33. message('删除失败!','','error');
  34. }
  35. }
  36. if($_GPC['op']=='change'){
  37. $res=pdo_update('zhtc_activity',array('is_bm'=>$_GPC['is_bm']),array('id'=>$_GPC['id']));
  38. if($res){
  39. message('修改成功!', $this->createWebUrl('activity'), 'success');
  40. }else{
  41. message('修改失败!','','error');
  42. }
  43. }
  44. include $this->template('web/activity');