MenuShortcut.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. namespace We7\Table\Core;
  7. class MenuShortcut extends \We7Table {
  8. protected $tableName = 'core_menu_shortcut';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uid',
  12. 'uniacid',
  13. 'modulename',
  14. 'displayorder',
  15. 'position',
  16. 'updatetime',
  17. );
  18. protected $default = array(
  19. 'uid' => '',
  20. 'uniacid' => '',
  21. 'modulename' => '',
  22. 'displayorder' => '0',
  23. 'position' => '',
  24. 'updatetime' => '',
  25. );
  26. public function getUserWelcomeShortcutList($uid) {
  27. return $this->query
  28. ->where('position', 'home_welcome_system_common')
  29. ->where('uid', $uid)
  30. ->orderby('displayorder', 'desc')
  31. ->getall();
  32. }
  33. public function getUserWelcomeShortcut($uid, $uniacid, $modulename) {
  34. return $this->where(array('uid' => $uid, 'uniacid' => $uniacid, 'modulename' => $modulename, 'position' => 'home_welcome_system_common'))->get();
  35. }
  36. public function getUserPluginModuleShortcut($uid, $uniacid, $main_module) {
  37. $position = 'module_' . $main_module . '_menu_plugin_shortcut';
  38. return $this->where(array('uid' => $uid, 'uniacid' => $uniacid, 'modulename' => $main_module, 'position' => $position))->get();
  39. }
  40. public function saveUserWelcomeShortcut($uid, $uniacid = 0, $modulename = '') {
  41. $user_welcome_short_info = $this->getUserWelcomeShortcut($uid, $uniacid, $modulename);
  42. if (!$user_welcome_short_info) {
  43. $save_data = array(
  44. 'uid' => $uid,
  45. 'uniacid' => $uniacid,
  46. 'modulename' => $modulename,
  47. 'position' => 'home_welcome_system_common',
  48. );
  49. $this->fill($save_data)->save();
  50. }
  51. }
  52. public function getCurrentModuleMenuPluginList($main_module) {
  53. global $_W;
  54. $position = 'module_' . $main_module . '_menu_plugin_shortcut';
  55. return $this->where(array('uid' => $_W['uid'], 'uniacid' => $_W['uniacid'], 'position' => $position))->getall('modulename');
  56. }
  57. }