Changeset 40 for branches/2/translation.php
- Timestamp:
- Jan 24, 2009, 5:55:02 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2/translation.php
r9 r40 44 44 { 45 45 $Result = array(); 46 $DbResult = $this->Database->query('SELECT `TextGroup`.*, (SELECT `Text` FROM `Text` WHERE `Text`.`TranslationGroup` = `TextGroup`.`Id` LIMIT 1) as `Text`, (SELECT COUNT(`TextGroup2`.`User`) FROM `TextGroup` AS `TextGroup2` WHERE `TextGroup2`.`Index` = `TextGroup`.`Index` AND `TextGroup2`.`Group` = `TextGroup`.`Group`) as `TextCount` FROM `TextGroup` WHERE `TextGroup`.`Group`='.$GroupId.' AND `TextGroup`.`User`='.$UserId.' AND `TextGroup`.`Language`='.$Language.' LIMIT '.($Page * $ItemPerPage).','.$ItemPerPage); 46 if($GroupId != 0) $GroupCondition = '`TextGroup`.`Group`='.$GroupId.' AND '; else $GroupCondition = ''; 47 $DbResult = $this->Database->query('SELECT `TextGroup`.*, (SELECT `Text` FROM `Text` WHERE `Text`.`TranslationGroup` = `TextGroup`.`Id` LIMIT 1) as `Text`, (SELECT COUNT(`TextGroup2`.`User`) FROM `TextGroup` AS `TextGroup2` WHERE `TextGroup2`.`Index` = `TextGroup`.`Index` AND `TextGroup2`.`Group` = `TextGroup`.`Group`) as `TextCount` FROM `TextGroup` WHERE '.$GroupCondition.'`TextGroup`.`User`='.$UserId.' AND `TextGroup`.`Language`='.$Language.' LIMIT '.($Page * $ItemPerPage).','.$ItemPerPage); 47 48 //echo($this->Database->LastQuery); 48 49 if($DbResult->num_rows > 0) … … 50 51 { 51 52 $Result[] = $DbRow; 53 echo('.'); 52 54 } 53 55 return($Result); … … 57 59 { 58 60 $Result = array(); 59 $DbResult = $this->Database->select('TextGroup', 'COUNT(*)', '`Group`='.$GroupId.' AND `User`='.$UserId.' AND `Language`='.$Language); 61 if($GroupId != 0) $GroupCondition = '`Group`='.$GroupId.' AND '; else $GroupCondition = ''; 62 $DbResult = $this->Database->select('TextGroup', 'COUNT(*)', $GroupCondition.'`User`='.$UserId.' AND `Language`='.$Language); 60 63 //echo($this->Database->LastQuery); 61 64 $DbRow = $DbResult->fetch_array(); … … 75 78 return($Result); 76 79 } 80 81 function AddTranslation($Group, $Index, $TextList) 82 { 83 $this->Database->insert('TextGroup', array('Group' => $Group, 'Index' => $Index, 'Language' => $this->System->Modules['User']->User['Language'], 'User' => $this->System->Modules['User']->User['Id'], 'Time' => 'NOW()', 'Revision' => 1, 'OriginalText' => 0)); 84 $GroupId = $this->Database->insert_id; 85 foreach($TextList as $Index => $Text) 86 { 87 $this->Database->insert('Text', array('TranslationGroup' => $GroupId, 'Text' => $Text, 'GroupItem' => $Index)); 88 } 89 } 77 90 } 78 91
Note:
See TracChangeset
for help on using the changeset viewer.