Ignore:
Timestamp:
Jan 17, 2016, 8:15:03 PM (8 years ago)
Author:
chronos
Message:
  • Added: List of latest forum posts on front page.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Translation/Translation.php

    r846 r850  
    4949      'Icon' => '',
    5050    ));
    51     /*
    5251    if(array_key_exists('Search', $this->System->ModuleManager->Modules))
    5352    {
     
    6867      }
    6968    }
    70     */
    7169  }
    7270
     
    9694    return($Output);
    9795  }
     96
     97  function ShowBox()
     98  {
     99    $Count = 40;
     100    $Output = '<strong>'.T('Last translated').':</strong>';
     101
     102    $GroupListQuery = 'SELECT `Group`.* FROM `Group`';
     103    $Query = '';
     104    $UnionItems = array();
     105    $DbResult = $this->Database->query($GroupListQuery);
     106    if($DbResult->num_rows > 0)
     107    {
     108      while($DbRow = $DbResult->fetch_assoc())
     109      {
     110        $UnionItems[] = 'SELECT `T`.`ID`, `T`.`Take`, `T`.`User`, `T`.`ModifyTime`, `T`.`Group`, `T`.`GroupName` '.
     111            'FROM (SELECT `T`.`User`, `T`.`ID`, `T`.`ModifyTime`, '.
     112            $DbRow['Id'].' AS `Group`, "'.addslashes($DbRow['Name']).'" AS `GroupName`, `T`.`Take` FROM `'.
     113            $DbRow['TablePrefix'].'` AS `T`'.
     114            ' WHERE (`T`.`Complete` = 1) AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage'].') ORDER BY `T`.`ModifyTime` DESC LIMIT '.
     115            $Count.') AS `T`';
     116      }
     117      $Query = 'SELECT `TT`.*, `User`.`Name` AS `UserName`, `User`.`Id` AS `UserId` '.
     118          ' FROM ('.implode(' UNION ', $UnionItems).') AS `TT`'.
     119          ' JOIN `User` ON `User`.`Id` = `TT`.`User`'.
     120          ' ORDER BY `ModifyTime` DESC LIMIT '.$Count;
     121      $DbResult = $this->Database->query($Query);
     122      $Output .= '<table class="MiniTable"><tr><th>'.T('Date').'</th><th>'.T('Who').'</th><th>'.T('New').'</th><th>'.T('Source').'</th><th>'.T('Group').'</th></tr>';
     123      while($DbRow = $DbResult->fetch_assoc())
     124      {
     125        $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'.
     126            '<td><a href="'.$this->System->Link('/user/?user='.$DbRow['UserId']).'">'.$DbRow['UserName'].'</a></td>'.
     127            '<td><a href="'.$this->System->Link('/form.php?group='.$DbRow['Group'].'&amp;ID='.$DbRow['ID']).'">'.$DbRow['ID'].'</a></td>'.
     128            '<td><a href="'.$this->System->Link('/form.php?group='.$DbRow['Group'].'&amp;ID='.$DbRow['Take']).'">'.$DbRow['Take'].'</a></td>'.
     129            '<td><a href="'.$this->System->Link('/TranslationList.php?group='.$DbRow['Group'].'&amp;action=filter').'">'.T($DbRow['GroupName']).'</a></td></tr>';
     130      }
     131      $Output .= '</table>';
     132    }
     133    return($Output);
     134  }
    98135}
Note: See TracChangeset for help on using the changeset viewer.