Орла
Области
Компаний
Пользователи
Галерея
Фиксированные новости
Орла
Отзывы о фирмах
Тарифы
Пользователи
Области
Банкоматы
Торговые точки
Доска объявлений
Курсы валют
Скидки
организации Орла
организации области
товары
сайты
сайты Орел
Данные
Разделы
Поиск
Поиск запросы
Статистика
Показы каталога организаций
Статистика клиенты
Пользователи
Сайты
Управление сайтом
Анкета
Аптеки
Афиша
Афиша новая
Баннеры
Бизнес >
Викторина
Голосование
Гость на сайте
Истории
Календарь событий
Каталоги >
Конкурс красоты
Конкурс аудио
Консультации
Меню
Новое на сайте
Новости >
Организации >
Программа ТВ
Публикации
Разделы сайта
Рассылка
Рестораны
Секрет фирмы >
Сервисы >
Ссылки
Тесты
Файловый менеджер
Форум
Фотогалерея
Обратная связь
Недвижимость
Новый год
Тексты
Пользователи
Юридический рейтинг
Отзывы на товары
Бан пользователей
Жалобы
Новые тесты
Коронавирус
Файловый менеджер
Имя файла
Afisha.php
Содержимое
<?php namespace app\afisha; class Afisha { private $_pdo; public function __construct() { $this->_pdo = \App::getAfishaPdo(); } /** * Функция возвращает ID афиши, зная URL страницы * @param $url * @return null|int */ public function getIdByUrl($url) { $sth = $this->_pdo->prepare(' SELECT id FROM afisha_event WHERE url = :url '); $sth->execute([ ':url' => $url ]); $data = $sth->fetch(); if (isset($data['id'])) { return $data['id']; } return null; } public function getData($id) { $sth = $this->_pdo->prepare(' SELECT a.*, b.id gid, b.name gname, c.id_org, c.id id_act, b.url as group_url, c.date_ot, c.date_do ndate_to, c.date_do, c.begin, c.price FROM infostrana.afisha_event a, infostrana.afisha_groups b, infoorel.afisha_new c WHERE a.id_grp=b.id AND a.id=c.id_activity AND a.id = :afisha_id GROUP BY a.id '); $sth->execute([ ':afisha_id' => $id ]); $data = $sth->fetch(); if (isset($data['id']) == false) { return null; } return $data; } public function getAfishaTheme($id) { $sth = $this->_pdo->prepare(' SELECT id, `name` FROM afisha_event WHERE id = :id '); $sth->execute([ ':id' => $id ]); $data = $sth->fetch(); if (isset($data['name'])) { return $data['name']; } return null; } public function getAfishaCategoryId($id) { $sth = $this->_pdo->prepare(' SELECT id, id_grp FROM afisha_event WHERE id = :id '); $sth->execute([ ':id' => $id ]); $data = $sth->fetch(); if (isset($data['id_grp'])) { return $data['id_grp']; } return null; } /** * Времена проведения, к примеру: * Кинотеатр ГриннФильм с 5 января по 9 января Начало: 10:50, 15:20, 17:00 * @param $id * @return array */ public function getSimilarItems($id) { $sth = $this->_pdo // ->prepare(' // SELECT a.*, b.id gid, b.name gname, c.id_org, c.id id_act, // c.date_ot, c.date_do ndate_to, c.date_do, c.begin, c.price, d.name org_name // FROM infostrana.afisha_event a, infostrana.afisha_groups b, infoorel.afisha_new c, infoorel.firma d // WHERE a.id_grp=b.id AND a.id=c.id_activity AND c.id_org=d.id AND a.id = :id AND date_do >= CURDATE() // ORDER BY date_ot ASC; // '); ->prepare(' SELECT a.*, b.id gid, b.name gname, c.id_org, c.id id_act, c.date_ot, c.date_do ndate_to, c.date_do, c.begin, c.price, IFNULL(d.name, c.place_text) org_name, c.place_text, c.canceled_text FROM infostrana.afisha_event a LEFT JOIN infostrana.afisha_groups b ON b.id = a.id_grp LEFT JOIN infoorel.afisha_new c ON c.id_activity = a.id LEFT JOIN infoorel.firma d ON d.id = c.id_org WHERE a.id = :id AND date_do >= CURDATE() ORDER BY date_ot ASC; '); $sth->execute([ ':id' => $id ]); return $sth->fetchAll(); } public function getTotalItemsByGroupId($groupId, $dateOt = null) { $sqlWhereFragment = ''; if ($dateOt != null && strtotime($dateOt) > 0) { $sqlWhereFragment = ' AND c.date_ot >= DATE("' . date('Y-m-d', strtotime($dateOt)) .'")'; } $sth = $this->_pdo ->prepare(' SELECT COUNT(a.id) as total FROM infostrana.afisha_event a, infoorel.afisha_new c WHERE a.id_grp=:group_id AND a.id=c.id_activity AND c.date_do>=curdate() '.$sqlWhereFragment.' '); $sth->execute([ ':group_id' => $groupId ]); return $sth->fetch()['total']; } public function getTotalItems($dateOt = null) { $sqlWhereFragment = ''; if ($dateOt != null && strtotime($dateOt) > 0) { $sqlWhereFragment = ' AND c.date_ot >= DATE("' . date('Y-m-d', strtotime($dateOt)) .'")'; } $sth = $this->_pdo ->prepare(' SELECT COUNT(a.id) as total FROM infostrana.afisha_event a, infoorel.afisha_new c WHERE a.id=c.id_activity AND c.date_do>=curdate() '.$sqlWhereFragment.' '); $sth->execute(); return $sth->fetch()['total']; } public function getArchivById($id) { $sth = $this->_pdo ->prepare(' SELECT COUNT(a.id) as total FROM infostrana.afisha_event a, infoorel.afisha_new c WHERE a.id=c.id_activity AND c.date_do>=curdate() and a.id=:id '); $sth->execute([ ':id' => $id ]); return $sth->fetch()['total']; } /** * Функция возвращает полный путь к новости афиши. * @param $id * @return string|null */ public function getFullUrl($id) { $sth = $this->_pdo->prepare(' SELECT url FROM afisha_event WHERE id = :id '); $sth->execute([ ':id' => $id ]); $data = $sth->fetch(); if (isset($data['url'])) { return '/afisha/' . $data['url'] . '.html'; } return null; } }
/app/afisha/
Имя
Дата
Размер
..
2026-10-01
Afisha.php
2020-03-19
6 кб.
AfishaGroups.php
2017-06-20
1 кб.
AfishaPlace.php
2016-12-22
601 байт
AfishaReader.php
2017-09-12
2 кб.
/app/afisha
Загрузить файлы
Файл 1
Файл 2
Файл 3