本文整理汇总了PHP中CIBlock::SetMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::SetMessages方法的具体用法?PHP CIBlock::SetMessages怎么用?PHP CIBlock::SetMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::SetMessages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
*
*/
public function process()
{
if ($this->processed) {
return;
}
$this->processed = true;
foreach ($this->generateData() as $k => $v) {
$this->data[$k] = $v;
}
$this->update();
$o = new \CIBlock();
$mesages = $this->messages();
$o->SetMessages($this->getId(), $mesages);
$fields = $this->fields();
$o->SetFields($this->getId(), $fields);
$props = $this->loadProperties();
$newProps = $this->properties();
foreach ($this->urlsProps() as $key => $data) {
$newProps[$key] = $data;
}
$o = new \CIBlockProperty();
foreach ($props as $prop => $data) {
if (!isset($newProps[$prop])) {
$o->Delete($data['ID']);
}
}
foreach ($newProps as $prop => $data) {
$data['CODE'] = $prop;
if ($data['PROPERTY_TYPE'] == 'E' || $data['PROPERTY_TYPE'] == 'G') {
if (!isset($data['LINK_IBLOCK_ID'])) {
if (isset($data['LINK_IBLOCK_CODE'])) {
$data['LINK_IBLOCK_ID'] = self::codeToId($data['LINK_IBLOCK_CODE']);
}
}
}
if (isset($props[$prop])) {
$id = $props[$prop]['ID'];
$o->Update($id, $data);
} else {
$data['IBLOCK_ID'] = $this->getId();
$id = $o->Add($data);
}
if ($data['PROPERTY_TYPE'] == 'L' && isset($data['ITEMS']) && is_array($data['ITEMS'])) {
$items = array();
$newItems = $data['ITEMS'];
$res = \CIBlockPropertyEnum::GetList(array(), array('PROPERTY_ID' => $id, 'CHECK_PERMISSIONS' => 'N'));
while ($row = $res->Fetch()) {
$iid = $row['ID'];
$eid = $row['EXTERNAL_ID'];
if (!isset($newItems[$eid])) {
\CIBlockPropertyEnum::Delete($iid);
} else {
$items[$eid] = $row;
}
}
$eo = new \CIBlockPropertyEnum();
foreach ($newItems as $eid => $edata) {
if (is_string($edata)) {
$edata = array('VALUE' => $edata);
}
$edata['PROPERTY_ID'] = $id;
$edata['EXTERNAL_ID'] = $eid;
$edata['XML_ID'] = $eid;
if (isset($items[$eid])) {
$eo->Update($items[$eid]['ID'], $edata);
} else {
$eo->Add($edata);
}
}
}
}
}