Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
index.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
9 ?>
10 
11 <?php if (is_array($block->getChildBlock('diagrams')->getTabsIds())) : ?>
12 <script>
13 require([
14  'Magento_Ui/js/modal/alert',
15  'prototype'
16 ], function(alert){
17 
18 window.changeDiagramsPeriod = function(periodObj) {
19  periodParam = periodObj.value ? 'period/' + periodObj.value + '/' : '';
20 <?php foreach ($block->getChildBlock('diagrams')->getTabsIds() as $tabId): ?>
21  ajaxBlockParam = 'block/tab_<?= /* @escapeNotVerified */ $tabId ?>/';
22  ajaxBlockUrl = '<?= $block->getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => '', 'period' => '']) ?>' + ajaxBlockParam + periodParam;
23  new Ajax.Request(ajaxBlockUrl, {
24  parameters: {isAjax: 'true', form_key: FORM_KEY},
25  onSuccess: function(transport) {
26  tabContentElementId = '<?= /* @escapeNotVerified */ $block->getChildBlock('diagrams')->getId() ?>_<?= /* @escapeNotVerified */ $tabId ?>_content';
27  try {
28  if (transport.responseText.isJSON()) {
29  var response = transport.responseText.evalJSON()
30  if (response.error) {
31  alert({
32  content: response.message
33  });
34  }
35  if(response.ajaxExpired && response.ajaxRedirect) {
36  setLocation(response.ajaxRedirect);
37  }
38  } else {
39  $(tabContentElementId).update(transport.responseText);
40  }
41  }
42  catch (e) {
43  $(tabContentElementId).update(transport.responseText);
44  }
45  }
46  });
47 <?php endforeach; ?>
48  ajaxBlockUrl = '<?= $block->getUrl('adminhtml/*/ajaxBlock', ['_current' => true, 'block' => 'totals', 'period' => '']) ?>' + periodParam;
49  new Ajax.Request(ajaxBlockUrl, {
50  parameters: {isAjax: 'true', form_key: FORM_KEY},
51  onSuccess: function(transport) {
52  tabContentElementId = 'dashboard_diagram_totals';
53  try {
54  if (transport.responseText.isJSON()) {
55  var response = transport.responseText.evalJSON();
56  if (response.error) {
57  alert({
58  content: response.message
59  });
60  }
61  if(response.ajaxExpired && response.ajaxRedirect) {
62  setLocation(response.ajaxRedirect);
63  }
64  } else {
65  $(tabContentElementId).replace(transport.responseText);
66  }
67  }
68  catch (e) {
69  $(tabContentElementId).replace(transport.responseText);
70  }
71  }
72  });
73 }
74 
75 });
76 </script>
77 <?php endif; ?>
78 <div class="dashboard-container row">
79  <div class="dashboard-main col-m-8 col-m-push-4">
80  <div class="dashboard-diagram-container">
81  <?= $block->getChildHtml('diagrams') ?>
82  <?php if (is_array($block->getChildBlock('diagrams')->getTabsIds())) : ?>
83  <div id="diagram_tab_content" class="dashboard-diagram-tab-content"></div>
84  <?php endif; ?>
85  </div>
86  <?= $block->getChildHtml('totals') ?>
87  <div class="dashboard-store-stats">
88  <?= $block->getChildHtml('grids') ?>
89  <div id="grid_tab_content" class="dashboard-store-stats-content"></div>
90  <?= $block->getChildHtml('refresh_statistics') ?>
91  </div>
92  </div>
93  <div class="dashboard-secondary col-m-4 col-m-pull-8">
94  <?= $block->getChildHtml('sales') ?>
95  <div class="dashboard-item">
96  <div class="dashboard-item-title"><?= /* @escapeNotVerified */ __('Last Orders') ?></div>
97  <?= $block->getChildHtml('lastOrders') ?>
98  </div>
99  <div class="dashboard-item">
100  <div class="dashboard-item-title"><?= /* @escapeNotVerified */ __('Last Search Terms') ?></div>
101  <?= $block->getChildHtml('lastSearches') ?>
102  </div>
103  <div class="dashboard-item">
104  <div class="dashboard-item-title"><?= /* @escapeNotVerified */ __('Top Search Terms') ?></div>
105  <?= $block->getChildHtml('topSearches') ?>
106  </div>
107  </div>
108 </div>
$block
Definition: block.php:8