Changeset 806 for trunk/Modules/Translation/LoadNames.php
- Timestamp:
- May 25, 2014, 12:14:02 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/LoadNames.php
r764 r806 1 1 <?php 2 include_once(dirname(__FILE__).'/../../includes/global.php');3 4 $System = new System();5 $System->DoNotShowPage = true;6 $System->Run();7 8 9 2 10 function ReplaceTranslated($orig,$tran,$Text,$ID,$Group) { 11 global $System; 12 $tran_replace = str_replace(' ',' ',htmlspecialchars($tran)); 13 $orig_replace = str_replace(' ',' ',htmlspecialchars($orig)); 3 class PageLoadNames extends Page 4 { 5 function ReplaceTranslated($orig,$tran,$Text,$ID,$Group) 6 { 7 $tran_replace = str_replace(' ',' ',htmlspecialchars($tran)); 8 $orig_replace = str_replace(' ',' ',htmlspecialchars($orig)); 14 9 15 // if (strlen($orig) < strlen($Text)-1) { 16 if ($Group <> '') { 17 $Text = str_replace(' '.$orig,' <span Title="Přelož jako: '.$tran_replace.'" class="edit"><a class="edit" target="_NEW2" href="'.$System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); 18 } else { 19 $Text = str_replace(' '.$orig,' <span Title="Přelož jako: '.$tran_replace.'" class="edit"><a class="edit" target="_NEW2" href="'.$System->Link('/dictionary/?search='.$tran).'">'.$orig_replace.'</a></span>',$Text); 20 } 21 // } 22 return ($Text); 10 // if (strlen($orig) < strlen($Text)-1) { 11 if ($Group <> '') 12 { 13 $Text = str_replace(' '.$orig,' <span Title="Přelož jako: '.$tran_replace. 14 '" class="edit"><a class="edit" target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); 15 } else { 16 $Text = str_replace(' '.$orig,' <span Title="Přelož jako: '.$tran_replace. 17 '" class="edit"><a class="edit" target="_NEW2" href="'.$this->System->Link('/dictionary/?search='.$tran).'">'.$orig_replace.'</a></span>',$Text); 18 } 19 // } 20 return ($Text); 23 21 } 24 function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group) { 25 global $System; 26 $orig_replace = str_replace(' ',' ',htmlspecialchars($orig)); 27 28 $Text = str_replace(' '.$orig,' <span title="Kliknutím přeložíš" class="needtran"><a class="needtran" target="_NEW2" href="'.$System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); 29 return ($Text); 22 function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group) 23 { 24 $orig_replace = str_replace(' ',' ',htmlspecialchars($orig)); 25 26 $Text = str_replace(' '.$orig,' <span title="Kliknutím přeložíš" class="needtran"><a class="needtran" target="_NEW2" href="'. 27 $this->System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); 28 return ($Text); 30 29 } 31 30 … … 48 47 if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId'])) 49 48 if ($Line[3] <> '') { 50 $Text = ReplaceTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]);49 $Text = $this->ReplaceTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]); 51 50 52 51 } else { 53 $Text = ReplaceNotTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]);52 $Text = $this->ReplaceNotTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]); 54 53 } 55 54 } … … 57 56 } 58 57 59 60 $Text = ''; 61 function LoadNames() { 62 global $System,$TranslationTree; 63 $Output = ''; 64 if (array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId']; 65 $Table = $TranslationTree[$GroupId]['TablePrefix']; 66 $DbResult = $System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$_GET['ID'].' LIMIT 1'); 67 $LineAJ = $DbResult->fetch_assoc(); 68 $Column = $_GET['Column']; 69 //$Text = $LineAJ[$TranslationTree[$GroupId]['Items'][$_GET['Item']]]; 58 function LoadNames() 59 { 60 global $TranslationTree; 61 62 $Output = ''; 63 if(array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId']; 64 else return(ShowMessage(T('GroupId not specified'), MESSAGE_CRITICAL)); 65 if(!array_key_exists('ID', $_GET)) return(ShowMessage(T('ID not specified'), MESSAGE_CRITICAL)); 66 if(!array_key_exists('Column', $_GET)) return(ShowMessage(T('Column not specified'), MESSAGE_CRITICAL)); 67 $Table = $TranslationTree[$GroupId]['TablePrefix']; 68 $DbResult = $this->System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$_GET['ID'].' LIMIT 1'); 69 $LineAJ = $DbResult->fetch_assoc(); 70 $Column = $_GET['Column']; 71 //$Text = $LineAJ[$TranslationTree[$GroupId]['Items'][$_GET['Item']]]; 70 72 $Text = $LineAJ[$Column]; 71 73 $names = array(); 72 if ($ System->User->Licence(LICENCE_USER))74 if ($this->System->User->Licence(LICENCE_USER)) 73 75 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 74 76 { … … 83 85 } 84 86 //$LineAJ[$Column] 85 return ( ColorNames(htmlspecialchars($Text),$names));87 return ($this->ColorNames(htmlspecialchars($Text),$names)); 86 88 } 87 echo str_replace("\n", '<br/>',LoadNames()); 89 90 function Show() 91 { 92 $this->RawPage = true; 93 return(str_replace("\n", '<br/>', $this->LoadNames())); 94 } 95 }
Note:
See TracChangeset
for help on using the changeset viewer.