phpDocumentor

ShipcloudController extends AdminHttpViewController
in package

Class ShipcloudController

Table of Contents

MAX_DESCRIPTION_LENGTH  = 50
$assets  : AssetCollectionInterface
$contentView  : ContentViewInterface
$httpContextReader  : HttpContextReaderInterface
$httpResponseProcessor  : HttpResponseProcessorInterface
$postDataArray  : array<string|int, mixed>
$queryParametersArray  : array<string|int, mixed>
$serverDataArray  : array<string|int, mixed>
$shipcloudConfigurationStorage  : ShipcloudConfigurationStorage
configuration storage
$shipcloudLogger  : ShipcloudLogger
logger
$shipcloudText  : ShipcloudText
wrapper for text phrases
$db  : CI_DB_query_builder
Query Builder
__construct()  : mixed
actionCreateLabelForm()  : HttpControllerResponse
Shows a form for entering data for a label
actionCreateLabelFormSubmit()  : JsonHttpControllerResponse
Processes form submit for forms created by actionCreateLabelForm()
actionCreateMultiLabelForm()  : HttpControllerResponse
Shows form for bulk label retrieval
actionCreateMultiLabelFormSubmit()  : JsonHttpControllerResponse
Processes form data from form returned by actionCreateMultiLabelForm().
actionDefault()  : mixed
Run the actionDefault method.
actionDeleteShipment()  : mixed
Deletes a shipment label
actionGetMultiShipmentQuote()  : JsonHttpControllerResponse
Retrieves shipment quotes (bulk retrieval)
actionGetShipmentQuote()  : JsonHttpControllerResponse
Uses form data (cf. actionCreateLabelForm()) to retrieve a shipment quote
actionLoadLabelList()  : HttpControllerResponse
Outputs a list of labels for an order identified by its orders_id via the corresponding GET parameter
actionLoadMultiLabelList()  : HttpControllerResponse
Retrieves list of labels for a set of orders listed in POST[orders_ids].
actionPickupShipments()  : JsonHttpControllerResponse
Requests pickups for a given list of shipments from each of the carriers involved
actionUnconfiguredNote()  : HttpControllerResponse
Returns message to be displayed to users if the Shipcloud interface is still unconfigured
proceed()  : mixed
Override "proceed" method of parent and use it for initialization.
validateCurrentAdminStatus()  : mixed
Makes sure that the admin status is currently given in session
_callActionMethod()  : HttpControllerResponseInterface
Invokes an action method by the given action name.
_enforceLengthLimits()  : array<string|int, mixed>
modifies an array containing a delivery address to suit carrier-specific field lengths
_getPostData()  : string|null
Returns the expected $_POST value by the given key name.
_getPostDataCollection()  : KeyValueCollection
Creates and returns a key value collection which represent the global $_POST array.
_getQueryParameter()  : mixed|null
Returns the expected $_GET value by the given key name.
_getQueryParametersCollection()  : KeyValueCollection
Creates and returns a key value collection which represent the global $_GET array.
_getServerData()  : string|null
Returns the expected $_SERVER value by the given key name.
_getShippingWeight()  : mixed
computes total weight of products for an order
_prepareSingleFormDataForShipmentRequest()  : KeyValueCollection
Uses POST data from the form returned by actionCreateLabelForm() to populate a KeyValueCollection to be fed to the ShipmentFactory
_render()  : string
Renders and returns a template file.
_validatePageToken()  : mixed
Check if the $_POST['pageToken'] or $_GET['pageToken'] variable is provided and if it's valid.
getDeclaredValue()  : float
retrieves an order's total
getOrderLanguageCode()  : string
Looks up the language for a given order and returns the 2-letter ISO code
getTemplateFile()  : ExistingFile
Searches the GXModules directory and admin/html directory for a template file, wich can be useed inside the AdminLayoutHttpControllerResponse object for the template parameter.
getTransportConditions()  : mixed
isConfigured()  : mixed
determines if Shipcloud is configured and ready to use
isValidJson()  : bool
isValidRequestMethod()  : bool
makeProductName()  : mixed
prepareJsonInput()  : array<string|int, mixed>
shortenString()  : string
shortens a string to a maximum length, appending “…” if shortening required
splitStreet()  : array<string|int, mixed>
Heuristically splits up a street address into its component street name and house number

Constants

Properties

$shipcloudConfigurationStorage

configuration storage

protected ShipcloudConfigurationStorage $shipcloudConfigurationStorage

Methods

actionDefault()

Run the actionDefault method.

public actionDefault() : mixed
Return values
mixed

actionDeleteShipment()

Deletes a shipment label

public actionDeleteShipment() : mixed
Return values
mixed

_enforceLengthLimits()

modifies an array containing a delivery address to suit carrier-specific field lengths

protected _enforceLengthLimits(string $carrier, array<string|int, mixed> $toArray) : array<string|int, mixed>

Currently returns $toArray unchanged. Future operation tbd.

Parameters
$carrier : string
$toArray : array<string|int, mixed>

delivery address

Return values
array<string|int, mixed>

_getPostData()

Returns the expected $_POST value by the given key name.

protected _getPostData(string $keyName) : string|null

This method is the object oriented layer for $_POST[$keyName].

Parameters
$keyName : string

Expected key of post parameter.

Return values
string|null

Either the expected value or null, of not found.

_getQueryParameter()

Returns the expected $_GET value by the given key name.

protected _getQueryParameter(string $keyName) : mixed|null

This method is the object oriented layer for $_GET[$keyName].

Parameters
$keyName : string

Expected key of query parameter.

Return values
mixed|null

Either the expected value or null, of not found.

_getServerData()

Returns the expected $_SERVER value by the given key name.

protected _getServerData(string $keyName) : string|null

This method is the object oriented layer for $_SERVER[$keyName].

Parameters
$keyName : string

Expected key of server parameter.

Return values
string|null

Either the expected value or null, of not found.

_getShippingWeight()

computes total weight of products for an order

protected _getShippingWeight(mixed $orders_id) : mixed
Parameters
$orders_id : mixed
Return values
mixed

_prepareSingleFormDataForShipmentRequest()

Uses POST data from the form returned by actionCreateLabelForm() to populate a KeyValueCollection to be fed to the ShipmentFactory

protected _prepareSingleFormDataForShipmentRequest(array<string|int, mixed> $postDataArray[, bool $anon_from = false ][, string $language_code = null ]) : KeyValueCollection
Parameters
$postDataArray : array<string|int, mixed>
$anon_from : bool = false

used for shipment quote requests

$language_code : string = null

ISO2 language code used for advance notices (e.g. DPD Predict)

Return values
KeyValueCollection

_render()

Renders and returns a template file.

protected _render(string $templateFile, array<string|int, mixed> $contentArray) : string
Parameters
$templateFile : string

Template file to render.

$contentArray : array<string|int, mixed>

Content array which represent the variables of the template.

Return values
string

Rendered template.

_validatePageToken()

Check if the $_POST['pageToken'] or $_GET['pageToken'] variable is provided and if it's valid.

protected _validatePageToken([string $customExceptionMessage = null ]) : mixed

Example: public function proceed(HttpContextInterface $httpContext) { parent::proceed($httpContext); // proceed http context from parent class if($_SERVER['REQUEST_METHOD'] === 'POST') { $this->_validatePageToken(); // CSRF Protection } }

Parameters
$customExceptionMessage : string = null

(optional) You can specify a custom exception message.

Tags
throws
Exception

If the validation fails.

Return values
mixed

getDeclaredValue()

retrieves an order's total

protected getDeclaredValue(int $orders_id) : float
Parameters
$orders_id : int

the order's id

Tags
todo

get this data from OrderService

Return values
float

getOrderLanguageCode()

Looks up the language for a given order and returns the 2-letter ISO code

protected getOrderLanguageCode(int $orders_id) : string
Parameters
$orders_id : int
Return values
string

ISO2 language code

getTemplateFile()

Searches the GXModules directory and admin/html directory for a template file, wich can be useed inside the AdminLayoutHttpControllerResponse object for the template parameter.

protected getTemplateFile(string $templateFile) : ExistingFile
Parameters
$templateFile : string

The relative path and filename to search for

Tags
throws
Exception

if the path or file is not found

Return values
ExistingFile

containing absolute file path to the given template file

getTransportConditions()

protected getTransportConditions(mixed $orderId) : mixed
Parameters
$orderId : mixed
Return values
mixed

isConfigured()

determines if Shipcloud is configured and ready to use

protected isConfigured() : mixed
Return values
mixed

isValidRequestMethod()

protected isValidRequestMethod(string $method) : bool
Parameters
$method : string
Return values
bool

makeProductName()

protected makeProductName(mixed $product) : mixed
Parameters
$product : mixed
Return values
mixed

prepareJsonInput()

protected prepareJsonInput(string $json) : array<string|int, mixed>
Parameters
$json : string
Return values
array<string|int, mixed>

shortenString()

shortens a string to a maximum length, appending “…” if shortening required

protected shortenString(string $subject, int $maxLength) : string
Parameters
$subject : string

string to be shortened

$maxLength : int

maximum length

Return values
string

shortened string

splitStreet()

Heuristically splits up a street address into its component street name and house number

protected splitStreet(mixed $street_address) : array<string|int, mixed>
Parameters
$street_address : mixed
Return values
array<string|int, mixed>

with keys 'street' and 'house_no'

Search results