Ignore:
Timestamp:
Jan 24, 2009, 5:55:02 PM (16 years ago)
Author:
george
Message:
  • Upraveno: Změna kódování znaků souborů na UTF-8.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2/translation.php

    r9 r40  
    4444  {
    4545    $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);
    4748    //echo($this->Database->LastQuery);
    4849    if($DbResult->num_rows > 0)
     
    5051    {
    5152      $Result[] = $DbRow;
     53      echo('.');
    5254    }
    5355    return($Result);
     
    5759  {
    5860    $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);
    6063    //echo($this->Database->LastQuery);
    6164    $DbRow = $DbResult->fetch_array();
     
    7578    return($Result);
    7679  }
     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  }
    7790}
    7891
Note: See TracChangeset for help on using the changeset viewer.