Changeset 893 for trunk/Modules/Team
- Timestamp:
- Mar 6, 2023, 1:48:45 AM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Team/Team.php
r888 r893 34 34 function ShowTeamList() 35 35 { 36 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 36 37 $this->Title = T('Teams'); 37 38 $Output = '<h3>'.T('List of translating teams').'</h3>'; … … 42 43 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 43 44 44 if ($ this->System->User->Licence(LICENCE_USER))45 if ($User->Licence(LICENCE_USER)) 45 46 $Output .= '<br /><div style="text-align: center;"><a href="?action=create">'.T('Create translating team').'</a></div><br/>'; 46 47 if ($_SESSION['search'] != '') … … 64 65 array('Name' => 'TimeCreate', 'Title' => T('Founding date')), 65 66 ); 66 if ($ this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('User actions'));67 if ($User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('User actions')); 67 68 68 69 $Order = GetOrderTableHeader($TableColumns, 'NumberUser', 1); … … 80 81 '<td><a href="'.$this->System->Link('/users/?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a></td>'. 81 82 '<td>'.HumanDate($Team['TimeCreate']).'</td>'; 82 if ($ this->System->User->Licence(LICENCE_USER))83 { 84 if ($Team['Leader'] == $ this->System->User->Id) $Action = ' <a href="?action=modify&id='.$Team['Id'].'">'.T('Edit').'</a>';83 if ($User->Licence(LICENCE_USER)) 84 { 85 if ($Team['Leader'] == $User->Id) $Action = ' <a href="?action=modify&id='.$Team['Id'].'">'.T('Edit').'</a>'; 85 86 else $Action = ''; 86 if ($Team['Id'] == $ this->System->User->Team) $Action = ' <a href="?action=leave">'.T('Leave').'</a>';87 if ($Team['Id'] == $User->Team) $Action = ' <a href="?action=leave">'.T('Leave').'</a>'; 87 88 $Output .= '<td><a href="?action=gointeam&id='.$Team['Id'].'">'.T('Enter').'</a>'.$Action.'</td>'; 88 89 } … … 97 98 function TeamJoin() 98 99 { 99 if ($this->System->User->Licence(LICENCE_USER)) 100 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 101 if ($User->Licence(LICENCE_USER)) 100 102 { 101 103 if (array_key_exists('id', $_GET)) 102 104 { 103 $this->Database->query('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$ this->System->User->Id);105 $this->Database->query('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$User->Id); 104 106 $Output = ShowMessage(T('You joined new team')); 105 107 $this->System->ModuleManager->Modules['Log']->WriteLog('Uživatel vstoupil do týmu '.$_GET['id'], LOG_TYPE_USER); … … 119 121 function TeamCreateFinish() 120 122 { 123 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 121 124 $Output = ''; 122 if ($ this->System->User->Licence(LICENCE_USER))125 if ($User->Licence(LICENCE_USER)) 123 126 { 124 127 if (array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST)) … … 131 134 $this->Database->query('INSERT INTO `Team` (`Name` ,`Description`, `URL`, `TimeCreate`, `Leader`)'. 132 135 ' VALUES ("'.trim($_POST['Name']).'", "'.trim($_POST['Description']).'", "'. 133 $_POST['URL'].'", NOW(), '.$ this->System->User->Id.')');134 $this->Database->query('UPDATE `User` SET `Team` = '.$this->Database->insert_id.' WHERE `ID` = '.$ this->System->User->Id);136 $_POST['URL'].'", NOW(), '.$User->Id.')'); 137 $this->Database->query('UPDATE `User` SET `Team` = '.$this->Database->insert_id.' WHERE `ID` = '.$User->Id); 135 138 $Output .= ShowMessage('Překladatelský tým vytvořen.'); 136 139 $this->System->ModuleManager->Modules['Log']->WriteLog('Překladatelský tým vytvořen '.$_POST['Name'], LOG_TYPE_USER); … … 147 150 function TeamModify() 148 151 { 149 if ($this->System->User->Licence(LICENCE_USER)) 152 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 153 if ($User->Licence(LICENCE_USER)) 150 154 { 151 155 if (array_key_exists('id', $_GET)) 152 156 { 153 $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$ this->System->User->Id);157 $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$User->Id); 154 158 if ($DbResult->num_rows > 0) 155 159 { … … 170 174 function TeamModifyFinish() 171 175 { 176 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 172 177 $Output = ''; 173 if ($ this->System->User->Licence(LICENCE_USER))178 if ($User->Licence(LICENCE_USER)) 174 179 { 175 180 if (array_key_exists('id', $_GET) and array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST) and array_key_exists('URL', $_POST)) 176 181 { 177 $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$ this->System->User->Id);182 $DbResult = $this->Database->query('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$User->Id); 178 183 if ($DbResult->num_rows > 0) 179 184 { … … 197 202 function TeamCreate() 198 203 { 199 if ($this->System->User->Licence(LICENCE_USER)) 204 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 205 if ($User->Licence(LICENCE_USER)) 200 206 { 201 207 $Output ='<form action="?action=finish_create" method="post">'. … … 212 218 function TeamShow() 213 219 { 220 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 214 221 $Output = ''; 215 222 if (array_key_exists('id', $_GET) and is_numeric($_GET['id'])) … … 237 244 $Output .= '<br />'; 238 245 //$Output .= '<a href="export/?team='.$Team['Id'].'">Exportovat překlad týmu</a> '; 239 if ($ this->System->User->Licence(LICENCE_USER))246 if ($User->Licence(LICENCE_USER)) 240 247 $Output .='<a href="?action=gointeam&id='.$Team['Id'].'">'.T('Enter to team').'</a><br /><br />'; 241 248 $XP = GetLevelMinMax($Team['AverageXP']); … … 245 252 T('Average level of team members').': <strong>'.$XP['Level'].'</strong> '.T('experience').': '.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'<br />'. 246 253 '<br />'. 247 '<strong>'.T('Team completion state for version').' '. $this->System->Config['Web']['GameVersion'].'</strong><br />';248 249 $BuildNumber = GetBuildNumber( $this->System->Config['Web']['GameVersion']);254 '<strong>'.T('Team completion state for version').' '.Core::Cast($this->System)->Config['Web']['GameVersion'].'</strong><br />'; 255 256 $BuildNumber = GetBuildNumber(Core::Cast($this->System)->Config['Web']['GameVersion']); 250 257 251 258 $GroupListQuery = 'SELECT `Group`.* FROM `Group`'; … … 259 266 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 260 267 'WHERE (`User` IN (SELECT `ID` FROM `User` WHERE `Team` = '.$Team['Id'].')) '. 261 'AND (`Complete` = 1) AND (`T`.`Language`!='. $this->System->Config['OriginalLanguage'].') '.268 'AND (`Complete` = 1) AND (`T`.`Language`!='.Core::Cast($this->System)->Config['OriginalLanguage'].') '. 262 269 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 263 270 ') AS `C1`) AS `Translated`, '. 264 271 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 265 272 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '. 266 'WHERE (`Language` = '. $this->System->Config['OriginalLanguage'].') '.273 'WHERE (`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') '. 267 274 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 268 275 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION '; … … 311 318 function TeamLeave() 312 319 { 313 if ($this->System->User->Licence(LICENCE_USER)) 314 { 315 $this->Database->query('UPDATE `User` SET `Team` = NULL WHERE `ID` = '.$this->System->User->Id); 320 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 321 if ($User->Licence(LICENCE_USER)) 322 { 323 $this->Database->query('UPDATE `User` SET `Team` = NULL WHERE `ID` = '.$User->Id); 316 324 $Output = ShowMessage(T('You are now not member of any team')); 317 325 $this->System->ModuleManager->Modules['Log']->WriteLog('Uživatel vystoupil z týmu', LOG_TYPE_USER);
Note:
See TracChangeset
for help on using the changeset viewer.