Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
agreement.php
1<?php
9
16
17Loc::loadMessages(__FILE__);
18
35class AgreementTable extends Entity\DataManager
36{
42 public static function getTableName()
43 {
44 return 'b_consent_agreement';
45 }
46
52 public static function getMap()
53 {
54 return array(
55 'ID' => array(
56 'data_type' => 'integer',
57 'primary' => true,
58 'autocomplete' => true,
59 ),
60 'CODE' => array(
61 'data_type' => 'string',
62 ),
63 'DATE_INSERT' => array(
64 'data_type' => 'datetime',
65 'required' => true,
66 'default_value' => new DateTime(),
67 ),
68 'ACTIVE' => array(
69 'data_type' => 'boolean',
70 'required' => true,
71 'default_value' => Agreement::ACTIVE,
73 ),
74 'NAME' => array(
75 'data_type' => 'string',
76 'required' => true,
77 'title' => Loc::getMessage('MAIN_USER_CONSENT_TBL_AGREEMENT_FIELD_TITLE_NAME'),
78 ),
79 'TYPE' => array(
80 'data_type' => 'string',
81 'required' => true,
82 'default_value' => Agreement::TYPE_STANDARD,
84 ),
85 'LANGUAGE_ID' => array(
86 'data_type' => 'string',
87 ),
88 'DATA_PROVIDER' => array(
89 'data_type' => 'string',
90 ),
91 'AGREEMENT_TEXT' => array(
92 'data_type' => 'text',
93 ),
94 'LABEL_TEXT' => array(
95 'data_type' => 'string',
96 ),
97 'SECURITY_CODE' => array(
98 'data_type' => 'string',
99 'default_value' => function()
100 {
101 return Random::getString(6);
102 }
103 ),
104 'USE_URL' => [
105 'data_type' => 'boolean',
106 'default_value' => 'N',
107 'values' => ['Y', 'N']
108 ],
109 'URL' => [
110 'data_type' => 'string',
111 ],
112 'IS_AGREEMENT_TEXT_HTML' => [
113 'data_type' => 'boolean',
114 'default_value' => 'N',
115 'values' => ['Y', 'N']
116 ],
117 );
118 }
119
126 public static function onAfterDelete(Entity\Event $event)
127 {
128 $result = new Entity\EventResult;
129 $data = $event->getParameters();
130
131 $sql = "DELETE FROM " . ConsentTable::getTableName() . " WHERE AGREEMENT_ID = " . intval($data['primary']['ID']);
132 Application::getConnection()->query($sql);
133
134 return $result;
135 }
136}
static getConnection($name="")
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29