Constants

VERSION_MAJOR

VERSION_MAJOR = 2

which version is this? even if we are unreleased, keep track of internal version-to-be developers need to set this in code. The user-displayed string is generated into $CAT_VERSION_STRING and $CAT_COPYRIGHT below

VERSION_MINOR

VERSION_MINOR = 0

VERSION_PATCH

VERSION_PATCH = 0

VERSION_EXTRA

VERSION_EXTRA = alpha2

RELEASE_VERSION

RELEASE_VERSION = FALSE

USER_API_VERSION

USER_API_VERSION = 2

DB_TYPE

DB_TYPE = INST

the default database to query in this class.

L_OK

L_OK = 0

L_REMARK

L_REMARK = 4

L_WARN

L_WARN = 32

L_ERROR

L_ERROR = 256

Properties

$device

$device : 

Type

$CAT_VERSION_STRING

$CAT_VERSION_STRING : 

Type

$CAT_COPYRIGHT

$CAT_COPYRIGHT : 

Type

$nomenclature_fed

$nomenclature_fed : 

the custom displayable variant of the term 'federation'

Type

$nomenclature_inst

$nomenclature_inst : 

the custom displayable variant of the term 'institution'

Type

$knownFederations

$knownFederations : mixed|string|int

all known federation, in an array with ISO short name as an index, and localised version of the pretty-print name as value.

The static value is only filled with meaningful content after the first object has been instantiated. That is because it is not possible to define static properties with function calls like _().

Type

mixed|string|int — of all known federations

$country

$country : 

Type

$idp

$idp : 

Type

$profile

$profile : 

Type

$args

$args : 

Type

$profileCount

$profileCount : 

Type

$page

$page : 

Type

$loggerInstance

$loggerInstance : \core\common\Logging

We occasionally log stuff (debug/audit). Have an initialised Logging instance nearby is sure helpful.

Type

\core\common\Logging —

$languageInstance

$languageInstance : \core\common\Language

access to language settings to be able to switch textDomain

Type

\core\common\Language —

$installerPath

$installerPath : 

Type

Methods

__construct()

__construct() 

create the SimpleGUI object calling CAT constructor first

sets up all public prperties of the object

generateInstaller()

generateInstaller(  device,   profileId,  generatedFor = user,  token = NULL,  password = NULL) : mixed|string|int

Prepare the device module environment and send back the link This method creates a device module instance via the {@link DeviceFactory} call, then sets up the device module environment for the specific profile by calling {@link DeviceConfig::setup()} method and finally, called the devide writeInstaller meethod passing the returned path name.

Parameters

device

identifier as in {@link devices.php}

profileId

profile identifier

generatedFor
token
password

Returns

mixed|string|int —

array with the following fields: profile - the profile identifier; device - the device identifier; link - the path name of the resulting installer mime - the mimetype of the installer

listDevices()

listDevices( showHidden) 

interface to Devices::listDevices()

Parameters

showHidden

deviceInfo()

deviceInfo(  device,   profileId) 

Parameters

device
profileId

profileAttributes()

profileAttributes(  profId) : mixed|string|int

Prepare the support data for a given profile

Parameters

profId

profile identifier

Returns

mixed|string|int —

array with the following fields:

  • local_email
  • local_phone
  • local_url
  • description
  • devices - an array of device names and their statuses (for a given profile)

downloadInstaller()

downloadInstaller(  device,   prof_id,  generated_for = user,  token = NULL,  password = NULL) : 

Generate and send the installer

Parameters

device

identifier as in {@link devices.php}

prof_id

profile identifier

generated_for
token
password

Returns

binary stream: installerFile

locateUser()

locateUser() : mixed|string|int

find out where the user is currently located

Returns

mixed|string|int —

orderIdentityProviders()

orderIdentityProviders( country, mixed|string|int  currentLocation = NULL) : mixed|string|int

Order active identity providers according to their distance and name

Parameters

country
mixed|string|int currentLocation
  • current location

Returns

mixed|string|int —

$IdPs - list of arrays ('id', 'name');

detectOS()

detectOS() : array|bool

Detect the best device driver form the browser Detects the operating system and returns its id display name and group membership (as in devices.php)

Returns

array|bool —

OS information, indexed by 'id', 'display', 'group'

getUserCerts()

getUserCerts(  token) : array|bool

finds all the user certificates that originated in a given token

Parameters

token

Returns

array|bool —

returns FALSE if a token is invalid, otherwise array of certs

totalIdPs()

totalIdPs(  level) : 

Calculates the number of IdPs overall in the system

Parameters

level

completeness level of IdPs that are to be taken into consideration for counting

Returns

listAllIdentityProviders()

listAllIdentityProviders(  activeOnly,   country) : mixed|string|int

Lists all identity providers in the database adding information required by DiscoJuice.

Parameters

activeOnly

if set to non-zero will cause listing of only those institutions which have some valid profiles defined.

country

if set, only list IdPs in a specific country

Returns

mixed|string|int —

the list of identity providers

printCountryList()

printCountryList(  activeOnly) : mixed|string|int

Prepares a list of countries known to the CAT.

Parameters

activeOnly

is set and nonzero will cause that only countries with some institutions underneath will be listed

Returns

mixed|string|int —

Array indexed by (uppercase) lang codes and sorted according to the current locale

getExternalDBEntityDetails()

getExternalDBEntityDetails(  externalId,   realm = NULL) : mixed|string|int

get additional details about an institution from the EXTERNAL customer DB (if any; for eduroam, this would be the official eduroam database)

Parameters

externalId

the ID of the institution in the external DB

realm

the function can also try to find an inst by its realm in the external DB

Returns

mixed|string|int —

a list of institutions, ideally with only one member

getExternalCountriesList()

getExternalCountriesList() : mixed|string|int

the list of countries as per external DB

Returns

mixed|string|int —

the list

getRootUrlPath()

getRootUrlPath() 

__destruct()

__destruct() 

destroys the entity.

Logs the end of lifetime of the entity to the debug log on level 5.

createTemporaryDirectory()

createTemporaryDirectory(  purpose = installer,   failIsFatal = 1) : mixed|string|int

create a temporary directory and return the location

Parameters

purpose

one of 'installer', 'logo', 'test' defined the purpose of the directory

failIsFatal

decides if a creation failure should cause an error; defaults to true

Returns

mixed|string|int —

the tuple of: base path, absolute path for directory, directory name

rrmdir()

rrmdir(  dir) 

this direcory delete function has been copied from PHP documentation

Parameters

dir

name of the directory to delete

listCountries()

listCountries() 

listIdPs()

listIdPs() 

listProfiles()

listProfiles() 

listProfileDevices()

listProfileDevices() 

displayDeviceDownload()

displayDeviceDownload() 

langSelection()

langSelection() 

yourChoice()

yourChoice() 

displays the navigation bar showing the current location of the page

passArgument()

passArgument(  argName) : 

generates a hidden input field with the given argName

Parameters

argName

name of the hidden input field

Returns

getLogo()

getLogo(  identifier,  type,   width,   height) : array|null

Get and prepare logo file

When called for DiscoJuice, first check if file cache exists If not then generate the file and save it in the cache

Parameters

identifier

IdP of Federation identifier

type
width

maximum width of the generated image - if 0 then it is treated as no upper bound

height

maximum height of the generated image - if 0 then it is treated as no upper bound

Returns

array|null —

array with image information or NULL if there is no logo

verifyDownloadAccess()

verifyDownloadAccess( profile) 

Parameters

profile

getCache()

getCache(  device, \core\AbstractProfile  profile) : bool|string

This function tries to find a cached copy of an installer for a given combination of Profile and device

Parameters

device
\core\AbstractProfile profile

Returns

bool|string —

the string with the path to the cached copy, or FALSE if no cached copy exists

generateNewInstaller()

generateNewInstaller(  device, \core\AbstractProfile  profile,  generatedFor,  token,  password) : mixed|string|int

Generates a new installer for the given combination of device and Profile

Parameters

device
\core\AbstractProfile profile
generatedFor
token
password

Returns

mixed|string|int —

info about the new installer (mime and link)

processImage()

processImage(  inputImage,   destFile,   width,   height,   resize) : mixed|string|int

resizes image files

Parameters

inputImage
destFile
width
height
resize

shall we do resizing? width and height are ignored otherwise

Returns

mixed|string|int —

locateUser1()

locateUser1() 

locateUser2()

locateUser2() : mixed|string|int

find out where the user is currently located, using GeoIP2

Returns

mixed|string|int —

geoDistance()

geoDistance(mixed|string|int  point1, mixed|string|int  profile1) : 

Calculate the distance in km between two points given their geo coordinates.

Parameters

mixed|string|int point1
  • first point as an 'lat', 'lon' array
mixed|string|int profile1
  • second point as an 'lat', 'lon' array

Returns

distance in km

returnDevice()

returnDevice( devId,  device) 

Parameters

devId
device

deviceFromRequest()

deviceFromRequest() : \core\device

This methods cheks if the devide has been specified as the HTTP parameters

Returns

\core\device —

id|FALSE if correcty specified or FALSE otherwise

profileSort()

profileSort(\core\AbstractProfile  profile1, \core\AbstractProfile  profile2) : 

helper function to sort profiles by their name

Parameters

\core\AbstractProfile profile1

the first profile's information

\core\AbstractProfile profile2

the second profile's information

Returns