Content type CMS_TEASER which lets the editor select articles in various ways which are displayed as teasers.

package Core
subpackage Content Type

 Methods

Initialises class attributes and handles store events.

__construct(string $rawSettings, integer $id, array $contentTypes) : void

Parameters

$rawSettings

string

the raw settings in an XML structure or as plaintext

$id

integer

ID of the content type, e.g. 3 if CMS_DATE[3] is used

$contentTypes

array

array containing the values of all content types

Returns all translation strings for mi18n.

addModuleTranslations(array $translationStrings) : array
Static

Parameters

$translationStrings

array

translation strings

Returns

arrayupdated translation string

Builds an array with directory information from the given upload path.

buildDirectoryList(string $uploadPath) : array
Inherited
inherited_from \cContentTypeAbstract::buildDirectoryList()
inherited_from \cContentTypeAbstractTabbed::buildDirectoryList()

Parameters

$uploadPath

string

path to upload directory (optional, default: root upload path of client)

Returns

arraywith directory information (keys: name, path, sub)

Generates a directory list from the given directory information (which is typically built by {@link cContentTypeAbstract::buildDirectoryList}).

generateDirectoryList(array $dirs) : string
Inherited
inherited_from \cContentTypeAbstract::generateDirectoryList()
inherited_from \cContentTypeAbstractTabbed::generateDirectoryList()

Parameters

$dirs

array

directory information

Returns

stringHTML code showing a directory list

Generates the code which should be shown if this content type is edited.

generateEditCode() : string

Returns

stringescaped HTML code which should be shown if content type is edited

Function is called in edit- and viewmode in order to generate teasercode for output

generateTeaserCode() : \html

Returns

\htmlstring of select box

Generates the code which should be shown if this content type is shown in the frontend.

generateViewCode() : string

Returns

stringescaped HTML code which sould be shown if content type is shown in frontend

Since the content type code is evaled by php, the code has to be encoded.

_encodeForOutput(string $code) : string
Inherited
inherited_from \cContentTypeAbstract::_encodeForOutput()
inherited_from \cContentTypeAbstractTabbed::_encodeForOutput()

Parameters

$code

string

code to encode

Returns

stringencoded code

Generates the code for the action buttons (save and cancel).

_generateActionCode() : string
Inherited
inherited_from \cContentTypeAbstractTabbed::_generateActionCode()

Returns

string- the encoded code for the action buttons

Generates the encoded code for the tab menu.

_generateTabMenuCode(array $tabs) : string
Inherited
inherited_from \cContentTypeAbstractTabbed::_generateTabMenuCode()

Parameters

$tabs

array

associative array mapping the tab IDs to the tab names

Returns

string- the encoded code for the tab menu

Checks whether the directory defined by the given directory information is the currently active directory.

_isActiveDirectory(array $dirData) : boolean
Inherited

Overwrite in subclasses if you use generateDirectoryList!

inherited_from \cContentTypeAbstract::_isActiveDirectory()
inherited_from \cContentTypeAbstractTabbed::_isActiveDirectory()

Parameters

$dirData

array

directory information

Returns

booleanwhether the directory is the currently active directory

Checks whether the given $subDir is a subdirectory of the given $dir.

_isSubdirectory(string $subDir, string $dir) : boolean
Inherited
inherited_from \cContentTypeAbstract::_isSubdirectory()
inherited_from \cContentTypeAbstractTabbed::_isSubdirectory()

Parameters

$subDir

string

the potential subdirectory

$dir

string

the parent directory

Returns

booleanwhether the given $subDir is a subdirectory of $dir

Reads all settings from the $_rawSettings attribute (XML or plaintext) and stores them in the $_settings attribute (associative array or plaintext).

_readSettings() : void
Inherited
inherited_from \cContentTypeAbstract::_readSettings()
inherited_from \cContentTypeAbstractTabbed::_readSettings()

Checks whether the directory defined by the given directory information should be shown expanded.

_shouldDirectoryBeExpanded(array $dirData) : boolean
Inherited

Overwrite in subclasses if you use getDirectoryList!

inherited_from \cContentTypeAbstract::_shouldDirectoryBeExpanded()
inherited_from \cContentTypeAbstractTabbed::_shouldDirectoryBeExpanded()

Parameters

$dirData

array

directory information

Returns

booleanwhether the directory should be shown expanded

Stores all values from the $_POST array in the $_settings attribute (associative array) and saves them in the database (XML).

_storeSettings() : void
Inherited
inherited_from \cContentTypeAbstract::_storeSettings()
inherited_from \cContentTypeAbstractTabbed::_storeSettings()

When a HTML Code is given for a Teaser image try to find a image in this code and generate Teaser image on that basis

_extractImage(string $content) : \img

Parameters

$content

string
  • HTML string to search image in

Returns

\imgtag containing scaled image

In edit and view mode this function fills teaser template with informations from a CONTENIDO article object.

_fillTeaserTemplateEntry(\cApiArticleLanguage $article, \cTemplate $template) : boolean

Parameters

$article

\cApiArticleLanguage
  • CONTENIDO Article object

$template

\cTemplate
  • CONTENIDO Template object (as reference)

Returns

boolean- success state of this operation

Generats a select box for setting number of articles which should be displayed in teaser as a maximum.

_generateCountSelect() : \html

Only important in editmode.

Returns

\htmlstring of select box

Function which provides select option for cropping teaser images

_generateCropSelect() : \html

Returns

\htmlstring of select box

Function which generated a select box for setting teaser sort order argument

_generateSortOrderSelect() : \html

Returns

\htmlstring of select box

Function which generated a select box for setting teaser sort argument

_generateSortSelect() : \html

Returns

\htmlstring of select box

Generats a select box for setting teaser style currently two seperate teaser templates were supported

_generateStyleSelect() : \html

Returns

\htmlstring of select box

Generates code for the advanced tab in which various advanced settings can be made.

_generateTabAdvanced() : string

Returns

string- the code for the advanced tab

Generates code for the general tab in which various settings can be made.

_generateTabGeneral() : string

Returns

string- the code for the general tab

Generates code for the manual tab in which various settings for the manual teaser can be made.

_generateTabManual() : string

Returns

string- the code for the manual tab

Teaser gets informations from other articles and their content typs Function builds a select box in which coresponding cms type can be selected after that a text box is rendered for setting id for this conent type to get informations from.

_generateTypeSelect(string $selectName, string $selected, string $value) : \html

This function is used three times for source defintion of headline text and teaserimage

Parameters

$selectName

string
  • name of input elements

$selected

string
  • value of select box which is selected

$value

string
  • current value of text box

Returns

\htmlstring of select box

Teaser allows to get a list of ids in which article content is searched in article like 1,2,5,6 the result with largest character count is returned

_getArtContent(\cApiArticleLanguage $article, string $contentTypeName, string $ids) : string

Parameters

$article

\cApiArticleLanguage
  • CONTENIDO article object

$contentTypeName

string
  • Name of Content type to extract informations from

$ids

string
  • list of ids to search in

Returns

string- largest result of content

Function retrives name of an article by its id from database

_getArtName(integer $idArt) : string

Parameters

$idArt

integer
  • CONTENIDO article id

Returns

string- name of article

Function gets path to an image of base of idupload in CONTENIDO, scales this image on basis of teaser settings and returns path to scaled image.

_getImage(integer $image, integer $maxX, integer $maxY, $cropped, boolean $isFile) : string

It is also possible to give path to image directly, in this case set fourth parameter to true

Parameters

$image

integer
  • idupl of image to use for teaser

$maxX

integer
  • maximum image width

$maxY

integer
  • maximum image height

$cropped

$isFile

boolean
  • in case of a direct file path retrival from database is not needed

Returns

string- tag contains scaled image

Gets all currenty avariable content types and their ids from database and store it into class variable aCMSTypes.

_initCmsTypes() : void

Because this information is used multiple times, this causes a better performance than gettting it seperately

Sets some default values for teaser in case that there is no value defined.

_setDefaultValues() : void

 Properties

 

$_cfg : array
Inherited
inherited_from \cContentTypeAbstract::$$_cfg
inherited_from \cContentTypeAbstractTabbed::$$_cfg
 

$_cfgClient : array
Inherited
inherited_from \cContentTypeAbstract::$$_cfgClient
inherited_from \cContentTypeAbstractTabbed::$$_cfgClient
 

$_client : integer
Inherited
inherited_from \cContentTypeAbstract::$$_client
inherited_from \cContentTypeAbstractTabbed::$$_client
 

$_contentTypes : array
Inherited
inherited_from \cContentTypeAbstract::$$_contentTypes
inherited_from \cContentTypeAbstractTabbed::$$_contentTypes
 

$_formFields : array
Inherited
inherited_from \cContentTypeAbstract::$$_formFields
inherited_from \cContentTypeAbstractTabbed::$$_formFields
 

$_id : integer
Inherited

3 if CMS_TEASER[3] is used.

inherited_from \cContentTypeAbstract::$$_id
inherited_from \cContentTypeAbstractTabbed::$$_id
 

$_idArt : integer
Inherited
inherited_from \cContentTypeAbstract::$$_idArt
inherited_from \cContentTypeAbstractTabbed::$$_idArt
 

$_idArtLang : integer
Inherited
inherited_from \cContentTypeAbstract::$$_idArtLang
inherited_from \cContentTypeAbstractTabbed::$$_idArtLang
 

$_idCat : integer
Inherited
inherited_from \cContentTypeAbstract::$$_idCat
inherited_from \cContentTypeAbstractTabbed::$$_idCat
 

$_lang : integer
Inherited
inherited_from \cContentTypeAbstract::$$_lang
inherited_from \cContentTypeAbstractTabbed::$$_lang
 

$_prefix : string
Inherited

'teaser'.

inherited_from \cContentTypeAbstract::$$_prefix
inherited_from \cContentTypeAbstractTabbed::$$_prefix
 

$_rawSettings : string
Inherited
inherited_from \cContentTypeAbstract::$$_rawSettings
inherited_from \cContentTypeAbstractTabbed::$$_rawSettings
 

$_session : \Contenido_Session
Inherited
inherited_from \cContentTypeAbstract::$$_session
inherited_from \cContentTypeAbstractTabbed::$$_session
 

$_settings : array
Inherited
inherited_from \cContentTypeAbstract::$$_settings
inherited_from \cContentTypeAbstractTabbed::$$_settings
 

$_settingsType : string
Inherited
inherited_from \cContentTypeAbstract::$$_settingsType
inherited_from \cContentTypeAbstractTabbed::$$_settingsType
 

$_translations : array

Important: This must be a static array!

 

$_type : string
Inherited

'CMS_TEASER'.

inherited_from \cContentTypeAbstract::$$_type
inherited_from \cContentTypeAbstractTabbed::$$_type
 

$_uploadPath : string
Inherited
inherited_from \cContentTypeAbstract::$$_uploadPath
inherited_from \cContentTypeAbstractTabbed::$$_uploadPath
 

$_useXHTML : boolean
Inherited
inherited_from \cContentTypeAbstract::$$_useXHTML
inherited_from \cContentTypeAbstractTabbed::$$_useXHTML
 

$_cmsTypes : array
 

$_forwardTypes : array
 

$_ignoreTypes : array

 Constants

 

Constant defining that the settings should be interpreted as plaintext.

SETTINGS_TYPE_PLAINTEXT 
Inherited
inherited_from \cContentTypeAbstract::SETTINGS_TYPE_PLAINTEXT
inherited_from \cContentTypeAbstractTabbed::SETTINGS_TYPE_PLAINTEXT
 

Constant defining that the settings should be interpreted as XML.

SETTINGS_TYPE_XML 
Inherited
inherited_from \cContentTypeAbstract::SETTINGS_TYPE_XML
inherited_from \cContentTypeAbstractTabbed::SETTINGS_TYPE_XML