Documentation

MediaDirectoryEntry extends MediaDirectoryInputfield

Media Directory Entry Class

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

CLOUDREXX Development Team info@cloudrexx.com

subpackage

module_mediadir

Table of Contents

Properties

$_objTpl  : mixed
$arrCommunityGroups  : mixed
$arrEntries  : mixed
$arrFrontendLanguages  : mixed
$arrInputfields  : mixed
$arrJavascriptFormOnSubmit  : mixed
$arrSettings  : mixed
$bolExpSearch  : mixed
$intFormId  : mixed
$moduleConstVar  : mixed
$moduleLangVar  : mixed
$moduleName  : mixed
$moduleNameLC  : mixed
$moduleTablePrefix  : mixed
$pageContent  : mixed
$recordCount  : mixed
$strErrMessage  : mixed
$strJavascript  : mixed
$strOkMessage  : mixed
$category  : mixed
$contextTypes  : array<string|int, mixed>
List of context types to be assigned to inputfields
$currentFetchedEntryDataObject  : MediaDirectoryEntry
Holds the MediaDirectoryEntry object with the most recently loaded entries (using MediaDirectoryEntry::getEntries())
$cx  : mixed
$defaultFieldTemplatetKey  : string
Key to reference the default component or context templates in {@see static::$fieldTemplates}.
$fieldTemplates  : array<string|int, mixed>
List of templates to be used for parsing title and content data of entries.
$fieldTemplateScopes  : array<string|int, mixed>
Available scopes to be used as field templates.
$form  : mixed
$formSlugFields  : array<string|int, mixed>
Contains the form fields as key and their slug field's id as value
$inputFieldMetaData  : array<string|int, mixed>
Temporary container for the meta-data of the input fields.
$level  : mixed
$objForm  : MediaDirectoryForm
Local instance of MediaDirectoryForm
$outputLocale  : Locale
The locale in which the output shall be parsed for
$settings  : array<string|int, mixed>
List of the component's configuration
$slugConversions  : mixed
$slugs  : array<string|int, mixed>
Contains a list of all existing slugs
$usedFrontendLocales  : array<string|int, mixed>
Two-dimensional array of activated frontend locales
$arrSubCategories  : mixed
$arrSubLevels  : mixed
$bolActive  : mixed
$bolLatest  : mixed
$bolPopular  : mixed
$bolReadyToConfirm  : mixed
$bolUnconfirmed  : mixed
$intCatId  : mixed
$intCmdFormId  : mixed
$intEntryId  : mixed
$intLevelId  : mixed
$intLimit  : mixed
$intLimitEnd  : mixed
$intLimitStart  : mixed
$intOffset  : mixed
$intUserId  : mixed
$strBlockName  : mixed
$strSearchTerm  : mixed

Methods

__construct()  : mixed
Constructor
addInputfield()  : mixed
buildDropdownmenu()  : mixed
checkAccess()  : mixed
checkDisplayduration()  : mixed
checkFieldTypeIsExpSeach()  : mixed
confirmEntry()  : mixed
countEntries()  : mixed
createFormOnSubmitScript()  : mixed
deleteEntry()  : mixed
deleteInputfield()  : mixed
fetchMediaDirListConfigFromTemplate()  : array<string|int, mixed>
Fetch config from template
findOneBySlug()  : mixed
generateEntrySlugs()  : mixed
Provides each entry (and the form it is based on) with a slug field and a slug value, both only if the entry/form doesn't already have it Is called when usePrettyUrls is activated or a form has been modified, to make sure the resolving of the entries works correctly.
getApplicationPageByCategory()  : mixed
getApplicationPageByEntry()  : mixed
getApplicationPageByLevel()  : mixed
getApplicationPageByLevelAndCategory()  : mixed
getAssociatedEntriesOptions()  : mixed
Return HTML options for selecting associated entries
getAssociatedEntryIdsByEntryId()  : array<string|int, mixed>
Return an array of Entry IDs associated to the given Entry ID
getAutoSlugPath()  : Url
Get the human readable url for a mediadir location
getCategories()  : mixed
getCategoriesLevels()  : mixed
getCategoryData()  : mixed
getCategorySlugPath()  : mixed
getCommunityGroups()  : mixed
getContextTypes()  : array<string|int, mixed>
Returns available context options
getCustomFormat()  : string
Generate and return a custom formatted representation of an entry ($entry).
getDetailUrl()  : Url
Get the Url of the page on which the entry shall be displayed on
getDetailUrlOfEntry()  : Url
Get the Url of the page on which the entry shall be displayed on
getEntries()  : void
Load Entries for the given parameters
getFieldData()  : array<string|int, mixed>
Get definitions of inputfields.
getFormData()  : mixed
getFormDefinition()  : array<string|int, mixed>
Get the data of entry's associated MediaDirectoryForm object
getFormDefinitionOfEntry()  : array<string|int, mixed>
Get the data of a MediaDirectoryForm object an entry is based on
getFormUrl()  : Url
Get the Url of the section that is used to list the loaded entry
getFrontendLanguages()  : mixed
getInputfieldJavascript()  : mixed
getInputfields()  : array<string|int, mixed>
Get list of inputfields (as array) of either all active forms or only those from a specific form if argument $formId is set.
getJavascript()  : mixed
getLevelData()  : mixed
getLevels()  : mixed
getLevelSlugPath()  : mixed
getMediaBrowserButton()  : string
Get mediabrowser button
getNameFromSlug()  : mixed
getOutputLocale()  : Locale
Get locale in which output shall be parsed for
getPublishedQueryCondition()  : string
Returns a SQL condition that matches currently published entries.
getQueryToFindPrimaryInputFieldId()  : string
Get SQL statement to fetch the ID of the primary field of a form.
getSelectorJavascript()  : mixed
getSelectorOrder()  : mixed
getSelectorSearch()  : array<string|int, mixed>
Get setting if levels or categories shall be included in extended search functionality of a specific form.
getSettings()  : mixed
getSlugFromName()  : mixed
getStrBlockName()  : string
Getter for $this->strBlockName
getThumbImage()  : string
Get the Thumbnail image path from given file Thumbnail will be created it is not exists
getUploadedFilePath()  : bool|string
Get uploaded file path by using uploader id and file name
listEntries()  : mixed
listInputfields()  : mixed
listPlaceholders()  : mixed
makeJavascriptInputfieldArray()  : mixed
moveInputfield()  : mixed
parseCategoryLevels()  : mixed
Parse template blocks mediadir_category or mediadir_level
refreshInputfields()  : string
Refresh the Input fields
refreshOrder()  : mixed
resetEntries()  : mixed
Reset fetch entry list
saveEntry()  : mixed
saveInputfields()  : mixed
saveOrder()  : mixed
searchResultsForSearchModule()  : array<string|int, mixed>
Searches the content and returns an array that is built as needed by the search module.
setDisplaydurationNotificationStatus()  : mixed
setJavascript()  : mixed
setStrBlockName()  : mixed
Setter for $this->strBlockName
sortInputfields()  : mixed
updateEntries()  : mixed
Update the entries while activating the new language.
updateHits()  : mixed
updateInputFields()  : bool
Update form inputfields
addSlugFieldToForm()  : int
Add a new inputfield to a form and set its context type to 'slug'.
dateFromInput()  : int
Takes a date in the format dd.mm.yyyyand returns it's representation as mktime()-timestamp.
deleteAssociatedEntryIds()  : bool
Remove associated Entries for the given Entry ID
enforceUniqueSlug()  : mixed
Enforce uniqueness of a slug
flushInputFieldMetaDataByFormId()  : mixed
Flush cache of input-field meta-data of a specific form
flushSettings()  : mixed
flushUsedFrontendLocales()  : mixed
Flush cached list of used frontend locales
getApplicationPageByForm()  : mixed
getCurrentFetchedEntryDataObject()  : mixed
getCustomFormatDefinition()  : string
Get the FieldTemplate (HTML-Code) (from {@see static::getCustomFormatTemplates()}) for $scope that best matches $component, $context and $formId.
getCustomFormatTemplates()  : array<string|int, mixed>
Load and return the custom format templates
getInputContexts()  : array<string|int, mixed>
Returns available context options
getInputfieldTypes()  : array<string|int, mixed>
getInputfieldVerifications()  : array<string|int, mixed>
getMainApplicationPage()  : mixed
getQueryToFindInputFieldIdByContextType()  : string
Get SQL statement to fetch the ID of the field of a form identified by its context.
getSourceLocaleIdForTargetLocale()  : int
Get the source locale of a target locale
initI18nEntryData()  : void
Initialize the multilingual data of all existing entries associated to form identified by `$formId`. This will insert empty datasets into the database for each inputfield of `$formId` that is a multilingual field (`type_multi_lang = 1`).
initOutputLocale()  : Locale
Determine the locale in which the output shall be parsed for.
insertAssociatedEntryId()  : bool
Insert an associated Entry relation
isEntryPublished()  : bool
Determines whether the entry is currently published.
isEntryScheduled()  : bool
Determines whether the entry is scheduled (i.e., not currently published but time-bound).
loadAllSlugsFromDb()  : mixed
Fetch all slugs from the database
parseContextData()  : void
Parse context related data into template $template
parseEntry()  : void
Parse data of entry from $arrEntry into placeholders & blocks in template $objTpl.
parseGoogleMapPlaceholder()  : mixed
setCurrentFetchedEntryDataObject()  : mixed
slugify()  : mixed
Slugifies the given string and ensures its uniqueness
storeAssociatedEntryIds()  : bool
Store an array of target Entry IDs associated to the given source Entry ID

Properties

$contextTypes

List of context types to be assigned to inputfields

protected static array<string|int, mixed> $contextTypes = ['none' => ['label' => 'TXT_MEDIADIR_INPUTFIELD_CONTEXT_NONE'], 'title' => ['label' => 'TXT_MEDIADIR_INPUTFIELD_CONTEXT_TITLE', 'fieldTypeRestrictions' => [ 1, // text 2, // textarea 7, // file 8, // image 12, // link 13, // linkGroup 19, // wysiwyg 20, // mail 32, // date 33, // time 34, ]], 'content' => ['label' => 'TXT_MEDIADIR_INPUTFIELD_CONTEXT_CONTENT'], 'address' => ['label' => 'TXT_MEDIADIR_INPUTFIELD_CONTEXT_ADDRESS'], 'zip' => ['label' => 'TXT_MEDIADIR_INPUTFIELD_CONTEXT_ZIP'], 'city' => ['label' => 'TXT_MEDIADIR_INPUTFIELD_CONTEXT_CITY'], 'country' => ['label' => 'TXT_MEDIADIR_INPUTFIELD_CONTEXT_COUNTRY'], 'image' => ['label' => 'TXT_MEDIADIR_INPUTFIELD_CONTEXT_IMAGE'], 'keywords' => ['label' => 'TXT_MEDIADIR_INPUTFIELD_CONTEXT_KEYWORDS', 'fieldTypeRestrictions' => [ 1, // text 2, // textarea 3, // dropdown 4, // radio 5, ]], 'slug' => ['label' => 'TXT_MEDIADIR_INPUTFIELD_CONTEXT_SLUG', 'fieldTypeRestrictions' => [1]]]

Each context type must only be assigned once per form. The structure of the array is as follows:

array(
    <type> => array(
        'label' => '<label>',
        ['fieldTypeRestrictions' => array(
            <typeId>,
            ...
        ),]
    ),
    ...
)

$currentFetchedEntryDataObject

Holds the MediaDirectoryEntry object with the most recently loaded entries (using MediaDirectoryEntry::getEntries())

protected static MediaDirectoryEntry $currentFetchedEntryDataObject = null

$defaultFieldTemplatetKey

Key to reference the default component or context templates in {@see static::$fieldTemplates}.

protected static string $defaultFieldTemplatetKey = 'default'

$fieldTemplates

List of templates to be used for parsing title and content data of entries.

protected static array<string|int, mixed> $fieldTemplates = []

$fieldTemplateScopes

Available scopes to be used as field templates.

protected static array<string|int, mixed> $fieldTemplateScopes = ['title', 'content']

Those are currently only title (Title.html) and content (Content.html).

$formSlugFields

Contains the form fields as key and their slug field's id as value

protected array<string|int, mixed> $formSlugFields = null

$inputFieldMetaData

Temporary container for the meta-data of the input fields.

protected static array<string|int, mixed> $inputFieldMetaData = array()

This is used to reduce the amount of queries made to the database system.

$slugs

Contains a list of all existing slugs

protected static array<string|int, mixed> $slugs = array()

Is being used to ensure uniqueness within slugs.

$usedFrontendLocales

Two-dimensional array of activated frontend locales

protected static array<string|int, mixed> $usedFrontendLocales = array()

Contains array-data of the frontend locales that have been activated in the settings section.

Methods

buildDropdownmenu()

public buildDropdownmenu(mixed $arrOptions[, mixed $intSelected = null ]) : mixed
Parameters
$arrOptions : mixed
$intSelected : mixed = null

createFormOnSubmitScript()

public createFormOnSubmitScript(mixed $arrScripts) : mixed
Parameters
$arrScripts : mixed

fetchMediaDirListConfigFromTemplate()

Fetch config from template

public static fetchMediaDirListConfigFromTemplate(string $block, Sigma $template[, int $formId = null ][, int $categoryId = null ][, int $levelId = null ]) : array<string|int, mixed>

Identity functional placeholders in the block $block of template $templatet that will act as config options to be applied on the listing of entries. Placeholders can have the following form:

  • MEDIADIR_CONFIG_LIST_LATEST => Order by latest addition
  • MEDIADIR_CONFIG_LIST_LIMIT_<limit> => Limit the listing
  • MEDIADIR_CONFIG_LIST_OFFSET_<offset> => Start listing at offset
  • MEDIADIR_CONFIG_FILTER_FIELD_<field>_(EQ|GE|GT|LE|LT|NE)_<value> => filter by field having ID <field> and <value> using equal (EQ), greater equal (GE), greater than (GT), lower equal (LE), lower than (LT) or not equal (NE) operation
  • MEDIADIR_CONFIG_FILTER_FORM_<id> => filter by form
  • MEDIADIR_CONFIG_FILTER_CATEGORY_<id> => filter by category
  • MEDIADIR_CONFIG_FILTER_LEVEL_<id> => filter by level
  • MEDIADIR_CONFIG_FILTER_ASSOCIATED => filter associated entries
  • MEDIADIR_CONFIG_FILTER_AUTO => filter by supplied arguments as default
  • MEDIADIR_CONFIG_SORT_POPULAR => order entries by popularity
  • MEDIADIR_CONFIG_SORT_ALPHABETICAL => order entries alphabetically
  • MEDIADIR_CONFIG_SORT_BY_<field>_(ASC|DESC) => order entries by field having ID <field>
  • MEDIADIR_CONFIG_FUNC_<func> => function specific config. Known usages are:
    • MEDIADIR_CONFIG_FUNC_FIELD_<field>_FILTER_BY_OR => apply OR-filter (instead of AND-filter) on field having ID <field>
    • MEDIADIR_CONFIG_FUNC_FALLBACK_LINK_MYSELF_AS_CATEGORY => Use current page as fallback-link in case no matching category application page is present
    • MEDIADIR_CONFIG_FUNC_FALLBACK_LINK_MYSELF_AS_LEVEL => Use current page as fallback-link in case no matching level application page is present
  • MEDIADIR_CONFIG_FUNC_<func>[_<int>] => function specific config with value set to <int>
Parameters
$block : string

Name of the template block to look up for functional placeholders

$template : Sigma

Template object where the block $block is located in

$formId : int = null

If supplied and filter MEDIADIR_CONFIG_FILTER_AUTO is present, then do set filter form to $formId

$categoryId : int = null

If supplied and filter MEDIADIR_CONFIG_FILTER_AUTO is present, then do set filter category to $categoryId

$levelId : int = null

If supplied and filter MEDIADIR_CONFIG_FILTER_AUTO is present, then do set filter level to $levelId

Return values
array<string|int, mixed>

Multi-dimensional array containing the fetched config having the following structure:

[
    'list' => [
         'latest' => true,
         'limit' => <int:limit>,
         'offset' => <int:offset>,
    ],
    'filter' => [
         'field' => [
             <int:fieldId>' => [
                 (EQ|GE|GT|LE|LT|NE) => <string:filter_value>,
             ],
         ],
         'form' => <int:formId>,
         'category' => <int:categoryId>,
         'level' => <int:levelId>,
         'associated' => true,
    ],
    'sort' => [
        'alphabetical' => true,
        'popular' => true,
        'by' => [
            <int:fieldId> => (ASC|DESC),
        ],
    ],
    'func' => [
        '<string:func>' => (true|<int>),
    ],
]

Note: the sub entries of list, filter, sort and func are only set in case any of the associated placeholders are present in the specified template block.

findOneBySlug()

public findOneBySlug(mixed $slug[, mixed $formId = null ][, mixed $catId = null ][, mixed $levelId = null ][, mixed $autoload = false ]) : mixed
Parameters
$slug : mixed
$formId : mixed = null
$catId : mixed = null
$levelId : mixed = null
$autoload : mixed = false

generateEntrySlugs()

Provides each entry (and the form it is based on) with a slug field and a slug value, both only if the entry/form doesn't already have it Is called when usePrettyUrls is activated or a form has been modified, to make sure the resolving of the entries works correctly.

public generateEntrySlugs([int $formId = 0 ]) : mixed
Parameters
$formId : int = 0

Limit slug generation to form identified by ID $formId.

getApplicationPageByCategory()

public getApplicationPageByCategory(mixed &$categoryId, mixed $langId[, mixed $traverseUp = false ]) : mixed
Parameters
$categoryId : mixed
$langId : mixed
$traverseUp : mixed = false

getApplicationPageByEntry()

public getApplicationPageByEntry(mixed $formId, mixed $langId) : mixed
Parameters
$formId : mixed
$langId : mixed

getApplicationPageByLevel()

public getApplicationPageByLevel(mixed &$levelId, mixed $langId[, mixed $traverseUp = false ]) : mixed
Parameters
$levelId : mixed
$langId : mixed
$traverseUp : mixed = false

getApplicationPageByLevelAndCategory()

public getApplicationPageByLevelAndCategory(mixed &$levelId, mixed &$categoryId, mixed $langId[, mixed $traverseUp = false ]) : mixed
Parameters
$levelId : mixed
$categoryId : mixed
$langId : mixed
$traverseUp : mixed = false

getAssociatedEntriesOptions()

Return HTML options for selecting associated entries

public getAssociatedEntriesOptions(int $formId[, int $entryId = null ]) : mixed

Includes active Entries of Forms associated with Form ID $formId only. Entries associated with $entryID have their "selected" attribute set. When creating a new Entry, $entryId should be null.

Parameters
$formId : int
$entryId : int = null

The optional Entry ID

Tags
author

Reto Kohli reto.kohli@comvation.com

getAssociatedEntryIdsByEntryId()

Return an array of Entry IDs associated to the given Entry ID

public getAssociatedEntryIdsByEntryId(int $entryId) : array<string|int, mixed>

Mind that the returned array may be empty.

Parameters
$entryId : int
Tags
throws
Exception

With the database error message

author

Reto Kohli reto.kohli@comvation.com

Return values
array<string|int, mixed>

The ID array

getAutoSlugPath()

Get the human readable url for a mediadir location

public getAutoSlugPath([array<string|int, mixed> $arrEntry = null ][, int $categoryId = null ][, int $levelId = null ][, bool $useRequestedPageAsFallback = false ][, bool $includeDetailApplicationPage = true ][, Locale $locale = null ]) : Url

URI-Slug scheme precedence

  1. $levelId & $categoryId are set: Url will point to specific level & category application page (if existing). I.e.: section=MediaDir&cmd=4-2

  2. $levelId is set: Url will point to specific level application page (if existing). I.e.: section=MediaDir&cmd=4

  3. $categoryId is set: Url will point to specific category application page (if existing). I.e.: section=MediaDir&cmd=2

  4. if $arrEntry is set: Url will point to specific form application page (if existing). I.e.: section=MediaDir&cmd=team

  5. $categoryId is set: Url will point to main application page (if existing). I.e.: section=MediaDir

  6. if $arrEntry is set: Url will point to specific form detail application page (if existing). I.e.: section=MediaDir&cmd=detail12

  7. if $arrEntry is set: Url will point to generic detail application page (if existing). I.e.: section=MediaDir&cmd=detail

  8. fallback #1 Url will point to main application page (if existing). I.e.: section=MediaDir

  9. fallback #2 Lookup failed, NULL will be returned

Parameters
$arrEntry : array<string|int, mixed> = null

(Optional) Array definition of the entry to locate

$categoryId : int = null

(Optional) ID of the category to locate

$levelId : int = null

(Optional) ID of the level to locate

$useRequestedPageAsFallback : bool = false

(Optional) Whether or not to use the requested page as fallback in case no matching mediadir application could be found

$includeDetailApplicationPage : bool = true

(Optional) Whether or not to include the detail application page as a feasible url target

$locale : Locale = null

(Optional) Get slug-path from specific locale. the detail application page as a feasible url target

Return values
Url

Returns an Url object of the mediadir location. If location is invalid, method will return NULL.

getCategories()

public getCategories([mixed $intEntryId = null ]) : mixed
Parameters
$intEntryId : mixed = null
Tags
todo

Fetch category data once. Also fetch all entry relations at once. Then cache them.

getCategoriesLevels()

public getCategoriesLevels(mixed $intType[, mixed $intEntryId = null ]) : mixed
Parameters
$intType : mixed
$intEntryId : mixed = null

getCategorySlugPath()

public getCategorySlugPath(int $categoryId[, int $offsetCategoryId = 0 ]) : mixed
Parameters
$categoryId : int

ID of category to get the slug-path from

$offsetCategoryId : int = 0

Set the ID of a parent category to only fetch the slug-path from that category downwards.

getContextTypes()

Returns available context options

public static getContextTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

static::$contextTypes

getCustomFormat()

Generate and return a custom formatted representation of an entry ($entry).

public getCustomFormat(array<string|int, mixed> $entry, string $scope[, string $context = '' ][, string $component = '' ]) : string

The format to be used (selected by $scope, $context and $component) is defined by a FieldTemplate. See MediaDirectoryLibrary::getCustomFormatTemplates().

Parameters
$entry : array<string|int, mixed>

The data of the entry that shall be used to generate the formatted output. This should be an element from static::$arrEntries.

$scope : string

One of MediaDirectoryLibrary::$fieldTemplateScopes

$context : string = ''

Optional context for selecting a FieldTemplate. See MediaDirectoryLibrary::getCustomFormatTemplates()

$component : string = ''

The name of the component that is responsible for the custom FieldTemplate (default: MediaDir).

Return values
string

Custom formatted data of $entry.

getDetailUrl()

Get the Url of the page on which the entry shall be displayed on

public getDetailUrl([bool $fallbackToOverview = false ]) : Url

Alias for getDetailUrlOfEntry() where the current loaded entry will be passed to getDetailUrlOfEntry() as first argument $arrEntry.

Parameters
$fallbackToOverview : bool = false

If set to TRUE, method will try to match an overview page in case no appropriate detail page exists (step 3 & 4 of above listing). Defaults to FALSE.

Tags
throws
MediaDirectoryEntryException

In case no valid application page was found, MediaDirectoryEntryException is thrown

Return values
Url

Url the entry will be displayed on

getDetailUrlOfEntry()

Get the Url of the page on which the entry shall be displayed on

public getDetailUrlOfEntry(array<string|int, mixed> $arrEntry[, bool $fallbackToOverview = false ]) : Url

If will try to look of the available application pages in the following order:

  1. Form specific detail page (i.e. section=MediaDir&cmd=detail3)
  2. Regular detail page (i.e. section=MediaDir&cmd=detail)
  3. (optional) Form specific overview page (i.e. section=MediaDir&cmd=team)
  4. (optional) Mail application page (i.e. section=MediaDir)
Parameters
$arrEntry : array<string|int, mixed>

Data regarding an entry object

$fallbackToOverview : bool = false

If set to TRUE, method will try to match an overview page in case no appropriate detail page exists (step 3 & 4 of above listing). Defaults to FALSE.

Tags
throws
MediaDirectoryEntryException

In case no valid application page was found, MediaDirectoryEntryException is thrown

Return values
Url

Url the entry will be displayed on

getEntries()

Load Entries for the given parameters

public getEntries([int|null $intEntryId = null ][, int|null $intLevelId = null ][, int|null $intCatId = null ][, string|null $strSearchTerm = null ][, bool|null $bolLatest = null ][, bool|null $bolUnconfirmed = null ][, bool|null $bolActive = null ][, int|null $intLimitStart = null ][, int|string $intLimitEnd = 'n' ][, int|null $intUserId = null ][, bool|null $bolPopular = null ][, int|null $intCmdFormId = null ][, bool|null $bolReadyToConfirm = null ][, int $intLimit = 0 ][, int $intOffset = 0 ][, bool $associated = false ][, bool $searchByZip = false ][, array<string|int, mixed> $order = array() ][, array<string|int, mixed> $filter = array() ]) : void

Adds Entries to the $arrEntries property array.

Parameters
$intEntryId : int|null = null

The Entry ID

$intLevelId : int|null = null
$intCatId : int|null = null
$strSearchTerm : string|null = null
$bolLatest : bool|null = null
$bolUnconfirmed : bool|null = null
$bolActive : bool|null = null
$intLimitStart : int|null = null
$intLimitEnd : int|string = 'n'
$intUserId : int|null = null
$bolPopular : bool|null = null
$intCmdFormId : int|null = null
$bolReadyToConfirm : bool|null = null
$intLimit : int = 0
$intOffset : int = 0
$associated : bool = false

If true, load all Entries associated with Entry ID $intEntryId

$searchByZip : bool = false

If true, a lookup will be performed by matching $strSearchTerm against the inputfield that has the context 'zip' set.

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

(optional) List of fields to order by. Only works if $bolLatest, $bolPopular and $associated are false/null. Field name (including table alias name where necessary) or field ID as key, SORT_ASC (or 'ASC') or SORT_DESC (or 'DESC') as value.

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

(optional) Associative array of filters to apply. Keys are field IDs. Each value must be an associative array with a single comparison operator as the key and the comparison value as the value. Supported operators are:

  • 'EQ' (equals)
  • 'NE' (not equals)
  • 'GT' (greater than)
  • 'GE' (greater than or equal)
  • 'LT' (less than)
  • 'LE' (less than or equal) Example:
[
    5 => ['EQ' => 'test'],
    7 => ['GE' => 100],
    8 => ['LT' => 200],
]
Tags
global

array $_ARRAYLANG

global

array $_CORELANG

global

\ADOConnection $objDatabase

global

InitCMS $objInit

getFieldData()

Get definitions of inputfields.

public getFieldData() : array<string|int, mixed>
Tags
todo

Extend returned data by additional meta data.

Return values
array<string|int, mixed>

Associated array of all inputfields that are accessible by the current request. Inputfields on which the current user is not authorized to access to, are not returned. The returned array has the following structure:

[
    <int:fieldId> => [
        'type' => <int:type>,
    ],
]

getFormDefinition()

Get the data of entry's associated MediaDirectoryForm object

public getFormDefinition() : array<string|int, mixed>
Return values
array<string|int, mixed>

Data of entry's associated MediaDirectoryForm object

getFormDefinitionOfEntry()

Get the data of a MediaDirectoryForm object an entry is based on

public getFormDefinitionOfEntry(mixed $entryId) : array<string|int, mixed>
Parameters
$entryId : mixed
Return values
array<string|int, mixed>

Data of entry's associated MediaDirectoryForm object

getFormUrl()

Get the Url of the section that is used to list the loaded entry

public getFormUrl() : Url

If a form specific page exists (i.e. section=MediaDir&cmd=team), then the Url to that specific page is returned. Otherwise the Url to the mail application page is returned (section=MediaDir).

Tags
throws
MediaDirectoryEntryException

In case no valid application page was found, MediaDirectoryEntryException is thrown

Return values
Url

Url of the form specific section

getInputfields()

Get list of inputfields (as array) of either all active forms or only those from a specific form if argument $formId is set.

public getInputfields([mixed $formId = 0 ]) : array<string|int, mixed>
Parameters
$formId : mixed = 0
Return values
array<string|int, mixed>

List of inputfields

getLevelSlugPath()

public getLevelSlugPath(int $levelId[, int $offsetLevelId = 0 ]) : mixed
Parameters
$levelId : int

ID of level to get the slug-path from

$offsetLevelId : int = 0

Set the ID of a parent level to only fetch the slug-path from that level downwards.

getMediaBrowserButton()

Get mediabrowser button

public getMediaBrowserButton(string $buttonValue[, string $options = array() ][, string $callback = '' ]) : string
Parameters
$buttonValue : string

Value of the button

$options : string = array()

Input button options

$callback : string = ''

Media browser callback function

Return values
string

html element of browse button

getPublishedQueryCondition()

Returns a SQL condition that matches currently published entries.

public static getPublishedQueryCondition() : string

This condition can be used in SQL queries to filter entries that are:

  • Always published (duration_type = 1), or
  • Time-based (duration_type = 2) and within the valid start/end date window.
Return values
string

The formatted SQL condition for published entries.

getQueryToFindPrimaryInputFieldId()

Get SQL statement to fetch the ID of the primary field of a form.

public getQueryToFindPrimaryInputFieldId([int $formId = 0 ]) : string

The SQL statement can be used as a sub-query in a query where contrexx_module_mediadir_entry is used and has been aliased as 'entry'

Parameters
$formId : int = 0

Set to the ID of a form to restrict the query to a specific form.

Return values
string

The SQL statement to be used as sub-query

getSelectorSearch()

Get setting if levels or categories shall be included in extended search functionality of a specific form.

public getSelectorSearch(int $intSelectorId) : array<string|int, mixed>
Parameters
$intSelectorId : int

Set to 9 to get the setting for category. set to 10 to get the setting for level.

Return values
array<string|int, mixed>

Array containung the setting if the levels or categories shall be included in the extended seach functionality for each form. Format: array( => )

getStrBlockName()

Getter for $this->strBlockName

public getStrBlockName() : string
Return values
string

current parse block name to list the entries

getThumbImage()

Get the Thumbnail image path from given file Thumbnail will be created it is not exists

public getThumbImage(string $path) : string
Parameters
$path : string

Relative path to the file

Return values
string

Thumbnail path

getUploadedFilePath()

Get uploaded file path by using uploader id and file name

public getUploadedFilePath(string $uploaderId, string $fileName) : bool|string
Parameters
$uploaderId : string

Uploader id

$fileName : string

File name

Return values
bool|string

File path when File exists, false otherwise

listEntries()

public listEntries(Sigma $objTpl, int $intView[, string $templateKey = null ]) : mixed
Parameters
$objTpl : Sigma

Template instance to parse the entries into.

$intView : int

Set one of the available parsing behavior: 1: Backend entry list: Use to list entries in backend 2: Frontend entry list: Use to list entries in frontend 3: Alphabetical entry list: Use to list entry for frontend section 'alphabetical' 4: Map view: Use to show entries on a Google Map 5: (deprecated) Frontend entry list: Use to list entries in frontend

$templateKey : string = null

Depends on value of $intView: 4 -> If $templateKey is set, then it will be used as the placeholder to parse the Goolge Map into. 5 -> Is used to "namespace" the placeholders & blocks (to be parsed) as follows: - [[MEDIADIR_<$templateKey>_ENTRY_..]] - <!-- BEGIN/END mediadir_<$templateKey>_inputfields --> Note: <$templateKey> is automatically being converted to upper- or lowercase, depending if its being used in a placeholder or block.

Tags
todo

Migrate deprecated frontend entry list ($intView=5) to $intView=2.

listInputfields()

public listInputfields(Sigma $objTpl, int $intView[, int $intEntryId = null ][, array<string|int, mixed> &$arrContextData = array() ][, string $block = '__global__' ]) : mixed
Parameters
$objTpl : Sigma

Template instance to parse the input-fields into.

$intView : int

Set one of the available parsing behavior: 1: Add/edit form view: Use to set/alter the input-fields of a form 2: Add/edit entry view: Use to set/alter entry data in input-fields 3: Frontend entry view: Use to list entry data in frontend 4: Search form view: Use to generate input-fields as filter-fields for expanded search view MediaDirectorySearch::getExpandedInputfields()

$intEntryId : int = null

Id of entry to parse for views 2 (Add/edit entry view) and 3 (Frontend entry view).

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

Will be filled with the context data of entry identified by $intEntryId of the entry' form defined context fields. But only for $intView = 3 (frontend). I.e.:

[
    'title'   => '...',
    'content' => '...',
    'address' => '...',
    ...
]
$block : string = '__global__'

Used by $intView=3 (Frontend entry view): Name of template block (within $objTpl) into which the input-fields shall get parsed into.

makeJavascriptInputfieldArray()

public makeJavascriptInputfieldArray(mixed $intId, mixed $strName, mixed $intRequired, mixed $strVerification, mixed $strType) : mixed
Parameters
$intId : mixed
$strName : mixed
$intRequired : mixed
$strVerification : mixed
$strType : mixed

moveInputfield()

public moveInputfield(mixed $intFieldId, mixed $intDirectionId) : mixed
Parameters
$intFieldId : mixed
$intDirectionId : mixed

parseCategoryLevels()

Parse template blocks mediadir_category or mediadir_level

public parseCategoryLevels(mixed $intType, mixed $intEntryId, mixed $objTpl) : mixed
Parameters
$intType : mixed
$intEntryId : mixed
$objTpl : mixed

refreshInputfields()

Refresh the Input fields

public refreshInputfields(Sigma $objTpl) : string
Parameters
$objTpl : Sigma

Template object

Return values
string

Parsed Template content

resetEntries()

Reset fetch entry list

public resetEntries() : mixed

Use this method to reset the fetch entry list before calling MediaDirectoryEntry::getEntries again, unless any previously loaded entries shall kept loaded.

saveEntry()

public saveEntry(mixed $arrData[, mixed $intEntryId = null ]) : mixed
Parameters
$arrData : mixed
$intEntryId : mixed = null

searchResultsForSearchModule()

Searches the content and returns an array that is built as needed by the search module.

public searchResultsForSearchModule(Search $search) : array<string|int, mixed>
Parameters
$search : Search
Return values
array<string|int, mixed>

setDisplaydurationNotificationStatus()

public setDisplaydurationNotificationStatus(mixed $intEntryId, mixed $bolStatus) : mixed
Parameters
$intEntryId : mixed
$bolStatus : mixed

setStrBlockName()

Setter for $this->strBlockName

public setStrBlockName(string $blockName) : mixed
Parameters
$blockName : string

html parse block name

updateEntries()

Update the entries while activating the new language.

public updateEntries([mixed $usedLocaleIds = array() ]) : mixed
Parameters
$usedLocaleIds : mixed = array()

updateInputFields()

Update form inputfields

public updateInputFields(int $intFieldId, array<string|int, mixed> $arrFieldNames, array<string|int, mixed> $arrFieldDefaultValues, array<string|int, mixed> $arrFieldInfos[, mixed $existingLocaleIds = array() ]) : bool

Before calling this method Remove the existing form inputfield entries from db for avoiding the duplicate entries in db.

Parameters
$intFieldId : int

Form InputField id

$arrFieldNames : array<string|int, mixed>

Form inputField Names array, the key is refered as the language id

$arrFieldDefaultValues : array<string|int, mixed>

Form inputField Default values array, the key is refered as the language id

$arrFieldInfos : array<string|int, mixed>

Form inputField Information values array the key is refered as the language id

$existingLocaleIds : mixed = array()
Return values
bool

true | false

addSlugFieldToForm()

Add a new inputfield to a form and set its context type to 'slug'.

protected addSlugFieldToForm(int $formId) : int
Parameters
$formId : int

Id of form to add the inputfield to.

Return values
int

Id of the newly added inputfield.

dateFromInput()

Takes a date in the format dd.mm.yyyyand returns it's representation as mktime()-timestamp.

protected dateFromInput(mixed $value) : int
Parameters
$value : mixed

string

Return values
int

timestamp

deleteAssociatedEntryIds()

Remove associated Entries for the given Entry ID

protected deleteAssociatedEntryIds(int $entryId) : bool
Parameters
$entryId : int
Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise

enforceUniqueSlug()

Enforce uniqueness of a slug

protected enforceUniqueSlug(string &$slug, int $entryId, int $slugLangId) : mixed

The supplied $slug will be made unqiue within the sopce of a locale (identified by the locale's ID through argument $slugLangId). This is achieved by adding a trailing (unique) integer to the slug in case its not yet unique. In case the option settingsShowEntriesInAllLang is set, then the slug will be made unique over all locales.

Parameters
$slug : string

The slug to make unique.

$entryId : int

The associated entry of the slug.

$slugLangId : int

The ID of the locale the slug is from.

flushInputFieldMetaDataByFormId()

Flush cache of input-field meta-data of a specific form

protected static flushInputFieldMetaDataByFormId(int $id) : mixed
Parameters
$id : int

ID of form to flush the meta-data of its input fields from the cache.

flushUsedFrontendLocales()

Flush cached list of used frontend locales

protected static flushUsedFrontendLocales() : mixed

getApplicationPageByForm()

protected getApplicationPageByForm(mixed $formCmd, mixed $langId) : mixed
Parameters
$formCmd : mixed
$langId : mixed

getCustomFormatDefinition()

Get the FieldTemplate (HTML-Code) (from {@see static::getCustomFormatTemplates()}) for $scope that best matches $component, $context and $formId.

protected getCustomFormatDefinition(string $scope, string $component, string $context[, int $formId = 0 ]) : string

If there is no matching template for $context, then the default for $component will be returned. However if not even a default for $component exists, then the generic default template will be returned.

Parameters
$scope : string

Either title or content.

$component : string

The name of a component.

$context : string

The specific context to use.

$formId : int = 0

The ID of a form.

Return values
string

The HTML-code of the matching template.

getCustomFormatTemplates()

Load and return the custom format templates

protected getCustomFormatTemplates() : array<string|int, mixed>

The custom format templates are defined in two locations:

  1. modules/MediaDir/View/Template/Generic/.html
  2. images/MediaDir/FieldTemplate/[<formId>/][<componentName>/[/]].html
Tags
todo

Move templates to /data/private/MediaDir (CLX-4442)

Return values
array<string|int, mixed>

List of loaded field templates. The returned array has the following format:

[
    <componentName> => [
        <context> => [
            <scope> => <template>,
            ...
        ],
        ...
    ],
    ...
],

If there are any form specific templates defined, then those are returned in the list of loaded field templates as follows:

[
    <formId> => [
        <componentName> => [
            <context> => [
                <scope> => <template>,
                ...
            ],
            ...
        ],
        ...
    ],
    ...
 ],

getInputContexts()

Returns available context options

protected getInputContexts() : array<string|int, mixed>
Return values
array<string|int, mixed>

available contexts

getInputfieldVerifications()

protected getInputfieldVerifications() : array<string|int, mixed>
Return values
array<string|int, mixed>

getQueryToFindInputFieldIdByContextType()

Get SQL statement to fetch the ID of the field of a form identified by its context.

protected getQueryToFindInputFieldIdByContextType(string $type[, int $formId = 0 ][, bool $allowFallback = false ]) : string

The SQL statement can be used as a sub-query in a query where contrexx_module_mediadir_entry is used and has been aliased as 'entry'

Parameters
$type : string

Context type (MediaDirectoryInputfields::getInputContexts()

$formId : int = 0

Set to the ID of a form to restrict the query to a specific form. In case the form (identified by $formId) has a field set as context $type, then $allowFallback = false is implied.

$allowFallback : bool = false

Set to true to return the first inputfield (according to the set sort order of the inputfields) in case the form of the associated entry does not contain a field by the specified context $type.

Return values
string

The SQL statement to be used as sub-query

getSourceLocaleIdForTargetLocale()

Get the source locale of a target locale

protected static getSourceLocaleIdForTargetLocale(int $localeId[, array<string|int, mixed> $usedFrontendLocales = array() ]) : int

The source locale is the fallback locale of a locale (the target locale) or the system's default locale.

Parameters
$localeId : int

The ID of the target locale

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

List of available locales. One-dimensional array of locale IDs.

Return values
int

The ID of the source locale

initI18nEntryData()

Initialize the multilingual data of all existing entries associated to form identified by `$formId`. This will insert empty datasets into the database for each inputfield of `$formId` that is a multilingual field (`type_multi_lang = 1`).

protected initI18nEntryData(int $formId) : void
Parameters
$formId : int

ID of form to init the i18n entry data.

initOutputLocale()

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

protected static initOutputLocale() : Locale

Backend:

  1. Matching Locale of Backend language
  2. Selected Frontend Locale (of menu / if used by MediaDir)
  3. Default Frontend Locale (if used by MediaDir)
  4. Any Frontend Locale used by MediaDir

Any other mode: Currently requested frontend Locale

Return values
Locale

insertAssociatedEntryId()

Insert an associated Entry relation

protected insertAssociatedEntryId(int $sourceEntryId, int $targetEntryId, int $ord) : bool

The relation is added one-way only, from source to target. Existing records are ignored.

Parameters
$sourceEntryId : int
$targetEntryId : int
$ord : int
Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise

isEntryPublished()

Determines whether the entry is currently published.

protected isEntryPublished(array<string|int, mixed> $entry) : bool

An entry is considered published if:

  • It has entryDurationType set to 1 (always published), or
  • Its start date (entryDurationStart) is in the past (or unset) and end date (entryDurationEnd) is in the future (or unset).
Parameters
$entry : array<string|int, mixed>

An associative array representing the entry.

Return values
bool

true if the entry is published, false otherwise.

isEntryScheduled()

Determines whether the entry is scheduled (i.e., not currently published but time-bound).

protected isEntryScheduled(array<string|int, mixed> $entry) : bool

An entry is considered scheduled if:

  • entryDurationType is 2 (timed),
  • And either:
    • entryDurationStart is in the future, or
    • entryDurationEnd is in the past.
Parameters
$entry : array<string|int, mixed>

An associative array representing the entry.

Return values
bool

true if the entry is scheduled (future or expired), false otherwise.

loadAllSlugsFromDb()

Fetch all slugs from the database

protected loadAllSlugsFromDb() : mixed

Those will be used to ensure uniqueness within slugs (@see MediaDirectoryLibrary::enforceUniqueSlug()).

parseContextData()

Parse context related data into template $template

protected parseContextData(array<string|int, mixed> $arrContextData, Sigma $template[, string $varPrefixUC = '' ]) : void

Depending of the form definition of the currently parsing entry, the following placeholders (if $varPrefixUC is an empty string) will be parsed:

  • MEDIADIR_ENTRY_TITLE
  • MEDIADIR_ENTRY_TITLE_URL_ENCODED
  • MEDIADIR_ENTRY_CONTENT
  • MEDIADIR_ENTRY_ADDRESS
  • MEDIADIR_ENTRY_ZIP
  • MEDIADIR_ENTRY_CITY
  • MEDIADIR_ENTRY_COUNTRY
  • MEDIADIR_ENTRY_IMAGE
  • MEDIADIR_ENTRY_KEYWORDS
  • MEDIADIR_ENTRY_SLUG Note: The values will be parsed HTML-entity-encoded as fetched from MediaDirectoryInputfield::listInputfields().
Parameters
$arrContextData : array<string|int, mixed>

See MediaDirectoryInputfield::listInputfields()

$template : Sigma
$varPrefixUC : string = ''

parseEntry()

Parse data of entry from $arrEntry into placeholders & blocks in template $objTpl.

protected parseEntry(array<string|int, mixed> $arrEntry, Sigma $objTpl[, string $blockName = '__global__' ][, int $idx = 0 ]) : void
Parameters
$arrEntry : array<string|int, mixed>

Entry from static::arrEntries to be parsed.

$objTpl : Sigma

Template instance that has loaded an appropriate template for parsing the entries data.

$blockName : string = '__global__'

Name of main template-block to use in $objTpl for parsing the entry.

$idx : int = 0

Index of entry being parsed. Will be used to parse [[MEDIADIR_ROW_CLASS]] either as row1 or row2.

parseGoogleMapPlaceholder()

protected parseGoogleMapPlaceholder(mixed $template, mixed $placeholder) : mixed
Parameters
$template : mixed
$placeholder : mixed

setCurrentFetchedEntryDataObject()

protected setCurrentFetchedEntryDataObject(mixed $objEntry) : mixed
Parameters
$objEntry : mixed

slugify()

Slugifies the given string and ensures its uniqueness

protected slugify(int $entryId, string &$string, int $langId[, array<string|int, mixed> $titleData = array() ]) : mixed
Parameters
$entryId : int

The ID of the associated entry

$string : string

The string to slugify

$langId : int

The ID of the locale the string $string comes from.

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

Array of strings to be used in case $string is an empty string. The array uses the IDs of available locales as keys for each string.

storeAssociatedEntryIds()

Store an array of target Entry IDs associated to the given source Entry ID

protected storeAssociatedEntryIds(int $sourceEntryId, array<string|int, mixed> $targetEntryIds) : bool

Returns false on error. If the source Entry's Form is associated bidirectionally with the target form, Entries are also associated both ways.

Parameters
$sourceEntryId : int
$targetEntryIds : array<string|int, mixed>
Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
bool

True on success, false otherwise


        
On this page

Search results