<div v-for="(item, index) in items" :key="index">
...
</div>
(new ReflectionMethod('MyClass', 'methodA'))->isStatic();
call_user_func([$object, 'method']);
call_user_func(['ClassName', 'staticMethod']);
AddEventHandler("catalog", "OnBeforeCatalogImport1C", "CatalogWeightProcessor::OnBeforeCatalogImport1C");
AddEventHandler("catalog", "OnSuccessCatalogImport1C", "CatalogWeightProcessor::OnSuccessCatalogImport1C");
class CatalogWeightProcessor
{
protected static $exchangeStart = null;
public static function OnBeforeCatalogImport1C()
{
// запоминаем время начала обмена, чтобы вытащить только обновленные товары
self::$exchangeStart = time();
}
public static function OnSuccessCatalogImport1C()
{
Bitrix\Main\Loader::includeModule('iblock');
$select = [
'ID',
'PROPERTY_[вес]',
];
$filter = [
'=IBLOCK_ID' => "ид каталога",
'>=TIMESTAMP_X' => Bitrix\Main\Type\DateTime::createFromTimestamp(self::$exchangeStart),
];
$result = CIBlockElement::GetList([], $filter, false, false, $select);
while ($row = $result->GetNext()) {
$productId = $row['ID'];
$weight = (float) $row['PROPERTY_[вес]_VALUE'];
$result = Bitrix\Catalog\ProductTable::update($productId, [
'WEIGHT' => $weight,
]);
if (!$result->isSuccess()) {
$errors = $result->getErrorMessages();
CEventLog::Add([
'SEVERITY' => 'ERROR',
'AUDIT_TYPE_ID' => 'exchange1c',
'MODULE_ID' => 'catalog',
'ITEM_ID' => $productId,
'DESCRIPTION' => join(",", $errors),
]);
}
}
}
}
<template>
<div>
<div class='tags'>
<a v-for="item in tags" @click.prevent="activeTagId = item.id">{item.name}</a>
</div>
<div class="videos">
<div v-for="item in videos" v-show="isViewVideo(item)">...</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
activeTagId: null,
tags: [
{
id: 1,
name: '',
},
],
videos: [
{
id: 1,
name: '',
tagIds: [1,2,3],
},
],
};
},
methods: {
isViewVideo(video) {
return video.tagIds && video.tagIds.indexOf(this.activeTagId) >= 0;
},
},
}
</script>
class SitemapImageBuilder
{
public function __construct(string $imagesDir)
{
$this->dir = $imagesDir;
}
public function run()
{
$imageFiles = $this->getImageFiles($this->dir);
$this->generateXml($imageFiles);
}
public function getImageFiles(string $path)
{
$ret = [];
$files = scandir($path);
$explodeNames = [
'.',
'..',
];
$mimeRe = "/^image/";
foreach ($files as $name) {
if (in_array($name, $explodeNames)) {
continue;
}
$filePath = $path .'/'. $name;
if (is_dir($filePath)) {
$childs = $this->getImageFiles($filePath);
if ($childs) {
array_push($ret, ...$childs);
}
}
else if (is_file($filePath)) {
$mime = mime_content_type($name);
if (preg_match($mimeRe, $mime)) {
$ret[] = $filePath;
}
}
}
return $ret;
}
public function generateXml(array $pathes)
{
// генерация XML sitemap
}
}
$imagesDir = 'path/to/static';
(new SitemapImageBuilder($imagesDir))->run();
<template>
<div v-for="(item, index) in items" :key="index">
<span @click="item.open = !item.open">{{ item.question }}</span>
<span v-if="item.open">{{ item.answer }}</span>
</div>
</template>
<script>
export default {
data: {
faqs: [
{
open: false,
question: '...',
answer: '...',
},
],
},
}
</script>
$arrProgressBuilds = [];
if (!empty($arResult['PROPERTIES']['per1']['VALUE'])) {
$arrProgressBuilds[] = [
'name' => $arResult['PROPERTIES']['per1']['NAME'],
];
}
if (!empty($arResult['PROPERTIES']['per2']['VALUE'])) {
$arrProgressBuilds[] = [
'name' => $arResult['PROPERTIES']['per2']['NAME'],
];
}
if (!empty($arResult['PROPERTIES']['per3']['VALUE'])) {
$arrProgressBuilds[] = [
'name' => $arResult['PROPERTIES']['per3']['NAME'],
];
}