diff --git a/.gitignore b/.gitignore index c98034d..7e6dc6b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ vizitka/tmp/ vkteamssetup.exe local/*.json local/*.txt +local/commands/ !local/sitemap.php \ No newline at end of file diff --git a/local/components/evolution/form.catalog.filter/templates/.default/style.css b/local/components/evolution/form.catalog.filter/templates/.default/style.css index e1e870d..beb9f97 100644 --- a/local/components/evolution/form.catalog.filter/templates/.default/style.css +++ b/local/components/evolution/form.catalog.filter/templates/.default/style.css @@ -18,4 +18,15 @@ .catalog_filter_used *[data-desktop-order] { width: 100% !important; } +} + +@media (max-width: 767px) +{ + #filter .filter_body .filter_column:last-child { + margin-bottom: 10px !important; + } + + #filter .filter_header { + margin-bottom: 80px !important; + } } \ No newline at end of file diff --git a/local/used.php b/local/used.php index 871dd93..f049a5e 100644 --- a/local/used.php +++ b/local/used.php @@ -329,10 +329,10 @@ function resize_image($image, $filename, $width, $height, $quality) $original_height = imagesy($source); $panel_width = $width; - $panel_height = ($original_height * ($width / $original_width)); + $panel_height = intval($original_height * floatval($width / $original_width)); $panel = imagecreatetruecolor($panel_width, $panel_height); imagecopyresampled($panel, $source, 0, 0, 0, 0, $panel_width, $panel_height, $original_width, $original_height); - imagecopyresampled($resized, $panel, 0, 0, 0, (($panel_height - $height) / 2), $width, $height, $panel_width, $height); + imagecopyresampled($resized, $panel, 0, 0, 0, intval(($panel_height - $height) / 2), $width, $height, $panel_width, $height); imagejpeg($resized, $tempfile_filename, $quality); @@ -452,9 +452,6 @@ foreach($json as $car) } } - print "photos_property_values\n\n"; - print_r($photos_property_values); - CIBlockElement::SetPropertyValueCode($new_used_car_id, "PHOTO", $photo_property_value); CIBlockElement::SetPropertyValueCode($new_used_car_id, "PHOTOS_1080", $photos_1080_property_values); CIBlockElement::SetPropertyValueCode($new_used_car_id, "PHOTOS_480", $photos_480_property_values); diff --git a/marketplace/.left.menu_ext.php b/marketplace/.left.menu_ext.php new file mode 100644 index 0000000..2882bff --- /dev/null +++ b/marketplace/.left.menu_ext.php @@ -0,0 +1,194 @@ + "menu_marketplace"), + "" + ); +} + +if( + !$extranetSite + && CModule::IncludeModule("rest") +) +{ + if (\CRestUtil::isAdmin()) + { + $arMenu[] = Array( + GetMessage("MENU_MARKETPLACE_INSTALLED"), + SITE_DIR."marketplace/installed/", + Array(), + Array("menu_item_id" => "menu_marketplace_installed"), + "" + ); + } + + $arUserGroupCode = $USER->GetAccessCodes(); + + $arMenuApps = array(); + $dbApps = \Bitrix\Rest\AppTable::getList( + [ + 'order' => [ + "ID" => "ASC" + ], + 'filter' => [ + "=ACTIVE" => \Bitrix\Rest\AppTable::ACTIVE + ], + 'select' => [ + 'ID', + 'CODE', + 'CLIENT_ID', + 'STATUS', + 'ACTIVE', + 'ACCESS', + 'MENU_NAME' => 'LANG.MENU_NAME', + 'MENU_NAME_DEFAULT' => 'LANG_DEFAULT.MENU_NAME', + 'MENU_NAME_LICENSE' => 'LANG_LICENSE.MENU_NAME', + ], + ] + ); + foreach ($dbApps->fetchCollection() as $app) + { + $arApp = [ + 'ID' => $app->getId(), + 'CODE' => $app->getCode(), + 'ACTIVE' => $app->getActive(), + 'CLIENT_ID' => $app->getClientId(), + 'ACCESS' => $app->getAccess(), + 'MENU_NAME' => !is_null($app->getLang()) ? $app->getLang()->getMenuName() : '', + 'MENU_NAME_DEFAULT' => !is_null($app->getLangDefault()) ? $app->getLangDefault()->getMenuName() : '', + 'MENU_NAME_LICENSE' => !is_null($app->getLangLicense()) ? $app->getLangLicense()->getMenuName() : '' + ]; + + if($arApp['CODE'] === \CRestUtil::BITRIX_1C_APP_CODE) + { + continue; + } + + $lang = in_array(LANGUAGE_ID, array("ru", "en", "de")) + ? LANGUAGE_ID + : \Bitrix\Main\Localization\Loc::getDefaultLang(LANGUAGE_ID); + + if ($arApp["MENU_NAME"] === '' && $arApp['MENU_NAME_DEFAULT'] === '' && $arApp['MENU_NAME_LICENSE'] === '') + { + $app->fillLangAll(); + if (!is_null($app->getLangAll())) + { + $langList = []; + foreach ($app->getLangAll() as $appLang) + { + if ($appLang->getMenuName() !== '') + { + $langList[$appLang->getLanguageId()] = $appLang->getMenuName(); + } + } + + if (isset($langList[$lang]) && $langList[$lang]) + { + $arApp["MENU_NAME"] = $langList[$lang]; + } + elseif (isset($langList['en']) && $langList['en']) + { + $arApp["MENU_NAME"] = $langList['en']; + } + elseif (!empty($langList)) + { + $arApp["MENU_NAME"] = reset($langList); + } + } + } + + if($arApp["MENU_NAME"] <> '' || $arApp['MENU_NAME_DEFAULT'] <> '' || $arApp['MENU_NAME_LICENSE'] <> '') + { + $appRightAvailable = false; + if(\CRestUtil::isAdmin()) + { + $appRightAvailable = true; + } + elseif(!empty($arApp["ACCESS"])) + { + $rights = explode(",", $arApp["ACCESS"]); + foreach($rights as $rightID) + { + if(in_array($rightID, $arUserGroupCode)) + { + $appRightAvailable = true; + break; + } + } + } + else + { + $appRightAvailable = true; + } + + if($appRightAvailable) + { + $appName = $arApp["MENU_NAME"]; + + if($appName == '') + { + $appName = $arApp['MENU_NAME_DEFAULT']; + } + + if($appName == '') + { + $appName = $arApp['MENU_NAME_LICENSE']; + } + + $arMenuApps[] = Array( + htmlspecialcharsbx($appName), + \CRestUtil::getApplicationPage($arApp['ID'], 'ID', $arApp), + Array( + \CRestUtil::getApplicationPage($arApp['ID'], 'CODE', $arApp), + \CRestUtil::getApplicationPage($arApp['ID'], 'CLIENT_ID', $arApp), + ), + Array("is_application" => "Y", "app_id" => $arApp["ID"]), + "" + ); + } + } + } + + if ($USER->IsAuthorized()) + { + $urlDevOps = \Bitrix\Rest\Url\DevOps::getInstance()->getIndexUrl(); + $arMenu[] = [ + GetMessage("REST_MENU_MARKETPLACE_DEVOPS"), + $urlDevOps, + [], + [ + "menu_item_id" => "menu_marketplace_hook" + ], + "", + ]; + } + + $arMenu = array_merge($arMenu, $arMenuApps); +} + + +$aMenuLinks = array_merge($arMenu, $aMenuLinks); diff --git a/marketplace/app/index.php b/marketplace/app/index.php new file mode 100644 index 0000000..3d484f1 --- /dev/null +++ b/marketplace/app/index.php @@ -0,0 +1,30 @@ +IncludeComponent( + "bitrix:ui.sidepanel.wrapper", + "", + array( + "POPUP_COMPONENT_NAME" => "bitrix:app.layout", + "POPUP_COMPONENT_TEMPLATE_NAME" => ".default", + "POPUP_COMPONENT_PARAMS" => array( + "COMPONENT_TEMPLATE" => ".default", + "DETAIL_URL" => SITE_DIR."marketplace/detail/#code#/", + "SEF_MODE" => "Y", + "IS_SLIDER" => (\CRestUtil::isSlider() ? "Y" : "N"), + "SEF_FOLDER" => SITE_DIR."marketplace/app/", + "SEF_URL_TEMPLATES" => array( + "application" => "#id#/", + ), + "USE_PADDING" => 'N' + ), + "USE_PADDING" => false, + "PAGE_MODE" => true, + "USE_UI_TOOLBAR" => "N", + "PLAIN_VIEW" => (\CRestUtil::isSlider() ? "Y" : "N") + ), + $component +); + +require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php"); \ No newline at end of file diff --git a/marketplace/configuration/index.php b/marketplace/configuration/index.php new file mode 100644 index 0000000..5ffb898 --- /dev/null +++ b/marketplace/configuration/index.php @@ -0,0 +1,38 @@ +getContext()->getRequest(); +if ($request->get('inSlider') === 'N') +{ + $APPLICATION->includeComponent( + 'bitrix:rest.configuration', + '', + array( + "SEF_MODE" => "Y", + 'SEF_FOLDER' => \Bitrix\Rest\Marketplace\Url::getConfigurationUrl(), + ), + false, array('HIDE_ICONS' => 'Y') + ); +} +else +{ + $APPLICATION->SetTitle(""); + $APPLICATION->IncludeComponent( + "bitrix:ui.sidepanel.wrapper", + "", + [ + "POPUP_COMPONENT_NAME" => "bitrix:rest.configuration", + "POPUP_COMPONENT_TEMPLATE_NAME" => ".default", + "POPUP_COMPONENT_PARAMS" => [ + "SEF_MODE" => "Y", + 'SEF_FOLDER' => \Bitrix\Rest\Marketplace\Url::getConfigurationUrl(), + + ], + "PAGE_MODE" => false, + "USE_PADDING" => false, + "RELOAD_GRID_AFTER_SAVE" => 'all' + ] + ); + require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php"); +} +?> \ No newline at end of file diff --git a/marketplace/index.php b/marketplace/index.php new file mode 100644 index 0000000..08233eb --- /dev/null +++ b/marketplace/index.php @@ -0,0 +1,45 @@ +SetTitle(""); + +if (Loader::includeModule('market')) { + $path = str_replace('/marketplace/', '/market/', Context::getCurrent()->getRequest()->getRequestUri()); + LocalRedirect($path); +} + +$APPLICATION->IncludeComponent( + "bitrix:ui.sidepanel.wrapper", + "", + array( + "POPUP_COMPONENT_NAME" => "bitrix:rest.marketplace", + "POPUP_COMPONENT_TEMPLATE_NAME" => ".default", + "POPUP_COMPONENT_PARAMS" => array( + "SEF_MODE" => "Y", + "SEF_FOLDER" => SITE_DIR."marketplace/", + "APPLICATION_URL" => SITE_DIR."marketplace/app/#id#/", + "SEF_URL_TEMPLATES" => array( + //"top" => "", + "category" => "category/#category#/", + "detail" => "detail/#app#/", + "placement_view" => "view/#APP#/", + "placement" => "placement/#PLACEMENT_ID#/", + "search" => "search/", + "buy" => "buy/", + "updates" => "updates/", + "installed" => "installed/", + ) + ), + "USE_UI_TOOLBAR" => "Y", + "USE_PADDING" => false, + "PAGE_MODE" => false + ), +); +?> + + \ No newline at end of file