Skip to content

Instantly share code, notes, and snippets.

View Ozimnadius's full-sized avatar
🎯
Focusing

Seregin Mikhail Ozimnadius

🎯
Focusing
  • http://web-comp.ru/
  • 109382, г. Москва, ул. Нижние Поля, 31
View GitHub Profile
@Ozimnadius
Ozimnadius / gist:aed941ec1fbd5df590f30759c09e651d
Last active April 17, 2024 14:34
Отправка формы и создание элемента инфоблока Формы
<?php
header('Content-Type: application/json');
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
function sendMail()
{
$postData = $_POST;
// Sanitize and validate input data
$name = htmlspecialchars(trim($postData['name']));
@Ozimnadius
Ozimnadius / gist:a734d8a41128e602076256a34688bdc1
Created April 9, 2024 08:45
Bitrix Древовидное меню
if (!empty($arResult)) {
$parentID = false;
$subParentID = false;
foreach($arResult as $i => $arItem) {
if ($arItem['DEPTH_LEVEL'] == 1) {
$parentID = $i;
$arResult[$i]['ITEMS'] = array();
} elseif ($arItem['DEPTH_LEVEL']==2 && $parentID!==false) {
$arResult[$parentID]['ITEMS'][$i] = $arItem;
$subParentID = $i;
@Ozimnadius
Ozimnadius / gist:bd4e82c79387411ad3673e2b44e21a49
Created March 13, 2024 13:08
Bitrix smart.mobile.filter (with fast filter)
/*Новые строки для быстрого фильтра 20-22 и 341-414 они помечены как TODO*/
function JCSmartFilter(ajaxURL, viewMode, params) {
this.ajaxURL = ajaxURL;
this.form = null;
this.timer = null;
this.cacheKey = '';
this.cache = [];
this.popups = [];
this.viewMode = viewMode;
@Ozimnadius
Ozimnadius / gist:f36c0b7a77d8ee63626e984971e512fe
Created November 8, 2023 11:09
Настройка xdebug+openserver
В файле php.ini
zend_extension = xdebug;
[xdebug]
xdebug.mode = debug
xdebug.remote_port = 9001
xdebug.idekey = "PHPSTORM"
xdebug.start_with_request = "yes"
<? ob_start(); ?>
<? var_export($arResult["OFFERS"]); ?>
<? $string = "<?\$res=".ob_get_clean()."?>";
file_put_contents($_SERVER["DOCUMENT_ROOT"]."/debug.php", $string); ?>
@Ozimnadius
Ozimnadius / gist:84c86a924d86f6e571bd472d9f8b46a0
Created May 19, 2023 10:46
Извлечение SVG из файла
<? $svg = file_get_contents($_SERVER["DOCUMENT_ROOT"] . $arItem["PARAMS"]["IMG"]); ?>
$arOrder = array("SORT" => "ASC");
$arFilter = array("IBLOCK_ID" => IntVal($arParams["IBLOCK_ID"]), "ACTIVE" => "Y");
$bIncCnt = false;
$arSelect = array("ID", "IBLOCK_ID", "*", "PROPERTY_*");
$arNavStartParams = false;
$res = CIBlockSection::GetList($arOrder, $arFilter, $bIncCnt, $arSelect, $arNavStartParams,);
while ($ob = $res->GetNext()) {
$arrSections[] = $ob;
}
CFile::GetPath($arItem["PICTURE"]);
<? header('Content-Type: application/json');?>
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");?>
<?
echo json_encode(array(
'status' => send()
));
?>
@Ozimnadius
Ozimnadius / gist:e4948a5e8daccbf4639bef84414b6808
Created February 27, 2023 09:16
Bitrix GetList(CIBlockElement)
$arOrder= array("SORT"=>"ASC");
$arFilter = Array("IBLOCK_ID"=>IntVal(1), "ACTIVE"=>"Y");
$arGroupBy = false;
$arNavStartParams = array();
$arSelect = Array("ID", "IBLOCK_ID", "*", "PROPERTY_*");
$res = CIBlockElement::GetList($arOrder, $arFilter, $arGroupBy, $arNavStartParams, $arSelect);
while ($ob = $res->GetNextElement()) {
$arFields = $ob->GetFields();
$arProps = $ob->GetProperties();
}