Орла
Области
Компаний
Пользователи
Галерея
Фиксированные новости
Орла
Отзывы о фирмах
Тарифы
Пользователи
Области
Банкоматы
Торговые точки
Доска объявлений
Курсы валют
Скидки
организации Орла
организации области
товары
сайты
сайты Орел
Данные
Разделы
Поиск
Поиск запросы
Статистика
Показы каталога организаций
Статистика клиенты
Пользователи
Сайты
Управление сайтом
Анкета
Аптеки
Афиша
Афиша новая
Баннеры
Бизнес >
Викторина
Голосование
Гость на сайте
Истории
Календарь событий
Каталоги >
Конкурс красоты
Конкурс аудио
Консультации
Меню
Новое на сайте
Новости >
Организации >
Программа ТВ
Публикации
Разделы сайта
Рассылка
Рестораны
Секрет фирмы >
Сервисы >
Ссылки
Тесты
Файловый менеджер
Форум
Фотогалерея
Обратная связь
Недвижимость
Новый год
Тексты
Пользователи
Юридический рейтинг
Отзывы на товары
Бан пользователей
Жалобы
Новые тесты
Коронавирус
Файловый менеджер
Имя файла
EditOrganizationContactForm.php
Содержимое
<?php namespace app\organizations\form; use app\core\models\Form; use app\organizations\OrganizationPhones; use app\organizations\Organizations; use App; /** * Модель формы для редактирования контактов организации. * * Class EditOrganizationContactForm * @package app\organizations\form */ class EditOrganizationContactForm extends Form { public $id_firm; public $name; public $regim; public $sub_adm_area_id; public $locality_id; public $street; public $house; public $house_add; public $corps; public $build; public $address_add; /** * @var array */ public $phones_country_code; /** * @var array */ public $phones_city_code; /** * @var array */ public $phones_phone_number; /** * @var array */ public $phones_ext_phone; /** * @var array */ public $phones_info; /** * @var array */ public $email; /** * @var array */ public $url; /** * @var array */ public $rubrik_ids; /** * @var int */ public $active_phone_number; public $inn; public $twogis_catalog_url; public $yandex_catalog_url; public $google_catalog_url; public $rusprofile_catalog_url; public function rules() { return [ ['id_firm', 'required', 'message' => 'Фирма не передана'], ['regim', 'required', 'message' => 'Укажите режим работы'], ['name', 'required', 'message' => 'Укажите название организации'], ['sub_adm_area_id', 'required', 'message' => 'Укажите район'], ['street', 'required', 'message' => 'Укажите улицу'] ]; } public function save() { if (Organizations::isMyOrganization($this->id_firm) == false) { $this->addError('id_firm', 'Вам запрещено изменение этой организации'); return false; } // обновляем виды деятельности App::$command ->createCommand(' DELETE FROM `rubrik2` WHERE id_firm = :firma_id ') ->bindValue(':firma_id', (int)$this->id_firm) ->query(); foreach ($this->rubrik_ids as $rubrikId) { App::$command ->createCommand(' INSERT INTO `rubrik2` (id_firm, id_rubrik) VALUES(:id_firm, :id_rubrik) ') ->bindValue(':id_firm', $this->id_firm) ->bindValue(':id_rubrik', $rubrikId) ->query(); } // обновляем сайты компании App::$command ->createCommand(' DELETE FROM firma_site WHERE id_firma = :firma_id ') ->bindValue(':firma_id', $this->id_firm) ->query(); foreach ($this->url as $url) { App::$command ->createCommand(' INSERT INTO firma_site (id_firma, url) VALUES(:firma_id, :url) ') ->bindValue(':firma_id', $this->id_firm) ->bindValue(':url', $url) ->query(); } // Обновление списка email адресов. App::$command ->createCommand(' DELETE FROM `firma_email` WHERE id_firma = :firma_id ') ->bindValue(':firma_id', $this->id_firm) ->query(); foreach ($this->email as $email) { App::$command ->createCommand(' INSERT INTO `firma_email` (id_firma, email) VALUES(:firma_id, :email) ') ->bindValue(':email', $email) ->bindValue(':firma_id', $this->id_firm) ->query(); } // обновление списка телефонов App::$command ->createCommand(' DELETE FROM `firma_phone` WHERE id_firma = :firma_id ') ->bindValue(':firma_id', $this->id_firm) ->query(); foreach ($this->phones_city_code as $i => $value) { if ($this->phones_country_code[$i] == '') { continue; } $phone = '+' . $this->phones_country_code[$i] . ' (' . $this->phones_city_code[$i] . ') ' . preg_replace('/([0-9]+)([0-9]{2})([0-9]{2})/', "\\1-\\2-\\3", $this->phones_phone_number[$i]); App::$command ->createCommand(' INSERT INTO `firma_phone` (id_firma, number, ext, info, type) VALUES(:firma_id, :phone, :ext, :info, 1) ') ->bindValues([ ':firma_id' => $this->id_firm, ':phone' => $phone, ':ext' => $this->phones_ext_phone[$i], ':info' => $this->phones_info[$i] ]) ->query(); } // обновление активного номера телефона if ($this->active_phone_number != '') { try { OrganizationPhones::setActivePhone($this->id_firm, $this->active_phone_number); } catch (\Exception $e) { // nothing } } // Обновление данных организации App::$command ->createCommand(' UPDATE firma SET name = :name, regim = :regim, street = :street, house = :house, house_add = :house_add, corps = :corps, build = :build, address_add = :address_add, locality_id = :locality_id, sub_adm_area_id = :sub_adm_area_id, inn = :inn, 2gis_catalog_url = :twogis_catalog_url, yandex_catalog_url = :yandex_catalog_url, google_catalog_url = :google_catalog_url, rusprofile_catalog_url = :rusprofile_catalog_url WHERE id = :id ') ->bindValues([ ':name' => $this->name, ':regim' => $this->regim, ':street' => $this->street, ':house' => $this->house, ':house_add' => $this->house_add, ':corps' => $this->corps, ':build' => $this->build, ':address_add' => $this->address_add, ':locality_id' => $this->locality_id, ':sub_adm_area_id' => $this->sub_adm_area_id, ':id' => $this->id_firm, ':inn' => $this->inn, ':twogis_catalog_url' => $this->twogis_catalog_url, ':yandex_catalog_url' => $this->yandex_catalog_url, ':google_catalog_url' => $this->google_catalog_url, ':rusprofile_catalog_url' => $this->rusprofile_catalog_url ]) ->query(); return true; } }
/app/organizations/form/
Имя
Дата
Размер
..
2020-04-06
filters
2019-04-03
AddCommentForm.php
2026-05-25
3 кб.
AddCommentForm.php~
2017-08-16
2 кб.
AddOrganizationForm.php
2026-05-25
6 кб.
AddOrganizationForm.php~
2019-04-03
5 кб.
AddPhotoForm.php
2017-03-24
2 кб.
ChangeDeliveryForm.php
2020-04-10
2 кб.
DeletePhotoForm.php
2017-03-24
2 кб.
DeleteProductForm.php
2020-04-06
1 кб.
EditInformationForm.php
2020-02-25
3 кб.
EditOrganizationContactForm.php
2020-04-06
8 кб.
EditProductForm.php
2020-04-10
4 кб.
VoteForm.php
2017-01-25
1 кб.
/app/organizations/form
Загрузить файлы
Файл 1
Файл 2
Файл 3