59 lines
1.8 KiB
PHP
Executable File
59 lines
1.8 KiB
PHP
Executable File
<?php
|
|
namespace Conmed\Authserver;
|
|
|
|
use Bitrix\Main\Loader;
|
|
|
|
trait InternalDataTrait {
|
|
|
|
/**
|
|
* Возвращает список специальностей для PHP-компонента
|
|
*/
|
|
public static function getSpecialtiesForComponent() {
|
|
$rs = \Bitrix\Main\GroupTable::getList([
|
|
'filter' => ['=ACTIVE' => 'Y', '=C_SORT' => 555],
|
|
'select' => ['ID', 'NAME', 'STRING_ID'],
|
|
'order' => ['NAME' => 'ASC']
|
|
]);
|
|
$res = [];
|
|
while($g = $rs->fetch()) {
|
|
if($g['STRING_ID']) {
|
|
$res[] = ['id' => $g['ID'], 'name' => $g['NAME'], 'code' => $g['STRING_ID']];
|
|
}
|
|
}
|
|
return $res;
|
|
}
|
|
|
|
/**
|
|
* Возвращает справочники стран и городов для PHP-компонента
|
|
*/
|
|
public static function getGeoForComponent() {
|
|
// 1. Страны (из ядра Битрикс)
|
|
$countries = [];
|
|
$arCountries = GetCountryArray();
|
|
if (is_array($arCountries['reference_id'])) {
|
|
foreach ($arCountries['reference_id'] as $k => $id) {
|
|
$countries[] = [
|
|
'id' => $id,
|
|
'name' => $arCountries['reference'][$k]
|
|
];
|
|
}
|
|
}
|
|
|
|
// 2. Города (из модуля веб-аналитики)
|
|
$cities = [];
|
|
if (Loader::includeModule('statistic')) {
|
|
$rs = \CCity::GetList(['CITY_NAME' => 'ASC'], []);
|
|
while ($el = $rs->Fetch()) {
|
|
if (!empty($el['CITY_NAME'])) {
|
|
$cities[] = $el['CITY_NAME'];
|
|
}
|
|
}
|
|
$cities = array_values(array_unique($cities));
|
|
}
|
|
|
|
return [
|
|
'countries' => $countries,
|
|
'cities' => $cities
|
|
];
|
|
}
|
|
} |