Documentation

Downloads extends DownloadsLibrary

Downloads

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

CLOUDREXX Development Team info@cloudrexx.com

subpackage

module_downloads

version
1.0.0

Table of Contents

Properties

$arrConfig  : mixed
$arrPermissionTypes  : mixed
$categoriesSortingOptions  : array<string|int, mixed>
Categories setting option
$currentApplicationPageCmd  : string
$defaultCategoryImage  : mixed
$defaultDownloadImage  : mixed
$downloadsSortingOptions  : array<string|int, mixed>
Downloads setting option
$isRegularMode  : bool
Whether or not this instance is used for parsing the frontend application section or for a widget.
$moduleParamsHtml  : mixed
$outputLocale  : Locale
The locale in which the output shall be parsed for
$requestedPage  : Page
The reuqested page this component will be parsed into
$searchKeyword  : mixed
$arrStatusMsg  : array<string|int, mixed>
Contains the info messages about done operations
$categoryId  : mixed
$cmd  : mixed
$htmlImgTemplate  : mixed
$htmlLinkTemplate  : mixed
$metaKeys  : string
$moduleParamsJs  : mixed
$objTemplate  : Sigma
$pageTitle  : mixed
$userId  : mixed

Methods

__construct()  : mixed
Constructor
addDownloadFromUpload()  : bool
Save upload file details to database for download
clearEsiCache()  : mixed
Clear Esi Cache content
enhanceUrlForDownload()  : mixed
Enhance $url into a download-url for $download.
getApplicationUrl()  : Url
Get URL pointing to an application page of this component
getGroupById()  : string
Get Group content by group id
getMetaKeywords()  : string
Get meta keywords
getOutputLocale()  : Locale
Get locale in which output shall be parsed for
getPage()  : mixed
Reads $this->cmd and selects (depending on the value) an action
getPageTitle()  : mixed
getPrettyFormatFileName()  : string
Format a filename according to configuration option 'Pretty format' of currently loaded downloads file.
getSettings()  : mixed
hasUserAccessToCategoriesOfDownload()  : bool
Check if currently authenticated user has read access to any of a perticular download's associated categories.
parseSettingsDropDown()  : null
parse the settings dropdown
uploadFinished()  : array<string|int, mixed>
Upload Finished callback
fetchPagingLimitFromTemplate()  : int
Identify a functional placeholder in the block $block of template $template that will determine a custom paging limit.
fetchSortOrderFromTemplate()  : array<string|int, mixed>
Identify functional placeholder in the block $block of template $template that will determine the sort order of the downloads.
getApplicationPage()  : Page
Find best matching application
getCategoryMenu()  : mixed
getCurrentApplicationPageUrl()  : Url
getDownloadMimeTypeMenu()  : mixed
getParsedCategoryListForDownloadAssociation()  : mixed
getParsedUsername()  : mixed
getUserDropDownMenu()  : mixed
getValidityMenu()  : mixed
initDefaultCategoryImage()  : mixed
initDefaultDownloadImage()  : mixed
initOutputLocale()  : mixed
Determine the locale in which the output shall be parsed for.
initSearch()  : mixed
updateSettings()  : mixed
deleteCategory()  : mixed
deleteDownload()  : mixed
download()  : mixed
getFormatedFileSize()  : mixed
getHtmlDeleteLinkIcon()  : mixed
getHtmlFolderLinkTag()  : mixed
getHtmlImageTag()  : mixed
getHtmlLinkTag()  : mixed
getJavaScriptCode()  : mixed
initSettings()  : mixed
overview()  : mixed
parseCategories()  : mixed
parseCategory()  : mixed
parseCategoryAttributes()  : mixed
parseCategoryTreeForDownloadAssociation()  : mixed
parseCategoryTreeForMenu()  : mixed
parseCreateCategoryForm()  : mixed
parseCrumbtrail()  : mixed
parseDownload()  : mixed
parseDownloadAttributes()  : mixed
parseDownloads()  : mixed
parseGlobalStuff()  : mixed
parseGroups()  : mixed
parseMessages()  : mixed
parseRelatedCategories()  : mixed
parseRelatedDownloads()  : mixed
Parse a related downloads
parseSearchForm()  : mixed
parseSpecialDownloads()  : mixed
parseUploadForm()  : mixed
parseURLModifiers()  : mixed
processCreateDirectory()  : mixed

Properties

$arrConfig

protected mixed $arrConfig = array('overview_cols_count' => 2, 'overview_max_subcats' => 5, 'use_attr_metakeys' => 1, 'use_attr_size' => 1, 'use_attr_license' => 1, 'use_attr_version' => 1, 'use_attr_author' => 1, 'use_attr_website' => 1, 'most_viewed_file_count' => 5, 'most_downloaded_file_count' => 5, 'most_popular_file_count' => 5, 'newest_file_count' => 5, 'updated_file_count' => 5, 'new_file_time_limit' => 604800, 'updated_file_time_limit' => 604800, 'associate_user_to_groups' => '', 'list_downloads_current_lang' => 1, 'integrate_into_search_component' => 1, 'auto_file_naming' => 'off', 'pretty_regex_pattern' => '', 'global_search_linking' => 'detail')

$arrPermissionTypes

protected mixed $arrPermissionTypes = array('getReadAccessId' => 'read', 'getAddSubcategoriesAccessId' => 'add_subcategories', 'getManageSubcategoriesAccessId' => 'manage_subcategories', 'getAddFilesAccessId' => 'add_files', 'getManageFilesAccessId' => 'manage_files')

$categoriesSortingOptions

Categories setting option

protected array<string|int, mixed> $categoriesSortingOptions = array('custom' => array('order' => 'ASC', 'name' => 'ASC', 'id' => 'ASC'), 'alphabetic' => array('name' => 'ASC', 'id' => 'ASC'))

$currentApplicationPageCmd

protected string $currentApplicationPageCmd = ''

$downloadsSortingOptions

Downloads setting option

protected array<string|int, mixed> $downloadsSortingOptions = array('custom' => array('order' => 'ASC', 'name' => 'ASC', 'id' => 'ASC'), 'alphabetic' => array('name' => 'ASC', 'id' => 'ASC'), 'newestToOldest' => array('ctime' => 'DESC', 'id' => 'ASC'), 'oldestToNewest' => array('ctime' => 'ASC', 'id' => 'ASC'))

$isRegularMode

Whether or not this instance is used for parsing the frontend application section or for a widget.

protected bool $isRegularMode = true

If instance is used for processing a regular frontend request to this components application section, then $isRegularMode is set TRUE. Otherwise, if this instance is being used for parsing a Widget of this component, then $isRegularMode is set to FALSE.

$moduleParamsHtml

protected mixed $moduleParamsHtml = '?section=Downloads'

$requestedPage

The reuqested page this component will be parsed into

protected Page $requestedPage = null

$arrStatusMsg

Contains the info messages about done operations

private array<string|int, mixed> $arrStatusMsg = array('ok' => array(), 'error' => array())
Tags
access

private

$htmlImgTemplate

private mixed $htmlImgTemplate = '<img src="%s" alt="%s" />'

$htmlLinkTemplate

private mixed $htmlLinkTemplate = '<a href="%s" title="%s">%s</a>'

$metaKeys

private string $metaKeys

The metakeys is used to set page metakeys

$moduleParamsJs

private mixed $moduleParamsJs = '?section=Downloads'

Methods

__construct()

Constructor

public __construct(mixed $pageContent[,  $queryParams = array() ][,  $requestedPage = null ]) : mixed

Calls the parent constructor and creates a local template object

Parameters
$pageContent : mixed

The content of the page as string or \Cx\Core\Html\Sigma template

$queryParams : = array()

array The constructor accepts an array parameter $queryParams, which will override the request parameters cmd and/or category, if given

$requestedPage : = null

\Cx\Core\ContentManager\Model\Entity\Page The requested page this component will be parsed into

addDownloadFromUpload()

Save upload file details to database for download

public static addDownloadFromUpload(string $fileName, string $fileExtension, mixed $suffix, object $objCategory, object $objDownloads, object $sourceName, mixed $data) : bool
Parameters
$fileName : string

filename it is modified name or original name ie) what name will be mentioned for upload file in target folder

$fileExtension : string

file extension

$suffix : mixed

if choosen file is already exist, suffix will be created as string otherwise empty

$objCategory : object

upload file category

$objDownloads : object

downdload file object from the upload informations

$sourceName : object

original file name

$data : mixed
Return values
bool

true | false

enhanceUrlForDownload()

Enhance $url into a download-url for $download.

public static enhanceUrlForDownload(Url $url, Download $download[, string $disposition = HTTP_DOWNLOAD_ATTACHMENT ]) : mixed
Parameters
$url : Url

URL object to enhance

$download : Download

Target Download object

$disposition : string = HTTP_DOWNLOAD_ATTACHMENT

Set to HTTP_DOWNLOAD_ATTACHMENT or HTTP_DOWNLOAD_INLINE

getApplicationUrl()

Get URL pointing to an application page of this component

public static getApplicationUrl([mixed $categories = array() ]) : Url

If one or more IDs of categories are supplied, then it will try to point to an application identified by an ID of a category as its CMD.

Parameters
$categories : mixed = array()
Tags
throws
DownloadsLibraryException

In case no valid application page is found, DownloadsLibraryException is thrown

Return values
Url

URL pointing to an application page of this component

getGroupById()

Get Group content by group id

public getGroupById(int $id, int $langId) : string
Parameters
$id : int

group id

$langId : int

Language id

Return values
string

getMetaKeywords()

Get meta keywords

public getMetaKeywords() : string
Return values
string

getPage()

Reads $this->cmd and selects (depending on the value) an action

public getPage() : mixed

getPrettyFormatFileName()

Format a filename according to configuration option 'Pretty format' of currently loaded downloads file.

public getPrettyFormatFileName(string $fileName) : string
Parameters
$fileName : string

The filename to pretty format

Return values
string

The pretty formatted filename. In case of any error or if the function to pretty format is disabled, then the original $filename is being returned.

hasUserAccessToCategoriesOfDownload()

Check if currently authenticated user has read access to any of a perticular download's associated categories.

public hasUserAccessToCategoriesOfDownload(mixed $objDownload) : bool
Parameters
$objDownload : mixed
Return values
bool

Returns TRUE, if the currently authenticated user has read access to at least one of the download's associated categories.

parseSettingsDropDown()

parse the settings dropdown

public parseSettingsDropDown(object $objTemplate, array<string|int, mixed> $settingValues, string $selected, string $blockName) : null
Parameters
$objTemplate : object

template object

$settingValues : array<string|int, mixed>

array of setting values

$selected : string

selected dropdown value

$blockName : string

block name for template parsing

Return values
null

uploadFinished()

Upload Finished callback

public static uploadFinished(string $tempPath, string $tempWebPath, array<string|int, mixed> $data, string $uploadId, array<string|int, mixed> $fileInfos, array<string|int, mixed> $response) : array<string|int, mixed>

This is called as soon as uploads have finished. takes care of moving them to the right folder

Parameters
$tempPath : string

Path to the temporary directory containing the files at this moment

$tempWebPath : string

Points to the same folder as tempPath, but relative to the webroot

$data : array<string|int, mixed>

Data given to setData() when creating the uploader

$uploadId : string

unique session id for the current upload

$fileInfos : array<string|int, mixed>

uploaded file informations

$response : array<string|int, mixed>

uploaded status

Return values
array<string|int, mixed>

path and webpath

fetchPagingLimitFromTemplate()

Identify a functional placeholder in the block $block of template $template that will determine a custom paging limit.

protected fetchPagingLimitFromTemplate(string $block, Sigma $template, int $defaultPagingLimit) : int

Placeholder can have the following form:

  • DOWNLOADS_CONFIG_LIMIT_ Example:
  • DOWNLOADS_CONFIG_LIMIT_3
Parameters
$block : string

Name of the template block to look up for functional placeholder

$template : Sigma

Template object where the block $block is located in

$defaultPagingLimit : int

Fallback paging limit in case no functional placeholder can be located in the supplied template.

Return values
int

Identified paging limit. If no functional placeholder has been found in the supplied template, then the default paging limit (defined by $defaultPagingLimit) is returned.

fetchSortOrderFromTemplate()

Identify functional placeholder in the block $block of template $template that will determine the sort order of the downloads.

protected fetchSortOrderFromTemplate(string $block, Sigma $template, string $defaultSortOrder, mixed $orderOptions) : array<string|int, mixed>

Placeholder can have the following form:

  • DOWNLOADS_CONFIG_LIST_CUSTOM => Order by custom order
  • DOWNLOADS_CONFIG_LIST_ALPHABETIC => Order alphabetically
  • DOWNLOADS_CONFIG_LIST_NEWESTTOOLDEST => Order by latest
  • DOWNLOADS_CONFIG_LIST_OLDESTTONEWEST => Order by oldest
Parameters
$block : string

Name of the template block to look up for functional placeholder

$template : Sigma

Template object where the block $block is located in

$defaultSortOrder : string

Fallback sort order in case no functional placeholder can be located in the supplied template.

$orderOptions : mixed
Return values
array<string|int, mixed>

Identified sort oder. If no functional placeholder has been found in the supplied template, then the default sort order (defined by $defaultSortOrder) is returned. The returned array is an element of $orderOptions.

getApplicationPage()

Find best matching application

protected static getApplicationPage([array<string|int, mixed> $categoryIds = array() ]) : Page

If one or more IDs of categories are supplied, then it will try to find an application identified by an ID of a category as its CMD.

Parameters
$categoryIds : array<string|int, mixed> = array()

Array of category IDs to look for a matching application page for.

Tags
throws
DownloadsLibraryException

In case no valid application page is found, DownloadsLibraryException is thrown

Return values
Page

An application page of this component.

getCategoryMenu()

protected getCategoryMenu(mixed $accessType, mixed $selectedCategory, mixed $selectionText[, mixed $attrs = null ][, mixed $categoryId = null ]) : mixed
Parameters
$accessType : mixed
$selectedCategory : mixed
$selectionText : mixed
$attrs : mixed = null
$categoryId : mixed = null

getCurrentApplicationPageUrl()

protected getCurrentApplicationPageUrl([mixed $params = [] ]) : Url
Parameters
$params : mixed = []
Tags
params

array Optional arguments to append to the URL of the current application page.

Return values
Url

getDownloadMimeTypeMenu()

protected getDownloadMimeTypeMenu(mixed $selectedType) : mixed
Parameters
$selectedType : mixed

getParsedCategoryListForDownloadAssociation()

protected getParsedCategoryListForDownloadAssociation() : mixed

getParsedUsername()

protected getParsedUsername(mixed $userId) : mixed
Parameters
$userId : mixed

getUserDropDownMenu()

protected getUserDropDownMenu(mixed $selectedUserId, mixed $userId) : mixed
Parameters
$selectedUserId : mixed
$userId : mixed

getValidityMenu()

protected getValidityMenu(mixed $validity, mixed $expirationDate) : mixed
Parameters
$validity : mixed
$expirationDate : mixed

initOutputLocale()

Determine the locale in which the output shall be parsed for.

protected static initOutputLocale() : mixed

getFormatedFileSize()

private getFormatedFileSize(mixed $bytes) : mixed
Parameters
$bytes : mixed

getHtmlDeleteLinkIcon()

private getHtmlDeleteLinkIcon(mixed $id, mixed $name, mixed $method) : mixed
Parameters
$id : mixed
$name : mixed
$method : mixed

getHtmlFolderLinkTag()

private getHtmlFolderLinkTag(mixed $href, mixed $title, mixed $value) : mixed
Parameters
$href : mixed
$title : mixed
$value : mixed

getHtmlImageTag()

private getHtmlImageTag(mixed $src, mixed $alt) : mixed
Parameters
$src : mixed
$alt : mixed

getHtmlLinkTag()

private getHtmlLinkTag(mixed $href, mixed $title, mixed $value) : mixed
Parameters
$href : mixed
$title : mixed
$value : mixed

getJavaScriptCode()

private getJavaScriptCode(mixed $objCategory) : mixed
Parameters
$objCategory : mixed

parseCategories()

private parseCategories(mixed $objCategory, mixed $arrCategoryBlocks[, mixed $categoryLimit = null ][, mixed $variablePrefix = '' ][, mixed $rowBlock = null ][, mixed $arrSubCategoryBlocks = null ][, mixed $subCategoryLimit = null ][, mixed $subPrefix = '' ]) : mixed
Parameters
$objCategory : mixed
$arrCategoryBlocks : mixed
$categoryLimit : mixed = null
$variablePrefix : mixed = ''
$rowBlock : mixed = null
$arrSubCategoryBlocks : mixed = null
$subCategoryLimit : mixed = null
$subPrefix : mixed = ''

parseCategory()

private parseCategory(mixed $objCategory) : mixed
Parameters
$objCategory : mixed

parseCategoryAttributes()

private parseCategoryAttributes(mixed $objCategory, mixed $row, mixed $variablePrefix[, mixed $allowDeleteCategory = false ]) : mixed
Parameters
$objCategory : mixed
$row : mixed
$variablePrefix : mixed
$allowDeleteCategory : mixed = false

parseCategoryTreeForDownloadAssociation()

private parseCategoryTreeForDownloadAssociation(mixed &$arrCategories[, mixed $parentId = 0 ][, mixed $level = 0 ][, mixed $parentName = '' ]) : mixed
Parameters
$arrCategories : mixed
$parentId : mixed = 0
$level : mixed = 0
$parentName : mixed = ''

parseCategoryTreeForMenu()

private parseCategoryTreeForMenu(mixed &$arrCategories, mixed $selectedCategory[, mixed $categoryId = null ][, mixed $parentId = 0 ][, mixed $level = 0 ]) : mixed
Parameters
$arrCategories : mixed
$selectedCategory : mixed
$categoryId : mixed = null
$parentId : mixed = 0
$level : mixed = 0

parseCreateCategoryForm()

private parseCreateCategoryForm(mixed $objCategory) : mixed
Parameters
$objCategory : mixed

parseCrumbtrail()

private parseCrumbtrail(mixed $objParentCategory) : mixed
Parameters
$objParentCategory : mixed

parseDownload()

private parseDownload(mixed $objDownload, mixed $categoryId) : mixed
Parameters
$objDownload : mixed
$categoryId : mixed

parseDownloadAttributes()

private parseDownloadAttributes(mixed $objDownload, mixed $categoryId[, mixed $allowDeleteFilesFromCategory = false ][, mixed $variablePrefix = '' ]) : mixed
Parameters
$objDownload : mixed
$categoryId : mixed
$allowDeleteFilesFromCategory : mixed = false
$variablePrefix : mixed = ''

parseDownloads()

private parseDownloads(mixed $objCategory[, mixed $variablePrefix = '' ]) : mixed
Parameters
$objCategory : mixed
$variablePrefix : mixed = ''

parseGlobalStuff()

private parseGlobalStuff(mixed $objCategory) : mixed
Parameters
$objCategory : mixed

parseGroups()

private parseGroups(mixed $objCategory) : mixed
Parameters
$objCategory : mixed

parseRelatedCategories()

private parseRelatedCategories(mixed $objDownload[, mixed $variablePrefix = '' ]) : mixed
Parameters
$objDownload : mixed
$variablePrefix : mixed = ''

parseRelatedDownloads()

Parse a related downloads

private parseRelatedDownloads(Download $objDownload, int $currentCategoryId) : mixed
Parameters
$objDownload : Download

Download object

$currentCategoryId : int

Category ID

parseSearchForm()

private parseSearchForm(mixed $objCategory) : mixed
Parameters
$objCategory : mixed

parseSpecialDownloads()

private parseSpecialDownloads(mixed $arrBlocks, mixed $arrFilter, mixed $arrSort, mixed $limit) : mixed
Parameters
$arrBlocks : mixed
$arrFilter : mixed
$arrSort : mixed
$limit : mixed

parseUploadForm()

private parseUploadForm(mixed $objCategory) : mixed
Parameters
$objCategory : mixed

parseURLModifiers()

private parseURLModifiers(mixed $queryParams) : mixed
Parameters
$queryParams : mixed

processCreateDirectory()

private processCreateDirectory(mixed $objCategory) : mixed
Parameters
$objCategory : mixed

        
On this page

Search results