Changeset 4 for trunk/index.php
- Timestamp:
- Aug 5, 2018, 1:12:12 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r3 r4 4 4 include_once('Config.php'); 5 5 include_once('Meet.php'); 6 include_once('RSS.php'); 7 include_once('Global.php'); 6 8 7 9 session_start(); 8 10 9 function HumanDate($Time)10 {11 return(date('j.n.Y', $Time));12 }13 14 11 class Application 15 12 { 13 var $NoFullPage = false; 14 16 15 function Link($URL) 17 16 { … … 69 68 $Output .= '<th>'.$ResourceGroup['Name'].'</th>'; 70 69 } 71 $Output .= '</tr>'; 70 $Output .= '</tr>'; 72 71 $DbResult = $this->Database->select('Dance', '*, (SELECT Name FROM DanceGroup WHERE DanceGroup.Id=Dance.Group) AS GroupName', '1 ORDER BY `Name`'); 73 72 while($Dance = $DbResult->fetch_assoc()) … … 118 117 function ShowMeetList() 119 118 { 119 $Output = ''; 120 //print_r($_GET); 120 121 if (array_key_exists('lvm', $_GET) and ($_GET['lvm'] == 'seznam')) 121 122 { … … 125 126 if (array_key_exists('vyskaod', $_GET) ) $_SESSION['vyskaod'] = $_GET['vyskaod']; 126 127 if (array_key_exists('vyskado', $_GET) ) $_SESSION['vyskado'] = $_GET['vyskado']; 128 if (array_key_exists('vahaod', $_GET) ) $_SESSION['vahaod'] = $_GET['vahaod']; 129 if (array_key_exists('vahado', $_GET) ) $_SESSION['vahado'] = $_GET['vahado']; 130 if (array_key_exists('pohlavi', $_GET) ) { 131 if ($_GET['pohlavi'] > 0) $_SESSION['pohlavi'] = $_GET['pohlavi']; 132 else unset($_SESSION['pohlavi']); 133 } 127 134 } else { 128 $Output = '';129 135 $Output .= '<script>function reloadlist(){ $(\'#meetlist\').load(document.URL + \' #meetlist\');}'. 130 136 ' var load_timer = 100; … … 143 149 } 144 150 145 var cf = { pohlavi:\'2\'};151 var cf = {}; 146 152 147 153 function setupc(key,val){ … … 150 156 var ccv = $(\'#\'+key).val(); 151 157 if(ccv!=val) $(\'#\'+key).val(val==0?\'\':val); 158 } 159 if(key==\'pohlavi\') { 160 $(\'.c\'+key).removeClass(\'active\'); 161 $(\'#\'+key+val).addClass(\'active\'); 152 162 } 153 163 } … … 167 177 }'. 168 178 '</script>'; 179 $Output .= '<h4 style="text-align: center;">Inzeráty:</h4>'; 180 $Output .= '<div class="btn-group ma3">'. 181 '<button class="btn btn-filter cpohlavi btn-ico" onclick="upf(\'pohlavi\',0)" id="pohlavi0" data-toggle="tooltip" '. 182 'data-placement="top" title="Obě pohlaví"><span class="icon-both"></span></button>'. 183 '<button class="btn btn-filter cpohlavi btn-ico" onclick="upf(\'pohlavi\',1)" id="pohlavi1" data-toggle="tooltip" '. 184 'data-placement="top" title="Jen muži"><span class="icon-man"></span></button>'. 185 '<button class="btn btn-filter cpohlavi btn-ico" onclick="upf(\'pohlavi\',2)" id="pohlavi2" data-toggle="tooltip" '. 186 'data-placement="top" title="Jen ženy"><span class="icon-woman"></span></button>'. 187 '</div>'; 169 188 $Output .= '<div class="filter-num-box">'. 170 189 '<div class="label-box">Věk</div>'. 171 '<input value=" " onkeyup="if(event.keyCode!=9) upf(\'vekod\',$(this).val(),(event.keyCode==13?0:1)); '.190 '<input value="'.$_SESSION['vekod'].'" onkeyup="if(event.keyCode!=9) upf(\'vekod\',$(this).val(),(event.keyCode==13?0:1)); '. 172 191 '" id="vekod" autocomplete="off" type="text">'. 173 192 '<div class="label-box">-</div>'. 174 '<input value=" " onkeyup="'.193 '<input value="'.$_SESSION['vekdo'].'" onkeyup="'. 175 194 'if(event.keyCode!=9) upf(\'vekdo\',$(this).val(),(event.keyCode==13?0:1));" '. 176 195 'id="vekdo" autocomplete="off" type="text"><div class="label-box">let</div></div>'. 177 '</div> ' .178 196 '</div> '; 197 $Output .= '<div class="filter-num-box">'. 179 198 '<div class="label-box">Výška</div>'. 180 '<input value=" " onkeyup="if(event.keyCode!=9) upf(\'vyskaod\',$(this).val(),(event.keyCode==13?0:1)); '.199 '<input value="'.$_SESSION['vyskaod'].'" onkeyup="if(event.keyCode!=9) upf(\'vyskaod\',$(this).val(),(event.keyCode==13?0:1)); '. 181 200 '" id="vyskaod" autocomplete="off" type="text">'. 182 201 '<div class="label-box">-</div>'. 183 '<input value=" " onkeyup="'.202 '<input value="'.$_SESSION['vyskado'].'" onkeyup="'. 184 203 'if(event.keyCode!=9) upf(\'vyskado\',$(this).val(),(event.keyCode==13?0:1));" '. 185 204 'id="vyskado" autocomplete="off" type="text"><div class="label-box">cm</div></div>'. 205 '</div> '; 206 $Output .= '<div class="filter-num-box">'. 207 '<div class="label-box">Váha</div>'. 208 '<input value="'.$_SESSION['vahaod'].'" onkeyup="if(event.keyCode!=9) upf(\'vahaod\',$(this).val(),(event.keyCode==13?0:1)); '. 209 '" id="vahaod" autocomplete="off" type="text">'. 210 '<div class="label-box">-</div>'. 211 '<input value="'.$_SESSION['vahado'].'" onkeyup="'. 212 'if(event.keyCode!=9) upf(\'vahado\',$(this).val(),(event.keyCode==13?0:1));" '. 213 'id="vahado" autocomplete="off" type="text"><div class="label-box">cm</div></div>'. 186 214 '</div>'; 187 $Output .= '<h4 style="text-align: center;">Inzeráty:</h4>'; 188 } 189 190 $Gender = array('', 'Muž', 'Žena'); 191 $Output .= '<div id="list_content">'. 192 '<table class="WideTable">'; 193 $Output .= '<tr>'. 194 '<th>Datum</th>'. 195 '<th>Jméno</th>'. 196 '<th>Výška</th>'. 197 '<th>Věk</th>'. 198 '<th>Váha</th>'. 199 //'<th>Email</th>'. 200 //'<th>Telefon</th>'. 201 '<th>Pohlaví</th>'. 202 '<th>Zpráva</th>'. 203 '<th>Zdroj</th>'; 204 $Output .= '</tr>'; 215 } 216 205 217 $Where = ''; 206 218 if (array_key_exists('vekod', $_SESSION) and ($_SESSION['vekod'] != '')) $Where .= ' AND (Age >= '.$_SESSION['vekod'].')'; … … 208 220 if (array_key_exists('vyskaod', $_SESSION) and ($_SESSION['vyskaod'] != '')) $Where .= ' AND (Height >= '.$_SESSION['vyskaod'].')'; 209 221 if (array_key_exists('vyskado', $_SESSION) and ($_SESSION['vyskado'] != '')) $Where .= ' AND (Height <= '.$_SESSION['vyskado'].')'; 222 if (array_key_exists('vahaod', $_SESSION) and ($_SESSION['vahaod'] != '')) $Where .= ' AND (Weight >= '.$_SESSION['vahaod'].')'; 223 if (array_key_exists('vahado', $_SESSION) and ($_SESSION['vahado'] != '')) $Where .= ' AND (Weight <= '.$_SESSION['vahado'].')'; 224 if (array_key_exists('pohlavi', $_SESSION) and ($_SESSION['pohlavi'] != '')) $Where .= ' AND (Gender = '.$_SESSION['pohlavi'].')'; 210 225 if (substr($Where, 0, 4) == ' AND') $Where = substr($Where, 4); 211 if ($Where == '') $Where = '1'; 226 if ($Where == '') $Where = '1'; 227 228 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `MeetItem` WHERE '.$Where); 229 $DbRow = $DbResult->fetch_row(); 230 $PageList = GetPageList($DbRow[0]); 231 232 $Gender = array('', 'Muž', 'Žena'); 233 $Output .= '<div id="list_content">'; 234 $Output .= $PageList['Output']; 235 $TableColumns = array( 236 array('Name' => 'Date', 'Title' => 'Datum'), 237 array('Name' => 'Name', 'Title' => 'Jméno'), 238 array('Name' => 'Height', 'Title' => 'Výška'), 239 array('Name' => 'Age', 'Title' => 'Věk'), 240 array('Name' => 'Weight', 'Title' => 'Váha'), 241 array('Name' => 'Gender', 'Title' => 'Pohlaví'), 242 array('Name' => 'Message', 'Title' => 'Zpráva'), 243 array('Name' => 'Source', 'Title' => 'Zdroj'), 244 ); 245 $Order = GetOrderTableHeader($TableColumns, 'Date', 1); 246 $Output .= '<table class="WideTable">'; 247 $Output .= $Order['Output']; 212 248 $DbResult = $this->Database->select('MeetItem', '*, (SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName, '. 213 '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL', $Where. ' ORDER BY `Date` DESC');249 '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL', $Where.$Order['SQL'].$PageList['SQLLimit']); 214 250 while($MeetItem = $DbResult->fetch_assoc()) 215 251 { … … 227 263 $Output .= '</tr>'; 228 264 } 229 $Output .= '</table></div>'; 230 231 return($Output); 265 $Output .= '</table>'; 266 $Output .= $PageList['Output']; 267 $Output .= '</div>'; 268 269 return($Output); 270 } 271 272 function ShowMeetListRss() 273 { 274 global $Config; 275 276 $this->NoFullPage = true; 277 $RSS = new RSS(); 278 $RSS->Title = 'Taneční seznamka'; 279 $RSS->Description = ''; 280 $RSS->Link = $Config['BaseURL'].'seznamka'; 281 282 $DbResult = $this->Database->select('MeetItem', '*, (SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName, '. 283 '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL', '1 ORDER BY `Date` DESC LIMIT 30'); 284 while($MeetItem = $DbResult->fetch_assoc()) 285 { 286 $Title = $MeetItem['Name']; 287 if ($MeetItem['Age'] != '') $Title .= ', '.$MeetItem['Age'].' let'; 288 if ($MeetItem['Weight'] != '') $Title .= ', '.$MeetItem['Height'].' cm'; 289 $Description = $MeetItem['Message']; 290 if ($MeetItem['Email'] != '') $Description .= '<br/>Email: '.$MeetItem['Email']; 291 if ($MeetItem['Phone'] != '') $Description .= '<br/>Telefon: '.$MeetItem['Phone']; 292 $Description .= '<br/>Škola: <a href="'.$this->Link($MeetItem['SourceURL']).'">'.$MeetItem['SourceName'].'</a>'; 293 $RSS->Items[] = array( 294 'Title' => $Title, 295 'Description' => $Description, 296 'Time' => MysqlDateTimeToTime($MeetItem['Date']), 297 'Link' => $Config['BaseURL'].'seznamka', 298 ); 299 $Output .= '<tr>'. 300 '<td>'.HumanDate(MysqlDateToTime($MeetItem['Date'])).'</td>'. 301 '<td>'.$MeetItem['Name'].'</td>'. 302 '<td>'.$MeetItem['Height'].'</td>'. 303 '<td>'.$MeetItem['Age'].'</td>'. 304 '<td>'.$MeetItem['Weight'].'</td>'. 305 //'<td>'.$MeetItem['Email'].'</td>'. 306 //'<td>'.$MeetItem['Phone'].'</td>'. 307 '<td>'.$Gender[$MeetItem['Gender']].'</td>'. 308 '<td>'.$MeetItem['Message'].'</td>'. 309 '<td></td>'; 310 $Output .= '</tr>'; 311 } 312 313 return $RSS->Generate(); 232 314 } 233 315 … … 240 322 '<link rel="stylesheet" href="'.$this->Link('/style.css').'" type="text/css" media="all" />'. 241 323 '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$this->Config['Encoding'].'" />'. 242 '<script src="jquery.js"></script>'. 243 '<title>Tance</title>'. 324 '<script src="jquery.js"></script>'; 325 $Output .= '<link rel="alternate" title="Taneční seznamka" href="'. 326 $this->Config['BaseURL'].'seznamka-rss" type="application/rss+xml" />'; 327 $Output .= '<title>Tance</title>'. 244 328 '</head><body>'; 245 329 $Output .= $Content; … … 266 350 else if($this->PathItems[0] == 'tance') $Output .= $this->ShowDanceList(); 267 351 else if($this->PathItems[0] == 'seznamka') $Output .= $this->ShowMeetList(); 352 else if($this->PathItems[0] == 'seznamka-rss') $Output .= $this->ShowMeetListRss(); 268 353 else if($this->PathItems[0] == 'seznamka-aktualizace') $Output .= $this->ShowMeetUpdate(); 269 354 else $Output .= $this->ShowDanceList();
Note:
See TracChangeset
for help on using the changeset viewer.