Changeset 826 for trunk/Modules


Ignore:
Timestamp:
Mar 1, 2015, 3:38:19 PM (10 years ago)
Author:
chronos
Message:
  • Modified: Removed generation of user level to images as files. Level images ware replaced by HTML progress bar.
  • Modified: User XP level and translated count is now calculated during every translation save operation rather then calculated in user list and group view page show.
  • Fixed: Wrong indentation in some files.
Location:
trunk/Modules
Files:
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Export/ProcessTask.php

    r816 r826  
    1010
    1111//LoadCommandLineParameters();
    12   $System = new System();
    13   $System->DoNotShowPage = true;
    14     $System->Run();
    15 
    16 function SetProgress($Export,$per) {
     12$System = new System();
     13$System->DoNotShowPage = true;
     14$System->Run();
     15
     16function SetProgress($Export, $Progress)
     17{
    1718   global $System;
    18         $System->Database->query('UPDATE `ExportTask` SET `Progress`='.$per.' WHERE `Export`='.$Export->Id);
    19 }
    20 
     19
     20   $System->Database->query('UPDATE `ExportTask` SET `Progress`='.$Progress.' WHERE `Export`='.$Export->Id);
     21}
    2122
    2223function DeleteOldFiles($deldir)
    2324{
    24         if(file_exists($deldir.'/'))
    25         {
    26           $Dir = opendir($deldir.'/') ;
    27           while(($File = readdir($Dir)) !== false)
    28           {
    29             if(($File != '..') and ($File != '.') and (!is_dir("$File"))) unlink($deldir.'/'.$File);
    30           }
    31           closedir($Dir);
    32         }
    33 
    34 }
    35 
    36 function rcopy($src, $dst) {
     25  if(file_exists($deldir.'/'))
     26  {
     27    $Dir = opendir($deldir.'/') ;
     28    while(($File = readdir($Dir)) !== false)
     29    {
     30      if(($File != '..') and ($File != '.') and (!is_dir("$File"))) unlink($deldir.'/'.$File);
     31    }
     32    closedir($Dir);
     33  }
     34}
     35
     36function rcopy($src, $dst)
     37{
    3738 // echo  $src.' '.$dst."\n";
    3839  if (file_exists($dst)) DeleteOldFiles($dst);
     
    4647}
    4748
    48 function GetWinZPatch($patch) {
     49function GetWinZPatch($patch)
     50{
    4951  //TMP="Z:\\a\\www\\wowpreklad\\tmp\\Export\\${EXPORTID}\\"
    5052  $patch = str_replace(DIRECTORY_SEPARATOR,'\\',$patch);
     
    5355}
    5456
    55 function MPQPack($packdir) {
    56 
     57function MPQPack($packdir)
     58{
    5759  if(file_exists($packdir.DIRECTORY_SEPARATOR))
    5860  {
  • trunk/Modules/Team/Team.php

    r816 r826  
    3030}
    3131
    32 include_once(dirname(__FILE__).'/../../img_level.php');
    33 
    3432class PageTeam extends Page
    3533{
     
    6058
    6159    $TableColumns = array(
    62         array('Name' => 'Name', 'Title' => T('Name')),
    63         array('Name' => 'URL', 'Title' => T('Web pages')),
    64         array('Name' => 'LeaderName', 'Title' => T('Leader')),
    65         array('Name' => 'NumberUser', 'Title' => T('Member count')),
    66         array('Name' => 'TimeCreate', 'Title' => T('Founding date')),
     60      array('Name' => 'Name', 'Title' => T('Name')),
     61      array('Name' => 'URL', 'Title' => T('Web pages')),
     62      array('Name' => 'LeaderName', 'Title' => T('Leader')),
     63      array('Name' => 'NumberUser', 'Title' => T('Member count')),
     64      array('Name' => 'TimeCreate', 'Title' => T('Founding date')),
    6765    );
    6866    if($this->System->User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => T('User actions'));
     
    7775    {
    7876      $Output .= '<tr>'.
    79           '<td><a href="?action=team&amp;id='.$Team['Id'].'">'.$Team['Name'].'</a></td>'.
    80           '<td><a href="http://'.$Team['URL'].'">'.$Team['URL'].'</a></td>'.
    81           '<td><a href="'.$this->System->Link('/user.php?user='.$Team['Leader']).'">'.$Team['LeaderName'].'</a></td>'.
    82           '<td><a href="'.$this->System->Link('/userlist.php?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a></td>'.
    83           '<td>'.HumanDate($Team['TimeCreate']).'</td>';
     77        '<td><a href="?action=team&amp;id='.$Team['Id'].'">'.$Team['Name'].'</a></td>'.
     78        '<td><a href="http://'.$Team['URL'].'">'.$Team['URL'].'</a></td>'.
     79        '<td><a href="'.$this->System->Link('/user.php?user='.$Team['Leader']).'">'.$Team['LeaderName'].'</a></td>'.
     80        '<td><a href="'.$this->System->Link('/userlist.php?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a></td>'.
     81        '<td>'.HumanDate($Team['TimeCreate']).'</td>';
    8482      if($this->System->User->Licence(LICENCE_USER))
    8583      {
     
    9290    }
    9391    $Output .= '</table>'.
    94         $PageList['Output'];
     92      $PageList['Output'];
    9593
    9694    return($Output);
     
    132130        {
    133131          $this->Database->query('INSERT INTO `Team` (`Name` ,`Description`, `URL`, `TimeCreate`, `Leader`)'.
    134               ' VALUES ("'.trim($_POST['Name']).'", "'.trim($_POST['Description']).'", "'.
    135               $_POST['URL'].'", NOW(), '.$this->System->User->Id.')');
     132            ' VALUES ("'.trim($_POST['Name']).'", "'.trim($_POST['Description']).'", "'.
     133            $_POST['URL'].'", NOW(), '.$this->System->User->Id.')');
    136134          $this->Database->query('UPDATE `User` SET `Team` = '.$this->Database->insert_id.' WHERE `ID` = '.$this->System->User->Id);
    137135          $Output .= ShowMessage('Překladatelský tým vytvořen.');
     
    158156          $Team = $DbResult->fetch_assoc();
    159157          $Output = '<form action="?action=finish_modify&amp;id='.$_GET['id'].'" method="post">'.
    160               '<fieldset><legend>Nastavení týmu</legend>'.
    161               '<table><tr><td>Jméno:</td><td><input type="text" name="Name" value="'.$Team['Name'].'"/></td></tr>'.
    162               '<tr><td>Webové stránky:</td><td>http://<input type="text" name="URL" value="'.$Team['URL'].'"/></td></tr>'.
    163               '<tr><td>Popis:</td><td><input type="text" name="Description" value="'.$Team['Description'].'"/></td></tr>'.
    164               '<tr><td colspan="2"><input type="submit" value="Uložit" /></td></tr>'.
    165               '</table></fieldset></form>';
     158            '<fieldset><legend>Nastavení týmu</legend>'.
     159            '<table><tr><td>Jméno:</td><td><input type="text" name="Name" value="'.$Team['Name'].'"/></td></tr>'.
     160            '<tr><td>Webové stránky:</td><td>http://<input type="text" name="URL" value="'.$Team['URL'].'"/></td></tr>'.
     161            '<tr><td>Popis:</td><td><input type="text" name="Description" value="'.$Team['Description'].'"/></td></tr>'.
     162            '<tr><td colspan="2"><input type="submit" value="Uložit" /></td></tr>'.
     163            '</table></fieldset></form>';
    166164        } else $Output = ShowMesage('Tým nenalezen.', MESSAGE_CRITICAL);
    167165      } else $Output = ShowMessage('Nezadáno id týmu', MESSAGE_CRITICAL);
     
    202200    {
    203201      $Output ='<form action="?action=finish_create" method="post">'.
    204           '<fieldset><legend>Vytvoření nového týmu</legend>'.
    205           '<table><tr><td>Jméno:</td><td><input type="text" name="Name" /></td></tr>'.
    206           '<tr><td>Webové stránky:</td><td>http://<input type="text" name="URL" value=""/></td></tr>'.
    207           '<tr><td>Popis:</td><td><input type="text" name="Description" /></td></tr>'.
    208           '<tr><td colspan="2"><input type="submit" value="Vytvořit a vstoupit" /></td></tr>'.
    209           '</table></fieldset></form>';
     202        '<fieldset><legend>Vytvoření nového týmu</legend>'.
     203        '<table><tr><td>Jméno:</td><td><input type="text" name="Name" /></td></tr>'.
     204        '<tr><td>Webové stránky:</td><td>http://<input type="text" name="URL" value=""/></td></tr>'.
     205        '<tr><td>Popis:</td><td><input type="text" name="Description" /></td></tr>'.
     206        '<tr><td colspan="2"><input type="submit" value="Vytvořit a vstoupit" /></td></tr>'.
     207        '</table></fieldset></form>';
    210208    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    211209    return($Output);
     
    217215    if(array_key_exists('id', $_GET) and is_numeric($_GET['id']))
    218216    {
    219       ImgLevelUpdate();
    220 
    221217      $DbResult = $this->Database->query('SELECT `Id`, `Name`, `Description`, `URL`, `Leader`, '.
    222           '(SELECT COUNT(*) FROM `User` WHERE '.
    223           '`Team` = `Team`.`Id`) AS `NumberUser`, (SELECT SUM(`TranslatedCount`) FROM `User` WHERE '.
    224           '`Team` = `Team`.`Id`) AS `NumberTranslate` FROM '.
    225           '`Team` WHERE `Id`='.($_GET['id'] * 1));
     218        '(SELECT COUNT(*) FROM `User` WHERE '.
     219        '`Team` = `Team`.`Id`) AS `NumberUser`, '.
     220        '(SELECT SUM(`TranslatedCount`) FROM `User` WHERE `Team` = `Team`.`Id`) AS `NumberTranslate`, '.
     221        '(SELECT ROUND(AVG(`XP`)) FROM `User` WHERE `Team` = `Team`.`Id`) AS `AverageXP` FROM '.
     222        '`Team` WHERE `Id`='.($_GET['id'] * 1));
    226223      if($DbResult->num_rows > 0)
    227224      {
     
    233230        } else $Leader = array('Name' => '', 'Id' => 0);
    234231
    235         $Output .='<strong>Překladatelský tým '.$Team['Name'].'</strong><br />'.
    236             'Webové stránky: <a href="http://'.$Team['URL'].'">'.$Team['URL'].'</a><br/>'.
    237             'Vedoucí: <a href="'.$this->System->Link('/user.php?user='.$Leader['Id']).'">'.$Leader['Name'].'</a><br/>'.
    238             'Popis: '.$Team['Description'].'<br /><br />';
     232        $Output .='<h3>Překladatelský tým '.$Team['Name'].'</h3><br />'.
     233          'Webové stránky: <a href="http://'.$Team['URL'].'">'.$Team['URL'].'</a><br/>'.
     234          'Vedoucí: <a href="'.$this->System->Link('/user.php?user='.$Leader['Id']).'">'.$Leader['Name'].'</a><br/>';
     235        if($Team['Description'] != '')
     236          $Output .= 'Popis: '.$Team['Description'].'<br />';
     237        $Output .= '<br />';
    239238        //$Output .= '<a href="export/?team='.$Team['Id'].'">Exportovat překlad týmu</a> ';
    240239        if($this->System->User->Licence(LICENCE_USER))
    241240          $Output .='<a href="?action=gointeam&amp;id='.$Team['Id'].'">Vstoupit do týmu</a><br /><br />';
     241        $XP = GetLevelMinMax($Team['AverageXP']);
    242242        $Output .='<fieldset><legend>Statistika</legend>'.
    243             'Počet členů týmu: <a href="'.$this->System->Link('/userlist.php?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a><br />'.
    244             'Počet přeložených textů týmu: <strong>'.$Team['NumberTranslate'].'</strong><br />'.
    245             'Průměrná úroveň překladatelů v týmu: <img src="'.$this->System->Link('/tmp/team/'.$Team['Name'].'/level.png').'" /><br /><br />'.
    246             '<strong>Stav dokončení týmu pro verzi '.$this->System->Config['Web']['GameVersion'].'</strong><br />';
     243          'Počet členů týmu: <a href="'.$this->System->Link('/userlist.php?team='.$Team['Id']).'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a><br />'.
     244          'Počet přeložených textů týmu: <strong>'.$Team['NumberTranslate'].'</strong><br />'.
     245          'Průměrná úroveň překladatelů v týmu: <strong>'.$XP['Level'].'</strong> zkušenost: '.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'<br />'.
     246          '<br />'.
     247          '<strong>Stav dokončení týmu pro verzi '.$this->System->Config['Web']['GameVersion'].'</strong><br />';
    247248
    248249        $BuildNumber = GetBuildNumber($this->System->Config['Web']['GameVersion']);
     
    256257          {
    257258            $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
    258                 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '.
    259                 'WHERE (`User` IN (SELECT `ID` FROM `User` WHERE `Team` = '.$Team['Id'].')) '.
    260                 'AND (`Complete` = 1) AND (`T`.`Language`!='.$this->System->Config['OriginalLanguage'].') '.
    261                 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
    262                 ') AS `C1`) AS `Translated`, '.
    263                 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
    264                 'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '.
    265                 'WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].') '.
    266                 'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
    267                 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION ';
     259              'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '.
     260              'WHERE (`User` IN (SELECT `ID` FROM `User` WHERE `Team` = '.$Team['Id'].')) '.
     261              'AND (`Complete` = 1) AND (`T`.`Language`!='.$this->System->Config['OriginalLanguage'].') '.
     262              'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
     263              ') AS `C1`) AS `Translated`, '.
     264              '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
     265              'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '.
     266              'WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].') '.
     267              'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
     268              ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION ';
    268269          }
    269270          $Query = substr($Query, 0, - 6);
     
    276277          $Output .='<table class="BaseTable">';
    277278          $TableColumns = array(
    278               array('Name' => 'Name', 'Title' => 'Jméno'),
    279               array('Name' => 'Translated', 'Title' => 'Přeložených'),
    280               array('Name' => 'Total', 'Title' => 'Anglických'),
    281               array('Name' => 'Percent', 'Title' => 'Procenta'),
     279            array('Name' => 'Name', 'Title' => 'Jméno'),
     280            array('Name' => 'Translated', 'Title' => 'Přeložených'),
     281            array('Name' => 'Total', 'Title' => 'Anglických'),
     282            array('Name' => 'Percent', 'Title' => 'Procenta'),
    282283          );
    283284
  • trunk/Modules/Translation/Form.php

    r821 r826  
    203203          $Output .= '</td></tr>';
    204204
    205           //todo javascript
     205          // TODO: javascript
    206206
    207207          $Output .= '<script src="'.$this->System->Link('/style/jquery.js').'"></script>'.
     
    238238
    239239              $Output .= '<br/><table class="BaseTable">'.
    240               '<tr><th>Překladač:</th><th>Nepřeložené</th><th>Přeložené</th>';
     240              '<tr><th>Google překladač:</th><th>Nepřeložené</th><th>Přeložené</th>';
    241241              foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    242242                if($TextItem['Visible'] == 1)
     
    245245                      '<td>'.$LineAJ[$TextItem['Column']].'</td>'.
    246246                      '<td>'.GetTranslateGoogle($LineAJ[$TextItem['Column']]).'</td></tr>';
    247 
    248247
    249248              $Output .= '</table>';
  • trunk/Modules/Translation/Progress.php

    r816 r826  
    1919      {
    2020        $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
    21             'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '.
    22             'WHERE (`Complete` = 1) '.$LanguageFilter.' '.
    23             'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
    24             ') AS `C1`) AS `Translated`, '.
    25             '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
    26             'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '.
    27             'WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].') '.
    28             'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
    29             ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION ';
     21          'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '.
     22          'WHERE (`Complete` = 1) '.$LanguageFilter.' '.
     23          'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
     24          ') AS `C1`) AS `Translated`, '.
     25          '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
     26          'SELECT `T`.`Entry` FROM `'.$DbRow['TablePrefix'].'` AS `T` '.
     27          'WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].') '.
     28          'AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.
     29          ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION ';
    3030      }
    3131      $Query = substr($Query, 0, - 6);
     
    3838      $Output .= '<table class="BaseTable">';
    3939      $TableColumns = array(
    40           array('Name' => 'Name', 'Title' => 'Jméno'),
    41           array('Name' => 'Translated', 'Title' => 'Přeložených'),
    42           array('Name' => 'Total', 'Title' => 'Anglických'),
    43           array('Name' => 'Percent', 'Title' => 'Procenta'),
     40        array('Name' => 'Name', 'Title' => 'Jméno'),
     41        array('Name' => 'Translated', 'Title' => 'Přeložených'),
     42        array('Name' => 'Total', 'Title' => 'Anglických'),
     43        array('Name' => 'Percent', 'Title' => 'Procenta'),
    4444      );
    4545
     
    6767  {
    6868    $this->Title = T('Progress');
    69 $LanguageList = GetLanguageList();
     69    $LanguageList = GetLanguageList();
    7070
    71 if(array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version'];
    72 if(!array_key_exists('StatVersion', $_SESSION))
    73 {
    74   if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->PreferredVersionGame != ''))
    75   {
    76     $_SESSION['StatVersion'] = $this->System->User->PreferredVersionGame;
    77   } else
    78     $_SESSION['StatVersion'] = $this->System->Config['Web']['GameVersion'];
    79 }
     71    if(array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version'];
     72    if(!array_key_exists('StatVersion', $_SESSION))
     73    {
     74      if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->PreferredVersionGame != ''))
     75      {
     76        $_SESSION['StatVersion'] = $this->System->User->PreferredVersionGame;
     77      } else {
     78        $_SESSION['StatVersion'] = $this->System->Config['Web']['GameVersion'];
     79      }
     80    }
    8081
    81 if(!isset($_SESSION['language']))
    82 {
    83   if($this->System->User->Licence(LICENCE_USER))
    84   {
    85     $_SESSION['language'] = $this->System->User->Language;
    86   } else $_SESSION['language'] = '';
    87 }
    88 if(array_key_exists('language', $_GET)) {
    89   if($_GET['language'] == '') $_SESSION['language'] = '';
    90     else {
    91       $_SESSION['language'] = $_GET['language'] * 1;
     82    if(!isset($_SESSION['language']))
     83    {
     84      if($this->System->User->Licence(LICENCE_USER))
     85      {
     86        $_SESSION['language'] = $this->System->User->Language;
     87      } else {
     88        $_SESSION['language'] = '';
     89      }
    9290    }
    93 }
    94 if(!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = '';
     91    if(array_key_exists('language', $_GET))
     92    {
     93      if($_GET['language'] == '') {
     94        $_SESSION['language'] = '';
     95      } else {
     96        $_SESSION['language'] = $_GET['language'] * 1;
     97      }
     98    }
     99    if(!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = '';
    95100
    96 // Show client version selection
    97 $Output = 'Verze klienta: ';
    98 $DbResult = $this->Database->query('SELECT `Version`, `Title` FROM `ClientVersion` WHERE `Imported`=1 ORDER BY `Version`');
    99 while($DbRow = $DbResult->fetch_assoc())
    100   $Output .= '<a href="?Version='.$DbRow['Version'].'" title="'.$DbRow['Title'].'">'.$DbRow['Version'].'</a> ';
    101 $Output .= '<br/>';
     101    // Show client version selection
     102    $Output = 'Verze klienta: ';
     103    $DbResult = $this->Database->query('SELECT `Version`, `Title` FROM `ClientVersion` WHERE `Imported`=1 ORDER BY `Version`');
     104    while($DbRow = $DbResult->fetch_assoc())
     105      $Output .= '<a href="?Version='.$DbRow['Version'].'" title="'.$DbRow['Title'].'">'.$DbRow['Version'].'</a> ';
     106    $Output .= '<br/>';
    102107
    103 // Show language selection
    104 $Output .= 'Jazyk: ';
    105 $Lang = '<a href="?language=">Všechny</a>';
    106 if($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';
    107   else $Output .= $Lang;
    108 foreach($LanguageList as $Language)
    109 if($Language['Enabled'] == 1)
    110 {
    111   $Lang = ' <a href="?language='.$Language['Id'].'">'.$Language['Name'].'</a>';
    112   if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';
    113     else $Output .= $Lang;
    114 }
     108    // Show language selection
     109    $Output .= 'Jazyk: ';
     110    $Lang = '<a href="?language=">Všechny</a>';
     111    if($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';
     112      else $Output .= $Lang;
     113    foreach($LanguageList as $Language)
     114    if($Language['Enabled'] == 1)
     115    {
     116      $Lang = ' <a href="?language='.$Language['Id'].'">'.$Language['Name'].'</a>';
     117      if($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';
     118        else $Output .= $Lang;
     119    }
    115120
    116 if(is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];
    117   else $LanguageName = 'Všechny';
    118 $Output .= '<br/><br /><h3>Statistika dokončení překladů jazyka '.$LanguageName.' pro verzi '.$_SESSION['StatVersion'].'</h3><br/>';
    119 $Output .= $this->ShowStatTable();
     121    if(is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];
     122      else $LanguageName = 'Všechny';
     123    $Output .= '<br/><br /><h3>Statistika dokončení překladů jazyka '.$LanguageName.' pro verzi '.$_SESSION['StatVersion'].'</h3><br/>';
     124    $Output .= $this->ShowStatTable();
    120125
    121126    return($Output);
  • trunk/Modules/Translation/Save.php

    r816 r826  
    213213
    214214        // Update flag for experience info load
    215         $this->Database->query('UPDATE `User` SET `NeedUpdate` = 1 WHERE `ID` = '.$this->System->User->Id);
     215        //$this->Database->query('UPDATE `User` SET `NeedUpdate` = 1 WHERE `ID` = '.$this->System->User->Id);
     216        UserLevelUpdate($this->System->User->Id);
    216217      } else $Output .= ShowMessage('Položka nenalezena', MESSAGE_CRITICAL);
    217218    } else
  • trunk/Modules/Translation/Translation.php

    r816 r826  
    77include_once(dirname(__FILE__).'/Progress.php');
    88include_once(dirname(__FILE__).'/LoadNames.php');
     9include_once(dirname(__FILE__).'/UserLevel.php');
    910
    1011class ModuleTranslation extends AppModule
  • trunk/Modules/Translation/UserLevel.php

    r824 r826  
    77$index_level = 100;
    88$from_diakrit = 3; // higher xp for word with diacritics
    9 $FontFile = dirname(__FILE__).'/images/FRIZQT__.ttf';
    109
    1110function CheckDiakrit($Word)
     
    2221}
    2322
    24 function CreateImg($prefix, $user, $xp)
    25 {
    26   global $index_level, $FontFile;
    27 
    28   if($xp > 0)
    29   {
    30     $level = sqrt($xp / $index_level);
    31     $level = substr($level, 0, strpos($level, '.'));
    32   } else $level = 0;
    33   $xp_min = $level * $level * $index_level;
    34   $xp_max = ($level + 1) * ($level + 1) * $index_level;
    35   $xp_max = $xp_max - $xp_min;
    36   $xp = $xp - $xp_min;
    37 
    38   if($xp_max > 0) $Percent = ( $xp / $xp_max) * 100;
    39     else $Percent = 0;
    40   $Percent = substr($Percent, 0, 5);
    41 
    42   $PercentBar = $Percent * 2.5;
    43   $Image = ImageCreateTrueColor(250, 15);
    44   $Color1 = imagecolorallocate($Image, 214, 214, 214);
    45   $Color2 = imagecolorallocate($Image, 239, 131, 166);
    46   $Color3 = imagecolorallocate($Image, 225, 0, 0);
    47   imagefilledrectangle($Image, 0, 0, 250, 15, $Color1);
    48   imagefilledrectangle($Image, 0, 0, $PercentBar, 59, $Color2);
    49   ImageTTFText($Image, 11, 0, 10, 12, $Color3, $FontFile, $level.' Level');
    50   ImageTTFText($Image, 8, 0, 80, 12, $Color3, $FontFile, $xp.'/'.$xp_max.' xp   '.$user);
    51 
    52   if(!file_exists(dirname(__FILE__).'/tmp/'.$prefix.'/')) mkdir(dirname(__FILE__).'/tmp/'.$prefix.'/');
    53   if(!file_exists(dirname(__FILE__).'/tmp/'.$prefix.'/'.$user.'/')) mkdir(dirname(__FILE__).'/tmp/'.$prefix.'/'.$user.'/');
    54   ImagePNG($Image, dirname(__FILE__).'/tmp/'.$prefix.'/'.$user.'/level.png');
    55 }
    56 
    5723function GetXPFromTranslation($UserId)
    5824{
     
    6733      foreach($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)
    6834      {
    69          $GroupBy .= '`'.$TextItem['Column'].'`, ';
     35        $GroupBy .= '`'.$TextItem['Column'].'`, ';
    7036      }
    7137      $GroupBy = substr($GroupBy, 0, -2);
    7238
    73       $IDtran = $System->Database->query('SELECT * FROM `'.$Group['TablePrefix'].'` WHERE (`User` = '.$UserId.') AND (`Complete` = 1) AND (`Take` IS NOT NULL) '.$GroupBy);
     39      $IDtran = $System->Database->query('SELECT * FROM `'.$Group['TablePrefix'].'` WHERE '.
     40        '(`User` = '.$UserId.') AND (`Complete` = 1) AND (`Take` IS NOT NULL) '.$GroupBy);
    7441      while($Line = $IDtran->fetch_array())
    7542      {
     
    8047        foreach($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)
    8148        {
    82           if(($Line[$TextItem['Column']] <> $LineComparison[$TextItem['Column']]) and (strlen($Line[$TextItem['Column']]) > (strlen($LineComparison[$TextItem['Column']]) * 0.5)))
     49          if(($Line[$TextItem['Column']] <> $LineComparison[$TextItem['Column']]) and
     50            (strlen($Line[$TextItem['Column']]) > (strlen($LineComparison[$TextItem['Column']]) * 0.5)))
    8351          {
    8452            $TextArr = explode(' ', $Line[$TextItem['Column']]);
     
    9159          } else
    9260          {
    93             if (($Line[$TextItem['Column']] == $LineComparison[$TextItem['Column']]) and ('0' == $LineComparison['Language']) and ($LineComparison[$TextItem['Column']] <> '') and ($TextItem['Column'] <> 'ShortCut')) $translated = false;
     61            if (($Line[$TextItem['Column']] == $LineComparison[$TextItem['Column']]) and
     62              ('0' == $LineComparison['Language']) and ($LineComparison[$TextItem['Column']] <> '') and
     63              ($TextItem['Column'] <> 'ShortCut')) $translated = false;
    9464          }
    9565        }
     
    10171}
    10272
    103 function ImgLevelUpdate()
     73function UserLevelUpdate($UserId)
    10474{
    10575  global $System, $TranslationTree, $Config;
    10676
    10777  // Main code for users
    108   $DbResult = $System->Database->query('SELECT `ID`, `Name` FROM `User` WHERE `NeedUpdate` = 1');
     78  $DbResult = $System->Database->query('SELECT `ID`, `Name` FROM `User` WHERE `Id` = '.$UserId);
    10979  if($DbResult->num_rows > 0)
    11080  {
     
    12797      $xp = GetXPFromTranslation($LineUser['ID']);
    12898      $System->Database->query('UPDATE `User` SET `XP` = '.$xp.', `TranslatedCount` = '.$TranslatedCount.' WHERE `User`.`ID` = '.$LineUser['ID']);
    129       CreateImg('user', $LineUser['Name'], $xp);
    13099    }
    131 
    132     // Main code for translation teams
    133     $DbResult = $System->Database->query('SELECT `ID`, `Name`, (SELECT AVG(`XP`) FROM `User` WHERE `Team` = `Team`.`Id`) AS `Average` '.
    134       'FROM `Team` WHERE `ID` IN (SELECT `Team` FROM `User` WHERE `NeedUpdate` = 1)');
    135     while($LineTeam = $DbResult->fetch_array())
    136     {
    137       CreateImg('team', $LineTeam['Name'], substr($LineTeam['Average'], 0, strpos($LineTeam['Average'],'.')));  //image creation
    138     }
    139     $System->Database->query('UPDATE `User` SET `NeedUpdate` = 0');
    140100  }
    141101}
    142 
    143 function ImgLevelShow()
    144 {
    145   global $System;
    146 
    147   // Do update for all users
    148   $System->Database->query('UPDATE `User` SET `NeedUpdate` = 1');
    149   ImgLevelUpdate();
    150 
    151   $Output = '<strong>Uživatelé</strong><br/>';
    152   $ID = $System->Database->query('SELECT `ID`, `Name` FROM `User`');
    153   while($LineUser = $ID->fetch_array())
    154   {
    155     $Output .= '<img src="'.$System->Link('/tmp/user/'.$LineUser['Name'].'/level.png').'"/> '.$LineUser['Name'].'<br />';
    156   }
    157 
    158   $Output .= '<br/><strong>Týmy</strong><br/>';
    159   $ID = $System->Database->query('SELECT `ID`, `Name` FROM `Team`');
    160   while($LineTeam = $ID->fetch_array())
    161   {
    162     $Output .= '<img src="'.$System->Link('/tmp/team/'.$LineTeam['Name'].'/level.png').'"/> '.$LineTeam['Name'].'<br />';
    163   }
    164   WriteLog('Přegenerovány obrázky úrovní překladatelů a týmů', LOG_TYPE_ADMINISTRATION);
    165   return($Output);
    166 }
  • trunk/Modules/User/Profile.php

    r825 r826  
    1313      $Subject = $_POST['subject'];
    1414      $Output = 'Email: <strong>'.$Email.'</strong><br />'.
    15           'Předmět: <strong>'.$Subject.'</strong><br />'.
    16           'Text: <strong>'.$Text.'</strong><br />';
    17 
    18       if(@mail($Email, $Subject, $Text, 'From: '.$this->System->Config['Web']['AdminEmail'].'\nReply-To: '.$this->System->Config['Web']['AdminEmail'].'\nX-Mailer: PHP/'))
     15        'Předmět: <strong>'.$Subject.'</strong><br />'.
     16        'Text: <strong>'.$Text.'</strong><br />';
     17
     18      if(@mail($Email, $Subject, $Text, 'From: '.$this->System->Config['Web']['AdminEmail'].
     19        '\nReply-To: '.$this->System->Config['Web']['AdminEmail'].'\nX-Mailer: PHP/'))
    1920      {
    2021        $Output .= ShowMessage(T('Message was sent'));
     
    156157        'Poslední připojení: <strong>'.HumanDateTime($UserLine['LastLogin']).'</strong><br />'.
    157158        'Počet přeložených: <a href="TranslationList.php?user='.$UserLine['ID'].'&amp;state=2&amp;group=0" title="Zobrazit Všechny jeho přeložené texty"><strong>'.$UserLine['TranslatedCount'].'</strong></a><br />'.
    158         'Úroveň: <strong>'.$XP['Level'].'</strong><br/>'.
    159         'Zkušenost: '.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'<br/>';
     159        'Úroveň: <strong>'.$XP['Level'].'</strong> zkušenost: '.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'<br/>';
    160160      if($UserLine['TeamName'] != '')
    161161        $Output .= 'Člen týmu: <a href="team/?action=team&amp;id='.$UserLine['Team'].'"><strong>'.$UserLine['TeamName'].'</strong></a><br />';
     
    175175      }
    176176
    177 
    178177    $Output .= '<br /><fieldset><legend>Text profilu:</legend>'.str_replace("\n", '<br/>', $UserLine['Info']).'</fieldset><br/>';
    179178
    180179    $Output .= '<table class="Home"><tr>'.
    181         '<td>'.$this->ShowLastTranslated().'</td>'.
    182         '<td>'.$this->ExportList().'</td>'.
    183         '</tr></table>';
     180      '<td>'.$this->ShowLastTranslated().'</td>'.
     181      '<td>'.$this->ExportList().'</td>'.
     182      '</tr></table>';
    184183    $Output .= '<br />'.$this->ShowLastForum().'<br />';
    185184    if($this->System->User->Licence(LICENCE_MODERATOR))
     
    224223          'Email: <strong>'.$UserLine['Email'].'</strong><br />';
    225224      $Output .= '<br/><form action="user.php" method="post"><div>'.
    226           'Napsat E-mail:'.
    227           '<input type="text" name="email" value="'.$UserLine['Email'].'" /><br/>'.
    228           'Předmět:'.
    229           '<input type="text" name="subject" value="'.$this->System->Config['Web']['Title'].'" />'.
    230           '<br />'.
    231           '<textarea name="text" rows="20" cols="62">'.
    232           ''."\n".
    233           'S pozdravem '.$this->System->User->Name."\n".
    234           '--------------------------------------------------------'."\n".
    235           $this->System->Config['Web']['Title'].' '.$this->System->Config['Web']['Host'].$this->System->Link('/')."\n".
    236           '</textarea><br/>'.
    237           '<input type="submit" value="Odeslat" />'.
    238           '</div></form></fieldset>';
     225        'Napsat E-mail:'.
     226        '<input type="text" name="email" value="'.$UserLine['Email'].'" /><br/>'.
     227        'Předmět:'.
     228        '<input type="text" name="subject" value="'.$this->System->Config['Web']['Title'].'" />'.
     229        '<br />'.
     230        '<textarea name="text" rows="20" cols="62">'.
     231        ''."\n".
     232        'S pozdravem '.$this->System->User->Name."\n".
     233        '--------------------------------------------------------'."\n".
     234        $this->System->Config['Web']['Title'].' '.$this->System->Config['Web']['Host'].$this->System->Link('/')."\n".
     235        '</textarea><br/>'.
     236        '<input type="submit" value="Odeslat" />'.
     237        '</div></form></fieldset>';
    239238      }
    240239    } else $Output .= ShowMessage('Uživatel nenalezen', MESSAGE_CRITICAL);
  • trunk/Modules/User/UserList.php

    r825 r826  
    11<?php
    2 
    3 include_once(dirname(__FILE__).'/../../img_level.php');
    42
    53class PageUserList extends Page
     
    86  {
    97    $this->Title = T('Translators');
    10     ImgLevelUpdate();
    11 
    128    $Output = '';
    139    if(array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
Note: See TracChangeset for help on using the changeset viewer.