L_category.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. class L_category extends DooModel {
  4. public $cid;
  5. public $title;
  6. public $defult;
  7. public $districtid;
  8. public $_table = 'CLD_L_category';
  9. public $_primarykey = 'cid';
  10. public $_fields = array (
  11. 'cid',
  12. 'title',
  13. 'defult',
  14. 'districtid'
  15. );
  16. public function checkUser($uid, $passwork) {
  17. return $this->find ( array (
  18. 'where' => "uid= '" . $uid . "' and passwork = '" . addslashes ( $passwork ) . "'",
  19. 'asArray' => TRUE
  20. ) );
  21. }
  22. public function getCategoryInCid($cidString = '') {
  23. Doo::loadClass ( 'XDeode' );
  24. $XDeode = new XDeode ( 5 );
  25. if (empty ( $cidString ))
  26. return array ();
  27. $list= $this->find ( array (
  28. 'where' => "cid in ( " .$cidString . ") ",
  29. 'asArray' => TRUE
  30. ) );
  31. foreach ( $list as $key => $value ) {
  32. $list [$key] ['cidKey'] = $XDeode->encode ( $value ['cid'] );
  33. }
  34. return $list;
  35. }
  36. public function getCategoryById($cid = 0, $othercid = "") {
  37. if (! empty ( $othercid ))
  38. return $this->find ( array (
  39. 'where' => "cid in ( " . $cid . "," . $othercid . ") ",
  40. 'asArray' => TRUE
  41. ) );
  42. else
  43. return $this->find ( array (
  44. 'where' => "cid= '" . $cid . "' ",
  45. 'asArray' => TRUE
  46. ) );
  47. }
  48. public function getCategory() {
  49. Doo::loadClass ( 'XDeode' );
  50. $XDeode = new XDeode ( 5 );
  51. $list = $this->find ( array (
  52. 'asc' => 'cid',
  53. 'asArray' => TRUE
  54. ) );
  55. foreach ( $list as $key => $value ) {
  56. $list [$key] ['cidKey'] = $XDeode->encode ( $value ['cid'] );
  57. }
  58. return $list;
  59. }
  60. public function getUserByIdList($puid) {
  61. return $this->find ( array (
  62. 'where' => "uid= '" . $puid . "'",
  63. 'asArray' => TRUE
  64. ) );
  65. }
  66. public function getCategoryStaff() {
  67. $list = $this->find ( array (
  68. 'asArray' => TRUE
  69. ) );
  70. Doo::loadModel ( 'staff' );
  71. $staff = new staff ();
  72. foreach ( $list as $key => $value ) {
  73. $list [$key] ['staff'] = $staff->getStaffByCid ( $value ['cid'] );
  74. }
  75. return $list;
  76. }
  77. }
  78. ?>