Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Connect_Adminhtml_Extension_CustomController
  • Mage_Connect_Adminhtml_Extension_LocalController
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Form
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Abstract
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Authors
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Contents
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Depends
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Grid
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Load
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Local
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Package
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tab_Release
  • Mage_Connect_Block_Adminhtml_Extension_Custom_Edit_Tabs
  • Mage_Connect_Helper_Data
  • Mage_Connect_Model_Extension
  • Mage_Connect_Model_Extension_Collection
  • Mage_Connect_Model_Session
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Connect
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Extension controller
 29:  *
 30:  * @category    Mage
 31:  * @package     Mage_Connect
 32:  * @author      Magento Core Team <core@magentocommerce.com>
 33:  */
 34: class Mage_Connect_Adminhtml_Extension_CustomController extends Mage_Adminhtml_Controller_Action
 35: {
 36:     /**
 37:      * Redirect to edit Extension Package action
 38:      *
 39:      */
 40:     public function indexAction()
 41:     {
 42:         $this->_title($this->__('System'))
 43:              ->_title($this->__('Magento Connect'))
 44:              ->_title($this->__('Package Extensions'));
 45: 
 46:         $this->_forward('edit');
 47:     }
 48: 
 49:     /**
 50:      * Edit Extension Package Form
 51:      *
 52:      */
 53:     public function editAction()
 54:     {
 55:         $this->_title($this->__('System'))
 56:              ->_title($this->__('Magento Connect'))
 57:              ->_title($this->__('Package Extensions'))
 58:              ->_title($this->__('Edit Extension'));
 59: 
 60:         $this->loadLayout();
 61:         $this->_setActiveMenu('system/extension/custom');
 62:         $this->renderLayout();
 63:     }
 64: 
 65:     /**
 66:      * Reset Extension Package form data
 67:      *
 68:      */
 69:     public function resetAction()
 70:     {
 71:         Mage::getSingleton('connect/session')->unsCustomExtensionPackageFormData();
 72:         $this->_redirect('*/*/edit');
 73:     }
 74: 
 75:     /**
 76:      * Load Local Extension Package
 77:      *
 78:      */
 79:     public function loadAction()
 80:     {
 81:         $packageName = base64_decode(strtr($this->getRequest()->getParam('id'), '-_,', '+/='));
 82:         if ($packageName) {
 83:             $session = Mage::getSingleton('connect/session');
 84:             try {
 85:                 $data = Mage::helper('connect')->loadLocalPackage($packageName);
 86:                 if (!$data) {
 87:                     Mage::throwException(Mage::helper('connect')->__('Failed to load the package data.'));
 88:                 }
 89:                 $data = array_merge($data, array('file_name' => $packageName));
 90:                 $session->setCustomExtensionPackageFormData($data);
 91:                 $session->addSuccess(
 92:                     Mage::helper('connect')->__('The package %s data has been loaded.', $packageName)
 93:                 );
 94:             } catch (Exception $e) {
 95:                 $session->addError($e->getMessage());
 96:             }
 97:         }
 98:         $this->_redirect('*/*/edit');
 99:     }
100: 
101:     /**
102:      * Save Extension Package
103:      *
104:      */
105:     public function saveAction()
106:     {
107:         $session = Mage::getSingleton('connect/session');
108:         $p = $this->getRequest()->getPost();
109: 
110:         if (!empty($p['_create'])) {
111:             $create = true;
112:             unset($p['_create']);
113:         }
114: 
115:         if ($p['file_name'] == '') {
116:             $p['file_name'] = $p['name'];
117:         }
118: 
119:         $session->setCustomExtensionPackageFormData($p);
120:         try {
121:             $ext = Mage::getModel('connect/extension');
122:             /** @var $ext Mage_Connect_Model_Extension */
123:             $ext->setData($p);
124:             if ($ext->savePackage()) {
125:                 $session->addSuccess(Mage::helper('connect')->__('The package data has been saved.'));
126:             } else {
127:                 $session->addError(Mage::helper('connect')->__('There was a problem saving package data'));
128:                 $this->_redirect('*/*/edit');
129:             }
130:             if (empty($create)) {
131:                 $this->_redirect('*/*/edit');
132:             } else {
133:                 $this->_forward('create');
134:             }
135:         } catch (Mage_Core_Exception $e){
136:             $session->addError($e->getMessage());
137:             $this->_redirect('*/*');
138:         } catch (Exception $e){
139:             $session->addException($e, Mage::helper('connect')->__('Failed to save the package.'));
140:             $this->_redirect('*/*');
141:         }
142:     }
143: 
144:     /**
145:      * Create new Extension Package
146:      *
147:      */
148:     public function createAction()
149:     {
150:         $session = Mage::getSingleton('connect/session');
151:         try {
152:             $p = $this->getRequest()->getPost();
153:             $session->setCustomExtensionPackageFormData($p);
154:             $ext = Mage::getModel('connect/extension');
155:             $ext->setData($p);
156:             $packageVersion = $this->getRequest()->getPost('version_ids');
157:             if (is_array($packageVersion)) {
158:                 if (in_array(Mage_Connect_Package::PACKAGE_VERSION_2X, $packageVersion)) {
159:                     $ext->createPackage();
160:                 }
161:                 if (in_array(Mage_Connect_Package::PACKAGE_VERSION_1X, $packageVersion)) {
162:                     $ext->createPackageV1x();
163:                 }
164:             }
165:             $this->_redirect('*/*');
166:         } catch(Mage_Core_Exception $e){
167:             $session->addError($e->getMessage());
168:             $this->_redirect('*/*');
169:         } catch(Exception $e){
170:             $session->addException($e, Mage::helper('connect')->__('Failed to create the package.'));
171:             $this->_redirect('*/*');
172:         }
173:     }
174: 
175:     /**
176:      * Load Grid with Local Packages
177:      *
178:      */
179:     public function loadtabAction()
180:     {
181:         $this->loadLayout();
182:         $this->renderLayout();
183:     }
184: 
185:     /**
186:      * Grid for loading packages
187:      *
188:      */
189:     public function gridAction()
190:     {
191:         $this->loadLayout();
192:         $this->renderLayout();
193:     }
194: 
195:     /**
196:      * Check is allowed access to actions
197:      *
198:      * @return bool
199:      */
200:     protected function _isAllowed()
201:     {
202:         return Mage::getSingleton('admin/session')->isAllowed('system/extensions/custom');
203:     }
204: }
205: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0