<?php class PageLoadNames extends Page { function ReplaceTranslated($orig, $tran, $Text, $ID, $Group) { $tran_replace = str_replace(' ',' ',htmlspecialchars($tran)); $orig_replace = str_replace(' ',' ',htmlspecialchars($orig)); // if (strlen($orig) < strlen($Text)-1) { if ($Group <> '') { $Text = str_replace(' '.$orig,' <span Title="PĹ™eloĹľ jako: '.$tran_replace. '" class="edit"><a class="edit" target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); } else { $Text = str_replace(' '.$orig,' <span Title="PĹ™eloĹľ jako: '.$tran_replace. '" class="edit"><a class="edit" target="_NEW2" href="'.$this->System->Link('/'.T('dictionary', 'URL').'/?search='.$tran).'">'.$orig_replace.'</a></span>',$Text); } // } return $Text; } function ReplaceNotTranslated($orig, $tran, $Text, $ID, $Group) { $orig_replace = str_replace(' ',' ',htmlspecialchars($orig)); $Text = str_replace(' '.$orig,' <span title="KliknutĂm pĹ™eložÚ" class="needtran"><a class="needtran" target="_NEW2" href="'. $this->System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); return $Text; } function ColorNames($Text, $names) { $Text = ' '.$Text; $Text = str_replace('$B$B','$B$B ',$Text); $Text = str_replace('$B','<span Title="Znamená odřádkovánĂ, pĹ™ekladu zachovej na stejnĂ© pozici." class="edit">$B</span>',$Text); $Text = str_replace('$N','<span Title="Znamená jmĂ©no hráče, pĹ™ekladu zachovej na stejnĂ© pozici." class="edit">$N</span>',$Text); $Text = str_replace('$R','<span Title="Znamená rasu hráče, pĹ™ekladu zachovej na stejnĂ© pozici." class="edit">$R</span>',$Text); $Text = str_replace('$C','<span Title="Znamená povolánĂ hráče, pĹ™ekladu zachovej na stejnĂ© pozici." class="edit">$C</span>',$Text); $Text = str_replace('$G','<span Title="Vybere oslovenĂ podle pohlavĂ hráče, pĹ™ekladu zachovej na stejnĂ© pozici." class="edit">$G</span>',$Text); $Text = str_replace('$b','<span Title="Znamená odřádkovánĂ, pĹ™ekladu zachovej na stejnĂ© pozici." class="edit">$B</span>',$Text); $Text = str_replace('$n','<span Title="Znamená jmĂ©no hráče, pĹ™ekladu zachovej na stejnĂ© pozici." class="edit">$N</span>',$Text); $Text = str_replace('$c','<span Title="Znamená povolánĂ hráče, pĹ™ekladu zachovej na stejnĂ© pozici." class="edit">$c</span>',$Text); $Text = str_replace('$r','<span Title="Znamená rasu hráče, pĹ™ekladu zachovej na stejnĂ© pozici." class="edit">$R</span>',$Text); $Text = str_replace('$g','<span Title="Vybere oslovenĂ podle pohlavĂ hráče, pĹ™ekladu zachovej na stejnĂ© pozici." class="edit">$G</span>',$Text); foreach ($names as $Line) { if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId'])) { if ($Line[3] <> '') { $Text = $this->ReplaceTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]); } else { $Text = $this->ReplaceNotTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]); } } } return $Text; } function LoadNames() { $User = ModuleUser::Cast($this->System->GetModule('User'))->User; $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); $Output = ''; if (array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId']; else return ShowMessage(T('GroupId not specified'), MESSAGE_CRITICAL); if (!array_key_exists('ID', $_GET)) return ShowMessage(T('ID not specified'), MESSAGE_CRITICAL); if (!array_key_exists('Column', $_GET)) return ShowMessage(T('Column not specified'), MESSAGE_CRITICAL); $Table = $TranslationTree[$GroupId]['TablePrefix']; $DbResult = $this->System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$_GET['ID'].' LIMIT 1'); $LineAJ = $DbResult->fetch_assoc(); $Column = $_GET['Column']; //$Text = $LineAJ[$TranslationTree[$GroupId]['Items'][$_GET['Item']]]; $Text = $LineAJ[$Column]; $names = array(); if ($User->Licence(LICENCE_USER)) if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) { //<span class="edit">barvou.</span> $names = GetTranslatNames($Text, 0, GetTranslatNamesArray()); } else { if (($GroupId == 13)) { $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text', 'TextGlobalString' => 'Text', 'TextArea' => 'Name', 'TextItemSubClass' => 'Name', 'TextCharacterRace' => 'Name1',), false); } else { $names = GetTranslatNames($Text, 0, GetTranslatNamesArray()); } } //$LineAJ[$Column] return $this->ColorNames(htmlspecialchars($Text), $names); } function Show(): string { $this->RawPage = true; return str_replace("\n", '<br/>', $this->LoadNames()); } }