@@ -35,8 +35,8 @@ public function indexAction()
3535 $ this ->_redirect ('adminhtml/dashboard ' );
3636 return ;
3737 }
38-
39- $ this ->storeDependenciesInCachedRegistry ();
38+
39+ Mage:: helper ( ' zendesk ' ) ->storeDependenciesInCachedRegistry ();
4040
4141 $ this ->_title ($ this ->__ ('Zendesk Dashboard ' ));
4242 $ this ->loadLayout ();
@@ -629,7 +629,7 @@ public function ticketsAllAction() {
629629 $ isAjax = Mage::app ()->getRequest ()->isAjax ();
630630
631631 if ($ isAjax ) {
632- $ this ->storeDependenciesInCachedRegistry ();
632+ Mage:: helper ( ' zendesk ' ) ->storeDependenciesInCachedRegistry ();
633633 $ this ->getResponse ()->setBody ($ this ->getLayout ()->createBlock ('zendesk/adminhtml_dashboard_tab_tickets_grid_all ' )->toHtml ());
634634 }
635635 }
@@ -638,34 +638,14 @@ public function ticketsViewAction() {
638638 $ isAjax = Mage::app ()->getRequest ()->isAjax ();
639639
640640 if ($ isAjax ) {
641- $ this ->storeDependenciesInCachedRegistry ();
641+ Mage:: helper ( ' zendesk ' ) ->storeDependenciesInCachedRegistry ();
642642 $ viewId = (int ) $ this ->getRequest ()->getParam ('viewid ' );
643643 Mage::register ('zendesk_tickets_view ' , $ viewId );
644644
645645 $ this ->getResponse ()->setBody ($ this ->getLayout ()->createBlock ('zendesk/adminhtml_dashboard_tab_tickets_grid_view ' )->toHtml ());
646646 }
647647 }
648648
649- protected function storeDependenciesInCachedRegistry () {
650- $ cache = Mage::app ()->getCache ();
651-
652- if ( $ cache ->load ('zendesk_users ' ) === false ) {
653- $ users = serialize ( Mage::getModel ('zendesk/api_users ' )->all () );
654- $ cache ->save ($ users , 'zendesk_users ' , array ('zendesk ' , 'zendesk_users ' ), 300 );
655- }
656-
657- if ( $ cache ->load ('zendesk_groups ' ) === false ) {
658- $ groups = serialize ( Mage::getModel ('zendesk/api_groups ' )->all () );
659- $ cache ->save ($ groups , 'zendesk_groups ' , array ('zendesk ' , 'zendesk_groups ' ), 1200 );
660- }
661-
662- $ users = unserialize ( $ cache ->load ('zendesk_users ' ) );
663- $ groups = unserialize ( $ cache ->load ('zendesk_groups ' ) );
664-
665- Mage::register ('zendesk_users ' , $ users );
666- Mage::register ('zendesk_groups ' , $ groups );
667- }
668-
669649 protected function getMassActionResponse ($ response , $ ids , $ message = '%d out of %d ticket(s) were updated. ' )
670650 {
671651 if (isset ($ response ['job_status ' ]) && isset ($ response ['job_status ' ]['url ' ])) {
0 commit comments