menu.table.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. private $coreMenu = 'core_menu';
  11. protected $primaryKey = 'id';
  12. public function uniaccount() {
  13. return $this->belongsTo('account', 'uniacid', 'uniacid');
  14. }
  15. public function searchAccountMenuList($type = '') {
  16. global $_W;
  17. $this->query->from($this->account_menu_table)->where('uniacid', $_W['uniacid']);
  18. if (!empty($type)) {
  19. $this->query->where('type', $type);
  20. }
  21. $result = $this->query->getall('id');
  22. return $result;
  23. }
  24. public function accountMenuInfo($condition = array()) {
  25. global $_W;
  26. $fields = array('id', 'menuid', 'type', 'status');
  27. $this->query->from($this->account_menu_table)->where('uniacid', $_W['uniacid']);
  28. if (!empty($condition)) {
  29. foreach ($condition as $key => $val) {
  30. if (in_array($key, $fields)) {
  31. $this->query->where($key, $val);
  32. }
  33. }
  34. }
  35. $result = $this->query->get();
  36. return $result;
  37. }
  38. public function accountDefaultMenuInfo() {
  39. global $_W;
  40. $this->query->from($this->account_menu_table)->where('uniacid', $_W['uniacid'])->where('type', MENU_CURRENTSELF)->where('status', STATUS_ON);
  41. $result = $this->query->get();
  42. return $result;
  43. }
  44. public function getCoreMenuList() {
  45. return $this->query->from($this->coreMenu)->getall('permission_name');
  46. }
  47. public function coreMenuOrderByDisplayorder($order = 'DESC') {
  48. $order = empty($order) ? 'ASC' : $order;
  49. return $this->query->orderby('displayorder', $order);
  50. }
  51. public function getCoreMenuFillPermissionName() {
  52. return $this->query->from($this->coreMenu)->where('permission_name !=', '')->getall('permission_name');
  53. }
  54. public function getTopMenu() {
  55. return $this->query->from($this->coreMenu)->where('is_system !=', 1)->getall();
  56. }
  57. }