Ejemplo n.º 1
0
 /**
  * @return array[string][string]string
  */
 public function queryValues()
 {
     $templateInstance = new BaseTemplate($this);
     $templates = $templateInstance->findTemplates();
     foreach ($templates as $CODE => $row) {
         $templates[$CODE]["VALUE"] = \Freetrix\Iblock\Template\Engine::process($this->createTemplateEntity(), $row["TEMPLATE"]);
     }
     return $templates;
 }
Ejemplo n.º 2
0
		$entity->setFields($arFields);

		$templates = $ipropTemplates->findTemplates();
		if (is_array($_POST["IPROPERTY_TEMPLATES"]))
		{
			foreach ($_POST["IPROPERTY_TEMPLATES"] as $TEMPLATE_NAME => $TEMPLATE_VALUE)
			{
				$templates[$TEMPLATE_NAME] = array(
					"TEMPLATE" => \Freetrix\Iblock\Template\Helper::convertArrayToModifiers($TEMPLATE_VALUE),
				);
			}
		}

		$result = array();
		foreach ($templates as $TEMPLATE_NAME => $templateInfo)
		{
			$result[] = array(
				"id" => $TEMPLATE_NAME,
				"value" => \Freetrix\Main\Text\String::htmlEncode(
					\Freetrix\Iblock\Template\Engine::process($entity, $templateInfo["TEMPLATE"])
				),
			);
		}
		echo CUtil::PhpToJSObject($result);
		//$entity = $values->createTemplateEntity();
		//$entity->setFields($arFields);
		//$templates = $values->getTemplateEntity();
	}
}
require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/epilog_after.php");
?>
Ejemplo n.º 3
0
 public static function makeFileName(\Freetrix\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 \Freetrix\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"];
 }
Ejemplo n.º 4
0
			if (!empty($arDirProperties))
			{
				foreach ($arDirProperties as $arOneConvert)
				{
					if (isset($arPropertySaveValues[$arOneConvert['ID']]))
					{
						$arPropertySaveValues[$arOneConvert['ID']] = $arOneConvert['CONVERT'][$arPropertySaveValues[$arOneConvert['ID']]];
					}
				}
			}
			$arPropertySaveValues["CML2_LINK"] = $parentElement;
			$arIBlockElementAdd['PROPERTY_VALUES'] = $arPropertySaveValues;
			$sku = new \Freetrix\Iblock\Template\Entity\Element(0);
			$sku->setFields($arIBlockElementAdd);
			$arIBlockElementAdd["NAME"] = \Freetrix\Iblock\Template\Engine::process($sku, $title);
			unset($arIBlockElementAdd['PROPERTY_VALUES']["CML2_LINK"]);
			$idNewElement = $obIBlockElement->Add($arIBlockElementAdd, false, true, true);
			if($idNewElement)
			{

				CCatalogProduct::Add(array("ID" => $idNewElement, "WEIGHT" => $_POST["IB_SEG_WEIGHT"], "LENGTH" => $_POST["IB_SEG_BASE_LENGTH"], "WIDTH" => $_POST["IB_SEG_BASE_WIDTH"], "HEIGHT" => $_POST["IB_SEG_BASE_HEIGHT"], "VAT_ID" => $_POST["IB_SEG_VAT_ID"], "VAT_INCLUDED" => $_POST["IB_SEG_VAT_INCLUDED"]));
				foreach($arPriceGroup as $price)
					CPrice::Add(array("PRODUCT_ID" => $idNewElement, "CURRENCY" => $price["CURRENCY"], "PRICE" => $price["PRICE"], "CATALOG_GROUP_ID" => $price["TYPE"]));
				$element = new \Freetrix\Iblock\InheritedProperty\ElementValues($subIBlockId, $idNewElement);
				$template = new \Freetrix\Iblock\InheritedProperty\BaseTemplate($element);
				$template->set(array(
					"MY_TEMPLATE" => $title,
				));
			}
			else