\apex\app\utilshashes

Hashes Library

Service: apex\services\utils\hashes

Handles the various has operations against the hashes defined within the $this->hash array within package.php configuration files. Allows you to easily parse a hash, obtain select options, etc.

This class is available within the services container, meaning its methods can be accessed statically via the service singleton as shown below.

PHP Example

</php

namespace apex;

use apex\app; use apex\services\utils\hashes;

// Get variables s $var = hashes::get_hashvar('users:status', 'active');

Summary

Methods
Properties
Constants
create_options()
get_hash_var()
parse_data_source()
get_stdvar()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

create_options()

create_options(string  $hash_alias, \apex\app\utils\string/array  $value = '', string  $form_field = 'select', string  $form_name = '') : string

Uses key-value pairs of a hash, and creates the necessary ( HTML code for select, radio, or checkbox lists.

Parameters

string $hash_alias

The alias of the hash in standard Apex format (eg. PACKAGE:ALIAS).

\apex\app\utils\string/array $value

Optional, and the value of the select / radio list. Pass array if form field is 'checkbox'.

string $form_field

Can be either 'select', 'radio', or 'checkbox'. Defaults to 'select'.

string $form_name

Only valid if $form_field is 'radio' or 'checkbox', and is the name of the form field.

Returns

string —

The resulting HTML code for the select / ario / checkbox list.

get_hash_var()

get_hash_var(string  $hash_alias,   $var_alias) : string

Returns the value of a hash variable.

Parameters

string $hash_alias

The alis of the ash in standard Apex format (ie. PACKAGE:ALIAS).

$var_alias

The alias / key of the variable to return the value of.

Returns

string —

The value of the variable.

parse_data_source()

parse_data_source(string  $data_source, string  $value = '', string  $form_field = 'select', string  $form_name = '') : string

Parse data source

Parses a database source, and returns the necessary select list. This allows you to pull information from a variety of ways, and siplay a select list of options.

Parameters

string $data_source

The data source. See documentation for full details.

string $value

The value of the select list, if an option is selected.

string $form_field

The form field to output, can be 'select', 'radio' or 'checkbox'. Defaults to 'select'.

string $form_name

Only applicable if $form_field is 'radio' or 'checkbox', and is the name of the form field.

Returns

string —

The resulting HTML code.

get_stdvar()

get_stdvar(string  $type, string  $abbr,   $column = 'name') : string

Gets value of a stdlist variable (timezone, language, country, currency)

Parameters

string $type

The list to retrieve value from. Must be 'timezone', 'country', 'language', or 'currency'.

string $abbr

The abbreviation of the value (eg. 'en' = English). This is the value stored within the database.

$column

The column from the internal_stdlists table to return. Defaults to 'name'

Returns

string —

The value of the stdlist variable.