Name = 'Meet'; $this->Version = '1.0'; $this->Creator = 'Chronos'; $this->License = 'GNU/GPL'; $this->Description = 'List of dance meet items'; $this->Dependencies = array(); $this->RSSChannels = array(); } function Start(): void { $this->System->RegisterPage(['seznamka'], 'PageMeetList'); $this->System->RegisterPage(['seznamka', 'inzerat'], 'PageMeetItem'); $this->System->RegisterPage(['seznamka', 'aktualizace'], 'PageMeetUpdate'); $this->System->RegisterPage(['seznamka', 'rss'], 'PageMeetRss'); Core::Cast($this->System)->RegisterMenuItem('/seznamka', 'Seznamka'); } } class PageMeetList extends Page { function __construct($System) { parent::__construct($System); $this->Title = 'Seznamka'; $this->Description = 'Taneční seznamka'; } function Show(): string { global $Config; $Filter = new Filter(); $Filter->Items = array( array('Name' => 'pohlavi', 'Type' => 'Enumeration', 'DbName' => 'Gender', 'Title' => 'Pohlaví', 'States' => array(0 => 'Obě', 1 => 'Muži', 2 => 'Ženy')), array('Name' => 'name', 'Type' => 'String', 'DbName' => 'Name', 'Title' => 'Jméno'), array('Name' => 'vek', 'Type' => 'Integer', 'DbName' => 'Age', 'Title' => 'Věk', 'Units' => 'let'), array('Name' => 'vyska', 'Type' => 'Integer', 'DbName' => 'Height', 'Title' => 'Výška', 'Units' => 'cm'), array('Name' => 'vaha', 'Type' => 'Integer', 'DbName' => 'Weight', 'Title' => 'Váha', 'Units' => 'Kg'), array('Name' => 'message', 'Type' => 'String', 'DbName' => 'Message', 'Title' => 'Zpráva'), array('Name' => 'location', 'Type' => 'String', 'DbName' => 'Location', 'Title' => 'Umístění'), array('Name' => 'source', 'Type' => 'String', 'DbName' => 'SourceName', 'Title' => 'Zdroj'), ); $Output = ''; if (array_key_exists('lvm', $_GET) and ($_GET['lvm'] == 'seznam')) { $this->RawPage = true; } else { $Output .= '
Inzeráty
'; } $Output .= $Filter->GetOutput($this->System->Link('/seznamka/')); $Where = $Filter->GetWhere($this->Database); $DbResult = $this->Database->query('SELECT COUNT(*) FROM (SELECT *, '. '(SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName FROM `MeetItem`) AS T '. 'WHERE '.GetDefaultMeetFilter('T').' AND '.$Where); $DbRow = $DbResult->fetch_row(); $PageList = GetPageList($DbRow[0]); $Gender = array('', 'Muž', 'Žena'); $Output .= '
'; $Output .= $PageList['Output']; $TableColumns = array( array('Name' => 'Time', 'Title' => 'Čas'), array('Name' => 'Name', 'Title' => 'Jméno'), array('Name' => 'Height', 'Title' => 'Výška'), array('Name' => 'Age', 'Title' => 'Věk'), array('Name' => 'Weight', 'Title' => 'Váha'), array('Name' => 'Location', 'Title' => 'Umístění'), array('Name' => 'Gender', 'Title' => 'Pohlaví'), array('Name' => 'Message', 'Title' => 'Zpráva'), array('Name' => 'Source', 'Title' => 'Zdroj'), array('Name' => '', 'Title' => 'Detail'), ); $Order = GetOrderTableHeader($TableColumns, 'Time', 1); $Output .= ''; $Output .= $Order['Output']; $DbResult = $this->Database->query('SELECT * FROM (SELECT *, (SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName, '. '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL FROM MeetItem) AS T WHERE '.GetDefaultMeetFilter('T').' AND '. $Where.$Order['SQL'].$PageList['SQLLimit']); while ($MeetItem = $DbResult->fetch_assoc()) { $Output .= ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''; $Output .= ''; } $Output .= '
'.HumanDate(MysqlDateToTime($MeetItem['Time'])).''.$MeetItem['Name'].''.$MeetItem['Height'].''.$MeetItem['Age'].''.$MeetItem['Weight'].''.$MeetItem['Location'].''.$Gender[$MeetItem['Gender']].''.$MeetItem['Message'].''.$MeetItem['SourceName'].'Ukázat
'; $Output .= $PageList['Output']; $Output .= '
'; if (array_key_exists('lvm', $_GET) and ($_GET['lvm'] == 'seznam')) { } else { $Output .= '
rss20
'; $Output .= '
Vložit nový inzerát: '; $Output .= '
'; } return $Output; } } class PageMeetUpdate extends Page { function __construct($System) { parent::__construct($System); $this->Title = 'Aktualizace seznamky'; $this->Description = 'Aktualizace taneční seznamky'; } function Show(): string { $MeetSources = new MeetSources(); $MeetSources->Database = $this->Database; if (array_key_exists('i', $_GET)) $Output = $MeetSources->Parse($_GET['i']); else $Output = $MeetSources->Parse(); return $Output; } } class PageMeetItem extends Page { function __construct($System) { parent::__construct($System); $this->Title = 'Inzerát'; $this->Description = 'Inzerát taneční seznamky'; } function Show(): string { $Output = ''; if (count($this->System->PathItems) > 2) { $id = $this->System->PathItems[2] * 1; } else return 'Položka nenalezena'; if (Core::Cast($this->System)->IsAdmin()) { if (array_key_exists('hide', $_GET)) $this->Database->update('MeetItem', 'Id='.$id, array('Hidden' => 1)); if (array_key_exists('unhide', $_GET)) $this->Database->update('MeetItem', 'Id='.$id, array('Hidden' => 0)); } $Output .= '
Inzerát
'; $Gender = array('', 'Muž', 'Žena'); $DbResult = $this->Database->select('MeetItem', '*, (SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName, '. '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL, '.GetDefaultMeetFilter().' AS Filter', 'Id='.$id); if ($DbResult->num_rows > 0) { $MeetItem = $DbResult->fetch_assoc(); if (($MeetItem['Filter'] == '0') and !Core::Cast($this->System)->IsAdmin()) return 'Položka nenalezena'; if ($MeetItem['Link'] != '') $Link = 'Odkaz'; else $Link = ''; $Output .= ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''; $Output .= '
Čas'.HumanDate(MysqlDateToTime($MeetItem['Time'])).'
Pohlaví'.$Gender[$MeetItem['Gender']].'
Jméno'.$MeetItem['Name'].'
Výška'.$MeetItem['Height'].'
Věk'.$MeetItem['Age'].'
Váha'.$MeetItem['Weight'].'
Umístění'.$MeetItem['Location'].'
Email'.$MeetItem['Email'].'
Telefón'.$MeetItem['Phone'].'
Zpráva'.$MeetItem['Message'].'
Původní stránka'.$Link.'
Zdroj'.$MeetItem['SourceName'].'
'; $Output .= '
Vložit nový inzerát: '; $Output .= '
'; if (Core::Cast($this->System)->IsAdmin()) { if ($MeetItem['Hidden'] == '1') $Output .= '
Skrytá položka Zviditelnit
'; else $Output .= '
Viditelná položka Skrýt
'; } } else $Output .= 'Položka nenalezena'; return $Output; } } class PageMeetRss extends Page { function __construct($System) { parent::__construct($System); $this->Title = 'RSS inzeráty seznamky'; $this->Description = 'RSS kanál taneční seznamky'; } function Show(): string { global $Config; $this->RawPage = true; $RSS = new RSS(); $RSS->Title = 'Taneční seznamka'; $RSS->Description = ''; $RSS->Link = $this->System->AbsoluteLink('/seznamka/'); $DbResult = $this->Database->query('SELECT *, (SELECT MeetSource.Name FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceName, '. '(SELECT MeetSource.URL FROM MeetSource WHERE MeetSource.Id = MeetItem.Source) AS SourceURL FROM MeetItem WHERE '. GetDefaultMeetFilter().' ORDER BY `Time` DESC LIMIT 30'); while ($MeetItem = $DbResult->fetch_assoc()) { $Title = $MeetItem['Name']; if ($MeetItem['Age'] != '') $Title .= ', '.$MeetItem['Age'].' let'; if ($MeetItem['Weight'] != '') $Title .= ', '.$MeetItem['Height'].' cm'; if ($MeetItem['Location'] != '') $Title .= ', '.$MeetItem['Location']; $Description = $MeetItem['Message']."
\n"; if ($MeetItem['Email'] != '') $Description .= '
Email: '.$MeetItem['Email']; if ($MeetItem['Phone'] != '') $Description .= '
Telefon: '.$MeetItem['Phone']; if ($MeetItem['Age'] != '') $Description .= '
Věk: '.$MeetItem['Age'].' let'; if ($MeetItem['Height'] != '') $Description .= '
Výška: '.$MeetItem['Height'].' cm'; if ($MeetItem['Weight'] != '') $Description .= '
Váha: '.$MeetItem['Weight'].' kg'; $Description .= '
Zdroj: '.$MeetItem['SourceName'].''; $Time = MysqlDateTimeToTime($MeetItem['Time']); $TimeImport = MysqlDateTimeToTime($MeetItem['TimeImport']); // Append time part of TimeImport time to item time so new items will appear in correct time order even if item doesn't have time part specified if (TimeToMysqlTime($Time) == '00:00:00') { $Time = MysqlDateTimeToTime(TimeToMysqlDate($Time).' '.TimeToMysqlTime($TimeImport)); } $RSS->Items[] = array( 'Title' => $Title, 'Description' => $Description, 'Time' => $Time, 'Link' => $this->System->AbsoluteLink('/seznamka/inzerat/'.$MeetItem['Id'].'/'), ); } return $RSS->Generate(); } }