You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.0 KiB

7 years ago
7 years ago
7 years ago
7 years ago
  1. <?php
  2. /**
  3. * Class Faq_model
  4. * ----------------------------------------------------------
  5. * FAQ 그룹 FAQ 내용에 대한 Model
  6. */
  7. class Faq_model extends WB_Model {
  8. /**
  9. * FAQ 그룹중 하나를 가져온다.
  10. */
  11. function get_category($fac_idx)
  12. {
  13. if( empty($fac_idx)) return FALSE;
  14. $param['idx'] = $fac_idx;
  15. $param['column'] = "fac_idx";
  16. $param['from'] = "faq_category";
  17. return $this->get_one($param);
  18. }
  19. /**
  20. * FAQ 그룹의 목록을 가져온다.
  21. */
  22. function get_category_list()
  23. {
  24. $param['from'] = "faq_category";
  25. $param['limit'] = FALSE;
  26. $param['where']['fac_status'] = "Y";
  27. $param['order_by'] = "sort ASC";
  28. return $this->get_list($param);
  29. }
  30. /**
  31. * FAQ 그룹의 등록된 FAQ 개수를 최신화 한다.
  32. * @param $fac_idx
  33. * @return bool
  34. */
  35. function update_category_count($fac_idx)
  36. {
  37. if(empty($fac_idx)) return FALSE;
  38. $count = ((int) $this->db->select('COUNT(faq_idx) AS count')->where('fac_idx', $fac_idx)->where('faq_status','Y')->get('faq')->row(0)->count);
  39. $this->db->set('fac_count', $count);
  40. $this->db->where('fac_idx', $fac_idx);
  41. return $this->db->update('faq_category');
  42. }
  43. /**
  44. * FAQ중 하나를 가져온다.
  45. */
  46. function get_faq($faq_idx)
  47. {
  48. if( empty($faq_idx)) return FALSE;
  49. $param['idx'] = $faq_idx;
  50. $param['column'] = "faq_idx";
  51. $param['from'] = "faq";
  52. return $this->get_one($param);
  53. }
  54. function get_detail_list($fac_idx="")
  55. {
  56. $param['select'] = 'F.*, M.mem_nickname AS upd_username';
  57. $param['from'] = "faq AS F";
  58. $param['join'][] = array('member AS M','M.mem_idx=F.upd_user','left');
  59. if($fac_idx)
  60. {
  61. $param['where']['fac_idx'] = $fac_idx;
  62. }
  63. $param['where']['faq_status'] = "Y";
  64. $param['order_by'] = "sort ASC";
  65. return $this->get_list($param);
  66. }
  67. }