Contenido API - Article Object

This object represents a Contenido article

Create object with $obj = new Article(idart, client, lang [, idartlang]);

You can now read the article properties with $obj->getField(property);

List of article properties:

idartlang - Language dependant article id idart - Language indepenant article id idclient - Id of the client idtplcfg - Template configuration id title - Internal Title pagetitle - HTML Title summary - Article summary created - Date created lastmodified - Date lastmodiefied author - Article author (username) online - On-/offline redirect - Redirect redirect_url - Redirect URL artsort - Article sort key timemgmt - Time management datestart - Time management start date dateend - Time management end date status - Article status free_use_01 - Free to use free_use_02 - Free to use free_use_03 - Free to use time_move_cat - Move category after time management time_target_cat - Move category to this cat after time management time_online_move - Set article online after move external_redirect - Open article in new window locked - Article is locked for editing

You can extract article content with the $obj->getContent(contype [, number]) method.

To extract the first headline you can use:

$headline = $obj->getContent("htmlhead", 1);

If the second parameter is ommitted the method returns an array with all available content of this type. The array has the following schema:

array( number => content );

$headlines = $obj->getContent("htmlhead");

$headlines[1] First headline $headlines[2] Second headline $headlines[6] Sixth headline

Legal content type string are defined in the Contenido system table 'con_type'. Default content types are:

NOTE: This parameter is case insesitive, you can use html or cms_HTML or CmS_HtMl. Your don't need start with cms, but it won't crash if you do so.

htmlhead - HTML Headline html - HTML Text headline - Headline (no HTML) text - Text (no HTML) img - Upload id of the element imgdescr - Image description link - Link (URL) linktarget - Linktarget (_self, _blank, _top ...) linkdescr - Linkdescription swf - Upload id of the element

author Timo A. Hummel <Timo.Hummel@4fb.de>
author Murat Purc
version 0.3
copyright four for business 2003

 Methods

Article()

Article($idart, $client, $lang, $idartlang) 

deprecated [2011-03-15] Old constructor function for downwards compatibility

Parameters

$idart

$client

$lang

$idartlang

Constructor

__construct(int $idart, $client, int $lang, $idartlang) : void

Parameters

$idart

int

Article Id

$client

$lang

int

Language Id

$idartlang

Exceptions

\Contenido_ItemException If table name or primary key is not set

Filters the passed data using the functions defines in the _arrInFilters array.

_inFilter(mixed $mData) : mixed
Inherited

see \setFilters
inherited_from \Item::_inFilter()

Parameters

$mData

mixed

Data to filter

Returns

mixedFiltered data

Deletes a custom property.

deleteProperty(string $sType, string $sName) : bool
Inherited

inherited_from \Item::deleteProperty()

Parameters

$sType

string

Specifies the type

$sName

string

Specifies the name

Returns

bool

Deletes a custom property by its id.

deletePropertyById(int $idprop) : bool
Inherited

inherited_from \Item::deletePropertyById()

Parameters

$idprop

int

Id of property

Returns

bool

Escape string for using in SQL-Statement.

escape(string $sString) : string
Inherited

inherited_from \Contenido_ItemBaseAbstract::escape()
inherited_from \Item::escape()

Parameters

$sString

string

The string to escape

Returns

stringEscaped string

Wrapper for getField (less to type).

get(string $sField) : mixed
Inherited

inherited_from \Item::get()

Parameters

$sField

string

Specifies the field to retrieve

Returns

mixedValue of the field

Get content(s) from an article

getContent(string $type, int $id) : mixed

Returns the specified content element or an array("id"=>"value") if the second parameter is omitted.

Legal content type string are defined in the Contenido system table 'con_type'. Default content types are:

NOTE: Parameter is case insesitive, you can use html or cms_HTML or CmS_HtMl. Your don't need start with cms, but it won't crash if you do so.

htmlhead - HTML Headline html - HTML Text headline - Headline (no HTML) text - Text (no HTML) img - Upload id of the element imgdescr - Image description link - Link (URL) linktarget - Linktarget (_self, _blank, _top ...) linkdescr - Linkdescription swf - Upload id of the element

Parameters

$type

string

CMS_TYPE - Legal cms type string

$id

int

Id of the content

Returns

mixedString/Array Content Data

Get the value of an article property

getField(string $name) : mixed

List of article properties:

idartlang - Language dependant article id idart - Language indepenant article id idclient - Id of the client idtplcfg - Template configuration id title - Internal Title pagetitle - HTML Title summary - Article summary created - Date created lastmodified - Date lastmodiefied author - Article author (username) online - On-/offline redirect - Redirect redirect_url - Redirect URL artsort - Article sort key timemgmt - Time management datestart - Time management start date dateend - Time management end date status - Article status free_use_01 - Free to use free_use_02 - Free to use free_use_03 - Free to use time_move_cat - Move category after time management time_target_cat - Move category to this cat after time management time_online_move - Set article online after move external_redirect - Open article in new window locked - Article is locked for editing

Parameters

$name

string

Property name

Returns

mixedProperty value

Getter for idartlang of article object

getIdArtLang() : int

author Ortwin Pinke
since ConLite 0.1.0

Returns

intidartlang

getMetaObject()

getMetaObject() 
Inherited

inherited_from \Item::getMetaObject()

Returns a custom property.

getProperty(string $sType, string $sName) : mixed
Inherited

inherited_from \Item::getProperty()

Parameters

$sType

string

Specifies the type

$sName

string

Specifies the name

Returns

mixedValue of the given property or false

Checks if a the item is already loaded.

isLoaded() : bool
Inherited

inherited_from \Item::isLoaded()

Returns

bool

Loads an item by colum/field from the database.

loadBy(string $sField, mixed $mValue, bool $bSafe) : bool
Inherited

inherited_from \Item::loadBy()

Parameters

$sField

string

Specifies the field

$mValue

mixed

Specifies the value

$bSafe

bool

Use inFilter or not

Returns

boolTrue if the load was successful

Loads an item by ID from the database.

loadByPrimaryKey(string $mValue) : bool
Inherited

inherited_from \Item::loadByPrimaryKey()

Parameters

$mValue

string

Specifies the primary key value

Returns

boolTrue if the load was successful

Loads an item by it's recordset.

loadByRecordSet(array $aRecordSet) 
Inherited

inherited_from \Item::loadByRecordSet()

Parameters

$aRecordSet

array

The recordset of the item

Shortcut to setField.

set(string $sField, string $mValue, bool $bSafe) 
Inherited

inherited_from \Item::set()

Parameters

$sField

string

Field name

$mValue

string

Value to set

$bSafe

bool

Flag to run defined inFilter on passed value

Sets the value of a specific field.

setField(string $sField, string $mValue, bool $bSafe) 
Inherited

inherited_from \Item::setField()

Parameters

$sField

string

Field name

$mValue

string

Value to set

$bSafe

bool

Flag to run defined inFilter on passed value

Define the filter functions used when data is being stored or retrieved from the database.

setFilters(array $aInFilters, array $aOutFilters) : void
Inherited

Examples:

$obj->setFilters(array('addslashes'), array('stripslashes'));
$obj->setFilters(array('htmlencode', 'addslashes'), array('stripslashes', 'htmlencode'));

inherited_from \Item::setFilters()

Parameters

$aInFilters

array

Array with function names

$aOutFilters

array

Array with function names

Sets a custom property.

setProperty(string $sType, string $sName, mixed $mValue) : bool
Inherited

inherited_from \Item::setProperty()

Parameters

$sType

string

Specifies the type

$sName

string

Specifies the name

$mValue

mixed

Specifies the value

Returns

bool

Store -DISABLED-

store() : \none

This Article Object is READ ONLY

access private

Returns

\none

Returns current item data as an assoziative array.

toArray() : array | false
Inherited

inherited_from \Item::toArray()

Returns

arrayfalse

Returns current item data as an object.

toObject() : \stdClass | false
Inherited

inherited_from \Item::toObject()

Returns

\stdClassfalse

Load the articles content and stores it in the 'content' property of the article object

_getArticleContent() : void

$article->content[type][number] = value;

Extract 'idartlang' for a specified 'idart' and 'lang'

_getIdArtLang(int $idart, int $lang) : int

access private

Parameters

$idart

int

Article id

$lang

int

Language id

Returns

intLanguage dependant article id

Returns properties instance, instantiates it if not done before.

_getPropertiesCollectionInstance() : \PropertyCollection
Inherited

inherited_from \Contenido_ItemBaseAbstract::_getPropertiesCollectionInstance()
inherited_from \Item::_getPropertiesCollectionInstance()

Returns

Returns the second database instance, usable to run additional statements without losing current query results.

_getSecondDBInstance() : \DB_Contenido
Inherited

inherited_from \Contenido_ItemBaseAbstract::_getSecondDBInstance()
inherited_from \Item::_getSecondDBInstance()

Returns

Loads an item by passed where clause from the database.

_loadByWhereClause(string $sWhere) : bool
Inherited

This function is expensive, since it executes allways a query to the database to retrieve the primary key, even if the record set is aleady cached. NOTE: Passed value has to be escaped before. This will not be done by this function.

inherited_from \Item::_loadByWhereClause()

Parameters

$sWhere

string

The where clause like 'idart = 123 AND idlang = 1'

Returns

boolTrue if the load was successful

Function which is called whenever an item is loaded.

_onLoad() : void
Inherited

Inherited classes should override this function if desired.

inherited_from \Item::_onLoad()

Filters the passed data using the functions defines in the _arrOutFilters array.

_outFilter(mixed $mData) : mixed
Inherited

see \setFilters
inherited_from \Item::_outFilter()

Parameters

$mData

mixed

Data to filter

Returns

mixedFiltered data

_setMetaObject()

_setMetaObject($sObjectName) 
Inherited

inherited_from \Item::_setMetaObject()

Parameters

$sObjectName

 Properties

 

Article content

$content : array

 

Storage of the primary key

$primaryKey : string
Inherited

inherited_from \Contenido_ItemBaseAbstract::$$primaryKey
inherited_from \Item::$$primaryKey
 

Config array

$tab : array

 

Storage of the source table to use for the user informations

$values : array
Inherited

inherited_from \Item::$$values
 

Checks for the virginity of created objects. If true, the object is virgin and no operations on it except load-Functions are allowed.

$virgin : bool
Inherited

inherited_from \Contenido_ItemBaseAbstract::$$virgin
inherited_from \Item::$$virgin
 

List of funcion names of the filters used when data is stored to the db.

$_arrInFilters : array
Inherited

inherited_from \Item::$$_arrInFilters
 

List of funcion names of the filtersused when data is retrieved from the db

$_arrOutFilters : array
Inherited

inherited_from \Item::$$_arrOutFilters
 

Classname of current instance

$_className : string
Inherited

inherited_from \Contenido_ItemBaseAbstract::$$_className
inherited_from \Item::$$_className
 

holds idartlang of article

$_iIdArtLang : int

 

Class name of meta object

$_metaObject : string
Inherited

inherited_from \Item::$$_metaObject
 

Item cache instance

$_oCache : \Contenido_ItemCache
Inherited

inherited_from \Contenido_ItemBaseAbstract::$$_oCache
inherited_from \Item::$$_oCache
 

GenericDB settings, see $cfg['sql']

$_settings : array
Inherited

inherited_from \Contenido_ItemBaseAbstract::$$_settings
inherited_from \Item::$$_settings
 

Cache the result items FIXME seems to not used, remove it!

$cache : array
Inherited

inherited_from \Contenido_ItemBaseAbstract::$$cache
inherited_from \Item::$$cache
 

Database instance, contains the database object

$db : \DB_Contenido
Inherited

inherited_from \Contenido_ItemBaseAbstract::$$db
inherited_from \Item::$$db
 

Storage of the last occured error

$lasterror : string
Inherited

inherited_from \Contenido_ItemBaseAbstract::$$lasterror
inherited_from \Item::$$lasterror
 

Lifetime of results/created objects? FIXME Not used at the moment!

$lifetime : int
Inherited

inherited_from \Contenido_ItemBaseAbstract::$$lifetime
inherited_from \Item::$$lifetime
 

Storage of the fields which were modified, where the keys are the fieldnames and the values just simple booleans.

$modifiedValues : array
Inherited

inherited_from \Item::$$modifiedValues
 

Stores the old primary key, just in case somebody wants to change it

$oldPrimaryKey : string
Inherited

inherited_from \Item::$$oldPrimaryKey
 

Property collection instance

$properties : \PropertyCollection
Inherited

inherited_from \Contenido_ItemBaseAbstract::$$properties
inherited_from \Item::$$properties
 

Second DB instance, is required for some additional queries without losing an current existing query result.

$secondDb : \DB_Contenido
Inherited

inherited_from \Contenido_ItemBaseAbstract::$$secondDb
inherited_from \Item::$$secondDb
 

Storage of the source table to use for the information

$table : string
Inherited

inherited_from \Contenido_ItemBaseAbstract::$$table
inherited_from \Item::$$table