AccountModules.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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\Uni;
  7. class AccountModules extends \We7Table {
  8. protected $tableName = 'uni_account_modules';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uniacid',
  12. 'module',
  13. 'enabled',
  14. 'shortcut',
  15. 'displayorder',
  16. 'settings',
  17. );
  18. protected $default = array(
  19. 'uniacid' => '',
  20. 'module' => '',
  21. 'enabled' => 0,
  22. 'shortcut' => 0,
  23. 'displayorder' => 0,
  24. 'settings' => '',
  25. );
  26. public function isSettingExists($module_name) {
  27. global $_W;
  28. return $this->query->where('module', $module_name)->where('uniacid', $_W['uniacid'])->exists();
  29. }
  30. public function getByUniacidAndVersionId($uniacid, $version_id) {
  31. $data = $this->query->where('uniacid', $uniacid)->where('version_id', $version_id)->get();
  32. if (!empty($data['settings'])) {
  33. $data['settings'] = iunserializer($data['settings']);
  34. }
  35. return $data;
  36. }
  37. public function getByUniacidAndModule($module_name, $uniacid) {
  38. $result = $this->query->where('module', $module_name)->where('uniacid', $uniacid)->get();
  39. if (!empty($result)) {
  40. $result['settings'] = iunserializer($result['settings']);
  41. }
  42. return $result;
  43. }
  44. }