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_ImportExport_Adminhtml_ExportController
  • Mage_ImportExport_Adminhtml_ImportController
  • Mage_ImportExport_Block_Adminhtml_Export_Edit
  • Mage_ImportExport_Block_Adminhtml_Export_Edit_Form
  • Mage_ImportExport_Block_Adminhtml_Export_Filter
  • Mage_ImportExport_Block_Adminhtml_Import_Edit
  • Mage_ImportExport_Block_Adminhtml_Import_Edit_Form
  • Mage_ImportExport_Block_Adminhtml_Import_Frame_Result
  • Mage_ImportExport_Helper_Data
  • Mage_ImportExport_Model_Abstract
  • Mage_ImportExport_Model_Config
  • Mage_ImportExport_Model_Export
  • Mage_ImportExport_Model_Export_Adapter_Abstract
  • Mage_ImportExport_Model_Export_Adapter_Csv
  • Mage_ImportExport_Model_Export_Entity_Abstract
  • Mage_ImportExport_Model_Export_Entity_Customer
  • Mage_ImportExport_Model_Export_Entity_Product
  • Mage_ImportExport_Model_Export_Entity_Product_Type_Abstract
  • Mage_ImportExport_Model_Export_Entity_Product_Type_Configurable
  • Mage_ImportExport_Model_Export_Entity_Product_Type_Grouped
  • Mage_ImportExport_Model_Export_Entity_Product_Type_Simple
  • Mage_ImportExport_Model_Import
  • Mage_ImportExport_Model_Import_Adapter
  • Mage_ImportExport_Model_Import_Adapter_Abstract
  • Mage_ImportExport_Model_Import_Adapter_Csv
  • Mage_ImportExport_Model_Import_Entity_Abstract
  • Mage_ImportExport_Model_Import_Entity_Customer
  • Mage_ImportExport_Model_Import_Entity_Customer_Address
  • Mage_ImportExport_Model_Import_Entity_Product
  • Mage_ImportExport_Model_Import_Entity_Product_Type_Abstract
  • Mage_ImportExport_Model_Import_Entity_Product_Type_Configurable
  • Mage_ImportExport_Model_Import_Entity_Product_Type_Grouped
  • Mage_ImportExport_Model_Import_Entity_Product_Type_Simple
  • Mage_ImportExport_Model_Import_Proxy_Product
  • Mage_ImportExport_Model_Import_Proxy_Product_Resource
  • Mage_ImportExport_Model_Import_Uploader
  • Mage_ImportExport_Model_Mysql4_Import_Data
  • Mage_ImportExport_Model_Mysql4_Setup
  • Mage_ImportExport_Model_Resource_Import_Data
  • Mage_ImportExport_Model_Resource_Setup
  • Mage_ImportExport_Model_Source_Export_Entity
  • Mage_ImportExport_Model_Source_Export_Format
  • Mage_ImportExport_Model_Source_Import_Behavior
  • Mage_ImportExport_Model_Source_Import_Entity
  • 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_ImportExport
 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:  * Abstract import adapter
 29:  *
 30:  * @category    Mage
 31:  * @package     Mage_ImportExport
 32:  * @author      Magento Core Team <core@magentocommerce.com>
 33:  */
 34: abstract class Mage_ImportExport_Model_Import_Adapter_Abstract implements SeekableIterator
 35: {
 36:     /**
 37:      * Column names array.
 38:      *
 39:      * @var array
 40:      */
 41:     protected $_colNames;
 42: 
 43:     /**
 44:      * Quantity of columns in first (column names) row.
 45:      *
 46:      * @var int
 47:      */
 48:     protected $_colQuantity;
 49: 
 50:     /**
 51:      * Current row.
 52:      *
 53:      * @var array
 54:      */
 55:     protected $_currentRow = null;
 56: 
 57:     /**
 58:      * Current row number.
 59:      *
 60:      * @var int
 61:      */
 62:     protected $_currentKey = null;
 63: 
 64:     /**
 65:      * Source file path.
 66:      *
 67:      * @var string
 68:      */
 69:     protected $_source;
 70: 
 71:     /**
 72:      * Adapter object constructor.
 73:      *
 74:      * @param string $source Source file path.
 75:      * @throws Mage_Core_Exception
 76:      * @return void
 77:      */
 78:     final public function __construct($source)
 79:     {
 80:         if (!is_string($source)) {
 81:             Mage::throwException(Mage::helper('importexport')->__('Source file path must be a string'));
 82:         }
 83:         if (!is_readable($source)) {
 84:             Mage::throwException(Mage::helper('importexport')->__("%s file does not exists or is not readable", $source));
 85:         }
 86:         $this->_source = $source;
 87: 
 88:         $this->_init();
 89: 
 90:         // validate column names consistency
 91:         if (is_array($this->_colNames) && !empty($this->_colNames)) {
 92:             $this->_colQuantity = count($this->_colNames);
 93: 
 94:             if (count(array_unique($this->_colNames)) != $this->_colQuantity) {
 95:                 Mage::throwException(Mage::helper('importexport')->__('Column names have duplicates'));
 96:             }
 97:         } else {
 98:             Mage::throwException(Mage::helper('importexport')->__('Column names is empty or is not an array'));
 99:         }
100:     }
101: 
102:     /**
103:      * Method called as last step of object instance creation. Can be overridden in child classes.
104:      *
105:      * @return Mage_ImportExport_Model_Import_Adapter_Abstract
106:      */
107:     protected function _init()
108:     {
109:         return $this;
110:     }
111: 
112:     /**
113:      * Return the current element.
114:      *
115:      * @return mixed
116:      */
117:     public function current()
118:     {
119:         return array_combine(
120:             $this->_colNames,
121:             count($this->_currentRow) != $this->_colQuantity
122:                     ? array_pad($this->_currentRow, $this->_colQuantity, '')
123:                     : $this->_currentRow
124:         );
125:     }
126: 
127:     /**
128:      * Column names getter.
129:      *
130:      * @return array
131:      */
132:     public function getColNames()
133:     {
134:         return $this->_colNames;
135:     }
136: 
137:     /**
138:      * Return the key of the current element.
139:      *
140:      * @return int More than 0 integer on success, integer 0 on failure.
141:      */
142:     public function key()
143:     {
144:         return $this->_currentKey;
145:     }
146: 
147:     /**
148:      * Seeks to a position.
149:      *
150:      * @param int $position The position to seek to.
151:      * @return void
152:      */
153:     public function seek($position)
154:     {
155:         Mage::throwException(Mage::helper('importexport')->__('Not implemented yet'));
156:     }
157: 
158:     /**
159:      * Checks if current position is valid.
160:      *
161:      * @return boolean Returns true on success or false on failure.
162:      */
163:     public function valid()
164:     {
165:         return !empty($this->_currentRow);
166:     }
167: 
168:     /**
169:      * Check source file for validity.
170:      *
171:      * @return Mage_ImportExport_Model_Import_Adapter_Abstract
172:      */
173:     public function validateSource()
174:     {
175:         return $this;
176:     }
177: }
178: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0