/**
  * Delete action
  */
 public function deleteAction()
 {
     $id = $this->getRequest()->getParam('id');
     if (0 === (int) $id) {
         // No ID
         $this->_session->addError($this->__('Invalid entry ID.'));
         $this->_redirectBack();
         return;
     }
     try {
         /** @var $collection Mage_Oauth_Model_Resource_Token_Collection */
         $collection = Mage::getModel('oauth/token')->getCollection();
         $collection->joinConsumerAsApplication()->addFilterByCustomerId($this->_session->getCustomerId())->addFilterByType(Mage_Oauth_Model_Token::TYPE_ACCESS)->addFilterById($id);
         /** @var $model Mage_Oauth_Model_Token */
         $model = $collection->getFirstItem();
         if ($model->getId()) {
             $name = $model->getName();
             $model->delete();
             $this->_session->addSuccess($this->__('Application "%s" has been deleted.', $name));
         } else {
             $this->_session->addError($this->__('Application not found.'));
         }
     } catch (Mage_Core_Exception $e) {
         $this->_session->addError($e->getMessage());
     } catch (Exception $e) {
         $this->_session->addError($this->__('An error occurred on delete application.'));
         Mage::logException($e);
     }
     $this->_redirectBack();
 }
 /**
  * Generic profile view action
  */
 protected function _viewAction()
 {
     try {
         $profile = $this->_initProfile();
         $this->_title($this->__('Recurring Profiles'))->_title($this->__('Profile #%s', $profile->getReferenceId()));
         $this->loadLayout();
         $this->_initLayoutMessages('customer/session');
         $navigationBlock = $this->getLayout()->getBlock('customer_account_navigation');
         if ($navigationBlock) {
             $navigationBlock->setActive('sales/recurring_profile/');
         }
         $this->renderLayout();
         return;
     } catch (Mage_Core_Exception $e) {
         $this->_session->addError($e->getMessage());
     } catch (Exception $e) {
         Mage::logException($e);
     }
     $this->_redirect('*/*/');
 }
 private function _viewAction()
 {
     if (!$this->_loadValidSubscription()) {
         return;
     }
     try {
         $subscription = Mage::registry('current_subscription');
         $this->_title(Mage::helper('customweb_subscription')->__('Subscriptions'))->_title(Mage::helper('customweb_subscription')->__('Subscription #%s', $subscription->getReferenceId()));
         $this->loadLayout();
         $this->_initLayoutMessages('customer/session');
         $navigationBlock = $this->getLayout()->getBlock('customer_account_navigation');
         if ($navigationBlock) {
             $navigationBlock->setActive('customweb_subscription/subscription/');
         }
         $this->renderLayout();
         return;
     } catch (Mage_Core_Exception $e) {
         $this->_session->addError($e->getMessage());
     } catch (Exception $e) {
         Mage::logException($e);
     }
     $this->_redirect('*/*/');
 }