source: page_list.php@ 18

Last change on this file since 18 was 18, checked in by maron, 16 years ago

Oprava v CZWOW out of date, filtr překladů

File size: 14.2 KB
Line 
1<?php
2include('includes/global.php');
3
4//Poèet page_textù na stránce
5 $Number_page_text = 200;
6
7 if(array_key_exists('order', $_GET)) {
8 $order = $_GET['order'];
9 $desc = $_GET['desc'];
10 $_SESSION['order'] = $_GET['order'];
11 $_SESSION['desc'] = $_GET['desc'];
12 } else {
13 if (isset($_SESSION['order'])) {
14 $order = $_SESSION['order'];
15 $desc = $_SESSION['desc'];
16 } else {
17 $order = '';
18 $desc = 'desc';
19 }
20 }
21
22 if(array_key_exists('limitx', $_GET)) {
23 $_SESSION['limitx'] = mysql_escape_string($_GET['limitx']);
24 $_SESSION['limity'] = mysql_escape_string($_GET['limity']);
25 } else {
26 if (isset($_SESSION['limitx']) == false) {
27 $_SESSION['limitx'] = '0';
28 $_SESSION['limity'] = $Number_page_text;
29 }
30 }
31
32 function WritePages($Addres, $Where)
33 { // BEGIN function WritePages
34 global $Database, $Number_page_text;
35
36 $Line = mysql_fetch_row($Database->SQLCommand("SELECT count(*) FROM page_text $Where"));
37 $CountLists = $Line[0]/$Number_page_text;
38
39 echo 'Poèet page_textù: <b>'.$Line[0].'</b><br />
40 Zobrazit stránku: ';
41
42 for ($i=0; $i< $CountLists; ++$i) {
43 $limity = $Number_page_text;
44 $limitx = $i*$limity;
45 $Page = $i+1;
46 if ($_SESSION['limitx'] == $limitx)
47 echo '<b>'.$Page.'</b> ';
48 else
49 echo '<a href="'.$Addres.'&amp;limitx='.$limitx.'&amp;limity='.$limity.'">'.$Page.'</a> ';
50 }
51
52 if (@$_SESSION['limitx'] > @$limitx) $_SESSION['limitx'] = 0;
53
54 } // END function WritePages
55
56 function Write_page_text($sql, $limit, $address)
57 { // BEGIN function Writepage_text
58 global $Database, $order, $desc;
59
60 if ($limit <> '') $limit = 'LIMIT '.$limit;
61
62 if ($address <> 'selection') {
63 if ($order <> '') $order = 'ORDER BY '.$order;
64 if ($desc <> 'desc') $desc = 'desc'; else $desc = '';
65 } else {
66 $order = '';
67 $desc = '';
68 }
69
70 echo '<table border="1" cellpadding="2" cellspacing="0">
71 <tr>
72 <th><a href="page_list.php?'.$address.'&amp;order=ID&amp;desc='.$desc.'">Poøadové èíslo</a></th>
73 <th><a href="page_list.php?'.$address.'&amp;order=entry&amp;desc='.$desc.'">ID page_textu</a></th>';
74 if ($address <> 'notran') echo '<th><a href="page_list.php?'.$address.'&amp;order=user&amp;desc='.$desc.'">User</a></th>
75 <th><a href="page_list.php?'.$address.'&amp;order=vote&amp;desc='.$desc.'">Známka</a></th>
76 <th><a href="page_list.php?'.$address.'&amp;order=CountVote&amp;desc='.$desc.'">Poèet hlasování</a></th>';
77 echo '</tr>';
78
79 // echo "$sql $order $desc $limit";
80 $ID = $Database->SQLCommand("$sql $order $desc $limit");
81 while ($Line = mysql_fetch_array($ID)) {
82 echo '<tr>
83 <td><a href="page_form.php?ID='.$Line['ID'].'">'.$Line['ID'].'</a></td>
84 <td>'.$Line['entry'].'</td>';
85 if ($address <> 'notran') echo '<td>'.@$Line['User'].'</td>
86 <td>'.substr($Line['Vote'], 0, 4).'</td>
87 <td>'.$Line['CountVote'].'</td>';
88 echo '</tr>';
89 }
90 echo '</table>';
91 } // END function Writepage_text
92
93
94 if(array_key_exists('notran', $_GET)) {
95 echo '<a Title="Zobrazit page_texty podle vlastního filtru" href="page_list.php?filter">Filtr page_textù</a> ->
96 <a Title="Zde mù¾ete zaèít pøekládat" href="page_list.php?selection">Nepøelo¾ené page_texty</a> - >
97 <b>Vypsání nepøelo¾ených page_textù s limitem na stránku</b><br><br>';
98
99 WritePages('page_list.php?notran',"items WHERE items.Language = '0' AND
100 NOT EXISTS(SELECT 1 FROM page_text sub WHERE sub.Language <> 0 AND sub.entry = items.entry)");
101
102 Write_page_text("SELECT * FROM page_text items WHERE items.Language = '0' AND
103 NOT EXISTS(SELECT 1 FROM page_text sub WHERE sub.Language <> 0 AND sub.entry = items.entry) ", $_SESSION['limitx'].','.$_SESSION['limity'],'notran');
104 }
105
106 if(array_key_exists('nocheck', $_GET)) {
107 echo '<a Title="Zobrazit page_texty podle vlasního filtru" href="page_list.php?filter">Filtr page_textù</a> ->
108 <a Title="Zatím nezkontrolované page_texty" href="page_list.php?nocheck">Nezkontrolované page_texty</a><br><br>';
109
110 WritePages('page_list.php?nocheck'," WHERE Language <> 0 AND page_text.Complete = '1' AND admin_check <> 1");
111
112 Write_page_text("SELECT *, (SELECT user.user FROM user WHERE user.id = page_text.user) as User
113 FROM page_text WHERE Language <> 0 AND page_text.Complete = '1' AND admin_check <> 1", $_SESSION['limitx'].','.$_SESSION['limity'],'nocheck');
114 }
115
116 if(array_key_exists('check', $_GET)) {
117 echo '<a Title="Zobrazit page_texty podle vlasního filtru" href="page_list.php?filter">Filtr page_textù</a> ->
118 <a Title="Zkontrolované page_texty" href="page_list.php?nocheck">Zkontrolované page_texty</a><br><br>';
119
120 WritePages('page_list.php?nocheck'," WHERE Language <> 0 AND page_text.Complete = '1' AND admin_check = 1");
121
122 Write_page_text("SELECT *, (SELECT user.user FROM user WHERE user.id = page_text.user) as User
123 FROM page_text WHERE Language <> 0 AND page_text.Complete = '1' AND admin_check = 1", $_SESSION['limitx'].','.$_SESSION['limity'],'check');
124 }
125 if(array_key_exists('notvote', $_GET)) {
126 echo '<a Title="Zobrazit page_texty podle vlastního filtru" href="page_list.php?filter">Filtr page_textù</a> ->
127 <a Title="Zatím neznámkované page_texty" href="page_list.php?notvote">Neznámkované page_texty</a><br><br>';
128
129 WritePages('page_list.php?notvote'," WHERE Language <> 0 AND page_text.Complete = '1' AND User <> ".$_SESSION['UserID']." AND
130 NOT EXISTS(SELECT 1 FROM page_vote WHERE IDuser = ".$_SESSION['UserID']." AND IDpage = page_text.ID)");
131
132 Write_page_text("SELECT *, (SELECT user.user FROM user WHERE user.id = page_text.user) as User
133 FROM page_text WHERE Language <> 0 AND page_text.Complete = '1' AND User <> ".$_SESSION['UserID']." AND
134 NOT EXISTS(SELECT 1 FROM page_vote WHERE IDuser = ".$_SESSION['UserID']." AND IDpage = page_text.ID)", $_SESSION['limitx'].','.$_SESSION['limity'],'notvote');
135 }
136
137 if(array_key_exists('Translate', $_GET)) {
138 echo '<a Title="Zobrazit page_texty podle vlastního filtru" href="page_list.php?filter">Filtr page_textù</a> ->
139 <a Title="Pøelo¾ené page_texty, mù¾ete zde hlasovat, nebo opravovat page_texty" href="page_list.php?Translate">Pøelo¾ené page_texty</a><br><br>';
140
141 WritePages('page_list.php?Translate', "WHERE page_text.Language <> 0 AND page_text.Complete = '1'");
142
143 Write_page_text("SELECT *, (SELECT user.user FROM user WHERE user.id = page_text.user) as User FROM
144 page_text WHERE page_text.Language <> 0 AND page_text.Complete = '1'", $_SESSION['limitx'].','.$_SESSION['limity'], 'Translate');
145 }
146
147 if(array_key_exists('my', $_GET) and Licence(0)) {
148 echo '<a Title="Zobrazit page_texty podle vlastního filtru" href="page_list.php?filter">Filtr page_textù</a> ->
149 <a Title="Pøelo¾ené page_texty pøilá¹eného u¾ivatele" href="page_list.php?my">Moje page_texty</a><br><br>';
150 Write_page_text("SELECT * FROM page_text Where user = ".$_SESSION['UserID'], '', 'my');
151 }
152
153 if(array_key_exists('mydevelop', $_GET) and Licence(0)) {
154 echo '<a Title="Zobrazit page_texty podle vlastního filtru" href="page_list.php?filter">Filtr page_textù</a> ->
155 <a Title="Nedokonèené page_texty" href="page_list.php?mydevelop">Rozepsané page_texty</a><br><br>';
156 Write_page_text("SELECT * FROM page_text Where user = ".$_SESSION['UserID']." AND complete = '0'", '', 'mydevelop');
157 }
158
159
160 if(array_key_exists('users', $_GET)) {
161 echo '<a Title="Zobrazit page_texty podle vlastního filtru" href="page_list.php?filter">Filtr page_textù</a> ->
162 <b>Vypsání page_textù od urèitých u¾ivatelù</b><br><br>';
163 $users = @$_POST['users'];
164
165 $WhereUsers = '';
166
167 for ($i=0; $i<Count($users); $i++):
168 if ($WhereUsers <> '')
169 $WhereUsers .= " OR User = ".$users[$i];
170 else
171 $WhereUsers .= " User = ".$users[$i];
172 endfor;
173 Write_page_text("SELECT *, (SELECT user.user FROM user WHERE user.id = page_text.user) as User FROM page_text Where $WhereUsers", '', 'users');
174
175 }
176
177 if(array_key_exists('byvote', $_GET)) {
178 echo '<a Title="Zobrazit page_texty podle vlastního filtru" href="page_list.php?filter">Filtr page_textù</a> ->
179 <b>Vypsání podle známky</b><br><br>';
180
181 $SingVote = $_POST['SingVote'];
182 $SingNumberVote = $_POST['SingNumberVote'];
183 $Vote = $_POST['Vote'];
184 $NumberVote = $_POST['NumberVote'];
185
186 Write_page_text("SELECT *, (SELECT user.user FROM user WHERE user.id = page_text.user) as User
187 FROM page_text WHERE Vote $SingVote $Vote AND CountVote $SingNumberVote $NumberVote", '', 'users');
188
189 }
190
191 if (array_key_exists('search', $_GET)) {
192 $Search = $_GET['search'];
193
194 $sql = "SELECT * FROM `page_text`
195 WHERE `ID` LIKE '%$Search%'
196 OR `entry` LIKE '%$Search%'
197 OR `text` LIKE '%$Search%'
198 OR `Language` LIKE '%$Search%'
199 OR `Vote` LIKE '%$Search%'
200 OR `CountVote` LIKE '%$Search%'
201 OR `User` LIKE '%$Search%'
202 OR `Complete` LIKE '%$Search%'
203 OR `Take` LIKE '%$Search%'";
204 Write_page_text($sql, '', 'search='.$Search);
205 }
206
207 if (array_key_exists('searchentry', $_GET)) {
208 $Search = $_GET['searchentry'];
209
210 $sql = "SELECT * FROM `page_text` WHERE `entry` LIKE '$Search'";
211
212 Write_page_text($sql, '', 'searchentry='.$Search);
213 }
214
215 if(array_key_exists('filter', $_GET)) {
216 echo '<a Title="Zobrazit page_texty podle vlastního filtru" href="page_list.php?filter">Filtr page_textù</a><br><br><br>';
217 echo '
218 <table border="1" cellpadding="3" cellspacing="0">
219 <tr><th>Odkaz</th><th>Popis</th></tr>';
220
221 echo '<tr><td><a Title="Zde mù¾ete zaèít pøekládat" href="page_list.php?notran">Nepøelo¾ené page_texty</a></td>
222 <td>Nikým nepøelo¾ené page_texty, zde mù¾ete zaèít pøekládat</td></tr>
223 <tr><td><a Title="Pøelo¾ené page_texty, mù¾ete zde hlasovat, nebo opravovat page_text" href="page_list.php?Translate">Pøelo¾ené page_texty</a></td>
224 <td>Pøelo¾ené page_texty, mù¾ete zde hlasovat, nebo opravovat page_texty</td></tr>
225 ';
226
227 if (Licence(0)) {
228 echo '<tr><td><a Title="Nedokonèené page_texty" href="page_list.php?mydevelop">Rozepsané page_texty</a></td>
229 <td>Nedokonèené page_texty pøilá¹eného u¾ivatele</td></tr>
230 <tr><td><a Title="Pøelo¾ené page_texty pøilá¹eného u¾ivatele" href="page_list.php?my">Moje page_texty</a></td>
231 <td>Pøelo¾ené page_texty pøilá¹eného u¾ivatele</td></tr>
232 <tr><td><a Title="Zatím neznámkované page_texty" href="page_list.php?notvote">Neznámkované page_texty</a></td>
233 <td>Zatím neznámkované page_texty</td></tr>';
234 if (Licence(2)) {
235 echo '<tr><td><a Title="Nezkontrolované page_texty" href="page_list.php?nocheck">Nezkontrolované page</a></td></tr>';
236 echo '<tr><td><a Title="Zkontrolované page_texty" href="page_list.php?check">Zkontrolované page</a></td></tr>';
237 }
238 }
239
240 echo '<tr><td><form action="page_list.php?users" method="post">
241 &nbsp;<select name="users[]" size="10" multiple>';
242
243 $ID = $Database->SQLCommand("SELECT user,ID FROM `user` WHERE
244 EXISTS(SELECT 1 FROM page_text WHERE user = user.ID) ORDER BY user");
245 while ($Line = mysql_fetch_array($ID))
246 echo '<option value="'.$Line['ID'].'">'.$Line['user'].'</option>';
247
248 echo '</select><br>
249 <input type="submit" value="Vypsat"></form></td>
250 <td>Vypsat pouze od tìchto u¾ivatalù<br>
251 Vybrat více u¾ivatelù mù¾ete pomocí CTRL+click</td></tr>';
252
253 echo '<tr><td>
254 <form action="page_list.php?byvote" method="post">
255 Poèet hlasù: <br />
256 <input type="radio" name="SingNumberVote" value="=" checked="true" title="Rovná se &quot;=&quot;">
257 <input type="radio" name="SingNumberVote" value=">" checked="true" title="Je vìt¹í ne¾ &quot;>&quot;">
258 <input type="radio" name="SingNumberVote" value="<" checked="true" title="Je men¹í ne¾ &quot;<&quot;">
259 <input type="text" name="NumberVote" value="3" size="1"><br>
260 Známka: <br />
261 <input type="radio" name="SingVote" value="=" checked="true" title="Rovná se &quot;=&quot;">
262 <input type="radio" name="SingVote" value=">" checked="true" title="Je vìt¹í ne¾ &quot;>&quot;">
263 <input type="radio" name="SingVote" value="<" checked="true" title="Je men¹í ne¾ &quot;<&quot;">
264 <input type="text" name="Vote" value="3" size="1"><br>
265 <input type="submit" value="Vypsat"></form>
266 </td><td>Zobrazit podle známky</td></tr>';
267
268 echo '<tr><td><form action="page_list.php" method="get">
269 <input type="text" name="search" size="8">
270 <input type="submit" value="Hledat">
271 </form>
272 </td><td>Vyhledat pomocí textu</td></tr>
273 ';
274
275 echo '<tr><td><form action="page_list.php" method="get">
276 <input type="text" name="searchentry" size="8">
277 <input type="submit" value="Hledat">
278 </form>
279 </td><td>Zobrazit podle ID page_textu v mangosu</td></tr>
280 ';
281
282
283
284 echo '</table>';
285 // Writepage_text("SELECT * FROM page_text Where user = ".$_SESSION['UserID']." AND complete = '0'", '', 'mydevelop');
286 }
287
288
289 ShowFooter();
290?>
291
Note: See TracBrowser for help on using the repository browser.