Customers
in package
Customer as used in the Shop.
Includes access methods and data layer. Do not, I repeat, do not access private fields, or even try to access the database directly!
Tags
Table of Contents
Properties
- $objCustomer : Customer
- Static Customer
Methods
- get() : Customer
- Returns the Users matching the given parameter values
- getActiveMenuoptions() : string
- Returns a string with HTML code for the Customer status dropdown menu options
- getCount() : int
- Returns the number of Customers in the Usergroups with IDs present in the given array
- getGenderMenuoptions() : string
- Returns HTML options for selecting the gender in any menu
- getNameArray() : array<string|int, mixed>
- Returns an array of Customer names, ordered by last names, ascending
- getNameById() : string
- Returns a string representing the name of a customer
- getSortMenuoptions() : string
- Returns a string with HTML code for the Customer sorting dropdown menu options
- getTypeMenuoptions() : string
- Returns a string with HTML code for the Customer type dropdown menu options
- toggleStatusById() : bool
- Toggles the Customer status for the given ID
Properties
$objCustomer
Static Customer
private
static Customer
$objCustomer
= null
Methods
get()
Returns the Users matching the given parameter values
public
static get([array<string|int, mixed> $filter = null ][, string $search = null ][, array<string|int, mixed> $arrSort = null ][, int $limit = null ][, int $offset = 0 ]) : Customer
Parameters are like for User::getUsers(), without the attributes
Parameters
- $filter : array<string|int, mixed> = null
-
The optional filter array
- $search : string = null
-
The optional search string
- $arrSort : array<string|int, mixed> = null
-
The optional order array
- $limit : int = null
-
The optional upper limit
- $offset : int = 0
-
The optional offset
Return values
Customer —The Customer object on success, false(?) otherwise
getActiveMenuoptions()
Returns a string with HTML code for the Customer status dropdown menu options
public
static getActiveMenuoptions(int $selected[, bool $include_none = false ]) : string
Parameters
- $selected : int
-
The optional preselected status
- $include_none : bool = false
-
Prepend a null element if true. Defaults to false
Tags
Return values
string —The Menuoptions HTML code
getCount()
Returns the number of Customers in the Usergroups with IDs present in the given array
public
static getCount([array<string|int, mixed> $arrGroupId = null ]) : int
If $arrGroupId is empty, both final customers and resellers will automatically be included. Mind that the Customers are counted separately for each Usergroup, thus the latter must not overlap, since you don't want to count some Customers twice!
Parameters
- $arrGroupId : array<string|int, mixed> = null
-
The optional array of Usergroup IDs
Return values
int —The Customer count on success, 0 (zero) otherwise
getGenderMenuoptions()
Returns HTML options for selecting the gender in any menu
public
static getGenderMenuoptions([string $selected = null ]) : string
Parameters
- $selected : string = null
-
The optional preselected gender as defined in User_Profile_Attribute::$arrCoreAttributes
Return values
string —The HTML options string
getNameArray()
Returns an array of Customer names, ordered by last names, ascending
public
static getNameArray([bool $inactive = false ][, string $format = null ]) : array<string|int, mixed>
If $inactive is true, inactive Customers are included. See getNameById() for details on the $format parameter.
Parameters
- $inactive : bool = false
-
Include inactive Customers if true. Defaults to false
- $format : string = null
-
The optional format string
Return values
array<string|int, mixed> —The array of Customer names
getNameById()
Returns a string representing the name of a customer
public
static getNameById(int $customer_id[, string $format = null ]) : string
The format of the string is determined by the optional $format parameter in sprintf() format:
- %1$s : First name
- %2$s : Last name
- %3$u : ID
- %4$s : Username Defaults to '%2$s %1$s (%3$u)'
Parameters
- $customer_id : int
-
The Customer ID
- $format : string = null
-
The optional format string
Return values
string —The Customer name
getSortMenuoptions()
Returns a string with HTML code for the Customer sorting dropdown menu options
public
static getSortMenuoptions([int $selected = 'id' ]) : string
Parameters
- $selected : int = 'id'
-
The optional preselected order
Tags
Return values
string —The Menuoptions HTML code
getTypeMenuoptions()
Returns a string with HTML code for the Customer type dropdown menu options
public
static getTypeMenuoptions(int $selected[, bool $include_none = false ]) : string
Parameters
- $selected : int
-
The optional preselected type
- $include_none : bool = false
-
Prepend a null element if true. Defaults to false
Tags
Return values
string —The Menuoptions HTML code
toggleStatusById()
Toggles the Customer status for the given ID
public
static toggleStatusById(int $id) : bool
If the Customer doesn't exist to begin with, returns null.
Parameters
- $id : int
-
The Customer ID
Return values
bool —True on success, false on failure, or null otherwise