CORE POS - Fannie
The CORE POS back end
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
COREPOS\Fannie\API\FannieUploadPage Class Reference
Inheritance diagram for COREPOS\Fannie\API\FannieUploadPage:
FanniePage AdTextImportPage AlaffiaUploadPage CoolItemUploadPage CoopDealsUploadPage DefaultUploadPage DenfeldInitialUpload DepartmentImportPage EdlpCatalogOverwrite EdlpUploadPage EquityHistoryImportPage ExcelUpload GardenOfLifeUploadPage HobartItemCsvUploadPage LikeCodePriceUploadPage MemContactImportPage MemNameNumImportPage PatronageCheckNumbersUploadPage PatronageUploadPage ProductImportPage ScaleItemUploadPage SubdeptImportPage UnfiUploadPage UploadPluMapPage VendorDepartmentUploadPage WfcAbandonEquityImport WfcGazetteBillingPage WicUploadPage XlsBatchPage

Public Member Functions

 preprocess ()
 
 process_file ($linedata, $indexes)
 
 split_start ()
 
 split_end ()
 
 bodyContent ()
 
 form_content ()
 
 preview_content ()
 
 javascript_content ()
 
 results_content ()
 
 ajaxContent ()
 
 helpContent ()
 
 unitTest ($phpunit)
 

Public Attributes

 $required = true
 
 $description
 
 $page_set = 'Import Tools'
 

Protected Member Functions

 processUpload ()
 
 uploadError ()
 
 processingError ()
 
 basicForm ()
 
 basicPreview ()
 
 getIndexes ()
 
 getColumnIndex ($name)
 
 get_column_index ($name)
 
 fileToArray ($limit=0)
 
 csvToArray ($limit=0)
 
 xlsToArray ($limit)
 
 xlsxToArray ($limit)
 
 simpleStats ($stats, $key='imported')
 
 checkIndex ($index, $line)
 

Protected Attributes

 $content_function = "form_content"
 
 $preview = true
 
 $preview_opts
 
 $preview_selections = array()
 
 $upload_field_name = 'FannieUploadFile'
 
 $upload_file_name = ''
 
 $allowed_extensions = array('csv','xls','xlsx')
 
 $error_details = 'n/a'
 
 $use_splits = false
 
 $use_js = false
 

Member Function Documentation

COREPOS\Fannie\API\FannieUploadPage::basicForm ( )
protected

Default form automatically included with form_content()

Returns
An HTML string
COREPOS\Fannie\API\FannieUploadPage::basicPreview ( )
protected

Default preview of uploaded data

Returns
An HTML string
COREPOS\Fannie\API\FannieUploadPage::bodyContent ( )

Use the function $this->content_function to generate the page contents.

Returns
An HTML string
COREPOS\Fannie\API\FannieUploadPage::csvToArray (   $limit = 0)
protected

Helper for csv files. See fileToArray()

COREPOS\Fannie\API\FannieUploadPage::fileToArray (   $limit = 0)
protected

Get two-dimensional array of file data

Parameters
$limitif specified only return $limit records
Returns
An array of arrays. Each inner array represents one line of data
COREPOS\Fannie\API\FannieUploadPage::form_content ( )

Any extra content before the form itself.

Returns
An HTML string
COREPOS\Fannie\API\FannieUploadPage::getColumnIndex (   $name)
protected

Get the numerical index that the user selected for a given column

Parameters
$namethe name (as defined in $this->preview_opts)
Returns
Integer index if available otherwise False
COREPOS\Fannie\API\FannieUploadPage::javascript_content ( )

This function ensures column selections are unique.

COREPOS\Fannie\API\FannieUploadPage::preprocess ( )

Handle pre-display tasks such as input processing

Returns
  • True if the page should be displayed
  • False to stop here

Create temporary database table and load all records into the table

first pass

Render page that includes ajax javascript

COREPOS\Fannie\API\FannieUploadPage::preview_content ( )

Any extra content to show with the preview

Returns
An HTML string
COREPOS\Fannie\API\FannieUploadPage::process_file (   $linedata,
  $indexes 
)

Do something with the uploaded data

Parameters
$linedataan array of arrays (each inner area is one line of data)
$indexesan array of column names and indexes
Returns
True on success, False on error
COREPOS\Fannie\API\FannieUploadPage::processingError ( )
protected

Display if there is an processing error

Returns
An HTML string
COREPOS\Fannie\API\FannieUploadPage::processUpload ( )
protected

Store uploaded file

Returns
True on success, False on error
COREPOS\Fannie\API\FannieUploadPage::results_content ( )

What to display when the upload is done

Returns
An HTML string
COREPOS\Fannie\API\FannieUploadPage::split_end ( )

Called after processing all split files process_file() will be called multiple times so anything that should only happen once goes here instead.

COREPOS\Fannie\API\FannieUploadPage::split_start ( )

Called before processing split files process_file() will be called multiple times so anything that should only happen once goes here instead.

COREPOS\Fannie\API\FannieUploadPage::uploadError ( )
protected

Display if there is an upload error

Returns
An HTML string
COREPOS\Fannie\API\FannieUploadPage::xlsToArray (   $limit)
protected

Helper for xls files. See fileToArray()

Member Data Documentation

COREPOS\Fannie\API\FannieUploadPage::$content_function = "form_content"
protected

Function for drawing page content. form_content, preview_content, and results content provided by default.

COREPOS\Fannie\API\FannieUploadPage::$description
Initial value:
= "
Base class for handling file uploads
"
COREPOS\Fannie\API\FannieUploadPage::$preview = true
protected

Show a preview where the user can choose columns that contain data

COREPOS\Fannie\API\FannieUploadPage::$preview_opts
protected
Initial value:
= array(
'example' => array(
'name' => 'upc',
'display_name' => 'UPC',
'default' => 0,
'required' => false,
),
)

Define user-selectable options

COREPOS\Fannie\API\FannieUploadPage::$use_js = false
protected

Make repeated AJAX calls to process part of the file and provide progress feedback. Similar to splitting in that process_file is called repeatedly and split_start() and split_end() called once each at the very beginning and end. Works with all supported file types BUT must be able to load the entire file within PHP's memory_limit. Memory allocated to load the file can be substantially higher than the raw file size.

COREPOS\Fannie\API\FannieUploadPage::$use_splits = false
protected

Split uploaded file into multiple smaller files process_file() will be called separately for each smaller file. split_start() and split_end() are called at the beginning and end of the whole process. Only works with CSV files in *nix environments.


The documentation for this class was generated from the following file: