Changeset 880 for trunk/Modules/Translation/UserLevel.php
- Timestamp:
- Apr 7, 2020, 10:15:48 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/UserLevel.php
r859 r880 11 11 $Diakrit = array("á","č","ď","é","ě","í","ľ","ň","ó","ř","š","ť","ú", 12 12 "ů","ý","ž","Á","Č","Ď","É","Ě","Í","Ľ","Ň","Ó","Ř","Š","Ť","Ú","Ů","Ý","Ž"); 13 for ($i = 0; $i < count($Diakrit); $i = $i + 1)13 for ($i = 0; $i < count($Diakrit); $i = $i + 1) 14 14 { 15 if (strpos($Word, $Diakrit[$i]) <> false)15 if (strpos($Word, $Diakrit[$i]) <> false) 16 16 $Result = true; 17 17 } 18 return ($Result);18 return $Result; 19 19 } 20 20 … … 26 26 27 27 $xp = 0; 28 foreach ($TranslationTree as $Group)28 foreach ($TranslationTree as $Group) 29 29 { 30 if ($Group['TablePrefix'] != '')30 if ($Group['TablePrefix'] != '') 31 31 { 32 32 $GroupBy = 'GROUP BY '; 33 33 $TakeColumns = ''; 34 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)34 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem) 35 35 { 36 36 $GroupBy .= '`T`.`'.$TextItem['Column'].'`, '; … … 42 42 'LEFT JOIN `'.$Group['TablePrefix'].'` AS `T2` ON `T2`.`ID` = `T`.`Take` '. 43 43 'WHERE (`T`.`User` = '.$UserId.') AND (`T`.`Complete` = 1) AND (`T`.`Take` IS NOT NULL) '.$GroupBy); 44 while ($Line = $IDtran->fetch_array())44 while ($Line = $IDtran->fetch_array()) 45 45 { 46 46 $xp_translation = 0; 47 47 $translated = true; 48 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)48 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem) 49 49 { 50 if (($Line[$TextItem['Column']] <> $Line[$TextItem['Column'].'_Take']) and50 if (($Line[$TextItem['Column']] <> $Line[$TextItem['Column'].'_Take']) and 51 51 (strlen($Line[$TextItem['Column']]) > (strlen($Line[$TextItem['Column'].'_Take']) * 0.5))) 52 52 { 53 53 $TextArr = explode(' ', $Line[$TextItem['Column']]); 54 foreach ($TextArr as $Word)54 foreach ($TextArr as $Word) 55 55 { 56 if (CheckDiakrit($Word)) $indikator = $from_diakrit;56 if (CheckDiakrit($Word)) $indikator = $from_diakrit; 57 57 else $indikator = 1; 58 58 $xp_translation = $xp_translation + ($indikator * $xp_from_word); … … 65 65 } 66 66 } 67 if ($translated) $xp = $xp + $xp_translation; // XP addition for entire translation if complete translated67 if ($translated) $xp = $xp + $xp_translation; // XP addition for entire translation if complete translated 68 68 } 69 69 } 70 70 } 71 return ($xp);71 return $xp; 72 72 } 73 73 … … 79 79 // Main code for users 80 80 $DbResult = $System->Database->query('SELECT `ID`, `Name` FROM `User` WHERE `Id` = '.$UserId); 81 if ($DbResult->num_rows > 0)81 if ($DbResult->num_rows > 0) 82 82 { 83 while ($LineUser = $DbResult->fetch_array())83 while ($LineUser = $DbResult->fetch_array()) 84 84 { 85 85 // Build TranslatedCount query 86 86 $TranslatedCount = '('; 87 if (count($TranslationTree) > 0)87 if (count($TranslationTree) > 0) 88 88 { 89 foreach ($TranslationTree as $Group)90 if ($Group['TablePrefix'] != '')89 foreach ($TranslationTree as $Group) 90 if ($Group['TablePrefix'] != '') 91 91 { 92 92 $Count = '(SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE (`Complete` = 1) AND (`Language` <> '.
Note:
See TracChangeset
for help on using the changeset viewer.