Changeset 365 for trunk/team.php
- Timestamp:
- Mar 9, 2010, 11:29:05 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/team.php
r357 r365 31 31 echo($Order['Output']); 32 32 33 if(array_key_exists('search', $_GET)) $_SESSION['search'] = ' WHERE ` name` LIKE "%'.$_GET['search'].'%" OR `description` LIKE "%'.$_GET['search'].'%"';33 if(array_key_exists('search', $_GET)) $_SESSION['search'] = ' WHERE `Name` LIKE "%'.$_GET['search'].'%" OR `Description` LIKE "%'.$_GET['search'].'%"'; 34 34 else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 35 35 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; … … 46 46 if(!is_numeric($_SESSION['team'])) echo(' <a href="?Where">Zrušit filtr týmů</a><br />'); 47 47 */ 48 $DbResult = $Database->SQLCommand('SELECT `Team` FROM ` user` WHERE `ID`='.$_SESSION['UserID']);48 $DbResult = $Database->SQLCommand('SELECT `Team` FROM `User` WHERE `ID`='.$_SESSION['UserID']); 49 49 $User = mysql_fetch_assoc($DbResult); 50 50 51 $ID = $Database->SQLCommand('SELECT *, (SELECT COUNT(*) FROM ` user` WHERE `user`.`team` = `Team`.`Id`) AS `NumberUser`, (SELECT `user` FROM `user` WHERE `user`.`ID`=`Team`.`Leader`) AS `LeaderName` FROM `Team` '.$_SESSION['search'].$Order['SQL'].$PageList['SQLLimit']);51 $ID = $Database->SQLCommand('SELECT *, (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) AS `NumberUser`, (SELECT `Name` FROM `User` WHERE `User`.`ID`=`Team`.`Leader`) AS `LeaderName` FROM `Team` '.$_SESSION['search'].$Order['SQL'].$PageList['SQLLimit']); 52 52 while($Team = mysql_fetch_assoc($ID)) 53 53 { … … 81 81 if(array_key_exists('id', $_GET)) 82 82 { 83 $Database->SQLCommand('UPDATE ` user` SET `team` = '.$_GET['id'].' WHERE `ID` = '.$_SESSION['UserID']);83 $Database->SQLCommand('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$_SESSION['UserID']); 84 84 echo('<strong>Vstoupil jsi do týmu</strong><br /><br />'); 85 85 WriteLog('Uživatel vstoupil do týmu '.$_GET['id'], LOG_TYPE_USER); 86 86 87 87 // Delete all teams without users 88 $Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM ` user` WHERE `user`.`team` = `Team`.`Id`) = 0');88 $Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0'); 89 89 90 90 // Set new leader for teams where old leader went to other team 91 $Database->SQLCommand('UPDATE Team SET Leader=(SELECT Id FROM `user` WHERE user.Team=Team.Id ORDER BY user.RegistrationTime LIMIT 1) WHERE Leader NOT IN (SELECT ID FROM user WHERE user.Team=Team.Id);');91 $Database->SQLCommand('UPDATE `Team` SET `Leader`=(SELECT `Id` FROM `User` WHERE `User`.`Team`=`Team`.`Id` ORDER BY `User`.`RegistrationTime` LIMIT 1) WHERE `Leader` NOT IN (SELECT `ID` FROM `User` WHERE `User`.`Team`=`Team`.`Id`);'); 92 92 93 93 ShowTeamList(); … … 110 110 { 111 111 $Database->SQLCommand('INSERT INTO `Team` (`Name` ,`Description`, `URL`, `TimeCreate`,`Leader`) VALUES ("'.trim($_POST['Name']).'", "'.trim($_POST['Description']).'", "'.$_POST['URL'].'", NOW(), '.$_SESSION['UserID'].')'); 112 $Database->SQLCommand('UPDATE ` user` SET `team` = '.mysql_insert_id().' WHERE `ID` = '.$_SESSION['UserID']);112 $Database->SQLCommand('UPDATE `User` SET `Team` = '.mysql_insert_id().' WHERE `ID` = '.$_SESSION['UserID']); 113 113 echo('<strong>Překladatelský tým vytvořen</strong><br /><br />'); 114 114 WriteLog('Překladatelský tým vytvořen '.$_POST['Name'], LOG_TYPE_USER); 115 115 116 116 // Delete all teams without users 117 $Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM ` user` WHERE `user`.`team` = `Team`.`Id`) = 0');117 $Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0'); 118 118 } else echo('Již existuje tým se stejným jménem'); 119 119 } else echo('Chybí údaje formuláře'); … … 195 195 ImgLevelUpdate(); 196 196 197 $Team = mysql_fetch_assoc($Database->SQLCommand('SELECT *, (SELECT count(*) FROM `user` WHERE `team` = `Team`.`Id`) AS `NumberUser`, (SELECT SUM(`TranslatedCount`) FROM `user` WHERE `team` = `Team`.`Id`) AS `NumberTranslate` FROM `Team` WHERE `Id`='.$_GET['id']));198 $DbResult = $Database->SQLCommand('SELECT user FROM user WHERE ID='.$Team['Leader']);197 $Team = mysql_fetch_assoc($Database->SQLCommand('SELECT *, (SELECT COUNT(*) FROM `User` WHERE `Team` = `Team`.`Id`) AS `NumberUser`, (SELECT SUM(`TranslatedCount`) FROM `User` WHERE `team` = `Team`.`Id`) AS `NumberTranslate` FROM `Team` WHERE `Id`='.$_GET['id'])); 198 $DbResult = $Database->SQLCommand('SELECT `Name` FROM `User` WHERE `ID`='.$Team['Leader']); 199 199 if(mysql_num_rows($DbResult) > 0) 200 200 { 201 201 $Leader = mysql_fetch_assoc($DbResult); 202 $Leader = $Leader[' user'];202 $Leader = $Leader['Name']; 203 203 } else $Leader = ''; 204 204 … … 227 227 if(Licence(LICENCE_USER)) 228 228 { 229 $Database->SQLCommand('UPDATE ` user` SET `team` = 0 WHERE `ID` = '.$_SESSION['UserID']);229 $Database->SQLCommand('UPDATE `User` SET `Team` = 0 WHERE `ID` = '.$_SESSION['UserID']); 230 230 echo('<strong>Nyní nejste členem žádného týmu</strong><br /><br />'); 231 231 WriteLog('Uživatel vystoupil z týmu', LOG_TYPE_USER); 232 232 233 233 // Delete all teams without users 234 $Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM ` user` WHERE `user`.`team` = `Team`.`Id`) = 0');234 $Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0'); 235 235 236 236 // Set new leader for teams where old leader went to other team 237 $Database->SQLCommand('UPDATE Team SET Leader=(SELECT Id FROM `user` WHERE user.Team=Team.Id ORDER BY user.RegistrationTime LIMIT 1) WHERE Leader NOT IN (SELECT ID FROM user WHERE user.Team=Team.Id);');237 $Database->SQLCommand('UPDATE `Team` SET `Leader`=(SELECT `Id` FROM `User` WHERE `User`.`Team`=`Team`.`Id` ORDER BY `User`.`RegistrationTime` LIMIT 1) WHERE `Leader` NOT IN (SELECT `ID` FROM `User` WHERE `User`.`Team`=`Team`.`Id`);'); 238 238 239 239 ShowTeamList();
Note:
See TracChangeset
for help on using the changeset viewer.