PHP Class ArticleImage

Copyright (C) 2005-2012 Leo Feyer
Author: Tim Gatzky ([email protected])
Inheritance: extends Frontend
Show file Open project: sourcefabric/newscoop Class Usage Examples

Public Properties

Property Type Description
$m_columnNames
$m_dbTableName
$m_image
$m_keyColumnNames

Public Methods

Method Description
AddImageToArticle ( integer $p_imageId, integer $p_articleNumber, integer $p_templateId = null ) : void Link the given image with the given article. The template ID is the image's position in the template.
ArticleImage ( integer $p_articleNumber = null, integer $p_imageId = null, integer $p_templateId = null ) : ArticleImage The ArticleImage table links together Articles with Images.
GetArticlesThatUseImage ( $p_imageId ) : array Return an array of Article objects, all the articles which use this image.
GetImagesByArticleNumber ( integer $p_articleNumber, boolean $p_countOnly = false ) : mixed Get all the images that belong to this article.
GetList ( array $p_parameters, array $p_order = [], integer $p_start, integer $p_limit, integer &$p_count, $p_skipCache = false ) : array Returns an article images list based on the given parameters.
GetUnusedTemplateId ( integer $p_articleNumber ) Get a free Template ID.
OnArticleCopy ( integer $p_srcArticleNumber, integer $p_destArticleNumber ) : void Copy all the pointers for the given article.
OnArticleDelete ( integer $p_articleNumber ) : void Remove image pointers for the given article.
OnImageDelete ( integer $p_imageId ) : void This is called when an image is deleted.
RemoveImageTagsFromArticleText ( integer $p_articleNumber, integer $p_templateId ) : void Remove the image tags in the article text.
TemplateIdInUse ( integer $p_articleNumber, integer $p_templateId ) : boolean Return true if article already is using the given template ID, false otherwise.
delete ( ) : boolean Remove the linkage between the given image and the given article and remove the image tags from the article text.
getArticleNumber ( ) : integer
getImage ( ) Return an Image object.
getImageArticleIndex ( ) : integer
getImageId ( ) : integer
getTemplateId ( ) : integer
setProperty ( $p_dbColumnName, $p_value, $p_commit = true, $p_isSql = false ) Wrapper around DatabaseObject::setProperty
setTemplateId ( integer $p_templateId ) : boolean This call will only work for entries that already exist.

Private Methods

Method Description
ProcessListOrder ( array $p_order ) : array Processes an order directive coming from template tags.
ProcessListParameters ( array $p_param ) : array Processes a paremeter (condition) coming from template tags.

Method Details

AddImageToArticle() public static method

Link the given image with the given article. The template ID is the image's position in the template.
public static AddImageToArticle ( integer $p_imageId, integer $p_articleNumber, integer $p_templateId = null ) : void
$p_imageId integer
$p_articleNumber integer
$p_templateId integer Optional. If not specified, this will be the next highest number of the existing values.
return void

ArticleImage() public method

The ArticleImage table links together Articles with Images.
public ArticleImage ( integer $p_articleNumber = null, integer $p_imageId = null, integer $p_templateId = null ) : ArticleImage
$p_articleNumber integer
$p_imageId integer
$p_templateId integer
return ArticleImage

GetArticlesThatUseImage() public static method

Return an array of Article objects, all the articles which use this image.
public static GetArticlesThatUseImage ( $p_imageId ) : array
return array

GetImagesByArticleNumber() public static method

Get all the images that belong to this article.
public static GetImagesByArticleNumber ( integer $p_articleNumber, boolean $p_countOnly = false ) : mixed
$p_articleNumber integer The specific article you want the images from.
$p_countOnly boolean Only return the number of images in the article.
return mixed Return either an array or an int.

GetList() public static method

Returns an article images list based on the given parameters.
public static GetList ( array $p_parameters, array $p_order = [], integer $p_start, integer $p_limit, integer &$p_count, $p_skipCache = false ) : array
$p_parameters array An array of ComparisonOperation objects
$p_order array An array of columns and directions to order by
$p_start integer The record number to start the list
$p_limit integer The offset. How many records from $p_start will be retrieved.
$p_count integer The total count of the elements; this count is computed without applying the start ($p_start) and limit parameters ($p_limit)
return array $articleImagesList An array of Image objects

GetUnusedTemplateId() public static method

Get a free Template ID.
public static GetUnusedTemplateId ( integer $p_articleNumber )
$p_articleNumber integer

OnArticleCopy() public static method

Copy all the pointers for the given article.
public static OnArticleCopy ( integer $p_srcArticleNumber, integer $p_destArticleNumber ) : void
$p_srcArticleNumber integer
$p_destArticleNumber integer
return void

OnArticleDelete() public static method

Remove image pointers for the given article.
public static OnArticleDelete ( integer $p_articleNumber ) : void
$p_articleNumber integer
return void

OnImageDelete() public static method

It will disassociate the image from all articles.
public static OnImageDelete ( integer $p_imageId ) : void
$p_imageId integer
return void

RemoveImageTagsFromArticleText() public static method

Remove the image tags in the article text.
public static RemoveImageTagsFromArticleText ( integer $p_articleNumber, integer $p_templateId ) : void
$p_articleNumber integer
$p_templateId integer
return void

TemplateIdInUse() public static method

Return true if article already is using the given template ID, false otherwise.
public static TemplateIdInUse ( integer $p_articleNumber, integer $p_templateId ) : boolean
$p_articleNumber integer
$p_templateId integer
return boolean

delete() public method

Remove the linkage between the given image and the given article and remove the image tags from the article text.
public delete ( ) : boolean
return boolean

getArticleNumber() public method

public getArticleNumber ( ) : integer
return integer

getImage() public method

Return an Image object.
public getImage ( )

getImageArticleIndex() public method

public getImageArticleIndex ( ) : integer
return integer

getImageId() public method

public getImageId ( ) : integer
return integer

getTemplateId() public method

public getTemplateId ( ) : integer
return integer

setProperty() public method

Wrapper around DatabaseObject::setProperty
public setProperty ( $p_dbColumnName, $p_value, $p_commit = true, $p_isSql = false )

setTemplateId() public method

This call will only work for entries that already exist.
public setTemplateId ( integer $p_templateId ) : boolean
$p_templateId integer
return boolean

Property Details

$m_columnNames public property

public $m_columnNames

$m_dbTableName public property

public $m_dbTableName

$m_image public property

public $m_image

$m_keyColumnNames public property

public $m_keyColumnNames