1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
component_template.php
См. документацию.
1<?php
2
9
12
14 "php" => [
15 "templateExt" => ["php"],
16 "function" => "",
17 "sort" => 100,
18 ],
19];
20
22
24{
25 public $__name = "";
26 public $__page = "";
27 public $__engineID = "";
28 public $__file = "";
29 public $__fileAlt = "";
30 public $__folder = "";
31 public $__siteTemplate = "";
32 public $__templateInTheme = false;
33 public $__hasCSS = null;
34 public $__hasJS = null;
36 public $__component = null;
37 public $__bInited = false;
38 private $__view = [];
40 private $frames = [];
41 private $frameMode = null;
42 private $languageId = false;
43 private $externalCss = [];
44 private $externalJs = [];
45
46 public function __construct()
47 {
48 $this->__bInited = false;
49
50 $this->__file = "";
51 $this->__fileAlt = "";
52 $this->__folder = "";
53 }
54
64 public function GetName()
65 {
66 if (!$this->__bInited)
67 {
68 return null;
69 }
70
71 return $this->__name;
72 }
73
83 public function GetPageName()
84 {
85 if (!$this->__bInited)
86 {
87 return null;
88 }
89
90 return $this->__page;
91 }
92
102 public function GetFile()
103 {
104 if (!$this->__bInited)
105 {
106 return null;
107 }
108
109 return $this->__file;
110 }
111
121 public function GetFolder()
122 {
123 if (!$this->__bInited)
124 {
125 return null;
126 }
127
128 return $this->__folder;
129 }
130
140 public function GetSiteTemplate()
141 {
142 if (!$this->__bInited)
143 {
144 return null;
145 }
146
147 return $this->__siteTemplate;
148 }
149
159 public function IsInTheme()
160 {
161 if (!$this->__bInited)
162 {
163 return null;
164 }
165
166 return $this->__templateInTheme;
167 }
168
176 public function setLanguageId($languageId)
177 {
178 $this->languageId = $languageId;
179 }
180
188 public function getLanguageId()
189 {
190 return $this->languageId;
191 }
192
203 public function GetCachedData()
204 {
205 if (!$this->__bInited)
206 {
207 return null;
208 }
209
210 $arReturn = [];
211
212 if ($this->__folder <> '')
213 {
214 $fname = $_SERVER["DOCUMENT_ROOT"] . $this->__folder . "/style.css";
215 if (file_exists($fname))
216 {
217 $arReturn["additionalCSS"] = $this->__folder . "/style.css";
218 }
219
220 $fname = $_SERVER["DOCUMENT_ROOT"] . $this->__folder . "/script.js";
221 if (file_exists($fname))
222 {
223 $arReturn["additionalJS"] = $this->__folder . "/script.js";
224 }
225 }
226
227 if (!empty($this->frames))
228 {
229 $arReturn["frames"] = [];
230 foreach ($this->frames as $frame)
231 {
232 $arReturn["frames"][] = $frame->getCachedData();
233 }
234 }
235
236 $arReturn["frameMode"] = $this->frameMode;
237 if (!$this->frameMode)
238 {
239 $arReturn["frameModeCtx"] = $this->__file;
240 }
241
242 if ($this->externalCss)
243 {
244 $arReturn["externalCss"] = $this->externalCss;
245 }
246
247 if ($this->externalJs)
248 {
249 $arReturn["externalJs"] = $this->externalJs;
250 }
251
252 return $arReturn;
253 }
254
263 public function ApplyCachedData($arData)
264 {
266 global $APPLICATION;
267
268 if ($arData && is_array($arData))
269 {
270 if (array_key_exists("additionalCSS", $arData) && $arData["additionalCSS"] <> '')
271 {
272 $APPLICATION->SetAdditionalCSS($arData["additionalCSS"]);
273 //Check if parent component exists and plug css it to it's "collection"
274 if ($this->__component && $this->__component->__parent)
275 {
276 $this->__component->__parent->addChildCSS($this->__folder . "/style.css");
277 }
278 }
279
280 if (array_key_exists("additionalJS", $arData) && $arData["additionalJS"] <> '')
281 {
282 $APPLICATION->AddHeadScript($arData["additionalJS"]);
283 //Check if parent component exists and plug js it to it's "collection"
284 if ($this->__component && $this->__component->__parent)
285 {
286 $this->__component->__parent->addChildJS($this->__folder . "/script.js");
287 }
288 }
289
290 if (array_key_exists("frames", $arData) && is_array($arData["frames"]))
291 {
292 foreach ($arData["frames"] as $frameState)
293 {
295 if ($this->__component && $this->__component->__parent)
296 {
297 $this->__component->__parent->addChildFrame($frame);
298 }
299 }
300 }
301
302 if (array_key_exists("frameMode", $arData))
303 {
304 $this->setFrameMode($arData["frameMode"]);
305
306 if ($this->getFrameMode() === false)
307 {
308 $context = isset($arData["frameModeCtx"]) ? "(from component cache) " . $arData["frameModeCtx"] : "";
310 $page->giveNegativeComponentVote($context);
311 }
312 }
313
314 if (isset($arData["externalCss"]))
315 {
316 foreach ($arData["externalCss"] as $cssPath)
317 {
318 $APPLICATION->SetAdditionalCSS($cssPath);
319 //Check if parent component exists and plug css it to it's "collection"
320 if ($this->__component && $this->__component->__parent)
321 {
322 $this->__component->__parent->addChildCSS($cssPath);
323 }
324 }
325 }
326
327 if (isset($arData["externalJs"]))
328 {
329 foreach ($arData["externalJs"] as $jsPath)
330 {
331 $APPLICATION->AddHeadScript($jsPath);
332 //Check if parent component exists and plug js it to it's "collection"
333 if ($this->__component && $this->__component->__parent)
334 {
335 $this->__component->__parent->addChildJS($jsPath);
336 }
337 }
338 }
339 }
340 }
341
349 public function InitTemplateEngines($arTemplateEngines = [])
350 {
352
353 if (
354 array_key_exists("arCustomTemplateEngines", $GLOBALS)
355 && is_array($GLOBALS["arCustomTemplateEngines"])
356 && !empty($GLOBALS["arCustomTemplateEngines"])
357 )
358 {
360 }
361
362 if (is_array($arTemplateEngines) && !empty($arTemplateEngines))
363 {
365 }
366
368
370
371 foreach ($arBXAvailableTemplateEngines as $engineID => $engineValue)
372 {
373 foreach ($engineValue["templateExt"] as $ext)
374 {
375 $arBXRuntimeTemplateEngines[$ext] = $engineID;
376 }
377 }
378 }
379
390 public function Init(&$component, $siteTemplate = false, $customTemplatePath = "")
391 {
393
394 $this->__bInited = false;
395
396 if ($siteTemplate === false)
397 {
398 $this->__siteTemplate = $component->getSiteTemplateId();
399 }
400 else
401 {
402 $this->__siteTemplate = $siteTemplate;
403 }
404
405 if ($this->__siteTemplate == '')
406 {
407 $this->__siteTemplate = ".default";
408 }
409
410 $this->__file = "";
411 $this->__fileAlt = "";
412 $this->__folder = "";
413
415 {
416 $this->InitTemplateEngines();
417 }
418
419 if (!($component instanceof cbitrixcomponent))
420 {
421 return false;
422 }
423
424 $this->__component = &$component;
425
426 $this->__name = $this->__component->GetTemplateName();
427 if ($this->__name == '')
428 {
429 $this->__name = ".default";
430 }
431
432 $this->__name = preg_replace("'[\\\\/]+'", "/", $this->__name);
433 $this->__name = trim($this->__name, "/");
434
435 if (!self::CheckName($this->__name))
436 {
437 $this->__name = ".default";
438 }
439
440 $this->__page = $this->__component->GetTemplatePage();
441 if ($this->__page == '')
442 {
443 $this->__page = "template";
444 }
445
446 if (!$this->__SearchTemplate($customTemplatePath))
447 {
448 return false;
449 }
450
451 $this->__GetTemplateEngine();
452
453 $this->__bInited = true;
454
455 return true;
456 }
457
466 public static function CheckName($name)
467 {
468 return preg_match("#^([A-Za-z0-9_.-]+)(/[A-Za-z0-9_.-]+)?$#i", $name) > 0;
469 }
470
480 {
482
484 {
485 $this->InitTemplateEngines();
486 }
487
488 $filePath = $_SERVER["DOCUMENT_ROOT"] . $path . "/" . $fileName . ".php";
489 if (count($arBXRuntimeTemplateEngines) === 1 && file_exists($filePath) && is_file($filePath))
490 {
491 return $fileName . ".php";
492 }
493 else
494 {
495 foreach ($arBXRuntimeTemplateEngines as $templateExt => $engineID)
496 {
497 $filePath = $_SERVER["DOCUMENT_ROOT"] . $path . "/" . $fileName . "." . $templateExt;
498 if (file_exists($filePath) && is_file($filePath))
499 {
500 return $fileName . "." . $templateExt;
501 }
502 }
503 }
504
505 return false;
506 }
507
512 public function hasTemplate(): bool
513 {
514 $folders = $this->generatePossibleTemplatePath();
515 foreach ($folders as $folder)
516 {
517 if (is_dir($_SERVER["DOCUMENT_ROOT"] . $folder["path"] . "/" . $this->__name))
518 {
519 return true;
520 }
521 }
522 return false;
523 }
524
530 public function hasTemplatePage(string $templatePage): bool
531 {
532 $ext = '.php';
533 $delimeter = '/';
534
535 $folders = $this->generatePossibleTemplatePath();
536 foreach ($folders as $folder)
537 {
538 $folderPath = $_SERVER["DOCUMENT_ROOT"] . $folder["path"];
539 $pageName = $templatePage . $ext;
540 if (file_exists(implode($delimeter, [$folderPath, $this->__name, $pageName])))
541 {
542 return true;
543 }
544 }
545 return false;
546 }
547
552 {
553 $component = $this->getComponent();
554 $arFolders = [];
555 $relativePath = $component->GetRelativePath();
556 $parentComponent = $component->GetParent();
557 $siteTemplate = $component->getSiteTemplateId();
558
559 $defSiteTemplate = ($siteTemplate == ".default");
560 $parentTemplatePath = '';
561 $parentRelativePath = '';
562 if ($parentComponent && $parentComponent->GetTemplate())
563 {
564 $parentRelativePath = $parentComponent->GetRelativePath();
565 $parentTemplateName = $parentComponent->GetTemplate()->GetName();
566 if ($parentTemplateName <> '')
567 {
568 $parentTemplatePath = "/" . $parentTemplateName;
569 }
570
571 if (!$defSiteTemplate)
572 {
573 $arFolders[] = [
574 "path" => "/local/templates/" . $siteTemplate . "/components" . $parentRelativePath . $parentTemplatePath . $relativePath,
575 "in_theme" => true,
576 ];
577 }
578 $arFolders[] = [
579 "path" => "/local/templates/.default/components" . $parentRelativePath . $parentTemplatePath . $relativePath,
580 "in_theme" => true,
581 "site_template" => ".default",
582 ];
583 $arFolders[] = [
584 "path" => "/local/components" . $parentRelativePath . "/templates" . $parentTemplatePath . $relativePath,
585 "in_theme" => true,
586 "site_template" => "",
587 ];
588 }
589 if (!$defSiteTemplate)
590 {
591 $arFolders[] = [
592 "path" => "/local/templates/" . $siteTemplate . "/components" . $relativePath,
593 ];
594 }
595 $arFolders[] = [
596 "path" => "/local/templates/.default/components" . $relativePath,
597 "site_template" => ".default",
598 ];
599 $arFolders[] = [
600 "path" => "/local/components" . $relativePath . "/templates",
601 "site_template" => "",
602 ];
603
604 if ($parentComponent)
605 {
606 if (!$defSiteTemplate)
607 {
608 $arFolders[] = [
609 "path" => BX_PERSONAL_ROOT . "/templates/" . $siteTemplate . "/components" . $parentRelativePath . $parentTemplatePath . $relativePath,
610 "in_theme" => true,
611 ];
612 }
613 $arFolders[] = [
614 "path" => BX_PERSONAL_ROOT . "/templates/.default/components" . $parentRelativePath . $parentTemplatePath . $relativePath,
615 "in_theme" => true,
616 "site_template" => ".default",
617 ];
618 $arFolders[] = [
619 "path" => "/bitrix/components" . $parentRelativePath . "/templates" . $parentTemplatePath . $relativePath,
620 "in_theme" => true,
621 "site_template" => "",
622 ];
623 }
624 if (!$defSiteTemplate)
625 {
626 $arFolders[] = [
627 "path" => BX_PERSONAL_ROOT . "/templates/" . $siteTemplate . "/components" . $relativePath,
628 ];
629 }
630 $arFolders[] = [
631 "path" => BX_PERSONAL_ROOT . "/templates/.default/components" . $relativePath,
632 "site_template" => ".default",
633 ];
634 $arFolders[] = [
635 "path" => "/bitrix/components" . $relativePath . "/templates",
636 "site_template" => "",
637 ];
638
639 return $arFolders;
640 }
641//AddEventHandler("main", "OnUserTypeBuildList", array("CUserTypeWebdavElement", "GetUserTypeDescription"));
642
664 public function __SearchTemplate($customTemplatePath = "")
665 {
666 $this->__file = "";
667 $this->__fileAlt = "";
668 $this->__folder = "";
669 $this->__hasCSS = null;
670 $this->__hasJS = null;
671
672 $relativePath = $this->__component->GetRelativePath();
673
674 $parentRelativePath = "";
675 $parentTemplateName = "";
676
677 $parentComponent = $this->__component->GetParent();
678
679 if ($parentComponent && $parentComponent->GetTemplate())
680 {
681 $parentRelativePath = $parentComponent->GetRelativePath();
682 $parentTemplateName = $parentComponent->GetTemplate()->GetName();
683 }
684
685 $arFolders = $this->generatePossibleTemplatePath();
686
687 if ($customTemplatePath <> '' && $templatePageFile = $this->__SearchTemplateFile($customTemplatePath, $this->__page))
688 {
689 $this->__fileAlt = $customTemplatePath . "/" . $templatePageFile;
690
691 foreach ($arFolders as $folder)
692 {
693 if (is_dir($_SERVER["DOCUMENT_ROOT"] . $folder["path"] . "/" . $this->__name))
694 {
695 $this->__file = $folder["path"] . "/" . $this->__name . "/" . $templatePageFile;
696 $this->__folder = $folder["path"] . "/" . $this->__name;
697 }
698
699 if ($this->__file <> '')
700 {
701 if (isset($folder["site_template"]))
702 {
703 $this->__siteTemplate = $folder["site_template"];
704 }
705
706 if (isset($folder["in_theme"]) && $folder["in_theme"] === true)
707 {
708 $this->__templateInTheme = true;
709 }
710 else
711 {
712 $this->__templateInTheme = false;
713 }
714
715 break;
716 }
717 }
718 return ($this->__file <> '');
719 }
720
721 static $cache = [];
722 $cache_id = $relativePath . "|" . $this->__siteTemplate . "|" . $parentRelativePath . "|" . $parentTemplateName . "|" . $this->__page . "|" . $this->__name;
723 if (!isset($cache[$cache_id]))
724 {
725 foreach ($arFolders as $folder)
726 {
727 $fname = $folder["path"] . "/" . $this->__name;
728 if (file_exists($_SERVER["DOCUMENT_ROOT"] . $fname))
729 {
730 if (is_dir($_SERVER["DOCUMENT_ROOT"] . $fname))
731 {
732 if ($templatePageFile = $this->__SearchTemplateFile($fname, $this->__page))
733 {
734 $this->__file = $fname . "/" . $templatePageFile;
735 $this->__folder = $fname;
736 $this->__hasCSS = file_exists($_SERVER["DOCUMENT_ROOT"] . $fname . "/style.css");
737 $this->__hasJS = file_exists($_SERVER["DOCUMENT_ROOT"] . $fname . "/script.js");
738 }
739 }
740 elseif (is_file($_SERVER["DOCUMENT_ROOT"] . $fname))
741 {
742 $this->__file = $fname;
743 if (str_contains($this->__name, "/"))
744 {
745 $this->__folder = $folder["path"] . "/" . mb_substr($this->__name, 0, bxstrrpos($this->__name, "/"));
746 }
747 }
748 }
749 else
750 {
751 if ($templatePageFile = $this->__SearchTemplateFile($folder["path"], $this->__name))
752 {
753 $this->__file = $folder["path"] . "/" . $templatePageFile;
754 }
755 }
756
757 if ($this->__file != "")
758 {
759 if (isset($folder["site_template"]))
760 {
761 $this->__siteTemplate = $folder["site_template"];
762 }
763
764 if (isset($folder["in_theme"]) && $folder["in_theme"] === true)
765 {
766 $this->__templateInTheme = true;
767 }
768 else
769 {
770 $this->__templateInTheme = false;
771 }
772
773 break;
774 }
775 }
776 $cache[$cache_id] = [
777 $this->__folder,
778 $this->__file,
779 $this->__siteTemplate,
780 $this->__templateInTheme,
781 $this->__hasCSS,
782 $this->__hasJS,
783 ];
784 }
785 else
786 {
787 $this->__folder = $cache[$cache_id][0];
788 $this->__file = $cache[$cache_id][1];
789 $this->__siteTemplate = $cache[$cache_id][2];
790 $this->__templateInTheme = $cache[$cache_id][3];
791 $this->__hasCSS = $cache[$cache_id][4];
792 $this->__hasJS = $cache[$cache_id][5];
793 }
794 return ($this->__file != "");
795 }
796
810 public function __IncludePHPTemplate(&$arResult, &$arParams, $parentTemplateFolder = "")
811 {
813 global $APPLICATION, $USER, $DB;
814
815 static $exists = [];
816
817 if (!$this->__bInited)
818 {
819 return false;
820 }
821
822 // these vars are used in the template file
824 $templateName = $this->__name;
826 $templateFile = $this->__file;
828 $templateFolder = $this->__folder;
830 $componentPath = $this->__component->GetPath();
831
832 $component = &$this->__component;
833
834 if ($this->__fileAlt <> '')
835 {
836 include($_SERVER["DOCUMENT_ROOT"] . $this->__fileAlt);
837 return null;
838 }
839
840 $templateData = false;
841
842 include($_SERVER["DOCUMENT_ROOT"] . $this->__file);
843
844 for ($i = count($this->frames) - 1; $i >= 0; $i--)
845 {
846 $frame = $this->frames[$i];
847 if ($frame->isStarted() && !$frame->isEnded())
848 {
849 $frame->end();
850 }
851 }
852
853 if (!$this->getFrameMode())
854 {
856 $page->giveNegativeComponentVote($this->__file);
857 }
858
859 $component_epilog = $this->__folder . "/component_epilog.php";
860
861 if (!isset($exists[$component_epilog]))
862 {
863 $exists[$component_epilog] = file_exists($_SERVER["DOCUMENT_ROOT"] . $component_epilog);
864 }
865
866 if ($exists[$component_epilog])
867 {
868 //These will be available with extract then component will
869 //execute epilog without template
870 $component->SetTemplateEpilog([
871 "epilogFile" => $component_epilog,
872 "templateName" => $this->__name,
873 "templateFile" => $this->__file,
874 "templateFolder" => $this->__folder,
875 "templateData" => $templateData,
876 ]);
877 }
878 return null;
879 }
880
890 public function IncludeTemplate(&$arResult)
891 {
893
894 if (!$this->__bInited)
895 {
896 return false;
897 }
898
899 $arLangMessages = null;
900 $externalEngine = ($arBXAvailableTemplateEngines[$this->__engineID]["function"] <> '' && function_exists($arBXAvailableTemplateEngines[$this->__engineID]["function"]));
901
902 $arParams = $this->__component->arParams;
903
904 if ($this->__folder <> '')
905 {
906 if ($externalEngine)
907 {
908 $arLangMessages = $this->IncludeLangFile("", false, true);
909 }
910 else
911 {
912 $this->IncludeLangFile();
913 }
915 if (!isset($this->__hasCSS) || $this->__hasCSS)
916 {
917 $this->__IncludeCSSFile();
918 }
919 if (!isset($this->__hasJS) || $this->__hasJS)
920 {
921 $this->__IncludeJSFile();
922 }
923 }
924
925 $parentTemplateFolder = "";
926 $parentComponent = $this->__component->GetParent();
927 if ($parentComponent)
928 {
929 $parentTemplate = $parentComponent->GetTemplate();
930 if ($parentTemplate)
931 {
932 $parentTemplateFolder = $parentTemplate->GetFolder();
933 }
934 }
935
936 if ($externalEngine)
937 {
938 $result = call_user_func(
939 $arBXAvailableTemplateEngines[$this->__engineID]["function"],
940 $this->__file,
941 $arResult,
942 $arParams,
943 $arLangMessages,
944 $this->__folder,
945 $parentTemplateFolder,
946 $this
947 );
948 }
949 else
950 {
951 $result = $this->__IncludePHPTemplate($arResult, $arParams, $parentTemplateFolder);
952 }
953
954 return $result;
955 }
956
966 public function IncludeLangFile($relativePath = "", $lang = false, $return = false)
967 {
968 $arLangMessages = [];
969
970 if ($this->__folder <> '')
971 {
972 if ($relativePath == "")
973 {
974 $relativePath = bx_basename($this->__file);
975 }
976
977 $absPath = $_SERVER["DOCUMENT_ROOT"] . $this->__folder . "/" . $relativePath;
978
979 if ($lang === false && $return === false)
980 {
982 }
983 else
984 {
985 if ($lang === false)
986 {
987 $lang = $this->getLanguageId();
988 }
989 $arLangMessages = \Bitrix\Main\Localization\Loc::loadLanguageFile($absPath, $lang);
990 }
991 }
992
993 return $arLangMessages;
994 }
995
1004 {
1006 global $APPLICATION, $USER, $DB;
1007
1008 static $exists = [];
1009
1010 if ($this->__folder <> '')
1011 {
1012 $resultModifier = $this->__folder . "/result_modifier.php";
1013 if (!isset($exists[$resultModifier]))
1014 {
1015 $exists[$resultModifier] = file_exists($_SERVER["DOCUMENT_ROOT"] . $resultModifier);
1016 }
1017 if ($exists[$resultModifier])
1018 {
1019 include $_SERVER["DOCUMENT_ROOT"] . $resultModifier;
1020 }
1021 }
1022 }
1023
1028 public function __IncludeCSSFile()
1029 {
1031 global $APPLICATION;
1032
1033 if ($this->__folder <> '')
1034 {
1035 if (
1036 $this->__hasCSS
1037 || file_exists($_SERVER["DOCUMENT_ROOT"] . $this->__folder . "/style.css")
1038 )
1039 {
1040 $APPLICATION->SetAdditionalCSS($this->__folder . "/style.css");
1041
1042 //Check if parent component exists and plug css it to it's "collection"
1043 if ($this->__component && $this->__component->__parent)
1044 {
1045 $this->__component->__parent->addChildCSS($this->__folder . "/style.css");
1046 }
1047 }
1048 }
1049 }
1050
1055 public function __IncludeJSFile()
1056 {
1058 global $APPLICATION;
1059
1060 if ($this->__folder <> '')
1061 {
1062 if (
1063 $this->__hasJS
1064 || file_exists($_SERVER["DOCUMENT_ROOT"] . $this->__folder . "/script.js")
1065 )
1066 {
1067 $APPLICATION->AddHeadScript($this->__folder . "/script.js");
1068 //Check if parent component exists and plug js it to it's "collection"
1069 if ($this->__component && $this->__component->__parent)
1070 {
1071 $this->__component->__parent->addChildJS($this->__folder . "/script.js");
1072 }
1073 }
1074 }
1075 }
1076
1083 public function __GetTemplateExtension($templateName)
1084 {
1085 $templateName = trim($templateName, ". \r\n\t");
1086 $arTemplateName = explode(".", $templateName);
1087 return mb_strtolower($arTemplateName[count($arTemplateName) - 1]);
1088 }
1089
1095 {
1097
1099 {
1100 $this->InitTemplateEngines();
1101 }
1102
1103 $templateExt = $this->__GetTemplateExtension($this->__file);
1104
1105 if (array_key_exists($templateExt, $arBXRuntimeTemplateEngines))
1106 {
1107 $this->__engineID = $arBXRuntimeTemplateEngines[$templateExt];
1108 }
1109 else
1110 {
1111 $this->__engineID = "php";
1112 }
1113 }
1114
1125 public function SetViewTarget($target, $pos = 500)
1126 {
1127 $this->EndViewTarget();
1128 $view = &$this->__view;
1129
1130 if (!isset($view[$target]))
1131 {
1132 $view[$target] = [];
1133 }
1134 $view[$target][] = [false, $pos];
1135
1136 ob_start();
1137 }
1138
1146 public function EndViewTarget()
1147 {
1149 global $APPLICATION;
1150
1151 $view = &$this->__view;
1152 if (!empty($view))
1153 {
1154 //Get the key to last started view target
1155 end($view);
1156 $target_key = key($view);
1157
1158 //Get the key to last added "sub target"
1159 //in most cases there will be only one
1160 end($view[$target_key]);
1161 $sub_target_key = key($view[$target_key]);
1162
1163 $sub_target = &$view[$target_key][$sub_target_key];
1164 if ($sub_target[0] === false)
1165 {
1166 $sub_target[0] = ob_get_contents();
1167 $APPLICATION->AddViewContent($target_key, $sub_target[0], $sub_target[1]);
1168 $this->__component->addViewTarget($target_key, $sub_target[0], $sub_target[1]);
1169 ob_end_clean();
1170 }
1171 }
1172 }
1173
1197 public function AddEditAction($entryId, $editLink, $editTitle = false, $arParams = [])
1198 {
1199 $this->__component->addEditButton(['AddEditAction', $entryId, $editLink, $editTitle, $arParams]);
1200 }
1201
1218 public function AddDeleteAction($entryId, $deleteLink, $deleteTitle = false, $arParams = [])
1219 {
1220 $this->__component->addEditButton(['AddDeleteAction', $entryId, $deleteLink, $deleteTitle, $arParams]);
1221 }
1222
1235 public function GetEditAreaId($entryId)
1236 {
1237 return $this->__component->GetEditAreaId($entryId);
1238 }
1239
1248 public function randString($length = 6)
1249 {
1250 return $this->__component->randString($length);
1251 }
1252
1260 public function setFrameMode($mode)
1261 {
1262 if (in_array($mode, [true, false, null], true))
1263 {
1264 $this->frameMode = $mode;
1265 }
1266 }
1267
1272 public function getFrameMode()
1273 {
1274 if ($this->frameMode !== null)
1275 {
1276 return $this->frameMode;
1277 }
1278
1279 if (!$this->__component)
1280 {
1281 //somebody has stolen the instance of component
1282 return false;
1283 }
1284
1285 $frameMode = $this->__component->getDefaultFrameMode();
1286 if ($frameMode === null)
1287 {
1288 $frameMode = false;
1289 }
1290
1291 return $frameMode;
1292 }
1293
1294 public function getRealFrameMode()
1295 {
1296 return $this->frameMode;
1297 }
1298
1314 public function createFrame($id = null, $autoContainer = true)
1315 {
1316 $this->frameMode = true;
1317 if (!is_string($id) || $id == '')
1318 {
1319 $id = $this->randString();
1320 }
1321
1322 $frame = new Bitrix\Main\Composite\BufferArea($id, $autoContainer);
1323 $this->frames[] = $frame;
1324
1325 if ($this->__component && $this->__component->__parent)
1326 {
1327 $this->__component->__parent->addChildFrame($frame);
1328 }
1329
1330 return $frame;
1331 }
1332
1342 public function addExternalCss($cssPath)
1343 {
1345 global $APPLICATION;
1346 $this->externalCss[] = $cssPath;
1347 $APPLICATION->SetAdditionalCSS($cssPath);
1348 //Check if parent component exists and plug css it to it's "collection"
1349 if ($this->__component && $this->__component->__parent)
1350 {
1351 $this->__component->__parent->addChildCSS($cssPath);
1352 }
1353 }
1354
1364 public function addExternalJs($jsPath)
1365 {
1367 global $APPLICATION;
1368 $this->externalJs[] = $jsPath;
1369 $APPLICATION->AddHeadScript($jsPath);
1370 //Check if parent component exists and plug js it to it's "collection"
1371 if ($this->__component && $this->__component->__parent)
1372 {
1373 $this->__component->__parent->addChildJS($jsPath);
1374 }
1375 }
1376
1381 public function getComponent()
1382 {
1383 return $this->__component;
1384 }
1385}
$arParams
Определения access_dialog.php:21
$path
Определения access_edit.php:21
global $APPLICATION
Определения include.php:80
$arResult
Определения generate_coupon.php:16
static getInstance()
Определения page.php:76
static applyCachedData($cachedData)
Определения staticarea.php:222
static loadLanguageFile($file, $language=null, $normalize=true)
Определения loc.php:225
static loadMessages($file)
Определения loc.php:65
static sortByColumn(array &$array, $columns, $callbacks='', $defaultValueIfNotSetValue=null, $preserveKeys=false)
Определения collection.php:24
AddDeleteAction($entryId, $deleteLink, $deleteTitle=false, $arParams=[])
Определения component_template.php:1218
InitTemplateEngines($arTemplateEngines=[])
Определения component_template.php:349
randString($length=6)
Определения component_template.php:1248
setLanguageId($languageId)
Определения component_template.php:176
IncludeTemplate(&$arResult)
Определения component_template.php:890
hasTemplatePage(string $templatePage)
Определения component_template.php:530
__SearchTemplateFile($path, $fileName)
Определения component_template.php:479
ApplyCachedData($arData)
Определения component_template.php:263
GetEditAreaId($entryId)
Определения component_template.php:1235
IncludeLangFile($relativePath="", $lang=false, $return=false)
Определения component_template.php:966
__SearchTemplate($customTemplatePath="")
Определения component_template.php:664
__IncludeMutatorFile(&$arResult, &$arParams)
Определения component_template.php:1003
__IncludePHPTemplate(&$arResult, &$arParams, $parentTemplateFolder="")
Определения component_template.php:810
createFrame($id=null, $autoContainer=true)
Определения component_template.php:1314
static CheckName($name)
Определения component_template.php:466
Init(&$component, $siteTemplate=false, $customTemplatePath="")
Определения component_template.php:390
AddEditAction($entryId, $editLink, $editTitle=false, $arParams=[])
Определения component_template.php:1197
addExternalJs($jsPath)
Определения component_template.php:1364
SetViewTarget($target, $pos=500)
Определения component_template.php:1125
generatePossibleTemplatePath()
Определения component_template.php:551
__GetTemplateExtension($templateName)
Определения component_template.php:1083
addExternalCss($cssPath)
Определения component_template.php:1342
if( $strWarning=="") if($strWarning=="") $componentPath
Определения component_props2.php:197
global $arBXAvailableTemplateEngines
Определения component_template.php:10
global $arBXRuntimeTemplateEngines
Определения component_template.php:11
</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
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $DB
Определения cron_frame.php:29
global $USER
Определения csv_new_run.php:40
$context
Определения csv_new_setup.php:223
if(!defined('SITE_ID')) $lang
Определения include.php:91
bxstrrpos($haystack, $needle)
Определения tools.php:3292
bx_basename($path, $ext="")
Определения tools.php:3269
randString($pass_len=10, $pass_chars=false)
Определения tools.php:2154
$name
Определения menu_edit.php:35
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$fileName
Определения quickway.php:305
$i
Определения factura.php:643
$page
Определения order_form.php:33
</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
$GLOBALS['_____370096793']
Определения update_client.php:1