model.php 1001 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. class feedbackModel extends model
  3. {
  4. public function getFeedbackPairs($type)
  5. {
  6. return array('admin' => 'Admin', 'user1' => 'User1');
  7. }
  8. /**
  9. * Get feedback by list.
  10. *
  11. * @param string $idList
  12. * @access public
  13. * @return array
  14. */
  15. public function getByList($idList)
  16. {
  17. if(empty($idList)) return array();
  18. return $this->dao->select('*')->from(TABLE_FEEDBACK)
  19. ->where('id')->in($idList)
  20. ->fetchAll('id');
  21. }
  22. /**
  23. * Get feedback list by condition.
  24. *
  25. * @param string $condition
  26. * @access public
  27. * @return array
  28. */
  29. public function getList($condition = 'all')
  30. {
  31. if(empty($condition)) $condition = 'all';
  32. $query = $this->dao->select('*')->from(TABLE_FEEDBACK);
  33. if($condition != 'all')
  34. {
  35. $query->where('status')->eq($condition);
  36. }
  37. return $query->fetchAll('', false);
  38. }
  39. }