diff --git a/src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Dashboard.php b/src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Dashboard.php index 36aeb6c7..89bbcd9c 100644 --- a/src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Dashboard.php +++ b/src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Dashboard.php @@ -24,7 +24,8 @@ public function __construct() { } public function getIsZendeskDashboard() { - return Mage::app()->getFrontController()->getRequest()->getControllerName() === 'zendesk'; + $request = Mage::app()->getFrontController()->getRequest(); + return $request && $request->getControllerName() === 'zendesk'; } public function getAuthHeader() { diff --git a/src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Dashboard/Grids.php b/src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Dashboard/Grids.php index a93618f3..c82e755c 100644 --- a/src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Dashboard/Grids.php +++ b/src/app/code/community/Zendesk/Zendesk/Block/Adminhtml/Dashboard/Grids.php @@ -120,6 +120,7 @@ protected function _prepareLayout() { } public function getIsZendeskDashboard() { - return Mage::app()->getFrontController()->getRequest()->getControllerName() === 'zendesk'; + $request = Mage::app()->getFrontController()->getRequest(); + return $request && $request->getControllerName() === 'zendesk'; } } diff --git a/src/app/code/community/Zendesk/Zendesk/Model/Observer.php b/src/app/code/community/Zendesk/Zendesk/Model/Observer.php index 708fa7ed..b2f878f1 100644 --- a/src/app/code/community/Zendesk/Zendesk/Model/Observer.php +++ b/src/app/code/community/Zendesk/Zendesk/Model/Observer.php @@ -18,38 +18,6 @@ class Zendesk_Zendesk_Model_Observer { - public function setHook(Varien_Event_Observer $observer) - { - if (Mage::app()->getFrontController()->getAction()->getFullActionName() === 'adminhtml_dashboard_index') - { - $block = $observer->getBlock(); - if ($block->getNameInLayout() === 'dashboard') - { - $block->getChild('totals')->setUseAsDashboardHook(true); - } - } - } - - public function insertBlock(Varien_Event_Observer $observer) - { - if (Mage::app()->getFrontController()->getAction()->getFullActionName() === 'adminhtml_dashboard_index') - { - if ($observer->getBlock()->getUseAsDashboardHook()) - { - $html = $observer->getTransport()->getHtml(); - $zendeskDash = $observer->getBlock()->getLayout() - ->createBlock('zendesk/adminhtml_dashboard') - ->setName('zendesk_dashboard'); - $zendeskGrid = $zendeskDash->getLayout() - ->createBlock('zendesk/adminhtml_dashboard_grids') - ->setName('zendesk_dashboard_grids'); - $zendeskDash->setChild('zendesk_dashboard_grids', $zendeskGrid); - $html .= $zendeskDash->toHtml(); - $observer->getTransport()->setHtml($html); - } - } - } - public function saveConfig(Varien_Event_Observer $observer) { // Defaults for "global" scope diff --git a/src/app/code/community/Zendesk/Zendesk/etc/config.xml b/src/app/code/community/Zendesk/Zendesk/etc/config.xml index 70756017..90a39769 100644 --- a/src/app/code/community/Zendesk/Zendesk/etc/config.xml +++ b/src/app/code/community/Zendesk/Zendesk/etc/config.xml @@ -149,22 +149,6 @@ - - - - zendesk/observer - setHook - - - - - - - zendesk/observer - insertBlock - - - diff --git a/src/app/design/adminhtml/default/default/layout/zendesk.xml b/src/app/design/adminhtml/default/default/layout/zendesk.xml index d75bf933..35c5be19 100644 --- a/src/app/design/adminhtml/default/default/layout/zendesk.xml +++ b/src/app/design/adminhtml/default/default/layout/zendesk.xml @@ -17,6 +17,14 @@ */ --> + + + + + + + + diff --git a/src/app/design/adminhtml/default/default/template/zendesk/dashboard/index.phtml b/src/app/design/adminhtml/default/default/template/zendesk/dashboard/index.phtml index 81d7ffd2..11fb2b4d 100644 --- a/src/app/design/adminhtml/default/default/template/zendesk/dashboard/index.phtml +++ b/src/app/design/adminhtml/default/default/template/zendesk/dashboard/index.phtml @@ -25,8 +25,16 @@ + + - + getChildHtml('zendesk_dashboard_grids') ?> getIsZendeskDashboard()): ?>