1: <?php
2: /**
3: * This code is licensed under AGPLv3 license or Afterlogic Software License
4: * if commercial version of the product was purchased.
5: * For full statements of the licenses see LICENSE-AFTERLOGIC and LICENSE-AGPL3 files.
6: */
7:
8: namespace Aurora\Modules\FilesTableviewWebclientPlugin;
9:
10: /**
11: * Replaces folders and files list view template in Files module for displaying items in table.
12: *
13: * @license https://www.gnu.org/licenses/agpl-3.0.html AGPL-3.0
14: * @license https://afterlogic.com/products/common-licensing Afterlogic Software License
15: * @copyright Copyright (c) 2023, Afterlogic Corp.
16: *
17: * @package Modules
18: */
19: class Module extends \Aurora\System\Module\AbstractWebclientModule
20: {
21: public function init()
22: {
23: }
24:
25: /**
26: * Obtains list of module settings for authenticated user.
27: *
28: * @return array
29: */
30: public function GetSettings()
31: {
32: \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::Anonymous);
33:
34: $oUser = \Aurora\System\Api::getAuthenticatedUser();
35: if (!empty($oUser) && $oUser->isNormalOrTenant()) {
36: return array(
37: 'EnableModule' => $oUser->{self::GetName().'::EnableModule'},
38: 'EnablePreviewPane' => $oUser->{self::GetName().'::EnablePreviewPane'}
39: );
40: }
41:
42: return null;
43: }
44:
45: /**
46: * Updates settings of the Simple Chat Module.
47: *
48: * @param boolean $EnableModule indicates if user turned on Simple Chat Module.
49: * @return boolean
50: */
51: public function UpdateSettings($EnableModule, $EnablePreviewPane)
52: {
53: \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::NormalUser);
54:
55: $iUserId = \Aurora\System\Api::getAuthenticatedUserId();
56: if (0 < $iUserId) {
57: $oUser = \Aurora\Modules\Core\Module::Decorator()->GetUserUnchecked($iUserId);
58: $oUser->setExtendedProp(self::GetName().'::EnableModule', $EnableModule);
59: $oUser->setExtendedProp(self::GetName().'::EnablePreviewPane', $EnablePreviewPane);
60: \Aurora\Modules\Core\Module::Decorator()->UpdateUserObject($oUser);
61: }
62: return true;
63: }
64: }
65: