Changeset 6 for branches


Ignore:
Timestamp:
May 8, 2008, 8:48:00 PM (17 years ago)
Author:
george
Message:

Přidáno: Zobrazení prvních textů v seznamu položek ve skupinách.

Location:
branches/2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2/frontend.php

    r5 r6  
    3737    foreach($this->System->Modules['Translation']->GetTextList($TranslationGroupId) as $GroupItem)
    3838    {
    39       $Output .= '<tr><th>'.$GroupItem['Name'].'</th><td>'.$GroupItem['Text'].'</td><td><textarea name="GroupItem'.$GroupItem['Id'].'">'.$GroupItem['Text'].'</textarea></td></tr>';
     39      $Output .= '<tr><th>'.$GroupItem['Name'].'</th><td>'.$GroupItem['Text'].'</td><td><div><textarea name="GroupItem'.$GroupItem['Id'].'">'.$GroupItem['Text'].'</textarea></div></td></tr>';
    4040    }
    4141    $Output .= '</table>';
     
    4343  }
    4444
    45   function TranslationGroupItemList($GroupId)
     45  function TextGroupList($GroupId)
    4646  {
     47    $ItemPerPage = 30;
     48    if(array_key_exists('Page', $_GET)) $Page = $_GET['Page']; else $Page = 0;
    4749    $Output = '<strong>Seznam textů:</strong><br/>';
    48     foreach($this->System->Modules['Translation']->GetTextGroupList($GroupId, 1, 1) as $Translation)
     50    foreach($this->System->Modules['Translation']->GetTextGroupList($GroupId, 1, 1, $Page, $ItemPerPage) as $Translation)
    4951    {
    50       $Output .= '<a href="?Action=TranslationGroupEdit&amp;GroupId='.$Translation['Id'].'">'.$Translation['Index'].'</a><br />';
     52      if(strlen($Translation['Text']) > 30) $Translation['Text'] = substr($Translation['Text'], 0, 30).'...';
     53      $Output .= $Translation['Index'].'. <a href="?Action=TranslationGroupEdit&amp;GroupId='.$Translation['Id'].'">'.$Translation['Text'].'</a><br />';
    5154    }
     55    $Output .= $this->System->PagesList('?Action=TextGroupList&amp;GroupId='.$GroupId.'&amp;Page=', $Page, $this->System->Modules['Translation']->GetTextGroupListCount($GroupId, 1, 1), $ItemPerPage);
    5256    return($Output);
    5357  }
     
    5862    foreach($this->System->Modules['Translation']->GetTranslationGroupList() as $Group)
    5963    {
    60       $Output .= '<a href="?Action=TranslationGroupList&amp;GroupId='.$Group['Id'].'">'.$Group['Name'].'</a><br />';
     64      $Output .= '<a href="?Action=TextGroupList&amp;GroupId='.$Group['Id'].'">'.$Group['Name'].'</a><br />';
    6165    }
    6266    return($Output);
     
    7882        $Output = $this->TranslationGroupEdit($_GET['GroupId']);
    7983        break;
    80       case 'TranslationGroupList':
    81         $Output = $this->TranslationGroupItemList($_GET['GroupId']);
     84      case 'TextGroupList':
     85        $Output = $this->TextGroupList($_GET['GroupId']);
    8286        break;
    8387      case 'MangosImport':
  • branches/2/index.php

    r5 r6  
    5050    return($out);
    5151  }
     52
     53  function PagesList($URL, $Page, $TotalCount, $CountPerPage)
     54  {
     55    $Count = ceil($TotalCount / $CountPerPage);
     56    $Around = 10;
     57    $Result = '';
     58    if($Count > 1)
     59    {
     60      if($Page > 0)
     61      {
     62        $Result .= '<a href="'.$URL.'0">&lt;&lt;</a> ';
     63        $Result .= '<a href="'.$URL.($Page - 1).'">&lt;</a> ';
     64      }
     65      $PagesMax = $Count - 1;
     66      $PagesMin = 0;
     67      if($PagesMax > ($Page + $Around)) $PagesMax = $Page + $Around;
     68      if($PagesMin < ($Page - $Around))
     69      {
     70        $Result .= ' .. ';
     71        $PagesMin = $Page - $Around;
     72      }
     73      for($i = $PagesMin; $i <= $PagesMax; $i++)
     74      {
     75        if($i == $Page) $Result .= '<strong>';
     76        $Result .= '<a href="'.$URL.$i.'">'.($i + 1).'</a> ';
     77        if($i == $Page) $Result .= '</strong>';
     78      }
     79      if($PagesMax < ($Count - 1)) $Result .= ' .. ';
     80      if($Page < ($Count - 1))
     81      {
     82        $Result .= '<a href="'.$URL.($Page + 1).'">&gt;</a> ';
     83        $Result .= '<a href="'.$URL.($Count - 1).'">&gt;&gt;</a>';
     84      }
     85    }
     86    return($Result);
     87  }
    5288}
    5389
  • branches/2/style.css

    r5 r6  
    4343  width: 98%;
    4444  height: 100%;
     45  top: 0;
    4546}
  • branches/2/translation.php

    r5 r6  
    4141  }
    4242
    43   function GetTextGroupList($GroupId, $UserId, $Language)
     43  function GetTextGroupList($GroupId, $UserId, $Language, $Page, $ItemPerPage)
    4444  {
    4545    $Result = array();
    46     $DbResult = $this->Database->select('TextGroup', '*', '`Group`='.$GroupId.' AND `User`='.$UserId.' AND `Language`='.$Language);
     46    $DbResult = $this->Database->query('SELECT `TextGroup`.*, (SELECT `Text` FROM `Text` WHERE `Text`.`TranslationGroup` = `TextGroup`.`Id` LIMIT 1) as `Text` FROM `TextGroup`  WHERE `TextGroup`.`Group`='.$GroupId.' AND `TextGroup`.`User`='.$UserId.' AND `TextGroup`.`Language`='.$Language.' LIMIT '.($Page * $ItemPerPage).','.$ItemPerPage);
    4747    //echo($this->Database->LastQuery);
    4848    if($DbResult->num_rows > 0)
     
    5454  }
    5555
     56  function GetTextGroupListCount($GroupId, $UserId, $Language)
     57  {
     58    $Result = array();
     59    $DbResult = $this->Database->select('TextGroup', 'COUNT(*)', '`Group`='.$GroupId.' AND `User`='.$UserId.' AND `Language`='.$Language);
     60    //echo($this->Database->LastQuery);
     61    $DbRow = $DbResult->fetch_array();
     62    return($DbRow[0]);
     63  }
    5664}
    5765
Note: See TracChangeset for help on using the changeset viewer.