table_common_adminnote.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: table_common_adminnote.php 31558 2012-09-10 03:22:31Z liulanbo $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_common_adminnote extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'common_adminnote';
  15. $this->_pk = 'id';
  16. parent::__construct();
  17. }
  18. public function delete($id, $admin = '') {
  19. if(empty($id)) {
  20. return false;
  21. }
  22. return DB::query('DELETE FROM %t WHERE '.DB::field('id', $id).' %i', array($this->_table, ($admin ? ' AND '.DB::field('admin', $admin) : '')));
  23. }
  24. public function fetch_all_by_access($access) {
  25. if(!is_numeric($access) && !is_array($access)) {
  26. return array();
  27. }
  28. return DB::fetch_all('SELECT * FROM %t WHERE '.DB::field('access', $access).' ORDER BY dateline DESC', array($this->_table));
  29. }
  30. public function count_by_access($access) {
  31. if(!is_numeric($access) && !is_array($access)) {
  32. return 0;
  33. }
  34. return DB::result_first('SELECT COUNT(*) FROM %t WHERE '.DB::field('access', $access), array($this->_table));
  35. }
  36. }
  37. ?>