1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
base.php
См. документацию.
1<?php
9
11
12abstract class Base
13{
14 protected $fieldPrefix;
16 protected $fieldValues;
17 protected $fieldFormName;
18 protected $moduleId;
19
21 protected $resultView;
22
25
26 protected bool $checkAccessRights = true;
31 public function setModuleId($moduleId)
32 {
33 $this->moduleId = $moduleId;
34 }
35
39 public function getModuleId()
40 {
41 return $this->moduleId;
42 }
43
49 public function getDataTypeId()
50 {
51 return $this->dataTypeId;
52 }
53
60 public function setDataTypeId($dataTypeId)
61 {
62 $this->dataTypeId = $dataTypeId;
63 }
64
70 {
71 $this->fieldFormName = $fieldFormName;
72 }
73
75 public function getFieldFormName()
76 {
78 }
79
85 {
86 $this->fieldPrefix = $fieldPrefix;
87 }
88
89 public function getFieldPrefix()
90 {
91 return $this->fieldPrefix;
92 }
93
99 {
100 $this->fieldPrefixExtended = $fieldPrefixExtended;
101 }
102
103 public function getFieldPrefixExtended()
104 {
106 }
107
114 public function setFieldValues(array $fieldValues = null)
115 {
116 $this->fieldValues = $fieldValues;
117 }
118
124 public function getFieldValues()
125 {
126 return is_array($this->fieldValues) ? $this->fieldValues : array();
127 }
128
134 public function hasFieldValues()
135 {
136 return count($this->getFieldValues()) > 0;
137 }
138
143 public function getFieldId($id)
144 {
145 $fieldPrefix = $this->getFieldPrefix();
147 if($fieldPrefix)
148 {
149 $moduleId = str_replace('.', '_', $this->getModuleId());
150 return $fieldPrefix . '_' . $moduleId . '_' . $this->getCode() . '_%CONNECTOR_NUM%_' . $id;
151 }
153 {
154 return str_replace(array('][', '[', ']'), array('_', '', ''), $fieldPrefixExtended) .'_'. $id;
155 }
156 else
157 return $id;
158 }
159
164 public function getFieldName($name)
165 {
166 $fieldPrefix = $this->getFieldPrefix();
169 {
170 $arReturnName = array();
171 if($fieldPrefix)
172 $arReturnName[] = $fieldPrefix.'['.$this->getModuleId().']['.$this->getCode().'][%CONNECTOR_NUM%]';
173 else
174 $arReturnName[] = $fieldPrefixExtended;
175
176 $arName = explode('[', $name);
177 $arReturnName[] = '['.$arName[0].']';
178 if(count($arName)>1)
179 {
180 unset($arName[0]);
181 $arReturnName[] = '['.implode('[', $arName);
182 }
183
184 return implode('', $arReturnName);
185 }
186 else
187 return $name;
188 }
189
195 public function getFieldValue($name, $defaultValue = null)
196 {
197 if($this->fieldValues && array_key_exists($name, $this->fieldValues))
198 return $this->fieldValues[$name];
199 else
200 return $defaultValue;
201 }
202
206 public function getId()
207 {
208 return $this->getModuleId().'_'.$this->getCode();
209 }
210
216 public function getDataCount()
217 {
218 return $this->getResult()->getSelectedRowsCount();
219 }
220
226 protected function getDataCountByType()
227 {
228 return null;
229 }
230
236 final function getDataCounter()
237 {
238 $dataCounts = $this->getDataCountByType();
239 if (is_object($dataCounts) && $dataCounts instanceof DataCounter)
240 {
241 return $dataCounts;
242 }
243 else if (!is_array($dataCounts))
244 {
245 $dataCounts = array($this->getDataTypeId() => $this->getDataCount());
246 }
247
248 return new DataCounter($dataCounts);
249 }
250
256 final function getResult()
257 {
258 $personalizeList = array();
259 $personalizeListTmp = $this->getPersonalizeList();
260 foreach($personalizeListTmp as $tag)
261 {
262 if(!empty($tag['ITEMS']))
263 {
264 foreach ($tag['ITEMS'] as $item)
265 {
266 $personalizeList[$item['CODE']] = $item['CODE'];
267 }
268 continue;
269 }
270 if(strlen($tag['CODE']) > 0)
271 {
272 $personalizeList[] = $tag['CODE'];
273 }
274 }
275
276 $result = new Result($this->getData());
277 $result->setFilterFields($personalizeList);
278 $result->setDataTypeId($this->getDataTypeId());
279
280 return $result;
281 }
282
288 public function isResultViewable()
289 {
290 return false;
291 }
292
299 public function getResultView()
300 {
301 if (!$this->resultView)
302 {
303 $this->resultView = new ResultView($this);
304 $this->onInitResultView();
305 }
306
307 return $this->resultView;
308 }
309
316 public function setResultView($resultView)
317 {
318 $this->resultView = $resultView;
319 }
320
321 protected function onInitResultView()
322 {
323
324 }
325
329 public function requireConfigure()
330 {
331 return false;
332 }
333
337 public static function getPersonalizeList()
338 {
339 return array();
340 }
341
345 public abstract function getName();
346
350 public abstract function getCode();
351
357 public abstract function getData();
358
359
360
361 public function buildData()
362 {
363 return null;
364 }
365
369 public abstract function getForm();
370
375 public function getStatFields()
376 {
377 return [];
378 }
379
383 public function isCheckAccessRights(): bool
384 {
386 }
387
393 public function setCheckAccessRights(bool $checkAccessRights): static
394 {
395 $this->checkAccessRights = $checkAccessRights;
396
397 return $this;
398 }
399}
if($_SERVER $defaultValue['REQUEST_METHOD']==="GET" &&!empty($RestoreDefaults) && $bizprocPerms==="W" &&check_bitrix_sessid())
Определения options.php:32
setCheckAccessRights(bool $checkAccessRights)
Определения base.php:393
getFieldPrefixExtended()
Определения base.php:103
setResultView($resultView)
Определения base.php:316
getDataCount()
Определения base.php:216
onInitResultView()
Определения base.php:321
getDataCounter()
Определения base.php:236
$fieldPrefixExtended
Определения base.php:15
bool $checkAccessRights
Определения base.php:26
setFieldValues(array $fieldValues=null)
Определения base.php:114
getFieldName($name)
Определения base.php:164
$fieldFormName
Определения base.php:17
$fieldPrefix
Определения base.php:14
hasFieldValues()
Определения base.php:134
$fieldValues
Определения base.php:16
isResultViewable()
Определения base.php:288
getDataTypeId()
Определения base.php:49
$resultView
Определения base.php:21
isCheckAccessRights()
Определения base.php:383
getFieldValues()
Определения base.php:124
setFieldPrefix($fieldPrefix)
Определения base.php:84
setModuleId($moduleId)
Определения base.php:31
$dataTypeId
Определения base.php:24
getResultView()
Определения base.php:299
getFieldFormName()
Определения base.php:75
setFieldFormName($fieldFormName)
Определения base.php:69
getStatFields()
Определения base.php:375
buildData()
Определения base.php:361
getFieldPrefix()
Определения base.php:89
getModuleId()
Определения base.php:39
getDataCountByType()
Определения base.php:226
setFieldPrefixExtended($fieldPrefixExtended)
Определения base.php:98
getFieldId($id)
Определения base.php:143
setDataTypeId($dataTypeId)
Определения base.php:60
requireConfigure()
Определения base.php:329
static getPersonalizeList()
Определения base.php:337
getResult()
Определения base.php:256
getFieldValue($name, $defaultValue=null)
Определения base.php:195
const EMAIL
Определения type.php:21
</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
$name
Определения menu_edit.php:35
Определения base.php:8
Class ResultView
Определения resultview.php:19
Определения agent.php:8
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
</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