source: trunk/Modules/User/UserList.php@ 577

Last change on this file since 577 was 577, checked in by chronos, 12 years ago
  • Modified: Moved some code from global to system file. System class is now serving as main application class. Now old files which still use ShowPage function need system initialization with $InitSystem = true; before global.php inclusion.
  • Modified: Get rid of some global reference to $System, $Config and $User variables.
  • Modified: Search result functionality moved to application module from action.php file.
File size: 3.0 KB
Line 
1<?php
2
3include_once(dirname(__FILE__).'/../../img_level.php');
4
5class PageUserList extends Page
6{
7 function Show()
8 {
9 ImgLevelUpdate();
10
11 $Output = '';
12 if(array_key_exists('search', $_GET))
13 {
14 $_SESSION['Where'] = ' WHERE `User`.`Name` LIKE "%'.$_GET['search'].'%"';
15 }
16 if(array_key_exists('team', $_GET))
17 {
18 $DbResult = $this->Database->select('Team', 'Name', 'Id='.$_GET['team']);
19 if($DbResult->num_rows > 0)
20 {
21 $Team = $DbResult->fetch_assoc();
22 $Output .= '<h3>Seznam uživatelů v týmu '.$Team['Name'].'</h3>';
23 $_SESSION['Where'] = ' WHERE `Team`='.$_GET['team'];
24 if($_GET['team'] == '') $_SESSION['Where'] = '';
25 } else {
26 $Output .= ShowMessage('Tým '.$_GET['team'].' nenalezen', MESSAGE_CRITICAL);
27 $_SESSION['Where'] = ' WHERE FALSE';
28 }
29 } else
30 {
31 $Output .= '<h3>Seznam uživatelů</h3>';
32 if(!array_key_exists('Where', $_SESSION)) $_SESSION['Where'] = '';
33 }
34
35 if(array_key_exists('action', $_GET))
36 {
37 if($_GET['action'] == 'nofilter') $_SESSION['Where'] = '';
38 }
39 //if($_SESSION['Where'] <> '') $Output .= ' <a href="?action=nofilter">Zrušit filtr uživatelů</a><br />';
40
41 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `User`'.$_SESSION['Where']);
42 $DbRow = $DbResult->fetch_row();
43 $PageList = GetPageList($DbRow[0]);
44
45 $Output .= $PageList['Output'].
46 '<table class="BaseTable">';
47
48 $TableColumns = array(
49 array('Name' => 'Name', 'Title' => 'Jméno'),
50 array('Name' => 'TranslatedCount', 'Title' => 'Překladů'),
51 array('Name' => 'XP', 'Title' => 'Úroveň'),
52 array('Name' => 'XP', 'Title' => 'Zkušenost'),
53 //array('Name' => 'GM', 'Title' => 'Oprávnění'),
54 array('Name' => 'LastLogin', 'Title' => 'Naposledy přítomen'),
55 array('Name' => 'RegistrationTime', 'Title' => 'Čas registrace'),
56 );
57 $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1);
58 $Output .= $Order['Output'];
59
60
61 $Query = 'SELECT `User`.`ID`, `User`.`Name`, `LastLogin`, `GM`, `XP`, `TranslatedCount`, `RegistrationTime` '.
62 'FROM `User` '.
63 'LEFT JOIN `UserTrace` ON `UserTrace`.`User` = `User`.`Id` '.
64 $_SESSION['Where'].$Order['SQL'].$PageList['SQLLimit'];
65
66 $DbResult = $this->Database->query($Query);
67 while($Line = $DbResult->fetch_assoc())
68 {
69 $XP = GetLevelMinMax($Line['XP']);
70 $Output .= '<tr><td><a href="user.php?user='.$Line['ID'].'">'.$Line['Name'].'</a></td>'.
71 '<td style="text-align: center;"><a href="TranslationList.php?user='.$Line['ID'].'&amp;group=0&amp;state=2" title="Zobrazit Všechny jeho přeložené texty">'.$Line['TranslatedCount'].'</a></td>'.
72 '<td>'.$XP['Level'].'</td>'.
73 '<td>'.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'</td>'.
74 //<td>'.$Moderators[$Line['GM']].'</td>
75 '<td>'.HumanDate($Line['LastLogin']).'</td>'.
76 '<td>'.HumanDate($Line['RegistrationTime']).'</td></tr>';
77 }
78 $Output .= '</table>'.
79 $PageList['Output'];
80
81 return($Output);
82 }
83}
Note: See TracBrowser for help on using the repository browser.