Changeset 249 for quests/ListQuests.php


Ignore:
Timestamp:
Jan 19, 2008, 10:51:11 PM (17 years ago)
Author:
maron
Message:

Ve vyhledávání pouze uživatelé, kteří mají questy, vyhledávání podle ID questu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quests/ListQuests.php

    r246 r249  
    150150      }
    151151     
     152     
     153      if(array_key_exists('users', $_GET)) {
     154        echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a> ->
     155        <b>Vypsání questù od urèitých u¾ivatelù</b><br><br>';
     156        $users = @$_POST['users'];
     157 
     158        $WhereUsers = '';
     159   
     160        for ($i=0; $i<Count($users); $i++):
     161          if ($WhereUsers <> '')
     162           $WhereUsers .= " OR User = ".$users[$i];
     163          else
     164            $WhereUsers .= " User = ".$users[$i];
     165        endfor;   
     166        WriteQuests("SELECT *, (SELECT user.user FROM user WHERE user.id = quests.user) as User FROM quests Where $WhereUsers", '', 'users');
     167 
     168      }
     169
     170      if(array_key_exists('byvote', $_GET)) {
     171        echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a> ->
     172        <b>Vypsání podle známky</b><br><br>';
     173       
     174        $SingVote = $_POST['SingVote'];
     175        $SingNumberVote = $_POST['SingNumberVote'];
     176        $Vote = $_POST['Vote'];
     177        $NumberVote = $_POST['NumberVote'];
     178       
     179        WriteQuests("SELECT *, (SELECT user.user FROM user WHERE user.id = quests.user) as User
     180        FROM quests WHERE Vote $SingVote $Vote AND CountVote $SingNumberVote $NumberVote", '', 'users');
     181 
     182      }
     183     
     184  if (array_key_exists('search', $_GET)) {
     185    $Search = $_GET['search'];
     186 
     187    $sql = "SELECT * FROM `quests`.`quests` WHERE `ID` LIKE '%$Search%'
     188    OR `entry` LIKE '%$Search%'
     189    OR `Title` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
     190    OR `Details` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
     191    OR `Objectives` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
     192    OR `OfferRewardText` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
     193    OR `RequestItemsText` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
     194    OR `EndText` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
     195    OR `ObjectiveText1` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
     196    OR `ObjectiveText2` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
     197    OR `ObjectiveText3` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
     198    OR `ObjectiveText4` LIKE CONVERT( _utf8 '%$Search%' USING latin2 ) COLLATE latin2_czech_cs
     199    OR `Language` LIKE '%$Search%'
     200    OR `Vote` LIKE '%$Search%'
     201    OR `User` LIKE '%$Search%'
     202    OR `complete` LIKE '%$Search%'";
     203   
     204    WriteQuests($sql, '', 'search='.$Search);
     205  }       
     206     
     207  if (array_key_exists('searchentry', $_GET)) {
     208    $Search = $_GET['searchentry'];
     209 
     210    $sql = "SELECT * FROM `quests`.`quests` WHERE `entry` LIKE '$Search'";
     211   
     212    WriteQuests($sql, '', 'searchentry='.$Search);
     213  }       
     214     
    152215      if(array_key_exists('filter', $_GET)) {
    153216        echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a><br><br><br>';
     
    171234          &nbsp;<select name="users[]" size="10" multiple>';
    172235         
    173           $ID = $Database->SQLCommand("SELECT user,ID FROM `user`");
     236          $ID = $Database->SQLCommand("SELECT user,ID FROM `user` WHERE
     237          EXISTS(SELECT 1 FROM quests WHERE user = user.ID) ORDER BY user");
    174238          while ($Line = mysql_fetch_array($ID))
    175239            echo '<option value="'.$Line['ID'].'">'.$Line['user'].'</option>';
     
    195259          </td><td>Zobrazit podle známky</td></tr>';
    196260         
    197           echo '<tr><td><form action="action.php" method="get">
     261          echo '<tr><td><form action="ListQuests.php" method="get">
    198262          <input type="text" name="search" size="8">
    199263          <input type="submit" value="Hledat">
     
    201265          </td><td>Vyhledat pomocí textu</td></tr>
    202266          ';
     267         
     268          echo '<tr><td><form action="ListQuests.php" method="get">
     269          <input type="text" name="searchentry" size="8">
     270          <input type="submit" value="Hledat">
     271          </form>
     272          </td><td>Zobrazit podle ID questu v mangosu</td></tr>
     273          ';
    203274                                                                           
    204275
     
    208279      }
    209280     
    210       if(array_key_exists('users', $_GET)) {
    211         echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a> ->
    212         <b>Vypsání questù od urèitých u¾ivatelù</b><br><br>';
    213         $users = @$_POST['users'];
    214  
    215         $WhereUsers = '';
    216    
    217         for ($i=0; $i<Count($users); $i++):
    218           if ($WhereUsers <> '')
    219            $WhereUsers .= " OR User = ".$users[$i];
    220           else
    221             $WhereUsers .= " User = ".$users[$i];
    222         endfor;   
    223         WriteQuests("SELECT *, (SELECT user.user FROM user WHERE user.id = quests.user) as User FROM quests Where $WhereUsers", '', 'users');
    224  
    225       }
    226 
    227       if(array_key_exists('byvote', $_GET)) {
    228         echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a> ->
    229         <b>Vypsání podle známky</b><br><br>';
    230        
    231         $SingVote = $_POST['SingVote'];
    232         $SingNumberVote = $_POST['SingNumberVote'];
    233         $Vote = $_POST['Vote'];
    234         $NumberVote = $_POST['NumberVote'];
    235        
    236         WriteQuests("SELECT *, (SELECT user.user FROM user WHERE user.id = quests.user) as User
    237         FROM quests WHERE Vote $SingVote $Vote AND CountVote $SingNumberVote $NumberVote", '', 'users');
    238  
    239       }
    240281
    241282  ShowFooter();
Note: See TracChangeset for help on using the changeset viewer.