contenido\classes\class.cms_teaser.php
Description: Class for handling CMS Type Teaser Teaser is able to teaser all articles in a category. It is also possible to set a list of articles which were displayed as manual teaser. This function is not category dependant. There are also several more properties like sort defintions, character limits for teaser text and a teaser headline
Requirements:
- Author
- Timo Trautmann
- Con_php_req
- 5.0
- Copyright
- four for business AG
- License
- http://www.contenido.org/license/LIZENZ.txt
- Link
- http://www.4fb.de
- Link
- http://www.contenido.org
- Package
- Contenido Content Types
- Since
- file available since contenido release 4.8.12 {@internal created 2009-04-08 modified 2009-04-14 - added possibility to expand template select by client or system setting using type 'cms_teaser' modofied 2009-04-21 - added seperate handling for xhtml modified 2009-05-04 - added sort order sequence modified 2009-10-01 - Dominik Ziegler, fixed session bug in link modified 2009-10-12 - Dominik Ziegler, fixed online/offline articles, dynamic teaser generation and translation implemented modified 2009-10-16 - Dominik Ziegler, added manual date support modified 2010-01-21 - Dominik Ziegler, strip tags from manual teaser date $Id$: }}
- Version
- 1.0.5
\Cms_Teaser
All properties of teaser content type were stored as xml document in database as content in {prefix}_content
Properties

array $aCMSTypes- Type
- array
- Access
- private

array $aCfgClient- Type
- array
- Access
- private

array $aTeaserData- Type
- array
- Access
- private

array $aTranslations = array("MORE" => "mehr")Important: This must be a static array!
array("MORE" => "mehr")Details- Type
- array
- Access
- private

integer $iIdArtLang- Type
- integer
- Access
- private

string $sContent- Type
- string
- Access
- private
Methods

__construct(string $sContent, integer $iNumberOfCms, integer $iIdArtLang, array $sEditLink, array $aCfg, array $oDB, string $sContenidoLang, integer $iClient, integer $iLang, array $aCfgClient, $oSess) : voidConstructor of class inits some important class variables and gets some Contenido global vars, so this class has no need to use ugly and buggy global commands
| Name | Type | Description |
|---|---|---|
| $sContent | string |
|
| $iNumberOfCms | integer |
|
| $iIdArtLang | integer |
|
| $sEditLink | array |
|
| $aCfg | array |
|
| $oDB | array |
|
| $sContenidoLang | string |
|
| $iClient | integer |
|
| $iLang | integer |
|
| $aCfgClient | array |
|
| $oSess |
- Access
- public

addModuleTranslations(array $aTranslationStrings) : arrayReturns all translation strings for mi18n.
| Name | Type | Description |
|---|---|---|
| $aTranslationStrings | array | Array with translation strings |
| Type | Description |
|---|---|
| array | Translation strings |

encodeForOutput(string $sCode) : stringIn Contenido content type code is evaled by php.
To make this possible, this function prepares code for evaluation
| Name | Type | Description |
|---|---|---|
| $sCode | string |
|
| Type | Description |
|---|---|
| string | - escaped code |
- Access
- private

extractImage(string $sContent) : \imgWhen a HTML Code is given for a Teaser image try to find a image in this code and generate Teaser image on that basis
| Name | Type | Description |
|---|---|---|
| $sContent | string |
|
| Type | Description |
|---|---|
| \img | tag containing scaled image |
- Access
- private

fillTeaserTemplateEntry(object $oArticle, object $oTpl) : booleanIn edit and view mode this function fills teaser template with informations from an Contenido article object
| Name | Type | Description |
|---|---|---|
| $oArticle | object |
|
| $oTpl | object |
|
| Type | Description |
|---|---|
| boolean | - success state of this operation |
- Access
- private

getAllWidgetEdit() : stringFunction is called in editmode of contenido an returns teaser view and editbutton
| Type | Description |
|---|---|
| string | - escaped html code for further use in contenido and sending to browser |
- Access
- public

getAllWidgetOutput(boolean $bEditmode = false) : \htmlFunction is called in edit- and viewmode in order to generate teasercode for output
| Name | Type | Description |
|---|---|---|
| $bEditmode | boolean |
|
| Type | Description |
|---|---|
| \html | string of select box |
- Access
- public

getAllWidgetView() : stringDynamic filelist generator.
This method is executed every time the filelist is displayed.
| Type | Description |
|---|---|
| string | output of the filelist |

getArtContent(object $oArticle, string $sIdType, integer $iIdType) : stringTeaser 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
| Name | Type | Description |
|---|---|---|
| $oArticle | object |
|
| $sIdType | string |
|
| $iIdType | integer |
|
| Type | Description |
|---|---|
| string | - largest result of content |
- Access
- private

getArtName(integer $iIdArt) : stringFunction retrives name of an article by its id from database
| Name | Type | Description |
|---|---|---|
| $iIdArt | integer |
|
| Type | Description |
|---|---|
| string | - name of article |
- Access
- private

getCountSelect(string $sSelected) : \htmlFunction which generated a select box for setting number of articles which were displayed in teaser as a maximum.
Only important in editmode
| Name | Type | Description |
|---|---|---|
| $sSelected | string |
|
| Type | Description |
|---|---|
| \html | string of select box |
- Access
- private

getCropSelect(string $sSelected) : \htmlFunction which provides select option for cropping teaser images
| Name | Type | Description |
|---|---|---|
| $sSelected | string |
|
| Type | Description |
|---|---|
| \html | string of select box |
- Access
- private

getImage(integer $iImage, integer $iMaxX, integer $iMaxY, $bCropped, boolean $bIsFile = false) : stringFunction 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.
It is also possible to give path to image directly, in this case set fourth parameter to true
| Name | Type | Description |
|---|---|---|
| $iImage | integer |
|
| $iMaxX | integer |
|
| $iMaxY | integer |
|
| $bCropped | ||
| $bIsFile | boolean |
|
| Type | Description |
|---|---|
| string | - <img> tag contains scaled image |
- Access
- private

getSortOrderSelect(string $sSelected) : \htmlFunction which generated a select box for setting teaser sort order argument
| Name | Type | Description |
|---|---|---|
| $sSelected | string |
|
| Type | Description |
|---|---|
| \html | string of select box |
- Access
- private

getSortSelect(string $sSelected) : \htmlFunction which generated a select box for setting teaser sort argument
| Name | Type | Description |
|---|---|---|
| $sSelected | string |
|
| Type | Description |
|---|---|
| \html | string of select box |
- Access
- private

getStyleSelect(string $sSelected) : \htmlFunction which generated a select box for setting teaser style currently two seperate teaser templates were supported
| Name | Type | Description |
|---|---|---|
| $sSelected | string |
|
| Type | Description |
|---|---|
| \html | string of select box |
- Access
- private

getTypeSelect(\unknown_type $sSelectName, string $sSelected, string $sValue) : \htmlTeaser 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.
This function is used three times for source defintion of headline text and teaserimage
| Name | Type | Description |
|---|---|---|
| $sSelectName | \unknown_type |
|
| $sSelected | string |
|
| $sValue | string |
|
| Type | Description |
|---|---|
| \html | string of select box |
- Access
- private

initCmsTypes() : voidFunction which gets all currenty avariable content types and their ids from database and store it into class variable aCMSTypes.
Because this information is used multiple, this way causes a better performance to get this information seperately
- Access
- private

readSettings() : voidFuncten parses XML Document which contains teaser settings and store properties as array into $aSettings
- Access
- private

setDefaultValues() : voidFunction sets some default values for teaser in case that there is no value definied
- Access
- private