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.

45 lines
1.6 KiB

  1. <?php
  2. /*********************************************************************************************************
  3. * Class Boardlib
  4. * ======================================================================================================
  5. *
  6. * 게시판용 라이브러리
  7. *********************************************************************************************************/
  8. class Boardlib {
  9. protected $CI;
  10. function __construct()
  11. {
  12. $this->CI =& get_instance();
  13. }
  14. function initialize($brd_key = "")
  15. {
  16. if(empty($brd_key)) return;
  17. }
  18. /******************************************************************************************************
  19. * 새글이 올라온 게시글 목록을 보여줍니다.
  20. *****************************************************************************************************/
  21. function getNewPostBoards ()
  22. {
  23. $cnt_query =
  24. $this->CI->db
  25. ->select('brd_key, COUNT(brd_key) AS new_cnt')
  26. ->from('board_post')
  27. ->where('reg_datetime >=', date('Y-m-d H:i:s', strtotime('-1 days')))
  28. ->where('post_status','Y')
  29. ->group_by('brd_key')
  30. ->get_compiled_select();
  31. $board_list =
  32. $this->CI->db
  33. ->select('B.*, IF(ISNULL(BC.new_cnt), 0, new_cnt) AS new_cnt')
  34. ->from('board AS B')
  35. ->join("($cnt_query) AS BC", 'BC.brd_key=B.brd_key','left')
  36. ->get()
  37. ->result_array();
  38. return $board_list;
  39. }
  40. }