Changeset 893 for trunk/Modules/User/User.php
- Timestamp:
- Mar 6, 2023, 1:48:45 AM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/User/User.php
r892 r893 1 1 <?php 2 2 3 include_once(dirname(__FILE__).'/ModuleUser.php'); 3 4 include_once(dirname(__FILE__).'/UserList.php'); 4 5 include_once(dirname(__FILE__).'/Options.php'); 5 6 include_once(dirname(__FILE__).'/Registration.php'); 6 7 include_once(dirname(__FILE__).'/Profile.php'); 7 8 class ModuleUser extends Module9 {10 function __construct(System $System)11 {12 parent::__construct($System);13 $this->Name = 'User';14 $this->Version = '1.1';15 $this->Creator = 'Chronos';16 $this->License = 'GNU/GPL';17 $this->Description = 'User and permission management';18 $this->Dependencies = array();19 }20 21 function DoStart(): void22 {23 $this->System->User = new User($this->System);24 $this->System->RegisterPage(['users'], 'PageUserList');25 $this->System->RegisterPage(['options'], 'PageUserOptions');26 $this->System->RegisterPage(['registration'], 'PageUserRegistration');27 $this->System->RegisterPage(['user'], 'PageUserProfile');28 $this->System->RegisterPage(['login'], 'PageUserLogin');29 Core::Cast($this->System)->RegisterMenuItem(array(30 'Title' => T('Translators'),31 'Hint' => 'Seznam registrovaných uživatelů',32 'Link' => $this->System->Link('/users/'),33 'Permission' => LICENCE_ANONYMOUS,34 'Icon' => '',35 ), 0);36 if (array_key_exists('Search', $this->System->ModuleManager->Modules))37 $this->System->ModuleManager->Modules['Search']->RegisterSearch('user',38 T('Translators'), array('Name'), '`User`', $this->System->Link('/users/?search='));39 Core::Cast($this->System)->RegisterPageBarItem('Top', 'User', array($this, 'TopBarCallback'));40 Core::Cast($this->System)->RegisterPageBarItem('Left', 'User', array($this, 'ShowOnlineList'));41 }42 43 function ShowOnlineList()44 {45 $Output = T('Online translators').':<br />';46 $DbResult = $this->System->Database->query('SELECT * FROM ('.47 'SELECT `User`.`Name`, `User`.`ID` FROM `UserOnline` '.48 'JOIN `User` ON `User`.`ID` = `UserOnline`.`User` '.49 'WHERE (`ActivityTime` >= NOW() - 300) '.50 'ORDER BY `ActivityTime` DESC ) AS `T` GROUP BY `Name`');51 while ($DbUser = $DbResult->fetch_assoc())52 {53 $Name = '<a href="'.$this->System->Link('/user/?user='.$DbUser['ID']).'">'.$DbUser['Name'].'</a>';54 $Output .= $Name.'<br />';55 }56 return $Output;57 }58 59 function TopBarCallback()60 {61 $Output = '';62 if ($this->System->User->Licence(LICENCE_USER))63 {64 //$DbResult =$this->Database->query('SELECT `Id`, `Name` FROM `Team` WHERE `Id`='.$this->System->User->Team);65 //$Team = $DbResult->fetch_assoc();66 //$Output .= ''<span class="MenuItem">Moje překlady: <a href="">Dokončené</a> <a href="">Rozpracované</a> <a href="">Exporty</a> Tým: <a href="">'.$Team['name'].'</a></span>';67 $Output .= $this->System->User->Name.' <a href="'.$this->System->Link('/?action=logout').'">'.T('Logout').'</a>'.68 ' <a href="'.$this->System->Link('/user/?user='.$this->System->User->Id).'">'.T('My page').'</a>'.69 ' <a href="'.$this->System->Link('/options/').'">'.T('Options').'</a>'.70 ' <a title="Vámi přeložené texty" href="'.$this->System->Link('/TranslationList.php?user='.71 $this->System->User->Id.'&group=0&state=2&text=&entry=').'">'.T('Translated').'</a>'.72 ' <a title="Vaše rozpracované text" href="'.$this->System->Link('/TranslationList.php?user='.73 $this->System->User->Id.'&group=0&state=3&text=&entry=').'">'.T('Unfinished').'</a>'.74 ' <a title="Nikým nepřeložené texty" href="'.75 $this->System->Link('/TranslationList.php?user=0&group=0&state=1&text=&entry=').'">'.T('Untranslated').'</a>';76 } else77 {78 $Output .= '<a href="'.$this->System->Link('/login/').'">'.T('Login').'</a> '.79 '<a href="'.$this->System->Link('/registration/').'">'.T('Registration').'</a>';80 }81 return $Output;82 }83 }84 8 85 9 class PageUserLogin extends Page … … 117 41 { 118 42 var $Id; 119 var$Name;43 public string $Name; 120 44 var $Team; 121 45 var $Role; … … 126 50 var $OnlineStateTimeout; 127 51 var $PreferredVersion = 0; 52 public string $PreferredVersionGame; 53 public string $Email; 54 public string $Info; 128 55 129 56 function __construct(System $System)
Note:
See TracChangeset
for help on using the changeset viewer.