# \CGExtensions

A base class for all CMSMS modules written by me to provide optimizations and conveniences that are not built into CMSMS.

## Summary

Methods
Properties
Constants
__construct()
SetParameters()
GetFriendlyName()
GetVersion()
GetHelp()
GetAuthor()
GetAuthorEmail()
GetChangeLog()
IsPluginModule()
HasAdmin()
HandlesEvents()
GetAdminSection()
GetAdminDescription()
GetDependencies()
InstallPostMessage()
MinimumCMSVersion()
UninstallPostMessage()
VisibleToAdminUser()
GetHeaderHTML()
DoAction()
encrypt()
decrypt()
CreateURL()
CreateSortableListArea()
CreateInputYesNoDropdown()
CGCreateInputSubmit()
CreateInputCheckbox()
CGCreateFormStart()
CGCreateFrontendFormStart()
CreateInputHidden()
RedirectToTab()
Redirect()
IsAdminAction()
SetError()
SetMessage()
DisplayErrors()
DisplayMessages()
SetCurrentAction()
SetCurrentTab()
SetTabHeader()
DisplayErrorMessage()
GetErrorTemplate()
ResetErrorTemplate()
SetErrorTemplate()
CreateInputStateDropdown()
CreateInputCountryDropdown()
GetCountry()
GetState()
CreateImageDropdown()
CreateFileDropdown()
CreateColorDropdown()
CreateImageTag()
DisplayImage()
CreateImageLink()
AddImageDir()
ListTemplatesWithPrefix()
CreateTemplateDropdown()
ShowTemplateList()
GetDefaultTemplateForm()
EditDefaultTemplateForm()
CreateContentURL()
GetAdminUsername()
GetUploadErrorMessage()
GetSingleTemplateForm()
GetWatermarkError()
InitializeCharting()
InitializeAssocData()
session_clear()
session_put()
session_get()
param_session_get()
resolve_alias_or_id()
http_post()
http_get()
CGGetPreference()
CGGetUserPreference()
CGSetUserPreference()
CGRemoveUserPreference()
find_file()
CreateSmartyTemplate()
CGGetTemplateResource()
CGProcessTemplate()
GetActionModule()
No public properties found
No constants found
get_state_list()
get_state_list_options()
get_country_list()
get_country_list_options()
No protected properties found
N/A
No private methods found
No private properties found
N/A

File
  CGExtensions.module.php
Package
  \CGExtensions
Class hierarchy
  \CMSModule
  \CGExtensions

## Tags

todo |

## Methods

### __construct()

    __construct()

The constructor.

This method does numerous things, including setup an extended autoloader, create defines for the module itself. i.e: MOD_CGEXTENSIONS, or MOD_FRONTENDUSERS. sets up a built in cache driver for temporarily caching data. and register numerous smarty plugins (see the documentation for those).

#

## Tags

todo |

### SetParameters()

    SetParameters()

Set parameters for this module.

#

#### Deprecated

See also

## Tags

todo |

### GetFriendlyName()

    GetFriendlyName() : string

The Friendly name for this module. For use in the admin navigation.

#### Returns

string

#

See also

## Tags

todo |

### GetVersion()

    GetVersion() : string

Return the version of this module.

#### Returns

string

#

See also

## Tags

todo |

### GetHelp()

    GetHelp() : string

Return the help of this module.

#### Returns

string

#

See also

## Tags

todo |

### GetAuthor()

    GetAuthor() : string

Return the Author of this module.

#### Returns

string

#

See also

## Tags

todo |

### GetAuthorEmail()

    GetAuthorEmail() : string

Return the email address for the author of this module.

#### Returns

string

#

See also

## Tags

todo |

### GetChangeLog()

    GetChangeLog() : string

Return the changelog for this module.

#### Returns

string

#

See also

## Tags

todo |

### IsPluginModule()

    IsPluginModule() : bool

Return if this is a plugin module (for the frontend of the website) or not.

#### Returns

bool

#

See also

## Tags

todo |

### HasAdmin()

    HasAdmin() : string

Return if this module has an admin section.

#### Returns

string

#

See also

## Tags

todo |

### HandlesEvents()

    HandlesEvents() : string

Return if this module handles events.

#### Returns

string

#

See also

## Tags

todo |

### GetAdminSection()

    GetAdminSection() : string

Get the section of the admin navigation that this module belongs to.

#### Returns

string

#

## Tags

todo |

### GetAdminDescription()

    GetAdminDescription() : string

Get a human readable description for this module.

#### Returns

string

#

## Tags

todo |

### GetDependencies()

    GetDependencies() : string

Get a hash containing dependent modules, and their minimum versions.

#### Returns

string

#

## Tags

todo |

### InstallPostMessage()

    InstallPostMessage() : string

Display a custom message after the module has been installed.

#### Returns

string

#

## Tags

todo |

### MinimumCMSVersion()

    MinimumCMSVersion() : string

Return the minimum CMSMS version that this module is compatible with.

#### Returns

string

#

## Tags

todo |

### UninstallPostMessage()

    UninstallPostMessage() : string

Return a message to display after the module has been uninstalled.

#### Returns

string

#

## Tags

todo |

### VisibleToAdminUser()

    VisibleToAdminUser() : bool

Test if this module is visible in the admin navigation to the currently logged in admin user.

#### Returns

bool

#

## Tags

todo |

### GetHeaderHTML()

    GetHeaderHTML() : bool

Retrieve some HTML to be output in all admin requests for this module (and its descendants).

By default this module calls the jsloader::render method, and includes some standard styles

#### Returns

bool

#

See also

## Tags

todo |

### DoAction()

    DoAction(string $name, string $id, array $params, int $returnid)

A replacement for the built in DoAction method For CGExtensions derived modules some builtin smarty variables are created module hints are handled, and input type=image values are corrected in input parameters.

this method also handles setting the active tab, and displaying any messages or errors set with the SetError or SetMessage methods.

This method is called automatically by the system based on the incoming request, and the page template. It should almost never be called manually.

#### Parameters

string | $name | the action name
string | $id | The module action id
array | $params | The module parameters
int | $returnid | The page that will contain the HTML results. This is empty for admin requests.

#

See also

## Tags

todo |

### encrypt()

    encrypt(string $key, string $data) : string

A convenience method to encrypt some data

#### Parameters

string | $key | The encryption key
string | $data | The data to encrypt

#### Returns

string —

The encrypted data

#

See also

## Tags

todo |

### decrypt()

    decrypt(string $key, string $data) : string

A convenience method to decrypt some data

#### Parameters

string | $key | The encryption key
string | $data | The data to decrypt

#### Returns

string —

The derypted data

#

See also

## Tags

todo |

### CreateURL()

    CreateURL(string $id, string $action, string $returnid, array $params, bool $inline, string $prettyurl)

A convenience function to create a url for a module action.

This method is deprecated as the CMSModule::create_url method replaces it.

#### Parameters

string | $id | the module action id
string | $action | The module action
string | $returnid | The page that the url will refer to. This is empty for admin requests
array | $params | Module parameters
bool | $inline | For frontend requests only dicates wether this url should be inline only.
string | $prettyurl |

#

#### Deprecated

## Tags

todo |

### CreateSortableListArea()

    CreateSortableListArea(string $id, string $name, array $items, string $selected, bool $allowduplicates, int $max_selected, string $template, string $label_left, string $label_right) : string

A convenience method to create a control that contains a 'sortable list'.

The output control is translated, and interactive and suitable for use in forms.

#### Parameters

string | $id | The module action id
string | $name | The input element name
array | $items | An associative array of the items for this list.
string | $selected | A comma separated string of selected item keys
bool | $allowduplicates |
int | $max_selected | The maximum number of items that can be selected
string | $template | Specify an alternate template for the sortable list control
string | $label_left | A label for the left column.
string | $label_right | A label for the right column.

#### Returns

string

#

#### Deprecated

## Tags

todo |

### CreateInputYesNoDropdown()

    CreateInputYesNoDropdown(string $id, string $name, int $selectedvalue, string $addtext) : string

Create a translated Yes/No dropdown.

The output control is translated, and suitable for use in forms. This method is deprecated. It is best to assign all data to smarty and then create input elements as necessary in the smarty template.

#### Parameters

string | $id | the module action id
string | $name | The name for the input element
int | $selectedvalue | The selected value (0 == no, 1 == yes)
string | $addtext |

#### Returns

string

#

#### Deprecated

## Tags

todo |

### CGCreateInputSubmit()

    CGCreateInputSubmit(string $id, string $name, string $value, string $addtext, string $image, string $confirmtext, string $class) : string

Create a custom submit button.

The output control is translated, and suitable for use in forms. This method is deprecated. It is best to assign all data to smarty and then create input elements as necessary in the smarty template.

#### Parameters

string | $id | the module action id
string | $name | The name for the input element
string | $value | The value for the submit button
string | $addtext | Additional text for the tag
string | $image | an optional image path
string | $confirmtext | Optional confirmation text
string | $class | Optional value for the class attribute

#### Returns

string

#

#### Deprecated

## Tags

todo |

### CreateInputCheckbox()

    CreateInputCheckbox(string $id, string $name, string $value, string $selectedvalue, string $addtext) : string

Create a custom checkbox.

This is similar to the standard checkbox but has a hidden field with the same name before it so that some value for this field is always returned to the form handler. This method is deprecated. It is best to assign all data to smarty and then create input elements as necessary in the smarty template.

#### Parameters

string | $id | the module action id
string | $name | The name for the input element
string | $value | The value for the checkbox
string | $selectedvalue | The current value of the field.
string | $addtext | Additional text for the tag

#### Returns

string

#

#### Deprecated

## Tags

todo |

### CGCreateFormStart()

    CGCreateFormStart(string $id, string $action, string $returnid, array $params, bool $inline, string $method, string $enctype, string $idsuffix, string $extra) : string

A Convenience function for creating form tags.

This method re-organises some of the parameters of the original CreateFormStart method and handles current tab functionalty, and sets the encoding type of the form to multipart/form-data

This method is deprecated and will be replaced in CMSMS 2.0 by the core {form_start} tag.

#### Parameters

string | $id | the module action id
string | $action | the destination action
string | $returnid | The destination pagpe for the action handler. Empty for admin requests
array | $params | additional parameters to be passed with the form
bool | $inline | wether this is an inline form request (output will replace module tag rather than the entire content section of the template.
string | $method | The form method.
string | $enctype | The form encoding type
string | $idsuffix |
string | $extra | Extra text for thhe form tag

#### Returns

string

#

#### Deprecated

## Tags

todo |

### CGCreateFrontendFormStart()

    CGCreateFrontendFormStart(string $id, string $action, string $returnid, array $params, bool $inline, string $method, string $enctype, string $idsuffix, string $extra) : string

A convenience function for creating a frontend form This method re-organises some of the parameters of the original CreateFormStart method and sets the encoding type of the form to multipart/form-data

This method is deprecated and will be replaced in CMSMS 2.0 by the core {form_start} tag.

#### Parameters

string | $id | the module action id
string | $action | the destination action
string | $returnid | The destination pagpe for the action handler. Empty for admin requests
array | $params | additional parameters to be passed with the form
bool | $inline | wether this is an inline form request (output will replace module tag rather than the entire content section of the template.
string | $method | The form method.
string | $enctype | The form encoding type
string | $idsuffix |
string | $extra | Extra text for thhe form tag

#### Returns

string

#

#### Deprecated

## Tags

todo |

### CreateInputHidden()

    CreateInputHidden(string $id, string $name, string $value, string $addtext, string $delim) : string

A convenience method to create a hidden input element for forms.

This method is deprecated. It is best to assign all data to smarty and then create input elements as necessary in the smarty template.

#### Parameters

string | $id | the module action id
string | $name | The name of the input element
string | $value | The value of the input element
string | $addtext | Additional text for the tag
string | $delim | the delimiter for value separation.

#### Returns

string

#

#### Deprecated

## Tags

todo |

### RedirectToTab()

    RedirectToTab(string $id, string $tab, string $params, string $action)

For admin requests only, pass variables so that the specified tab will be displayed by default in the resulting action.

#### Parameters

string | $id | the module action id. For admin requests this is usually 'm1_'
string | $tab | The name of the parameter
string | $params | Extra parameters for the request
string | $action | The designated module action. If none is specified 'defaultadmin' is assumed.

#

## Tags

todo |

### Redirect()

    Redirect(string $id, string $action, int $returnid, array $params, bool $inline)

Redirect to a specified module action.

This method is usable both for admin and frontend requests.

#### Parameters

string | $id | the module action id. For admin requests this is usually 'm1_'
string | $action | The designated module action. If none is specified 'defaultadmin' is assumed.
int | $returnid | The destination page. empty for admin requests.
array | $params | Extra parameters for the URL
bool | $inline | Wether the output should be an inline URL or not ??

#

## Tags

todo |

### IsAdminAction()

    IsAdminAction() : bool

Test if the current code is handling an admin action or a frontend action

#### Returns

bool —

True for an admin action, false otherwise.

#

## Tags

todo |

### SetError()

    SetError(string $str)

Set an error to display on the next admin request from a CGExtensions derived module.

The error message will be carried on to the next admin request and displayed.

#### Parameters

string | $str | The error message.

#

## Tags

todo |

### SetMessage()

    SetMessage(string $str)

Set a message to display on the next admin request from a CGExtensions derived module.

The message will be carried on to the next admin request and displayed.

#### Parameters

string | $str | The informational message to display.

#

## Tags

todo |

### DisplayErrors()

    DisplayErrors()

Display any set error message in the admin console.

#

## Tags

todo |

### DisplayMessages()

    DisplayMessages()

Display any set informational messages in the admin console.

#

## Tags

todo |

### SetCurrentAction()

    SetCurrentAction(string $action)

Set the current action for the next request of the admin console.

Used for the various admin forms.

#### Parameters

string | $action | The action name

#

## Tags

todo |

### SetCurrentTab()

    SetCurrentTab(string $tab)

Set the current tab for the next request of the admin console.

Used for the various template forms.

#### Parameters

string | $tab | The tab name.

#

## Tags

todo |

### SetTabHeader()

    SetTabHeader(string $name, string $str, mixed $state)

A replacement for the built in SetTabHeader.

This method is a smart replacement that will automatically handle an active tab on the requiest.

#### Parameters

string | $name | The tab name (for coding purposes)
string | $str | The human readable label for the tab.
mixed | $state | If Empty or 'unknown' then detect any currently set tab.

#

## Tags

todo |

### DisplayErrorMessage()

    DisplayErrorMessage(string $txt, string $class)

A function for using a template to display an error message.

This method is suitable for frontend displays.

#### Parameters

string | $txt | The error message
string | $class | An optional class attribute value.

#

#### Deprecated

## Tags

todo |

### GetErrorTemplate()

    GetErrorTemplate()

A convenience function for retrieving the current error template

#

#### Deprecated

## Tags

todo |

### ResetErrorTemplate()

    ResetErrorTemplate()

Reset the error template to factory defaults

#

#### Deprecated

## Tags

todo |

### SetErrorTemplate()

    SetErrorTemplate(string $tmpl)

Set the error template

#### Parameters

string | $tmpl | Smarty Template source

#

#### Deprecated

## Tags

todo |

### CreateInputStateDropdown()

    CreateInputStateDropdown(string $id, string $name, string $value, mixed $selectone, string $addtext)

A convenience function to create a state dropdown list.

#### Parameters

string | $id | The module action id
string | $name | the name for the dropdown.
string | $value | The initial value for the dropdown.
mixed | $selectone | If true, then a hardcoded "Select One" string will be prepended to the list. If a string then that string will be used.
string | $addtext | Additional text for the select tag.

#

#### Deprecated

## Tags

todo |

### CreateInputCountryDropdown()

    CreateInputCountryDropdown(string $id, string $name, string $value, mixed $selectone, string $addtext)

A convenience function to create a country dropdown list

#### Parameters

string | $id | The module action id
string | $name | the name for the dropdown.
string | $value | The initial value for the dropdown.
mixed | $selectone | If true, then a hardcoded "Select One" string will be prepended to the list. If a string then that string will be used.
string | $addtext | Additional text for the select tag.

#

#### Deprecated

## Tags

todo |

### GetCountry()

    GetCountry(string $the_acronym) : string

A convenience function to get the country name given the acronym

#### Parameters

string | $the_acronym |

#### Returns

string

#

## Tags

todo |

### GetState()

    GetState(string $the_acronym) : string

A convenience function to get the state name given the acronym

#### Parameters

string | $the_acronym |

#### Returns

string

#

## Tags

todo |

### CreateImageDropdown()

    CreateImageDropdown(string $id, string $name, string $selectedfile, string $dir, mixed $none) : \string.

A convenience function to create an image dropdown from all of the image files in a specified directory.

This method will not ignore thumbnails.

#### Parameters

string | $id | The module action id
string | $name | the name for the dropdown.
string | $selectedfile | The initial value for the dropdown (an image filename)
string | $dir | The path (relative to the uploads path) to the directory to pull images from. If not specified, the image uploads path will be used.
mixed | $none | If true, then 'None' will be prepended to the list of output images. If a string it's value will be used.

#### Returns

\string.

#

#### Deprecated

## Tags

todo |

### CreateFileDropdown()

    CreateFileDropdown(string $id, string $name, string $selectedfile, string $dir, string $extensions, bool $allownone, bool $allowmultiple, int $size) : \string.

A convenience function to create a list of filenames in a specified directory.

#### Parameters

string | $id | The module action id
string | $name | the name for the dropdown.
string | $selectedfile | The initial value for the dropdown (an image filename)
string | $dir | The path (relative to the uploads path) to the directory to pull images from. If not specified, the image uploads path will be used.
string | $extensions | A comma separated list of filename extensions to include in the list. If not specified the module preference will be used.
bool | $allownone | Allow no files to be selected.
bool | $allowmultiple | To allow selecting multiple files.
int | $size | The size of the dropdown.

#### Returns

\string.

#

#### Deprecated

## Tags

todo |

### CreateColorDropdown()

    CreateColorDropdown(string $id, string $name, string $selectedvalue) : string

A convenience function to create a color selection dropdown

#### Parameters

string | $id | The module action id
string | $name | the name for the dropdown.
string | $selectedvalue | The initial value for the input field.

#### Returns

string

#

#### Deprecated

## Tags

todo |

### CreateImageTag()

    CreateImageTag(string $id, string $alt, int $width, int $height, string $class, string $addtext) : string

A convenience method to create an image tag.

This method will automatically search through added image dirs for frontend and admin requests and through the admin theme directories for admin requests.

#### Parameters

string | $id | The module action id
string | $alt | The alt attribute for the tag
int | $width | Width in pixels
int | $height | Height in pixels
string | $class | Value for the class attribute
string | $addtext | Additional text for the img tag.

#### Returns

string

#

#### Deprecated

See also

## Tags

todo |

### DisplayImage()

    DisplayImage(string $image, string $alt, string $class, int $width, int $height) : string

A convenience method to display an image.

This method will automatically search through added image dirs for frontend and admin requests and through the admin theme directories for admin requests.

#### Parameters

string | $image | The basename for the desired image.
string | $alt | The alt attribute for the tag
string | $class | Value for the class attribute
int | $width | Width in pixels
int | $height | Height in pixels

#### Returns

string

#

#### Deprecated

See also

## Tags

todo |

### CreateImageLink()

    CreateImageLink(string $id, string $action, int $returnid, string $contents, string $image, array $params, string $classname, string $warn_message, bool $imageonly, bool $inline, string $addtext, bool $targetcontentonly, string $prettyurl) : string

A convenience method to create a link to a module action containing an image and optionally some text.

This method will automatically search through added image dirs for frontend and admin requests and through the admin theme directories for admin requests.

#### Parameters

string | $id | The module action id
string | $action | The name of the destination action
int | $returnid | The page for the destination of the request. Empty for admin requests.
string | $contents | The text content of the image.
string | $image | The basename of the image to display.
array | $params | Additional link parameters
string | $classname | Class for the img tag.
string | $warn_message | An optional confirmation message
bool | $imageonly | Wether the contents (if specified) should be ignored.
bool | $inline |
string | $addtext |
bool | $targetcontentonly |
string | $prettyurl | An optional pretty url slug.

#### Returns

string

#

#### Deprecated

See also

## Tags

todo |

### AddImageDir()

    AddImageDir(string $dir)

Add a directory to the list of searchable directories

#### Parameters

string | $dir | A directory relative to this modules installation directory.

#

## Tags

todo |

### ListTemplatesWithPrefix()

    ListTemplatesWithPrefix(string $prefix, bool $trim) : array

List all templates stored with this module that begin with the same prefix.

#### Parameters

string | $prefix | The optional prefix
bool | $trim |

#### Returns

array

#

#### Deprecated

See also

## Tags

todo |

### CreateTemplateDropdown()

    CreateTemplateDropdown(string $id, string $name, string $prefix, string $selectedvalue, string $addtext) : string

Create a dropdown of all templates beginning with the specified prefix

#### Parameters

string | $id | The module action id
string | $name | The name for the input element.
string | $prefix | The optional prefix
string | $selectedvalue | The default value for the input element
string | $addtext |

#### Returns

string

#

#### Deprecated

## Tags

todo |

### ShowTemplateList()

    ShowTemplateList(string $id, int $returnid, string $prefix, string $defaulttemplatepref, string $active_tab, string $defaultprefname, string $title, string $info, string $destaction)

Part of the multiple database template functionality this function provides an interface for adding, editing, deleting and marking active all templates that match a prefix.

#### Parameters

string | $id | The module action id (pass in the value from doaction)
int | $returnid | The page id to use on subsequent forms and links.
string | $prefix | The template prefix
string | $defaulttemplatepref | The name of the template containing the system default template. This can either be the name of a database template or a filename ending with .tpl.
string | $active_tab | The tab to return to
string | $defaultprefname | The name of the preference that contains the name of the current default template. If empty string then there will be no possibility to set a default template for this list.
string | $title | Title text to display in the add/edit template form
string | $info | Information text to display in the add/edit template form
string | $destaction | The action to return to.

#

#### Deprecated

Use the CmsLayoutTemplate class(es) in 2.0 capable modules.

## Tags

todo |

### GetDefaultTemplateForm()

    GetDefaultTemplateForm(\GExtensions $module, string $id, string $returnid, string $prefname, string $action, string $active_tab, string $title, string $filename, string $info) : string

GetDefaultTemplateForm.

A function to return a form suitable for editing a single template.

#### Parameters

\GExtensions | $module | A CGExtensions derived module reference
string | $id |
string | $returnid |
string | $prefname |
string | $action |
string | $active_tab |
string | $title |
string | $filename |
string | $info |

#### Returns

string

#

#### Deprecated

(this functionality is irrelevant in CMSMS 2.0)

See also

## Tags

todo |

### EditDefaultTemplateForm()

    EditDefaultTemplateForm(\GExtensions $module, string $id, string $returnid, string $prefname, string $active_tab, string $title, string $filename, string $info, string $action) : string

EditDefaultTemplateForm

A function to return a form suitable for editing a single template.

#### Parameters

\GExtensions | $module | A CGExtensions derived module reference
string | $id |
string | $returnid |
string | $prefname |
string | $active_tab |
string | $title |
string | $filename |
string | $info |
string | $action |

#### Returns

string

#

#### Deprecated

(this functionality is irrelevant in CMSMS 2.0)

See also

## Tags

todo |

### CreateContentURL()

    CreateContentURL(mixed $pageid) : string

A convenience function to create a url to a certain CMS page

#### Parameters

mixed | $pageid | A frontend page id or alias.

#### Returns

string

#

## Tags

todo |

### GetAdminUsername()

    GetAdminUsername(int $uid) : string

Get the username of the currently logged in admin user.

#### Parameters

int | $uid |

#### Returns

string

#

#### Deprecated

## Tags

todo |

### GetUploadErrorMessage()

    GetUploadErrorMessage(string $code) : string

Get a human readable error message for an upload code.

#### Parameters

string | $code | The upload error code.

#### Returns

string

#

#### Deprecated

See also

## Tags

todo |

### GetSingleTemplateForm()

    GetSingleTemplateForm(\CGExtensions $module, string $id, int $returnid, string $tmplname, string $active_tab, string $title, string $filename, string $info, string $destaction)

Get a form for adding or editing a single template.

#### Parameters

\CGExtensions | $module | A CGExtensions module reference
string | $id |
int | $returnid |
string | $tmplname | The name of the template to edit
string | $active_tab |
string | $title |
string | $filename | The name of the file (in the module's template directory) containing the system default template.
string | $info |
string | $destaction |

#

#### Deprecated

See also

## Tags

todo |

### GetWatermarkError()

    GetWatermarkError(string $error) : string

Retrieve a human readable string for any error generated during watermarking.

#### Parameters

string | $error | the watermarking error code

#### Returns

string

#

#### Deprecated

## Tags

todo |

### InitializeCharting()

    InitializeCharting()

Setup and initializing charting functionality

#

#### Deprecated

## Tags

todo |

### InitializeAssocData()

    InitializeAssocData()

Initialize associative data functionality

#

#### Deprecated

## Tags

todo |

### session_clear()

    session_clear(string $key)

A convenience method to clear any session data associated with this module.

#### Parameters

string | $key | If not specified clear all session data relative to this module."

#

## Tags

todo |

### session_put()

    session_put(string $key, string $value)

A convenience method to store some session data associated with this module.

#### Parameters

string | $key | The variable key.
string | $value | The data to store.

#

## Tags

todo |

### session_get()

    session_get(string $key, string $dfltvalue) : \mixed.

A convenience method to retrieve some session data associated with this module.

#### Parameters

string | $key | The variable key.
string | $dfltvalue | "The default value to return if the specified data does not exist."

#### Returns

\mixed.

#

## Tags

todo |

### param_session_get()

    param_session_get(array $params, string $key, string $defaultvalue) : \mixed.

Return data identified by a key either from the supplied parameters, or from session.

#### Parameters

array | $params | Input parameters
string | $key | The data key
string | $defaultvalue | The data to return if the specified data does not exist in the session or in the input parameters.

#### Returns

\mixed.

#

## Tags

todo |

### resolve_alias_or_id()

    resolve_alias_or_id(mixed $txt, int $dflt) : int

Given a page alias resolve it to a page id.

#### Parameters

mixed | $txt | The page alias to resolve. If an integer page id is passed in that is acceptable as well.
int | $dflt | The default page id to return if no match can be found

#### Returns

int

#

## Tags

todo |

### http_post()

    http_post(string $URL, array $data, string $referer) : string

Perform an HTTP post request.

#### Parameters

string | $URL | the url to post to
array | $data | The array to post.
string | $referer | An optional referrer string.

#### Returns

string

#

## Tags

todo |

### http_get()

    http_get(string $URL, string $referer) : string

Perform an HTTP GET request.

#### Parameters

string | $URL | the url to post to
string | $referer | An optional referrer string.

#### Returns

string

#

## Tags

todo |

### CGGetPreference()

    CGGetPreference(string $pref_name, string $dflt_value, bool $allow_empty) : \string.

Similar to GetPreference except the default value is used even if the preference exists, but is blank.

#### Parameters

string | $pref_name | The preference name
string | $dflt_value | The default value for the preference if not set (or empty)
bool | $allow_empty | Wether the default value should be used if the preference exists, but is empty.

#### Returns

\string.

#

## Tags

todo |

### CGGetUserPreference()

    CGGetUserPreference(string $pref_name, string $dflt_value, bool $allow_empty) : \string.

A wrapper to get a module specific user preference.

this method only applies to admin users.

#### Parameters

string | $pref_name | The preference name
string | $dflt_value | The default value for the preference if not set (or empty)
bool | $allow_empty | Wether the default value should be used if the preference exists, but is empty.

#### Returns

\string.

#

## Tags

todo |

### CGSetUserPreference()

    CGSetUserPreference(string $pref_name, string $value)

A wrapper to set a user preference that is module specific.

this method only applies to admin users.

#### Parameters

string | $pref_name | The preference name
string | $value | The preference value.

#

## Tags

todo |

### CGRemoveUserPreference()

    CGRemoveUserPreference(string $pref_name)

A wrapper to remove a user preference that is module specific.

this method only applies to admin users.

#### Parameters

string | $pref_name | The preference name

#

## Tags

todo |

### find_file()

    find_file(string $filename) : string

find a file for this module looks in module_custom, and in the module directory

#### Parameters

string | $filename |

#### Returns

string

#

## Tags

todo |

### CreateSmartyTemplate()

    CreateSmartyTemplate(string $template_name, string $prefix) : object

A convenience method to generate a new smarty template object given a resource string, and a prefix. This method will also automatically assign a few common smarty variables to the new scope.

#### Parameters

string | $template_name | The desired template name
string | $prefix | an optional prefix for database templates.

#### Returns

object

#

## Tags

todo |

### CGGetTemplateResource()

    CGGetTemplateResource(string $template_name, string $prefix) : string

A convenience method to generate a smarty resource string given a template name and an optional prefix.

if the supplied template name ends with .tpl then a file template is assumed.

#### Parameters

string | $template_name | The desired template name
string | $prefix | an optional prefix for database templates.

#### Returns

string

#

## Tags

todo |

### CGProcessTemplate()

    CGProcessTemplate(string $template_name, string $prefix) : string

An advanced method to process either a file, or database template for this module through smarty

#### Parameters

string | $template_name | The template name. If the value of this parameter ends with .tpl then a file template is assumed. Otherwise a database template is assumed.
string | $prefix | For database templates, optionally prefix thie template name with this value.

#### Returns

string —

The output from the processed smarty template.

#

## Tags

todo |

### GetActionModule()

    GetActionModule() : string

Get the name of the module that the current action is for.

(only works with modules derived from CGExtensions). This method is useful to find the module action that was used to send an event.

#### Returns

string

#

## Tags

todo |

### get_state_list()

    get_state_list() : array

A function to return an array of of country codes and country names.

i.e: array( array('code'=>'AB','name'=>'Alberta'), array('code'=>'MB','code'=>'Manitoba'));

#### Returns

array

#

## Tags

todo |

### get_state_list_options()

    get_state_list_options() : array

A function to return an array of of country codes and country names.

This method returns data that is suitable for use in a list. i.e: array( array('code'=>'AB','name'=>'Alberta'), array('code'=>'MB','code'=>'Manitoba'));

#### Returns

array

#

## Tags

todo |

### get_country_list()

    get_country_list()

A function to return an array of of country codes and country names.

i.e: array( array('code'=>'US','name'=>'United States'), array('code'=>'CA','code'=>'Canada'));

#

## Tags

todo |

### get_country_list_options()

    get_country_list_options()

A function to return an array of of country codes and country names.

This method returns data suitable for giving to smarty and displaying in a dropdown.

#

## Tags

todo |

### CGExtensions.module.php