Changeset 887 for trunk/Modules/Log/Log.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Log/Log.php
r874 r887 3 3 class ModuleLog extends AppModule 4 4 { 5 function __construct( $System)5 function __construct(System $System) 6 6 { 7 7 parent::__construct($System); … … 14 14 } 15 15 16 function DoInstall() 16 function DoInstall(): void 17 17 { 18 18 } 19 19 20 function DoUnInstall() 20 function DoUnInstall(): void 21 21 { 22 22 } 23 23 24 function DoStart() 24 function DoStart(): void 25 25 { 26 26 $this->System->FormManager->RegisterClass('Log', array( … … 38 38 ), 39 39 )); 40 $this->System->ModuleManager->Modules['RSS']->RegisterRSS(array('Title' => 'Logs',41 'Channel' => 'log', 'Callback' => array( 'ModuleLog', 'ShowRSS'),40 ModuleRSS::Cast($this->System->GetModule('RSS'))->RegisterRSS(array('Title' => 'Logs', 41 'Channel' => 'log', 'Callback' => array($this, 'ShowRSS'), 42 42 'Permission' => array('Module' => 'Log', 'Operation' => 'RSS'))); 43 43 } 44 44 45 function DoStop() 45 function DoStop(): void 46 46 { 47 47 } 48 48 49 function NewRecord( $Module, $Operation, $Value = '')49 function NewRecord(string $Module, string $Operation, string $Value = ''): void 50 50 { 51 if ( array_key_exists('User', $this->System->ModuleManager->Modules) and52 array_key_exists('Id', $this->System->User->User))53 $UserId = $this->System->User->User['Id'];51 if ($this->System->ModuleManager->ModulePresent('User') and 52 array_key_exists('Id', ModuleUser::Cast($this->System->GetModule('User'))->User->User)) 53 $UserId = ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id']; 54 54 else $UserId = NULL; 55 55 if (array_key_exists('REMOTE_ADDR', $_SERVER)) $IPAddress = $_SERVER['REMOTE_ADDR']; … … 60 60 } 61 61 62 function ShowRSS() 62 function ShowRSS(): string 63 63 { 64 64 $this->ClearPage = true; … … 98 98 return $RSS->Generate(); 99 99 } 100 101 static function Cast(AppModule $AppModule): ModuleLog 102 { 103 if ($AppModule instanceof ModuleLog) 104 { 105 return $AppModule; 106 } 107 throw new Exception('Expected ModuleLog type but got '.gettype($AppModule)); 108 } 100 109 }
Note:
See TracChangeset
for help on using the changeset viewer.