本文整理汇总了PHP中Base::setFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Base::setFields方法的具体用法?PHP Base::setFields怎么用?PHP Base::setFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base::setFields方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setFields
public function setFields(array $fields)
{
parent::setFields($fields);
if (is_array($this->fields) && $this->fields["MEASURE"] > 0) {
$this->fields["MEASURE"] = new ElementCatalogMeasure($this->fields["MEASURE"]);
}
}
示例2: setFields
public function setFields(array $fields)
{
parent::setFields($fields);
if (is_array($this->fields)) {
//$this->fields["MEASURE"] = new ElementCatalogMeasure($this->fields["MEASURE"]);
//TODO
}
}
示例3: setFields
/**
* Used to initialize entity fields from some external source.
*
* @param array $fields Entity fields.
*
* @return void
*/
public function setFields(array $fields)
{
parent::setFields($fields);
if (is_array($this->fields) && $this->iblockId > 0) {
foreach ($this->fields as $id => $value) {
if (substr($id, 0, 3) === "UF_") {
$propertyCode = $id;
$fieldCode = strtolower(substr($id, 3));
$this->fieldMap[$fieldCode] = $propertyCode;
}
}
}
}
示例4: setFields
public function setFields(array $fields)
{
parent::setFields($fields);
if (is_array($this->fields) && $this->fields["IBLOCK_ID"] > 0) {
if (isset($fields["PROPERTY_VALUES"]) && is_array($fields["PROPERTY_VALUES"])) {
$this->property = new ElementProperty($this->id);
$this->property->setIblockId($this->fields["IBLOCK_ID"]);
$this->property->setFields($fields["PROPERTY_VALUES"]);
}
$this->iblock = new Iblock($fields["IBLOCK_ID"]);
if (isset($fields["IBLOCK_SECTION_ID"]) && $fields["IBLOCK_SECTION_ID"] > 0) {
$this->parent = new Section($fields["IBLOCK_SECTION_ID"]);
$this->sections = new SectionPath($fields["IBLOCK_SECTION_ID"]);
}
if (\Freetrix\Main\Loader::includeModule('catalog')) {
$this->catalog = new ElementCatalog($this->id);
}
}
}
示例5: setFields
public function setFields(array $fields)
{
parent::setFields($fields);
if (is_array($this->fields) && $this->fields["IBLOCK_ID"] > 0) {
$properties = array();
foreach ($this->fields as $id => $value) {
if (substr($id, 0, 3) === "UF_") {
$properties[$id] = $value;
}
}
$this->property = new SectionProperty($this->id);
$this->property->setIblockId($this->fields["IBLOCK_ID"]);
$this->property->setFields($properties);
$this->iblock = new Iblock($fields["IBLOCK_ID"]);
if (isset($fields["IBLOCK_SECTION_ID"]) && $fields["IBLOCK_SECTION_ID"] > 0) {
$this->parent = new Section($fields["IBLOCK_SECTION_ID"]);
$this->sections = new SectionPath($fields["IBLOCK_SECTION_ID"]);
}
if (\Bitrix\Main\Loader::includeModule('catalog')) {
$this->catalog = new ElementCatalog($this->id);
}
}
}
示例6: setFields
public function setFields(array $fields)
{
parent::setFields($fields);
if (is_array($this->fields) && $this->iblock_id > 0) {
$properties = array();
$propertyList = \Bitrix\Iblock\PropertyTable::getList(array("select" => array("*"), "filter" => array("=IBLOCK_ID" => $this->iblock_id)));
while ($row = $propertyList->fetch()) {
if ($row["USER_TYPE_SETTINGS"]) {
$row["USER_TYPE_SETTINGS"] = unserialize($row["USER_TYPE_SETTINGS"]);
}
$properties[$row["ID"]] = $row;
if ($row["CODE"] != "") {
$properties[$row["CODE"]] =& $properties[$row["ID"]];
}
}
foreach ($fields as $propertyCode => $propertyValues) {
if (is_array($propertyValues)) {
foreach ($propertyValues as $i => $propertyValue) {
if (is_array($propertyValue) && array_key_exists("VALUE", $propertyValue)) {
if ($propertyValue["VALUE"] != "") {
$propertyValues[$i] = $propertyValue["VALUE"];
} else {
unset($propertyValues[$i]);
}
}
}
}
if (isset($properties[$propertyCode])) {
$property = $properties[$propertyCode];
$fieldCode = strtolower($propertyCode);
if ($property["PROPERTY_TYPE"] === "L") {
if (is_numeric($propertyValues)) {
$value = new ElementPropertyEnum($propertyValues);
} elseif (is_array($propertyValues)) {
$value = array();
foreach ($propertyValues as $propertyValue) {
if (is_numeric($propertyValue)) {
$value[] = new ElementPropertyEnum($propertyValue);
}
}
} else {
$value = $propertyValues;
}
} elseif ($property["PROPERTY_TYPE"] === "E") {
if ($propertyValues instanceof Element) {
$this->element_link_properties[$fieldCode] = $propertyValues;
$value = $propertyValues->getField("name");
} elseif (is_numeric($propertyValues)) {
$this->element_link_properties[$fieldCode] = $propertyValues;
$value = new ElementPropertyElement($propertyValues);
} else {
$value = $propertyValues;
}
} elseif ($property["PROPERTY_TYPE"] === "G") {
if ($propertyValues instanceof Section) {
$this->section_link_properties[$fieldCode] = $propertyValues;
$value = $propertyValues->getField("name");
} elseif (is_numeric($propertyValues)) {
$this->section_link_properties[$fieldCode] = $propertyValues;
$value = new ElementPropertySection($propertyValues);
} else {
$value = $propertyValues;
}
} else {
if (strlen($property["USER_TYPE"])) {
$value = new ElementPropertyUserField($propertyValues, $property);
} else {
$value = $propertyValues;
}
}
$this->fieldMap[$fieldCode] = $property["ID"];
$this->fieldMap[$property["ID"]] = $property["ID"];
if ($property["CODE"] != "") {
$this->fieldMap[strtolower($property["CODE"])] = $property["ID"];
}
$this->fields[$property["ID"]] = $value;
}
}
}
}