PHP Class ArticleTypeField

Inheritance: extends DatabaseObject
Mostra file Open project: sourcefabric/newscoop Class Usage Examples

Public Properties

Property Type Description
$m_columnNames
$m_dbTableName
$m_keyColumnNames

Public Methods

Method Description
DatabaseTypes ( $p_numericDigits = null, $p_numericPrecision = null ) : array Returns an array of valid field data types.
FetchFields ( $p_name = null, $p_articleType = null, $p_dataType = null, $p_negateName = false, $p_negateArticleType = false, $p_negateDataType = false, $p_selectHidden = true, $p_skipCache = false ) : array Returns an array of fields from all article types that match the given conditions.
SetFieldColor ( $p_article_type, $p_field_name, $p_color_value )
TypesConvertibleFrom ( $p_type )
TypesConvertibleTo ( $p_type ) : array Returns an array of types compatible with the given field type.
VerboseTypeName ( $p_typeName, $p_languageId = 1, $p_rootTopicId = null ) : string Get a human-readable representation of the column type.
__construct ( $p_articleTypeName = null, $p_fieldName = null )
create ( string $p_type = null, array $p_params = [] ) Create a column in the table.
delete ( ) Deletes the current article type field.
fetch ( array $p_recordSet = null, $p_forceExists = false ) : boolean Fetch a single record from the database for the given key.
getArticleType ( ) : string Returns the article type name.
getColor ( )
getConvertibleFromTypes ( )
getConvertibleToTypes ( )
getDefaultColor ( )
getDisplayName ( $p_lang ) : string Gets the translation for a given language; default language is the session language. If no translation is set for that language, we return the dbTableName.
getDisplayNameLanguageCode ( $p_lang ) : string Gets the language code of the current translation language; or none if there is no translation.
getFilter ( ) : boolean Returns whether articles of this type should be filtered out by default at listings.
getGenericType ( ) fn getType
getMaxSize ( ) : integer Gets the maximum size of a article type
getMetadata ( ) : array Return an associative array of the metadata in ArticleFieldMetadata.
getName ( ) : string
getNextOrder ( ) : integer Returns the highest weight + 1 or 0 for the starter
getOrders ( ) : array Get the ordering of all fields; initially, a field has a field_weight of NULL when it is created. if we discover that a field has a field weight of NULL, we give it the MAX+1 field_weight. Returns a NUMERIC array of ORDER => FIELDNAME.
getPhraseId ( ) : -1
getPrintName ( ) : string
getStatus ( ) : string Returns the is_hidden status of a field. Returns 'hidden' or 'shown'.
getTopicTypeRootElement ( ) : string
getTranslations ( ) : array Returns an array of translation strings for the field name.
getType ( ) : string
getVerboseTypeName ( $p_languageId = 1 ) fn VerboseTypeName
isContent ( ) : boolean Returns true if the current field is a content field.
isConvertibleFrom ( $p_type ) : boolean Returns true if the given type can be converted to the current field type.
isConvertibleTo ( $p_type )
isHidden ( ) : boolean Returns true if the current field is hidden.
rename ( $p_newName ) Rename the article type field.
reorder ( $move ) Reorders the current field; accepts either "up" or "down"
setColor ( $p_color )
setFilter ( $p_filter ) : boolean Sets whether articles of this type should be filtered out by default at listings.
setIsContent ( $p_isContent ) : boolean Sets the content flag. Returns true on success, false otherwise.
setName ( integer $p_languageId, string $p_value ) : boolean Set the type name for the given language. A new entry in the database will be created if the language did not exist.
setOrders ( $orderArray ) Saves the ordering of all the fields. Accepts an NUMERIC array of ORDERRANK => FIELDNAME. (see getOrders)
setShowInEditor ( $p_showInEditor ) : integer Sets the int for where to show the field
setStatus ( $p_status )
setType ( $p_type ) Changes the type of the field
showInEditor ( ) : integer Returns int for where to show the field
translationExists ( $p_languageId ) Quick lookup to see if the current language is already translated for this article type: used by delete and update in setName returns 0 if no translation or the phrase_id if there is one.

Method Details

DatabaseTypes() public static method

Returns an array of valid field data types.
public static DatabaseTypes ( $p_numericDigits = null, $p_numericPrecision = null ) : array
return array

FetchFields() public static method

Returns an array of fields from all article types that match the given conditions.
public static FetchFields ( $p_name = null, $p_articleType = null, $p_dataType = null, $p_negateName = false, $p_negateArticleType = false, $p_negateDataType = false, $p_selectHidden = true, $p_skipCache = false ) : array
$p_name if specified returns fields with the given name
$p_articleType if specified returns fields of the given article type
$p_dataType if specified returns the fields having the given data type
return array

SetFieldColor() public static method

public static SetFieldColor ( $p_article_type, $p_field_name, $p_color_value )

TypesConvertibleFrom() public static method

public static TypesConvertibleFrom ( $p_type )

TypesConvertibleTo() public static method

Returns an array of types compatible with the given field type.
public static TypesConvertibleTo ( $p_type ) : array
return array

VerboseTypeName() public static method

Get a human-readable representation of the column type.
public static VerboseTypeName ( $p_typeName, $p_languageId = 1, $p_rootTopicId = null ) : string
return string

__construct() public method

public __construct ( $p_articleTypeName = null, $p_fieldName = null )

create() public method

Create a column in the table.
public create ( string $p_type = null, array $p_params = [] )
$p_type string Can be one of: 'text', 'date', 'body', 'switch', 'numeric'.
$p_params array

delete() public method

Deletes the current article type field.
public delete ( )

fetch() public method

Fetch a single record from the database for the given key.
public fetch ( array $p_recordSet = null, $p_forceExists = false ) : boolean
$p_recordSet array If the record has already been fetched and we just need to assign the data to the object's internal member variable.
return boolean TRUE on success, FALSE on failure

getArticleType() public method

Returns the article type name.
public getArticleType ( ) : string
return string

getColor() public method

public getColor ( )

getConvertibleFromTypes() public method

getConvertibleToTypes() public method

getDefaultColor() public static method

public static getDefaultColor ( )

getDisplayName() public method

Gets the translation for a given language; default language is the session language. If no translation is set for that language, we return the dbTableName.
public getDisplayName ( $p_lang ) : string
return string

getDisplayNameLanguageCode() public method

Gets the language code of the current translation language; or none if there is no translation.
public getDisplayNameLanguageCode ( $p_lang ) : string
return string

getFilter() public method

Returns whether articles of this type should be filtered out by default at listings.
public getFilter ( ) : boolean
return boolean

getGenericType() public method

fn getType
public getGenericType ( )

getMaxSize() public method

Gets the maximum size of a article type
public getMaxSize ( ) : integer
return integer

getMetadata() public method

Return an associative array of the metadata in ArticleFieldMetadata.
public getMetadata ( ) : array
return array

getName() public method

public getName ( ) : string
return string

getNextOrder() public method

Returns the highest weight + 1 or 0 for the starter
public getNextOrder ( ) : integer
return integer

getOrders() public method

Get the ordering of all fields; initially, a field has a field_weight of NULL when it is created. if we discover that a field has a field weight of NULL, we give it the MAX+1 field_weight. Returns a NUMERIC array of ORDER => FIELDNAME.
public getOrders ( ) : array
return array

getPhraseId() public method

public getPhraseId ( ) : -1
return -1

getPrintName() public method

public getPrintName ( ) : string
return string

getStatus() public method

Returns the is_hidden status of a field. Returns 'hidden' or 'shown'.
public getStatus ( ) : string
return string (shown|hidden)

getTopicTypeRootElement() public method

public getTopicTypeRootElement ( ) : string
return string

getTranslations() public method

Returns an array of translation strings for the field name.
public getTranslations ( ) : array
return array

getType() public method

public getType ( ) : string
return string

getVerboseTypeName() public method

fn VerboseTypeName
public getVerboseTypeName ( $p_languageId = 1 )

isContent() public method

Returns true if the current field is a content field.
public isContent ( ) : boolean
return boolean

isConvertibleFrom() public method

Returns true if the given type can be converted to the current field type.
public isConvertibleFrom ( $p_type ) : boolean
$p_type
return boolean

isConvertibleTo() public method

public isConvertibleTo ( $p_type )

isHidden() public method

Returns true if the current field is hidden.
public isHidden ( ) : boolean
return boolean

rename() public method

Rename the article type field.
public rename ( $p_newName )

reorder() public method

Reorders the current field; accepts either "up" or "down"
public reorder ( $move )

setColor() public method

public setColor ( $p_color )

setFilter() public method

Sets whether articles of this type should be filtered out by default at listings.
public setFilter ( $p_filter ) : boolean
return boolean

setIsContent() public method

Sets the content flag. Returns true on success, false otherwise.
public setIsContent ( $p_isContent ) : boolean
$p_isContent
return boolean

setName() public method

Set the type name for the given language. A new entry in the database will be created if the language did not exist.
public setName ( integer $p_languageId, string $p_value ) : boolean
$p_languageId integer
$p_value string
return boolean

setOrders() public method

Saves the ordering of all the fields. Accepts an NUMERIC array of ORDERRANK => FIELDNAME. (see getOrders)
public setOrders ( $orderArray )

setShowInEditor() public method

Sets the int for where to show the field
public setShowInEditor ( $p_showInEditor ) : integer
$p_showInEditor
return integer

setStatus() public method

public setStatus ( $p_status )

setType() public method

Changes the type of the field
public setType ( $p_type )

showInEditor() public method

Returns int for where to show the field
public showInEditor ( ) : integer
return integer

translationExists() public method

Quick lookup to see if the current language is already translated for this article type: used by delete and update in setName returns 0 if no translation or the phrase_id if there is one.
public translationExists ( $p_languageId )

Property Details

$m_columnNames public_oe property

public $m_columnNames

$m_dbTableName public_oe property

public $m_dbTableName

$m_keyColumnNames public_oe property

public $m_keyColumnNames