customer.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. class customer_c extends Control
  3. {
  4. var $subject;
  5. function __construct()
  6. {
  7. parent::Control();
  8. $this->load_model("user");
  9. $this->load_model("customer");
  10. }
  11. function customer_c()
  12. {
  13. $this->__construct();
  14. }
  15. function index_f()
  16. {
  17. if(!$_SESSION["user_id"])
  18. {
  19. error('',$this->url('login'));
  20. }
  21. $rs = $this->user_m->user_from_id($_SESSION["user_id"]);
  22. $id=$rs["id"];
  23. $this->tpl->assign("rs",$rs);
  24. $pageid = $this->trans_lib->int(SYS_PAGEID);
  25. $offset = $pageid>0 ? ($pageid-1)*SYS_PSIZE : 0;
  26. $rslist = $this->customer_m->get_list($id,$offset,SYS_PSIZE);
  27. $this->tpl->assign("rslist",$rslist);
  28. $total = $this->customer_m->get_count($id);
  29. $this->tpl->assign("total",$total);
  30. $pageurl = site_url("customer","uid=".$id);
  31. $this->page_lib->set_psize(SYS_PSIZE);
  32. $pagelist = $this->page_lib->page($pageurl,$total,true);//分页数组
  33. $this->tpl->assign("pagelist",$pagelist);
  34. //$this->tpl->assign("rslist",$rslist);
  35. $sitetitle = $this->lang["customer"];
  36. $this->tpl->assign("sitetitle",$sitetitle);
  37. $this->tpl->display("customer.".$this->tpl->ext);
  38. }
  39. function view_f()
  40. {
  41. if(!$_SESSION["user_id"])
  42. {
  43. error('',$this->url('login'));
  44. }
  45. $cid = $this->trans_lib->safe("id");
  46. $rs = $this->customer_m->customer_from_id($cid);
  47. $this->tpl->assign("rs",$rs);
  48. $this->tpl->display("msg_customer.".$this->tpl->ext);
  49. }
  50. }
  51. ?>