Орла
Области
Компаний
Пользователи
Галерея
Фиксированные новости
Орла
Отзывы о фирмах
Тарифы
Пользователи
Области
Банкоматы
Торговые точки
Доска объявлений
Курсы валют
Скидки
организации Орла
организации области
товары
сайты
сайты Орел
Данные
Разделы
Поиск
Поиск запросы
Статистика
Показы каталога организаций
Статистика клиенты
Пользователи
Сайты
Управление сайтом
Анкета
Аптеки
Афиша
Афиша новая
Баннеры
Бизнес >
Викторина
Голосование
Гость на сайте
Истории
Календарь событий
Каталоги >
Конкурс красоты
Конкурс аудио
Консультации
Меню
Новое на сайте
Новости >
Организации >
Программа ТВ
Публикации
Разделы сайта
Рассылка
Рестораны
Секрет фирмы >
Сервисы >
Ссылки
Тесты
Файловый менеджер
Форум
Фотогалерея
Обратная связь
Недвижимость
Новый год
Тексты
Пользователи
Юридический рейтинг
Отзывы на товары
Бан пользователей
Жалобы
Новые тесты
Коронавирус
Файловый менеджер
Имя файла
OrganizationsReader.php
Содержимое
<?php namespace app\organizations; use App; class OrganizationsReader { /** * Корневая категория, в которой ищем. * При этом будут и дочерние категории. * @var array */ private $_rootCategory = 0; private $categoryRepository; private $_orderBy = ['firma.id DESC']; private $_offset = 0; private $_limit = 12; private $_total = 0; public function __construct() { $this->categoryRepository = new OrganizationCategoryRepository(); } public function setRootCategory($categoryId) { $this->_rootCategory = $categoryId; return $this; } public function orderBy(array $orderBy = ['firma.id DESC']) { $this->_orderBy = $orderBy; return $this; } public function offset($offset) { $this->_offset = $offset; return $this; } public function limit($limit) { $this->_limit = $limit; return $this; } public function all() { $childrenCategoriesIds = Categories::getChildrenIds($this->_rootCategory); $childrenCategoriesIds[] = $this->_rootCategory; if (count($childrenCategoriesIds) == 0) { return []; } $command = App::$command->createCommand(' SELECT SQL_CALC_FOUND_ROWS firma.id, firma.lat, firma.lng, firma.name, firma.registr, firma.name_ur, firma.street, firma.house, firma.house_add, firma.corps, firma.build, firma.locality_id, firma.sub_adm_area_id, firma.adress, firma.address_add, firma_photo.photo, firma.client_logo, firma.build, firma.url, firma.firma_url, locality.name as city_name, rubrik2.id_rubrik, (SELECT COUNT(*) as total FROM firma_otzyv WHERE id_firm = firma.id AND hidden = 0 AND status = 3) as total_comments FROM firma LEFT JOIN firma_photo ON firma_photo.firma_id = firma.id LEFT JOIN locality ON locality.id = firma.locality_id INNER JOIN rubrik2 ON rubrik2.id_firm = firma.id WHERE rubrik2.id_rubrik IN ('.implode(',', $childrenCategoriesIds).') GROUP BY firma.id ORDER BY '.implode(',', $this->_orderBy).' LIMIT '.$this->_offset.','.$this->_limit.'; '); $items = $command->queryAll(); $this->_total = App::$command ->createCommand(' SELECT FOUND_ROWS() as total ') ->queryOne('total', 0); foreach ($items as $key => $item) { $address = $item['city_name']; if ($item['city_name'] == null) { $address = 'город Орел'; } if ($item['street'] != '') { $address .= ', ' . $item['street']; } if ($item['house'] != '' && $item['house'] > 0) { if (is_numeric($item['house_add'])) { $address .= ', ' . $item['house'] . '/' . $item['house_add']; } else { $address .= ', ' . $item['house'] . ' ' . $item['house_add']; } } $items[$key]['category'] = $this->categoryRepository->findOne($item['id_rubrik']); $items[$key]['number'] = OrganizationPhones::getActivePhone($item['id']); if ( $item['corps'] != '' ) $address .= ' корпус ' . $item['corps']; if ( $item['build'] != '' ) $address .= ' строение ' . $item['build']; if ( $item['address_add'] != '' ) $address .= ' ' .$item['address_add']; $items[$key]['address'] = $address; } return $items; } public function getTotal() { return $this->_total; } }
/app/organizations/
Имя
Дата
Размер
..
2026-10-01
activerecord
2017-03-23
banners
2017-03-20
entity
2019-02-11
form
2020-04-06
helpers
2019-02-08
interfaces
2017-01-26
regions
2017-02-02
search
2019-02-12
shop
2020-04-06
statistic
2019-01-29
utils
2018-01-12
validators
2020-02-11
views
2018-01-16
Categories.php
2019-02-13
6 кб.
CommentVote.php
2024-08-23
5 кб.
CommentVote.php~
2017-01-26
5 кб.
Comments.php
2019-02-26
6 кб.
CommentsKarma.php
2017-01-26
308 байт
OrganizationCategory.php
2019-02-11
896 байт
OrganizationCategoryFactory.php
2018-01-12
1 кб.
OrganizationCategoryRepository.php
2019-02-12
2 кб.
OrganizationCommentsReader.php
2019-02-18
5 кб.
OrganizationEmails.php
2017-03-09
1 кб.
OrganizationFactory.php
2016-12-13
277 байт
OrganizationFiles.php
2017-02-15
645 байт
OrganizationIndexator.php
2017-08-18
349 байт
OrganizationNews.php
2019-08-23
2 кб.
OrganizationPhones.php
2019-02-11
7 кб.
OrganizationPhotos.php
2017-08-15
2 кб.
OrganizationRepository.php
2019-02-12
433 байт
OrganizationRubriks.php
2017-03-09
2 кб.
OrganizationSchedule.php
2018-01-12
2 кб.
OrganizationScheduleFactory.php
2018-01-12
844 байт
OrganizationSites.php
2020-04-09
1 кб.
OrganizationSlider.php
2019-08-12
1 кб.
OrganizationStatistics.php
2019-04-01
2 кб.
OrganizationVideos.php
2017-01-25
1 кб.
Organizations.php
2020-04-17
34 кб.
OrganizationsReader.php
2019-02-11
4 кб.
PhoneRepository.php
2019-02-11
1 кб.
Rating.php
2024-08-23
2 кб.
Rating.php~
2019-02-15
1 кб.
/app/organizations
Загрузить файлы
Файл 1
Файл 2
Файл 3