Changeset 425 for branches/CombinedTextTables/save.php
- Timestamp:
- Apr 8, 2010, 7:58:16 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CombinedTextTables/save.php
r420 r425 10 10 $GroupId = LoadGroupIdParameter(); 11 11 $Group = $TranslationTree[$GroupId]; 12 $Table = $Group['TablePrefix'];13 12 if($User->Licence(LICENCE_USER)) 14 13 { … … 22 21 23 22 // Get source text record from database by ID 24 $DbResult = $System->Database->query('SELECT * FROM ` '.$Table.'` WHERE `ID`='.$TextID);23 $DbResult = $System->Database->query('SELECT * FROM `Translation` WHERE (`Id`='.$TextID.') AND (`Group` = '.$Group['Id'].')'); 25 24 if($DbResult->num_rows > 0) 26 25 { … … 28 27 29 28 // Get data for english original 30 $DbResult = $System->Database->query('SELECT * FROM ` '.$Table.'` WHERE (`Entry`='.$SourceText['Entry'].') AND (`Language` = 0) AND (`VersionStart` = '.$SourceText['VersionStart'].') AND (`VersionEnd` = '.$SourceText['VersionEnd'].')');31 if($DbResult->num_rows > 0) 29 $DbResult = $System->Database->query('SELECT * FROM `Translation` WHERE (`Entry`='.$SourceText['Entry'].') AND (`Language` = 0) AND (`VersionStart` = '.$SourceText['VersionStart'].') AND (`VersionEnd` = '.$SourceText['VersionEnd'].') AND (`Group` = '.$Group['Id'].')'); 30 if($DbResult->num_rows > 0) 32 31 { 33 32 $EnglishText = $DbResult->fetch_assoc(); … … 39 38 $Filter .= ' AND (`'.$GroupItem['Column'].'` = "'.$EnglishText[$GroupItem['Column']].'")'; 40 39 41 $DbResult = $System->Database->query('SELECT * FROM ` '.$Table.'` WHERE (`Language` = 0)'.$Filter);40 $DbResult = $System->Database->query('SELECT * FROM `Translation` WHERE (`Language` = 0) AND (`Group` = '.$Group['Id'].')'.$Filter); 42 41 while($DbRow = $DbResult->fetch_assoc()) 43 42 { 44 43 // Get user translation paired to found english item entry 45 $DbResult2 = $System->Database->query('SELECT * FROM ` '.$Table.'` WHERE (`User` = '.$User->Id.') AND (`Entry` = '.$DbRow['Entry'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') AND (`VersionEnd` = '.$SourceText['VersionEnd'].')');44 $DbResult2 = $System->Database->query('SELECT * FROM `Translation` WHERE (`User` = '.$User->Id.') AND (`Entry` = '.$DbRow['Entry'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') AND (`VersionEnd` = '.$SourceText['VersionEnd'].') AND (`Group` = '.$Group['Id'].')'); 46 45 if($DbResult2->num_rows > 0) 47 46 { … … 56 55 57 56 // Update user translation 58 $System->Database->query('UPDATE ` '.$Table.'` SET '.$Values.' WHERE `ID` = '.$ExistedText['ID']);57 $System->Database->query('UPDATE `Translation` SET '.$Values.' WHERE `ID` = '.$ExistedText['ID']); 59 58 60 59 echo('Změny v překladu <a href="form.php?group='.$GroupId.'&ID='.$ExistedText['ID'].'">'.$ExistedText['ID'].'</a> ('.$ExistedText['Entry'].') uloženy!<br />'); … … 63 62 { 64 63 // Insert new user translation 65 $Columns = '` Entry`, `VersionStart`, `VersionEnd`, `Language`, `Complete`, `User`, `Take`';66 $Values = $DbRow[' Entry'].', '.$DbRow['VersionStart'].', '.$DbRow['VersionEnd'].', '.$Language.', '.$Complete.', '.$User->Id.', '.$SourceText['ID'];64 $Columns = '`Group`, `Entry`, `VersionStart`, `VersionEnd`, `Language`, `Complete`, `User`, `Take`'; 65 $Values = $DbRow['Group'].', '.$DbRow['Entry'].', '.$DbRow['VersionStart'].', '.$DbRow['VersionEnd'].', '.$Language.', '.$Complete.', '.$User->Id.', '.$SourceText['ID']; 67 66 foreach($Group['Items'] as $GroupItem) 68 67 { … … 82 81 } 83 82 } 84 $System->Database->query('INSERT INTO ` '.$Table.'` ('.$Columns.') VALUES ('.$Values.')');83 $System->Database->query('INSERT INTO `Translation` ('.$Columns.') VALUES ('.$Values.')'); 85 84 $LastID = $System->Database->insert_id; 86 85
Note:
See TracChangeset
for help on using the changeset viewer.