setTemplate("bmbleb/jobs/status.phtml"); } public function getManager() { return Mage::getModel('combine/cron_manager_status'); } public function getAjaxToggleUrl() { return Mage::helper('adminhtml')->getUrl('*/*/toggleWorkerStatus'); } public function renderAsJson() { return json_encode(array( 'button_text' => $this->getButtonLabelText(), 'label_text' => $this->getLabelText(), )); } public function getLabelText() { if($this->getManager()->isActive()) { return $this->_getEnabledMessage(); } else if($this->getManager()->isBlocked()) { return $this->_getBlockedMessage(); } else { return $this->_getDisabledMessage(); } } protected function _getEnabledMessage() { $mgr = $this->getManager(); return 'Manager is ' . $mgr->getStatus() . ', and has been running for ' . $mgr->getRuntime() . ' seconds'; } protected function _getBlockedMessage() { return 'The Manager is DISABLED! ' . 'There may be available jobs left in the queue but will not be processed until the work manger is restarted. ' . 'This is likely because a stop work command was issued. '; } protected function _getDisabledMessage() { return 'The Manager is not running. ' . 'This is most likely because there are no available jobs left to run. ' . 'We will continue to queue jobs for syncing as they happen.'; } public function getButtonLabelText() { $manager = $this->getManager(); if($manager->isActive()) { $text = 'Deactivate Manager'; } else { $text = 'Start Manager'; } return $this->__($text); } }