Changeset 455 for trunk/img_level.php
- Timestamp:
- Apr 13, 2010, 10:03:12 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/img_level.php
r404 r455 57 57 function GetXPFromTranslation($UserId) 58 58 { 59 global $ Database, $TranslationTree, $xp_from_word, $from_diakrit;59 global $System, $TranslationTree, $xp_from_word, $from_diakrit; 60 60 61 61 $xp = 0; … … 71 71 $GroupBy = substr($GroupBy, 0, -2); 72 72 73 $IDtran = $ Database->SQLCommand('SELECT * FROM `'.$Group['TablePrefix'].'` WHERE (`User` = '.$UserId.') AND (`Complete` = 1) '.$GroupBy);74 while($Line = mysql_fetch_array($IDtran))73 $IDtran = $System->Database->query('SELECT * FROM `'.$Group['TablePrefix'].'` WHERE (`User` = '.$UserId.') AND (`Complete` = 1) '.$GroupBy); 74 while($Line = $IDtran->fetch_array()) 75 75 { 76 $DbResult = $ Database->SQLCommand('SELECT * FROM `'.$Group['TablePrefix'].'` WHERE `ID` = '.$Line['Take']);77 $LineComparison = mysql_fetch_assoc($DbResult);76 $DbResult = $System->Database->query('SELECT * FROM `'.$Group['TablePrefix'].'` WHERE `ID` = '.$Line['Take']); 77 $LineComparison = $DbResult->fetch_assoc(); 78 78 $xp_translation = 0; 79 79 $translated = true; … … 103 103 function ImgLevelUpdate() 104 104 { 105 global $ Database, $TranslationTree;105 global $System, $TranslationTree; 106 106 107 107 // Hlavní kod pro uživatele 108 $ ID = $Database->SQLCommand('SELECT `ID`, `Name` FROM `User` WHERE `NeedUpdate` = 1');109 while($LineUser = mysql_fetch_array($ID))108 $DbResult = $System->Database->query('SELECT `ID`, `Name` FROM `User` WHERE `NeedUpdate` = 1'); 109 while($LineUser = $DbResult->fetch_array()) 110 110 { 111 111 // Build TranslatedCount query … … 120 120 121 121 $xp = GetXPFromTranslation($LineUser['ID']); 122 $ Database->SQLCommand('UPDATE `User` SET `XP` = '.$xp.', `TranslatedCount` = '.$TranslatedCount.' WHERE `User`.`ID` = '.$LineUser['ID']);122 $System->Database->query('UPDATE `User` SET `XP` = '.$xp.', `TranslatedCount` = '.$TranslatedCount.' WHERE `User`.`ID` = '.$LineUser['ID']); 123 123 CreateImg('user', $LineUser['Name'], $xp); 124 124 } 125 125 126 126 // Hlavní kod pro překladatelské týmy 127 $ ID = $Database->SQLCommand('SELECT `ID`, `Name`, (SELECT AVG(`XP`) FROM `User` WHERE `Team` = `Team`.`Id`) AS `Average` FROM `Team` WHERE `ID` IN (SELECT `Team` FROM `User` WHERE `NeedUpdate` = 1)');128 while($LineTeam = mysql_fetch_array($ID))127 $DbResult = $System->Database->query('SELECT `ID`, `Name`, (SELECT AVG(`XP`) FROM `User` WHERE `Team` = `Team`.`Id`) AS `Average` FROM `Team` WHERE `ID` IN (SELECT `Team` FROM `User` WHERE `NeedUpdate` = 1)'); 128 while($LineTeam = $DbResult->fetch_array()) 129 129 { 130 130 CreateImg('team', $LineTeam['Name'], substr($LineTeam['Average'], 0, strpos($LineTeam['Average'],'.'))); //vytváření obrázku 131 131 } 132 $ Database->SQLCommand('UPDATE `User` SET `NeedUpdate` = 0');132 $System->Database->query('UPDATE `User` SET `NeedUpdate` = 0'); 133 133 } 134 134 135 135 function ImgLevelShow() 136 136 { 137 global $ Database;137 global $System; 138 138 139 139 // Do update for all users 140 $ Database->SQLCommand('UPDATE `User` SET `NeedUpdate` = 1');140 $System->Database->query('UPDATE `User` SET `NeedUpdate` = 1'); 141 141 ImgLevelUpdate(); 142 142 143 143 echo('<strong>Uživatelé</strong><br/>'); 144 $ID = $ Database->SQLCommand('SELECT `ID`, `Name` FROM `User`');145 while($LineUser = mysql_fetch_array($ID))144 $ID = $System->Database->query('SELECT `ID`, `Name` FROM `User`'); 145 while($LineUser = $ID->fetch_array()) 146 146 { 147 147 echo('<img src="tmp/user/'.$LineUser['Name'].'/level.png" /> '.$LineUser['Name'].'<br />'); … … 149 149 150 150 echo('<br/><strong>Týmy</strong><br/>'); 151 $ID = $ Database->SQLCommand('SELECT `ID`, `Name` FROM `Team`');152 while($LineTeam = mysql_fetch_array($ID))151 $ID = $System->Database->query('SELECT `ID`, `Name` FROM `Team`'); 152 while($LineTeam = $ID->fetch_array()) 153 153 { 154 154 echo('<img src="tmp/team/'.$LineTeam['Name'].'/level.png" /> '.$LineTeam['Name'].'<br />');
Note:
See TracChangeset
for help on using the changeset viewer.