menu.table.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. class MenuTable extends We7Table {
  8. protected $tableName = 'uni_account_menus';
  9. private $account_menu_table = 'uni_account_menus';
  10. protected $primaryKey = 'id';
  11. public function uniaccount() {
  12. return $this->belongsTo('account', 'uniacid', 'uniacid');
  13. }
  14. public function searchAccountMenuList($type = '') {
  15. global $_W;
  16. $this->query->from($this->account_menu_table)->where('uniacid', $_W['uniacid']);
  17. if (!empty($type)) {
  18. $this->query->where('type', $type);
  19. }
  20. $result = $this->query->getall('id');
  21. return $result;
  22. }
  23. public function accountMenuInfo($condition = array()) {
  24. global $_W;
  25. $fields = array('id', 'menuid', 'type', 'status');
  26. $this->query->from($this->account_menu_table)->where('uniacid', $_W['uniacid']);
  27. if (!empty($condition)) {
  28. foreach ($condition as $key => $val) {
  29. if (in_array($key, $fields)) {
  30. $this->query->where($key, $val);
  31. }
  32. }
  33. }
  34. $result = $this->query->get();
  35. return $result;
  36. }
  37. public function accountDefaultMenuInfo() {
  38. global $_W;
  39. $this->query->from($this->account_menu_table)->where('uniacid', $_W['uniacid'])->where('type', MENU_CURRENTSELF)->where('status', STATUS_ON);
  40. $result = $this->query->get();
  41. return $result;
  42. }
  43. }