ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,10 @@
<?xml version="1.0" ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="styles"/>
<update handle="editor"/>
<body>
<referenceContainer name="content">
<uiComponent name="olegnax_googlemap_location_form"/>
</referenceContainer>
</body>
</page>
@@ -0,0 +1,9 @@
<?xml version="1.0" ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="styles"/>
<body>
<referenceContainer name="content">
<uiComponent name="olegnax_googlemap_location_listing"/>
</referenceContainer>
</body>
</page>
@@ -0,0 +1,4 @@
<?xml version="1.0" ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="olegnax_googlemap_location_edit"/>
</page>
@@ -0,0 +1,293 @@
<?xml version="1.0" ?>
<!--suppress XmlDefaultAttributeValue -->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">olegnax_googlemap_location_form.location_form_data_source</item>
</item>
<item name="label" translate="true" xsi:type="string">General Information</item>
<item name="template" xsi:type="string">templates/form/collapsible</item>
</argument>
<settings>
<buttons>
<button class="Olegnax\GoogleMap\Block\Adminhtml\Location\Edit\BackButton" name="back"/>
<button class="Olegnax\GoogleMap\Block\Adminhtml\Location\Edit\DeleteButton" name="delete"/>
<button class="Olegnax\GoogleMap\Block\Adminhtml\Location\Edit\SaveButton" name="save"/>
<button class="Olegnax\GoogleMap\Block\Adminhtml\Location\Edit\SaveAndContinueButton" name="save_and_continue"/>
</buttons>
<namespace>olegnax_googlemap_location_form</namespace>
<dataScope>data</dataScope>
<deps>
<dep>olegnax_googlemap_location_form.location_form_data_source</dep>
</deps>
</settings>
<dataSource name="location_form_data_source">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
</item>
</argument>
<settings>
<submitUrl path="*/*/save"/>
</settings>
<dataProvider class="Olegnax\GoogleMap\Model\Location\DataProvider" name="location_form_data_source">
<settings>
<requestFieldName>location_id</requestFieldName>
<primaryFieldName>location_id</primaryFieldName>
</settings>
</dataProvider>
</dataSource>
<fieldset name="general">
<settings>
<label>General</label>
</settings>
<field formElement="input" name="name" sortOrder="10">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">Location</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">Name</label>
<dataScope>name</dataScope>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
</settings>
</field>
<field formElement="checkbox" name="status" sortOrder="20">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">Location</item>
<item name="default" xsi:type="number">1</item>
</item>
</argument>
<settings>
<dataType>boolean</dataType>
<label translate="true">Enable Location</label>
<dataScope>status</dataScope>
</settings>
<formElements>
<checkbox>
<settings>
<valueMap>
<map name="false" xsi:type="number">0</map>
<map name="true" xsi:type="number">1</map>
</valueMap>
<prefer>toggle</prefer>
</settings>
</checkbox>
</formElements>
</field>
<field name="store_views" formElement="multiselect" class="Olegnax\GoogleMap\Ui\Component\Form\Field\StoreView"
sortOrder="22">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">block</item>
<item name="default" xsi:type="number">0</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>int</dataType>
<tooltip>
<link>https://docs.magento.com/m2/ce/user_guide/configuration/scope.html</link>
<description>What is this?</description>
</tooltip>
<label translate="true">Store View</label>
<dataScope>store_id</dataScope>
</settings>
<formElements>
<multiselect>
<settings>
<options class="Magento\Cms\Ui\Component\Listing\Column\Cms\Options"/>
</settings>
</multiselect>
</formElements>
</field>
<field formElement="input" name="latitude" sortOrder="30">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">Location</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">Latitude</label>
<dataScope>latitude</dataScope>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
<rule name="validate-number" xsi:type="boolean">true</rule>
</validation>
</settings>
</field>
<field formElement="input" name="longitude" sortOrder="32">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">Location</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">Longitude</label>
<dataScope>longitude</dataScope>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
<rule name="validate-number" xsi:type="boolean">true</rule>
</validation>
</settings>
</field>
<field formElement="select" name="marker_style" sortOrder="40">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">Location</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">Marker Style</label>
<dataScope>marker_style</dataScope>
<validation>
<rule name="required-entry" xsi:type="boolean">false</rule>
</validation>
</settings>
<formElements>
<select>
<settings>
<options class="Olegnax\GoogleMap\Model\Config\Source\MarkerStyle"/>
</settings>
</select>
</formElements>
</field>
<field formElement="input" name="marker_image" sortOrder="42">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">Location</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">Custom Marker Image</label>
<dataScope>marker_image</dataScope>
<validation>
<rule name="required-entry" xsi:type="boolean">false</rule>
</validation>
<tooltip>
<description>
Set url to map pin image. E.g.: "images/map_pin.png" will
link to images folder in your current theme.
For athlete2 theme full path will be:
app\design\frontend\Olegnax\athlete2\web\images.
To use images from Google Map Module write
following: Olegnax_GoogleMap::images/marker.png.
Full path will be:
app\code\Olegnax\GoogleMap\images\marker.png
</description>
</tooltip>
</settings>
</field>
<field formElement="input" name="marker_size" sortOrder="44">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">Location</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">Marker Scale</label>
<dataScope>marker_size</dataScope>
<validation>
<rule name="required-entry" xsi:type="boolean">false</rule>
<rule name="validate-number" xsi:type="boolean">true</rule>
</validation>
<tooltip>
<description>Default is 1. You can adjust pin size by adding multiplier. E.g.: Set value to 2 to
double the size of the marker or 0.5 to halve the marker size.
</description>
</tooltip>
</settings>
</field>
<field formElement="colorPicker" name="marker_color_1" sortOrder="46">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">Location</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">Marker Main Color (Background)</label>
<dataScope>marker_color_1</dataScope>
<validation>
<rule name="required-entry" xsi:type="boolean">false</rule>
</validation>
<imports>
<link name="visible">${ $.parentName }.marker_style == 'custom'</link>
</imports>
</settings>
</field>
<field formElement="colorPicker" name="marker_color_2" sortOrder="48">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">Location</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">Marker Second Color (Inner circle or dot)</label>
<dataScope>marker_color_2</dataScope>
<validation>
<rule name="required-entry" xsi:type="boolean">false</rule>
</validation>
</settings>
</field>
<field formElement="colorPicker" name="marker_shadow_color" sortOrder="54">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">Location</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<label translate="true">Marker Shadow Color</label>
<dataScope>marker_shadow_color</dataScope>
<validation>
<rule name="required-entry" xsi:type="boolean">false</rule>
</validation>
</settings>
</field>
<field formElement="wysiwyg" name="description" sortOrder="200">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">Location</item>
<item name="wysiwygConfigData" xsi:type="array">
<item name="add_variables" xsi:type="boolean">false</item>
<item name="add_widgets" xsi:type="boolean">false</item>
<item name="add_images" xsi:type="boolean">true</item>
<item name="add_directives" xsi:type="boolean">false</item>
</item>
</item>
</argument>
<settings>
<additionalClasses>
<class name="admin__field-wide">true</class>
</additionalClasses>
<label translate="true">Description</label>
<dataScope>description</dataScope>
</settings>
<formElements>
<wysiwyg>
<settings>
<wysiwyg>true</wysiwyg>
</settings>
</wysiwyg>
</formElements>
</field>
</fieldset>
</form>
@@ -0,0 +1,125 @@
<?xml version="1.0" ?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">olegnax_googlemap_location_listing.olegnax_googlemap_location_listing_data_source</item>
<item name="deps" xsi:type="string">olegnax_googlemap_location_listing.olegnax_googlemap_location_listing_data_source</item>
</item>
<item name="spinner" xsi:type="string">olegnax_googlemap_location_columns</item>
<item name="buttons" xsi:type="array">
<item name="add" xsi:type="array">
<item name="name" xsi:type="string">add</item>
<item name="label" xsi:type="string" translate="true">Add new Location</item>
<item name="class" xsi:type="string">primary</item>
<item name="url" xsi:type="string">*/*/new</item>
</item>
</item>
</argument>
<dataSource name="olegnax_googlemap_location_listing_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider</argument>
<argument name="name" xsi:type="string">olegnax_googlemap_location_listing_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">location_id</argument>
<argument name="requestFieldName" xsi:type="string">id</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="update_url" xsi:type="url" path="mui/index/render"/>
<item name="storageConfig" xsi:type="array">
<item name="indexField" xsi:type="string">location_id</item>
</item>
</item>
</argument>
</argument>
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
</item>
</argument>
</dataSource>
<listingToolbar name="listing_top">
<settings>
<sticky>true</sticky>
</settings>
<bookmark name="bookmarks"/>
<columnsControls name="columns_controls"/>
<filters name="listing_filters"/>
<paging name="listing_paging"/>
</listingToolbar>
<columns name="olegnax_googlemap_location_columns">
<settings>
<editorConfig>
<param name="selectProvider" xsi:type="string">
olegnax_googlemap_location_listing.olegnax_googlemap_location_listing.olegnax_googlemap_location_columns.ids
</param>
<param name="enabled" xsi:type="boolean">true</param>
<param name="indexField" xsi:type="string">location_id</param>
<param name="clientConfig" xsi:type="array">
<item name="saveUrl" path="olegnax_googlemap/Location/inlineEdit" xsi:type="url"/>
<item name="validateBeforeSave" xsi:type="boolean">false</item>
</param>
</editorConfig>
<childDefaults>
<param name="fieldAction" xsi:type="array">
<item name="provider" xsi:type="string">
olegnax_googlemap_location_listing.olegnax_googlemap_location_listing.olegnax_googlemap_location_columns_editor
</item>
<item name="target" xsi:type="string">startEdit</item>
<item name="params" xsi:type="array">
<item name="0" xsi:type="string">${ $.$data.rowIndex }</item>
<item name="1" xsi:type="boolean">true</item>
</item>
</param>
</childDefaults>
</settings>
<selectionsColumn name="ids">
<settings>
<indexField>location_id</indexField>
</settings>
</selectionsColumn>
<column name="location_id" sortOrder="10">
<settings>
<filter>text</filter>
<sorting>asc</sorting>
<label translate="true">ID</label>
</settings>
</column>
<column name="name" sortOrder="20">
<settings>
<filter>text</filter>
<label translate="true">Name</label>
<editor>
<editorType>text</editorType>
<validation>
<rule name="required-entry" xsi:type="boolean">false</rule>
</validation>
</editor>
</settings>
</column>
<column name="store_id" class="Olegnax\GoogleMap\Ui\Component\Listing\Column\LocationStore" sortOrder="30">
<settings>
<label translate="true">Store View</label>
<bodyTmpl>ui/grid/cells/html</bodyTmpl>
<sortable>false</sortable>
</settings>
</column>
<column name="status" component="Magento_Ui/js/grid/columns/select" sortOrder="40">
<settings>
<options class="Magento\Cms\Model\Block\Source\IsActive"/>
<filter>select</filter>
<editor>
<editorType>select</editorType>
</editor>
<dataType>select</dataType>
<label translate="true">Status</label>
</settings>
</column>
<actionsColumn class="Olegnax\GoogleMap\Ui\Component\Listing\Column\LocationActions" name="actions"
sortOrder="50">
<settings>
<indexField>location_id</indexField>
<resizeEnabled>false</resizeEnabled>
<resizeDefaultWidth>107</resizeDefaultWidth>
</settings>
</actionsColumn>
</columns>
</listing>
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="google_map">
<block class="Olegnax\GoogleMap\Block\Widget\GoogleMap" name="ox.google.map" template="widget/googlemap.phtml"/>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,7 @@
// noinspection ES6ConvertVarToLetConst
var config = {
paths: {
'OXGoogleMap': 'Olegnax_GoogleMap/js/googlemap',
'OXGoogleMapLegacy': 'Olegnax_GoogleMap/js/googlemap-legacy'
}
};
@@ -0,0 +1,30 @@
<?php
/**
* @author Olegnax
* @package Olegnax_GoogleMap
* @copyright Copyright (c) 2020 Olegnax (http://olegnax.com/). All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Escaper;
use Magento\Framework\View\Element\Template;
use Olegnax\GoogleMap\Model\Location;
/** @var Template $block */
/** @var Escaper $escaper */
/** @var array $icon */
/** @var Location $location */
$viewBox = '0 0 ' . implode(' ', $icon['scaledSize']);
$markerScale = $location->getMarkerSize();
?>
<svg data-name="athlete-marker" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="<?= $viewBox ?>">
<circle fill="<?= $location->getMarkerColor1() ?>" cx="17" cy="17" r="17" transform="scale(<?=
$markerScale ?>)"/>
<circle fill="<?= $location->getMarkerColor2() ?>" cx="17" cy="17" r="6"
transform="scale(<?= $markerScale ?>)"/>
<polyline fill="<?= $location->getMarkerColor1() ?>" points="30.9 26.8 17.1 48.4 2.6 26"
transform="scale(<?= $markerScale ?>)"/>
</svg>
@@ -0,0 +1,40 @@
<?php
/**
* @author Olegnax
* @package Olegnax_GoogleMap
* @copyright Copyright (c) 2020 Olegnax (http://olegnax.com/). All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Escaper;
use Magento\Framework\View\Element\Template;
use Olegnax\GoogleMap\Model\Data\Location as DataLocation;
use Olegnax\GoogleMap\Model\Location;
/** @var Template $block */
/** @var Escaper $escaper */
/** @var array $icon */
/** @var Location $location */
$viewBox = '0 0 ' . implode(' ', $icon['scaledSize']);
$markerScale = $location->getMarkerSize();
$markerSize = 70;
$markerSize*=$markerScale;
$innerScale = 0.7;
$markerRadius = $markerSize / 2;
$markerInnerRadius = (($markerSize*$innerScale)/2);
$imagePosition = ($markerSize-($markerSize*$innerScale))/2;
$image = $block->getData('widgetBlock')->contentLocalImage(DataLocation::MARKER_IMAGE, $location);
?>
<svg preserveaspectratio="xMidYMid meet" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="<?= $viewBox ?>">
<circle class="ox-marker-shape" cx="<?= $markerRadius ?>" cy="<?= $markerRadius ?>" r="<?= $markerRadius ?>" fill="<?= $location->getMarkerColor1() ?>" />
<circle class="ox-marker-inner" cx="<?= $markerRadius ?>" cy="<?= $markerRadius ?>" r="<?= $markerInnerRadius ?>" fill="<?= $location->getMarkerColor2() ?>" />
<?php if ($image): ?>
<defs>
<clipPath id="oxImageMask">
<circle cx="<?= $markerSize/2 ?>" cy="<?= $markerSize/2 ?>" r="<?= $markerInnerRadius ?>" fill="<?= $location->getMarkerColor2() ?>" />
</clipPath>
</defs>
<image width="<?= $markerSize*$innerScale ?>" height="<?= $markerSize*$innerScale ?>" x="<?= $imagePosition ?>" y="<?= $imagePosition ?>" xlink:href="<?= $image ?>" clip-path="url(#oxImageMask)" />
<?php endif; ?>
</svg>
@@ -0,0 +1,25 @@
<?php
/**
* @author Olegnax
* @package Olegnax_GoogleMap
* @copyright Copyright (c) 2020 Olegnax (http://olegnax.com/). All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Escaper;
use Magento\Framework\View\Element\Template;
use Olegnax\GoogleMap\Model\Location;
/** @var Template $block */
/** @var Escaper $escaper */
/** @var array $icon */
/** @var Location $location */
$viewBox = '0 0 ' . implode(' ', $icon['scaledSize']);
$markerScale = $location->getMarkerSize();
?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="<?= $viewBox ?>" xml:space="preserve">
<circle cx="18" cy="18" r="18" fill="<?= $location->getMarkerColor1() ?>" transform="scale(<?= $markerScale ?>)"/>
<circle cx="18" cy="18" r="4" fill="<?= $location->getMarkerColor2() ?>" transform="scale(<?= $markerScale ?>)"/>
</svg>
@@ -0,0 +1,25 @@
<?php
/**
* @author Olegnax
* @package Olegnax_GoogleMap
* @copyright Copyright (c) 2020 Olegnax (http://olegnax.com/). All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Escaper;
use Magento\Framework\View\Element\Template;
use Olegnax\GoogleMap\Model\Location;
/** @var Template $block */
/** @var Escaper $escaper */
/** @var array $icon */
/** @var Location $location */
$viewBox = '0 0 ' . implode(' ', $icon['scaledSize']);
$markerScale = $location->getMarkerSize();
?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="<?= $viewBox ?>" xml:space="preserve">
<ellipse class="ox-marker-shadow" cx="17.5" cy="33.2" rx="12.1" ry="1.8" fill="<?= $location->getMarkerShadowColor() ?>" transform="scale(<?= $markerScale ?>)"/>
<path d="M11,34L11,34c-1.1,0-2-0.9-2-2V2c0-1.1,0.9-2,2-2h0c1.1,0,2,0.9,2,2v30C13,33.1,12.1,34,11,34z" fill="<?= $location->getMarkerColor1() ?>" transform="scale(<?= $markerScale ?>)"/>
<polygon points="9,0 35,0 28,8 35,16 9,16 " fill="<?= $location->getMarkerColor2() ?>" transform="scale(<?= $markerScale ?>)"/>
</svg>
@@ -0,0 +1,29 @@
<?php
/**
* @author Olegnax
* @package Olegnax_GoogleMap
* @copyright Copyright (c) 2020 Olegnax (http://olegnax.com/). All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Escaper;
use Magento\Framework\View\Element\Template;
use Olegnax\GoogleMap\Model\Location;
/** @var Template $block */
/** @var Escaper $escaper */
/** @var array $icon */
/** @var Location $location */
$viewBox = '0 0 ' . implode(' ', $icon['scaledSize']);
$markerScale = $location->getMarkerSize();
?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="<?= $viewBox ?>" xml:space="preserve">
<ellipse cx="18" cy="49" rx="12" ry="2" fill="<?= $location->getMarkerShadowColor() ?>"
transform="scale(<?= $markerScale ?>)"/>
<path d="M18,50L18,50c-1.1,0-2-0.9-2-2V18c0-1.1,0.9-2,2-2h0c1.1,0,2,0.9,2,2v30C20,49.1,19.1,50,18,50z"
fill="<?= $location->getMarkerColor1() ?>" transform="scale(<?= $markerScale ?>)"/>
<circle cx="18" cy="15" r="15" fill="<?= $location->getMarkerColor2() ?>" transform="scale(<?= $markerScale ?>)"/>
</svg>
@@ -0,0 +1,28 @@
<?php
/**
* @author Olegnax
* @package Olegnax_GoogleMap
* @copyright Copyright (c) 2020 Olegnax (http://olegnax.com/). All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Escaper;
use Magento\Framework\View\Element\Template;
use Olegnax\GoogleMap\Model\Location;
/** @var Template $block */
/** @var Escaper $escaper */
/** @var array $icon */
/** @var Location $location */
$viewBox = '0 0 ' . implode(' ', $icon['scaledSize']);
$markerScale = $location->getMarkerSize();
?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="<?= $viewBox ?>" xml:space="preserve">
<ellipse class="ox-marker-shadow" cx="17" cy="39.5" rx="11" ry="1.5" fill="<?= $location->getMarkerShadowColor() ?>"
transform="scale(<?= $markerScale ?>)"/>
<path d="M29.6,28.4L18.7,39.3c-0.9,0.9-2.5,0.9-3.4,0L4.4,28.4" fill="<?= $location->getMarkerColor1() ?>"
transform="scale(<?= $markerScale ?>)"/>
<path d="M17,0C7.6,0,0,7.6,0,17s7.6,17,17,17s17-7.6,17-17S26.4,0,17,0z M17,24.2c-3.9,0-7-3.1-7-7s3.1-7,7-7s7,3.1,7,7
S20.9,24.2,17,24.2z" fill="<?= $location->getMarkerColor1() ?>" transform="scale(<?= $markerScale ?>)"/>
</svg>
@@ -0,0 +1,40 @@
<?php
/**
* @author Olegnax
* @package Olegnax_GoogleMap
* @copyright Copyright (c) 2020 Olegnax (http://olegnax.com/). All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Escaper;
use Magento\Framework\View\Element\Template;
use Olegnax\GoogleMap\Model\Data\Location as DataLocation;
use Olegnax\GoogleMap\Model\Location;
/** @var Template $block */
/** @var Escaper $escaper */
/** @var array $icon */
/** @var Location $location */
$viewBox = '0 0 ' . implode(' ', $icon['scaledSize']);
$markerScale = $location->getMarkerSize();
$markerSize = 70;
$innerScale = 0.7;
$imageScaled = $markerSize * $innerScale * $markerScale;
$innerPosition = (($markerSize-($markerSize*$innerScale))/2);
$image = $block->getData('widgetBlock')->contentLocalImage(DataLocation::MARKER_IMAGE, $location);
?>
<svg preserveaspectratio="xMidYMid meet" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="<?= $viewBox ?>">
<ellipse class="ox-marker-shadow" cx="<?= (($markerSize/2) - 6) ?>" cy="<?= ($markerSize - 4) ?>" rx="12" ry="2" fill="<?= $location->getMarkerShadowColor() ?>" transform="scale(<?= $markerScale ?>)"/>
<rect width="<?= $markerSize ?>" height="<?= $markerSize ?>" fill="<?= $location->getMarkerColor1() ?>" transform="scale(<?= $markerScale ?>)"/>
<rect x="<?= $innerPosition ?>" y="<?= $innerPosition ?>" width="<?= $markerSize*$innerScale ?>" height="<?= $markerSize*$innerScale ?>" fill="<?= $location->getMarkerColor2() ?>" transform="scale(<?= $markerScale ?>)"/>
<polygon points="36.3,78.5 27.8,70 36.3,70 44.8,70 " fill="<?= $location->getMarkerColor1() ?>" transform="scale(<?= $markerScale ?>)"/>
<?php if ($image): ?>
<defs>
<clipPath id="oxImageMask">
<rect x="<?= $innerPosition ?>" y="<?= $innerPosition ?>" width="<?= $markerSize*$innerScale ?>" height="<?= $markerSize*$innerScale ?>" fill="<?= $location->getMarkerColor2() ?>" transform="scale(<?= $markerScale ?>)"/>
</clipPath>
</defs>
<image width="<?= $imageScaled ?>" height="<?= $imageScaled ?>" x="<?= $innerPosition*$markerScale ?>" y="<?= $innerPosition*$markerScale ?>" xlink:href="<?= $image ?>" clip-path="url(#oxImageMask)" />
<?php endif; ?>
</svg>
@@ -0,0 +1,82 @@
<?php
/**
* Olegnax GoogleMap Style
*
* @author Olegnax
* @package Olegnax_GoogleMap
* @copyright Copyright (c) 2020 Olegnax (http://olegnax.com/). All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
use Magento\Framework\Escaper;
use Magento\Framework\View\Element\Template;
/** @var Template $block */
/** @var Escaper $escaper */
/** @var string $widgetId */
$widgetId = $block->getData('widgetId');
/** @var array $appearance */
$appearance = $block->getData('appearance');
/** @var array $general */
$general = $block->getData('general');
if ($appearance['custom_styles']):
$popBg = $appearance['popup_background'];
$popColor = $appearance['popup_color'];
$shadowParams = $appearance['popup_shadow'];
$shadowColor = $appearance['popup_shadow_color'];
$popBorderRadius = $appearance['popup_border_radius'];
if ($appearance['popup_max_width']):?>
#<?= $widgetId ?> .ox-gmap-popup { max-width: <?= $appearance['popup_max_width'] ?>px }
<?php endif; ?>
<?php if ($popBg || $popColor): ?>
.poi-info-window div,
.poi-info-window a {
<?php if ($popColor): ?>
color: <?= $popColor ?>!important;
<?php endif; ?>
<?php if ($popBg): ?>
background-color: <?= $popBg ?>!important;
<?php endif; ?>
}
<?php endif; ?>
<?php if ($popBg || $popColor || $shadowParams || $shadowColor || $popBorderRadius): ?>
#<?= $widgetId ?> .gm-style .gm-style-iw-c {
<?php if ($popBg): ?>
background-color: <?= $popBg ?>!important;
<?php endif; ?>
<?php if ($popColor): ?>
color: <?= $popColor ?>!important;
<?php endif; ?>
<?php if ($popBorderRadius !== ''): ?>
border-radius: <?= $popBorderRadius ?>px!important;
<?php endif; ?>
<?php if ($shadowParams || $shadowColor) : ?>
box-shadow: <?= ($shadowParams ?: '0 2px 7px 1px') . ' ' . ($shadowColor ?: 'rgba(0,0,0,0.33)') ?>!important;
<?php endif; ?>
}
<?php endif; ?>
<?php if ($popBg): ?>
#<?= $widgetId ?> .gm-style .gm-style-iw-t::after { background: linear-gradient(45deg,<?= $popBg ?> 50%,rgba(255,255,255,0) 51%,rgba(255,255,255,0) 100%);!important; }
<?php endif;
if ($appearance['popup_bottom_arrow_hide']): ?>
#<?= $widgetId ?> .gm-style .gm-style-iw-t::after { content: none!important; }
<?php endif;
if ($appearance['popup_close_btn_bg']):?>
#<?= $widgetId ?> .gm-style .gm-style-iw-c > button { opacity:1!important; background-color: <?= $appearance['popup_close_btn_bg'] ?>!important; }
<?php endif;
if ($appearance['popup_close_btn_invert']):?>
#<?= $widgetId ?> .gm-style .gm-style-iw-c > button > img { filter: invert(1)!important; }
<?php endif;
endif;
if ($general['height']): ?>
#<?= $widgetId ?>.ox-gmap-wrapper{ height: <?= $general['height'] ?>px }
<?php endif;
if ($general['height_tablet']): ?>
@media (max-width: 1024px) {#<?= $widgetId ?>.ox-gmap-wrapper{ height: <?= $general['height_tablet'] ?>px }}
<?php endif;
if ($general['height_mobile']): ?>
@media (max-width: 768px) {#<?= $widgetId ?>.ox-gmap-wrapper{ height: <?= $general['height_mobile'] ?>px }}
<?php endif;
@@ -0,0 +1,24 @@
<?php
/**
* Olegnax GoogleMap Widget
*
* @author Olegnax
* @package Olegnax_GoogleMap
* @copyright Copyright (c) 2020 Olegnax (http://olegnax.com/). All rights reserved.
* See COPYING.txt for license details.
* @noinspection PhpUnhandledExceptionInspection
*/
declare(strict_types=1);
use Magento\Framework\Escaper;
use Olegnax\GoogleMap\Block\Widget\GoogleMap;
/** @var GoogleMap $block */
/** @var Escaper $escaper */
if ($block->isEnabled()):
$widgetId = $block->getMapId();
echo $block->getStyle($widgetId);
?>
<div id="<?= $escaper->escapeHtmlAttr($widgetId); ?>" class="ox-gmap-wrapper" data-role="ox-google-map"
data-mage-init='<?= $escaper->escapeHtml($block->getWidgetConfig()) ?>'></div>
<?php endif;
@@ -0,0 +1,49 @@
// /**
// * Copyright (c) Olegnax (http://olegnax.com/). All rights reserved.
// */
//
// Common
// _____________________________________________
& when (@media-common = true) {
.ox-gmap-popup {
max-width: @ox-gmap__popup--max-width;
padding: @ox-gmap__popup--padding;
}
.ox-gmap-popup > *:last-child {
margin-bottom: 0;
}
.ox-gmap-wrapper {
width: @ox-gmap--width;
height: @ox-gmap--height;
}
.gm-style .gm-style-iw .ox-gmap-popup {
font-weight: @ox-gmap__popup--font-weight;
font-size: @ox-gmap__popup--font-size;
}
.ox-gmap-wrapper .gm-style .gm-style-iw-c {
padding-bottom:12px!important;
> button {
top: 0px !important;
right: 0px !important;
box-shadow:none;
border-radius:0;
border:none;
> img {
width: 22px !important;
height: 22px !important;
margin: 4px !important;
}
}
}
.ox-gmap-wrapper .gm-style-iw-d {
overflow: auto !important;
}
}
@@ -0,0 +1,6 @@
// /**
// * Copyright � Olegnax (http://olegnax.com/). All rights reserved.
// */
@import "_variables.less";
@import "_base.less";
@@ -0,0 +1,18 @@
// /**
// * Copyright � Olegnax (http://olegnax.com/). All rights reserved.
// */
//
// Variables
// _____________________________________________
@ox-gmap--width: 100%;
@ox-gmap--height: 450px;
@ox-gmap__popup--max-width: 420px;
@ox-gmap__popup--padding: 14px;
@ox-gmap__popup--font-size: 14px;
@ox-gmap__popup--font-weight: 400;
@marker_shape_size: 70px;
@marker_shape_bg: #ff542b;
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

@@ -0,0 +1,227 @@
define([
'jquery',
'jquery/ui',
'mage/translate'
], function ($) {
'use strict';
// noinspection JSDuplicatedDeclaration
$.widget('mage.OXGoogleMap', {
options: {
apiKey: '',
responsiveWidth: 768,
responsive: {
zoom: 16
},
map: {
zoom: 17,
zoom_closer: 17,
center: {
lat: null,
lng: null
},
streetViewControl: true,
mapTypeId: "roadmap",
mapTypeControlOptions: {
mapTypeIds: []
}
},
styles: [],
locations: [],
},
_create: function () {
this.markers = [];
this.map = undefined;
if (!window.hasOwnProperty('OxFuncGoogleMap')) {
this.OXInitGoogleMap();
}
},
_init: function () {
if (window.hasOwnProperty('OxFuncGoogleMap')) {
window.OxFuncGoogleMap.push($.proxy(this.CreateMap, this));
} else {
this._showError(
$.mage.__('Initialization element "OxFuncGoogleMap" not defined!')
);
}
},
_showError: function (message) {
if (!this.element.find('.message.error').length)
this.element.html('<div class="message error"><span>' + message + '</span></div>');
},
CreateMap: function () {
this.element.html('');
let config = this._mapConfig();
// noinspection JSCheckFunctionSignatures,JSUnresolvedVariable,AmdModulesDependencies
this.map = new google.maps.Map(this.element[0], config);
// noinspection JSUnresolvedFunction,JSUnresolvedVariable,AmdModulesDependencies
if (Array.isArray(this.options.styles) && 0 < this.options.styles.length) {
// noinspection JSUnresolvedFunction,JSUnresolvedVariable,AmdModulesDependencies
let styledMapType = new google.maps.StyledMapType(this.options.styles);
// noinspection JSUnresolvedVariable
this.map.mapTypes.set("styled_map", styledMapType);
// noinspection JSUnresolvedFunction
this.map.setMapTypeId("styled_map");
}
// noinspection JSUnresolvedFunction,JSUnresolvedVariable,AmdModulesDependencies
this.infoWindows = new google.maps.InfoWindow();
this.ReloadMarkers();
},
_mapConfig: function () {
let map = $.extend({}, this.options.map);
if (window.innerWidth < this.options.responsiveWidth)
map = $.extend(map, this.options.responsive);
if (null === map.center.lat || null === map.center.lng)
map.center = this._createCenter(this.options.locations);
if (null === map.center.lat || null === map.center.lng)
this._showError($.mage.__('Ox Google Map: You need to set central point Latitude and Longitude.'));
return map;
},
ReloadMarkers: function () {
this.removeOldMarkers();
if (!this.options.locations.length) {
this._showError($.mage.__('Ox Google Map: Location markers are missing!'));
return;
}
for (let i = 0; i < this.options.locations.length; i++) {
// noinspection JSUnresolvedFunction,JSUnresolvedVariable,AmdModulesDependencies
let marker = new google.maps.Marker(this._prepareLocation(this.options.locations[i]));
marker.addListener('click', this._clickerHandler(i));
this.markers[i] = marker;
}
},
_prepareLocation: function (location) {
// noinspection JSUnresolvedFunction,JSUnresolvedVariable,AmdModulesDependencies
location.position = new google.maps.LatLng(location.position);
location.icon = this._prepareIcon(location.icon);
location.map = this.map;
return location;
},
_clickerHandler: function (i) {
let _self = this;
return function () {
let marker = _self.markers[i];
_self.map.panTo(this.getPosition());
// noinspection JSUnresolvedFunction
if (_self.options.zoom_closer && _self.options.zoom_closer !== _self.options.zoom) {
// noinspection JSUnresolvedFunction
_self.map.setZoom(_self.options.zoom_closer);
}
if (_self.options.locations[i].description) {
_self.infoWindows.setContent('<div class="ox-gmap-popup">' + _self.options.locations[i].description + '</div>');
_self.infoWindows.open(_self.map, marker);
}
};
},
removeOldMarkers: function () {
let i = 0;
while (i < this.markers.length) { // noinspection JSUnresolvedFunction
if (this.markers[i++].setMap()) { // noinspection JSUnresolvedFunction
this.markers[i++].setMap(null);
}
}
this.markers = [];
},
_prepareIcon: function (icon) {
if ('object' !== typeof icon)
return icon;
for (let i in icon)
if (icon.hasOwnProperty(i))
switch (i) {
case 'scaledSize':
case 'size':
// noinspection JSUnresolvedFunction,JSUnresolvedVariable,AmdModulesDependencies
icon[i] = new google.maps.Size(parseInt(icon[i][0]), parseInt(icon[i][1]));
break;
case 'anchor':
case 'origin':
// noinspection JSUnresolvedVariable,AmdModulesDependencies
icon[i] = new google.maps.Point(parseInt(icon[i][0]), parseInt(icon[i][1]));
break;
}
return icon;
},
_createCenter: function (locations) {
// noinspection ES6ConvertVarToLetConst,JSDuplicatedDeclaration
var locations = locations || [];
if (!locations.length)
return {
lat: null,
lng: null,
};
let position = {
lat: 0,
lng: 0,
},
i = 0;
while (i < locations.length) {
let pos = locations[i++].position;
position.lat += pos.lat;
position.lng += pos.lng;
}
if (1 === locations.length)
return position;
position.lat /= locations.length;
position.lng /= locations.length;
return position;
},
OXInitGoogleMap: function () {
if (!this.options.apiKey) {
this._showError(
$.mage.__('Ox Google Map: Google Map API Key is not set ( Olegnax / GoogleMap : Configuration ).')
);
return;
}
let init = function (apiKey) {
this.functions = [];
this.runned = false;
this.appended = false;
this.apiKey = apiKey;
this.funcInit = 'OXInitGoogleMap';
this.push = function (func) {
if ('function' === typeof func) {
this.functions.push(func);
}
if (this.runned) {
this.run();
} else {
this.appendJS();
}
};
this.appendJS = function () {
if (this.appended)
return;
this.appended = true;
let s = document.createElement("script");
s.type = "text/javascript";
s.async = true;
s.defer = true;
s.src = "https://maps.googleapis.com/maps/api/js?key=" + this.apiKey + "&callback=" + this.funcInit;
window.document.body.append(s);
};
this.Run = function () {
this.runned = true;
while (this.functions.length) {
let func = this.functions.shift();
if ('function' === typeof func) {
func();
}
}
};
let timerId;
window[this.funcInit] = function () {
clearTimeout(timerId);
// noinspection JSUnresolvedVariable,AmdModulesDependencies
if ('object' === typeof google && google.hasOwnProperty('maps') && 'object' === typeof google.maps) {
window.OxFuncGoogleMap.Run();
} else {
// noinspection JSPotentiallyInvalidUsageOfThis
timerId = setTimeout(window[this.funcInit], 50);
}
};
timerId = setTimeout(window[this.funcInit], 50);
};
window.OxFuncGoogleMap = new init(this.options.apiKey);
}
});
return $.mage.OXGoogleMap;
});
@@ -0,0 +1,227 @@
define([
'jquery',
'jquery-ui-modules/widget',
'mage/translate'
], function ($) {
'use strict';
// noinspection JSDuplicatedDeclaration
$.widget('mage.OXGoogleMap', {
options: {
apiKey: '',
responsiveWidth: 768,
responsive: {
zoom: 16
},
map: {
zoom: 17,
zoom_closer: 17,
center: {
lat: null,
lng: null
},
streetViewControl: true,
mapTypeId: "roadmap",
mapTypeControlOptions: {
mapTypeIds: []
}
},
styles: [],
locations: [],
},
_create: function () {
this.markers = [];
this.map = undefined;
if (!window.hasOwnProperty('OxFuncGoogleMap')) {
this.OXInitGoogleMap();
}
},
_init: function () {
if (window.hasOwnProperty('OxFuncGoogleMap')) {
window.OxFuncGoogleMap.push($.proxy(this.CreateMap, this));
} else {
this._showError(
$.mage.__('Initialization element "OxFuncGoogleMap" not defined!')
);
}
},
_showError: function (message) {
if (!this.element.find('.message.error').length)
this.element.html('<div class="message error"><span>' + message + '</span></div>');
},
CreateMap: function () {
this.element.html('');
let config = this._mapConfig();
// noinspection JSCheckFunctionSignatures,JSUnresolvedVariable,AmdModulesDependencies
this.map = new google.maps.Map(this.element[0], config);
// noinspection JSUnresolvedFunction,JSUnresolvedVariable,AmdModulesDependencies
if (Array.isArray(this.options.styles) && 0 < this.options.styles.length) {
// noinspection JSUnresolvedFunction,JSUnresolvedVariable,AmdModulesDependencies
let styledMapType = new google.maps.StyledMapType(this.options.styles);
// noinspection JSUnresolvedVariable
this.map.mapTypes.set("styled_map", styledMapType);
// noinspection JSUnresolvedFunction
this.map.setMapTypeId("styled_map");
}
// noinspection JSUnresolvedFunction,JSUnresolvedVariable,AmdModulesDependencies
this.infoWindows = new google.maps.InfoWindow();
this.ReloadMarkers();
},
_mapConfig: function () {
let map = $.extend({}, this.options.map);
if (window.innerWidth < this.options.responsiveWidth)
map = $.extend(map, this.options.responsive);
if (null === map.center.lat || null === map.center.lng)
map.center = this._createCenter(this.options.locations);
if (null === map.center.lat || null === map.center.lng)
this._showError($.mage.__('Ox Google Map: You need to set central point Latitude and Longitude.'));
return map;
},
ReloadMarkers: function () {
this.removeOldMarkers();
if (!this.options.locations.length) {
this._showError($.mage.__('Ox Google Map: Location markers are missing!'));
return;
}
for (let i = 0; i < this.options.locations.length; i++) {
// noinspection JSUnresolvedFunction,JSUnresolvedVariable,AmdModulesDependencies
let marker = new google.maps.Marker(this._prepareLocation(this.options.locations[i]));
marker.addListener('click', this._clickerHandler(i));
this.markers[i] = marker;
}
},
_prepareLocation: function (location) {
// noinspection JSUnresolvedFunction,JSUnresolvedVariable,AmdModulesDependencies
location.position = new google.maps.LatLng(location.position);
location.icon = this._prepareIcon(location.icon);
location.map = this.map;
return location;
},
_clickerHandler: function (i) {
let _self = this;
return function () {
let marker = _self.markers[i];
_self.map.panTo(this.getPosition());
// noinspection JSUnresolvedFunction
if (_self.options.zoom_closer && _self.options.zoom_closer !== _self.options.zoom) {
// noinspection JSUnresolvedFunction
_self.map.setZoom(_self.options.zoom_closer);
}
if (_self.options.locations[i].description) {
_self.infoWindows.setContent('<div class="ox-gmap-popup">' + _self.options.locations[i].description + '</div>');
_self.infoWindows.open(_self.map, marker);
}
};
},
removeOldMarkers: function () {
let i = 0;
while (i < this.markers.length) { // noinspection JSUnresolvedFunction
if (this.markers[i++].setMap()) { // noinspection JSUnresolvedFunction
this.markers[i++].setMap(null);
}
}
this.markers = [];
},
_prepareIcon: function (icon) {
if ('object' !== typeof icon)
return icon;
for (let i in icon)
if (icon.hasOwnProperty(i))
switch (i) {
case 'scaledSize':
case 'size':
// noinspection JSUnresolvedFunction,JSUnresolvedVariable,AmdModulesDependencies
icon[i] = new google.maps.Size(parseInt(icon[i][0]), parseInt(icon[i][1]));
break;
case 'anchor':
case 'origin':
// noinspection JSUnresolvedVariable,AmdModulesDependencies
icon[i] = new google.maps.Point(parseInt(icon[i][0]), parseInt(icon[i][1]));
break;
}
return icon;
},
_createCenter: function (locations) {
// noinspection ES6ConvertVarToLetConst,JSDuplicatedDeclaration
var locations = locations || [];
if (!locations.length)
return {
lat: null,
lng: null,
};
let position = {
lat: 0,
lng: 0,
},
i = 0;
while (i < locations.length) {
let pos = locations[i++].position;
position.lat += pos.lat;
position.lng += pos.lng;
}
if (1 === locations.length)
return position;
position.lat /= locations.length;
position.lng /= locations.length;
return position;
},
OXInitGoogleMap: function () {
if (!this.options.apiKey) {
this._showError(
$.mage.__('Ox Google Map: Google Map API Key is not set ( Olegnax / GoogleMap : Configuration ).')
);
return;
}
let init = function (apiKey) {
this.functions = [];
this.runned = false;
this.appended = false;
this.apiKey = apiKey;
this.funcInit = 'OXInitGoogleMap';
this.push = function (func) {
if ('function' === typeof func) {
this.functions.push(func);
}
if (this.runned) {
this.run();
} else {
this.appendJS();
}
};
this.appendJS = function () {
if (this.appended)
return;
this.appended = true;
let s = document.createElement("script");
s.type = "text/javascript";
s.async = true;
s.defer = true;
s.src = "https://maps.googleapis.com/maps/api/js?key=" + this.apiKey + "&callback=" + this.funcInit;
window.document.body.append(s);
};
this.Run = function () {
this.runned = true;
while (this.functions.length) {
let func = this.functions.shift();
if ('function' === typeof func) {
func();
}
}
};
let timerId;
window[this.funcInit] = function () {
clearTimeout(timerId);
// noinspection JSUnresolvedVariable,AmdModulesDependencies
if ('object' === typeof google && google.hasOwnProperty('maps') && 'object' === typeof google.maps) {
window.OxFuncGoogleMap.Run();
} else {
// noinspection JSPotentiallyInvalidUsageOfThis
timerId = setTimeout(window[this.funcInit], 50);
}
};
timerId = setTimeout(window[this.funcInit], 50);
};
window.OxFuncGoogleMap = new init(this.options.apiKey);
}
});
return $.mage.OXGoogleMap;
});