-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#12061: Merge branch '2.2-develop' of github.com:magento/magento2 int…
…o contact-module-cleanups
- Loading branch information
Showing
356 changed files
with
22,194 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Analytics\Api\Data; | ||
|
||
/** | ||
* Interface LinkInterface | ||
* | ||
* Represents link with collected data and initialized vector for decryption. | ||
*/ | ||
interface LinkInterface | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function getUrl(); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getInitializationVector(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Analytics\Api; | ||
|
||
/** | ||
* Provides link to file with collected report data. | ||
*/ | ||
interface LinkProviderInterface | ||
{ | ||
/** | ||
* @return \Magento\Analytics\Api\Data\LinkInterface | ||
*/ | ||
public function get(); | ||
} |
37 changes: 37 additions & 0 deletions
37
app/code/Magento/Analytics/Block/Adminhtml/System/Config/AdditionalComment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Analytics\Block\Adminhtml\System\Config; | ||
|
||
/** | ||
* Provides field with additional information | ||
*/ | ||
class AdditionalComment extends \Magento\Config\Block\System\Config\Form\Field | ||
{ | ||
/** | ||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element | ||
* @return string | ||
*/ | ||
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element) | ||
{ | ||
$html = '<div class="config-additional-comment-title">' . $element->getLabel() . '</div>'; | ||
$html .= '<div class="config-additional-comment-content">' . $element->getComment() . '</div>'; | ||
return $this->decorateRowHtml($element, $html); | ||
} | ||
|
||
/** | ||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element | ||
* @param string $html | ||
* @return string | ||
*/ | ||
private function decorateRowHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element, $html) | ||
{ | ||
return sprintf( | ||
'<tr id="row_%s"><td colspan="3"><div class="config-additional-comment">%s</div></td></tr>', | ||
$element->getHtmlId(), | ||
$html | ||
); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
app/code/Magento/Analytics/Block/Adminhtml/System/Config/CollectionTimeLabel.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Analytics\Block\Adminhtml\System\Config; | ||
|
||
/** | ||
* Provides label with default Time Zone | ||
*/ | ||
class CollectionTimeLabel extends \Magento\Config\Block\System\Config\Form\Field | ||
{ | ||
/** | ||
* Add default time zone to comment | ||
* | ||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element | ||
* @return string | ||
*/ | ||
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element) | ||
{ | ||
$timeZoneCode = $this->_localeDate->getConfigTimezone(); | ||
$getLongTimeZoneName = \IntlTimeZone::createTimeZone($timeZoneCode)->getDisplayName(); | ||
$element->setData( | ||
'comment', | ||
sprintf("%s (%s)", $getLongTimeZoneName, $timeZoneCode) | ||
); | ||
return parent::render($element); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
app/code/Magento/Analytics/Block/Adminhtml/System/Config/SubscriptionStatusLabel.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Analytics\Block\Adminhtml\System\Config; | ||
|
||
use Magento\Analytics\Model\SubscriptionStatusProvider; | ||
use Magento\Backend\Block\Template\Context; | ||
|
||
/** | ||
* Class SubscriptionStatusLabel. | ||
* | ||
* Provides labels for subscription status | ||
* Status can be reviewed in System Configuration | ||
*/ | ||
class SubscriptionStatusLabel extends \Magento\Config\Block\System\Config\Form\Field | ||
{ | ||
/** | ||
* @var SubscriptionStatusProvider | ||
*/ | ||
private $subscriptionStatusProvider; | ||
|
||
/** | ||
* SubscriptionStatusLabel constructor. | ||
* | ||
* @param Context $context | ||
* @param SubscriptionStatusProvider $labelStatusProvider | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
SubscriptionStatusProvider $labelStatusProvider, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
$this->subscriptionStatusProvider = $labelStatusProvider; | ||
} | ||
|
||
/** | ||
* Add Subscription status to comment | ||
* | ||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element | ||
* @return string | ||
*/ | ||
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element) | ||
{ | ||
$element->setData( | ||
'comment', | ||
$this->prepareLabelValue() | ||
); | ||
return parent::render($element); | ||
} | ||
|
||
/** | ||
* Prepare label for subscription status | ||
* | ||
* @return string | ||
*/ | ||
private function prepareLabelValue() | ||
{ | ||
return __('Subscription status') . ': ' . __($this->subscriptionStatusProvider->getStatus()); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
app/code/Magento/Analytics/Block/Adminhtml/System/Config/Vertical.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Analytics\Block\Adminhtml\System\Config; | ||
|
||
/** | ||
* Provides vertical select with additional information and style customization | ||
*/ | ||
class Vertical extends \Magento\Config\Block\System\Config\Form\Field | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element) | ||
{ | ||
$html = '<div class="config-vertical-title">' . $element->getHint() . '</div>'; | ||
$html .= '<div class="config-vertical-comment">' . $element->getComment() . '</div>'; | ||
return $this->decorateRowHtml($element, $html); | ||
} | ||
|
||
/** | ||
* Decorates row HTML for custom element style | ||
* | ||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element | ||
* @param string $html | ||
* @return string | ||
*/ | ||
private function decorateRowHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element, $html) | ||
{ | ||
$rowHtml = sprintf('<tr><td colspan="4">%s</td></tr>', $html); | ||
$rowHtml .= sprintf( | ||
'<tr id="row_%s"><td class="label config-vertical-label">%s</td><td class="value">%s</td></tr>', | ||
$element->getHtmlId(), | ||
$element->getLabelHtml($element->getHtmlId(), "[WEBSITE]"), | ||
$element->getElementHtml() | ||
); | ||
return $rowHtml; | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
app/code/Magento/Analytics/Controller/Adminhtml/BIEssentials/SignUp.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Analytics\Controller\Adminhtml\BIEssentials; | ||
|
||
use Magento\Backend\App\Action; | ||
use Magento\Backend\App\Action\Context; | ||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
|
||
/** | ||
* Class SignUp | ||
* | ||
* Provides link to BI Essentials signup | ||
*/ | ||
class SignUp extends Action | ||
{ | ||
/** | ||
* Path to config value with URL to BI Essentials sign-up page. | ||
* | ||
* @var string | ||
*/ | ||
private $urlBIEssentialsConfigPath = 'analytics/url/bi_essentials'; | ||
|
||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* @param Context $context | ||
* @param ScopeConfigInterface $config | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
ScopeConfigInterface $config | ||
) { | ||
$this->config = $config; | ||
parent::__construct($context); | ||
} | ||
|
||
/** | ||
* Check admin permissions for this controller | ||
* | ||
* @return boolean | ||
*/ | ||
protected function _isAllowed() | ||
{ | ||
return $this->_authorization->isAllowed('Magento_Analytics::bi_essentials'); | ||
} | ||
|
||
/** | ||
* Provides link to BI Essentials signup | ||
* | ||
* @return \Magento\Framework\Controller\AbstractResult | ||
*/ | ||
public function execute() | ||
{ | ||
return $this->resultRedirectFactory->create()->setUrl( | ||
$this->config->getValue($this->urlBIEssentialsConfigPath) | ||
); | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
app/code/Magento/Analytics/Controller/Adminhtml/Reports/Show.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Analytics\Controller\Adminhtml\Reports; | ||
|
||
use Magento\Analytics\Model\Exception\State\SubscriptionUpdateException; | ||
use Magento\Analytics\Model\ReportUrlProvider; | ||
use Magento\Backend\App\Action; | ||
use Magento\Backend\App\Action\Context; | ||
use Magento\Framework\Controller\Result\Redirect; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Framework\Exception\LocalizedException; | ||
|
||
/** | ||
* Provide redirect to resource with reports. | ||
*/ | ||
class Show extends Action | ||
{ | ||
/** | ||
* @var ReportUrlProvider | ||
*/ | ||
private $reportUrlProvider; | ||
|
||
/** | ||
* @param Context $context | ||
* @param ReportUrlProvider $reportUrlProvider | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
ReportUrlProvider $reportUrlProvider | ||
) { | ||
$this->reportUrlProvider = $reportUrlProvider; | ||
parent::__construct($context); | ||
} | ||
|
||
/** | ||
* Check admin permissions for this controller. | ||
* | ||
* @return boolean | ||
*/ | ||
protected function _isAllowed() | ||
{ | ||
return $this->_authorization->isAllowed('Magento_Analytics::analytics_settings'); | ||
} | ||
|
||
/** | ||
* Redirect to resource with reports. | ||
* | ||
* @return Redirect $resultRedirect | ||
*/ | ||
public function execute() | ||
{ | ||
/** @var Redirect $resultRedirect */ | ||
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); | ||
try { | ||
$resultRedirect->setUrl($this->reportUrlProvider->getUrl()); | ||
} catch (SubscriptionUpdateException $e) { | ||
$this->getMessageManager()->addNoticeMessage($e->getMessage()); | ||
$resultRedirect->setPath('adminhtml'); | ||
} catch (LocalizedException $e) { | ||
$this->getMessageManager()->addExceptionMessage($e, $e->getMessage()); | ||
$resultRedirect->setPath('adminhtml'); | ||
} catch (\Exception $e) { | ||
$this->getMessageManager()->addExceptionMessage( | ||
$e, | ||
__('Sorry, there has been an error processing your request. Please try again later.') | ||
); | ||
$resultRedirect->setPath('adminhtml'); | ||
} | ||
|
||
return $resultRedirect; | ||
} | ||
} |
Oops, something went wrong.