Documentation

Creditcard
in package

Creditcard helper methods

Tags
version
3.0.0
since
2.2.0
subpackage

core

copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Reto Kohli reto.kohli@comvation.com

todo

Test!

Table of Contents

Constants

TEXT_CORE_CREDITCARD_NAME  : mixed = 'CORE_CREDITCARD_NAME'
Database key

Properties

$arrCreditcards  : array<string|int, mixed>
Array of all creditcards

Methods

errorHandler()  : bool
Tries to fix or recreate the database table(s) for the class
getArray()  : array<string|int, mixed>
Returns the array of all creditcards
getMenu()  : string
Returns the HTML dropdown menu code for the active creditcards.
getMenuoptions()  : string
Returns the HTML code for the creditcards dropdown menu options
getNameArray()  : array<string|int, mixed>
Returns the array of all creditcard names indexed by their ID and ordered by the ordinal value
getNameById()  : string
Returns the name of the creditcard selected by its ID
getOrdById()  : string
Returns the ordinal value of the creditcard selected by its ID
init()  : bool
Initialise the static $arrCreditcards array with all creditcards found in the database

Constants

TEXT_CORE_CREDITCARD_NAME

Database key

public mixed TEXT_CORE_CREDITCARD_NAME = 'CORE_CREDITCARD_NAME'

Properties

$arrCreditcards

Array of all creditcards

private static array<string|int, mixed> $arrCreditcards = \false
Tags
access

private

see
init()

Methods

errorHandler()

Tries to fix or recreate the database table(s) for the class

public errorHandler() : bool

Should be called whenever there's a problem with the database table.

Return values
bool —

False. Always.

getArray()

Returns the array of all creditcards

public static getArray() : array<string|int, mixed>
Tags
static
Return values
array<string|int, mixed> —

The creditcard array on success, false otherwise

getMenu()

Returns the HTML dropdown menu code for the active creditcards.

public static getMenu([string $selected_id = '' ][, string $menuName = 'creditcardId' ][, string $onchange = '' ]) : string

Frontend use only.

Parameters
$selected_id : string = ''

Optional preselected creditcard ID

$menuName : string = 'creditcardId'

Optional name of the menu, defaults to "creditcardId"

$onchange : string = ''

Optional onchange callback function

Tags
static
Return values
string —

The HTML dropdown menu code

getMenuoptions()

Returns the HTML code for the creditcards dropdown menu options

public static getMenuoptions([string $selected_id = 0 ]) : string

Remembers the last selected ID and the menu options created, so it's very quick to call this again using the same arguments.

Parameters
$selected_id : string = 0

Optional preselected creditcard ID

Tags
static
Return values
string —

The HTML dropdown menu options code

getNameArray()

Returns the array of all creditcard names indexed by their ID and ordered by the ordinal value

public static getNameArray() : array<string|int, mixed>
Tags
static
Return values
array<string|int, mixed> —

The creditcard name array on success, false otherwise

getNameById()

Returns the name of the creditcard selected by its ID

public static getNameById(int $creditcard_id) : string

If a creditcard with the given ID does not exist, returns the empty string.

Parameters
$creditcard_id : int

The creditcard ID

Tags
static
Return values
string —

The creditcard name, or the empty string

getOrdById()

Returns the ordinal value of the creditcard selected by its ID

public static getOrdById(int $creditcard_id) : string

If a creditcard with the given ID does not exist, returns zero.

Parameters
$creditcard_id : int

The creditcard ID

Tags
static
Return values
string —

The ordinal value, or zero

init()

Initialise the static $arrCreditcards array with all creditcards found in the database

public init() : bool

The array created is of the form array( creditcard ID => array( 'id' => creditcard ID, 'name' => creditcard name, 'ord' => ordinal value, ), ... more ... ) The array is sorted by the ordinal values.

Tags
global

ADONewConnection $objDatabase

Return values
bool —

True on success, false otherwise

On this page

Search results