Beispiel #1
0
 public static function makeFileName(\Bitrix\Iblock\InheritedProperty\BaseTemplate $ipropTemplates, $templateName, $arFields, $arFile)
 {
     if (preg_match("/^(.+)(\\.[a-zA-Z0-9]+)\$/", $arFile["name"], $fileName)) {
         if (!isset($arFields["IPROPERTY_TEMPLATES"]) || $arFields["IPROPERTY_TEMPLATES"][$templateName] == "") {
             $templates = $ipropTemplates->findTemplates();
             $TEMPLATE = $templates[$templateName]["TEMPLATE"];
         } else {
             $TEMPLATE = $arFields["IPROPERTY_TEMPLATES"][$templateName];
         }
         if ($TEMPLATE != "") {
             list($template, $modifiers) = Helper::splitTemplate($TEMPLATE);
             if ($template != "") {
                 $values = $ipropTemplates->getValuesEntity();
                 $entity = $values->createTemplateEntity();
                 $entity->setFields($arFields);
                 return \Bitrix\Iblock\Template\Engine::process($entity, $TEMPLATE) . $fileName[2];
             } elseif ($modifiers != "") {
                 $simpleTemplate = new NodeRoot();
                 $simpleTemplate->addChild(new NodeText($fileName[1]));
                 $simpleTemplate->setModifiers($modifiers);
                 $baseEntity = new Entity\Base(0);
                 return $simpleTemplate->process($baseEntity) . $fileName[2];
             }
         }
     }
     return $arFile["name"];
 }
Beispiel #2
0
 function exportInheritedTemplates($level, \Bitrix\Iblock\InheritedProperty\BaseTemplate $template)
 {
     $templates = $template->get();
     if (!empty($templates)) {
         $ws = str_repeat("\t", $level);
         fwrite($this->fp, $ws . "<" . GetMessage("IBLOCK_XML2_INHERITED_TEMPLATES") . ">\n");
         foreach ($templates as $CODE => $TEMPLATE) {
             fwrite($this->fp, $ws . "\t<" . GetMessage("IBLOCK_XML2_TEMPLATE") . ">\n");
             fwrite($this->fp, $ws . "\t\t<" . GetMessage("IBLOCK_XML2_ID") . ">" . htmlspecialcharsbx($CODE) . "</" . GetMessage("IBLOCK_XML2_ID") . ">\n");
             fwrite($this->fp, $ws . "\t\t<" . GetMessage("IBLOCK_XML2_VALUE") . ">" . htmlspecialcharsbx($TEMPLATE["TEMPLATE"]) . "</" . GetMessage("IBLOCK_XML2_VALUE") . ">\n");
             fwrite($this->fp, $ws . "\t</" . GetMessage("IBLOCK_XML2_TEMPLATE") . ">\n");
         }
         fwrite($this->fp, $ws . "</" . GetMessage("IBLOCK_XML2_INHERITED_TEMPLATES") . ">\n");
     }
 }
 /**
  * @param integer $iblockId Identifier of the iblock of element.
  * @param integer $elementId Identifier of the element.
  */
 function __construct($iblockId, $elementId)
 {
     $entity = new ElementValues($iblockId, $elementId);
     parent::__construct($entity);
 }