Орла
Области
Компаний
Пользователи
Галерея
Фиксированные новости
Орла
Отзывы о фирмах
Тарифы
Пользователи
Области
Банкоматы
Торговые точки
Доска объявлений
Курсы валют
Скидки
организации Орла
организации области
товары
сайты
сайты Орел
Данные
Разделы
Поиск
Поиск запросы
Статистика
Показы каталога организаций
Статистика клиенты
Пользователи
Сайты
Управление сайтом
Анкета
Аптеки
Афиша
Афиша новая
Баннеры
Бизнес >
Викторина
Голосование
Гость на сайте
Истории
Календарь событий
Каталоги >
Конкурс красоты
Конкурс аудио
Консультации
Меню
Новое на сайте
Новости >
Организации >
Программа ТВ
Публикации
Разделы сайта
Рассылка
Рестораны
Секрет фирмы >
Сервисы >
Ссылки
Тесты
Файловый менеджер
Форум
Фотогалерея
Обратная связь
Недвижимость
Новый год
Тексты
Пользователи
Юридический рейтинг
Отзывы на товары
Бан пользователей
Жалобы
Новые тесты
Коронавирус
Файловый менеджер
Имя файла
FotoGalleryReader.php
Содержимое
<?php namespace app\fotogal; use App; class FotoGalleryReader { private $_page; private $_offset; private $_limit = 15; private $_album; private $_userId; private $_ids = []; private $_onlyFavorites = false; private $_items = []; private $_total; public function __construct() { return $this; } public function setPage($pageId) { $this->_page = (int)$pageId; return $this; } public function getPage() { return $this->_page; } public function setOffset($offset) { $this->_offset = (int)$offset; return $this; } public function getOffset() { return $this->_offset; } public function setLimit($limit) { $this->_limit = (int)$limit; return $this; } public function getLimit() { return $this->_limit; } public function setIds(array $ids) { $this->_onlyFavorites = true; foreach ($ids as $id) { $this->_ids[] = (int)$id; } return $this; } public function setAlbum($album) { if ($album == null) { return $this; } $this->_album = $album; return $this; } public function getAlbum() { return $this->_album; } public function setUserId($userId) { $this->_userId = (int)$userId; return $this; } public function getUserId() { return $this->_userId; } private function getWhereCondition() { $where = []; $where[] = 'fotogal2.status = 3'; if ($this->_album != null) { $where[] = 'fotogal2.id_razdel = ' . $this->_album; } if ($this->_userId != null) { $where[] = 'fotogal2.id_user = ' . $this->_userId; } if (count($this->_ids) > 0) { $where[] = 'fotogal2.id IN (' . implode(',', $this->_ids) .')'; } return 'WHERE ' . implode(' AND ', $where); } public function query() { if ($this->_onlyFavorites == true && count($this->_ids) == 0) { $this->_items = []; $this->_total = 0; return $this; } if ($this->_page != null) { $this->_offset = ($this->_page - 1) * $this->_limit; } $command = App::$command ->createCommand(' SELECT fotogal2.*, user.name as user_name, user.name_full as user_name_full, user.sex as user_sex, COUNT(comments.id) as total_comments FROM `fotogal2` LEFT JOIN user ON user.id = fotogal2.id_user LEFT JOIN foto_comment comments ON comments.id_foto = fotogal2.id '.$this->getWhereCondition().' GROUP BY fotogal2.id ORDER BY fotogal2.id DESC LIMIT '.(int)$this->_offset.', '.(int)$this->_limit.'; '); $this->_items = $command->queryAll(); // total $command = App::$command ->createCommand(' SELECT COUNT(fotogal2.id) as total FROM `fotogal2` '.$this->getWhereCondition().' '); $this->_total = $command->queryOne('total', 0); return $this; } public function total() { return $this->_total; } public function all() { return $this->_items; } }
/app/fotogal/
Имя
Дата
Размер
..
2026-10-01
forms
2016-12-28
FotoFavorites.php
2016-12-29
2 кб.
FotoGallery.php
2019-04-16
14 кб.
FotoGalleryReader.php
2016-12-29
4 кб.
FotoGalleryRoute.php
2016-12-29
621 байт
FotoGallery_back.php
2017-02-06
12 кб.
/app/fotogal
Загрузить файлы
Файл 1
Файл 2
Файл 3