Changeset 155


Ignore:
Timestamp:
Mar 12, 2009, 1:27:34 PM (16 years ago)
Author:
maron
Message:

Globální hledání

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/action.php

    r154 r155  
    88$Table = $TranslationTree[$GroupId]['TablePrefix'];
    99if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = '';
     10
     11if(($Action == 'search'))
     12{
     13  if(array_key_exists('search', $_GET)) $Search = $_GET['search'];
     14  else $Search = $_POST['search'];
     15
     16  echo('<table class="BaseTable"><tr><th>Skupina</th><th>Výsledků</th></tr>');
     17  foreach($TranslationTree as $Group) {
     18        $Table = $Group['TablePrefix'];
     19 
     20        $sql = 'SELECT count(*) FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%"
     21        OR `entry` LIKE "%'.$Search.'%"
     22        OR `User` LIKE "%'.$Search.'%"
     23        OR `Complete` LIKE "%'.$Search.'%"';
     24        foreach($Group['Items'] as $Item) {
     25                if($Item['Column'] != '') $sql .= ' OR `'.$Item['Column'].'` LIKE "%'.$Search.'%"';
     26        }
     27        $Line = mysql_fetch_row($Database->SQLCommand($sql));
     28        echo('<tr><td><a href="TranslationList?group='.$Group['Id'].'&amp;action=search&amp;search='.$Search.'">'.$Group['Name'].'</a></td><td>'.$Line[0].'</td></tr>');
     29  }
     30 
     31        $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `user` WHERE `user` LIKE "%'.$Search.'%"'));
     32        echo('<tr><td><a href="userlist?search='.$Search.'">Uživatelé</a></td><td>'.$Line[0].'</td></tr>');
     33        $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `team` WHERE `name` LIKE "%'.$Search.'%" OR `description` LIKE "%'.$Search.'%"'));
     34        echo('<tr><td><a href="team?search='.$Search.'">Týmy</a></td><td>'.$Line[0].'</td></tr>');
     35        $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `verseclient` WHERE `text` LIKE "%'.$Search.'%"'));
     36        echo('<tr><td><a href="download.php?addon">Čeština pro klienta</a></td><td>'.$Line[0].'</td></tr>');
     37 
     38  echo('</table>');
     39}
    1040
    1141
  • trunk/includes/global.php

    r152 r155  
    6666  </form>');
    6767  }
     68}
     69
     70function ShowSearchBox()
     71{
     72    echo('<strong>Hledání:</strong>
     73  <form action="action.php" method="get"><input type="hidden" name="action" value="search" />
     74  <table>
     75    <tr>
     76      <td><input type="text" name="search" size="13" /></td>
     77    </tr>
     78    <tr>
     79      <th><input type="submit" value="Hledat" /></th>
     80    </tr>
     81  </table>
     82  </form>');
    6883}
    6984
     
    220235  ShowMainMenu();
    221236     
    222   echo('<br />');   
     237 // echo('<br />');   
    223238  ShowLoginBox();
    224239  echo('<br />');
    225240  ShowOnlineUserList();
     241  echo('<br />');
     242  ShowSearchBox();
    226243  echo('</td><td id="border-left"></td><td class="content">');
    227244}
  • trunk/team.php

    r142 r155  
    7575echo('<table class="BaseTable">');
    7676
     77if(array_key_exists('search', $_GET))  $_SESSION['Where'] = ' WHERE `name` LIKE "%'.$_GET['search'].'%" OR `description` LIKE "%'.$_GET['search'].'%"';
     78if(array_key_exists('Where', $_GET)) {
     79         $_SESSION['Where'] = ' WHERE '.$_GET['Where'];
     80     if($_GET['Where'] == '') $_SESSION['Where'] = '';     
     81 }
     82else if(!array_key_exists('Where', $_SESSION)) $_SESSION['Where'] = '';
     83
     84if ($_SESSION['Where'] <> '') echo (' <a href="?Where">Zrušit filtr týmů</a><br />');
     85
     86
    7787$desc = $_SESSION['Desc'];
    7888if($desc == '') $desc = 'DESC'; else $desc = '';
     
    91101echo ('</tr>');
    92102
    93 $ID = $Database->SQLCommand('SELECT *,(SELECT count(*) FROM user WHERE team = team.ID) as numberuser FROM team ORDER BY '.$_SESSION['Order'].' '.$_SESSION['Desc'].' LIMIT '.($_SESSION['Page'] - 1) * $Config['Web']['ItemsPerPage'].','.$Config['Web']['ItemsPerPage']);
     103$ID = $Database->SQLCommand('SELECT *,(SELECT count(*) FROM user WHERE team = team.ID) as numberuser FROM team '.$_SESSION['Where'].' ORDER BY '.$_SESSION['Order'].' '.$_SESSION['Desc'].' LIMIT '.($_SESSION['Page'] - 1) * $Config['Web']['ItemsPerPage'].','.$Config['Web']['ItemsPerPage']);
    94104while($Line = mysql_fetch_assoc($ID))
    95105{
  • trunk/userlist.php

    r149 r155  
    1515else if(!array_key_exists('Desc', $_SESSION)) $_SESSION['Desc'] = 'DESC';
    1616
     17if(array_key_exists('search', $_GET)) {
     18         $_SESSION['Where'] = ' WHERE `user`.`user` LIKE "%'.$_GET['search'].'%"';
     19 }
    1720if(array_key_exists('Where', $_GET)) {
    1821         $_SESSION['Where'] = ' WHERE '.$_GET['Where'];
    19      if($_GET['Where'] == '') $_SESSION['Where'] = '';
     22     if($_GET['Where'] == '') $_SESSION['Where'] = '';     
    2023 }
    2124else if(!array_key_exists('Where', $_SESSION)) $_SESSION['Where'] = '';
Note: See TracChangeset for help on using the changeset viewer.