Class: GalleryTheme
Source Location: /modules/core/classes/GalleryTheme.class
Class GalleryTheme
Inherited Properties, Constants, and Methods
Method Summary
GalleryTheme |
GalleryTheme() |
Constructor to prevent PHP Notices in upgrader and AdminThemes.inc when old themes with a theme.inc are still in the themes folder. The old themes call $this->GalleryTheme() in their constructor. |
array |
getApiVersion() |
Return the major and minor version of the GalleryTheme API. |
int |
getPageSize() |
Return the number of items per page, or 0 if there is no pagination in this theme. |
array |
getSettings() |
Return the possible settings that a theme can specify on a global or per item basis. Used for theme with simple settings (@see isAdvancedSettings) |
array |
handleSettingsRequest() |
Let the theme handle the incoming request. Used for theme with advanced settings. |
GalleryStatus |
installOrUpgrade() |
Perform the module installation or upgrade, whatever is required. It will do the following: - Get the current version of the theme (if its already installed)
- Let the theme perform any necessary upgrade tasks.
|
boolean |
isAdvancedSettings() |
Return whether the theme uses simple or advanced settings. To support simple settings the theme needs to implement getSettings and validateSettings To support advanced settings the theme must implement loadSettingsTemplate and handleSettingsRequest. |
array |
loadSettingsTemplate() |
Load the template with data to define the theme settings. Used for theme with advanced settings. |
array |
loadTemplate() |
Load the template with data from this view. |
mixed |
packSetting() |
Convert a setting from a string format into a PHP native format. The string format is |
array |
showAdminPage() |
Load all the necessary template data to render a page for an administrative (or other) view. |
array |
showAlbumPage() |
Load all the necessary template data to render a page for an album. |
array |
showErrorPage() |
Load all the necessary template data to render an error page. |
array |
showModulePage() |
Load all the necessary template data to render a page for a module view (any views that aren't user, site, or item admin eg slideshow or members list). |
array |
showPhotoPage() |
Load all the necessary template data to render a page for a single item. |
array |
showProgressBarPage() |
Load all the necessary template data to render a progress bar page. |
array('headHtml' |
splitHtml() |
Split the HTML content into its various component pieces. |
array |
validateSettings() |
Check the values of the settings for legality. If there are errors, return an array of localized error messages to display for each invalid setting. Used for theme with simple settings (@see isAdvancedSettings) |
void |
_sortItemLinks() |
Sort an array of associative arrays on the 'text' key. |
Properties
Is the page we're rendering cacheable?
API Tags:
The version of the GalleryTheme API required by this theme.
API Tags:
Which of the standard theme settings this theme supports.
API Tags:
Methods
GalleryTheme GalleryTheme(
)
|
|
Constructor to prevent PHP Notices in upgrader and AdminThemes.inc when old themes with a theme.inc are still in the themes folder. The old themes call $this->GalleryTheme() in their constructor.
void activate(
[
$postActivationEvent = true]
)
|
|
Parameters:
API Tags:
See: | GalleryPlugin::activate |
Redefinition of:
- GalleryPlugin::activate()
- Activate this plugin
void deactivate(
[
$postDeactivationEvent = true]
)
|
|
Parameters:
API Tags:
See: | GalleryPlugin::deactivate |
Redefinition of:
- GalleryPlugin::deactivate()
- Deactivate this plugin.
Return the major and minor version of the GalleryTheme API.
This follows the same rules as the core API
API Tags:
Return: | major number, minor number |
See: | GalleryCoreApi::getApiVersion |
Information Tags:
Todo: | On the next major API bump: - Remove backwards compatible CSS from lib/javascript/AutoComplete.js
|
int getPageSize(
array
$params
)
|
|
Return the number of items per page, or 0 if there is no pagination in this theme.
Parameters:
array |
$params: |
the theme parameters |
Redefined in descendants as:
void getRequiredThemeApi(
)
|
|
array getSettings(
[int
$itemId = null]
)
|
|
Return the possible settings that a theme can specify on a global or per item basis. Used for theme with simple settings (@see isAdvancedSettings)
Each setting contains: key: a unique identifier name: a localized, displayable text string type: single-select, multiple-select, text-field choices: [only valid for single-select, multiple-select type] array of: keys: unique identifier within this set of choices values: localized displayable text string value: the current value for this setting
Parameters:
API Tags:
Return: | GalleryStatus a status code settings array params array (useful for a theme overriding this function) |
Redefined in descendants as:
void getStandardSettings(
)
|
|
array handleSettingsRequest(
array
$form, [int
$itemId = null]
)
|
|
Let the theme handle the incoming request. Used for theme with advanced settings.
Parameters:
array |
$form: |
the form values |
int |
$itemId: |
the item id or null for site wide settings |
API Tags:
Return: | GalleryStatus a status code array error messages string status message (itemId!=null) or status key (itemId==null) |
See: | GalleryController::handleRequest |
See: | GalleryTheme::isAdvancedSettings() |
Redefined in descendants as:
Perform the module installation or upgrade, whatever is required. It will do the following: - Get the current version of the theme (if its already installed)
- Let the theme perform any necessary upgrade tasks.
3. Set the new theme version and api requirements into the database Themes should not need to override this method. Instead they should override the upgrade method and put all their theme specific logic there
API Tags:
Redefinition of:
- GalleryPlugin::installOrUpgrade()
- Perform the plugin installation or upgrade, whatever is required.
boolean isAdvancedSettings(
)
|
|
Return whether the theme uses simple or advanced settings. To support simple settings the theme needs to implement getSettings and validateSettings To support advanced settings the theme must implement loadSettingsTemplate and handleSettingsRequest.
API Tags:
Return: | true for advanced settings, false for simple |
Redefined in descendants as:
Load commonly used data into theme template.
Always loaded: item item data children array of child item data Available keys to include in $dataToLoad parameter: owner = item owner data ^if childIds non-empty also fill ownerMap with array of ownerId => owner data viewCount = number of views for item ^if childIds non-empty also set viewCount on each child item childCount = number of children for item ^if childIds non-empty also set childCount on each child item that canContainChildren descendentCount = number of descendents for item ^if childIds non-empty also set descendentCount on each child that canContainChildren parents = array of ancestor data; also set parent key (direct parent data) systemLinks = array of array('text'=>.., 'params'=>.., 'moduleId'=>..) itemLinks = array of id => array('text'=>.., 'params'=>.., 'moduleId'=>..) ^if childIds non-empty also set itemLinks on each child item childItemLinksDetailed = boolean. true if you want detailed item links for children. you always get detailed item links for the current item itemSummaries = set itemSummaries (array of moduleId => html) on each child item thumbnails = if childIds non-empty then set thumbnail on each child item pageNavigator = calculate URLs for first/back/next/last links for album page navigation itemNavigator = calculate URLs for first/back/next/last links for photo navigation navThumbnails = load the thumbnails for itemNavigator items jumpRange = calculate page URLs for inter-album navigation (eg, "page: 1, 2 .. 7, 8") Include 'pageWindowSize'=># in $params to override default of 6 imageViews = loads entity data for resizes and source images, suitable for display when viewing a single image: 'imageViews' => derivatives, 'sourceImage' => data item, ^ contains 'viewInline' boolean, specifying if it can be displayed inline ^ contains 'itemTypeName' string, the type of item ^ contains 'isSource' member 'imageViewsIndex' => index to the resize currently displayed 'sourceImageViewIndex' => index to the source currently displayed 'fullSizeDimensions' => a string with dimensions of the orig. (eg, "640x480") permissions array of item permissions, respecting the guest mode flag. Periods in permissions have been converted to underscores to make them more Smarty friendly, so if you want to check a permission in smarty you'd do: {if isset($theme.permissions.core_addDataItem)}
Parameters:
GalleryTemplate |
$template: |
|
GalleryItem |
$item: |
the item to display |
array |
$params: |
theme parameters |
array |
$dataToLoad: |
(string data key, ..) data to load into template |
array |
$childIds: |
(optional) ids of child items to display |
boolean |
$useCache: |
(optional) |
|
&$template: |
|
API Tags:
array loadSettingsTemplate(
&$template,
&$form, [int
$itemId = null], GalleryTemplate
$template, array
$form
)
|
|
Load the template with data to define the theme settings. Used for theme with advanced settings.
Parameters:
GalleryTemplate |
$template: |
|
array |
$form: |
array the form values |
int |
$itemId: |
the item id or null for site wide settings |
|
&$template: |
|
|
&$form: |
|
API Tags:
Redefined in descendants as:
Load the template with data from this view.
Parameters:
API Tags:
Return: | GalleryStatus a status code array ('body' => string template or 'redirect' => array) |
mixed packSetting(
string
$packType, string
$value
)
|
|
Convert a setting from a string format into a PHP native format. The string format is
something that could be passed to the browser, like: [I like [eggs bacon]] The packed format might be: array("I like", array("eggs", "bacon")) The specific packing depends on the packType variable.
Parameters:
string |
$packType: |
|
string |
$value: |
the input value |
API Tags:
Call preload for given block if the module is active and a preload exists.
Parameters:
GalleryTemplate |
$template: |
|
string |
$blockId: |
(module.blockName) |
array |
$blockParams: |
(optional) block parameters |
|
&$template: |
|
API Tags:
Redefined in descendants as:
void setRequiredThemeApi(
$requirement
)
|
|
Parameters:
void setStandardSettings(
$standardSettings
)
|
|
Parameters:
Load all the necessary template data to render a page for an administrative (or other) view.
Parameters:
GalleryTemplate |
$template: |
|
GalleryItem |
$item: |
the item to render |
array |
$params: |
the theme parameters |
string |
$templateFile: |
the body template file from the view |
|
&$template: |
|
API Tags:
Return: | GalleryStatus a status code string path to a template file or array(html/redirect) |
Access: | private |
Redefined in descendants as:
Load all the necessary template data to render a page for an album.
Parameters:
GalleryTemplate |
$template: |
|
GalleryAlbumItem |
$item: |
the album item to render |
array |
$params: |
the theme parameters |
int |
$childIds: |
the child item ids |
|
&$template: |
|
API Tags:
Return: | GalleryStatus a status code string path to a template file or array(html/redirect) |
Access: | private |
Redefined in descendants as:
Load all the necessary template data to render an error page.
Parameters:
API Tags:
Return: | GalleryStatus a status code string path to a template file or array(html/redirect) |
Access: | private |
Redefined in descendants as:
Load all the necessary template data to render a page for a module view (any views that aren't user, site, or item admin eg slideshow or members list).
Parameters:
GalleryTemplate |
$template: |
|
GalleryItem |
$item: |
the item to render |
array |
$params: |
the theme parameters |
string |
$templateFile: |
the body template file from the view |
|
&$template: |
|
API Tags:
Return: | GalleryStatus a status code string path to a template file or array(html/redirect) |
Access: | private |
Redefined in descendants as:
Load all the necessary template data to render a page for a single item.
Parameters:
GalleryTemplate |
$template: |
|
GalleryItem |
$item: |
the item to render, can be any subclass of GalleryItem |
array |
$params: |
the theme parameters |
|
&$template: |
|
API Tags:
Return: | GalleryStatus a status code string path to a template file or array(html/redirect) |
Access: | private |
Redefined in descendants as:
Load all the necessary template data to render a progress bar page.
Parameters:
API Tags:
Return: | GalleryStatus a status code string path to a template file or array(html/redirect) |
Access: | private |
Redefined in descendants as:
array('headHtml' splitHtml(
string
$mainHtml, array
$extraHtml
)
|
|
Split the HTML content into its various component pieces.
Parameters:
string |
$mainHtml: |
the main html (<head>, <body>, etc) |
array |
$extraHtml: |
any extra html that we've generated, like sidebar HTML |
API Tags:
Return: | => ..., 'bodyHtml' => ...) |
string unpackSetting(
string
$packType, mixed
$value
)
|
|
Unpack a packed setting.
Parameters:
string |
$packType: |
|
mixed |
$value: |
the packed value |
API Tags:
Return: | the unpacked value |
See: | GalleryTheme::packSetting |
array validateSettings(
array
$settings
)
|
|
Check the values of the settings for legality. If there are errors, return an array of localized error messages to display for each invalid setting. Used for theme with simple settings (@see isAdvancedSettings)
Parameters:
array |
$settings: |
array('key' => array(value, ...), ...) |
API Tags:
Return: | errors in the form of array('key' => 'translated text', ...) |
Redefined in descendants as:
void _sortItemLinks(
$a,
$b
)
|
|
Sort an array of associative arrays on the 'text' key.
Parameters:
API Tags:
|
|