1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
config.php
См. документацию.
1<?php
2namespace Bitrix\MobileApp\Designer;
3
4use Bitrix\Main\Entity;
5use Bitrix\Main\Entity\Event;
6use Bitrix\Main\Entity\FieldError;
7use Bitrix\Main\Entity\Result;
8use Bitrix\Main\Entity\ScalarField;
9use Bitrix\Main\Localization\Loc;
10use Bitrix\Main;
11
12Loc::loadMessages(__FILE__);
13
41class ConfigTable extends Entity\DataManager
42{
43 public static function getFilePath()
44 {
45 return __FILE__;
46 }
47
48 public static function getTableName()
49 {
50 return 'b_mobileapp_config';
51 }
52
53 public static function getMap()
54 {
55 return array(
56 new Entity\StringField('APP_CODE',array(
57 'primary' => true,
58 'validation' => array(__CLASS__, 'validateAppCode'),
59 'title' => Loc::getMessage('CONFIG_ENTITY_APP_CODE_FIELD'),
60 )),
61 new Entity\StringField('PLATFORM',array(
62 'primary' => true,
63 'validation' => array(__CLASS__, 'validatePlatform'),
64 'title' => Loc::getMessage('CONFIG_ENTITY_PLATFORM_FIELD'),
65 )),
66 new Entity\TextField('PARAMS', array(
67 'serialized' => true,
68 'title' => Loc::getMessage('CONFIG_ENTITY_PARAMS_FIELD'),
69 )),
70
71 new Entity\DatetimeField('DATE_CREATE',array(
72 'default_value' => new \Bitrix\Main\Type\DateTime,
73 'title' => Loc::getMessage('CONFIG_ENTITY_DATE_CREATE_FIELD'),
74 )),
75 new Entity\ReferenceField(
76 'APP',
77 'Bitrix\MobileApp\AppTable',
78 array('=this.APP_CODE' => 'ref.CODE')
79 )
80 );
81 }
82
83 public static function validateAppCode()
84 {
85 return array(
86 new Entity\Validator\Length(null, 255),
87 );
88 }
89
90
91 public static function validatePlatform()
92 {
93 return array(
94 new Entity\Validator\Length(null, 255),
95 );
96 }
97
98
99 public static function getSupportedPlatforms()
100 {
101 $platforms = AppTable::getSupportedPlatforms();
102 $platforms[] = "global";
103 return $platforms;
104 }
105
106 public static function checkFields(Result $result, $primary, array $data)
107 {
108 parent::checkFields($result, $primary, $data);
109 $availablePlatforms = self::getSupportedPlatforms();
110
111 if( $result instanceof Entity\AddResult)
112 {
113 $entity = self::getEntity();
114 if(!$data["APP_CODE"])
115 {
116 $result->addError(new Entity\FieldError($entity->getField("APP_CODE"),"Can not be empty!", 1));
117 }
118 else if (!$data["PLATFORM"])
119 {
120 $result->addError(new Entity\FieldError($entity->getField("PLATFORM"), "Can not be empty!", 1));
121 }
122 elseif(!in_array($data["PLATFORM"], $availablePlatforms))
123 {
124 $result->addError(new Entity\FieldError($entity->getField("PLATFORM"), "The passed value in not available!", 1));
125 }
126
127 $selectResult = self::getList(array(
128 "filter"=>array(
129 "APP_CODE"=>$data["APP_CODE"],
130 "PLATFORM"=>$data["PLATFORM"]
131 )
132 ));
133
134 if($selectResult->getSelectedRowsCount() > 0)
135 {
136 $result->addError(new Entity\EntityError("Such configuration is already exists!", 1000));
137 }
138 }
139 }
140
141 public static function isExists($appCode, $platform)
142 {
143 //this is not such heavy operation as it might be expected
144 $config = self::getRowById(Array("APP_CODE" => $appCode, "PLATFORM" => $platform));
145 return (is_array($config) && count($config) > 0);
146 }
147}
148
static getSupportedPlatforms()
Определения app.php:177
static getMap()
Определения config.php:53
static validateAppCode()
Определения config.php:83
static getFilePath()
Определения config.php:43
static validatePlatform()
Определения config.php:91
static isExists($appCode, $platform)
Определения config.php:141
static checkFields(Result $result, $primary, array $data)
Определения config.php:106
static getSupportedPlatforms()
Определения config.php:99
static getTableName()
Определения config.php:48
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$entity
$platform
Определения settings.php:7
Определения ufield.php:9
Определения collection.php:2
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$config
Определения quickway.php:69
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936