position.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. Doo::loadCore('db/DooModel');
  3. class position extends DooModel {
  4. public $pid;
  5. public $positionName;
  6. public $positionDescribe;
  7. public $baseWage;
  8. public $postWage;
  9. public $achievementBonus;
  10. public $_table = 'CLD_position';
  11. public $_primarykey = 'pid';
  12. public $_fields = array('pid', 'positionName', 'positionDescribe', 'baseWage', 'postWage', 'achievementBonus');
  13. /**
  14. * 获得所有岗位
  15. */
  16. function getPositionByAll(){
  17. Doo::loadClass ( 'XDeode' );
  18. $XDeode = new XDeode ( 5 );
  19. Doo::loadModel ( 'staff' );
  20. $staff = new staff ();
  21. $list=$this->find ( array (
  22. 'asArray' => TRUE
  23. ) );
  24. foreach ($list as $key=>$value){
  25. $list [$key] ['pidKey'] = $XDeode->encode ( $value ['pid'] );
  26. $list [$key] ['staffCount']=$staff->count(array ('where' => 'positionId = "' . $value ['pid'] . '"'));
  27. }
  28. return $list;
  29. }
  30. /**
  31. * 根据ID获取相关信息
  32. * @param number $sid 用户ID
  33. */
  34. public function getPositionByPid($pid = 0) {
  35. Doo::loadClass ( 'XDeode' );
  36. $XDeode = new XDeode ( 5 );
  37. if (!is_numeric($pid)){
  38. $pid = $XDeode->decode ( $pid );
  39. }
  40. $detail = array ();
  41. if (! empty ( $pid )){
  42. Doo::loadModel ( 'staff' );
  43. $staff = new staff ();
  44. $detail = $this->getOne ( array (
  45. 'where' => "pid= '" . $pid . "'",
  46. 'asArray' => TRUE
  47. ) );
  48. if (!empty($detail)){
  49. $detail ['pidKey'] = $XDeode->encode ( $detail ['pid'] );
  50. $detail ['staffCount']=$staff->count(array ('where' => 'positionId = "' . $detail ['pid'] . '"'));
  51. }
  52. }
  53. return $detail;
  54. }
  55. //public function getPositionByPid
  56. }
  57. ?>