Changeset 105
- Timestamp:
- Feb 18, 2009, 4:37:11 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/img_level.php
r100 r105 14 14 $xp_from_word = 1; 15 15 $index_level = 100; 16 $ diverent = 3;16 $from_diakrit = 3; //zvýšené xp za slovo s diakritikou 17 17 18 18 function CheckDiakrit($word) { 19 19 $result = false; 20 $Diakrit = Array("á","č","ď","é","ě","í","ľ","ň","ó","ř","š","ť","ú", 21 "ů","ý","ž","Á","Č","Ď","É","Ě","Í","Ľ","Ň","Ó","Ř","Š","Ť","Ú","Ů","Ý","Ž"); 22 for ($i=0;$i<count($Diakrit);$i=$i+1) { 23 if (strpos($word,$Diakrit[$i]) <> false) { 24 $result = true; 25 } 26 } 27 return $result; 20 28 } 21 29 22 30 function CreateImg($user,$xp) { 23 global $index_level,$FontFile ,$diverent;31 global $index_level,$FontFile; 24 32 25 $level = ($xp / $index_level) / $diverent; 26 $level = substr($level,0,strpos($level,'.')); 27 $xp_min = ($level)* $index_level * $diverent; 28 $xp_max = ($level+1)* $index_level * $diverent; 33 if ($xp > 0) { 34 $level = sqrt ($xp / $index_level); 35 $level = substr($level,0,strpos($level,'.')); 36 } else { 37 $level = 0; 38 } 39 $xp_min = ($level) * ($level) * ($index_level); 40 $xp_max = ($level+1)*($level+1)* ($index_level); 29 41 $xp_max = $xp_max-$xp_min; 30 42 $xp = $xp-$xp_min; … … 40 52 imagefilledrectangle($Image, 0, 0, 250, 15, $Color1); 41 53 imagefilledrectangle($Image, 0, 0, $PercentBar, 59, $Color2); 42 $FontSize = 9; 43 ImageTTFText($Image, $FontSize, 0, 10, 12, $Color3, $FontFile, 'xp: '.$xp.'/'.$xp_max); 44 ImageTTFText($Image, $FontSize, 0, 100, 12, $Color3, $FontFile, 'Level: '.$level.' '.$user); 45 // ImageTTFText($Image, $FontSize, 0, 120, 29, $Color3, $FontFile, $Percent.'%'); 46 $FontSize = 6; 47 // ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date("m.d.y H:i")); 54 ImageTTFText($Image, 11, 0, 10, 12, $Color3, $FontFile, $level.' Level'); 55 ImageTTFText($Image, 8, 0, 80, 12, $Color3, $FontFile, $xp.'/'.$xp_max.' xp '.$user); 48 56 49 57 if (file_exists('tmp/'.$user.'/') == false) mkdir ('tmp/'.$user.'/'); … … 52 60 53 61 function GetXPFromTranslation($user_ID) { 54 global $Database,$TranslationTree,$xp_from_word ;62 global $Database,$TranslationTree,$xp_from_word,$from_diakrit; 55 63 $xp = 0; 56 64 … … 65 73 if (($Line[$TextItem['Column']] <> $LineComparison[$TextItem['Column']]) and (strlen($Line[$TextItem['Column']]) > (strlen($LineComparison[$TextItem['Column']])*0.5))) { //zda není stejný, zda je aspoň dlouhý jako polovina 66 74 $TextArr = explode(' ',$Line[$TextItem['Column']]); 67 for ($i=0;$i<count($TextArr);$i=$i+1) { 68 //if ($TextArr[$i]) // zjišťování diakritiky 69 $indikator = 1; 75 for ($i=0;$i<count($TextArr);$i=$i+1) { //pro každé slovo 76 if (CheckDiakrit($TextArr[$i])) // zjišťování diakritiky 77 $indikator = $from_diakrit; 78 else 79 $indikator = 1; 70 80 $xp_translation = $xp_translation + ($indikator * $xp_from_word); 71 81 } … … 83 93 84 94 //hlavní kod 85 $ID = $Database->SQLCommand('SELECT * FROM user'); // WHERE LastLogin > now() - 20 95 if ($nothide) 96 $ID = $Database->SQLCommand('SELECT * FROM user'); 97 else 98 $ID = $Database->SQLCommand('SELECT * FROM user WHERE DATE_SUB(NOW(), INTERVAL 2 DAY) < LastLogin'); 86 99 while ($LineUser = mysql_fetch_array($ID)) { 87 100 $xp = GetXPFromTranslation($LineUser['ID']); … … 92 105 if ($nothide) ShowFooter(); 93 106 94 //===================================================================95 /*96 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct(entry)) FROM '.$Group['TablePrefix'].' WHERE (Language <> 0) AND (Complete = 1)'));97 $NumberTranslate = $ID[0];98 99 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM '.$Group['TablePrefix'].' WHERE (Language = 0)'));100 $NumberAJ = $ID[0];101 102 if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100; else $Percent = 0;103 $Percent = substr($Percent, 0, 5);104 105 $PercentBar = $Percent * 4;106 $Image = ImageCreateTrueColor(400, 32);107 $Color1 = imagecolorallocate($Image, 214, 214, 214);108 $Color2 = imagecolorallocate($Image, 239, 131, 166);109 $Color3 = imagecolorallocate($Image, 225, 0, 0);110 imagefilledrectangle($Image, 0, 0, 400, 31, $Color1);111 imagefilledrectangle($Image, 0, 0, $PercentBar, 59, $Color2);112 $FontSize = 10;113 ImageTTFText($Image, $FontSize, 0, 120, 13, $Color3, $FontFile, $NumberTranslate.'/'.$NumberAJ);114 ImageTTFText($Image, $FontSize, 0, 240, 13, $Color3, $FontFile, $Group['Name']);115 ImageTTFText($Image, $FontSize, 0, 120, 29, $Color3, $FontFile, $Percent.'%');116 $FontSize = 6;117 ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date("m.d.y H:i"));118 119 Header("Content-type: image/png");120 ImagePNG($Image);121 ImageDestroy($Image);122 */123 107 ?> -
trunk/userlist.php
r101 r105 4 4 5 5 ShowPage(); 6 7 include('img_level.php'); 6 8 7 9 echo('<strong>Seznam uživatelů:</strong><br />'); … … 31 33 <th><a href="?Order=NumberTranslate&Desc='.$desc.'" title="Počet přeložených textů">Přeložených</a></th> 32 34 <th><a href="?Order=GM&Desc='.$desc.'">Oprávnění</a></th> 35 <th>Úroveň</th> 33 36 <th><a href="?Order=LastLogin&Desc='.$desc.'">Poslední připojení</a></th></tr>'); 34 37 … … 54 57 <td style="text-align: center;"><a href="TranslationList.php?user='.$Line['ID'].'&action=userall" title="Zobrazit Všechny jeho přeložené texty">'.$Line['NumberTranslate'].'</a></td> 55 58 <td>'.$Moderators[$Line['GM']].'</td> 59 <td><img src="tmp/'.$Line['user'].'/level.png" /><br></td> 56 60 <td>'.$Line['LastLogin'].'</td></tr>'); 57 61 }
Note:
See TracChangeset
for help on using the changeset viewer.