Changeset 6
- Timestamp:
- May 8, 2008, 8:48:00 PM (17 years ago)
- Location:
- branches/2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2/frontend.php
r5 r6 37 37 foreach($this->System->Modules['Translation']->GetTextList($TranslationGroupId) as $GroupItem) 38 38 { 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>'; 40 40 } 41 41 $Output .= '</table>'; … … 43 43 } 44 44 45 function T ranslationGroupItemList($GroupId)45 function TextGroupList($GroupId) 46 46 { 47 $ItemPerPage = 30; 48 if(array_key_exists('Page', $_GET)) $Page = $_GET['Page']; else $Page = 0; 47 49 $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) 49 51 { 50 $Output .= '<a href="?Action=TranslationGroupEdit&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&GroupId='.$Translation['Id'].'">'.$Translation['Text'].'</a><br />'; 51 54 } 55 $Output .= $this->System->PagesList('?Action=TextGroupList&GroupId='.$GroupId.'&Page=', $Page, $this->System->Modules['Translation']->GetTextGroupListCount($GroupId, 1, 1), $ItemPerPage); 52 56 return($Output); 53 57 } … … 58 62 foreach($this->System->Modules['Translation']->GetTranslationGroupList() as $Group) 59 63 { 60 $Output .= '<a href="?Action=T ranslationGroupList&GroupId='.$Group['Id'].'">'.$Group['Name'].'</a><br />';64 $Output .= '<a href="?Action=TextGroupList&GroupId='.$Group['Id'].'">'.$Group['Name'].'</a><br />'; 61 65 } 62 66 return($Output); … … 78 82 $Output = $this->TranslationGroupEdit($_GET['GroupId']); 79 83 break; 80 case 'T ranslationGroupList':81 $Output = $this->T ranslationGroupItemList($_GET['GroupId']);84 case 'TextGroupList': 85 $Output = $this->TextGroupList($_GET['GroupId']); 82 86 break; 83 87 case 'MangosImport': -
branches/2/index.php
r5 r6 50 50 return($out); 51 51 } 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"><<</a> '; 63 $Result .= '<a href="'.$URL.($Page - 1).'"><</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).'">></a> '; 83 $Result .= '<a href="'.$URL.($Count - 1).'">>></a>'; 84 } 85 } 86 return($Result); 87 } 52 88 } 53 89 -
branches/2/style.css
r5 r6 43 43 width: 98%; 44 44 height: 100%; 45 top: 0; 45 46 } -
branches/2/translation.php
r5 r6 41 41 } 42 42 43 function GetTextGroupList($GroupId, $UserId, $Language )43 function GetTextGroupList($GroupId, $UserId, $Language, $Page, $ItemPerPage) 44 44 { 45 45 $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); 47 47 //echo($this->Database->LastQuery); 48 48 if($DbResult->num_rows > 0) … … 54 54 } 55 55 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 } 56 64 } 57 65
Note:
See TracChangeset
for help on using the changeset viewer.