| Current Path : /var/www/homesaver/www/bitrix/admin/profistudio.sort/ |
| Current File : /var/www/homesaver/www/bitrix/admin/profistudio.sort/profistudio.sort_save.php |
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
if(!CModule::IncludeModule('iblock'))
{
die();
};
$ibSect = new CIBlockSection();
$ibEl = new CIBlockElement();
foreach($_REQUEST['sort'] as $key => $value)
{
if(mb_strlen($key) <= 0)
{
continue;
}
if(mb_stripos($key, "template_") !== false)
{
continue;
}
if(mb_stripos($key, "Etemplate_") !== false)
{
continue;
}
if(mb_stripos($key, "Stemplate_") !== false)
{
continue;
}
$id = mb_substr($key, 1);
if(mb_strlen($id) <= 0)
{
continue;
}
if(filter_var($id, FILTER_VALIDATE_INT) === false)
{
continue;
}
$id = intval($id);
if($id <= 0)
{
continue;
}
if(empty($value) || !is_array($value) || empty($value[0]))
{
continue;
}
$sort = $value[0];
if(is_array($sort))
{
continue;
}
if(mb_strlen($sort) <= 0)
{
continue;
}
if(filter_var($sort, FILTER_VALIDATE_INT) === false)
{
continue;
}
$sort = intval($sort);
//var_dump('----', $key[0], $id, $sort);
if($key[0] == "E")
{
$ibEl->Update($id, array("SORT" => $sort));
}
else if($key[0] == "S")
{
$ibSect->Update($id, array("SORT" => ($sort * 10)));
}
}
?>